import { AdminForthResource, IAdminForthDataSourceConnectorBase, AdminForthResourceColumn, IAdminForthSort, IAdminForthSingleFilter, IAdminForthAndOrFilter, AdminForthConfig, IAggregationRule, IGroupByRule } from "../types/Back.js"; import { AdminForthSortDirections } from "../types/Common.js"; type AdminForthFilterNode = IAdminForthSingleFilter | IAdminForthAndOrFilter; type AdminForthFilterInput = AdminForthFilterNode | AdminForthFilterNode[]; type AggregateGroupByInput = IGroupByRule | IGroupByRule[] | undefined; type AdminForthFilterNormalizationResult = { ok: boolean; error: string; normalizedFilters?: AdminForthFilterInput; }; export default class AdminForthBaseConnector implements IAdminForthDataSourceConnectorBase { client: any; /** * @deprecated Since 1.2.9. Will be removed in 4.0.0. Use .client instead. */ get db(): any; setupClient(url: string, options?: { recovery?: boolean; }): Promise; /** * Set to true in connector which is able to update/delete records of resources with composite primary key * (i.e. which uses pkValues argument of updateRecordOriginalValues/deleteRecord instead of getPrimaryKey()). */ supportsCompositePrimaryKey: boolean; /** * Returns name of first primary key column. * For resources with composite primary key use {@link getPrimaryKeys} instead. */ getPrimaryKey(resource: AdminForthResource): string; /** * Returns names of all primary key columns (more then one for resources with composite primary key) */ getPrimaryKeys(resource: AdminForthResource): string[]; /** * Splits recordId into values of primary key columns, casted to types which data source understands. * For resource with single primary key returns object with one key. */ getPrimaryKeyValues(resource: AdminForthResource, recordId: any): Record; /** * Parts of composite record id always come as strings (they are parsed out of url or API payload), * so cast them to JS types which validateAndSetFieldValue expects for the column type. */ castRecordIdPart(column: AdminForthResourceColumn, value: any): any; /** * Filter which excludes record with given composite primary key: * record differs from given one if at least one of primary key columns differs. */ compositeOtherRecordFilter(resource: AdminForthResource, record: any): AdminForthFilterNode; /** * Builds filters which select exactly one record by recordId */ getPrimaryKeyFilters(resource: AdminForthResource, recordId: any): IAdminForthSingleFilter[]; getRecordByPrimaryKeyWithOriginalTypes(resource: AdminForthResource, id: string): Promise; cloneFilterNode(filter: AdminForthFilterNode): AdminForthFilterNode; validateAndNormalizeInputFilters(filter: IAdminForthSingleFilter | IAdminForthAndOrFilter | Array | undefined): IAdminForthAndOrFilter; validateAndNormalizeFilters(filters: AdminForthFilterInput, resource: AdminForthResource): AdminForthFilterNormalizationResult; getDataWithOriginalTypes({ resource, limit, offset, sort, filters, columns }: { resource: AdminForthResource; limit: number; offset: number; sort: IAdminForthSort[]; filters: IAdminForthAndOrFilter; columns?: AdminForthResourceColumn[]; }): Promise; getAggregateWithOriginalTypes({ resource, filters, aggregations, groupBy }: { resource: AdminForthResource; filters: IAdminForthAndOrFilter; aggregations: { [alias: string]: IAggregationRule; }; groupBy?: AggregateGroupByInput; }): Promise>; normalizeGroupByRules(groupBy?: AggregateGroupByInput): IGroupByRule[]; getGroupByResultAlias(groupBy: IGroupByRule, index: number, total: number): string; private validateAggregateParams; aggregate({ resource, filters, aggregations, groupBy }: { resource: AdminForthResource; filters: IAdminForthAndOrFilter; aggregations: { [alias: string]: IAggregationRule; }; groupBy?: AggregateGroupByInput; }): Promise>; getCount({ resource, filters }: { resource: AdminForthResource; filters: IAdminForthAndOrFilter; }): Promise; discoverFields(resource: AdminForthResource, config: AdminForthConfig): Promise<{ [key: string]: AdminForthResourceColumn; }>; getFieldValue(field: AdminForthResourceColumn, value: any): void; setFieldValue(field: AdminForthResourceColumn, value: any): void; validateAndSetFieldValue(field: AdminForthResourceColumn, value: any): any; getMinMaxForColumnsWithOriginalTypes({ resource, columns }: { resource: AdminForthResource; columns: AdminForthResourceColumn[]; }): Promise<{ [key: string]: { min: any; max: any; }; }>; createRecordOriginalValues({ resource, record }: { resource: AdminForthResource; record: any; }): Promise; checkUnique(resource: AdminForthResource, column: AdminForthResourceColumn, value: any, record?: any): Promise; createRecord({ resource, record, adminUser }: { resource: AdminForthResource; record: any; adminUser: any; }): Promise<{ error?: string; ok: boolean; createdRecord?: any; }>; updateRecordOriginalValues({ resource, recordId, newValues, pkValues }: { resource: AdminForthResource; recordId: string; newValues: any; pkValues?: Record; }): Promise; updateRecord({ resource, recordId, newValues }: { resource: AdminForthResource; recordId: string; newValues: any; }): Promise<{ error?: string; ok: boolean; }>; deleteRecord({ resource, recordId, pkValues }: { resource: AdminForthResource; recordId: string; pkValues?: Record; }): Promise; /** * Throws readable error if resource uses composite primary key but connector can't handle it */ assertCompositePrimaryKeySupported(resource: AdminForthResource): void; getData({ resource, limit, offset, sort, filters, getTotals, columns }: { resource: AdminForthResource; limit: number; offset: number; sort: { field: string; direction: AdminForthSortDirections; }[]; filters: IAdminForthAndOrFilter; getTotals: boolean; columns?: AdminForthResourceColumn[]; }): Promise<{ data: any[]; total: number; }>; getMinMaxForColumns({ resource, columns }: { resource: AdminForthResource; columns: AdminForthResourceColumn[]; }): Promise<{ [key: string]: { min: any; max: any; }; }>; getRecordByPrimaryKey(resource: AdminForthResource, recordId: string): Promise; getAllTables(): Promise; getAllColumnsInTable(tableName: string): Promise>; isDatabaseEmpty(): Promise; } export {}; //# sourceMappingURL=baseConnector.d.ts.map