@wix/data 1.0.0

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.
Files changed (103) hide show
  1. package/build/cjs/index.d.ts +4 -0
  2. package/build/cjs/index.js +27 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/data-v1-external-database-connection.http.d.ts +29 -0
  5. package/build/cjs/src/data-v1-external-database-connection.http.js +397 -0
  6. package/build/cjs/src/data-v1-external-database-connection.http.js.map +1 -0
  7. package/build/cjs/src/data-v1-external-database-connection.public.d.ts +11 -0
  8. package/build/cjs/src/data-v1-external-database-connection.public.js +36 -0
  9. package/build/cjs/src/data-v1-external-database-connection.public.js.map +1 -0
  10. package/build/cjs/src/data-v1-external-database-connection.types.d.ts +53 -0
  11. package/build/cjs/src/data-v1-external-database-connection.types.js +3 -0
  12. package/build/cjs/src/data-v1-external-database-connection.types.js.map +1 -0
  13. package/build/cjs/src/data-v1-external-database-connection.universal.d.ts +129 -0
  14. package/build/cjs/src/data-v1-external-database-connection.universal.js +334 -0
  15. package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -0
  16. package/build/cjs/src/data-v2-data-collection.http.d.ts +37 -0
  17. package/build/cjs/src/data-v2-data-collection.http.js +458 -0
  18. package/build/cjs/src/data-v2-data-collection.http.js.map +1 -0
  19. package/build/cjs/src/data-v2-data-collection.public.d.ts +12 -0
  20. package/build/cjs/src/data-v2-data-collection.public.js +48 -0
  21. package/build/cjs/src/data-v2-data-collection.public.js.map +1 -0
  22. package/build/cjs/src/data-v2-data-collection.types.d.ts +638 -0
  23. package/build/cjs/src/data-v2-data-collection.types.js +143 -0
  24. package/build/cjs/src/data-v2-data-collection.types.js.map +1 -0
  25. package/build/cjs/src/data-v2-data-collection.universal.d.ts +732 -0
  26. package/build/cjs/src/data-v2-data-collection.universal.js +532 -0
  27. package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -0
  28. package/build/cjs/src/data-v2-data-item.http.d.ts +192 -0
  29. package/build/cjs/src/data-v2-data-item.http.js +944 -0
  30. package/build/cjs/src/data-v2-data-item.http.js.map +1 -0
  31. package/build/cjs/src/data-v2-data-item.public.d.ts +28 -0
  32. package/build/cjs/src/data-v2-data-item.public.js +137 -0
  33. package/build/cjs/src/data-v2-data-item.public.js.map +1 -0
  34. package/build/cjs/src/data-v2-data-item.types.d.ts +656 -0
  35. package/build/cjs/src/data-v2-data-item.types.js +27 -0
  36. package/build/cjs/src/data-v2-data-item.types.js.map +1 -0
  37. package/build/cjs/src/data-v2-data-item.universal.d.ts +1343 -0
  38. package/build/cjs/src/data-v2-data-item.universal.js +1435 -0
  39. package/build/cjs/src/data-v2-data-item.universal.js.map +1 -0
  40. package/build/cjs/src/data-v2-index.http.d.ts +29 -0
  41. package/build/cjs/src/data-v2-index.http.js +349 -0
  42. package/build/cjs/src/data-v2-index.http.js.map +1 -0
  43. package/build/cjs/src/data-v2-index.public.d.ts +10 -0
  44. package/build/cjs/src/data-v2-index.public.js +28 -0
  45. package/build/cjs/src/data-v2-index.public.js.map +1 -0
  46. package/build/cjs/src/data-v2-index.types.d.ts +120 -0
  47. package/build/cjs/src/data-v2-index.types.js +35 -0
  48. package/build/cjs/src/data-v2-index.types.js.map +1 -0
  49. package/build/cjs/src/data-v2-index.universal.d.ts +182 -0
  50. package/build/cjs/src/data-v2-index.universal.js +261 -0
  51. package/build/cjs/src/data-v2-index.universal.js.map +1 -0
  52. package/build/es/index.d.ts +4 -0
  53. package/build/es/index.js +5 -0
  54. package/build/es/index.js.map +1 -0
  55. package/build/es/src/data-v1-external-database-connection.http.d.ts +29 -0
  56. package/build/es/src/data-v1-external-database-connection.http.js +389 -0
  57. package/build/es/src/data-v1-external-database-connection.http.js.map +1 -0
  58. package/build/es/src/data-v1-external-database-connection.public.d.ts +11 -0
  59. package/build/es/src/data-v1-external-database-connection.public.js +28 -0
  60. package/build/es/src/data-v1-external-database-connection.public.js.map +1 -0
  61. package/build/es/src/data-v1-external-database-connection.types.d.ts +53 -0
  62. package/build/es/src/data-v1-external-database-connection.types.js +2 -0
  63. package/build/es/src/data-v1-external-database-connection.types.js.map +1 -0
  64. package/build/es/src/data-v1-external-database-connection.universal.d.ts +129 -0
  65. package/build/es/src/data-v1-external-database-connection.universal.js +307 -0
  66. package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -0
  67. package/build/es/src/data-v2-data-collection.http.d.ts +37 -0
  68. package/build/es/src/data-v2-data-collection.http.js +450 -0
  69. package/build/es/src/data-v2-data-collection.http.js.map +1 -0
  70. package/build/es/src/data-v2-data-collection.public.d.ts +12 -0
  71. package/build/es/src/data-v2-data-collection.public.js +29 -0
  72. package/build/es/src/data-v2-data-collection.public.js.map +1 -0
  73. package/build/es/src/data-v2-data-collection.types.d.ts +638 -0
  74. package/build/es/src/data-v2-data-collection.types.js +140 -0
  75. package/build/es/src/data-v2-data-collection.types.js.map +1 -0
  76. package/build/es/src/data-v2-data-collection.universal.d.ts +732 -0
  77. package/build/es/src/data-v2-data-collection.universal.js +505 -0
  78. package/build/es/src/data-v2-data-collection.universal.js.map +1 -0
  79. package/build/es/src/data-v2-data-item.http.d.ts +192 -0
  80. package/build/es/src/data-v2-data-item.http.js +920 -0
  81. package/build/es/src/data-v2-data-item.http.js.map +1 -0
  82. package/build/es/src/data-v2-data-item.public.d.ts +28 -0
  83. package/build/es/src/data-v2-data-item.public.js +109 -0
  84. package/build/es/src/data-v2-data-item.public.js.map +1 -0
  85. package/build/es/src/data-v2-data-item.types.d.ts +656 -0
  86. package/build/es/src/data-v2-data-item.types.js +24 -0
  87. package/build/es/src/data-v2-data-item.types.js.map +1 -0
  88. package/build/es/src/data-v2-data-item.universal.d.ts +1343 -0
  89. package/build/es/src/data-v2-data-item.universal.js +1392 -0
  90. package/build/es/src/data-v2-data-item.universal.js.map +1 -0
  91. package/build/es/src/data-v2-index.http.d.ts +29 -0
  92. package/build/es/src/data-v2-index.http.js +343 -0
  93. package/build/es/src/data-v2-index.http.js.map +1 -0
  94. package/build/es/src/data-v2-index.public.d.ts +10 -0
  95. package/build/es/src/data-v2-index.public.js +19 -0
  96. package/build/es/src/data-v2-index.public.js.map +1 -0
  97. package/build/es/src/data-v2-index.types.d.ts +120 -0
  98. package/build/es/src/data-v2-index.types.js +32 -0
  99. package/build/es/src/data-v2-index.types.js.map +1 -0
  100. package/build/es/src/data-v2-index.universal.d.ts +182 -0
  101. package/build/es/src/data-v2-index.universal.js +236 -0
  102. package/build/es/src/data-v2-index.universal.js.map +1 -0
  103. package/package.json +37 -0
