// @flow export type SchemaType = any; export type StorageClass = any; export type QueryType = any; export type QueryOptions = { skip?: number, limit?: number, acl?: string[], sort?: { [string]: number }, count?: boolean | number, keys?: string[], op?: string, distinct?: boolean, pipeline?: any, readPreference?: ?string, hint?: ?mixed, explain?: Boolean, caseInsensitive?: boolean, action?: string, addsField?: boolean, comment?: string, }; export type UpdateQueryOptions = { many?: boolean, upsert?: boolean, }; export type FullQueryOptions = QueryOptions & UpdateQueryOptions; export interface StorageAdapter { canSortOnJoinTables: boolean; schemaCacheTtl: ?number; enableSchemaHooks: boolean; classExists(className: string): Promise; setClassLevelPermissions(className: string, clps: any): Promise; createClass(className: string, schema: SchemaType): Promise; addFieldIfNotExists(className: string, fieldName: string, type: any): Promise; updateFieldOptions(className: string, fieldName: string, type: any): Promise; deleteClass(className: string): Promise; deleteAllClasses(fast: boolean): Promise; deleteFields(className: string, schema: SchemaType, fieldNames: Array): Promise; getAllClasses(): Promise; getClass(className: string): Promise; createObject( className: string, schema: SchemaType, object: any, transactionalSession: ?any ): Promise; deleteObjectsByQuery( className: string, schema: SchemaType, query: QueryType, transactionalSession: ?any ): Promise; updateObjectsByQuery( className: string, schema: SchemaType, query: QueryType, update: any, transactionalSession: ?any ): Promise<[any]>; findOneAndUpdate( className: string, schema: SchemaType, query: QueryType, update: any, transactionalSession: ?any ): Promise; upsertOneObject( className: string, schema: SchemaType, query: QueryType, update: any, transactionalSession: ?any ): Promise; find( className: string, schema: SchemaType, query: QueryType, options: QueryOptions ): Promise<[any]>; ensureIndex( className: string, schema: SchemaType, fieldNames: string[], indexName?: string, caseSensitive?: boolean, options?: Object ): Promise; ensureUniqueness(className: string, schema: SchemaType, fieldNames: Array): Promise; count( className: string, schema: SchemaType, query: QueryType, readPreference?: string, estimate?: boolean, hint?: mixed, comment?: string ): Promise; distinct( className: string, schema: SchemaType, query: QueryType, fieldName: string ): Promise; aggregate( className: string, schema: any, pipeline: any, readPreference: ?string, hint: ?mixed, explain?: boolean, comment?: string ): Promise; performInitialization(options: ?any): Promise; watch(callback: () => void): void; // Indexing createIndexes(className: string, indexes: any, conn: ?any): Promise; getIndexes(className: string, connection: ?any): Promise; updateSchemaWithIndexes(): Promise; setIndexesWithSchemaFormat( className: string, submittedIndexes: any, existingIndexes: any, fields: any, conn: ?any ): Promise; createTransactionalSession(): Promise; commitTransactionalSession(transactionalSession: any): Promise; abortTransactionalSession(transactionalSession: any): Promise; }