import type { TAggregateResult, TAggregation, TCollectionName, TFieldName, TFilter, TPaginatedFilter, TPartialSimpleRow, TRow, TSchema } from '../../templates'; import type { ActionFormElement, ActionResult, Caller, Collection, CollectionSchema, RecordData } from '@forestadmin/datasource-toolkit'; /** Collection wrapper which accepts plain objects in all methods */ export default class RelaxedCollection = TCollectionName> { private collection; private caller; get nativeDriver(): any; get schema(): CollectionSchema; constructor(collection: Collection, caller: Caller); /** * Execute a given action * @param name the name of the action * @param formValues the values of the form, if the action rely on an action form * @param filter the filter used to represent the selected records to use the action on * @example * .execute( * 'Refund', * { reason: 'Article is broken' }, * { * conditionTree: { * field: 'id', * operator: 'Equal', * value: 1 * } * } * ); */ execute(name: string, formValues: RecordData, filter?: TFilter): Promise; getForm(name: string, formValues?: RecordData, filter?: TFilter): Promise; /** * Create a list of records * @param data An array of records to create * @example * .create([ * { amountInEur: 150, description: 'Buy dvd' }, * { amountInEur: -100, description: 'Refund' }, * ]); */ create(data: TPartialSimpleRow[]): Promise[]>; /** * List multiple records * @param filter the filter used to select the records to list * @param projection an array of fields name representing the data to select * @example * .list({ * conditionTree: { * aggregator: 'And', * conditions: [{ * field: 'amountInEur', * operator: 'GreaterThan', * value: 1000 * }, { * field: 'description', * operator: 'Contains', * value: 'Refund', * }], * page: { limit: 10, skip: 0 }, * sort: [{ field: 'id', ascending: true }] * } * }, ['id', 'amountInEur', 'description']); */ list(filter: TPaginatedFilter, projection: TFieldName[]): Promise[]>; /** * Update a list of records * @param filter the filter that represent the list of records to update * @param patch the patch to apply on the selected records * @example * .update({ * conditionTree: { * field: 'isActive', * operator: 'Equal', * value: false * }, * }, { isActive: true }); */ update(filter: TFilter, patch: TPartialSimpleRow): Promise; /** * Delete a list of records * @param filter the filter that represent the list of records to update * @example * .delete({ * conditionTree: { * field: 'isBlocked', * operator: 'Equal', * value: false, * }, * }); */ delete(filter: TFilter): Promise; /** * Aggregate a list of records * @param filter the filter used to list the records to aggregate * @param aggregation the aggregation to apply * @param limit the maximum number of result to return * @example * .aggregate({ * conditionTree: { * field: "user:company:id", * operator: "In", * value: records.map((r) => r.id), * }, * }, { * operation: "Sum", * field: "amountInEur", * groups: [{ field: "user:company:id" }], * }, 10); */ aggregate(filter: TFilter, aggregation: TAggregation, limit?: number): Promise[]>; private buildFilter; private buildPaginatedFilter; private buildProjection; private buildAggregation; } //# sourceMappingURL=collection.d.ts.map