@wix/wix-data-items-sdk 1.0.147
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.
- package/README.md +8 -0
- package/build/cjs/context.d.ts +1 -0
- package/build/cjs/context.js +18 -0
- package/build/cjs/context.js.map +1 -0
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/data-items-api-client.d.ts +64 -0
- package/build/cjs/src/data-items-api-client.js +305 -0
- package/build/cjs/src/data-items-api-client.js.map +1 -0
- package/build/cjs/src/data-v2-data-item-items.context.d.ts +18 -0
- package/build/cjs/src/data-v2-data-item-items.context.js +51 -0
- package/build/cjs/src/data-v2-data-item-items.context.js.map +1 -0
- package/build/cjs/src/data-v2-data-item-items.meta.d.ts +27 -0
- package/build/cjs/src/data-v2-data-item-items.meta.js +103 -0
- package/build/cjs/src/data-v2-data-item-items.meta.js.map +1 -0
- package/build/cjs/src/data-v2-data-item-items.public.d.ts +32 -0
- package/build/cjs/src/data-v2-data-item-items.public.js +126 -0
- package/build/cjs/src/data-v2-data-item-items.public.js.map +1 -0
- package/build/cjs/src/data-v2-data-item-items.universal.d.ts +651 -0
- package/build/cjs/src/data-v2-data-item-items.universal.js +741 -0
- package/build/cjs/src/data-v2-data-item-items.universal.js.map +1 -0
- package/build/cjs/src/wix-data-api.d.ts +4 -0
- package/build/cjs/src/wix-data-api.js +13 -0
- package/build/cjs/src/wix-data-api.js.map +1 -0
- package/build/es/context.d.ts +1 -0
- package/build/es/context.js +2 -0
- package/build/es/context.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/index.typings.d.ts +1 -0
- package/build/es/index.typings.js +2 -0
- package/build/es/index.typings.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/build/es/src/data-items-api-client.d.ts +64 -0
- package/build/es/src/data-items-api-client.js +300 -0
- package/build/es/src/data-items-api-client.js.map +1 -0
- package/build/es/src/data-v2-data-item-items.context.d.ts +18 -0
- package/build/es/src/data-v2-data-item-items.context.js +32 -0
- package/build/es/src/data-v2-data-item-items.context.js.map +1 -0
- package/build/es/src/data-v2-data-item-items.meta.d.ts +27 -0
- package/build/es/src/data-v2-data-item-items.meta.js +62 -0
- package/build/es/src/data-v2-data-item-items.meta.js.map +1 -0
- package/build/es/src/data-v2-data-item-items.public.d.ts +32 -0
- package/build/es/src/data-v2-data-item-items.public.js +103 -0
- package/build/es/src/data-v2-data-item-items.public.js.map +1 -0
- package/build/es/src/data-v2-data-item-items.universal.d.ts +651 -0
- package/build/es/src/data-v2-data-item-items.universal.js +717 -0
- package/build/es/src/data-v2-data-item-items.universal.js.map +1 -0
- package/build/es/src/wix-data-api.d.ts +4 -0
- package/build/es/src/wix-data-api.js +10 -0
- package/build/es/src/wix-data-api.js.map +1 -0
- package/context/package.json +6 -0
- package/meta/package.json +6 -0
- package/package.json +77 -0
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
import { createWixData } from './wix-data-api';
|
|
2
|
+
import { WixDataPatch, QueryBase, } from '@wix/wix-data-items-common';
|
|
3
|
+
/**
|
|
4
|
+
* Adds an item to a collection.
|
|
5
|
+
*
|
|
6
|
+
* An item can only be inserted into an existing collection. You can create a new collection using the
|
|
7
|
+
* Data Collections API.
|
|
8
|
+
*
|
|
9
|
+
* The `insert()` function returns a Promise that resolves to the inserted item
|
|
10
|
+
* after it has been added to the specified collection. The Promise is rejected
|
|
11
|
+
* if the current user does not have "create" permissions for the collection or
|
|
12
|
+
* the specified item includes an `_id` property whose value matches an
|
|
13
|
+
* existing ID in the collection. Meaning, `insert()` cannot overwrite an
|
|
14
|
+
* existing item in the collection.
|
|
15
|
+
*
|
|
16
|
+
* Calling the `insert()` function triggers the `beforeInsert()` and
|
|
17
|
+
* `afterInsert()` hooks if they have been defined.
|
|
18
|
+
*
|
|
19
|
+
* Use the `options` parameter to run `insert()` from backend code without
|
|
20
|
+
* checking for permissions or without its registered hooks.
|
|
21
|
+
*
|
|
22
|
+
* When inserting an item into a collection that has a reference field, set the
|
|
23
|
+
* value of the reference field to the referenced item's `_id` value or the entire referenced item object.
|
|
24
|
+
*
|
|
25
|
+
* The `insert()` function adds the following properties and values to the item
|
|
26
|
+
* when it adds it to the collection:
|
|
27
|
+
* - `_id`: A unique identifier for an item in a collection, if the item
|
|
28
|
+
* doesn't have one or has one that is `undefined`. You can optionally provide
|
|
29
|
+
* your own ID. Once an ID is assigned to an item it cannot be changed.
|
|
30
|
+
* - `_createdDate`: The date the item was added to the collection.
|
|
31
|
+
* - `_updatedDate`: The date the item was modified. When the item is first
|
|
32
|
+
* added, the `_createdDate` and `_updatedDate` are the same.
|
|
33
|
+
*
|
|
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.
|
|
36
|
+
*
|
|
37
|
+
* The maximum size of an item that you can add to a collection is 500kb.
|
|
38
|
+
*
|
|
39
|
+
* > **Notes:**
|
|
40
|
+
* > - If an item's `_id` property value is set to `null` or an empty string,
|
|
41
|
+
* an error is thrown.
|
|
42
|
+
* > - When creating a Single Item Collection, an item with the system field
|
|
43
|
+
* > `_id` is pre-inserted into the collection. Single Item Collections may
|
|
44
|
+
* > contain only one item.
|
|
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
|
|
49
|
+
* > multi-reference fields, use `insertReference()`.
|
|
50
|
+
* @public
|
|
51
|
+
* @param dataCollectionId - ID of the collection item belongs to.
|
|
52
|
+
* @param item - Data item to insert.
|
|
53
|
+
* @param options - An object containing options to use when processing this operation.
|
|
54
|
+
* @documentationMaturity preview
|
|
55
|
+
* @requiredField dataCollectionId
|
|
56
|
+
* @requiredField item
|
|
57
|
+
* @permissionScope Write Data Items
|
|
58
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
59
|
+
*/
|
|
60
|
+
export async function insert(dataCollectionId, item, options) {
|
|
61
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
62
|
+
return createWixData(httpClient, sideEffects).insert(dataCollectionId, item, options);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Updates an item in a collection.
|
|
66
|
+
*
|
|
67
|
+
* The `update()` function returns a Promise that resolves to the updated item from
|
|
68
|
+
* the specified collection. The Promise is rejected if the current user does not
|
|
69
|
+
* have update permissions for the collection.
|
|
70
|
+
*
|
|
71
|
+
* Calling the `update()` function triggers the `beforeUpdate()` and `afterUpdate()`
|
|
72
|
+
* hooks if they have been defined.
|
|
73
|
+
*
|
|
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
|
|
79
|
+
* with the `_id` property values of the items in the specified collection. If
|
|
80
|
+
* an item in the collection has that `_id` value, `update()` replaces the
|
|
81
|
+
* item's property values with the ones in the specified item. If the existing
|
|
82
|
+
* item had properties with values and those properties were not included in
|
|
83
|
+
* the specified item, the values in those properties are lost. The item's
|
|
84
|
+
* `_updatedDate` property is also updated to the current date.
|
|
85
|
+
*
|
|
86
|
+
* Any valid JavaScript object can be used as a property value. The `update()`
|
|
87
|
+
* function maintains the structure of the specified object. For example,
|
|
88
|
+
* objects that contain nested objects, Arrays, or Arrays with nested objects
|
|
89
|
+
* are all added to the collection as defined.
|
|
90
|
+
*
|
|
91
|
+
* Use the `options` parameter to run `update()` from backend code without
|
|
92
|
+
* checking for permissions or without its registered hooks.
|
|
93
|
+
*
|
|
94
|
+
* When updating an item in a collection that has a reference field, set the
|
|
95
|
+
* value of the reference field to the referenced item's `_id` value or the
|
|
96
|
+
* entire referenced item object.
|
|
97
|
+
*
|
|
98
|
+
* The maximum size of an item that you can update in a collection is 500kb.
|
|
99
|
+
*
|
|
100
|
+
* > **Note:**
|
|
101
|
+
* > The update() function does not support multi-reference fields. For
|
|
102
|
+
* > multi-reference fields, use replaceReferences() or insertReference().
|
|
103
|
+
* @param dataCollectionId - ID of the collection item belongs to.
|
|
104
|
+
* @param item - Data item to update.
|
|
105
|
+
* @param options - An object containing options to use when processing this operation.
|
|
106
|
+
* @public
|
|
107
|
+
* @documentationMaturity preview
|
|
108
|
+
* @requiredField dataCollectionId
|
|
109
|
+
* @requiredField item
|
|
110
|
+
* @permissionScope Write Data Items
|
|
111
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
112
|
+
*/
|
|
113
|
+
export async function update(dataCollectionId, item, options) {
|
|
114
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
115
|
+
return createWixData(httpClient, sideEffects).update(dataCollectionId, item, options);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Inserts or updates an item in a collection.
|
|
119
|
+
*
|
|
120
|
+
* The `save()` function returns a Promise that resolves to the inserted or
|
|
121
|
+
* updated item after it has been added or updated in the specified
|
|
122
|
+
* collection. The Promise is rejected if the current user does not have
|
|
123
|
+
* the necessary permissions for the collection.
|
|
124
|
+
*
|
|
125
|
+
* The `save()` function inserts or updates the specified item, depending on
|
|
126
|
+
* whether it already exists in the collection. It compares the `_id` property
|
|
127
|
+
* value of the specified item with the `_id` property values of the items in
|
|
128
|
+
* the specified collection. If an item in the collection has that `_id` value,
|
|
129
|
+
* `save()` uses `update()` to update the item in the collection, triggering
|
|
130
|
+
* the `beforeUpdate()` and `afterUpdate()` hooks if they have been defined.
|
|
131
|
+
* If none of the items in the collection contain that `_id` value, the
|
|
132
|
+
* specified item does not have an `_id` property, or if the specified item's
|
|
133
|
+
* id property is `undefined`, `save()` uses `insert()` to add the specified
|
|
134
|
+
* item to the collection. This triggers the `beforeInsert()` and
|
|
135
|
+
* `afterInsert()` hooks if they have been defined.
|
|
136
|
+
*
|
|
137
|
+
* Use the `options` parameter to run `save()` from backend code without
|
|
138
|
+
* checking for permissions or without its registered hooks.
|
|
139
|
+
*
|
|
140
|
+
* When saving an item to a collection that has a reference field, set the
|
|
141
|
+
* value of the reference field to the referenced item's `_id` value or the
|
|
142
|
+
* entire referenced item object.
|
|
143
|
+
*
|
|
144
|
+
* The maximum size of an item that you can save to a collection is 500kb.
|
|
145
|
+
*
|
|
146
|
+
* > **Notes:**
|
|
147
|
+
* > - If an item's `_id` property value is set to null or an empty string, an
|
|
148
|
+
* > error is thrown.
|
|
149
|
+
* > - The `save()` function does not support multi-reference fields. For
|
|
150
|
+
* > multi-reference fields, use `insertReference() `or `replaceReferences()`.
|
|
151
|
+
* @public
|
|
152
|
+
* @documentationMaturity preview
|
|
153
|
+
* @requiredField dataCollectionId
|
|
154
|
+
* @requiredField item
|
|
155
|
+
* @param dataCollectionId - ID of the collection item belongs to.
|
|
156
|
+
* @param item - Data item to save.
|
|
157
|
+
* @param options - An object containing options to use when processing this operation.
|
|
158
|
+
* @permissionScope Write Data Items
|
|
159
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
160
|
+
*/
|
|
161
|
+
export async function save(dataCollectionId, item, options) {
|
|
162
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
163
|
+
return createWixData(httpClient, sideEffects).save(dataCollectionId, item, options);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Retrieves an item from a collection.
|
|
167
|
+
*
|
|
168
|
+
* The `get()` function returns a Promise that resolves to the item with ID
|
|
169
|
+
* `itemId` from the specified collection, or `null` if the `itemId` is not
|
|
170
|
+
* found. The Promise is rejected if the current user does not have read
|
|
171
|
+
* permissions for the collection.
|
|
172
|
+
*
|
|
173
|
+
* If the specified collection contains reference fields, the ID of the
|
|
174
|
+
* referenced item is returned. To return the values of the referenced items
|
|
175
|
+
* use `query()` and `include()`.
|
|
176
|
+
*
|
|
177
|
+
* Calling the `get()` function triggers the `beforeGet()` and `afterGet()`
|
|
178
|
+
* hooks if they have been defined.
|
|
179
|
+
*
|
|
180
|
+
* Use the `options` parameter to run `get()` from backend code without
|
|
181
|
+
* checking for permissions or without its registered hooks.
|
|
182
|
+
*
|
|
183
|
+
* > **Notes:**
|
|
184
|
+
* > - When using the `query()` or `get()` functions or another data retrieval
|
|
185
|
+
* > method following a change to your database collection, the data
|
|
186
|
+
* > retrieved may not contain your most recent changes. See Wix-data and
|
|
187
|
+
* > Eventual Consistency for more information. To solve this problem, you
|
|
188
|
+
* > can use the `setTimeout()` function to delay retrieving data following
|
|
189
|
+
* > any changes to your database collection.
|
|
190
|
+
* > - An `itemId` is required to retrieve an item even from a single-item
|
|
191
|
+
* > collection.
|
|
192
|
+
* @param dataCollectionId - ID of the collection item belongs to.
|
|
193
|
+
* @param itemId - ID of the data item to retrieve.
|
|
194
|
+
* @param options - An object containing options to use when processing this operation.
|
|
195
|
+
* @public
|
|
196
|
+
* @documentationMaturity preview
|
|
197
|
+
* @requiredField itemId
|
|
198
|
+
* @requiredField dataCollectionId.
|
|
199
|
+
* @permissionScope Read Data Items
|
|
200
|
+
* @permissionScopeId SCOPE.DC-DATA.READ
|
|
201
|
+
* @returns Retrieved item.
|
|
202
|
+
*/
|
|
203
|
+
export async function get(dataCollectionId, itemId, options) {
|
|
204
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
205
|
+
return createWixData(httpClient, sideEffects).get(dataCollectionId, itemId, options);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Removes an item from a collection.
|
|
209
|
+
*
|
|
210
|
+
* The `remove()` function returns a Promise that resolves to the removed item
|
|
211
|
+
* after it has been removed from the specified collection. The Promise is
|
|
212
|
+
* rejected if the current user does not have "delete" permissions for the
|
|
213
|
+
* collection.
|
|
214
|
+
*
|
|
215
|
+
* Calling the `remove()` function triggers the `beforeRemove()` and
|
|
216
|
+
* `afterRemove()` hooks if they have been defined.
|
|
217
|
+
*
|
|
218
|
+
* Use the `options` parameter to run `remove()` from backend code without
|
|
219
|
+
* checking for permissions or without its registered hooks.
|
|
220
|
+
*
|
|
221
|
+
* > **Notes:**
|
|
222
|
+
* > The `remove()` function also clears multiple-item reference fields for
|
|
223
|
+
* > items in collections referenced by the specified item. For example,
|
|
224
|
+
* > suppose you have a **Movies** collection with an **Actors** field that
|
|
225
|
+
* > contains multiple references to items in a **People** collection. Removing
|
|
226
|
+
* > an item in the **Movies** collection also clears the data in the
|
|
227
|
+
* > corresponding multiple-item reference fields in the **People** collection.
|
|
228
|
+
* @param dataCollectionId - ID of the collection item belongs to.
|
|
229
|
+
* @param itemId - ID of the item to remove.
|
|
230
|
+
* @param options - An object containing options to use when processing this operation.
|
|
231
|
+
* @public
|
|
232
|
+
* @documentationMaturity preview
|
|
233
|
+
* @requiredField itemId
|
|
234
|
+
* @requiredField dataCollectionId
|
|
235
|
+
* @permissionScope Write Data Items
|
|
236
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
237
|
+
*/
|
|
238
|
+
export async function remove(dataCollectionId, itemId, options) {
|
|
239
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
240
|
+
return createWixData(httpClient, sideEffects).remove(dataCollectionId, itemId, options);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Removes all items from a collection.
|
|
244
|
+
*
|
|
245
|
+
* The `truncate()` function returns a Promise that resolves after all items
|
|
246
|
+
* have been removed from the specified collection.
|
|
247
|
+
*
|
|
248
|
+
* `truncate()` runs when at least one of the following is true:
|
|
249
|
+
* - The current user is the site owner.
|
|
250
|
+
* - The request is performed in backend code with a `suppressAuth` options
|
|
251
|
+
* value of `true`.
|
|
252
|
+
*
|
|
253
|
+
* Calling the `truncate()` function does not trigger any hooks.
|
|
254
|
+
*
|
|
255
|
+
* > **Note:** `truncate()` also clears multiple-item reference fields in
|
|
256
|
+
* > collections referenced by the specified collection. For example, suppose you
|
|
257
|
+
* > have a **Movies** collection with an **Actors** field that contains multiple
|
|
258
|
+
* > references to items in a People collection. Truncating the **Movies**
|
|
259
|
+
* > collection also clears the data in the corresponding multiple-item reference
|
|
260
|
+
* > field in the People collection.
|
|
261
|
+
* @public
|
|
262
|
+
* @documentationMaturity preview
|
|
263
|
+
* @requiredField dataCollectionId
|
|
264
|
+
* @param dataCollectionId - ID of the collection to truncate.
|
|
265
|
+
* @permissionScope Write Data Items
|
|
266
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
267
|
+
*/
|
|
268
|
+
export async function truncate(dataCollectionId) {
|
|
269
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
270
|
+
return createWixData(httpClient, sideEffects).truncate(dataCollectionId);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Adds a number of items to a collection.
|
|
274
|
+
*
|
|
275
|
+
* The `bulkInsert()` function returns a Promise that resolves after the items
|
|
276
|
+
* have been added to the specified collection. The Promise is rejected if the
|
|
277
|
+
* current user does not have "create" permissions for the collection. Items
|
|
278
|
+
* are skipped if they include an `_id` property whose value matches an
|
|
279
|
+
* existing ID in the collection. Meaning, `bulkInsert()` cannot overwrite an
|
|
280
|
+
* existing item in the collection.
|
|
281
|
+
*
|
|
282
|
+
* Calling the `bulkInsert()` function triggers the `beforeInsert()` and
|
|
283
|
+
* `afterInsert()` hooks for each item that is inserted if the hooks have been
|
|
284
|
+
* defined.
|
|
285
|
+
*
|
|
286
|
+
* Use the options parameter to run `bulkInsert()` from backend code without
|
|
287
|
+
* checking for permissions or without its registered hooks.
|
|
288
|
+
*
|
|
289
|
+
* When inserting items into a collection that has a reference field, set the
|
|
290
|
+
* values of the reference fields to the referenced item's `_id` value or the
|
|
291
|
+
* entire referenced item object.
|
|
292
|
+
*
|
|
293
|
+
* The `bulkInsert()` function adds the following properties and values to the
|
|
294
|
+
* item when it adds it to the collection:
|
|
295
|
+
* - `_id`: A unique identifier for an item in a collection, if the item
|
|
296
|
+
* doesn't have one or has one that is `undefined`. You can optionally
|
|
297
|
+
* provide your own ID. Once an ID is assigned to an item it cannot be
|
|
298
|
+
* changed.
|
|
299
|
+
* - `_createdDate`: The date the item was added to the collection.
|
|
300
|
+
* - `_updatedDate`: The date the item was modified. When the item is first
|
|
301
|
+
* added, the `createdDate` and `updatedDate` are the same.
|
|
302
|
+
*
|
|
303
|
+
* Any valid JavaScript object can be added as a property value. The
|
|
304
|
+
* `bulkInsert()` function maintains the structure of the specified object. For
|
|
305
|
+
* example, objects that contain nested objects, Arrays, or Arrays with nested
|
|
306
|
+
* objects are all added to the collection as defined.
|
|
307
|
+
*
|
|
308
|
+
* The maximum size of an item that you can add to a collection is 500kb.
|
|
309
|
+
*
|
|
310
|
+
* > **Notes:**
|
|
311
|
+
* > - If an item's `_id` property value is set to `null` or an empty string,
|
|
312
|
+
* > 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
|
|
316
|
+
* > multi-reference fields, use `insertReference()`.
|
|
317
|
+
* @public
|
|
318
|
+
* @documentationMaturity preview
|
|
319
|
+
* @requiredField dataCollectionId
|
|
320
|
+
* @requiredField items
|
|
321
|
+
* @param dataCollectionId - ID of the collection items belong to.
|
|
322
|
+
* @param items - Data items to insert.
|
|
323
|
+
* @param options - An object containing options to use when processing this operation.
|
|
324
|
+
* @permissionScope Write Data Items
|
|
325
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
326
|
+
*/
|
|
327
|
+
export async function bulkInsert(dataCollectionId, items, options) {
|
|
328
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
329
|
+
return createWixData(httpClient, sideEffects).bulkInsert(dataCollectionId, items, options);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Updates a number of items in a collection.
|
|
333
|
+
*
|
|
334
|
+
* The `bulkUpdate()` function returns a Promise that resolves after the items
|
|
335
|
+
* have been updated in the specified collection. The Promise is rejected if
|
|
336
|
+
* the current user does not have update permissions for the collection. Items
|
|
337
|
+
* are skipped if they include an `_id` property whose value does not match an
|
|
338
|
+
* existing ID in the collection. Meaning, `bulkUpdate()` cannot add new items
|
|
339
|
+
* into the collection.
|
|
340
|
+
*
|
|
341
|
+
* Calling the `bulkUpdate()` function triggers the `beforeUpdate()` and
|
|
342
|
+
* `afterUpdate()` hooks for each item that is updated if the hooks have been
|
|
343
|
+
* defined.
|
|
344
|
+
*
|
|
345
|
+
* The `bulkUpdate()` function compares the `_id` property of the specified
|
|
346
|
+
* items with the `_id` property values of the items in the specified
|
|
347
|
+
* collection.
|
|
348
|
+
*
|
|
349
|
+
* > **Warning:** If an existing item in the specified collection matches the
|
|
350
|
+
* > `_id` of the specified item, bulkUpdate replaces the existing item's
|
|
351
|
+
* > property values with the ones in the specified item. **If the existing
|
|
352
|
+
* > item had properties with values and those properties were not included in
|
|
353
|
+
* > the specified item, the values in those properties are lost.** The item's
|
|
354
|
+
* `_updatedDate` property is also updated to the current date.
|
|
355
|
+
*
|
|
356
|
+
* Any valid JavaScript object can be used as a property value. The
|
|
357
|
+
* `bulkUpdate()` function maintains the structure of the specified object. For
|
|
358
|
+
* example, objects that contain nested objects, Arrays, or Arrays with nested
|
|
359
|
+
* objects are all added to the collection as defined.
|
|
360
|
+
*
|
|
361
|
+
* Use the options parameter to run `bulkUpdate()` from backend code without
|
|
362
|
+
* checking for permissions or without its registered hooks.
|
|
363
|
+
*
|
|
364
|
+
* When updating items in a collection that has a reference field, set the
|
|
365
|
+
* values of the reference field to the referenced item's `_id` value or the
|
|
366
|
+
* entire referenced item object.
|
|
367
|
+
*
|
|
368
|
+
* The maximum size of an item that you can update in a collection is 500kb.
|
|
369
|
+
*
|
|
370
|
+
* > **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
|
+
* > multi-reference fields, use `replaceReferences()` or `insertReference()`.
|
|
375
|
+
* @public
|
|
376
|
+
* @documentationMaturity preview
|
|
377
|
+
* @requiredField dataCollectionId
|
|
378
|
+
* @requiredField items
|
|
379
|
+
* @param dataCollectionId - ID of the collection items belong to.
|
|
380
|
+
* @param items - Data items to update.
|
|
381
|
+
* @param options - An object containing options to use when processing this operation.
|
|
382
|
+
* @permissionScope Write Data Items
|
|
383
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
384
|
+
*/
|
|
385
|
+
export async function bulkUpdate(dataCollectionId, items, options) {
|
|
386
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
387
|
+
return createWixData(httpClient, sideEffects).bulkUpdate(dataCollectionId, items, options);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Inserts or updates a number of items in a collection.
|
|
391
|
+
*
|
|
392
|
+
* The `bulkSave()` function returns a Promise that resolves after the items
|
|
393
|
+
* have been added or updated in the specified collection. The Promise is
|
|
394
|
+
* rejected if the current user does not have the necessary permissions for the
|
|
395
|
+
* collection.
|
|
396
|
+
*
|
|
397
|
+
* The `bulkSave()` function inserts or updates the specified items, depending
|
|
398
|
+
* on whether they already exist in the collection. It compares the `_id`
|
|
399
|
+
* property value of the specified items with the `_id` property values of the
|
|
400
|
+
* items in the specified collection.
|
|
401
|
+
*
|
|
402
|
+
* - If an item in the collection has the specified `_id` value, `bulkSave()`
|
|
403
|
+
* uses `update()` to update the item in the collection, triggering the
|
|
404
|
+
* `beforeUpdate()` and `afterUpdate()` hooks for that item if they have been
|
|
405
|
+
* defined.
|
|
406
|
+
* - If none of the items in the collection contain that `_id` value, the
|
|
407
|
+
* specified item does not have an `_id` property, or if the specified item's
|
|
408
|
+
* `_id` property is `undefined`, `bulkSave()` uses `insert()` to add the
|
|
409
|
+
* specified item into the collection. This triggers the `beforeInsert()` and
|
|
410
|
+
* `afterInsert()` hooks for that item if they have been defined.
|
|
411
|
+
*
|
|
412
|
+
* Use the `options` parameter to run `bulkSave()` from backend code without
|
|
413
|
+
* checking for permissions or without its registered hooks.
|
|
414
|
+
*
|
|
415
|
+
* When saving items to a collection that has a reference field, set the values
|
|
416
|
+
* of the reference fields to the referenced item's `_id` value or the entire
|
|
417
|
+
* referenced item object.
|
|
418
|
+
*
|
|
419
|
+
* The maximum size of an item that you can save to a collection is 500kb.
|
|
420
|
+
*
|
|
421
|
+
* > **Notes:**
|
|
422
|
+
* > - If an item's `_id` property value is set to null or an empty string, an
|
|
423
|
+
* > 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
|
|
427
|
+
* > multi-reference fields, use `replaceReferences()` or
|
|
428
|
+
* > `insertReference()`.
|
|
429
|
+
* @public
|
|
430
|
+
* @documentationMaturity preview
|
|
431
|
+
* @requiredField dataCollectionId
|
|
432
|
+
* @requiredField items
|
|
433
|
+
* @param dataCollectionId - ID of the collection items belong to.
|
|
434
|
+
* @param items - Data items to save.
|
|
435
|
+
* @param options - An object containing options to use when processing this operation.
|
|
436
|
+
* @permissionScope Write Data Items
|
|
437
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
438
|
+
*/
|
|
439
|
+
export async function bulkSave(dataCollectionId, items, options) {
|
|
440
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
441
|
+
return createWixData(httpClient, sideEffects).bulkSave(dataCollectionId, items, options);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Removes a number of items from a collection.
|
|
445
|
+
*
|
|
446
|
+
* The `bulkRemove()` function returns a Promise that resolves after the items
|
|
447
|
+
* have been removed from the specified collection. The Promise is rejected if
|
|
448
|
+
* the current user does not have "delete" permissions for the collection. If
|
|
449
|
+
* 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.
|
|
452
|
+
*
|
|
453
|
+
* Calling the `bulkRemove()` function triggers the `beforeRemove()` and
|
|
454
|
+
* `afterRemove()` hooks for each item that is deleted if the hooks have been
|
|
455
|
+
* defined.
|
|
456
|
+
*
|
|
457
|
+
* Use the options parameter to run `bulkRemove()` from backend code without
|
|
458
|
+
* checking for permissions or without its registered hooks.
|
|
459
|
+
*
|
|
460
|
+
* > **Notes:**
|
|
461
|
+
* > - The `bulkRemove()` function also clears multiple-item reference fields
|
|
462
|
+
* > for items in collections referenced by the specified items. For example,
|
|
463
|
+
* > suppose you have a **Movies** collection with an **Actors** field that
|
|
464
|
+
* > contains multiple references to items in a **People** collection.
|
|
465
|
+
* > Removing items in the **Movies** collection also clears the data in the
|
|
466
|
+
* > corresponding multiple-item reference fields in the People collection.
|
|
467
|
+
* > - Bulk operations are limited to 1000 items per function call.
|
|
468
|
+
* @public
|
|
469
|
+
* @documentationMaturity preview
|
|
470
|
+
* @requiredField dataCollectionId
|
|
471
|
+
* @requiredField dataItemIds
|
|
472
|
+
* @param dataCollectionId - ID of the collection items belong to.
|
|
473
|
+
* @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.
|
|
475
|
+
* @permissionScope Write Data Items
|
|
476
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
477
|
+
*/
|
|
478
|
+
export async function bulkRemove(dataCollectionId, itemIds, options) {
|
|
479
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
480
|
+
return createWixData(httpClient, sideEffects).bulkRemove(dataCollectionId, itemIds, options);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Checks if a reference to the referenced item exists in the specified
|
|
484
|
+
* property of the referring item.
|
|
485
|
+
*
|
|
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
|
+
*
|
|
491
|
+
* Calling the `isReferenced()` function does not trigger any hooks.
|
|
492
|
+
*
|
|
493
|
+
* > **Note:** The `isReferenced()` function is not supported for Single Item
|
|
494
|
+
* > Collections.
|
|
495
|
+
* @public
|
|
496
|
+
* @documentationMaturity preview
|
|
497
|
+
* @requiredField dataCollectionId
|
|
498
|
+
* @requiredField referencedItemId
|
|
499
|
+
* @requiredField referringItemFieldName
|
|
500
|
+
* @requiredField referringItemId
|
|
501
|
+
* @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.
|
|
505
|
+
* @param options - Options for checking whether a field contains a reference to an item.
|
|
506
|
+
* @permissionScope Read Data Items
|
|
507
|
+
* @permissionScopeId SCOPE.DC-DATA.READ
|
|
508
|
+
*/
|
|
509
|
+
export async function isReferenced(dataCollectionId, propertyName, referringItem, referencedItem, options) {
|
|
510
|
+
const { httpClient, sideEffects } = arguments[5];
|
|
511
|
+
return createWixData(httpClient, sideEffects).isReferenced(dataCollectionId, propertyName, referringItem, referencedItem, options);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Inserts a reference in the specified property.
|
|
515
|
+
*
|
|
516
|
+
* The `insertReference()` function returns a Promise that resolves when a
|
|
517
|
+
* reference to the referenced item(s) is added to the referring item in the
|
|
518
|
+
* specified property. The Promise is rejected if the current user does not
|
|
519
|
+
* have update permissions for the collection.
|
|
520
|
+
*
|
|
521
|
+
* Calling the `insertReference()` function does not trigger any hooks.
|
|
522
|
+
*
|
|
523
|
+
* > **Notes:**
|
|
524
|
+
* > - The `insertReference()` function only applies to multi-reference fields.
|
|
525
|
+
* > - The `insertReference()` function is not supported for Single Item
|
|
526
|
+
* > Collections.
|
|
527
|
+
* @public
|
|
528
|
+
* @documentationMaturity preview
|
|
529
|
+
* @requiredField dataCollectionId
|
|
530
|
+
* @requiredField propertyName
|
|
531
|
+
* @requiredField referringItem
|
|
532
|
+
* @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.
|
|
538
|
+
* @permissionScope Write Data Items
|
|
539
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
540
|
+
*/
|
|
541
|
+
export async function insertReference(dataCollectionId, propertyName, referringItem, referencedItem, options) {
|
|
542
|
+
const { httpClient, sideEffects } = arguments[4];
|
|
543
|
+
if (typeof propertyName !== 'string' &&
|
|
544
|
+
referringItem == undefined &&
|
|
545
|
+
referencedItem == undefined) {
|
|
546
|
+
// support undocumented insertReference method when second parameter is WixDataReference[]
|
|
547
|
+
return createWixData(httpClient, sideEffects).insertReference(dataCollectionId, propertyName, options);
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
return createWixData(httpClient, sideEffects).insertReference(dataCollectionId, propertyName, referringItem, referencedItem, options);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Removes a reference from the specified property.
|
|
555
|
+
*
|
|
556
|
+
* The `removeReference()` function returns a Promise that resolves when a
|
|
557
|
+
* reference to the referenced item(s) is removed from the specified property
|
|
558
|
+
* in the referring item. The Promise is rejected if the current user does not
|
|
559
|
+
* have update permissions for the collection.
|
|
560
|
+
*
|
|
561
|
+
* Calling the `removeReference()` function does not trigger any hooks.
|
|
562
|
+
*
|
|
563
|
+
* > **Note:** The `removeReference()` function is not supported for Single
|
|
564
|
+
* > Item Collections.
|
|
565
|
+
* @public
|
|
566
|
+
* @documentationMaturity preview
|
|
567
|
+
* @requiredField dataCollectionId
|
|
568
|
+
* @requiredField propertyName
|
|
569
|
+
* @requiredField referringItem
|
|
570
|
+
* @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.
|
|
576
|
+
* @permissionScope Write Data Items
|
|
577
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
578
|
+
*/
|
|
579
|
+
export async function removeReference(dataCollectionId, propertyName, referringItem, referencedItem, options) {
|
|
580
|
+
const { httpClient, sideEffects } = arguments[4];
|
|
581
|
+
return createWixData(httpClient, sideEffects).removeReference(dataCollectionId, propertyName, referringItem, referencedItem, options);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Replaces current references with references in the specified property.
|
|
585
|
+
*
|
|
586
|
+
* The `replaceReferences()` function returns a Promise that resolves when the
|
|
587
|
+
* item's current references in the specified property are removed and
|
|
588
|
+
* references to the referenced items are added in their place. The Promise is
|
|
589
|
+
* rejected if the current user does not have update permissions for the
|
|
590
|
+
* collection.
|
|
591
|
+
*
|
|
592
|
+
* Calling the `replaceReferences()` function does not trigger any hooks.
|
|
593
|
+
*
|
|
594
|
+
* > **Note:** The `replaceReferences()` function is not supported for Single
|
|
595
|
+
* > Item Collections.
|
|
596
|
+
* @public
|
|
597
|
+
* @documentationMaturity preview
|
|
598
|
+
* @requiredField dataCollectionId
|
|
599
|
+
* @requiredField propertyName
|
|
600
|
+
* @requiredField referringItem
|
|
601
|
+
* @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.
|
|
607
|
+
* @permissionScope Write Data Items
|
|
608
|
+
* @permissionScopeId SCOPE.DC-DATA.WRITE
|
|
609
|
+
*/
|
|
610
|
+
export async function replaceReferences(dataCollectionId, propertyName, referringItem, referencedItem, options) {
|
|
611
|
+
const { httpClient, sideEffects } = arguments[4];
|
|
612
|
+
return createWixData(httpClient, sideEffects).replaceReferences(dataCollectionId, propertyName, referringItem, referencedItem, options);
|
|
613
|
+
}
|
|
614
|
+
export function patch(dataCollectionId, itemId) {
|
|
615
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
616
|
+
return createWixData(httpClient, sideEffects).patch(dataCollectionId, itemId);
|
|
617
|
+
}
|
|
618
|
+
export function bulkPatch(dataCollectionId, itemIds) {
|
|
619
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
620
|
+
return createWixData(httpClient, sideEffects).bulkPatch(dataCollectionId, itemIds);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Creates a query to retrieve items from a database collection.
|
|
624
|
+
*
|
|
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.
|
|
628
|
+
*
|
|
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.
|
|
630
|
+
*
|
|
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.
|
|
632
|
+
*
|
|
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.
|
|
634
|
+
*
|
|
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`.
|
|
636
|
+
*
|
|
637
|
+
*
|
|
638
|
+
* @public
|
|
639
|
+
* @documentationMaturity preview
|
|
640
|
+
* @requiredField dataCollectionId
|
|
641
|
+
* @param dataCollectionId - The ID of the collection to run the query on.
|
|
642
|
+
* @permissionScope Read Data Items
|
|
643
|
+
* @permissionScopeId SCOPE.DC-DATA.READ
|
|
644
|
+
* @applicableIdentity APP
|
|
645
|
+
*/
|
|
646
|
+
export function query(dataCollectionId) {
|
|
647
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
648
|
+
return createWixData(httpClient, sideEffects).query(dataCollectionId);
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Creates an aggregation on a data collection.
|
|
652
|
+
*
|
|
653
|
+
* The `aggregate()` function builds an aggregation on the specified collection and returns a `WixDataAggregate` object.
|
|
654
|
+
*
|
|
655
|
+
* 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
|
+
* You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
|
|
657
|
+
*
|
|
658
|
+
* The returned object contains the aggregate definition which is typically used to run the aggregation using the `run()` function.
|
|
659
|
+
*
|
|
660
|
+
* You can refine the aggregation by chaining `WixDataAggregate` functions on to the aggregate.
|
|
661
|
+
* @public
|
|
662
|
+
* @documentationMaturity preview
|
|
663
|
+
* @requiredField dataCollectionId
|
|
664
|
+
* @param dataCollectionId - The ID of the collection to run the aggregation on.
|
|
665
|
+
* @permissionScope Read Data Items
|
|
666
|
+
* @permissionScopeId SCOPE.DC-DATA.READ
|
|
667
|
+
* @applicableIdentity APP
|
|
668
|
+
*/
|
|
669
|
+
export function aggregate(dataCollectionId) {
|
|
670
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
671
|
+
return createWixData(httpClient, sideEffects).aggregate(dataCollectionId);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Retrieves the full items referenced in the specified field of an item.
|
|
675
|
+
*
|
|
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.
|
|
678
|
+
*
|
|
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.
|
|
682
|
+
*
|
|
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`.
|
|
684
|
+
* @public
|
|
685
|
+
* @documentationMaturity preview
|
|
686
|
+
* @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.
|
|
692
|
+
* @param options - Options for querying referenced data items.
|
|
693
|
+
* @permissionScope Read Data Items
|
|
694
|
+
* @permissionScopeId SCOPE.DC-DATA.READ
|
|
695
|
+
* @applicableIdentity APP
|
|
696
|
+
*/
|
|
697
|
+
export async function queryReferenced(dataCollectionId, holdingItem, relationshipAttribute, options) {
|
|
698
|
+
const { httpClient, sideEffects } = arguments[4];
|
|
699
|
+
return createWixData(httpClient, sideEffects).queryReferenced(dataCollectionId, holdingItem, relationshipAttribute, options);
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Creates a filter to be used with queries and aggregations.
|
|
703
|
+
*
|
|
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.
|
|
706
|
+
*
|
|
707
|
+
* When working with Wix App Collections, check which fields can be used in a filter.
|
|
708
|
+
*
|
|
709
|
+
* @public
|
|
710
|
+
* @documentationMaturity preview
|
|
711
|
+
*/
|
|
712
|
+
export function filter() {
|
|
713
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
714
|
+
return createWixData(httpClient, sideEffects).filter;
|
|
715
|
+
}
|
|
716
|
+
export { WixDataPatch, QueryBase, };
|
|
717
|
+
//# sourceMappingURL=data-v2-data-item-items.universal.js.map
|