@wix/wix-data-items-sdk 1.0.188 → 1.0.190

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.
@@ -6,14 +6,14 @@ import { WixDataPatch, QueryBase, } from '@wix/wix-data-items-common';
6
6
  * An item can only be inserted into an existing collection. You can create a new collection using the
7
7
  * Data Collections API.
8
8
  *
9
- * The `insert()` function returns a Promise that resolves to the inserted item
9
+ * The `insert()` method returns a Promise that resolves to the inserted item
10
10
  * after it has been added to the specified collection. The Promise is rejected
11
11
  * if the current user does not have "create" permissions for the collection or
12
12
  * the specified item includes an `_id` property whose value matches an
13
13
  * existing ID in the collection. Meaning, `insert()` cannot overwrite an
14
14
  * existing item in the collection.
15
15
  *
16
- * Calling the `insert()` function triggers the `beforeInsert()` and
16
+ * Calling the `insert()` method triggers the `beforeInsert()` and
17
17
  * `afterInsert()` hooks if they have been defined.
18
18
  *
19
19
  * Use the `options` parameter to run `insert()` from backend code without
@@ -22,7 +22,7 @@ import { WixDataPatch, QueryBase, } from '@wix/wix-data-items-common';
22
22
  * When inserting an item into a collection that has a reference field, set the
23
23
  * value of the reference field to the referenced item's `_id` value or the entire referenced item object.
24
24
  *
25
- * The `insert()` function adds the following properties and values to the item
25
+ * The `insert()` method adds the following properties and values to the item
26
26
  * when it adds it to the collection:
27
27
  * - `_id`: A unique identifier for an item in a collection, if the item
28
28
  * doesn't have one or has one that is `undefined`. You can optionally provide
@@ -32,7 +32,7 @@ import { WixDataPatch, QueryBase, } from '@wix/wix-data-items-common';
32
32
  * added, the `_createdDate` and `_updatedDate` are the same.
33
33
  *
34
34
  * Any valid JavaScript object can be added as a property value. The `insert()`
35
- * function maintains the structure of the specified object. For example, objects that contain nested objects, Arrays, or Arrays with nested objects are all added to the collection as defined.
35
+ * method maintains the structure of the specified object. For example, objects that contain nested objects, Arrays, or Arrays with nested objects are all added to the collection as defined.
36
36
  *
37
37
  * The maximum size of an item that you can add to a collection is 500kb.
38
38
  *
@@ -43,14 +43,15 @@ import { WixDataPatch, QueryBase, } from '@wix/wix-data-items-common';
43
43
  * > `_id` is pre-inserted into the collection. Single Item Collections may
44
44
  * > contain only one item.
45
45
  * > - If there is a pre-existing item in a Single Item Collection, the
46
- * > `insert()` function will not run. To update or change an item in a
47
- * > Single Item Collection see the `update()` and `save()` functions.
48
- * > - The `insert()` function does not support multi-reference fields. For
46
+ * > `insert()` method will not run. To update or change an item in a
47
+ * > Single Item Collection see the `update()` and `save()` methods.
48
+ * > - The `insert()` method does not support multi-reference fields. For
49
49
  * > multi-reference fields, use `insertReference()`.
