@dataql/node
Version:
DataQL core SDK for unified data management with MongoDB and GraphQL - Production Multi-Cloud Ready
52 lines (51 loc) • 2.2 kB
TypeScript
export interface SubdocumentOperations {
create(data: any): Promise<any>;
createUnique(data: any): Promise<{
result?: any;
isExisting?: boolean;
}>;
find(filter?: any): Promise<any[]>;
update(filter: any, update: any): Promise<any>;
delete(filter: any): Promise<any>;
updateMany(filter: any, update: any): Promise<any>;
deleteMany(filter: any): Promise<any>;
}
export declare class SubdocumentCollection implements SubdocumentOperations {
private collectionName;
private parentFilter;
private subdocumentPath;
private schema;
private fetchFunction;
private appToken;
private ensureSession;
constructor(collectionName: string, parentFilter: any, subdocumentPath: string, schema: any, fetchFunction: (url: string, options: RequestInit) => Promise<Response>, appToken: string, ensureSession: () => Promise<string>);
private getWorkerUrl;
create(data: any): Promise<any>;
createUnique(data: any): Promise<{
result?: any;
isExisting?: boolean;
}>;
find(filter?: any): Promise<any[]>;
update(filter: any, update: any): Promise<any>;
delete(filter: any): Promise<any>;
updateMany(filter: any, update: any): Promise<any>;
deleteMany(filter: any): Promise<any>;
}
export declare class DocumentScope {
private collectionName;
private parentFilter;
private schema;
private fetchFunction;
private appToken;
private ensureSession;
subdocuments: Record<string, SubdocumentCollection>;
constructor(collectionName: string, parentFilter: any, schema: any, fetchFunction: (url: string, options: RequestInit) => Promise<Response>, appToken: string, ensureSession: () => Promise<string>);
private initializeSubdocuments;
private analyzeSchemaForSubdocuments;
private isSubdocumentArray;
private isNestedObject;
private createNestedProxy;
private getWorkerUrl;
[key: string]: any;
}
export declare function createDocumentScope(collectionName: string, parentFilter: any, schema: any, fetchFunction: (url: string, options: RequestInit) => Promise<Response>, appToken: string, ensureSession: () => Promise<string>): DocumentScope;