22 lines
981 B
TypeScript
22 lines
981 B
TypeScript
// ---------------------------------------------------------------------------
|
|
// AnyDB Client Stub — auto-included in every AUTO_DB React project
|
|
// ---------------------------------------------------------------------------
|
|
// When AnyDB is connected, this file is replaced by the real client
|
|
// generated by anydbService.getClientCode(). Until then, this stub
|
|
// returns empty results so components don't crash.
|
|
// ---------------------------------------------------------------------------
|
|
|
|
const STUB_COLLECTION = {
|
|
find: async (_filter?: any, _opts?: any) => ({ data: [], total: 0, page: 1, limit: 50, pages: 0 }),
|
|
insertOne: async (doc: any) => ({ ...doc, _id: `stub_${Date.now()}` }),
|
|
updateOne: async (_filter: any, _update: any) => ({ modifiedCount: 0 }),
|
|
deleteOne: async (_filter: any) => ({ deletedCount: 0 }),
|
|
aggregate: async (_pipeline: any[]) => [],
|
|
};
|
|
|
|
const anydb = {
|
|
collection: async (_name: string) => STUB_COLLECTION,
|
|
};
|
|
|
|
export default anydb;
|