@@ -0,0 +1,1343 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface DataItem {
8
+ /** Data item ID. */
9
+ _id?: string;
10
+ /**
11
+ * Data item contents.
12
+ *
13
+ * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:
14
+ *
15
+ * + `_id`: Item ID.
16
+ * + `_createdDate`: Date and time the item was added to the collection.
17
+ * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
18
+ * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.
19
+ */
20
+ data?: Record<string, any> | null;
21
+ }
22
+ export interface InsertDataItemRequest {
23
+ /** ID of the collection in which to insert the item. */
24
+ dataCollectionId: string;
25
+ /** Item to insert. */
26
+ dataItem: DataItem;
27
+ }
28
+ export declare enum Environment {
29
+ LIVE = "LIVE",
30
+ SANDBOX = "SANDBOX"
31
+ }
32
+ export interface Options {
33
+ }
34
+ export interface PublishPluginOptions {
35
+ showDraftItems?: boolean;
36
+ }
37
+ export interface InsertDataItemResponse {
38
+ /** Inserted data item. */
39
+ dataItem?: DataItem;
40
+ }
41
+ export interface UpdateDataItemRequest {
42
+ /** ID of the collection containing the existing item. */
43
+ dataCollectionId: string;
44
+ /** Updated data item content. The existing data item's content is replaced entirely. */
45
+ dataItem: DataItem;
46
+ }
47
+ export interface UpdateDataItemResponse {
48
+ /** Updated data item. */
49
+ dataItem?: DataItem;
50
+ }
51
+ export interface SaveDataItemRequest {
52
+ /** ID of the collection in which to insert or update the item. */
53
+ dataCollectionId: string;
54
+ /** Data item to insert or update. */
55
+ dataItem: DataItem;
56
+ }
57
+ export interface SaveDataItemResponse {
58
+ /**
59
+ * The action carried out for the item.
60
+ *
61
+ * + `INSERTED`: A new item was added to the collection.
62
+ * + `UPDATED`: An existing item in the collection was updated.
63
+ */
64
+ action?: Action;
65
+ /** Inserted or updated data item. */
66
+ dataItem?: DataItem;
67
+ }
68
+ export declare enum Action {
69
+ UNKNOWN_ACTION = "UNKNOWN_ACTION",
70
+ INSERTED = "INSERTED",
71
+ UPDATED = "UPDATED"
72
+ }
73
+ export interface GetDataItemRequest {
74
+ /** ID of the collection from which to retrieve the data item. */
75
+ dataCollectionId: string;
76
+ /** ID of the data item to retrieve. */
77
+ dataItemId: string;
78
+ /**
79
+ * Whether to retrieve data from the primary database instance.
80
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
81
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
82
+ *
83
+ * Default: `false`
84
+ */
85
+ consistentRead?: boolean;
86
+ }
87
+ export interface GetDataItemResponse {
88
+ /** Retrieved item. */
89
+ dataItem?: DataItem;
90
+ }
91
+ export interface RemoveDataItemRequest {
92
+ /** ID of the collection from which to remove the item. */
93
+ dataCollectionId: string;
94
+ /** ID of the item to remove. */
95
+ dataItemId: string;
96
+ }
97
+ export interface RemoveDataItemResponse {
98
+ /** Removed item. */
99
+ dataItem?: DataItem;
100
+ }
101
+ export interface TruncateDataItemsRequest {
102
+ /** ID of the collection to truncate. */
103
+ dataCollectionId: string;
104
+ }
105
+ export interface TruncateDataItemsResponse {
106
+ }
107
+ export interface QueryDataItemsRequest {
108
+ /** ID of the collection in which to insert the item. */
109
+ dataCollectionId: string;
110
+ /** Query preferences. For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). */
111
+ query?: QueryV2;
112
+ /**
113
+ * Whether to return the total count in the response for a query with offset paging.
114
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
115
+ *
116
+ * Default: `false`
117
+ */
118
+ returnTotalCount?: boolean;
119
+ /**
120
+ * Properties for which to include referenced items in the query's results.
121
+ * Up to 50 referenced items can be included for each item that matches the query.
122
+ */
123
+ includeReferencedItems?: string[];
124
+ /**
125
+ * Whether to retrieve data from the primary database instance.
126
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
127
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
128
+ *
129
+ * Default: `false`
130
+ */
131
+ consistentRead?: boolean;
132
+ }
133
+ export interface QueryV2 extends QueryV2PagingMethodOneOf {
134
+ /** Paging options to limit and skip the number of items. */
135
+ paging?: Paging;
136
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
137
+ cursorPaging?: CursorPaging;
138
+ /**
139
+ * Filter object in the following format:
140
+ *
141
+ * `"filter" : {
142
+ * "fieldName1": "value1",
143
+ * "fieldName2":{"$operator":"value2"}
144
+ * }`
145
+ *
146
+ * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
147
+ */
148
+ filter?: Record<string, any> | null;
149
+ /**
150
+ * Sort object in the following format:
151
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
152
+ */
153
+ sort?: Sorting[];
154
+ /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */
155
+ fields?: string[];
156
+ }
157
+ /** @oneof */
158
+ export interface QueryV2PagingMethodOneOf {
159
+ /** Paging options to limit and skip the number of items. */
160
+ paging?: Paging;
161
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
162
+ cursorPaging?: CursorPaging;
163
+ }
164
+ export interface Sorting {
165
+ /** Name of the field to sort by. */
166
+ fieldName?: string;
167
+ /** Sort order. */
168
+ order?: SortOrder;
169
+ }
170
+ export declare enum SortOrder {
171
+ ASC = "ASC",
172
+ DESC = "DESC"
173
+ }
174
+ export interface Paging {
175
+ /** Number of items to load. */
176
+ limit?: number | null;
177
+ /** Number of items to skip in the current sort order. */
178
+ offset?: number | null;
179
+ }
180
+ export interface CursorPaging {
181
+ /** Number of items to load. */
182
+ limit?: number | null;
183
+ /**
184
+ * Pointer to the next or previous page in the list of results.
185
+ *
186
+ * You can get the relevant cursor token
187
+ * from the `pagingMetadata` object in the previous call's response.
188
+ * Not relevant for the first request.
189
+ */
190
+ cursor?: string | null;
191
+ }
192
+ export interface QueryDataItemsResponse {
193
+ /** Retrieved items. */
194
+ dataItems?: DataItem[];
195
+ /** Paging information. */
196
+ pagingMetadata?: PagingMetadataV2;
197
+ }
198
+ export interface PagingMetadataV2 {
199
+ /** Number of items returned in the response. */
200
+ count?: number | null;
201
+ /** Offset that was requested. */
202
+ offset?: number | null;
203
+ /** Total number of items that match the query. Returned if offset paging is used, `returnTotalCount` is `true` in the request, and `tooManyToCount` is false. */
204
+ total?: number | null;
205
+ /** Whether the server failed to calculate the `total` field. */
206
+ tooManyToCount?: boolean | null;
207
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
208
+ cursors?: Cursors;
209
+ }
210
+ export interface Cursors {
211
+ /** Cursor pointing to next page in the list of results. */
212
+ next?: string | null;
213
+ /** Cursor pointing to previous page in the list of results. */
214
+ prev?: string | null;
215
+ }
216
+ export interface AggregateDataItemsRequest extends AggregateDataItemsRequestPagingMethodOneOf {
217
+ /** Paging options to limit and skip the number of items. */
218
+ paging?: Paging;
219
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
220
+ cursorPaging?: CursorPaging;
221
+ /** ID of the collection on which to run the aggregation. */
222
+ dataCollectionId: string;
223
+ /** Filter applied to the collection's data prior to running the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */
224
+ initialFilter?: Record<string, any> | null;
225
+ /** Aggregation applied to the data. */
226
+ aggregation?: Aggregation;
227
+ /** Filter applied to the processed data following the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */
228
+ finalFilter?: Record<string, any> | null;
229
+ /**
230
+ * Sort object in the following format:
231
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
232
+ */
233
+ sort?: Sorting[];
234
+ /**
235
+ * Whether to return the total count in the response for a query with offset paging.
236
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
237
+ *
238
+ * Default: `false`
239
+ */
240
+ returnTotalCount?: boolean;
241
+ /**
242
+ * Whether to retrieve data from the primary database instance.
243
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
244
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
245
+ *
246
+ * Default: `false`
247
+ */
248
+ consistentRead?: boolean;
249
+ }
250
+ /** @oneof */
251
+ export interface AggregateDataItemsRequestPagingMethodOneOf {
252
+ /** Paging options to limit and skip the number of items. */
253
+ paging?: Paging;
254
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
255
+ cursorPaging?: CursorPaging;
256
+ }
257
+ export interface Average {
258
+ /** Name of the field for which to calculate the average value. */
259
+ itemFieldName?: string;
260
+ }
261
+ export interface Min {
262
+ /** Name of the field for which to calculate the minimum value. */
263
+ itemFieldName?: string;
264
+ }
265
+ export interface Max {
266
+ /** Name of the field for which to calculate the maximum value. */
267
+ itemFieldName?: string;
268
+ }
269
+ export interface Sum {
270
+ /** Name of the field for which to calculate the sum. */
271
+ itemFieldName?: string;
272
+ }
273
+ export interface Count {
274
+ }
275
+ export interface Operation extends OperationCalculateOneOf {
276
+ /** Calculate the average value of a specified field for all items in the grouping. */
277
+ average?: Average;
278
+ /** Calculate the minimum value of a specified field for all items in the grouping. */
279
+ min?: Min;
280
+ /** Calculate the maximum value of a specified field for all items in the grouping. */
281
+ max?: Max;
282
+ /** Calculate the sum of values of a specified field for all items in the grouping. */
283
+ sum?: Sum;
284
+ /** Calculate the number of items in the grouping. */
285
+ itemCount?: Count;
286
+ /** Name of the field containing results of the operation. */
287
+ resultFieldName?: string;
288
+ }
289
+ /** @oneof */
290
+ export interface OperationCalculateOneOf {
291
+ /** Calculate the average value of a specified field for all items in the grouping. */
292
+ average?: Average;
293
+ /** Calculate the minimum value of a specified field for all items in the grouping. */
294
+ min?: Min;
295
+ /** Calculate the maximum value of a specified field for all items in the grouping. */
296
+ max?: Max;
297
+ /** Calculate the sum of values of a specified field for all items in the grouping. */
298
+ sum?: Sum;
299
+ /** Calculate the number of items in the grouping. */
300
+ itemCount?: Count;
301
+ }
302
+ export interface Aggregation {
303
+ /** Fields by which to group items for the aggregation. If empty, the aggregation is carried out on all items in the collection. */
304
+ groupingFields?: string[];
305
+ /** Operations to carry out on the data in each grouping. */
306
+ operations?: Operation[];
307
+ }
308
+ export interface AggregateDataItemsResponse {
309
+ /** Aggregation results. */
310
+ results?: Record<string, any>[] | null;
311
+ /** Paging information. */
312
+ pagingMetadata?: PagingMetadataV2;
313
+ }
314
+ export interface CountDataItemsRequest {
315
+ /** ID of the collection for which to count query results. */
316
+ dataCollectionId: string;
317
+ /**
318
+ * Filter object in the following format:
319
+ *
320
+ * `"filter" : {
321
+ * "fieldName1": "value1",
322
+ * "fieldName2":{"$operator":"value2"}
323
+ * }`.
324
+ *
325
+ * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
326
+ */
327
+ filter?: Record<string, any> | null;
328
+ /**
329
+ * Whether to retrieve data from the primary database instance.
330
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
331
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
332
+ *
333
+ * Default: `false`
334
+ */
335
+ consistentRead?: boolean;
336
+ }
337
+ export interface CountDataItemsResponse {
338
+ /** Number of items matching the query. */
339
+ totalCount?: number;
340
+ }
341
+ export interface QueryDistinctValuesRequest extends QueryDistinctValuesRequestPagingMethodOneOf {
342
+ /** Paging options to limit and skip the number of items. */
343
+ paging?: Paging;
344
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
345
+ cursorPaging?: CursorPaging;
346
+ /** ID of the collection to query. */
347
+ dataCollectionId: string;
348
+ /** Item field name for which to return all distinct values. */
349
+ fieldName?: string;
350
+ /**
351
+ * Filter object in the following format:
352
+ *
353
+ * `"filter" : {
354
+ * "fieldName1": "value1",
355
+ * "fieldName2":{"$operator":"value2"}
356
+ * }`.
357
+ *
358
+ * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
359
+ */
360
+ filter?: Record<string, any> | null;
361
+ /** Sort order. */
362
+ order?: SortOrder;
363
+ /**
364
+ * Whether to return the total count in the response for a query with offset paging.
365
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
366
+ *
367
+ * Default: `false`
368
+ */
369
+ returnTotalCount?: boolean;
370
+ /**
371
+ * Whether to retrieve data from the primary database instance.
372
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
373
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
374
+ *
375
+ * Default: `false`
376
+ */
377
+ consistentRead?: boolean;
378
+ }
379
+ /** @oneof */
380
+ export interface QueryDistinctValuesRequestPagingMethodOneOf {
381
+ /** Paging options to limit and skip the number of items. */
382
+ paging?: Paging;
383
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
384
+ cursorPaging?: CursorPaging;
385
+ }
386
+ export interface QueryDistinctValuesResponse {
387
+ /** List of distinct values contained in the field specified in `fieldName`. */
388
+ distinctValues?: any[];
389
+ /** Paging information. */
390
+ pagingMetadata?: PagingMetadataV2;
391
+ }
392
+ export interface BulkInsertDataItemsRequest {
393
+ /** ID of the collection in which to insert the items. */
394
+ dataCollectionId: string;
395
+ /** Data items to insert. */
396
+ dataItems: DataItem[];
397
+ /**
398
+ * Whether to return the inserted data items.
399
+ * When `true`, the `results` objects contain a `dataItem` field.
400
+ *
401
+ * Default: `false`
402
+ */
403
+ returnEntity?: boolean;
404
+ }
405
+ export interface BulkInsertDataItemsResponse {
406
+ /** Information about the inserted items. */
407
+ results?: BulkDataItemResult[];
408
+ /** Bulk action metadata. */
409
+ bulkActionMetadata?: BulkActionMetadata;
410
+ }
411
+ export interface BulkDataItemResult {
412
+ /** The action attempted for the data item. */
413
+ action?: BulkActionType;
414
+ /** Metadata related to the data item for which the action was attempted. */
415
+ itemMetadata?: ItemMetadata;
416
+ /** The data item for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */
417
+ dataItem?: DataItem;
418
+ }
419
+ export declare enum BulkActionType {
420
+ UNKNOWN_ACTION_TYPE = "UNKNOWN_ACTION_TYPE",
421
+ INSERT = "INSERT",
422
+ UPDATE = "UPDATE",
423
+ DELETE = "DELETE"
424
+ }
425
+ export interface ItemMetadata {
426
+ /** Item ID. This field doesn't appear if there is no item ID, for example, when item creation fails. */
427
+ _id?: string | null;
428
+ /** Index of the item within the request array. Allows for correlation between request and response items. */
429
+ originalIndex?: number;
430
+ /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
431
+ success?: boolean;
432
+ /** Details about the error in case of failure. */
433
+ error?: ApplicationError;
434
+ }
435
+ export interface ApplicationError {
436
+ /** Error code. */
437
+ code?: string;
438
+ /** Description of the error. */
439
+ description?: string;
440
+ /** Data related to the error. */
441
+ data?: Record<string, any> | null;
442
+ }
443
+ export interface BulkActionMetadata {
444
+ /** Number of items successfully processed. */
445
+ totalSuccesses?: number;
446
+ /** Number of items that couldn't be processed. */
447
+ totalFailures?: number;
448
+ }
449
+ export interface BulkUpdateDataItemsRequest {
450
+ /** ID of the collection in which to update items. */
451
+ dataCollectionId: string;
452
+ /** Data items to update. */
453
+ dataItems: DataItem[];
454
+ /**
455
+ * Whether to return the updated data items.
456
+ * When `true`, the `results` objects contain a `dataItem` field.
457
+ *
458
+ * Default: `false`
459
+ */
460
+ returnEntity?: boolean;
461
+ }
462
+ export interface BulkUpdateDataItemsResponse {
463
+ /** Information about the updated items. */
464
+ results?: BulkDataItemResult[];
465
+ /** Bulk action metadata. */
466
+ bulkActionMetadata?: BulkActionMetadata;
467
+ }
468
+ export interface BulkSaveDataItemsRequest {
469
+ /** ID of the collection in which to insert or update the items. */
470
+ dataCollectionId: string;
471
+ /** Data items to insert or update. */
472
+ dataItems: DataItem[];
473
+ /**
474
+ * Whether to return the saved data item.
475
+ * When `true`, the `results` objects contain a `dataItem` field.
476
+ *
477
+ * Default: `false`
478
+ */
479
+ returnEntity?: boolean;
480
+ }
481
+ export interface BulkSaveDataItemsResponse {
482
+ /** Information about the saved items. */
483
+ results?: BulkDataItemResult[];
484
+ /** Bulk action metadata. */
485
+ bulkActionMetadata?: BulkActionMetadata;
486
+ }
487
+ export interface BulkRemoveDataItemsRequest {
488
+ /** ID of the collection from which to remove the item. */
489
+ dataCollectionId: string;
490
+ /** IDs of data items to remove. */
491
+ dataItemIds: string[];
492
+ }
493
+ export interface BulkRemoveDataItemsResponse {
494
+ /** Information about the removed data items. */
495
+ results?: BulkDataItemResult[];
496
+ /** Bulk action metadata. */
497
+ bulkActionMetadata?: BulkActionMetadata;
498
+ }
499
+ export interface QueryReferencedDataItemsRequest extends QueryReferencedDataItemsRequestPagingMethodOneOf {
500
+ /** Paging options to limit and skip the number of items. */
501
+ paging?: Paging;
502
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
503
+ cursorPaging?: CursorPaging;
504
+ /** ID of the collection containing the referring item. */
505
+ dataCollectionId: string;
506
+ /** ID of the referring item. */
507
+ referringItemId?: string;
508
+ /** Field containing references in the referring item. */
509
+ referringItemFieldName?: string;
510
+ /** Order of the returned referenced items. Sorted by the date each item was referenced. */
511
+ order?: SortOrder;
512
+ /**
513
+ * Whether to return the total count in the response.
514
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
515
+ *
516
+ * Default: `false`
517
+ */
518
+ returnTotalCount?: boolean;
519
+ /**
520
+ * Whether to retrieve data from the primary database instance.
521
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
522
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
523
+ *
524
+ * Default: `false`
525
+ */
526
+ consistentRead?: boolean;
527
+ }
528
+ /** @oneof */
529
+ export interface QueryReferencedDataItemsRequestPagingMethodOneOf {
530
+ /** Paging options to limit and skip the number of items. */
531
+ paging?: Paging;
532
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
533
+ cursorPaging?: CursorPaging;
534
+ }
535
+ export interface QueryReferencedDataItemsResponse {
536
+ /** Referenced items and/or IDs. For successfully resolved references, the referenced data item is returned. For references that can't be resolved, the ID is returned. */
537
+ results?: ReferencedResult[];
538
+ /** Paging information. */
539
+ pagingMetadata?: PagingMetadataV2;
540
+ }
541
+ export interface UnresolvedReference {
542
+ /** ID of the referring item. */
543
+ referringItemId?: string;
544
+ /** Field specified to query for references. */
545
+ referringItemFieldName?: string;
546
+ }
547
+ export interface ReferencedResult extends ReferencedResultEntityOneOf {
548
+ /** Data item referenced. */
549
+ dataItem?: DataItem;
550
+ /** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */
551
+ unresolvedReference?: UnresolvedReference;
552
+ }
553
+ /** @oneof */
554
+ export interface ReferencedResultEntityOneOf {
555
+ /** Data item referenced. */
556
+ dataItem?: DataItem;
557
+ /** Unresolved reference. Appears instead of the data item when the reference doesn't resolve, for example, when an ID isn't found or if an item is in draft state. */
558
+ unresolvedReference?: UnresolvedReference;
559
+ }
560
+ export interface IsReferencedDataItemRequest {
561
+ /** ID of the collection containing the referring data item. */
562
+ dataCollectionId: string;
563
+ /** Field to check for a reference to the item that may be referenced. */
564
+ referringItemFieldName: string;
565
+ /** ID of the referring item. */
566
+ referringItemId: string;
567
+ /** ID of the item that may be referenced. */
568
+ referencedItemId: string;
569
+ /**
570
+ * Whether to retrieve data from the primary database instance.
571
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
572
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
573
+ *
574
+ * Default: `false`
575
+ */
576
+ consistentRead?: boolean;
577
+ }
578
+ export interface IsReferencedDataItemResponse {
579
+ /** Whether the specified reference exists. */
580
+ isReferenced?: boolean;
581
+ }
582
+ export interface InsertDataItemReferenceRequest {
583
+ /** ID of the collection in which to insert the reference. */
584
+ dataCollectionId: string;
585
+ /** Reference to insert */
586
+ dataItemReference?: DataItemReference;
587
+ }
588
+ export interface DataItemReference {
589
+ /** Referring item field containing the references to the referenced items. */
590
+ referringItemFieldName?: string;
591
+ /** ID of the referring item. */
592
+ referringItemId?: string;
593
+ /** ID of the referenced item. */
594
+ referencedItemId?: string;
595
+ }
596
+ export interface InsertDataItemReferenceResponse {
597
+ /** Inserted reference. */
598
+ dataItemReference?: DataItemReference;
599
+ }
600
+ export interface RemoveDataItemReferenceRequest {
601
+ /** ID of the collection containing the referring item. */
602
+ dataCollectionId: string;
603
+ /** Reference to remove. */
604
+ dataItemReference: DataItemReference;
605
+ }
606
+ export interface RemoveDataItemReferenceResponse {
607
+ /** Removed reference. */
608
+ dataItemReference?: DataItemReference;
609
+ }
610
+ export interface BulkInsertDataItemReferencesRequest {
611
+ /** ID of the collection containing the referring items. */
612
+ dataCollectionId: string;
613
+ /** References to insert. */
614
+ dataItemReferences: DataItemReference[];
615
+ /**
616
+ * Whether to return the inserted data item references.
617
+ * When `true`, the `results` objects contain a `dataItemReference` field.
618
+ *
619
+ * Default: `false`
620
+ */
621
+ returnEntity?: boolean;
622
+ }
623
+ export interface BulkInsertDataItemReferencesResponse {
624
+ /** Information about the inserted references. */
625
+ results?: BulkDataItemReferenceResult[];
626
+ /** Bulk action metadata. */
627
+ bulkActionMetadata?: BulkActionMetadata;
628
+ }
629
+ export interface BulkDataItemReferenceResult {
630
+ /** The action attempted for the reference. */
631
+ action?: BulkActionType;
632
+ /** Metadata related to the reference for which the action was attempted. */
633
+ referenceMetadata?: ItemMetadata;
634
+ /** The reference for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */
635
+ dataItemReference?: DataItemReference;
636
+ }
637
+ export interface BulkRemoveDataItemReferencesRequest {
638
+ /** ID of the collection containing the referring items. */
639
+ dataCollectionId: string;
640
+ /** References to remove. */
641
+ dataItemReferences: DataItemReference[];
642
+ }
643
+ export interface BulkRemoveDataItemReferencesResponse {
644
+ /** Information about the removed references. */
645
+ results?: BulkDataItemReferenceResult[];
646
+ /** Bulk action metadata. */
647
+ bulkActionMetadata?: BulkActionMetadata;
648
+ }
649
+ export interface ReplaceDataItemReferencesRequest {
650
+ /** ID of the collection containing the referring item. */
651
+ dataCollectionId: string;
652
+ /** Field containing references in the referring item. */
653
+ referringItemFieldName: string;
654
+ /** ID of the referring item. */
655
+ referringItemId: string;
656
+ /** List of new referenced item IDs to replace the existing ones. */
657
+ newReferencedItemIds?: string[];
658
+ }
659
+ export interface ReplaceDataItemReferencesResponse {
660
+ /** Updated references. */
661
+ dataItemReferences?: DataItemReference[];
662
+ }
663
+ /**
664
+ * Adds an item to a collection.
665
+ *
666
+ *
667
+ * An item can only be inserted into an existing connection.
668
+ * You can create a new collection using the [Data Collections API](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections).
669
+ *
670
+ * When an item is inserted into a collection, the item's ID is automatically assigned a random value.
671
+ * You can optionally provide a custom ID in `dataItem.id` when inserting the item.
672
+ * If you specify an ID that already exists in the collection, the insertion will fail.
673
+ *
674
+ * If `dataItem.data` is empty, a new item is created with no data fields.
675
+ * @public
676
+ * @documentationMaturity preview
677
+ * @requiredField options
678
+ * @requiredField options.dataCollectionId
679
+ * @requiredField options.dataItem
680
+ */
681
+ export declare function insertDataItem(options: InsertDataItemOptions): Promise<InsertDataItemResponse>;
682
+ export interface InsertDataItemOptions {
683
+ /** ID of the collection in which to insert the item. */
684
+ dataCollectionId: string;
685
+ /** Item to insert. */
686
+ dataItem: DataItem;
687
+ }
688
+ /**
689
+ * Updates an item in a collection.
690
+ *
691
+ *
692
+ * This endpoint replaces the data item's existing data with the payload provided in `dataItem.data` in the request.
693
+ *
694
+ * To update an item, you need to specify an item ID and a collection ID.
695
+ * If an item is found in the specified collection with the specified ID, that item is updated.
696
+ * If the collection doesn't contain an item with that ID, the request fails.
697
+ *
698
+ * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
699
+ *
700
+ * > **Note:**
701
+ * > After an item is updated, it only contains the fields included in the `dataItem.data` payload in Update Data Item request.
702
+ * > If the existing item has fields with values and those fields aren't included in the updated item, their values are lost.
703
+ * @param _id - Data item ID.
704
+ * @public
705
+ * @documentationMaturity preview
706
+ * @requiredField _id
707
+ * @requiredField options
708
+ * @requiredField options.dataCollectionId
709
+ * @requiredField options.dataItem
710
+ */
711
+ export declare function updateDataItem(_id: string, options: UpdateDataItemOptions): Promise<UpdateDataItemResponse>;
712
+ export interface UpdateDataItemOptions {
713
+ dataItem: {
714
+ /** Data item ID. */
715
+ _id?: string;
716
+ /**
717
+ * Data item contents.
718
+ *
719
+ * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:
720
+ *
721
+ * + `_id`: Item ID.
722
+ * + `_createdDate`: Date and time the item was added to the collection.
723
+ * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
724
+ * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.
725
+ */
726
+ data?: Record<string, any> | null;
727
+ };
728
+ /** ID of the collection containing the existing item. */
729
+ dataCollectionId: string;
730
+ }
731
+ /**
732
+ * Inserts or updates an item in a collection.
733
+ *
734
+ *
735
+ * The Save Data Item endpoint inserts or updates the specified item, depending on whether it already exists in the collection.
736
+ *
737
+ * + If you don't provide an ID, a new item is created.
738
+ *
739
+ * + If you provide an ID that does not exist in the collection, a new item is created with that ID.
740
+ *
741
+ * + If an item with the ID you provide already exists in the collection, that item is updated. When an item is updated, its `data._updatedDate` field is changed to the current date and time.
742
+ *
743
+ * > **Note:** When you provide an item with an ID that already exists in the collection, the payload you provide in `dataItem.data` replaces the existing item with that ID.
744
+ * > This means that the item's previous fields and values are lost.
745
+ * @public
746
+ * @documentationMaturity preview
747
+ * @requiredField options
748
+ * @requiredField options.dataCollectionId
749
+ * @requiredField options.dataItem
750
+ */
751
+ export declare function saveDataItem(options: SaveDataItemOptions): Promise<SaveDataItemResponse>;
752
+ export interface SaveDataItemOptions {
753
+ /** ID of the collection in which to insert or update the item. */
754
+ dataCollectionId: string;
755
+ /** Data item to insert or update. */
756
+ dataItem: DataItem;
757
+ }
758
+ /**
759
+ * Retrieves an item from a collection.
760
+ * @param dataItemId - ID of the data item to retrieve.
761
+ * @public
762
+ * @documentationMaturity preview
763
+ * @requiredField dataItemId
764
+ * @requiredField options
765
+ * @requiredField options.dataCollectionId
766
+ * @returns Retrieved item.
767
+ */
768
+ export declare function getDataItem(dataItemId: string, options: GetDataItemOptions): Promise<DataItem>;
769
+ export interface GetDataItemOptions {
770
+ /** ID of the collection from which to retrieve the data item. */
771
+ dataCollectionId: string;
772
+ /**
773
+ * Whether to retrieve data from the primary database instance.
774
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
775
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
776
+ *
777
+ * Default: `false`
778
+ */
779
+ consistentRead?: boolean;
780
+ }
781
+ /**
782
+ * Removes an item from a collection.
783
+ *
784
+ *
785
+ * If any items in other collections reference the removed item in reference or multi-reference fields, those fields are cleared.
786
+ *
787
+ * > **Note:**
788
+ * > Once an item has been removed from a collection, it can't be restored.
789
+ * @param dataItemId - ID of the item to remove.
790
+ * @public
791
+ * @documentationMaturity preview
792
+ * @requiredField dataItemId
793
+ * @requiredField options
794
+ * @requiredField options.dataCollectionId
795
+ */
796
+ export declare function removeDataItem(dataItemId: string, options: RemoveDataItemOptions): Promise<RemoveDataItemResponse>;
797
+ export interface RemoveDataItemOptions {
798
+ /** ID of the collection from which to remove the item. */
799
+ dataCollectionId: string;
800
+ }
801
+ /**
802
+ * Removes all items from a collection.
803
+ *
804
+ *
805
+ * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
806
+ *
807
+ * > **Note:**
808
+ * > Once items have been removed from a collection, they can't be restored.
809
+ * @public
810
+ * @documentationMaturity preview
811
+ * @requiredField options
812
+ * @requiredField options.dataCollectionId
813
+ */
814
+ export declare function truncateDataItems(options: TruncateDataItemsOptions): Promise<void>;
815
+ export interface TruncateDataItemsOptions {
816
+ /** ID of the collection to truncate. */
817
+ dataCollectionId: string;
818
+ }
819
+ /**
820
+ * Retrieves a list of items, on the basis of the filtering, sorting, and paging preferences you provide.
821
+ *
822
+ *
823
+ * For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
824
+ * @public
825
+ * @documentationMaturity preview
826
+ * @requiredField options.options
827
+ * @requiredField options.options.dataCollectionId
828
+ */
829
+ export declare function queryDataItems(options: QueryDataItemsOptions): DataItemsQueryBuilder;
830
+ export interface QueryDataItemsOptions {
831
+ /** ID of the collection in which to insert the item. */
832
+ dataCollectionId: string;
833
+ /**
834
+ * Whether to return the total count in the response for a query with offset paging.
835
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
836
+ *
837
+ * Default: `false`
838
+ */
839
+ returnTotalCount?: boolean | undefined;
840
+ /**
841
+ * Properties for which to include referenced items in the query's results.
842
+ * Up to 50 referenced items can be included for each item that matches the query.
843
+ */
844
+ includeReferencedItems?: string[] | undefined;
845
+ /**
846
+ * Whether to retrieve data from the primary database instance.
847
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
848
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
849
+ *
850
+ * Default: `false`
851
+ */
852
+ consistentRead?: boolean | undefined;
853
+ }
854
+ interface QueryOffsetResult {
855
+ currentPage: number;
856
+ totalPages: number;
857
+ totalCount: number;
858
+ hasNext: () => boolean;
859
+ hasPrev: () => boolean;
860
+ length: number;
861
+ pageSize: number;
862
+ }
863
+ export interface DataItemsQueryResult extends QueryOffsetResult {
864
+ items: DataItem[];
865
+ query: DataItemsQueryBuilder;
866
+ next: () => Promise<DataItemsQueryResult>;
867
+ prev: () => Promise<DataItemsQueryResult>;
868
+ }
869
+ export interface DataItemsQueryBuilder {
870
+ /** @param propertyName - Property whose value is compared with `value`.
871
+ * @param value - Value to compare against.
872
+ * @documentationMaturity preview
873
+ */
874
+ eq: (propertyName: '_id' | 'data' | string, value: any) => DataItemsQueryBuilder;
875
+ /** @param propertyName - Property whose value is compared with `value`.
876
+ * @param value - Value to compare against.
877
+ * @documentationMaturity preview
878
+ */
879
+ ne: (propertyName: '_id' | 'data' | string, value: any) => DataItemsQueryBuilder;
880
+ /** @param propertyName - Property whose value is compared with `string`.
881
+ * @param string - String to compare against. Case-insensitive.
882
+ * @documentationMaturity preview
883
+ */
884
+ startsWith: (propertyName: '_id' | string, value: string) => DataItemsQueryBuilder;
885
+ /** @param propertyName - Property whose value is compared with `values`.
886
+ * @param values - List of values to compare against.
887
+ * @documentationMaturity preview
888
+ */
889
+ hasSome: (propertyName: '_id' | 'data' | string, value: any[]) => DataItemsQueryBuilder;
890
+ /** @documentationMaturity preview */
891
+ in: (propertyName: '_id' | 'data' | string, value: any) => DataItemsQueryBuilder;
892
+ /** @documentationMaturity preview */
893
+ exists: (propertyName: '_id' | 'data' | string, value: boolean) => DataItemsQueryBuilder;
894
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
895
+ * @documentationMaturity preview
896
+ */
897
+ ascending: (...propertyNames: Array<'_id' | 'data' | string>) => DataItemsQueryBuilder;
898
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
899
+ * @documentationMaturity preview
900
+ */
901
+ descending: (...propertyNames: Array<'_id' | 'data' | string>) => DataItemsQueryBuilder;
902
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
903
+ * @documentationMaturity preview
904
+ */
905
+ limit: (limit: number) => DataItemsQueryBuilder;
906
+ /** @param skip - Number of items to skip in the query results before returning the results.
907
+ * @documentationMaturity preview
908
+ */
909
+ skip: (skip: number) => DataItemsQueryBuilder;
910
+ /** @documentationMaturity preview */
911
+ find: () => Promise<DataItemsQueryResult>;
912
+ }
913
+ /**
914
+ * Runs an aggregation on a data collection and returns the resulting list of items.
915
+ *
916
+ *
917
+ * An aggregation enables you to perform certain calculations on your collection data, or on groups of items that you define, to retrieve meaningful summaries.
918
+ * You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
919
+ * @public
920
+ * @documentationMaturity preview
921
+ * @requiredField options
922
+ * @requiredField options.dataCollectionId
923
+ */
924
+ export declare function aggregateDataItems(options: AggregateDataItemsOptions): Promise<AggregateDataItemsResponse>;
925
+ export interface AggregateDataItemsOptions extends AggregateDataItemsRequestPagingMethodOneOf {
926
+ /** ID of the collection on which to run the aggregation. */
927
+ dataCollectionId: string;
928
+ /** Filter applied to the collection's data prior to running the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */
929
+ initialFilter?: Record<string, any> | null;
930
+ /** Aggregation applied to the data. */
931
+ aggregation?: Aggregation;
932
+ /** Filter applied to the processed data following the aggregation. See [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section) for information on how to structure a filter object. */
933
+ finalFilter?: Record<string, any> | null;
934
+ /** Paging options to limit and skip the number of items. */
935
+ paging?: Paging;
936
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
937
+ cursorPaging?: CursorPaging;
938
+ /**
939
+ * Sort object in the following format:
940
+ * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
941
+ */
942
+ sort?: Sorting[];
943
+ /**
944
+ * Whether to return the total count in the response for a query with offset paging.
945
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
946
+ *
947
+ * Default: `false`
948
+ */
949
+ returnTotalCount?: boolean;
950
+ /**
951
+ * Whether to retrieve data from the primary database instance.
952
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
953
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
954
+ *
955
+ * Default: `false`
956
+ */
957
+ consistentRead?: boolean;
958
+ }
959
+ /**
960
+ * Counts the number of items in a data collection that match the provided filtering preferences.
961
+ * @public
962
+ * @documentationMaturity preview
963
+ * @requiredField options
964
+ * @requiredField options.dataCollectionId
965
+ */
966
+ export declare function countDataItems(options: CountDataItemsOptions): Promise<CountDataItemsResponse>;
967
+ export interface CountDataItemsOptions {
968
+ /** ID of the collection for which to count query results. */
969
+ dataCollectionId: string;
970
+ /**
971
+ * Filter object in the following format:
972
+ *
973
+ * `"filter" : {
974
+ * "fieldName1": "value1",
975
+ * "fieldName2":{"$operator":"value2"}
976
+ * }`.
977
+ *
978
+ * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
979
+ */
980
+ filter?: Record<string, any> | null;
981
+ /**
982
+ * Whether to retrieve data from the primary database instance.
983
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
984
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
985
+ *
986
+ * Default: `false`
987
+ */
988
+ consistentRead?: boolean;
989
+ }
990
+ /**
991
+ * Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
992
+ *
993
+ *
994
+ * As with the [Query Data Items](https://dev.wix.com/api/rest/wix-data/wix-data/data-items/query-data-items) endpoint, this endpoint retrieves items based on the filtering, sorting, and paging preferences you provide.
995
+ * However, the Query Distinct Values endpoint doesn't return all of the full items that match the query.
996
+ * Rather, it returns all unique values of the field you specify in `fieldName` for items that match the query.
997
+ * If more than one item has the same value for that field, that value appears only once.
998
+ *
999
+ * For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
1000
+ * @public
1001
+ * @documentationMaturity preview
1002
+ * @requiredField options
1003
+ * @requiredField options.dataCollectionId
1004
+ */
1005
+ export declare function queryDistinctValues(options: QueryDistinctValuesOptions): Promise<QueryDistinctValuesResponse>;
1006
+ export interface QueryDistinctValuesOptions extends QueryDistinctValuesRequestPagingMethodOneOf {
1007
+ /** ID of the collection to query. */
1008
+ dataCollectionId: string;
1009
+ /** Item field name for which to return all distinct values. */
1010
+ fieldName?: string;
1011
+ /**
1012
+ * Filter object in the following format:
1013
+ *
1014
+ * `"filter" : {
1015
+ * "fieldName1": "value1",
1016
+ * "fieldName2":{"$operator":"value2"}
1017
+ * }`.
1018
+ *
1019
+ * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
1020
+ */
1021
+ filter?: Record<string, any> | null;
1022
+ /** Sort order. */
1023
+ order?: SortOrder;
1024
+ /** Paging options to limit and skip the number of items. */
1025
+ paging?: Paging;
1026
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
1027
+ cursorPaging?: CursorPaging;
1028
+ /**
1029
+ * Whether to return the total count in the response for a query with offset paging.
1030
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1031
+ *
1032
+ * Default: `false`
1033
+ */
1034
+ returnTotalCount?: boolean;
1035
+ /**
1036
+ * Whether to retrieve data from the primary database instance.
1037
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1038
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
1039
+ *
1040
+ * Default: `false`
1041
+ */
1042
+ consistentRead?: boolean;
1043
+ }
1044
+ /**
1045
+ * Adds multiple items to a collection.
1046
+ *
1047
+ *
1048
+ * When each item is inserted into a collection, its ID is automatically assigned to random value.
1049
+ * You can optionally provide your own ID when inserting the item. If you specify an ID that already exists in the collection, the insertion will fail.
1050
+ * @public
1051
+ * @documentationMaturity preview
1052
+ * @requiredField options
1053
+ * @requiredField options.dataCollectionId
1054
+ * @requiredField options.dataItems
1055
+ */
1056
+ export declare function bulkInsertDataItems(options: BulkInsertDataItemsOptions): Promise<BulkInsertDataItemsResponse>;
1057
+ export interface BulkInsertDataItemsOptions {
1058
+ /** ID of the collection in which to insert the items. */
1059
+ dataCollectionId: string;
1060
+ /** Data items to insert. */
1061
+ dataItems: DataItem[];
1062
+ /**
1063
+ * Whether to return the inserted data items.
1064
+ * When `true`, the `results` objects contain a `dataItem` field.
1065
+ *
1066
+ * Default: `false`
1067
+ */
1068
+ returnEntity?: boolean;
1069
+ }
1070
+ /**
1071
+ * Updates multiple items in a collection.
1072
+ *
1073
+ *
1074
+ * This endpoint replaces each specified data item's existing data with the payload provided in the request.
1075
+ *
1076
+ * Each item in the request must include an ID. If an item is found in the specified collection with
1077
+ * the same ID, that item is updated. If the collection doesn't contain an item with that ID, the update fails.
1078
+ *
1079
+ * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
1080
+ *
1081
+ * > **Note:**
1082
+ * > After each item is updated, it only contains the fields included in the request. If the existing item has fields with values and those fields
1083
+ * > aren't included in the updated item, their values are lost.
1084
+ * @public
1085
+ * @documentationMaturity preview
1086
+ * @requiredField options
1087
+ * @requiredField options.dataCollectionId
1088
+ * @requiredField options.dataItems
1089
+ */
1090
+ export declare function bulkUpdateDataItems(options: BulkUpdateDataItemsOptions): Promise<BulkUpdateDataItemsResponse>;
1091
+ export interface BulkUpdateDataItemsOptions {
1092
+ /** ID of the collection in which to update items. */
1093
+ dataCollectionId: string;
1094
+ /** Data items to update. */
1095
+ dataItems: DataItem[];
1096
+ /**
1097
+ * Whether to return the updated data items.
1098
+ * When `true`, the `results` objects contain a `dataItem` field.
1099
+ *
1100
+ * Default: `false`
1101
+ */
1102
+ returnEntity?: boolean;
1103
+ }
1104
+ /**
1105
+ * Inserts or updates multiple items in a collection.
1106
+ *
1107
+ *
1108
+ * The Bulk Save Data Items endpoint inserts or updates each item provided, depending on whether it already exists in the collection. For each item:
1109
+ *
1110
+ * + If you don't provide an ID, a new item is created.
1111
+ *
1112
+ * + If you provide an ID that doesn't exist in the collection, a new item is created with that ID.
1113
+ *
1114
+ * + If an item with the ID you provide already exists in the collection, that item is updated. When an item is updated, its `data._updatedDate` field is changed to the current date and time.
1115
+ *
1116
+ * > **Note:** When you provide an item with an ID that already exists in the collection, the item you provide completely replaces the existing item with that ID.
1117
+ * > This means that all of the item's previous fields and values are lost.
1118
+ * @public
1119
+ * @documentationMaturity preview
1120
+ * @requiredField options
1121
+ * @requiredField options.dataCollectionId
1122
+ * @requiredField options.dataItems
1123
+ */
1124
+ export declare function bulkSaveDataItems(options: BulkSaveDataItemsOptions): Promise<BulkSaveDataItemsResponse>;
1125
+ export interface BulkSaveDataItemsOptions {
1126
+ /** ID of the collection in which to insert or update the items. */
1127
+ dataCollectionId: string;
1128
+ /** Data items to insert or update. */
1129
+ dataItems: DataItem[];
1130
+ /**
1131
+ * Whether to return the saved data item.
1132
+ * When `true`, the `results` objects contain a `dataItem` field.
1133
+ *
1134
+ * Default: `false`
1135
+ */
1136
+ returnEntity?: boolean;
1137
+ }
1138
+ /**
1139
+ * Removes multiple items from a collection.
1140
+ *
1141
+ *
1142
+ * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
1143
+ *
1144
+ * > **Note:** Once an item has been removed from a collection, it can't be restored.
1145
+ * @public
1146
+ * @documentationMaturity preview
1147
+ * @requiredField options
1148
+ * @requiredField options.dataCollectionId
1149
+ * @requiredField options.dataItemIds
1150
+ */
1151
+ export declare function bulkRemoveDataItems(options: BulkRemoveDataItemsOptions): Promise<BulkRemoveDataItemsResponse>;
1152
+ export interface BulkRemoveDataItemsOptions {
1153
+ /** ID of the collection from which to remove the item. */
1154
+ dataCollectionId: string;
1155
+ /** IDs of data items to remove. */
1156
+ dataItemIds: string[];
1157
+ }
1158
+ /**
1159
+ * Retrieves the full items referenced in the specified field of an item.
1160
+ *
1161
+ *
1162
+ * Reference and multi-reference fields refer to items in different collections.
1163
+ * Use this endpoint to retrieve the full details of the referenced items themselves.
1164
+ *
1165
+ * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection.
1166
+ * Querying the **Movies** collection using the Query Referenced Data Items endpoint returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
1167
+ * This gives you information from the **People** collection about each of the actors in the specified movie.
1168
+ * @public
1169
+ * @documentationMaturity preview
1170
+ * @requiredField options
1171
+ * @requiredField options.dataCollectionId
1172
+ */
1173
+ export declare function queryReferencedDataItems(options: QueryReferencedDataItemsOptions): Promise<QueryReferencedDataItemsResponse>;
1174
+ export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItemsRequestPagingMethodOneOf {
1175
+ /** ID of the collection containing the referring item. */
1176
+ dataCollectionId: string;
1177
+ /** ID of the referring item. */
1178
+ referringItemId?: string;
1179
+ /** Field containing references in the referring item. */
1180
+ referringItemFieldName?: string;
1181
+ /** Order of the returned referenced items. Sorted by the date each item was referenced. */
1182
+ order?: SortOrder;
1183
+ /** Paging options to limit and skip the number of items. */
1184
+ paging?: Paging;
1185
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
1186
+ cursorPaging?: CursorPaging;
1187
+ /**
1188
+ * Whether to return the total count in the response.
1189
+ * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1190
+ *
1191
+ * Default: `false`
1192
+ */
1193
+ returnTotalCount?: boolean;
1194
+ /**
1195
+ * Whether to retrieve data from the primary database instance.
1196
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1197
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
1198
+ *
1199
+ * Default: `false`
1200
+ */
1201
+ consistentRead?: boolean;
1202
+ }
1203
+ /**
1204
+ * Checks whether a field in a referring item contains a reference to a specified item.
1205
+ * @public
1206
+ * @documentationMaturity preview
1207
+ * @requiredField options
1208
+ * @requiredField options.dataCollectionId
1209
+ * @requiredField options.referencedItemId
1210
+ * @requiredField options.referringItemFieldName
1211
+ * @requiredField options.referringItemId
1212
+ */
1213
+ export declare function isReferencedDataItem(options: IsReferencedDataItemOptions): Promise<IsReferencedDataItemResponse>;
1214
+ export interface IsReferencedDataItemOptions {
1215
+ /** ID of the collection containing the referring data item. */
1216
+ dataCollectionId: string;
1217
+ /** Field to check for a reference to the item that may be referenced. */
1218
+ referringItemFieldName: string;
1219
+ /** ID of the referring item. */
1220
+ referringItemId: string;
1221
+ /** ID of the item that may be referenced. */
1222
+ referencedItemId: string;
1223
+ /**
1224
+ * Whether to retrieve data from the primary database instance.
1225
+ * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1226
+ * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
1227
+ *
1228
+ * Default: `false`
1229
+ */
1230
+ consistentRead?: boolean;
1231
+ }
1232
+ /**
1233
+ * Inserts a reference in the specified field in an item in a collection.
1234
+ *
1235
+ *
1236
+ * A reference in the `dataItemReference` field specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
1237
+ * @public
1238
+ * @documentationMaturity preview
1239
+ * @requiredField options
1240
+ * @requiredField options.dataCollectionId
1241
+ * @requiredField options.dataItemReference.referencedItemId
1242
+ * @requiredField options.dataItemReference.referringItemFieldName
1243
+ * @requiredField options.dataItemReference.referringItemId
1244
+ */
1245
+ export declare function insertDataItemReference(options: InsertDataItemReferenceOptions): Promise<InsertDataItemReferenceResponse>;
1246
+ export interface InsertDataItemReferenceOptions {
1247
+ /** ID of the collection in which to insert the reference. */
1248
+ dataCollectionId: string;
1249
+ /** Reference to insert */
1250
+ dataItemReference?: DataItemReference;
1251
+ }
1252
+ /**
1253
+ * Removes the specified reference from the specified field.
1254
+ * @public
1255
+ * @documentationMaturity preview
1256
+ * @requiredField options
1257
+ * @requiredField options.dataCollectionId
1258
+ * @requiredField options.dataItemReference
1259
+ * @requiredField options.dataItemReference.referencedItemId
1260
+ * @requiredField options.dataItemReference.referringItemFieldName
1261
+ * @requiredField options.dataItemReference.referringItemId
1262
+ */
1263
+ export declare function removeDataItemReference(options: RemoveDataItemReferenceOptions): Promise<RemoveDataItemReferenceResponse>;
1264
+ export interface RemoveDataItemReferenceOptions {
1265
+ /** ID of the collection containing the referring item. */
1266
+ dataCollectionId: string;
1267
+ /** Reference to remove. */
1268
+ dataItemReference: DataItemReference;
1269
+ }
1270
+ /**
1271
+ * Inserts one or more references in the specified fields of items in a collection.
1272
+ *
1273
+ *
1274
+ * This endpoint adds one or more references to a collection.
1275
+ * Each new reference in the `dataItemReferences` field specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
1276
+ * @public
1277
+ * @documentationMaturity preview
1278
+ * @requiredField options
1279
+ * @requiredField options.dataCollectionId
1280
+ * @requiredField options.dataItemReferences
1281
+ * @requiredField options.dataItemReferences.referencedItemId
1282
+ * @requiredField options.dataItemReferences.referringItemFieldName
1283
+ * @requiredField options.dataItemReferences.referringItemId
1284
+ */
1285
+ export declare function bulkInsertDataItemReferences(options: BulkInsertDataItemReferencesOptions): Promise<BulkInsertDataItemReferencesResponse>;
1286
+ export interface BulkInsertDataItemReferencesOptions {
1287
+ /** ID of the collection containing the referring items. */
1288
+ dataCollectionId: string;
1289
+ /** References to insert. */
1290
+ dataItemReferences: DataItemReference[];
1291
+ /**
1292
+ * Whether to return the inserted data item references.
1293
+ * When `true`, the `results` objects contain a `dataItemReference` field.
1294
+ *
1295
+ * Default: `false`
1296
+ */
1297
+ returnEntity?: boolean;
1298
+ }
1299
+ /**
1300
+ * Removes one or more references.
1301
+ * @public
1302
+ * @documentationMaturity preview
1303
+ * @requiredField options
1304
+ * @requiredField options.dataCollectionId
1305
+ * @requiredField options.dataItemReferences
1306
+ * @requiredField options.dataItemReferences.referencedItemId
1307
+ * @requiredField options.dataItemReferences.referringItemFieldName
1308
+ * @requiredField options.dataItemReferences.referringItemId
1309
+ */
1310
+ export declare function bulkRemoveDataItemReferences(options: BulkRemoveDataItemReferencesOptions): Promise<BulkRemoveDataItemReferencesResponse>;
1311
+ export interface BulkRemoveDataItemReferencesOptions {
1312
+ /** ID of the collection containing the referring items. */
1313
+ dataCollectionId: string;
1314
+ /** References to remove. */
1315
+ dataItemReferences: DataItemReference[];
1316
+ }
1317
+ /**
1318
+ * Replaces references in a specified field of a specified data item.
1319
+ *
1320
+ *
1321
+ * This endpoint replaces the existing reference or references contained in the field specified in `referringItemFieldName` within the data item specified in `referringItemId`.
1322
+ * The endpoint removes existing references and in their place it adds references to the items specified in `newReferencedItemIds`.
1323
+ *
1324
+ * > **Note:** If you pass an empty array in `newReferencedItemIds`, all existing references are removed.
1325
+ * @public
1326
+ * @documentationMaturity preview
1327
+ * @requiredField options
1328
+ * @requiredField options.dataCollectionId
1329
+ * @requiredField options.referringItemFieldName
1330
+ * @requiredField options.referringItemId
1331
+ */
1332
+ export declare function replaceDataItemReferences(options: ReplaceDataItemReferencesOptions): Promise<ReplaceDataItemReferencesResponse>;
1333
+ export interface ReplaceDataItemReferencesOptions {
1334
+ /** ID of the collection containing the referring item. */
1335
+ dataCollectionId: string;
1336
+ /** Field containing references in the referring item. */
1337
+ referringItemFieldName: string;
1338
+ /** ID of the referring item. */
1339
+ referringItemId: string;
1340
+ /** List of new referenced item IDs to replace the existing ones. */
1341
+ newReferencedItemIds?: string[];
1342
+ }
1343
+ export {};