50
+ * > - [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.
50
51
  * @public
51
52
  * @param dataCollectionId - ID of the collection item belongs to.
52
53
  * @param item - Data item to insert.
53
- * @param options - An object containing options to use when processing this operation.
54
+ * @param options - Options to use when processing this operation.
54
55
  * @documentationMaturity preview
55
56
  * @requiredField dataCollectionId
56
57
  * @requiredField item
@@ -64,18 +65,14 @@ export async function insert(dataCollectionId, item, options) {
64
65
  /**
65
66
  * Updates an item in a collection.
66
67
  *
67
- * The `update()` function returns a Promise that resolves to the updated item from
68
+ * The `update()` method returns a Promise that resolves to the updated item from
68
69
  * the specified collection. The Promise is rejected if the current user does not
69
70
  * have update permissions for the collection.
70
71
  *
71
- * Calling the `update()` function triggers the `beforeUpdate()` and `afterUpdate()`
72
+ * Calling the `update()` method triggers the `beforeUpdate()` and `afterUpdate()`
72
73
  * hooks if they have been defined.
73
74
  *
74
- * > **Note:**
75
- * > The specified item must include an `_id` property that already exists in
76
- * > the collection.
77
- *
78
- * The `update()` function compares the `_id` property of the specified item
75
+ * The `update()` method compares the `_id` property of the specified item
79
76
  * with the `_id` property values of the items in the specified collection. If
80
77
  * an item in the collection has that `_id` value, `update()` replaces the
81
78
  * item's property values with the ones in the specified item. If the existing
@@ -84,7 +81,7 @@ export async function insert(dataCollectionId, item, options) {
84
81
  * `_updatedDate` property is also updated to the current date.
85
82
  *
86
83
  * Any valid JavaScript object can be used as a property value. The `update()`
87
- * function maintains the structure of the specified object. For example,
84
+ * method maintains the structure of the specified object. For example,
88
85
  * objects that contain nested objects, Arrays, or Arrays with nested objects
89
86
  * are all added to the collection as defined.
90
87
  *
@@ -98,11 +95,13 @@ export async function insert(dataCollectionId, item, options) {
98
95
  * The maximum size of an item that you can update in a collection is 500kb.
99
96
  *
100
97
  * > **Note:**
101
- * > The update() function does not support multi-reference fields. For
102
- * > multi-reference fields, use replaceReferences() or insertReference().
98
+ * > The specified item must include an `_id` property that already exists in the collection.
99
+ * > The update() method does not support multi-reference fields. For multi-reference fields, use `replaceReferences()` or `insertReference()`.
100
+ * > - [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.
101
+ *
103
102
  * @param dataCollectionId - ID of the collection item belongs to.
104
103
  * @param item - Data item to update.
105
- * @param options - An object containing options to use when processing this operation.
104
+ * @param options - Options to use when processing this operation.
106
105
  * @public
107
106
  * @documentationMaturity preview
108
107
  * @requiredField dataCollectionId
@@ -117,12 +116,12 @@ export async function update(dataCollectionId, item, options) {
117
116
  /**
118
117
  * Inserts or updates an item in a collection.
119
118
  *
120
- * The `save()` function returns a Promise that resolves to the inserted or
119
+ * The `save()` method returns a Promise that resolves to the inserted or
121
120
  * updated item after it has been added or updated in the specified
122
121
  * collection. The Promise is rejected if the current user does not have
123
122
  * the necessary permissions for the collection.
124
123
  *
125
- * The `save()` function inserts or updates the specified item, depending on
124
+ * The `save()` method inserts or updates the specified item, depending on
126
125
  * whether it already exists in the collection. It compares the `_id` property
127
126
  * value of the specified item with the `_id` property values of the items in
128
127
  * the specified collection. If an item in the collection has that `_id` value,
@@ -146,15 +145,16 @@ export async function update(dataCollectionId, item, options) {
146
145
  * > **Notes:**
147
146
  * > - If an item's `_id` property value is set to null or an empty string, an
148
147
  * > error is thrown.
149
- * > - The `save()` function does not support multi-reference fields. For
148
+ * > - The `save()` method does not support multi-reference fields. For
150
149
  * > multi-reference fields, use `insertReference() `or `replaceReferences()`.
150
+ * > - [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.
151
151
  * @public
152
152
  * @documentationMaturity preview
153
153
  * @requiredField dataCollectionId
154
154
  * @requiredField item
155
155
  * @param dataCollectionId - ID of the collection item belongs to.
156
156
  * @param item - Data item to save.
157
- * @param options - An object containing options to use when processing this operation.
157
+ * @param options - Options to use when processing this operation.
158
158
  * @permissionScope Write Data Items
159
159
  * @permissionScopeId SCOPE.DC-DATA.WRITE
160
160
  */
@@ -165,7 +165,7 @@ export async function save(dataCollectionId, item, options) {
165
165
  /**
166
166
  * Retrieves an item from a collection.
167
167
  *
168
- * The `get()` function returns a Promise that resolves to the item with ID
168
+ * The `get()` method returns a Promise that resolves to the item with ID
169
169
  * `itemId` from the specified collection, or `null` if the `itemId` is not
170
170
  * found. The Promise is rejected if the current user does not have read
171
171
  * permissions for the collection.
@@ -174,24 +174,26 @@ export async function save(dataCollectionId, item, options) {
174
174
  * referenced item is returned. To return the values of the referenced items
175
175
  * use `query()` and `include()`.
176
176
  *
177
- * Calling the `get()` function triggers the `beforeGet()` and `afterGet()`
177
+ * If the get() method is passed the ID of a hidden item, it returns null.
178
+ *
179
+ * Calling the `get()` method triggers the `beforeGet()` and `afterGet()`
178
180
  * hooks if they have been defined.
179
181
  *
180
182
  * Use the `options` parameter to run `get()` from backend code without
181
183
  * checking for permissions or without its registered hooks.
182
184
  *
183
185
  * > **Notes:**
184
- * > - When using the `query()` or `get()` functions or another data retrieval
186
+ * > - When using the `query()` or `get()` methods or another data retrieval
185
187
  * > method following a change to your database collection, the data
186
188
  * > retrieved may not contain your most recent changes. See Wix-data and
187
189
  * > Eventual Consistency for more information. To solve this problem, you
188
- * > can use the `setTimeout()` function to delay retrieving data following
190
+ * > can use the `setTimeout()` method to delay retrieving data following
189
191
  * > any changes to your database collection.
190
192
  * > - An `itemId` is required to retrieve an item even from a single-item
191
193
  * > collection.
192
194
  * @param dataCollectionId - ID of the collection item belongs to.
193
195
  * @param itemId - ID of the data item to retrieve.
194
- * @param options - An object containing options to use when processing this operation.
196
+ * @param options - Options to use when processing this operation.
195
197
  * @public
196
198
  * @documentationMaturity preview
197
199
  * @requiredField itemId
@@ -207,27 +209,27 @@ export async function get(dataCollectionId, itemId, options) {
207
209
  /**
208
210
  * Removes an item from a collection.
209
211
  *
210
- * The `remove()` function returns a Promise that resolves to the removed item
212
+ * The `remove()` method returns a Promise that resolves to the removed item
211
213
  * after it has been removed from the specified collection. The Promise is
212
214
  * rejected if the current user does not have "delete" permissions for the
213
215
  * collection.
214
216
  *
215
- * Calling the `remove()` function triggers the `beforeRemove()` and
217
+ * Calling the `remove()` method triggers the `beforeRemove()` and
216
218
  * `afterRemove()` hooks if they have been defined.
217
219
  *
218
220
  * Use the `options` parameter to run `remove()` from backend code without
219
221
  * checking for permissions or without its registered hooks.
220
222
  *
221
223
  * > **Notes:**
222
- * > The `remove()` function also clears multiple-item reference fields for
224
+ * > The `remove()` method also clears multiple-item reference fields for
223
225
  * > items in collections referenced by the specified item. For example,
224
226
  * > suppose you have a **Movies** collection with an **Actors** field that
225
227
  * > contains multiple references to items in a **People** collection. Removing
226
228
  * > an item in the **Movies** collection also clears the data in the
227
229
  * > corresponding multiple-item reference fields in the **People** collection.
228
- * @param dataCollectionId - ID of the collection item belongs to.
230
+ * @param dataCollectionId - ID of the collection that contains the item.
229
231
  * @param itemId - ID of the item to remove.
230
- * @param options - An object containing options to use when processing this operation.
232
+ * @param options - Object containing options to use when processing this operation.
231
233
  * @public
232
234
  * @documentationMaturity preview
233
235
  * @requiredField itemId
@@ -242,7 +244,7 @@ export async function remove(dataCollectionId, itemId, options) {
242
244
  /**
243
245
  * Removes all items from a collection.
244
246
  *
245
- * The `truncate()` function returns a Promise that resolves after all items
247
+ * The `truncate()` method returns a Promise that resolves after all items
246
248
  * have been removed from the specified collection.
247
249
  *
248
250
  * `truncate()` runs when at least one of the following is true:
@@ -250,7 +252,7 @@ export async function remove(dataCollectionId, itemId, options) {
250
252
  * - The request is performed in backend code with a `suppressAuth` options
251
253
  * value of `true`.
252
254
  *
253
- * Calling the `truncate()` function does not trigger any hooks.
255
+ * Calling the `truncate()` method does not trigger any hooks.
254
256
  *
255
257
  * > **Note:** `truncate()` also clears multiple-item reference fields in
256
258
  * > collections referenced by the specified collection. For example, suppose you
@@ -272,14 +274,14 @@ export async function truncate(dataCollectionId) {
272
274
  /**
273
275
  * Adds a number of items to a collection.
274
276
  *
275
- * The `bulkInsert()` function returns a Promise that resolves after the items
277
+ * The `bulkInsert()` method returns a Promise that resolves after the items
276
278
  * have been added to the specified collection. The Promise is rejected if the
277
279
  * current user does not have "create" permissions for the collection. Items
278
280
  * are skipped if they include an `_id` property whose value matches an
279
281
  * existing ID in the collection. Meaning, `bulkInsert()` cannot overwrite an
280
282
  * existing item in the collection.
281
283
  *
282
- * Calling the `bulkInsert()` function triggers the `beforeInsert()` and
284
+ * Calling the `bulkInsert()` method triggers the `beforeInsert()` and
283
285
  * `afterInsert()` hooks for each item that is inserted if the hooks have been
284
286
  * defined.
285
287
  *
@@ -290,7 +292,7 @@ export async function truncate(dataCollectionId) {
290
292
  * values of the reference fields to the referenced item's `_id` value or the
291
293
  * entire referenced item object.
292
294
  *
293
- * The `bulkInsert()` function adds the following properties and values to the
295
+ * The `bulkInsert()` method adds the following properties and values to the
294
296
  * item when it adds it to the collection:
295
297
  * - `_id`: A unique identifier for an item in a collection, if the item
296
298
  * doesn't have one or has one that is `undefined`. You can optionally
@@ -301,7 +303,7 @@ export async function truncate(dataCollectionId) {
301
303
  * added, the `createdDate` and `updatedDate` are the same.
302
304
  *
303
305
  * Any valid JavaScript object can be added as a property value. The
304
- * `bulkInsert()` function maintains the structure of the specified object. For
306
+ * `bulkInsert()` method maintains the structure of the specified object. For
305
307
  * example, objects that contain nested objects, Arrays, or Arrays with nested
306
308
  * objects are all added to the collection as defined.
307
309
  *
@@ -310,17 +312,18 @@ export async function truncate(dataCollectionId) {
310
312
  * > **Notes:**
311
313
  * > - If an item's `_id` property value is set to `null` or an empty string,
312
314
  * > an error is thrown.
313
- * > - Bulk operations are limited to 1000 items per function call.
314
- * > - The `bulkInsert()` function is not supported for Single Item Collections.
315
- * > - The `bulkInsert()` function does not support multi-reference fields. For
315
+ * > - Bulk operations are limited to 1000 items per method call.
316
+ * > - The `bulkInsert()` method is not supported for Single Item Collections.
317
+ * > - The `bulkInsert()` method does not support multi-reference fields. For
316
318
  * > multi-reference fields, use `insertReference()`.
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 bulkInsert() fails and issues an error.
317
320
  * @public
318
321
  * @documentationMaturity preview
319
322
  * @requiredField dataCollectionId
320
323
  * @requiredField items
321
324
  * @param dataCollectionId - ID of the collection items belong to.
322
325
  * @param items - Data items to insert.
323
- * @param options - An object containing options to use when processing this operation.
326
+ * @param options - Options to use when processing this operation.
324
327
  * @permissionScope Write Data Items
325
328
  * @permissionScopeId SCOPE.DC-DATA.WRITE
326
329
  */
@@ -331,18 +334,18 @@ export async function bulkInsert(dataCollectionId, items, options) {
331
334
  /**
332
335
  * Updates a number of items in a collection.
333
336
  *
334
- * The `bulkUpdate()` function returns a Promise that resolves after the items
337
+ * The `bulkUpdate()` method returns a Promise that resolves after the items
335
338
  * have been updated in the specified collection. The Promise is rejected if
336
339
  * the current user does not have update permissions for the collection. Items
337
340
  * are skipped if they include an `_id` property whose value does not match an
338
341
  * existing ID in the collection. Meaning, `bulkUpdate()` cannot add new items
339
342
  * into the collection.
340
343
  *
341
- * Calling the `bulkUpdate()` function triggers the `beforeUpdate()` and
344
+ * Calling the `bulkUpdate()` method triggers the `beforeUpdate()` and
342
345
  * `afterUpdate()` hooks for each item that is updated if the hooks have been
343
346
  * defined.
344
347
  *
345
- * The `bulkUpdate()` function compares the `_id` property of the specified
348
+ * The `bulkUpdate()` method compares the `_id` property of the specified
346
349
  * items with the `_id` property values of the items in the specified
347
350
  * collection.
348
351
  *
@@ -354,7 +357,7 @@ export async function bulkInsert(dataCollectionId, items, options) {
354
357
  * `_updatedDate` property is also updated to the current date.
355
358
  *
356
359
  * Any valid JavaScript object can be used as a property value. The
357
- * `bulkUpdate()` function maintains the structure of the specified object. For
360
+ * `bulkUpdate()` method maintains the structure of the specified object. For
358
361
  * example, objects that contain nested objects, Arrays, or Arrays with nested
359
362
  * objects are all added to the collection as defined.
360
363
  *
@@ -368,17 +371,18 @@ export async function bulkInsert(dataCollectionId, items, options) {
368
371
  * The maximum size of an item that you can update in a collection is 500kb.
369
372
  *
370
373
  * > **Notes:**
371
- * > - Bulk operations are limited to 1000 items per function call.
372
- * > - The `bulkUpdate()` function is not supported for Single Item Collections.
373
- * > - The `bulkUpdate()` function does not support multi-reference fields. For
374
+ * > - Bulk operations are limited to 1000 items per method call.
375
+ * > - The `bulkUpdate()` method is not supported for Single Item Collections.
376
+ * > - The `bulkUpdate()` method does not support multi-reference fields. For
374
377
  * > multi-reference fields, use `replaceReferences()` or `insertReference()`.
378
+ * > - [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.
375
379
  * @public
376
380
  * @documentationMaturity preview
377
381
  * @requiredField dataCollectionId
378
382
  * @requiredField items
379
383
  * @param dataCollectionId - ID of the collection items belong to.
380
384
  * @param items - Data items to update.
381
- * @param options - An object containing options to use when processing this operation.
385
+ * @param options - Options to use when processing this operation.
382
386
  * @permissionScope Write Data Items
383
387
  * @permissionScopeId SCOPE.DC-DATA.WRITE
384
388
  */
@@ -389,12 +393,12 @@ export async function bulkUpdate(dataCollectionId, items, options) {
389
393
  /**
390
394
  * Inserts or updates a number of items in a collection.
391
395
  *
392
- * The `bulkSave()` function returns a Promise that resolves after the items
396
+ * The `bulkSave()` method returns a Promise that resolves after the items
393
397
  * have been added or updated in the specified collection. The Promise is
394
398
  * rejected if the current user does not have the necessary permissions for the
395
399
  * collection.
396
400
  *
397
- * The `bulkSave()` function inserts or updates the specified items, depending
401
+ * The `bulkSave()` method inserts or updates the specified items, depending
398
402
  * on whether they already exist in the collection. It compares the `_id`
399
403
  * property value of the specified items with the `_id` property values of the
400
404
  * items in the specified collection.
@@ -421,18 +425,19 @@ export async function bulkUpdate(dataCollectionId, items, options) {
421
425
  * > **Notes:**
422
426
  * > - If an item's `_id` property value is set to null or an empty string, an
423
427
  * > error is thrown.
424
- * > - Bulk operations are limited to 1000 items per function call.
425
- * > - The `bulkSave()` function is not supported for Single Item Collections.
426
- * > - The `bulkSave()` function does not support multi-reference fields. For
428
+ * > - Bulk operations are limited to 1000 items per method call.
429
+ * > - The `bulkSave()` method is not supported for Single Item Collections.
430
+ * > - The `bulkSave()` method does not support multi-reference fields. For
427
431
  * > multi-reference fields, use `replaceReferences()` or
428
432
  * > `insertReference()`.
433
+ * > - [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.
429
434
  * @public
430
435
  * @documentationMaturity preview
431
436
  * @requiredField dataCollectionId
432
437
  * @requiredField items
433
438
  * @param dataCollectionId - ID of the collection items belong to.
434
439
  * @param items - Data items to save.
435
- * @param options - An object containing options to use when processing this operation.
440
+ * @param options - Options to use when processing this operation.
436
441
  * @permissionScope Write Data Items
437
442
  * @permissionScopeId SCOPE.DC-DATA.WRITE
438
443
  */
@@ -443,14 +448,14 @@ export async function bulkSave(dataCollectionId, items, options) {
443
448
  /**
444
449
  * Removes a number of items from a collection.
445
450
  *
446
- * The `bulkRemove()` function returns a Promise that resolves after the items
451
+ * The `bulkRemove()` method returns a Promise that resolves after the items
447
452
  * have been removed from the specified collection. The Promise is rejected if
448
453
  * the current user does not have "delete" permissions for the collection. If
449
454
  * the delete permissions for the collection are set to Site member author, the
450
- * only items that will be deleted are those for which the current user is the
451
- * owner. All other items will be skipped.
455
+ * only items that are deleted are those for which the current user is the
456
+ * owner. All other items are skipped.
452
457
  *
453
- * Calling the `bulkRemove()` function triggers the `beforeRemove()` and
458
+ * Calling the `bulkRemove()` method triggers the `beforeRemove()` and
454
459
  * `afterRemove()` hooks for each item that is deleted if the hooks have been
455
460
  * defined.
456
461
  *
@@ -458,20 +463,20 @@ export async function bulkSave(dataCollectionId, items, options) {
458
463
  * checking for permissions or without its registered hooks.
459
464
  *
460
465
  * > **Notes:**
461
- * > - The `bulkRemove()` function also clears multiple-item reference fields
466
+ * > - The `bulkRemove()` method also clears multiple-item reference fields
462
467
  * > for items in collections referenced by the specified items. For example,
463
468
  * > suppose you have a **Movies** collection with an **Actors** field that
464
469
  * > contains multiple references to items in a **People** collection.
465
470
  * > Removing items in the **Movies** collection also clears the data in the
466
471
  * > corresponding multiple-item reference fields in the People collection.
467
- * > - Bulk operations are limited to 1000 items per function call.
472
+ * > - Bulk operations are limited to 1000 items per method call.
468
473
  * @public
469
474
  * @documentationMaturity preview
470
475
  * @requiredField dataCollectionId
471
476
  * @requiredField dataItemIds
472
477
  * @param dataCollectionId - ID of the collection items belong to.
473
478
  * @param itemIds - IDs of the items to remove. The array must contain at least one item. Passing an empty array returns an error.
474
- * @param options - An object containing options to use when processing this operation.
479
+ * @param options - Options to use when processing this operation.
475
480
  * @permissionScope Write Data Items
476
481
  * @permissionScopeId SCOPE.DC-DATA.WRITE
477
482
  */
@@ -480,17 +485,13 @@ export async function bulkRemove(dataCollectionId, itemIds, options) {
480
485
  return createWixData(httpClient, sideEffects).bulkRemove(dataCollectionId, itemIds, options);
481
486
  }
482
487
  /**
483
- * Checks if a reference to the referenced item exists in the specified
484
- * property of the referring item.
488
+ * Checks if a reference to the referenced item exists in the specified field of the referring item.
485
489
  *
486
- * The `isReferenced()` function returns a Promise that resolves to true if the
487
- * referring item contains a reference to the referenced item in the specified
488
- * property. The Promise is rejected if the current user does not have read
489
- * permissions for the collection.
490
+ * The `isReferenced()` method returns a Promise that resolves to true if the referring item contains a reference to the referenced item in the specified field. The Promise is rejected if the current user does not have read permissions for the collection.
490
491
  *
491
- * Calling the `isReferenced()` function does not trigger any hooks.
492
+ * Calling the `isReferenced()` method does not trigger any hooks.
492
493
  *
493
- * > **Note:** The `isReferenced()` function is not supported for Single Item
494
+ * > **Note:** The `isReferenced()` method is not supported for Single Item
494
495
  * > Collections.
495
496
  * @public
496
497
  * @documentationMaturity preview
@@ -498,118 +499,121 @@ export async function bulkRemove(dataCollectionId, itemIds, options) {
498
499
  * @requiredField referencedItemId
499
500
  * @requiredField referringItemFieldName
500
501
  * @requiredField referringItemId
502
+ * @requiredField referringItem
503
+ * @requiredField referencedItem
504
+ * @requiredField field
501
505
  * @param dataCollectionId - ID of the collection containing the referring item.
502
- * @param propertyName - Field to check for a reference to the item that may be referenced.
503
- * @param referringItem - The referring item.
504
- * @param referencedItem - Item that may be referenced.
506
+ * @param field - Field to check for a reference to the item that might be referenced.
507
+ * @param referringItem - Referring item.
508
+ * @param referencedItem - Item that might be referenced.
505
509
  * @param options - Options for checking whether a field contains a reference to an item.
506
510
  * @permissionScope Read Data Items
507
511
  * @permissionScopeId SCOPE.DC-DATA.READ
508
512
  */
509
- export async function isReferenced(dataCollectionId, propertyName, referringItem, referencedItem, options) {
513
+ export async function isReferenced(dataCollectionId, field, referringItem, referencedItem, options) {
510
514
  const { httpClient, sideEffects } = arguments[5];
511
- return createWixData(httpClient, sideEffects).isReferenced(dataCollectionId, propertyName, referringItem, referencedItem, options);
515
+ return createWixData(httpClient, sideEffects).isReferenced(dataCollectionId, field, referringItem, referencedItem, options);
512
516
  }
513
517
  /**
514
518
  * Inserts a reference in the specified property.
515
519
  *
516
- * The `insertReference()` function returns a Promise that resolves when a
520
+ * The `insertReference()` method returns a Promise that resolves when a
517
521
  * reference to the referenced item(s) is added to the referring item in the
518
522
  * specified property. The Promise is rejected if the current user does not
519
523
  * have update permissions for the collection.
520
524
  *
521
- * Calling the `insertReference()` function does not trigger any hooks.
525
+ * Calling the `insertReference()` method does not trigger any hooks.
522
526
  *
523
527
  * > **Notes:**
524
- * > - The `insertReference()` function only applies to multi-reference fields.
525
- * > - The `insertReference()` function is not supported for Single Item
528
+ * > - The `insertReference()` method only applies to multi-reference fields.
529
+ * > - The `insertReference()` method is not supported for Single Item
526
530
  * > Collections.
527
531
  * @public
528
532
  * @documentationMaturity preview
529
533
  * @requiredField dataCollectionId
530
- * @requiredField propertyName
534
+ * @requiredField field
531
535
  * @requiredField referringItem
532
536
  * @requiredField referencedItem
533
- * @param dataCollectionId - The ID of the collection that contains the referring item.
534
- * @param propertyName - The property to insert the reference into.
535
- * @param referringItem - The referring item or referring item's ID.
536
- * @param referencedItem - The referenced item, referenced item's ID, an array of referenced items, or an array of referenced item IDs.
537
- * @param options - An object containing options to use when processing this operation.
537
+ * @param dataCollectionId - ID of the collection that contains the referring item.
538
+ * @param field - Field to insert the reference into.
539
+ * @param referringItem - Referring item or referring item's ID.
540
+ * @param referencedItem - Referenced item, referenced item's ID, an array of referenced items, or an array of referenced item IDs.
541
+ * @param options - Options to use when processing this operation.
538
542
  * @permissionScope Write Data Items
539
543
  * @permissionScopeId SCOPE.DC-DATA.WRITE
540
544
  */
541
- export async function insertReference(dataCollectionId, propertyName, referringItem, referencedItem, options) {
545
+ export async function insertReference(dataCollectionId, field, referringItem, referencedItem, options) {
542
546
  const { httpClient, sideEffects } = arguments[4];
543
- if (typeof propertyName !== 'string' &&
547
+ if (typeof field !== 'string' &&
544
548
  referringItem == undefined &&
545
549
  referencedItem == undefined) {
546
550
  // support undocumented insertReference method when second parameter is WixDataReference[]
547
- return createWixData(httpClient, sideEffects).insertReference(dataCollectionId, propertyName, options);
551
+ return createWixData(httpClient, sideEffects).insertReference(dataCollectionId, field, options);
548
552
  }
549
553
  else {
550
- return createWixData(httpClient, sideEffects).insertReference(dataCollectionId, propertyName, referringItem, referencedItem, options);
554
+ return createWixData(httpClient, sideEffects).insertReference(dataCollectionId, field, referringItem, referencedItem, options);
551
555
  }
552
556
  }
553
557
  /**
554
558
  * Removes a reference from the specified property.
555
559
  *
556
- * The `removeReference()` function returns a Promise that resolves when a
560
+ * The `removeReference()` method returns a Promise that resolves when a
557
561
  * reference to the referenced item(s) is removed from the specified property
558
562
  * in the referring item. The Promise is rejected if the current user does not
559
563
  * have update permissions for the collection.
560
564
  *
561
- * Calling the `removeReference()` function does not trigger any hooks.
565
+ * Calling the `removeReference()` method does not trigger any hooks.
562
566
  *
563
- * > **Note:** The `removeReference()` function is not supported for Single
567
+ * > **Note:** The `removeReference()` method is not supported for Single
564
568
  * > Item Collections.
565
569
  * @public
566
570
  * @documentationMaturity preview
567
571
  * @requiredField dataCollectionId
568
- * @requiredField propertyName
572
+ * @requiredField field
569
573
  * @requiredField referringItem
570
574
  * @requiredField referencedItem
571
- * @param dataCollectionId - The ID of the collection that contains the referring item.
572
- * @param propertyName - The property to remove the reference from.
573
- * @param referringItem - The referring item or referring item's ID.
574
- * @param referencedItem - The referenced item, referenced item's ID, an array of referenced items, or an array of referenced item IDs.
575
- * @param options - An object containing options to use when processing this operation.
575
+ * @param dataCollectionId - ID of the collection that contains the referring item.
576
+ * @param field - Field from which to remove the reference.
577
+ * @param referringItem - Referring item or referring item's ID.
578
+ * @param referencedItem - Referenced item, referenced item's ID, an array of referenced items, or an array of referenced item IDs.
579
+ * @param options - Options to use when processing this operation.
576
580
  * @permissionScope Write Data Items
577
581
  * @permissionScopeId SCOPE.DC-DATA.WRITE
578
582
  */
579
- export async function removeReference(dataCollectionId, propertyName, referringItem, referencedItem, options) {
583
+ export async function removeReference(dataCollectionId, field, referringItem, referencedItem, options) {
580
584
  const { httpClient, sideEffects } = arguments[4];
581
- return createWixData(httpClient, sideEffects).removeReference(dataCollectionId, propertyName, referringItem, referencedItem, options);
585
+ return createWixData(httpClient, sideEffects).removeReference(dataCollectionId, field, referringItem, referencedItem, options);
582
586
  }
583
587
  /**
584
588
  * Replaces current references with references in the specified property.
585
589
  *
586
- * The `replaceReferences()` function returns a Promise that resolves when the
590
+ * The `replaceReferences()` method returns a Promise that resolves when the
587
591
  * item's current references in the specified property are removed and
588
592
  * references to the referenced items are added in their place. The Promise is
589
593
  * rejected if the current user does not have update permissions for the
590
594
  * collection.
591
595
  *
592
- * Calling the `replaceReferences()` function does not trigger any hooks.
596
+ * Calling the `replaceReferences()` method does not trigger any hooks.
593
597
  *
594
- * > **Note:** The `replaceReferences()` function is not supported for Single
598
+ * > **Note:** The `replaceReferences()` method is not supported for Single
595
599
  * > Item Collections.
596
600
  * @public
597
601
  * @documentationMaturity preview
598
602
  * @requiredField dataCollectionId
599
- * @requiredField propertyName
603
+ * @requiredField field
600
604
  * @requiredField referringItem
601
605
  * @requiredField referencedItem
602
- * @param dataCollectionId - The ID of the collection that contains the referring item.
603
- * @param propertyName - The property to replaces the references in.
604
- * @param referringItem - The referring item or referring item's ID.
605
- * @param referencedItem - The referenced item, referenced item's ID, an array of referenced items, or an array of referenced item IDs.
606
- * @param options - An object containing options to use when processing this operation.
606
+ * @param dataCollectionId - ID of the collection that contains the referring item.
607
+ * @param field - Field to replaces the references in.
608
+ * @param referringItem - Referring item or referring item's ID.
609
+ * @param referencedItem - Referenced item, referenced item's ID, an array of referenced items, or an array of referenced item IDs.
610
+ * @param options - Options to use when processing this operation.
607
611
  * @permissionScope Write Data Items
608
612
  * @permissionScopeId SCOPE.DC-DATA.WRITE
609
613
  */
610
- export async function replaceReferences(dataCollectionId, propertyName, referringItem, referencedItem, options) {
614
+ export async function replaceReferences(dataCollectionId, field, referringItem, referencedItem, options) {
611
615
  const { httpClient, sideEffects } = arguments[4];
612
- return createWixData(httpClient, sideEffects).replaceReferences(dataCollectionId, propertyName, referringItem, referencedItem, options);
616
+ return createWixData(httpClient, sideEffects).replaceReferences(dataCollectionId, field, referringItem, referencedItem, options);
613
617
  }
614
618
  export function patch(dataCollectionId, itemId) {
615
619
  const { httpClient, sideEffects } = arguments[2];
@@ -622,23 +626,33 @@ export function bulkPatch(dataCollectionId, itemIds) {
622
626
  /**
623
627
  * Creates a query to retrieve items from a database collection.
624
628
  *
625
- * The `query()` function builds a query to retrieve data items from a collection and returns a `WixDataQueryBuilder` object.
626
- *
627
- * The returned object contains the query definition which is typically used to run the query using the `find()` function.
629
+ * The `query()` method builds a query to retrieve data items from a collection and returns a `WixDataQuery` object, which contains the query definition.
628
630
  *
629
- * You can refine the query by chaining `WixDataQueryBuilder` functions onto the query. `WixDataQueryBuilder` functions enable you to sort, filter, and control the results that `query()` returns.
631
+ * You can refine the query by chaining `WixDataQuery` methods onto the query. `WixDataQuery` methods enable you to sort, filter, and control the results that `query()` returns.
630
632
  *
631
- * The functions that are chained to `query()` are applied in the order they are called. For example, if you sort on an `age` field in ascending order and then on a `name` field in descending order, the results are sorted first by the age of the items and then, if there are multiple results with the same age, the items are sorted by name in descending order, per age value.
633
+ * The methods that are chained to `query()` are applied in the order they are called. For example, if you sort on an `age` field in ascending order and then on a `name` field in descending order, the results are sorted first by the age of the items and then, if there are multiple results with the same age, the items are sorted by name in descending order, per age value.
632
634
  *
633
- * If the collection that you are querying has references to other collections, by default the data from referenced collections is not retrieved. To get the data from referenced items, specify them using `include()` function.
635
+ * The `query()` method runs with the following `WixDataQuery` defaults that you can override:
636
+ * - `skip`: 0
637
+ * - `limit`: 50
638
+ * - `descending`: by `_createdDate`
639
+ * - `include`: none
634
640
  *
635
- * > **Note**: When calling `query()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
641
+ * 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.
636
642
  *
643
+ * > **Notes**:
644
+ * > - When calling `query()` 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 `options.consistentRead` to `true`.
645
+ * - Items marked as hidden are not retrieved.
637
646
  *
647
+ * When working with Wix app collections, queried fields must have the following permissions:
648
+ * - Connect to data
649
+ * - Can use in dynamic page URLs
650
+ * - Can be sorted and filtered
651
+ * - Read-only: Check which fields can be used in a query.
638
652
  * @public
639
653
  * @documentationMaturity preview
640
654
  * @requiredField dataCollectionId
641
- * @param dataCollectionId - The ID of the collection to run the query on.
655
+ * @param dataCollectionId - ID of the collection to run the query on.
642
656
  * @permissionScope Read Data Items
643
657
  * @permissionScopeId SCOPE.DC-DATA.READ
644
658
  * @applicableIdentity APP
@@ -650,18 +664,24 @@ export function query(dataCollectionId) {
650
664
  /**
651
665
  * Creates an aggregation on a data collection.
652
666
  *
653
- * The `aggregate()` function builds an aggregation on the specified collection and returns a `WixDataAggregate` object.
667
+ * The `aggregate()` method builds an aggregation on the specified collection and returns a `WixDataAggregate` object.
654
668
  *
655
669
  * An aggregation enables you to perform certain calculations on your collection data, or on groups of items that you define, to retrieve meaningful summaries.
656
670
  * You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
657
671
  *
658
- * The returned object contains the aggregate definition which is typically used to run the aggregation using the `run()` function.
672
+ * The returned object contains the aggregate definition which is typically used to run the aggregation using the `run()` method.
673
+ *
674
+ * You can refine the aggregation by chaining `WixDataAggregate` methods on to the aggregate.
675
+ *
676
+ * The `aggregate()` method runs with the following defaults that you can override:
677
+ *
678
+ * + `skip` - 0
679
+ * + `limit`- 50
659
680
  *
660
- * You can refine the aggregation by chaining `WixDataAggregate` functions on to the aggregate.
661
681
  * @public
662
682
  * @documentationMaturity preview
663
683
  * @requiredField dataCollectionId
664
- * @param dataCollectionId - The ID of the collection to run the aggregation on.
684
+ * @param dataCollectionId - ID of the collection to run the aggregation on.
665
685
  * @permissionScope Read Data Items
666
686
  * @permissionScopeId SCOPE.DC-DATA.READ
667
687
  * @applicableIdentity APP
@@ -673,38 +693,41 @@ export function aggregate(dataCollectionId) {
673
693
  /**
674
694
  * Retrieves the full items referenced in the specified field of an item.
675
695
  *
676
- * Reference and multi-reference fields refer to items in different collections.
677
- * Use this function to retrieve the full details of the referenced items themselves.
696
+ * Reference and multi-reference fields refer to items in different collections. Use this method to retrieve the full details of the referenced items.
697
+ *
698
+ * 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.
678
699
  *
679
- * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection.
680
- * Querying the **Movies** collection using `queryReferenced()` returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
681
- * This gives you information from the **People** collection about each of the actors in the specified movie.
700
+ * 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.
682
701
  *
683
- * > **Note**: When calling `queryReferenced()` following an update to your collection, the data retrieved may not contain the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
702
+ * > **Notes**:
703
+ * > - Calling `queryReferenced()` does not trigger any hooks.
704
+ * > - You can only call `queryReferenced()` for [multi-reference fields](https://support.wix.com/en/article/about-referencing-multiple-items-in-one-field).
705
+ * > - This method does not support [single-item collections](ADDLINK).
706
+ * > - When calling `queryReferenced()` 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`.
707
+ * Learn more about [querying items that reference other items](https://support.wix.com/en/article/including-referenced-data-when-filtering).
684
708
  * @public
685
709
  * @documentationMaturity preview
686
710
  * @requiredField dataCollectionId
687
- * @requiredField holdingItem
688
- * @requiredField relationshipAttribute
689
- * @param dataCollectionId - The ID of the collection that contains the referring item.
690
- * @param holdingItem - The referring item or referring item's ID.
691
- * @param relationshipAttribute - The property that contains the references to the referenced items.
711
+ * @requiredField referringItem
712
+ * @requiredField field
713
+ * @param dataCollectionId - ID of the collection that contains the referring item.
714
+ * @param referringItem - Referring item or referring item's ID.
715
+ * @param field - Field that contains the references to the referenced items.
692
716
  * @param options - Options for querying referenced data items.
693
717
  * @permissionScope Read Data Items
694
718
  * @permissionScopeId SCOPE.DC-DATA.READ
695
719
  * @applicableIdentity APP
696
720
  */
697
- export async function queryReferenced(dataCollectionId, holdingItem, relationshipAttribute, options) {
721
+ export async function queryReferenced(dataCollectionId, referringItem, field, options) {
698
722
  const { httpClient, sideEffects } = arguments[4];
699
- return createWixData(httpClient, sideEffects).queryReferenced(dataCollectionId, holdingItem, relationshipAttribute, options);
723
+ return createWixData(httpClient, sideEffects).queryReferenced(dataCollectionId, referringItem, field, options);
700
724
  }
701
725
  /**
702
- * Creates a filter to be used with queries and aggregations.
726
+ * Creates a filter for queries and aggregations.
703
727
  *
704
- * The `filter()` function builds a filter to be applied to a query or an aggregation, and returns a `WixDataFilter` object.
705
- * The returned object contains the filter definition and can be combined with query builder using `and()`, `or()` and `not()` functions.
728
+ * 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.
706
729
  *
707
- * When working with Wix App Collections, check which fields can be used in a filter.
730
+ * When working with [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections), check which fields can be used in a filter.
708
731
  *
709
732
  * @public
710
733
  * @documentationMaturity preview