import { ServicePluginDefinition } from '@wix/sdk-types'; import { Context, QueryDataItemsRequest, QueryDataItemsResponse, CountDataItemsRequest, CountDataItemsResponse, AggregateDataItemsRequest, AggregateDataItemsResponse, QueryDistinctValuesRequest, QueryDistinctValuesResponse, InsertDataItemsRequest, InsertDataItemsResponse, UpdateDataItemsRequest, UpdateDataItemsResponse, RemoveDataItemsRequest, RemoveDataItemsResponse, TruncateDataItemsRequest, TruncateDataItemsResponse, QueryReferencedDataItemsRequest, QueryReferencedDataItemsResponse, InsertDataItemReferencesRequest, InsertDataItemReferencesResponse, RemoveDataItemReferencesRequest, RemoveDataItemReferencesResponse, ListCollectionsRequest, ListCollectionsResponse, CreateCollectionRequest, CreateCollectionResponse, UpdateCollectionRequest, UpdateCollectionResponse, DeleteCollectionRequest, DeleteCollectionResponse, GetCapabilitiesRequest, GetCapabilitiesResponse } from './service-plugins-types.js'; export interface QueryDataItemsEnvelope { request: QueryDataItemsRequest; metadata: Context; } export interface CountDataItemsEnvelope { request: CountDataItemsRequest; metadata: Context; } export interface AggregateDataItemsEnvelope { request: AggregateDataItemsRequest; metadata: Context; } export interface QueryDistinctValuesEnvelope { request: QueryDistinctValuesRequest; metadata: Context; } export interface InsertDataItemsEnvelope { request: InsertDataItemsRequest; metadata: Context; } export interface UpdateDataItemsEnvelope { request: UpdateDataItemsRequest; metadata: Context; } export interface RemoveDataItemsEnvelope { request: RemoveDataItemsRequest; metadata: Context; } export interface TruncateDataItemsEnvelope { request: TruncateDataItemsRequest; metadata: Context; } export interface QueryReferencedDataItemsEnvelope { request: QueryReferencedDataItemsRequest; metadata: Context; } export interface InsertDataItemReferencesEnvelope { request: InsertDataItemReferencesRequest; metadata: Context; } export interface RemoveDataItemReferencesEnvelope { request: RemoveDataItemReferencesRequest; metadata: Context; } export interface ListCollectionsEnvelope { request: ListCollectionsRequest; metadata: Context; } export interface CreateCollectionEnvelope { request: CreateCollectionRequest; metadata: Context; } export interface UpdateCollectionEnvelope { request: UpdateCollectionRequest; metadata: Context; } export interface DeleteCollectionEnvelope { request: DeleteCollectionRequest; metadata: Context; } export interface GetCapabilitiesEnvelope { request: GetCapabilitiesRequest; metadata: Context; } export declare const provideHandlers: ServicePluginDefinition<{ /** * * Retrieves a list of items based on the provided filtering, sorting, and paging preferences. */ queryDataItems(payload: QueryDataItemsEnvelope): QueryDataItemsResponse | Promise; /** * Counts the number of items in the specified data collection that match the filtering preferences. */ countDataItems(payload: CountDataItemsEnvelope): CountDataItemsResponse | Promise; /** * Runs an aggregation query on the specified data collection and returns the resulting list of items. */ aggregateDataItems(payload: AggregateDataItemsEnvelope): AggregateDataItemsResponse | Promise; /** * * Retrieves a list of distinct values for a given field for all items that match the query, without duplicates. * * As with [`queryDataItems()`](/external-database/query-data-items), this function retrieves items based on the filtering, sorting, and paging preferences provided. However, this function does not return the full items that match the query. Rather, for items that match the query, it returns all unique values in the field specified in `fieldName`. If more than one item has the same value in that field, that value appears only once. */ queryDistinctValues(payload: QueryDistinctValuesEnvelope): QueryDistinctValuesResponse | Promise; /** * * Adds one or more items to a collection. * * A data item object contains the `_id` and `_owner` fields. The response array must include the same items that were inserted, and each returned item must be added the `_createdDate` and `_updatedDate` fields. * * However, data items can also be inserted without an `_id` field. In that case, it is the service provider's responsibility to generate a unique ID for each item. */ insertDataItems(payload: InsertDataItemsEnvelope): InsertDataItemsResponse | Promise; /** * * Updates one or more items in a collection. Items must be completely replaced. * * The response array must include the same items that were updated, and each returned item must be added the `_createdDate` and `_updatedDate` fields. */ updateDataItems(payload: UpdateDataItemsEnvelope): UpdateDataItemsResponse | Promise; /** * Removes one or more items from a collection. The response object must contain the removed item. */ removeDataItems(payload: RemoveDataItemsEnvelope): RemoveDataItemsResponse | Promise; /** * Removes all items from a collection. */ truncateDataItems(payload: TruncateDataItemsEnvelope): TruncateDataItemsResponse | Promise; /** * * Retrieves the items referenced in the specified field of a referring item. Reference fields refer to items that exist in different collections. Implement this function so callers can retrieve the full details of the referenced items. * * This service plugin supports item multi-references, which means that data collections can have many-to-many relationships with other collections. For example, consider a scenario where a **Movies** collection includes a multi-reference **Actors** field, which might refer to several **Actor** items in an **Actors** collection. Users can therefore query the **Movies** collection to retrieve the **Actor** items referenced in each **Movie** item. * * > **Notes:** * > - This function does not retrieve the full referenced items of referenced items. For example, the referenced **Actors** collection might itself contain a multi-reference field with references to **Award** items in an **Awards** collection. When calling this function to retrieve the referenced items of any **Movie** item, the response contains the referenced **Actor** items, but only the IDs of the **Award** items. To retrieve the full **Award** items, the user must either call this function for the **Actors** collection, or the [`queryDataItems()`](/external-database/query-data-items) function for the **Awards** collection. * > - This function might also be called when a user calls the [`isReferenced()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/is-referenced-data-item) function of the Data API. */ queryReferencedDataItems(payload: QueryReferencedDataItemsEnvelope): QueryReferencedDataItemsResponse | Promise; /** * Inserts one or more item references into a referring field of the specified item. */ insertDataItemReferences(payload: InsertDataItemReferencesEnvelope): InsertDataItemReferencesResponse | Promise; /** * Removes one or more item references from a referring field of the specified item. */ removeDataItemReferences(payload: RemoveDataItemReferencesEnvelope): RemoveDataItemReferencesResponse | Promise; /** * * Retrieves a list of data collections and their details. * * When `collectionIds` is empty, all existing collections are returned. * If a specified collection does not exist, that collection can be ignored. */ listCollections(payload: ListCollectionsEnvelope): ListCollectionsResponse | Promise; /** * Creates a new data collection. */ createCollection(payload: CreateCollectionEnvelope): CreateCollectionResponse | Promise; /** * * Updates the structure of an existing data collection. * * Some parameters, such as `capabilities` and `pagingMode`, are determined by the service provider. If the collection passed in the request contains these parameters, their values must be ignored. However, these fields must be included in the response collection with relevant values. */ updateCollection(payload: UpdateCollectionEnvelope): UpdateCollectionResponse | Promise; /** * Deletes a data collection. */ deleteCollection(payload: DeleteCollectionEnvelope): DeleteCollectionResponse | Promise; /** * Lists the global capabilities the external database supports. */ getCapabilities(payload: GetCapabilitiesEnvelope): GetCapabilitiesResponse | Promise; }>;