@wix/wix-data-items-sdk 1.0.529 → 1.0.531

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,10 @@ import { DataItemCreatedEnvelope, DataItemDeletedEnvelope, DataItemUpdatedEnvelo
18
18
  *
19
19
  * When inserting an item into a collection that has a reference field, set the
20
20
  * value of the reference field to the referenced item's `_id` value or the entire referenced item object.
21
+ * When inserting an item into a collection that has a multi-reference field, set the
22
+ * value of the multi-reference field to an array of the referenced items' `_id` values or an array of the
23
+ * entire referenced item objects.
24
+ * To save multi-reference values, pass `saveReferences: true` in the `options` argument.
21
25
  *
22
26
  * The `insert()` method adds the following properties and values to the item
23
27
  * when it adds it to the collection:
@@ -37,7 +41,6 @@ import { DataItemCreatedEnvelope, DataItemDeletedEnvelope, DataItemUpdatedEnvelo
37
41
  * > - If an item's `_id` property value is set to `null` or an empty string, an error is thrown.
38
42
  * > - When creating a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection), an item with the system field `_id` is pre-inserted into the collection. [Single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection) may contain only one item.
39
43
  * > - If there is a pre-existing item in a [single-item collection](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection), the `insert()` method will not run. To update or change an item in a single-item collection see the `update()` and `save()` methods.
40
- * > - The `insert()` method does not support multi-reference fields. For multi-reference fields, use `insertReference()`.
41
44
  * > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `insert()` fails and issues an error.
42
45
  * @public
43
46
  * @param dataCollectionId - ID of the collection item belongs to.
@@ -76,12 +79,15 @@ export declare function insert<Item extends Record<string, any>>(dataCollectionI
76
79
  * When updating an item in a collection that has a reference field, set the
77
80
  * value of the reference field to the referenced item's `_id` value or the
78
81
  * entire referenced item object.
82
+ * When updating an item in a collection that has a multi-reference field, set the
83
+ * value of the multi-reference field to an array of the referenced items' `_id` values or an array of the
84
+ * entire referenced item objects.
85
+ * To save multi-reference values, pass `saveReferences: true` in the `options` argument.
79
86
  *
80
87
  * The maximum size of an item that you can update in a collection is 500kb.
81
88
  *
82
89
  * > **Notes:**
83
90
  * > - The specified item must include an `_id` property that already exists in the collection.
84
- * > - The `update()` method does not support multi-reference fields. For multi-reference fields, use `replaceReferences()` or `insertReference()`.
85
91
  * > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `update()` fails and issues an error.
86
92
  *
87
93
  * @param dataCollectionId - ID of the collection item belongs to.
@@ -120,11 +126,14 @@ export declare function update<Item extends WithId>(dataCollectionId: string, it
120
126
  * When saving an item to a collection that has a reference field, set the
121
127
  * value of the reference field to the referenced item's `_id` value or the
122
128
  * entire referenced item object.
129
+ * When saving an item to a collection that has a multi-reference field, set the
130
+ * value of the multi-reference field to an array of the referenced items' `_id` values or an array of the
131
+ * entire referenced item objects.
132
+ * To save multi-reference values, pass `saveReferences: true` in the `options` argument.
123
133
  *
124
134
  * > **Notes:**
125
135
  * > - The maximum size of an item that you can save to a collection is 500kb.
126
136
  * > - If an item's `_id` property value is set to null or an empty string, an error is thrown.
127
- * > - The `save()` method does not support multi-reference fields. For multi-reference fields, use `insertReference() `or `replaceReferences()`.
128
137
  * > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `save()` fails and issues an error.
129
138
  *
130
139
  * @public
@@ -232,6 +241,10 @@ export declare function truncate(dataCollectionId: string): Promise<void>;
232
241
  * When inserting items into a collection that has a reference field, set the
233
242
  * values of the reference fields to the referenced item's `_id` value or the
234
243
  * entire referenced item object.
244
+ * When inserting items into a collection that has a multi-reference field, set the
245
+ * values of the multi-reference fields to arrays of the referenced items' `_id` values or arrays of the
246
+ * entire referenced item objects.
247
+ * To save multi-reference values, pass `saveReferences: true` in the `options` argument.
235
248
  *
236
249
  * The `bulkInsert()` method adds the following properties and values to the
237
250
  * item when it adds it to the collection:
@@ -254,7 +267,6 @@ export declare function truncate(dataCollectionId: string): Promise<void>;
254
267
  * > - If an item's `_id` property value is set to `null` or an empty string, an error is thrown.
255
268
  * > - Bulk operations are limited to 1000 items per method call.
256
269
  * > - The `bulkInsert()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
257
- * > - The `bulkInsert()` method does not support multi-reference fields. For multi-reference fields, use `insertReference()`.
258
270
  * > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `bulkInsert()` fails and issues an error.
259
271
  * @public
260
272
  * @documentationMaturity preview
@@ -296,11 +308,14 @@ export declare function bulkInsert<Item extends Record<string, any>>(dataCollect
296
308
  * When updating items in a collection that has a reference field, set the
297
309
  * values of the reference field to the referenced item's `_id` value or the
298
310
  * entire referenced item object.
311
+ * When updating items in a collection that has a multi-reference field, set the
312
+ * values of the multi-reference field to arrays of the referenced items' `_id` values or arrays of the
313
+ * entire referenced item objects.
314
+ * To save multi-reference values, pass `saveReferences: true` in the `options` argument.
299
315
  *
300
316
  * > **Notes:**
301
317
  * > - The maximum size of an item that you can update in a collection is 500kb.
302
318
  * > - Bulk operations are limited to 1000 items per method call.
303
- * > - The `bulkUpdate()` method does not support multi-reference fields. For multi-reference fields, use `replaceReferences()` or `insertReference()`.
304
319
  * > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `bulkUpdate()` fails and issues an error.
305
320
  *
306
321
  * @public
@@ -340,13 +355,16 @@ export declare function bulkUpdate<Item extends WithId>(dataCollectionId: string
340
355
  * When saving items to a collection that has a reference field, set the values
341
356
  * of the reference fields to the referenced item's `_id` value or the entire
342
357
  * referenced item object.
358
+ * When saving items to a collection that has a multi-reference field, set the
359
+ * values of the multi-reference fields to arrays of the referenced items' `_id` values or arrays of the
360
+ * entire referenced item objects.
361
+ * To save multi-reference values, pass `saveReferences: true` in the `options` argument.
343
362
  *
344
363
  * > **Notes:**
345
364
  * > - The maximum size of an item that you can save to a collection is 500kb.
346
365
  * > - If an item's `_id` property value is set to null or an empty string, an error is thrown.
347
366
  * > - Bulk operations are limited to 1000 items per method call.
348
367
  * > - The `bulkSave()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
349
- * > - The `bulkSave()` method does not support multi-reference fields. For multi-reference fields, use `replaceReferences()` or `insertReference()`.
350
368
  * > - [Translatable collections](https://support.wix.com/en/article/wix-multilingual-translating-cms-collection-content) do not allow insertion and modification of items when working in a non-primary language. For example, if a collection's primary language is English, and the site visitor is viewing the site in French, calling `bulkSave()` fails and issues an error.
351
369
  *
352
370
  * @public
@@ -497,13 +515,9 @@ export declare function removeReference<ItemLeft extends WithId, ItemRight exten
497
515
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.ReplaceDataItemReferences
498
516
  */
499
517
  export declare function replaceReferences<ItemLeft extends WithId, ItemRight extends WithId>(dataCollectionId: string, field: string, referringItem: ItemLeft | string, referencedItem: ItemRight | string | ItemRight[] | string[], options?: WixDataOptions): Promise<void>;
518
+ export declare function patch(dataCollectionId: string, itemId: string): WixDataPatch;
500
519
  /**
501
- * Creates a patch to modify the specified item. Unlike [`update()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/update), only the fields specified in the request are modified. Data that isn't explicitly modified remains unchanged.
502
- *
503
- *
504
- * The `patch()` method builds a patch to modify a data item in a specified collection. It returns a `WixDataPatch` object that contains the patch definition, which you can further refine by chaining [`WixDataPatch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-patch/introduction) methods onto it. These methods allow you to clear, set, and increment field values, as well as add or remove items from array fields. The methods are applied in the order in which they are chained.
505
- *
506
- * Finally, to run the patch, chain [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-patch/run) as the last method.
520
+ * Partially updates the specified item. Unlike [`update()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/update), only the fields specified in the request are modified. Data that isn't explicitly modified remains unchanged.
507
521
  *
508
522
  * If an item is found in the specified collection with the specified ID, that item is patched. If the collection doesn't contain an item with that ID, the request fails.
509
523
  *
@@ -512,25 +526,25 @@ export declare function replaceReferences<ItemLeft extends WithId, ItemRight ext
512
526
  * > **Notes**:
513
527
  * > - When an item is patched, its `data._updatedDate` property is updated to the current date and time.
514
528
  * > - You can only patch items in [collections created by Wix users](https://support.wix.com/en/article/cms-formerly-content-manager-creating-a-collection). Items in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code) cannot be patched.
529
+ * > - Multi-reference fields are supported. You can use APPEND_TO_ARRAY field modification to add new references, REMOVE_FROM_ARRAY to remove references, and SET_FIELD to replace the current references.
515
530
  *
516
531
  * @public
517
532
  * @documentationMaturity preview
518
533
  * @requiredField dataCollectionId
519
534
  * @requiredField itemId
535
+ * @requiredField fieldModifications
520
536
  * @param dataCollectionId - ID of the collection that contains the item to patch.
521
537
  * @param itemId - ID of the data item to patch.
538
+ * @param fieldModifications - An array of field modifications to apply when patching the item.
539
+ * @param options - Options to use when processing this operation.
522
540
  * @permissionScope Write Data Items
523
541
  * @permissionScopeId SCOPE.DC-DATA.WRITE
524
542
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.PatchDataItem
525
543
  */
526
- export declare function patch(dataCollectionId: string, itemId: string): WixDataPatch;
527
544
  export declare function patch<Item extends Record<string, any> = WixDataItem>(dataCollectionId: string, itemId: string, fieldModifications: FieldModification[], options?: WixDataPatchOptions): Promise<(Item & WixDataItem) | null>;
545
+ export declare function bulkPatch(dataCollectionId: string, itemIds: string[]): WixDataBulkPatch;
528
546
  /**
529
- * Creates a bulk patch to modify the specified items. Unlike [`bulkUpdate()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/bulk-update), only the fields specified in the request are modified. Data that isn't explicitly modified remains unchanged.
530
- *
531
- * The `bulkPatch()` method builds a bulk patch to modify multiple data items in a collection. It returns a `WixDataBulkPatch` object that contains the bulk patch definition, which you can further refine by chaining [`WixDataBulkPatch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-bulk-patch/introduction) methods onto it. These methods allow you to clear, set, and increment field values, as well as add or remove items from array fields. The methods are applied in the order in which they are chained.
532
- *
533
- * Finally, to run the bulk patch, chain [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-bulk-patch/run) as the last method.
547
+ * Partially updates a number of items in a collection. Unlike [`bulkUpdate()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/bulk-update), only the fields specified in the request are modified. Data that isn't explicitly modified remains unchanged.
534
548
  *
535
549
  * Calling the `bulkPatch()` method triggers the [`beforeUpdate()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-update) and [`afterUpdate()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-update) hooks for each patched item, if the hooks have been defined.
536
550
  *
@@ -541,26 +555,26 @@ export declare function patch<Item extends Record<string, any> = WixDataItem>(da
541
555
  * > - When an item is patched, its `data._updatedDate` field is updated to the current date and time.
542
556
  * > - The maximum size of a patched collection item is 500kb.
543
557
  * > - If an item ID isn't found, the `errors` array in the response returned by [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-bulk-patch/run) contains a corresponding item with details about the error. Learn more about [Wix Data Error Codes](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-error-codes).
544
- *
558
+ * > - Multi-reference fields are supported. You can use APPEND_TO_ARRAY field modification to add new references, REMOVE_FROM_ARRAY to remove references, and SET_FIELD to replace the current references.
545
559
  *
546
560
  * @public
547
561
  * @documentationMaturity preview
548
562
  * @requiredField dataCollectionId
549
563
  * @requiredField itemIds
564
+ * @requiredField fieldModifications
550
565
  * @param dataCollectionId - ID of the collection that contains the items to patch.
551
566
  * @param itemIds - IDs of the data items to patch.
567
+ * @param fieldModifications - An array of field modifications to apply when patching the items.
568
+ * @param options - Options to use when processing this operation.
552
569
  * @permissionScope Write Data Items
553
570
  * @permissionScopeId SCOPE.DC-DATA.WRITE
554
571
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.BulkPatchDataItems
555
572
  */
556
- export declare function bulkPatch(dataCollectionId: string, itemIds: string[]): WixDataBulkPatch;
557
573
  export declare function bulkPatch(dataCollectionId: string, itemIds: string[], fieldModifications: FieldModification[], options?: WixDataBulkPatchOptions): Promise<WixDataBulkResult>;
558
574
  /**
559
575
  * Creates an async patch to modify all items matching a filter.
560
576
  *
561
- * The `asyncPatchByFilter()` method builds an async patch operation that selects items by filter instead of item ID.
562
- * It returns a `WixDataPatchByFilter` object that you can refine with patch methods such as `setField()`,
563
- * `removeField()`, `incrementField()`, `appendToArray()`, and `removeFromArray()`. To start the job, chain `run()`.
577
+ * The `asyncPatchByFilter()` method selects items by filter and starts a background job to partially update them.
564
578
  *
565
579
  * Pass an empty filter object to patch all items in the collection.
566
580
  *
@@ -568,9 +582,11 @@ export declare function bulkPatch(dataCollectionId: string, itemIds: string[], f
568
582
  * @documentationMaturity preview
569
583
  * @requiredField dataCollectionId
570
584
  * @requiredField filter
585
+ * @requiredField fieldModifications
571
586
  * @param dataCollectionId - ID of the collection containing the items to patch.
572
587
  * @param filter - Filter selecting items to patch. Use `{}` to select all items.
573
588
  * @param fieldModifications - Field modifications to apply to the items.
589
+ * @param options - Options to use when processing this operation.
574
590
  * @permissionScope Write Data Items
575
591
  * @permissionScopeId SCOPE.DC-DATA.WRITE
576
592
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.AsyncPatchDataItemsByFilter
@@ -608,67 +624,35 @@ export declare function asyncRemoveByFilter(dataCollectionId: string, filter: Wi
608
624
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.GetAsyncJobStatus
609
625
  */
610
626
  export declare function getAsyncJobStatus(jobId: string): Promise<WixDataAsyncJobStatus>;
627
+ export declare function query(dataCollectionId: string): WixDataQuery;
611
628
  /**
612
- * Creates a query to retrieve items from a database collection.
613
- *
614
- * The `query()` method builds a query to retrieve data items from a collection and returns a `WixDataQuery` object, which contains the query definition. You can refine the query by chaining [`WixDataQuery` methods](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/introduction) onto the query. `WixDataQuery` methods enable you to sort, filter, and control the query results.
615
- *
616
- *
617
- * The methods chained to `query()` are applied in the order they are called. For example, if you sort by an `age` field in ascending order and then by a `name` field in descending order, the results are sorted first by the age of the items. If there are multiple results with the same age, they are further sorted by name in descending order, per age value.
618
- *
619
- * Finally, to run the query, chain [`find()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/find) or [`distinct()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/distinct) as the last method.
620
- *
621
- * The `query()` method runs with the following `WixDataQuery` defaults that you can override:
622
- * - `skip`: `0`
623
- * - `limit`: `50`
624
- * - `descending`: by `_createdDate`
625
- * - `include`: `none`
629
+ * Retrieves items using a query from a database collection.
626
630
  *
627
631
  * > **Notes**:
628
632
  * > - When calling `query()` immediately following an update to your collection, the data retrieved might not contain the most recent changes. If you need the most up-to-date data, set the `options.consistentRead` parameter of the [`find()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/find) or [`distinct()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/distinct) methods to `true`. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency).
629
633
  * > - To speed up data retrieval, the results of certain data queries are cached. Learn more about [caching data query results](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/about-caching-data-query-results).
630
634
  * > - Items marked [in the CMS as hidden](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection) are not retrieved.
631
- * > - If the collection that you are querying has references to other collections, by default the data from referenced collections is not retrieved. To retrieve data from the referenced items, specify them using the `include()` method.
635
+ * > - If the collection that you are querying has references to other collections, by default the data from referenced collections is not retrieved. To retrieve data from the referenced items, use `includeReferences` option.
632
636
  * > - When querying [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code), make sure the fields you use to refine your query support the intended operations. Learn more about [querying by Wix app collection fields](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections).
633
637
  *
634
638
  *
635
639
  * @public
636
640
  * @documentationMaturity preview
637
641
  * @requiredField dataCollectionId
642
+ * @requiredField queryRequest
638
643
  * @param dataCollectionId - ID of the collection to run the query on.
644
+ * @param queryRequest - Query request object that defines the filter, sorting, selected fields, and paging for the collection query.
645
+ * @param options - Options to use when processing this operation.
646
+ * @returns Promise that resolves to the query results.
639
647
  * @permissionScope Read Data Items
640
648
  * @permissionScopeId SCOPE.DC-DATA.READ
641
649
  * @applicableIdentity APP
642
650
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.QueryDataItems
643
651
  */
644
- /**
645
- * Creates a query on a data collection.
646
- * @param dataCollectionId - ID of the collection to run the query on.
647
- * @returns A `WixDataQuery` builder object.
648
- */
649
- export declare function query(dataCollectionId: string): WixDataQuery;
650
- /**
651
- * Executes a query directly on a data collection.
652
- * @internal
653
- * @param dataCollectionId - ID of the collection to run the query on.
654
- * @param queryRequest - Query parameters including filter, sort, limit, skip, fields, and include.
655
- * @param options - Options for running the query.
656
- * @returns Promise that resolves to the query results.
657
- */
658
652
  export declare function query<Item extends Record<string, any> = WixDataItem>(dataCollectionId: string, queryRequest: WixDataQueryRequest, options?: WixDataQueryOptions): Promise<WixDataQueryResponse<Item & WixDataItem>>;
653
+ export declare function search(dataCollectionId: string): WixDataSearch;
659
654
  /**
660
- * Creates a search operation to find items in a database collection.
661
- *
662
- * The `search()` method builds a search operation to find data items in the specified collection based on text search and filter criteria. It returns a [`WixDataSearch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/introduction) object that defines the search operation, which you can refine by chaining [`WixDataSearch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/introduction) methods onto it. These methods define the search expression and mode, apply filters, and control sorting and pagination of search results.
663
- *
664
- * The methods chained to `search()` are applied in the order they are called. For example, if you specify an expression, apply filters, and then sort by a field, the search first finds items that match the expression and filters, and then sorts the results.
665
- *
666
- * Finally, to run the search, chain [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/run) as the last method.
667
- *
668
- * The `search()` method runs with the following [`WixDataSearch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/introduction) defaults that you can override:
669
- * - `skip`: `0`
670
- * - `limit`: `100`
671
- * - `ascending`: by `_id`
655
+ * Searches for items in a database collection.
672
656
  *
673
657
  * > **Notes**:
674
658
  * > - Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency) and might not reflect recent changes.
@@ -677,81 +661,48 @@ export declare function query<Item extends Record<string, any> = WixDataItem>(da
677
661
  * @public
678
662
  * @documentationMaturity preview
679
663
  * @requiredField dataCollectionId
664
+ * @requiredField searchRequest
680
665
  * @param dataCollectionId - ID of the collection in which to run the search.
681
- * @permissionScope Read Data Items
682
- * @permissionScopeId SCOPE.DC-DATA.READ
683
- */
684
- export declare function search(dataCollectionId: string): WixDataSearch;
685
- /**
686
- * Executes a search directly on a data collection.
687
- * @internal
688
- * @param dataCollectionId - ID of the collection to run the search on.
689
- * @param searchRequest - Search parameters including expression, mode, filter, sort, and paging.
690
- * @param options - Options for running the search.
666
+ * @param searchRequest - Search request object that defines the search expression, filter, sorting, selected fields, and paging to use when searching a collection.
691
667
  * @returns Promise that resolves to the search results.
692
- */
693
- export declare function search<Item extends Record<string, any> = WixDataItem>(dataCollectionId: string, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions): Promise<WixDataSearchResponse<Item & WixDataItem>>;
694
- /**
695
- * Creates an aggregation on a data collection.
696
- *
697
- * The `aggregate()` method builds an aggregation on the specified collection and returns a `WixDataAggregate` object.
698
- *
699
- * An aggregation enables you to perform certain calculations on your collection data, or on groups of items that you define, to retrieve meaningful summaries.
700
- *
701
- * You can also add paging, filtering, and sorting preferences to your aggregation by chaining [`WixDataAggregate`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-aggregate/introduction) methods. The returned object contains the aggregate definition.
702
- *
703
- * Finally, to run the aggregation, chain [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-aggregate/run) as the last method.
704
- *
705
- * The `aggregate()` method runs with the following defaults that you can override:
706
- *
707
- * + `skip`: `0`
708
- * + `limit`: `50`
709
- *
710
- * @public
711
- * @documentationMaturity preview
712
- * @requiredField dataCollectionId
713
- * @param dataCollectionId - ID of the collection to run the aggregation on.
714
668
  * @permissionScope Read Data Items
715
669
  * @permissionScopeId SCOPE.DC-DATA.READ
716
- * @applicableIdentity APP
717
- * @fqn com.wixpress.cloud.data.api.data.DataItemService.AggregateDataItems
718
670
  */
671
+ export declare function search<Item extends Record<string, any> = WixDataItem>(dataCollectionId: string, searchRequest: WixDataSearchRequest, options?: WixDataSearchOptions): Promise<WixDataSearchResponse<Item & WixDataItem>>;
719
672
  export declare function aggregate(dataCollectionId: string): WixDataAggregate;
720
- /**
721
- * Executes an aggregation pipeline directly on a data collection.
722
- * @internal
723
- * @param dataCollectionId - ID of the collection to run the aggregation on.
724
- * @param pipeline - Aggregation pipeline with stages and paging.
725
- * @param options - Options for running the aggregation.
726
- * @returns Promise that resolves to the aggregation results.
727
- */
728
- export declare function aggregate<Result extends Record<string, any> = Record<string, any>>(dataCollectionId: string, pipeline: AggregationPipeline, options?: WixDataAggregateOptions): Promise<WixDataAggregateResponse<Result>>;
729
673
  /**
730
674
  * Runs an aggregation pipeline on a data collection and returns the results.
731
675
  *
732
- * Aggregations enable you to perform advanced data calculations, transformations, and groupings. While [`aggregate()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate) allows you to perform basic aggregations, `aggregatePipeline()` allows you to perform advanced aggregations sequentially in stages, with each stage transforming the results of the previous stage.
676
+ * Aggregations enable you to perform advanced data calculations, transformations, and groupings. Aggregations are perfomed sequentially in stages, with each stage transforming the results of the previous stage.
733
677
  *
734
- * When calling the `aggregatePipeline()` method, specify the collection ID and an aggregation pipeline. To build the pipeline, call the [`pipelineBuilder()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder) method and chain [`PipelineBuilder`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder/introduction) methods to add stages and configure paging.
678
+ * When calling the `aggregate()` method, specify the collection ID and an aggregation pipeline. To build the pipeline, call the [`PipelineBuilder()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder) method and chain [`PipelineBuilder`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder/introduction) methods to add stages and configure paging.
735
679
  *
736
- * `aggregatePipeline()` returns the aggregated results and pagination information.
680
+ * `aggregate()` returns the aggregated results and pagination information.
737
681
  *
738
682
  * > **Note**: You can only build an aggregation pipeline for collections [created in the CMS](https://support.wix.com/en/article/cms-formerly-content-manager-creating-a-collection) or with the [Data Collections API](https://dev.wix.com/docs/sdk/backend-modules/data/collections/introduction). They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections) or [external collections](https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/overview/integrating-external-databases-with-your-wix-site).
739
683
  *
740
684
  * @public
741
685
  * @documentationMaturity preview
742
686
  * @requiredField dataCollectionId
687
+ * @requiredField pipeline
743
688
  * @param dataCollectionId - ID of the collection to run the aggregation pipeline on.
744
- * @param pipeline - Aggregation pipeline with data processing stages and paging configuration. Call [`pipelineBuilder()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder) to build the pipeline.
689
+ * @param pipeline - Aggregation pipeline with data processing stages and paging configuration. Call [`PipelineBuilder()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder) to build the pipeline.
745
690
  * @param options - Options for running the aggregation pipeline.
691
+ * @returns Promise that resolves to the aggregation results.
746
692
  * @permissionScope Read Data Items
747
693
  * @permissionScopeId SCOPE.DC-DATA.READ
748
694
  * @applicableIdentity APP
749
695
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.AggregatePipelineDataItems
750
696
  */
697
+ export declare function aggregate<Result extends Record<string, any> = Record<string, any>>(dataCollectionId: string, pipeline: AggregationPipeline, options?: WixDataAggregateOptions): Promise<WixDataAggregateResponse<Result>>;
751
698
  export declare function aggregatePipeline(dataCollectionId: string, pipeline: AggregationPipeline, options?: WixDataAggregateOptions): Promise<AggregatePipelineDataItemsResponse>;
752
699
  /**
753
700
  * Retrieves distinct values for a specified field directly from a data collection.
754
- * @internal
701
+ *
702
+ * @public
703
+ * @documentationMaturity preview
704
+ * @requiredField dataCollectionId
705
+ * @requiredField fieldName
755
706
  * @param dataCollectionId - ID of the collection to retrieve distinct values from.
756
707
  * @param fieldName - Field whose distinct values are retrieved.
757
708
  * @param options - Options for running the distinct operation.
@@ -760,24 +711,27 @@ export declare function aggregatePipeline(dataCollectionId: string, pipeline: Ag
760
711
  export declare function distinct<Value = any>(dataCollectionId: string, fieldName: string, options?: WixDataDistinctOptions): Promise<WixDataDistinctResponse<Value>>;
761
712
  /**
762
713
  * Counts the number of items directly in a data collection.
763
- * @internal
714
+ *
715
+ * @public
716
+ * @documentationMaturity preview
717
+ * @requiredField dataCollectionId
764
718
  * @param dataCollectionId - ID of the collection to count items in.
765
719
  * @param options - Options for running the count.
766
720
  * @returns Promise that resolves to the number of items.
767
721
  */
768
722
  export declare function count(dataCollectionId: string, options?: WixDataCountOptions): Promise<number>;
723
+ export declare function queryReferenced(dataCollectionId: string, referringItem: WixDataItem | string, field: string, options?: WixDataQueryReferencedOptions): Promise<WixDataResult>;
769
724
  /**
770
725
  * Retrieves the full items referenced in the specified field of an item.
771
726
  *
772
727
  * Reference and multi-reference fields refer to items in different collections. Use this method to retrieve the full details of the referenced items.
773
728
  *
774
- * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection. Querying the **Movies** collection using `queryReferenced()` retrieves the relevant **People** items referenced in the **Actors** field of the specified **Movie** item. This gives you information from the **People** collection about each of the actors in the specified movie.
729
+ * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection. Querying the **Movies** collection using `queryReferencedItems()` retrieves the relevant **People** items referenced in the **Actors** field of the specified **Movie** item. This gives you information from the **People** collection about each of the actors in the specified movie.
775
730
  *
776
- * The `queryReferenced()` method returns a Promise that resolves to the full items referenced in the specified property of the item from the specified collection. The Promise is rejected if the current user does not have read permissions for the specified collection or the collection containing the referenced items.
731
+ * The `queryReferencedItems()` method returns a Promise that resolves to the full items referenced in the specified property of the item from the specified collection. The Promise is rejected if the current user does not have read permissions for the specified collection or the collection containing the referenced items.
777
732
  *
778
733
  * > **Notes**:
779
- * > - You can only call `queryReferenced()` for [multi-reference fields](https://support.wix.com/en/article/about-referencing-multiple-items-in-one-field).
780
- * > - This method does not support [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
734
+ * > - You can call `queryReferencedItems()` for both [reference](https://support.wix.com/en/article/cms-using-reference-fields-to-display-content-from-multiple-collections) and [multi-reference](https://support.wix.com/en/article/about-referencing-multiple-items-in-one-field) fields.
781
735
  * > - When calling `queryReferenced()` immediately following an update to your collection, the data retrieved [may not contain the most recent changes](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency). If you need the most up-to-date data, set `options.consistentRead` to `true`.
782
736
  * > - To speed up data retrieval, the results of certain data queries are cached. Learn more about [caching data query results](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/about-caching-data-query-results).
783
737
  *
@@ -788,23 +742,6 @@ export declare function count(dataCollectionId: string, options?: WixDataCountOp
788
742
  * @requiredField referringItem
789
743
  * @requiredField field
790
744
  * @param dataCollectionId - ID of the collection that contains the referring item.
791
- * @param referringItem - Referring item or referring item's ID.
792
- * @param field - Field that contains the references to the referenced items.
793
- * @param options - Options for querying referenced data items.
794
- * @permissionScope Read Data Items
795
- * @permissionScopeId SCOPE.DC-DATA.READ
796
- * @applicableIdentity APP
797
- * @fqn com.wixpress.cloud.data.api.data.DataItemService.QueryReferencedDataItems
798
- */
799
- export declare function queryReferenced(dataCollectionId: string, referringItem: WixDataItem | string, field: string, options?: WixDataQueryReferencedOptions): Promise<WixDataResult>;
800
- /**
801
- * Queries referenced items for one or more referring items.
802
- * @internal
803
- * @documentationMaturity preview
804
- * @requiredField dataCollectionId
805
- * @requiredField referringItem
806
- * @requiredField field
807
- * @param dataCollectionId - ID of the collection that contains the referring item.
808
745
  * @param referringItem - Referring item, referring item's ID, or a list of referring items or IDs.
809
746
  * @param field - Field that contains the references to the referenced items.
810
747
  * @param options - Options for querying referenced data items.
@@ -814,16 +751,6 @@ export declare function queryReferenced(dataCollectionId: string, referringItem:
814
751
  * @fqn com.wixpress.cloud.data.api.data.DataItemService.QueryReferencedDataItems
815
752
  */
816
753
  export declare function queryReferencedItems<Item extends Record<string, any> = WixDataItem>(dataCollectionId: string, referringItem: WixDataItem | string | (WixDataItem | string)[], field: string, options?: WixDataQueryReferencedItemsOptions): Promise<WixDataQueryReferencedItemsResponse<Item & WixDataItem>>;
817
- /**
818
- * Creates a filter for queries and aggregations.
819
- *
820
- * The `filter()` method builds a filter to be applied to a query or an aggregation. It returns a `WixDataFilter` object, which can be used with other filter methods such as `and()`, `or()` and `not()`, to create complex filter definitions.
821
- *
822
- * When working with [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code), check which fields can be used in a filter.
823
- *
824
- * @public
825
- * @documentationMaturity preview
826
- */
827
754
  export declare function filter(): WixDataFilter;
828
755
  /**
829
756
  * Sets the [collection environment](https://support.wix.com/en/article/cms-about-sandbox-and-live-collections-and-syncing) for any methods chained to it.
@@ -889,11 +816,33 @@ export { WixDataReadOptions, WixDataReadWithProjectionOptions, WithIncludeFieldG
889
816
  /** @builder */
890
817
  export interface PipelineBuilder extends _PipelineBuilder {
891
818
  }
892
- /** @hidden */
819
+ /**
820
+ * Builds an aggregation pipeline for use with [`aggregate()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate).
821
+ *
822
+ * Configure the pipeline by calling `PipelineBuilder()` and chaining [`PipelineBuilder`](https://dev.wix.com/docs/sdk/backend-modules/data/items/pipeline-builder/introduction) methods. Then, specify the pipeline as the `pipeline` parameter when calling the [`aggregate()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/aggregate) method.
823
+ *
824
+ * > **Note**: You can only build an aggregation pipeline for collections [created in the CMS](https://support.wix.com/en/article/cms-formerly-content-manager-creating-a-collection) or with the [Data Collections API](https://dev.wix.com/docs/sdk/backend-modules/data/collections/introduction). They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections) or [external collections](https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/overview/integrating-external-databases-with-your-wix-site).
825
+ *
826
+ * @public
827
+ * @documentationMaturity preview
828
+ * @returns PipelineBuilder object
829
+ */
893
830
  export declare const PipelineBuilder: () => _PipelineBuilder;
894
- /** @hidden */
831
+ /**
832
+ * Use `Stages` to create and configure pipeline stages such as `filter()`,
833
+ * `group()`, `project()`, `sort()`, `limit()`, `skip()`, `unwind()`, and
834
+ * `objectToArray()` when building an aggregation pipeline.
835
+ *
836
+ * @public
837
+ * @documentationMaturity preview
838
+ */
895
839
  export declare const Stages: WixDataAggregatePipelineStages;
896
- /** @hidden */
840
+ /**
841
+ * Use `Expressions` to build computed values for aggregation stages such as
842
+ * `project()`, `group()`, and `reshape()`.
843
+ * @public
844
+ * @documentationMaturity preview
845
+ */
897
846
  export declare const Expressions: WixDataAggregatePipelineExpressions;
898
847
  export { PagingMetadata, WixDataQueryRequest } from '@wix/wix-data-items-common';
899
848
  export type { WixDataIsReferencedOptions, WixDataGetOptionsBuilder, WixDataQueryOptionsBuilder, WixDataQueryReferencedItemsOptionsBuilder, WixDataAggregateOptionsBuilder, WixDataDistinctOptionsBuilder, WixDataCountOptionsBuilder, WixDataIsReferencedOptionsBuilder, WixDataSearchOptionsBuilder, WixDataInsertOptionsBuilder, WixDataRemoveOptionsBuilder, WixDataBulkRemoveOptionsBuilder, WixDataAsyncRemoveByFilterOptionsBuilder, WixDataAsyncPatchByFilterOptionsBuilder, WixDataPatchOptionsBuilder, WixDataBulkPatchOptionsBuilder, WixDataSaveOptionsBuilder, WixDataBulkSaveOptionsBuilder, WixDataUpdateOptionsBuilder, WixDataBulkUpdateOptionsBuilder, WixDataBulkInsertOptionsBuilder, } from '@wix/wix-data-items-common';