@wix/data 1.0.90 → 1.0.91

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 (169) hide show
  1. package/build/cjs/context.d.ts +4 -4
  2. package/build/cjs/context.js +4 -4
  3. package/build/cjs/context.js.map +1 -1
  4. package/build/cjs/index.d.ts +4 -4
  5. package/build/cjs/index.js +4 -4
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/meta.d.ts +4 -4
  8. package/build/cjs/meta.js +4 -4
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/context.d.ts +4 -4
  11. package/build/es/context.js +4 -4
  12. package/build/es/context.js.map +1 -1
  13. package/build/es/index.d.ts +4 -4
  14. package/build/es/index.js +4 -4
  15. package/build/es/index.js.map +1 -1
  16. package/build/es/meta.d.ts +4 -4
  17. package/build/es/meta.js +4 -4
  18. package/build/es/meta.js.map +1 -1
  19. package/package.json +14 -9
  20. package/build/cjs/index.typings.d.ts +0 -4
  21. package/build/cjs/index.typings.js +0 -31
  22. package/build/cjs/index.typings.js.map +0 -1
  23. package/build/cjs/src/data-v1-external-database-connection.context.d.ts +0 -7
  24. package/build/cjs/src/data-v1-external-database-connection.context.js +0 -90
  25. package/build/cjs/src/data-v1-external-database-connection.context.js.map +0 -1
  26. package/build/cjs/src/data-v1-external-database-connection.http.d.ts +0 -28
  27. package/build/cjs/src/data-v1-external-database-connection.http.js +0 -393
  28. package/build/cjs/src/data-v1-external-database-connection.http.js.map +0 -1
  29. package/build/cjs/src/data-v1-external-database-connection.meta.d.ts +0 -23
  30. package/build/cjs/src/data-v1-external-database-connection.meta.js +0 -127
  31. package/build/cjs/src/data-v1-external-database-connection.meta.js.map +0 -1
  32. package/build/cjs/src/data-v1-external-database-connection.public.d.ts +0 -46
  33. package/build/cjs/src/data-v1-external-database-connection.public.js +0 -46
  34. package/build/cjs/src/data-v1-external-database-connection.public.js.map +0 -1
  35. package/build/cjs/src/data-v1-external-database-connection.types.d.ts +0 -321
  36. package/build/cjs/src/data-v1-external-database-connection.types.js +0 -88
  37. package/build/cjs/src/data-v1-external-database-connection.types.js.map +0 -1
  38. package/build/cjs/src/data-v1-external-database-connection.universal.d.ts +0 -433
  39. package/build/cjs/src/data-v1-external-database-connection.universal.js +0 -452
  40. package/build/cjs/src/data-v1-external-database-connection.universal.js.map +0 -1
  41. package/build/cjs/src/data-v2-data-collection.context.d.ts +0 -7
  42. package/build/cjs/src/data-v2-data-collection.context.js +0 -90
  43. package/build/cjs/src/data-v2-data-collection.context.js.map +0 -1
  44. package/build/cjs/src/data-v2-data-collection.http.d.ts +0 -36
  45. package/build/cjs/src/data-v2-data-collection.http.js +0 -494
  46. package/build/cjs/src/data-v2-data-collection.http.js.map +0 -1
  47. package/build/cjs/src/data-v2-data-collection.meta.d.ts +0 -21
  48. package/build/cjs/src/data-v2-data-collection.meta.js +0 -123
  49. package/build/cjs/src/data-v2-data-collection.meta.js.map +0 -1
  50. package/build/cjs/src/data-v2-data-collection.public.d.ts +0 -313
  51. package/build/cjs/src/data-v2-data-collection.public.js +0 -58
  52. package/build/cjs/src/data-v2-data-collection.public.js.map +0 -1
  53. package/build/cjs/src/data-v2-data-collection.types.d.ts +0 -1460
  54. package/build/cjs/src/data-v2-data-collection.types.js +0 -197
  55. package/build/cjs/src/data-v2-data-collection.types.js.map +0 -1
  56. package/build/cjs/src/data-v2-data-collection.universal.d.ts +0 -1626
  57. package/build/cjs/src/data-v2-data-collection.universal.js +0 -677
  58. package/build/cjs/src/data-v2-data-collection.universal.js.map +0 -1
  59. package/build/cjs/src/data-v2-data-item.context.d.ts +0 -23
  60. package/build/cjs/src/data-v2-data-item.context.js +0 -362
  61. package/build/cjs/src/data-v2-data-item.context.js.map +0 -1
  62. package/build/cjs/src/data-v2-data-item.http.d.ts +0 -225
  63. package/build/cjs/src/data-v2-data-item.http.js +0 -948
  64. package/build/cjs/src/data-v2-data-item.http.js.map +0 -1
  65. package/build/cjs/src/data-v2-data-item.meta.d.ts +0 -39
  66. package/build/cjs/src/data-v2-data-item.meta.js +0 -427
  67. package/build/cjs/src/data-v2-data-item.meta.js.map +0 -1
  68. package/build/cjs/src/data-v2-data-item.public.d.ts +0 -31
  69. package/build/cjs/src/data-v2-data-item.public.js +0 -137
  70. package/build/cjs/src/data-v2-data-item.public.js.map +0 -1
  71. package/build/cjs/src/data-v2-data-item.types.d.ts +0 -980
  72. package/build/cjs/src/data-v2-data-item.types.js +0 -27
  73. package/build/cjs/src/data-v2-data-item.types.js.map +0 -1
  74. package/build/cjs/src/data-v2-data-item.universal.d.ts +0 -1823
  75. package/build/cjs/src/data-v2-data-item.universal.js +0 -1639
  76. package/build/cjs/src/data-v2-data-item.universal.js.map +0 -1
  77. package/build/cjs/src/data-v2-index.context.d.ts +0 -5
  78. package/build/cjs/src/data-v2-index.context.js +0 -56
  79. package/build/cjs/src/data-v2-index.context.js.map +0 -1
  80. package/build/cjs/src/data-v2-index.http.d.ts +0 -28
  81. package/build/cjs/src/data-v2-index.http.js +0 -367
  82. package/build/cjs/src/data-v2-index.http.js.map +0 -1
  83. package/build/cjs/src/data-v2-index.meta.d.ts +0 -15
  84. package/build/cjs/src/data-v2-index.meta.js +0 -85
  85. package/build/cjs/src/data-v2-index.meta.js.map +0 -1
  86. package/build/cjs/src/data-v2-index.public.d.ts +0 -23
  87. package/build/cjs/src/data-v2-index.public.js +0 -28
  88. package/build/cjs/src/data-v2-index.public.js.map +0 -1
  89. package/build/cjs/src/data-v2-index.types.d.ts +0 -174
  90. package/build/cjs/src/data-v2-index.types.js +0 -35
  91. package/build/cjs/src/data-v2-index.types.js.map +0 -1
  92. package/build/cjs/src/data-v2-index.universal.d.ts +0 -237
  93. package/build/cjs/src/data-v2-index.universal.js +0 -274
  94. package/build/cjs/src/data-v2-index.universal.js.map +0 -1
  95. package/build/es/index.typings.d.ts +0 -4
  96. package/build/es/index.typings.js +0 -5
  97. package/build/es/index.typings.js.map +0 -1
  98. package/build/es/src/data-v1-external-database-connection.context.d.ts +0 -7
  99. package/build/es/src/data-v1-external-database-connection.context.js +0 -82
  100. package/build/es/src/data-v1-external-database-connection.context.js.map +0 -1
  101. package/build/es/src/data-v1-external-database-connection.http.d.ts +0 -28
  102. package/build/es/src/data-v1-external-database-connection.http.js +0 -385
  103. package/build/es/src/data-v1-external-database-connection.http.js.map +0 -1
  104. package/build/es/src/data-v1-external-database-connection.meta.d.ts +0 -23
  105. package/build/es/src/data-v1-external-database-connection.meta.js +0 -96
  106. package/build/es/src/data-v1-external-database-connection.meta.js.map +0 -1
  107. package/build/es/src/data-v1-external-database-connection.public.d.ts +0 -46
  108. package/build/es/src/data-v1-external-database-connection.public.js +0 -30
  109. package/build/es/src/data-v1-external-database-connection.public.js.map +0 -1
  110. package/build/es/src/data-v1-external-database-connection.types.d.ts +0 -321
  111. package/build/es/src/data-v1-external-database-connection.types.js +0 -85
  112. package/build/es/src/data-v1-external-database-connection.types.js.map +0 -1
  113. package/build/es/src/data-v1-external-database-connection.universal.d.ts +0 -433
  114. package/build/es/src/data-v1-external-database-connection.universal.js +0 -421
  115. package/build/es/src/data-v1-external-database-connection.universal.js.map +0 -1
  116. package/build/es/src/data-v2-data-collection.context.d.ts +0 -7
  117. package/build/es/src/data-v2-data-collection.context.js +0 -82
  118. package/build/es/src/data-v2-data-collection.context.js.map +0 -1
  119. package/build/es/src/data-v2-data-collection.http.d.ts +0 -36
  120. package/build/es/src/data-v2-data-collection.http.js +0 -486
  121. package/build/es/src/data-v2-data-collection.http.js.map +0 -1
  122. package/build/es/src/data-v2-data-collection.meta.d.ts +0 -21
  123. package/build/es/src/data-v2-data-collection.meta.js +0 -92
  124. package/build/es/src/data-v2-data-collection.meta.js.map +0 -1
  125. package/build/es/src/data-v2-data-collection.public.d.ts +0 -313
  126. package/build/es/src/data-v2-data-collection.public.js +0 -30
  127. package/build/es/src/data-v2-data-collection.public.js.map +0 -1
  128. package/build/es/src/data-v2-data-collection.types.d.ts +0 -1460
  129. package/build/es/src/data-v2-data-collection.types.js +0 -194
  130. package/build/es/src/data-v2-data-collection.types.js.map +0 -1
  131. package/build/es/src/data-v2-data-collection.universal.d.ts +0 -1626
  132. package/build/es/src/data-v2-data-collection.universal.js +0 -646
  133. package/build/es/src/data-v2-data-collection.universal.js.map +0 -1
  134. package/build/es/src/data-v2-data-item.context.d.ts +0 -23
  135. package/build/es/src/data-v2-data-item.context.js +0 -338
  136. package/build/es/src/data-v2-data-item.context.js.map +0 -1
  137. package/build/es/src/data-v2-data-item.http.d.ts +0 -225
  138. package/build/es/src/data-v2-data-item.http.js +0 -924
  139. package/build/es/src/data-v2-data-item.http.js.map +0 -1
  140. package/build/es/src/data-v2-data-item.meta.d.ts +0 -39
  141. package/build/es/src/data-v2-data-item.meta.js +0 -380
  142. package/build/es/src/data-v2-data-item.meta.js.map +0 -1
  143. package/build/es/src/data-v2-data-item.public.d.ts +0 -31
  144. package/build/es/src/data-v2-data-item.public.js +0 -109
  145. package/build/es/src/data-v2-data-item.public.js.map +0 -1
  146. package/build/es/src/data-v2-data-item.types.d.ts +0 -980
  147. package/build/es/src/data-v2-data-item.types.js +0 -24
  148. package/build/es/src/data-v2-data-item.types.js.map +0 -1
  149. package/build/es/src/data-v2-data-item.universal.d.ts +0 -1823
  150. package/build/es/src/data-v2-data-item.universal.js +0 -1592
  151. package/build/es/src/data-v2-data-item.universal.js.map +0 -1
  152. package/build/es/src/data-v2-index.context.d.ts +0 -5
  153. package/build/es/src/data-v2-index.context.js +0 -50
  154. package/build/es/src/data-v2-index.context.js.map +0 -1
  155. package/build/es/src/data-v2-index.http.d.ts +0 -28
  156. package/build/es/src/data-v2-index.http.js +0 -361
  157. package/build/es/src/data-v2-index.http.js.map +0 -1
  158. package/build/es/src/data-v2-index.meta.d.ts +0 -15
  159. package/build/es/src/data-v2-index.meta.js +0 -56
  160. package/build/es/src/data-v2-index.meta.js.map +0 -1
  161. package/build/es/src/data-v2-index.public.d.ts +0 -23
  162. package/build/es/src/data-v2-index.public.js +0 -19
  163. package/build/es/src/data-v2-index.public.js.map +0 -1
  164. package/build/es/src/data-v2-index.types.d.ts +0 -174
  165. package/build/es/src/data-v2-index.types.js +0 -32
  166. package/build/es/src/data-v2-index.types.js.map +0 -1
  167. package/build/es/src/data-v2-index.universal.d.ts +0 -237
  168. package/build/es/src/data-v2-index.universal.js +0 -245
  169. package/build/es/src/data-v2-index.universal.js.map +0 -1
@@ -1,1823 +0,0 @@
1
- export interface DataItem {
2
- /** Data item ID. */
3
- _id?: string;
4
- /**
5
- * ID of the collection this item belongs to
6
- * @readonly
7
- */
8
- dataCollectionId?: string;
9
- /**
10
- * Data item contents.
11
- *
12
- * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:
13
- *
14
- * + `_id`: Item ID.
15
- * + `_createdDate`: Date and time the item was added to the collection.
16
- * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
17
- * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.
18
- */
19
- data?: Record<string, any> | null;
20
- }
21
- export interface InsertDataItemRequest {
22
- /** ID of the collection in which to insert the item. */
23
- dataCollectionId: string;
24
- /** Item to insert. */
25
- dataItem: DataItem;
26
- }
27
- export declare enum Environment {
28
- LIVE = "LIVE",
29
- SANDBOX = "SANDBOX"
30
- }
31
- export interface Options {
32
- }
33
- export interface PublishPluginOptions {
34
- showDraftItems?: boolean;
35
- }
36
- export interface InsertDataItemResponse {
37
- /** Inserted data item. */
38
- dataItem?: DataItem;
39
- }
40
- export interface UpdateDataItemRequest {
41
- /** ID of the collection containing the existing item. */
42
- dataCollectionId: string;
43
- /** Updated data item content. The existing data item's content is replaced entirely. */
44
- dataItem: DataItem;
45
- }
46
- export interface UpdateDataItemResponse {
47
- /** Updated data item. */
48
- dataItem?: DataItem;
49
- }
50
- export interface SaveDataItemRequest {
51
- /** ID of the collection in which to insert or update the item. */
52
- dataCollectionId: string;
53
- /** Data item to insert or update. */
54
- dataItem: DataItem;
55
- }
56
- export interface SaveDataItemResponse {
57
- /**
58
- * The action carried out for the item.
59
- *
60
- * + `INSERTED`: A new item was added to the collection.
61
- * + `UPDATED`: An existing item in the collection was updated.
62
- */
63
- action?: Action;
64
- /** Inserted or updated data item. */
65
- dataItem?: DataItem;
66
- }
67
- export declare enum Action {
68
- UNKNOWN_ACTION = "UNKNOWN_ACTION",
69
- INSERTED = "INSERTED",
70
- UPDATED = "UPDATED"
71
- }
72
- export interface GetDataItemRequest {
73
- /** ID of the collection from which to retrieve the data item. */
74
- dataCollectionId: string;
75
- /** ID of the data item to retrieve. */
76
- dataItemId: string;
77
- /**
78
- * Whether to retrieve data from the primary database instance.
79
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
80
- *
81
- * Default: `false`
82
- */
83
- consistentRead?: boolean;
84
- /**
85
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
86
- * If provided, the result text is returned in the specified language.
87
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
88
- *
89
- * If not provided, result text is not translated.
90
- */
91
- language?: string | null;
92
- }
93
- export interface GetDataItemResponse {
94
- /** Retrieved item. */
95
- dataItem?: DataItem;
96
- }
97
- export interface RemoveDataItemRequest {
98
- /** ID of the collection from which to remove the item. */
99
- dataCollectionId: string;
100
- /** ID of the item to remove. */
101
- dataItemId: string;
102
- }
103
- export interface RemoveDataItemResponse {
104
- /** Removed item. */
105
- dataItem?: DataItem;
106
- }
107
- export interface TruncateDataItemsRequest {
108
- /** ID of the collection to truncate. */
109
- dataCollectionId: string;
110
- }
111
- export interface TruncateDataItemsResponse {
112
- }
113
- export interface QueryDataItemsRequest {
114
- /** ID of the collection to query. */
115
- dataCollectionId: string;
116
- /** Query preferences. For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). */
117
- query?: QueryV2;
118
- /**
119
- * Whether to return the total count in the response for a query with offset paging.
120
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
121
- *
122
- * Default: `false`
123
- */
124
- returnTotalCount?: boolean;
125
- /**
126
- * Properties for which to include referenced items in the query's results.
127
- * Up to 50 referenced items can be included for each item that matches the query.
128
- */
129
- includeReferencedItems?: string[];
130
- /**
131
- * Whether to retrieve data from the primary database instance.
132
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
133
- *
134
- * Default: `false`
135
- */
136
- consistentRead?: boolean;
137
- /**
138
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
139
- * If provided, the result text is returned in the specified language.
140
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
141
- *
142
- * If not provided, result text is not translated.
143
- */
144
- language?: string | null;
145
- }
146
- export interface QueryV2 extends QueryV2PagingMethodOneOf {
147
- /** Paging options to limit and skip the number of items. */
148
- paging?: Paging;
149
- /** 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`. */
150
- cursorPaging?: CursorPaging;
151
- /**
152
- * Filter object in the following format:
153
- *
154
- * `"filter" : {
155
- * "fieldName1": "value1",
156
- * "fieldName2":{"$operator":"value2"}
157
- * }`
158
- *
159
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
160
- */
161
- filter?: Record<string, any> | null;
162
- /**
163
- * Sort object in the following format:
164
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
165
- */
166
- sort?: Sorting[];
167
- /** Array of projected fields. A list of specific field names to return. */
168
- fields?: string[];
169
- }
170
- /** @oneof */
171
- export interface QueryV2PagingMethodOneOf {
172
- /** Paging options to limit and skip the number of items. */
173
- paging?: Paging;
174
- /** 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`. */
175
- cursorPaging?: CursorPaging;
176
- }
177
- export interface Sorting {
178
- /** Name of the field to sort by. */
179
- fieldName?: string;
180
- /**
181
- * Sort order.
182
- *
183
- * Supported values: `ASC`, `DESC`.
184
- */
185
- order?: SortOrder;
186
- }
187
- export declare enum SortOrder {
188
- ASC = "ASC",
189
- DESC = "DESC"
190
- }
191
- export interface Paging {
192
- /** Number of items to load. */
193
- limit?: number | null;
194
- /** Number of items to skip in the current sort order. */
195
- offset?: number | null;
196
- }
197
- export interface CursorPaging {
198
- /** Number of items to load. */
199
- limit?: number | null;
200
- /**
201
- * Pointer to the next or previous page in the list of results.
202
- *
203
- * You can get the relevant cursor token
204
- * from the `pagingMetadata` object in the previous call's response.
205
- * Not relevant for the first request.
206
- */
207
- cursor?: string | null;
208
- }
209
- export interface QueryDataItemsResponse {
210
- /** Retrieved items. */
211
- dataItems?: DataItem[];
212
- /** Paging information. */
213
- pagingMetadata?: PagingMetadataV2;
214
- }
215
- export interface PagingMetadataV2 {
216
- /** Number of items returned in the response. */
217
- count?: number | null;
218
- /** Offset that was requested. */
219
- offset?: number | null;
220
- /** Total number of items that match the query. Returned if offset paging is used, `returnTotalCount` is `true` in the request, and `tooManyToCount` is false. */
221
- total?: number | null;
222
- /** Whether the server failed to calculate the `total` field. */
223
- tooManyToCount?: boolean | null;
224
- /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
225
- cursors?: Cursors;
226
- }
227
- export interface Cursors {
228
- /** Cursor pointing to next page in the list of results. */
229
- next?: string | null;
230
- /** Cursor pointing to previous page in the list of results. */
231
- prev?: string | null;
232
- }
233
- export interface AggregateDataItemsRequest extends AggregateDataItemsRequestPagingMethodOneOf {
234
- /** Paging options to limit and skip the number of items. */
235
- paging?: Paging;
236
- /** 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`. */
237
- cursorPaging?: CursorPaging;
238
- /** ID of the collection on which to run the aggregation. */
239
- dataCollectionId: string;
240
- /** 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. */
241
- initialFilter?: Record<string, any> | null;
242
- /** Aggregation applied to the data. */
243
- aggregation?: Aggregation;
244
- /** 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. */
245
- finalFilter?: Record<string, any> | null;
246
- /**
247
- * Sort object in the following format:
248
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
249
- */
250
- sort?: Sorting[];
251
- /**
252
- * Whether to return the total count in the response for a query with offset paging.
253
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
254
- *
255
- * Default: `false`
256
- */
257
- returnTotalCount?: boolean;
258
- /**
259
- * Whether to retrieve data from the primary database instance.
260
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
261
- *
262
- * Default: `false`
263
- */
264
- consistentRead?: boolean;
265
- /**
266
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
267
- * If provided, the result text is returned in the specified language.
268
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
269
- *
270
- * If not provided, result text is not translated.
271
- */
272
- language?: string | null;
273
- }
274
- /** @oneof */
275
- export interface AggregateDataItemsRequestPagingMethodOneOf {
276
- /** Paging options to limit and skip the number of items. */
277
- paging?: Paging;
278
- /** 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`. */
279
- cursorPaging?: CursorPaging;
280
- }
281
- export interface Average {
282
- /** Name of the field for which to calculate the average value. */
283
- itemFieldName?: string;
284
- }
285
- export interface Min {
286
- /** Name of the field for which to calculate the minimum value. */
287
- itemFieldName?: string;
288
- }
289
- export interface Max {
290
- /** Name of the field for which to calculate the maximum value. */
291
- itemFieldName?: string;
292
- }
293
- export interface Sum {
294
- /** Name of the field for which to calculate the sum. */
295
- itemFieldName?: string;
296
- }
297
- export interface Count {
298
- }
299
- export interface Operation extends OperationCalculateOneOf {
300
- /** Calculate the average value of a specified field for all items in the grouping. */
301
- average?: Average;
302
- /** Calculate the minimum value of a specified field for all items in the grouping. */
303
- min?: Min;
304
- /** Calculate the maximum value of a specified field for all items in the grouping. */
305
- max?: Max;
306
- /** Calculate the sum of values of a specified field for all items in the grouping. */
307
- sum?: Sum;
308
- /** Calculate the number of items in the grouping. */
309
- itemCount?: Count;
310
- /** Name of the field containing results of the operation. */
311
- resultFieldName?: string;
312
- }
313
- /** @oneof */
314
- export interface OperationCalculateOneOf {
315
- /** Calculate the average value of a specified field for all items in the grouping. */
316
- average?: Average;
317
- /** Calculate the minimum value of a specified field for all items in the grouping. */
318
- min?: Min;
319
- /** Calculate the maximum value of a specified field for all items in the grouping. */
320
- max?: Max;
321
- /** Calculate the sum of values of a specified field for all items in the grouping. */
322
- sum?: Sum;
323
- /** Calculate the number of items in the grouping. */
324
- itemCount?: Count;
325
- }
326
- export interface Aggregation {
327
- /** Fields by which to group items for the aggregation. If empty, the aggregation is carried out on all items in the collection. */
328
- groupingFields?: string[];
329
- /** Operations to carry out on the data in each grouping. */
330
- operations?: Operation[];
331
- }
332
- export interface AggregateDataItemsResponse {
333
- /** Aggregation results. */
334
- results?: Record<string, any>[] | null;
335
- /** Paging information. */
336
- pagingMetadata?: PagingMetadataV2;
337
- }
338
- export interface CountDataItemsRequest {
339
- /** ID of the collection for which to count query results. */
340
- dataCollectionId: string;
341
- /**
342
- * Filter object in the following format:
343
- *
344
- * `"filter" : {
345
- * "fieldName1": "value1",
346
- * "fieldName2":{"$operator":"value2"}
347
- * }`.
348
- *
349
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
350
- */
351
- filter?: Record<string, any> | null;
352
- /**
353
- * Whether to retrieve data from the primary database instance.
354
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
355
- *
356
- * Default: `false`
357
- */
358
- consistentRead?: boolean;
359
- /**
360
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
361
- * If provided, the result text is returned in the specified language.
362
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
363
- *
364
- * If not provided, result text is not translated.
365
- */
366
- language?: string | null;
367
- }
368
- export interface CountDataItemsResponse {
369
- /** Number of items matching the query. */
370
- totalCount?: number;
371
- }
372
- export interface QueryDistinctValuesRequest extends QueryDistinctValuesRequestPagingMethodOneOf {
373
- /** Paging options to limit and skip the number of items. */
374
- paging?: Paging;
375
- /** 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`. */
376
- cursorPaging?: CursorPaging;
377
- /** ID of the collection to query. */
378
- dataCollectionId: string;
379
- /** Item field name for which to return all distinct values. */
380
- fieldName?: string;
381
- /**
382
- * Filter object in the following format:
383
- *
384
- * `"filter" : {
385
- * "fieldName1": "value1",
386
- * "fieldName2":{"$operator":"value2"}
387
- * }`.
388
- *
389
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
390
- */
391
- filter?: Record<string, any> | null;
392
- /**
393
- * Sort order.
394
- *
395
- * Supported values: `ASC`, `DESC`.
396
- */
397
- order?: SortOrder;
398
- /**
399
- * Whether to return the total count in the response for a query with offset paging.
400
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
401
- *
402
- * Default: `false`
403
- */
404
- returnTotalCount?: boolean;
405
- /**
406
- * Whether to retrieve data from the primary database instance.
407
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
408
- *
409
- * Default: `false`
410
- */
411
- consistentRead?: boolean;
412
- /**
413
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
414
- * If provided, the result text is returned in the specified language.
415
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
416
- *
417
- * If not provided, result text is not translated.
418
- */
419
- language?: string | null;
420
- }
421
- /** @oneof */
422
- export interface QueryDistinctValuesRequestPagingMethodOneOf {
423
- /** Paging options to limit and skip the number of items. */
424
- paging?: Paging;
425
- /** 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`. */
426
- cursorPaging?: CursorPaging;
427
- }
428
- export interface QueryDistinctValuesResponse {
429
- /** List of distinct values contained in the field specified in `fieldName`. */
430
- distinctValues?: any[];
431
- /** Paging information. */
432
- pagingMetadata?: PagingMetadataV2;
433
- }
434
- export interface BulkInsertDataItemsRequest {
435
- /** ID of the collection in which to insert the items. */
436
- dataCollectionId: string;
437
- /** Data items to insert. */
438
- dataItems: DataItem[];
439
- /**
440
- * Whether to return the inserted data items.
441
- * When `true`, the `results` objects contain a `dataItem` field.
442
- *
443
- * Default: `false`
444
- */
445
- returnEntity?: boolean;
446
- }
447
- export interface BulkInsertDataItemsResponse {
448
- /** Information about the inserted items. */
449
- results?: BulkDataItemResult[];
450
- /** Bulk action metadata. */
451
- bulkActionMetadata?: BulkActionMetadata;
452
- }
453
- export interface BulkDataItemResult {
454
- /**
455
- * The action attempted for the data item.
456
- *
457
- * Supported values: `UNKNOWN_ACTION_TYPE`, `INSERT`, `UPDATE`, `DELETE`.
458
- */
459
- action?: BulkActionType;
460
- /** Metadata related to the data item for which the action was attempted. */
461
- itemMetadata?: ItemMetadata;
462
- /** The data item for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */
463
- dataItem?: DataItem;
464
- }
465
- export declare enum BulkActionType {
466
- UNKNOWN_ACTION_TYPE = "UNKNOWN_ACTION_TYPE",
467
- INSERT = "INSERT",
468
- UPDATE = "UPDATE",
469
- DELETE = "DELETE"
470
- }
471
- export interface ItemMetadata {
472
- /** Item ID. This field doesn't appear if there is no item ID, for example, when item creation fails. */
473
- _id?: string | null;
474
- /** Index of the item within the request array. Allows for correlation between request and response items. */
475
- originalIndex?: number;
476
- /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
477
- success?: boolean;
478
- /** Details about the error in case of failure. */
479
- error?: ApplicationError;
480
- }
481
- export interface ApplicationError {
482
- /** Error code. */
483
- code?: string;
484
- /** Description of the error. */
485
- description?: string;
486
- /** Data related to the error. */
487
- data?: Record<string, any> | null;
488
- }
489
- export interface BulkActionMetadata {
490
- /** Number of items successfully processed. */
491
- totalSuccesses?: number;
492
- /** Number of items that couldn't be processed. */
493
- totalFailures?: number;
494
- }
495
- export interface BulkUpdateDataItemsRequest {
496
- /** ID of the collection in which to update items. */
497
- dataCollectionId: string;
498
- /** Data items to update. */
499
- dataItems: DataItem[];
500
- /**
501
- * Whether to return the updated data items.
502
- * When `true`, the `results` objects contain a `dataItem` field.
503
- *
504
- * Default: `false`
505
- */
506
- returnEntity?: boolean;
507
- }
508
- export interface BulkUpdateDataItemsResponse {
509
- /** Information about the updated items. */
510
- results?: BulkDataItemResult[];
511
- /** Bulk action metadata. */
512
- bulkActionMetadata?: BulkActionMetadata;
513
- }
514
- export interface BulkSaveDataItemsRequest {
515
- /** ID of the collection in which to insert or update the items. */
516
- dataCollectionId: string;
517
- /** Data items to insert or update. */
518
- dataItems: DataItem[];
519
- /**
520
- * Whether to return the saved data item.
521
- * When `true`, the `results` objects contain a `dataItem` field.
522
- *
523
- * Default: `false`
524
- */
525
- returnEntity?: boolean;
526
- }
527
- export interface BulkSaveDataItemsResponse {
528
- /** Information about the saved items. */
529
- results?: BulkDataItemResult[];
530
- /** Bulk action metadata. */
531
- bulkActionMetadata?: BulkActionMetadata;
532
- }
533
- export interface BulkRemoveDataItemsRequest {
534
- /** ID of the collection from which to remove the item. */
535
- dataCollectionId: string;
536
- /** IDs of data items to remove. */
537
- dataItemIds: string[];
538
- }
539
- export interface BulkRemoveDataItemsResponse {
540
- /** Information about the removed data items. */
541
- results?: BulkDataItemResult[];
542
- /** Bulk action metadata. */
543
- bulkActionMetadata?: BulkActionMetadata;
544
- }
545
- export interface QueryReferencedDataItemsRequest extends QueryReferencedDataItemsRequestPagingMethodOneOf {
546
- /** Paging options to limit and skip the number of items. */
547
- paging?: Paging;
548
- /** 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`. */
549
- cursorPaging?: CursorPaging;
550
- /** ID of the collection containing the referring item. */
551
- dataCollectionId: string;
552
- /** ID of the referring item. */
553
- referringItemId?: string;
554
- /** Field containing references in the referring item. */
555
- referringItemFieldName?: string;
556
- /** Order of the returned referenced items. Sorted by the date each item was referenced. */
557
- order?: SortOrder;
558
- /**
559
- * Whether to return the total count in the response.
560
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
561
- *
562
- * Default: `false`
563
- */
564
- returnTotalCount?: boolean;
565
- /**
566
- * Whether to retrieve data from the primary database instance.
567
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
568
- *
569
- * Default: `false`
570
- */
571
- consistentRead?: boolean;
572
- /**
573
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
574
- * If provided, the result text is returned in the specified language.
575
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
576
- *
577
- * If not provided, result text is not translated.
578
- */
579
- language?: string | null;
580
- }
581
- /** @oneof */
582
- export interface QueryReferencedDataItemsRequestPagingMethodOneOf {
583
- /** Paging options to limit and skip the number of items. */
584
- paging?: Paging;
585
- /** 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`. */
586
- cursorPaging?: CursorPaging;
587
- }
588
- export interface QueryReferencedDataItemsResponse {
589
- /** 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. */
590
- results?: ReferencedResult[];
591
- /** Paging information. */
592
- pagingMetadata?: PagingMetadataV2;
593
- }
594
- export interface UnresolvedReference {
595
- /** ID of the referring item. */
596
- referringItemId?: string;
597
- /** Field specified to query for references. */
598
- referringItemFieldName?: string;
599
- }
600
- export interface ReferencedResult extends ReferencedResultEntityOneOf {
601
- /** Data item referenced. */
602
- dataItem?: DataItem;
603
- /** 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. */
604
- unresolvedReference?: UnresolvedReference;
605
- }
606
- /** @oneof */
607
- export interface ReferencedResultEntityOneOf {
608
- /** Data item referenced. */
609
- dataItem?: DataItem;
610
- /** 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. */
611
- unresolvedReference?: UnresolvedReference;
612
- }
613
- export interface IsReferencedDataItemRequest {
614
- /** ID of the collection containing the referring data item. */
615
- dataCollectionId: string;
616
- /** Field to check for a reference to the item that may be referenced. */
617
- referringItemFieldName: string;
618
- /** ID of the referring item. */
619
- referringItemId: string;
620
- /** ID of the item that may be referenced. */
621
- referencedItemId: string;
622
- /**
623
- * Whether to retrieve data from the primary database instance.
624
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
625
- *
626
- * Default: `false`
627
- */
628
- consistentRead?: boolean;
629
- }
630
- export interface IsReferencedDataItemResponse {
631
- /** Whether the specified reference exists. */
632
- isReferenced?: boolean;
633
- }
634
- export interface InsertDataItemReferenceRequest {
635
- /** ID of the collection in which to insert the reference. */
636
- dataCollectionId: string;
637
- /** Reference to insert */
638
- dataItemReference?: DataItemReference;
639
- }
640
- export interface DataItemReference {
641
- /** Referring item field containing the references to the referenced items. */
642
- referringItemFieldName?: string;
643
- /** ID of the referring item. */
644
- referringItemId?: string;
645
- /** ID of the referenced item. */
646
- referencedItemId?: string;
647
- }
648
- export interface InsertDataItemReferenceResponse {
649
- /** Inserted reference. */
650
- dataItemReference?: DataItemReference;
651
- }
652
- export interface RemoveDataItemReferenceRequest {
653
- /** ID of the collection containing the referring item. */
654
- dataCollectionId: string;
655
- /** Reference to remove. */
656
- dataItemReference: DataItemReference;
657
- }
658
- export interface RemoveDataItemReferenceResponse {
659
- /** Removed reference. */
660
- dataItemReference?: DataItemReference;
661
- }
662
- export interface BulkInsertDataItemReferencesRequest {
663
- /** ID of the collection containing the referring items. */
664
- dataCollectionId: string;
665
- /** References to insert. */
666
- dataItemReferences: DataItemReference[];
667
- /**
668
- * Whether to return the inserted data item references.
669
- * When `true`, the `results` objects contain a `dataItemReference` field.
670
- *
671
- * Default: `false`
672
- */
673
- returnEntity?: boolean;
674
- }
675
- export interface BulkInsertDataItemReferencesResponse {
676
- /** Information about the inserted references. */
677
- results?: BulkDataItemReferenceResult[];
678
- /** Bulk action metadata. */
679
- bulkActionMetadata?: BulkActionMetadata;
680
- }
681
- export interface BulkDataItemReferenceResult {
682
- /**
683
- * The action attempted for the reference.
684
- *
685
- * Supported values: `UNKNOWN_ACTION_TYPE`, `INSERT`, `UPDATE`, `DELETE`.
686
- */
687
- action?: BulkActionType;
688
- /** Metadata related to the reference for which the action was attempted. */
689
- referenceMetadata?: ItemMetadata;
690
- /** The reference for which the action was attempted. Only returned if `returnEntity` is `true` in the request and the action is successful. */
691
- dataItemReference?: DataItemReference;
692
- }
693
- export interface BulkRemoveDataItemReferencesRequest {
694
- /** ID of the collection containing the referring items. */
695
- dataCollectionId: string;
696
- /** References to remove. */
697
- dataItemReferences: DataItemReference[];
698
- }
699
- export interface BulkRemoveDataItemReferencesResponse {
700
- /** Information about the removed references. */
701
- results?: BulkDataItemReferenceResult[];
702
- /** Bulk action metadata. */
703
- bulkActionMetadata?: BulkActionMetadata;
704
- }
705
- export interface ReplaceDataItemReferencesRequest {
706
- /** ID of the collection containing the referring item. */
707
- dataCollectionId: string;
708
- /** Field containing references in the referring item. */
709
- referringItemFieldName: string;
710
- /** ID of the referring item. */
711
- referringItemId: string;
712
- /** List of new referenced item IDs to replace the existing ones. */
713
- newReferencedItemIds?: string[];
714
- }
715
- export interface ReplaceDataItemReferencesResponse {
716
- /** Updated references. */
717
- dataItemReferences?: DataItemReference[];
718
- }
719
- export interface DomainEvent<T = string> extends DomainEventBodyOneOf<T> {
720
- createdEvent?: EntityCreatedEvent<T>;
721
- updatedEvent?: EntityUpdatedEvent<T>;
722
- deletedEvent?: EntityDeletedEvent<T>;
723
- actionEvent?: ActionEvent<T>;
724
- /**
725
- * Unique event ID.
726
- * Allows clients to ignore duplicate webhooks.
727
- */
728
- _id?: string;
729
- /**
730
- * Assumes actions are also always typed to an entity_type
731
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
732
- */
733
- entityFqdn?: string;
734
- /**
735
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
736
- * This is although the created/updated/deleted notion is duplication of the oneof types
737
- * Example: created/updated/deleted/started/completed/email_opened
738
- */
739
- slug?: string;
740
- /** ID of the entity associated with the event. */
741
- entityId?: string;
742
- /** Event timestamp. */
743
- eventTime?: Date;
744
- /**
745
- * Whether the event was triggered as a result of a privacy regulation application
746
- * (for example, GDPR).
747
- */
748
- triggeredByAnonymizeRequest?: boolean | null;
749
- /** If present, indicates the action that triggered the event. */
750
- originatedFrom?: string | null;
751
- /**
752
- * A sequence number defining the order of updates to the underlying entity.
753
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
754
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
755
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
756
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
757
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
758
- */
759
- entityEventSequence?: string | null;
760
- }
761
- export interface DomainCreatedEvent<T> extends Omit<DomainEvent<T>, 'deletedEvent' | 'updatedEvent' | 'actionEvent'> {
762
- }
763
- export interface DomainDeletedEvent<T> extends Omit<DomainEvent<T>, 'createdEvent' | 'updatedEvent' | 'actionEvent'> {
764
- }
765
- export interface DomainUpdatedEvent<T> extends Omit<DomainEvent<T>, 'createdEvent' | 'deletedEvent' | 'actionEvent'> {
766
- }
767
- export interface DomainActionEvent<T> extends Omit<DomainEvent<T>, 'createdEvent' | 'deletedEvent' | 'updatedEvent'> {
768
- }
769
- /** @oneof */
770
- export interface DomainEventBodyOneOf<T> {
771
- createdEvent?: EntityCreatedEvent<T>;
772
- updatedEvent?: EntityUpdatedEvent<T>;
773
- deletedEvent?: EntityDeletedEvent<T>;
774
- actionEvent?: ActionEvent<T>;
775
- }
776
- export interface EntityCreatedEvent<T> {
777
- entity?: T;
778
- }
779
- export interface EntityUpdatedEvent<T> {
780
- /**
781
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
782
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
783
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
784
- */
785
- currentEntity?: T;
786
- }
787
- export interface EntityDeletedEvent<T> {
788
- /** Entity that was deleted */
789
- deletedEntity?: T | null;
790
- }
791
- export interface ActionEvent<T> {
792
- body?: T;
793
- }
794
- export interface InsertDataItemResponseNonNullableFields {
795
- dataItem?: {
796
- _id: string;
797
- dataCollectionId: string;
798
- };
799
- }
800
- export interface UpdateDataItemResponseNonNullableFields {
801
- dataItem?: {
802
- _id: string;
803
- dataCollectionId: string;
804
- };
805
- }
806
- export interface SaveDataItemResponseNonNullableFields {
807
- action: Action;
808
- dataItem?: {
809
- _id: string;
810
- dataCollectionId: string;
811
- };
812
- }
813
- export interface GetDataItemResponseNonNullableFields {
814
- dataItem?: {
815
- _id: string;
816
- dataCollectionId: string;
817
- };
818
- }
819
- export interface RemoveDataItemResponseNonNullableFields {
820
- dataItem?: {
821
- _id: string;
822
- dataCollectionId: string;
823
- };
824
- }
825
- export interface QueryDataItemsResponseNonNullableFields {
826
- dataItems: {
827
- _id: string;
828
- dataCollectionId: string;
829
- }[];
830
- }
831
- export interface CountDataItemsResponseNonNullableFields {
832
- totalCount: number;
833
- }
834
- export interface BulkInsertDataItemsResponseNonNullableFields {
835
- results: {
836
- action: BulkActionType;
837
- itemMetadata?: {
838
- originalIndex: number;
839
- success: boolean;
840
- error?: {
841
- code: string;
842
- description: string;
843
- };
844
- };
845
- dataItem?: {
846
- _id: string;
847
- dataCollectionId: string;
848
- };
849
- }[];
850
- bulkActionMetadata?: {
851
- totalSuccesses: number;
852
- totalFailures: number;
853
- };
854
- }
855
- export interface BulkUpdateDataItemsResponseNonNullableFields {
856
- results: {
857
- action: BulkActionType;
858
- itemMetadata?: {
859
- originalIndex: number;
860
- success: boolean;
861
- error?: {
862
- code: string;
863
- description: string;
864
- };
865
- };
866
- dataItem?: {
867
- _id: string;
868
- dataCollectionId: string;
869
- };
870
- }[];
871
- bulkActionMetadata?: {
872
- totalSuccesses: number;
873
- totalFailures: number;
874
- };
875
- }
876
- export interface BulkSaveDataItemsResponseNonNullableFields {
877
- results: {
878
- action: BulkActionType;
879
- itemMetadata?: {
880
- originalIndex: number;
881
- success: boolean;
882
- error?: {
883
- code: string;
884
- description: string;
885
- };
886
- };
887
- dataItem?: {
888
- _id: string;
889
- dataCollectionId: string;
890
- };
891
- }[];
892
- bulkActionMetadata?: {
893
- totalSuccesses: number;
894
- totalFailures: number;
895
- };
896
- }
897
- export interface BulkRemoveDataItemsResponseNonNullableFields {
898
- results: {
899
- action: BulkActionType;
900
- itemMetadata?: {
901
- originalIndex: number;
902
- success: boolean;
903
- error?: {
904
- code: string;
905
- description: string;
906
- };
907
- };
908
- dataItem?: {
909
- _id: string;
910
- dataCollectionId: string;
911
- };
912
- }[];
913
- bulkActionMetadata?: {
914
- totalSuccesses: number;
915
- totalFailures: number;
916
- };
917
- }
918
- export interface QueryReferencedDataItemsResponseNonNullableFields {
919
- results: {
920
- dataItem?: {
921
- _id: string;
922
- dataCollectionId: string;
923
- };
924
- unresolvedReference?: {
925
- referringItemId: string;
926
- referringItemFieldName: string;
927
- };
928
- }[];
929
- }
930
- export interface IsReferencedDataItemResponseNonNullableFields {
931
- isReferenced: boolean;
932
- }
933
- export interface InsertDataItemReferenceResponseNonNullableFields {
934
- dataItemReference?: {
935
- referringItemFieldName: string;
936
- referringItemId: string;
937
- referencedItemId: string;
938
- };
939
- }
940
- export interface RemoveDataItemReferenceResponseNonNullableFields {
941
- dataItemReference?: {
942
- referringItemFieldName: string;
943
- referringItemId: string;
944
- referencedItemId: string;
945
- };
946
- }
947
- export interface BulkInsertDataItemReferencesResponseNonNullableFields {
948
- results: {
949
- action: BulkActionType;
950
- referenceMetadata?: {
951
- originalIndex: number;
952
- success: boolean;
953
- error?: {
954
- code: string;
955
- description: string;
956
- };
957
- };
958
- dataItemReference?: {
959
- referringItemFieldName: string;
960
- referringItemId: string;
961
- referencedItemId: string;
962
- };
963
- }[];
964
- bulkActionMetadata?: {
965
- totalSuccesses: number;
966
- totalFailures: number;
967
- };
968
- }
969
- export interface BulkRemoveDataItemReferencesResponseNonNullableFields {
970
- results: {
971
- action: BulkActionType;
972
- referenceMetadata?: {
973
- originalIndex: number;
974
- success: boolean;
975
- error?: {
976
- code: string;
977
- description: string;
978
- };
979
- };
980
- dataItemReference?: {
981
- referringItemFieldName: string;
982
- referringItemId: string;
983
- referencedItemId: string;
984
- };
985
- }[];
986
- bulkActionMetadata?: {
987
- totalSuccesses: number;
988
- totalFailures: number;
989
- };
990
- }
991
- export interface ReplaceDataItemReferencesResponseNonNullableFields {
992
- dataItemReferences: {
993
- referringItemFieldName: string;
994
- referringItemId: string;
995
- referencedItemId: string;
996
- }[];
997
- }
998
- /**
999
- * Adds an item to a collection.
1000
- *
1001
- *
1002
- * An item can only be inserted into an existing connection.
1003
- * You can create a new collection using the Data Collections API.
1004
- *
1005
- * When an item is inserted into a collection, the item's ID is automatically assigned a random value.
1006
- * You can optionally provide a custom ID in `dataItem.id` when inserting the item.
1007
- * If you specify an ID that already exists in the collection, the insertion will fail.
1008
- *
1009
- * If `options.dataItem.data` is empty, a new item is created with no data fields.
1010
- * @public
1011
- * @documentationMaturity preview
1012
- * @requiredField options
1013
- * @requiredField options.dataCollectionId
1014
- * @requiredField options.dataItem
1015
- * @param options - Options for adding an item to a collection.
1016
- * @permissionScope Write Data Items
1017
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1018
- * @applicableIdentity APP
1019
- */
1020
- export declare function insertDataItem(options: InsertDataItemOptions): Promise<InsertDataItemResponse & InsertDataItemResponseNonNullableFields>;
1021
- export interface InsertDataItemOptions {
1022
- /** ID of the collection in which to insert the item. */
1023
- dataCollectionId: string;
1024
- /** Item to insert. */
1025
- dataItem: DataItem;
1026
- }
1027
- /**
1028
- * Updates an item in a collection.
1029
- *
1030
- *
1031
- * This function replaces the data item's existing data with the payload provided in `options.dataItem.data` in the request.
1032
- *
1033
- * To update an item, you need to specify an item ID and a collection ID.
1034
- * If an item is found in the specified collection with the specified ID, that item is updated.
1035
- * If the collection doesn't contain an item with that ID, the request fails.
1036
- *
1037
- * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
1038
- *
1039
- * > **Note:**
1040
- * > After an item is updated, it only contains the fields included in the `options.dataItem.data` payload in the `updateDataItem()` call.
1041
- * > If the existing item has fields with values and those fields aren't included in the updated item, their values are lost.
1042
- * @param _id - Data item ID.
1043
- * @public
1044
- * @documentationMaturity preview
1045
- * @requiredField _id
1046
- * @requiredField options
1047
- * @requiredField options.dataCollectionId
1048
- * @requiredField options.dataItem
1049
- * @param options - Options for updating an item in a collection.
1050
- * @permissionScope Write Data Items
1051
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1052
- * @applicableIdentity APP
1053
- */
1054
- export declare function updateDataItem(_id: string, options: UpdateDataItemOptions): Promise<UpdateDataItemResponse & UpdateDataItemResponseNonNullableFields>;
1055
- export interface UpdateDataItemOptions {
1056
- /** Updated data item content. The existing data item's content is replaced entirely. */
1057
- dataItem: {
1058
- /** Data item ID. */
1059
- _id?: string;
1060
- /**
1061
- * ID of the collection this item belongs to
1062
- * @readonly
1063
- */
1064
- dataCollectionId?: string;
1065
- /**
1066
- * Data item contents.
1067
- *
1068
- * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:
1069
- *
1070
- * + `_id`: Item ID.
1071
- * + `_createdDate`: Date and time the item was added to the collection.
1072
- * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
1073
- * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.
1074
- */
1075
- data?: Record<string, any> | null;
1076
- };
1077
- /** ID of the collection containing the existing item. */
1078
- dataCollectionId: string;
1079
- }
1080
- /**
1081
- * Inserts or updates an item in a collection.
1082
- *
1083
- *
1084
- * The `saveDataItem()` function inserts or updates the specified item, depending on whether it already exists in the collection.
1085
- *
1086
- * + If you don't provide an ID, a new item is created.
1087
- *
1088
- * + If you provide an ID that does not exist in the collection, a new item is created with that ID.
1089
- *
1090
- * + 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.
1091
- *
1092
- * > **Note:** When you provide an item with an ID that already exists in the collection, the payload you provide in `options.dataItem.data` replaces the existing item with that ID.
1093
- * > This means that the item's previous fields and values are lost.
1094
- * @public
1095
- * @documentationMaturity preview
1096
- * @requiredField options
1097
- * @requiredField options.dataCollectionId
1098
- * @requiredField options.dataItem
1099
- * @param options - Options for saving an item in a collection.
1100
- * @permissionScope Write Data Items
1101
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1102
- * @applicableIdentity APP
1103
- */
1104
- export declare function saveDataItem(options: SaveDataItemOptions): Promise<SaveDataItemResponse & SaveDataItemResponseNonNullableFields>;
1105
- export interface SaveDataItemOptions {
1106
- /** ID of the collection in which to insert or update the item. */
1107
- dataCollectionId: string;
1108
- /** Data item to insert or update. */
1109
- dataItem: DataItem;
1110
- }
1111
- /**
1112
- * Retrieves an item from a collection.
1113
- *
1114
- *
1115
- * > **Note**: When calling `getDataItem()` 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`.
1116
- * @param dataItemId - ID of the data item to retrieve.
1117
- * @public
1118
- * @documentationMaturity preview
1119
- * @requiredField dataItemId
1120
- * @requiredField options.dataCollectionId
1121
- * @param options - Options for retrieving an item from a collection.
1122
- * @permissionScope Read Data Items
1123
- * @permissionScopeId SCOPE.DC-DATA.READ
1124
- * @applicableIdentity APP
1125
- * @returns Retrieved item.
1126
- */
1127
- export declare function getDataItem(dataItemId: string, options?: GetDataItemOptions): Promise<DataItem & NonNullable<GetDataItemResponseNonNullableFields>['dataItem']>;
1128
- export interface GetDataItemOptions {
1129
- /** ID of the collection from which to retrieve the data item. */
1130
- dataCollectionId: string;
1131
- /**
1132
- * Whether to retrieve data from the primary database instance.
1133
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1134
- *
1135
- * Default: `false`
1136
- */
1137
- consistentRead?: boolean;
1138
- /**
1139
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1140
- * If provided, the result text is returned in the specified language.
1141
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1142
- *
1143
- * If not provided, result text is not translated.
1144
- */
1145
- language?: string | null;
1146
- }
1147
- /**
1148
- * Removes an item from a collection.
1149
- *
1150
- *
1151
- * If any items in other collections reference the removed item in reference or multi-reference fields, those fields are cleared.
1152
- *
1153
- * > **Note:**
1154
- * > Once an item has been removed from a collection, it can't be restored.
1155
- * @param dataItemId - ID of the item to remove.
1156
- * @public
1157
- * @documentationMaturity preview
1158
- * @requiredField dataItemId
1159
- * @requiredField options
1160
- * @requiredField options.dataCollectionId
1161
- * @param options - Options for removing an item from a collection.
1162
- * @permissionScope Write Data Items
1163
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1164
- * @applicableIdentity APP
1165
- */
1166
- export declare function removeDataItem(dataItemId: string, options: RemoveDataItemOptions): Promise<RemoveDataItemResponse & RemoveDataItemResponseNonNullableFields>;
1167
- export interface RemoveDataItemOptions {
1168
- /** ID of the collection from which to remove the item. */
1169
- dataCollectionId: string;
1170
- }
1171
- /**
1172
- * Removes all items from a collection.
1173
- *
1174
- *
1175
- * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
1176
- *
1177
- * > **Note:**
1178
- * > Once items have been removed from a collection, they can't be restored.
1179
- * @public
1180
- * @documentationMaturity preview
1181
- * @requiredField options
1182
- * @requiredField options.dataCollectionId
1183
- * @param options - Options for truncating data items from a collection.
1184
- * @permissionScope Write Data Items
1185
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1186
- * @applicableIdentity APP
1187
- */
1188
- export declare function truncateDataItems(options: TruncateDataItemsOptions): Promise<void>;
1189
- export interface TruncateDataItemsOptions {
1190
- /** ID of the collection to truncate. */
1191
- dataCollectionId: string;
1192
- }
1193
- /**
1194
- * Creates a query to retrieve items from a database collection.
1195
- *
1196
- * The `queryDataItems()` function builds a query to retrieve data items from a collection and returns a `DataItemsQueryBuilder` object.
1197
- *
1198
- * The returned object contains the query definition which is typically used to run the query using the `find()` function.
1199
- *
1200
- * You can refine the query by chaining `DataItemsQueryBuilder` functions onto the query. `DataItemsQueryBuilder` functions enable you to sort, filter, and control the results that `queryDataItems()` returns.
1201
- *
1202
- * The `queryDataItems()` function runs with the following `DataItemsQueryBuilder` defaults that you can override:
1203
- *
1204
- * + `skip`: 0
1205
- * + `limit`: 50
1206
- * + `descending`: by `_createdDate`
1207
- *
1208
- * The functions that are chained to `queryDataItems()` 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.
1209
- *
1210
- * 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 in the `options.includeReferencedItems` parameter.
1211
- *
1212
- * > **Note**: When calling `queryDataItems()` 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`.
1213
- *
1214
- *
1215
- * @public
1216
- * @documentationMaturity preview
1217
- * @requiredField options.options.dataCollectionId
1218
- * @param options - Options for querying data items.
1219
- * @permissionScope Read Data Items
1220
- * @permissionScopeId SCOPE.DC-DATA.READ
1221
- * @applicableIdentity APP
1222
- */
1223
- export declare function queryDataItems(options: QueryDataItemsOptions): DataItemsQueryBuilder;
1224
- export interface QueryDataItemsOptions {
1225
- /** ID of the collection to query. */
1226
- dataCollectionId: string;
1227
- /**
1228
- * Whether to return the total count in the response for a query with offset paging.
1229
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1230
- *
1231
- * Default: `false`
1232
- */
1233
- returnTotalCount?: boolean | undefined;
1234
- /**
1235
- * Properties for which to include referenced items in the query's results.
1236
- * Up to 50 referenced items can be included for each item that matches the query.
1237
- */
1238
- includeReferencedItems?: string[] | undefined;
1239
- /**
1240
- * Whether to retrieve data from the primary database instance.
1241
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1242
- *
1243
- * Default: `false`
1244
- */
1245
- consistentRead?: boolean | undefined;
1246
- /**
1247
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1248
- * If provided, the result text is returned in the specified language.
1249
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1250
- *
1251
- * If not provided, result text is not translated.
1252
- */
1253
- language?: string | null | undefined;
1254
- }
1255
- interface QueryOffsetResult {
1256
- currentPage: number | undefined;
1257
- totalPages: number | undefined;
1258
- totalCount: number | undefined;
1259
- hasNext: () => boolean;
1260
- hasPrev: () => boolean;
1261
- length: number;
1262
- pageSize: number;
1263
- }
1264
- export interface DataItemsQueryResult extends QueryOffsetResult {
1265
- items: DataItem[];
1266
- query: DataItemsQueryBuilder;
1267
- next: () => Promise<DataItemsQueryResult>;
1268
- prev: () => Promise<DataItemsQueryResult>;
1269
- }
1270
- export interface DataItemsQueryBuilder {
1271
- /** @param propertyName - Property whose value is compared with `value`.
1272
- * @param value - Value to compare against.
1273
- * @documentationMaturity preview
1274
- */
1275
- eq: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: any) => DataItemsQueryBuilder;
1276
- /** @param propertyName - Property whose value is compared with `value`.
1277
- * @param value - Value to compare against.
1278
- * @documentationMaturity preview
1279
- */
1280
- ne: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: any) => DataItemsQueryBuilder;
1281
- /** @param propertyName - Property whose value is compared with `string`.
1282
- * @param string - String to compare against. Case-insensitive.
1283
- * @documentationMaturity preview
1284
- */
1285
- startsWith: (propertyName: '_id' | 'dataCollectionId' | string, value: string) => DataItemsQueryBuilder;
1286
- /** @documentationMaturity preview */
1287
- in: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: any) => DataItemsQueryBuilder;
1288
- /** @documentationMaturity preview */
1289
- exists: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: boolean) => DataItemsQueryBuilder;
1290
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1291
- * @documentationMaturity preview
1292
- */
1293
- ascending: (...propertyNames: Array<'_id' | 'dataCollectionId' | 'data' | string>) => DataItemsQueryBuilder;
1294
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1295
- * @documentationMaturity preview
1296
- */
1297
- descending: (...propertyNames: Array<'_id' | 'dataCollectionId' | 'data' | string>) => DataItemsQueryBuilder;
1298
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1299
- * @documentationMaturity preview
1300
- */
1301
- limit: (limit: number) => DataItemsQueryBuilder;
1302
- /** @param skip - Number of items to skip in the query results before returning the results.
1303
- * @documentationMaturity preview
1304
- */
1305
- skip: (skip: number) => DataItemsQueryBuilder;
1306
- /** @documentationMaturity preview */
1307
- find: () => Promise<DataItemsQueryResult>;
1308
- }
1309
- /**
1310
- * Runs an aggregation on a data collection and returns the resulting list of items.
1311
- *
1312
- *
1313
- * An aggregation enables you to perform certain calculations on your collection data, or on groups of items that you define, to retrieve meaningful summaries.
1314
- * You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
1315
- * @public
1316
- * @documentationMaturity preview
1317
- * @requiredField options.dataCollectionId
1318
- * @param options - Options for running an aggregation.
1319
- * @permissionScope Read Data Items
1320
- * @permissionScopeId SCOPE.DC-DATA.READ
1321
- * @applicableIdentity APP
1322
- */
1323
- export declare function aggregateDataItems(options?: AggregateDataItemsOptions): Promise<AggregateDataItemsResponse>;
1324
- export interface AggregateDataItemsOptions extends AggregateDataItemsRequestPagingMethodOneOf {
1325
- /** ID of the collection on which to run the aggregation. */
1326
- dataCollectionId: string;
1327
- /** 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. */
1328
- initialFilter?: Record<string, any> | null;
1329
- /** Aggregation applied to the data. */
1330
- aggregation?: Aggregation;
1331
- /** 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. */
1332
- finalFilter?: Record<string, any> | null;
1333
- /** Paging options to limit and skip the number of items. */
1334
- paging?: Paging;
1335
- /** 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`. */
1336
- cursorPaging?: CursorPaging;
1337
- /**
1338
- * Sort object in the following format:
1339
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1340
- */
1341
- sort?: Sorting[];
1342
- /**
1343
- * Whether to return the total count in the response for a query with offset paging.
1344
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1345
- *
1346
- * Default: `false`
1347
- */
1348
- returnTotalCount?: boolean;
1349
- /**
1350
- * Whether to retrieve data from the primary database instance.
1351
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1352
- *
1353
- * Default: `false`
1354
- */
1355
- consistentRead?: boolean;
1356
- /**
1357
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1358
- * If provided, the result text is returned in the specified language.
1359
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1360
- *
1361
- * If not provided, result text is not translated.
1362
- */
1363
- language?: string | null;
1364
- }
1365
- /**
1366
- * Counts the number of items in a data collection that match the provided filtering preferences.
1367
- *
1368
- * > **Note**: When calling `countDataItems()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
1369
- * @public
1370
- * @documentationMaturity preview
1371
- * @requiredField options.dataCollectionId
1372
- * @param options - Options for counting the number of items in a data collection.
1373
- * @permissionScope Read Data Items
1374
- * @permissionScopeId SCOPE.DC-DATA.READ
1375
- * @applicableIdentity APP
1376
- */
1377
- export declare function countDataItems(options?: CountDataItemsOptions): Promise<CountDataItemsResponse & CountDataItemsResponseNonNullableFields>;
1378
- export interface CountDataItemsOptions {
1379
- /** ID of the collection for which to count query results. */
1380
- dataCollectionId: string;
1381
- /**
1382
- * Filter object in the following format:
1383
- *
1384
- * `"filter" : {
1385
- * "fieldName1": "value1",
1386
- * "fieldName2":{"$operator":"value2"}
1387
- * }`.
1388
- *
1389
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
1390
- */
1391
- filter?: Record<string, any> | null;
1392
- /**
1393
- * Whether to retrieve data from the primary database instance.
1394
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1395
- *
1396
- * Default: `false`
1397
- */
1398
- consistentRead?: boolean;
1399
- /**
1400
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1401
- * If provided, the result text is returned in the specified language.
1402
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1403
- *
1404
- * If not provided, result text is not translated.
1405
- */
1406
- language?: string | null;
1407
- }
1408
- /**
1409
- * Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
1410
- *
1411
- *
1412
- * As with `queryDataItems()`, this endpoint retrieves items based on the filtering, sorting, and paging preferences you provide.
1413
- * However, `queryDistinctValues()` doesn't return all of the full items that match the query.
1414
- * Rather, it returns all unique values of the field you specify in `options.fieldName` for items that match the query.
1415
- * If more than one item has the same value for that field, that value appears only once.
1416
- *
1417
- * For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
1418
- *
1419
- * > **Note**: When calling `queryDistinctValues()` following an update to your collection, the data retrieved may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
1420
- * @public
1421
- * @documentationMaturity preview
1422
- * @requiredField options.dataCollectionId
1423
- * @param options - Options for querying distinct values.
1424
- * @permissionScope Read Data Items
1425
- * @permissionScopeId SCOPE.DC-DATA.READ
1426
- * @applicableIdentity APP
1427
- */
1428
- export declare function queryDistinctValues(options?: QueryDistinctValuesOptions): Promise<QueryDistinctValuesResponse>;
1429
- export interface QueryDistinctValuesOptions extends QueryDistinctValuesRequestPagingMethodOneOf {
1430
- /** ID of the collection to query. */
1431
- dataCollectionId: string;
1432
- /** Item field name for which to return all distinct values. */
1433
- fieldName?: string;
1434
- /**
1435
- * Filter object in the following format:
1436
- *
1437
- * `"filter" : {
1438
- * "fieldName1": "value1",
1439
- * "fieldName2":{"$operator":"value2"}
1440
- * }`.
1441
- *
1442
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
1443
- */
1444
- filter?: Record<string, any> | null;
1445
- /**
1446
- * Sort order.
1447
- *
1448
- * Supported values: `ASC`, `DESC`.
1449
- */
1450
- order?: SortOrder;
1451
- /** Paging options to limit and skip the number of items. */
1452
- paging?: Paging;
1453
- /** 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`. */
1454
- cursorPaging?: CursorPaging;
1455
- /**
1456
- * Whether to return the total count in the response for a query with offset paging.
1457
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1458
- *
1459
- * Default: `false`
1460
- */
1461
- returnTotalCount?: boolean;
1462
- /**
1463
- * Whether to retrieve data from the primary database instance.
1464
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1465
- *
1466
- * Default: `false`
1467
- */
1468
- consistentRead?: boolean;
1469
- /**
1470
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1471
- * If provided, the result text is returned in the specified language.
1472
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1473
- *
1474
- * If not provided, result text is not translated.
1475
- */
1476
- language?: string | null;
1477
- }
1478
- /**
1479
- * Adds multiple items to a collection.
1480
- *
1481
- *
1482
- * When each item is inserted into a collection, its ID is automatically assigned a random value.
1483
- * 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.
1484
- * @public
1485
- * @documentationMaturity preview
1486
- * @requiredField options.dataCollectionId
1487
- * @requiredField options.dataItems
1488
- * @param options - Options for adding multiple items to a collection.
1489
- * @permissionScope Write Data Items
1490
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1491
- * @applicableIdentity APP
1492
- */
1493
- export declare function bulkInsertDataItems(options?: BulkInsertDataItemsOptions): Promise<BulkInsertDataItemsResponse & BulkInsertDataItemsResponseNonNullableFields>;
1494
- export interface BulkInsertDataItemsOptions {
1495
- /** ID of the collection in which to insert the items. */
1496
- dataCollectionId: string;
1497
- /** Data items to insert. */
1498
- dataItems: DataItem[];
1499
- /**
1500
- * Whether to return the inserted data items.
1501
- * When `true`, the `results` objects contain a `dataItem` field.
1502
- *
1503
- * Default: `false`
1504
- */
1505
- returnEntity?: boolean;
1506
- }
1507
- /**
1508
- * Updates multiple items in a collection.
1509
- *
1510
- *
1511
- * This function replaces each specified data item's existing data with the payload provided in the request.
1512
- *
1513
- * Each item in the request must include an ID. If an item is found in the specified collection with
1514
- * the same ID, that item is updated. If the collection doesn't contain an item with that ID, the update fails.
1515
- *
1516
- * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
1517
- *
1518
- * > **Note:**
1519
- * > 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
1520
- * > aren't included in the updated item, their values are lost.
1521
- * @public
1522
- * @documentationMaturity preview
1523
- * @requiredField options.dataCollectionId
1524
- * @requiredField options.dataItems
1525
- * @param options - Options for updating multiple items in a collection.
1526
- * @permissionScope Write Data Items
1527
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1528
- * @applicableIdentity APP
1529
- */
1530
- export declare function bulkUpdateDataItems(options?: BulkUpdateDataItemsOptions): Promise<BulkUpdateDataItemsResponse & BulkUpdateDataItemsResponseNonNullableFields>;
1531
- export interface BulkUpdateDataItemsOptions {
1532
- /** ID of the collection in which to update items. */
1533
- dataCollectionId: string;
1534
- /** Data items to update. */
1535
- dataItems: DataItem[];
1536
- /**
1537
- * Whether to return the updated data items.
1538
- * When `true`, the `results` objects contain a `dataItem` field.
1539
- *
1540
- * Default: `false`
1541
- */
1542
- returnEntity?: boolean;
1543
- }
1544
- /**
1545
- * Inserts or updates multiple items in a collection.
1546
- *
1547
- *
1548
- * This function inserts or updates each item provided, depending on whether it already exists in the collection. For each item:
1549
- *
1550
- * + If you don't provide an ID, a new item is created.
1551
- *
1552
- * + If you provide an ID that doesn't exist in the collection, a new item is created with that ID.
1553
- *
1554
- * + 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.
1555
- *
1556
- * > **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.
1557
- * > This means that all of the item's previous fields and values are lost.
1558
- * @public
1559
- * @documentationMaturity preview
1560
- * @requiredField options.dataCollectionId
1561
- * @requiredField options.dataItems
1562
- * @param options - Options for saving multiple items in a collection.
1563
- * @permissionScope Write Data Items
1564
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1565
- * @applicableIdentity APP
1566
- */
1567
- export declare function bulkSaveDataItems(options?: BulkSaveDataItemsOptions): Promise<BulkSaveDataItemsResponse & BulkSaveDataItemsResponseNonNullableFields>;
1568
- export interface BulkSaveDataItemsOptions {
1569
- /** ID of the collection in which to insert or update the items. */
1570
- dataCollectionId: string;
1571
- /** Data items to insert or update. */
1572
- dataItems: DataItem[];
1573
- /**
1574
- * Whether to return the saved data item.
1575
- * When `true`, the `results` objects contain a `dataItem` field.
1576
- *
1577
- * Default: `false`
1578
- */
1579
- returnEntity?: boolean;
1580
- }
1581
- /**
1582
- * Removes multiple items from a collection.
1583
- *
1584
- *
1585
- * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
1586
- *
1587
- * > **Note:** Once an item has been removed from a collection, it can't be restored.
1588
- * @public
1589
- * @documentationMaturity preview
1590
- * @requiredField options
1591
- * @requiredField options.dataCollectionId
1592
- * @requiredField options.dataItemIds
1593
- * @param options - Options for removing multiple items from a collection.
1594
- * @permissionScope Write Data Items
1595
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1596
- * @applicableIdentity APP
1597
- */
1598
- export declare function bulkRemoveDataItems(options: BulkRemoveDataItemsOptions): Promise<BulkRemoveDataItemsResponse & BulkRemoveDataItemsResponseNonNullableFields>;
1599
- export interface BulkRemoveDataItemsOptions {
1600
- /** ID of the collection from which to remove the item. */
1601
- dataCollectionId: string;
1602
- /** IDs of data items to remove. */
1603
- dataItemIds: string[];
1604
- }
1605
- /**
1606
- * Retrieves the full items referenced in the specified field of an item.
1607
- *
1608
- *
1609
- * Reference and multi-reference fields refer to items in different collections.
1610
- * Use this function to retrieve the full details of the referenced items themselves.
1611
- *
1612
- * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection.
1613
- * Querying the **Movies** collection using `queryReferencedDataItems()` returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
1614
- * This gives you information from the **People** collection about each of the actors in the specified movie.
1615
- *
1616
- * > **Note**: When calling `queryReferencedDataItems()` 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`.
1617
- * @public
1618
- * @documentationMaturity preview
1619
- * @requiredField options.dataCollectionId
1620
- * @param options - Options for querying referenced data items.
1621
- * @permissionScope Read Data Items
1622
- * @permissionScopeId SCOPE.DC-DATA.READ
1623
- * @applicableIdentity APP
1624
- */
1625
- export declare function queryReferencedDataItems(options?: QueryReferencedDataItemsOptions): Promise<QueryReferencedDataItemsResponse & QueryReferencedDataItemsResponseNonNullableFields>;
1626
- export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItemsRequestPagingMethodOneOf {
1627
- /** ID of the collection containing the referring item. */
1628
- dataCollectionId: string;
1629
- /** ID of the referring item. */
1630
- referringItemId?: string;
1631
- /** Field containing references in the referring item. */
1632
- referringItemFieldName?: string;
1633
- /** Order of the returned referenced items. Sorted by the date each item was referenced. */
1634
- order?: SortOrder;
1635
- /** Paging options to limit and skip the number of items. */
1636
- paging?: Paging;
1637
- /** 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`. */
1638
- cursorPaging?: CursorPaging;
1639
- /**
1640
- * Whether to return the total count in the response.
1641
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1642
- *
1643
- * Default: `false`
1644
- */
1645
- returnTotalCount?: boolean;
1646
- /**
1647
- * Whether to retrieve data from the primary database instance.
1648
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1649
- *
1650
- * Default: `false`
1651
- */
1652
- consistentRead?: boolean;
1653
- /**
1654
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1655
- * If provided, the result text is returned in the specified language.
1656
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1657
- *
1658
- * If not provided, result text is not translated.
1659
- */
1660
- language?: string | null;
1661
- }
1662
- /**
1663
- * Checks whether a field in a referring item contains a reference to a specified item.
1664
- *
1665
- * > **Note**: When calling `isReferencedDataItem()` following an update to your collection, the result returned may not reflect the most recent changes. If you need the most up-to-date data, set `options.consistentRead` to `true`.
1666
- * @public
1667
- * @documentationMaturity preview
1668
- * @requiredField options.dataCollectionId
1669
- * @requiredField options.referencedItemId
1670
- * @requiredField options.referringItemFieldName
1671
- * @requiredField options.referringItemId
1672
- * @param options - Options for checking whether a field contains a reference to an item.
1673
- * @permissionScope Read Data Items
1674
- * @permissionScopeId SCOPE.DC-DATA.READ
1675
- * @applicableIdentity APP
1676
- */
1677
- export declare function isReferencedDataItem(options?: IsReferencedDataItemOptions): Promise<IsReferencedDataItemResponse & IsReferencedDataItemResponseNonNullableFields>;
1678
- export interface IsReferencedDataItemOptions {
1679
- /** ID of the collection containing the referring data item. */
1680
- dataCollectionId: string;
1681
- /** Field to check for a reference to the item that may be referenced. */
1682
- referringItemFieldName: string;
1683
- /** ID of the referring item. */
1684
- referringItemId: string;
1685
- /** ID of the item that may be referenced. */
1686
- referencedItemId: string;
1687
- /**
1688
- * Whether to retrieve data from the primary database instance.
1689
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1690
- *
1691
- * Default: `false`
1692
- */
1693
- consistentRead?: boolean;
1694
- }
1695
- /**
1696
- * Inserts a reference in the specified field in an item in a collection.
1697
- *
1698
- *
1699
- * A reference in `options.dataItemReference` specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
1700
- * @public
1701
- * @documentationMaturity preview
1702
- * @requiredField options.dataCollectionId
1703
- * @requiredField options.dataItemReference.referencedItemId
1704
- * @requiredField options.dataItemReference.referringItemFieldName
1705
- * @requiredField options.dataItemReference.referringItemId
1706
- * @param options - Options for inserting a reference.
1707
- * @permissionScope Write Data Items
1708
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1709
- * @applicableIdentity APP
1710
- */
1711
- export declare function insertDataItemReference(options?: InsertDataItemReferenceOptions): Promise<InsertDataItemReferenceResponse & InsertDataItemReferenceResponseNonNullableFields>;
1712
- export interface InsertDataItemReferenceOptions {
1713
- /** ID of the collection in which to insert the reference. */
1714
- dataCollectionId: string;
1715
- /** Reference to insert */
1716
- dataItemReference?: DataItemReference;
1717
- }
1718
- /**
1719
- * Removes the specified reference from the specified field.
1720
- * @public
1721
- * @documentationMaturity preview
1722
- * @requiredField options
1723
- * @requiredField options.dataCollectionId
1724
- * @requiredField options.dataItemReference
1725
- * @requiredField options.dataItemReference.referencedItemId
1726
- * @requiredField options.dataItemReference.referringItemFieldName
1727
- * @requiredField options.dataItemReference.referringItemId
1728
- * @param options - Options for removing a reference.
1729
- * @permissionScope Write Data Items
1730
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1731
- * @applicableIdentity APP
1732
- */
1733
- export declare function removeDataItemReference(options: RemoveDataItemReferenceOptions): Promise<RemoveDataItemReferenceResponse & RemoveDataItemReferenceResponseNonNullableFields>;
1734
- export interface RemoveDataItemReferenceOptions {
1735
- /** ID of the collection containing the referring item. */
1736
- dataCollectionId: string;
1737
- /** Reference to remove. */
1738
- dataItemReference: DataItemReference;
1739
- }
1740
- /**
1741
- * Inserts one or more references in the specified fields of items in a collection.
1742
- *
1743
- *
1744
- * This endpoint adds one or more references to a collection.
1745
- * Each new reference in `options.dataItemReferences` specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
1746
- * @public
1747
- * @documentationMaturity preview
1748
- * @requiredField options.dataCollectionId
1749
- * @requiredField options.dataItemReferences
1750
- * @requiredField options.dataItemReferences.referencedItemId
1751
- * @requiredField options.dataItemReferences.referringItemFieldName
1752
- * @requiredField options.dataItemReferences.referringItemId
1753
- * @param options - Options for inserting one or more references.
1754
- * @permissionScope Write Data Items
1755
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1756
- * @applicableIdentity APP
1757
- */
1758
- export declare function bulkInsertDataItemReferences(options?: BulkInsertDataItemReferencesOptions): Promise<BulkInsertDataItemReferencesResponse & BulkInsertDataItemReferencesResponseNonNullableFields>;
1759
- export interface BulkInsertDataItemReferencesOptions {
1760
- /** ID of the collection containing the referring items. */
1761
- dataCollectionId: string;
1762
- /** References to insert. */
1763
- dataItemReferences: DataItemReference[];
1764
- /**
1765
- * Whether to return the inserted data item references.
1766
- * When `true`, the `results` objects contain a `dataItemReference` field.
1767
- *
1768
- * Default: `false`
1769
- */
1770
- returnEntity?: boolean;
1771
- }
1772
- /**
1773
- * Removes one or more references.
1774
- * @public
1775
- * @documentationMaturity preview
1776
- * @requiredField options
1777
- * @requiredField options.dataCollectionId
1778
- * @requiredField options.dataItemReferences
1779
- * @requiredField options.dataItemReferences.referencedItemId
1780
- * @requiredField options.dataItemReferences.referringItemFieldName
1781
- * @requiredField options.dataItemReferences.referringItemId
1782
- * @param options - Options for removing one or more references.
1783
- * @permissionScope Write Data Items
1784
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1785
- * @applicableIdentity APP
1786
- */
1787
- export declare function bulkRemoveDataItemReferences(options: BulkRemoveDataItemReferencesOptions): Promise<BulkRemoveDataItemReferencesResponse & BulkRemoveDataItemReferencesResponseNonNullableFields>;
1788
- export interface BulkRemoveDataItemReferencesOptions {
1789
- /** ID of the collection containing the referring items. */
1790
- dataCollectionId: string;
1791
- /** References to remove. */
1792
- dataItemReferences: DataItemReference[];
1793
- }
1794
- /**
1795
- * Replaces references in a specified field of a specified data item.
1796
- *
1797
- *
1798
- * This function replaces the existing reference or references contained in the field specified in `options.referringItemFieldName` within the data item specified in `options.referringItemId`.
1799
- * The function removes existing references and in their place it adds references to the items specified in `options.newReferencedItemIds`.
1800
- *
1801
- * > **Note:** If you pass an empty array in `options.newReferencedItemIds`, all existing references are removed.
1802
- * @public
1803
- * @documentationMaturity preview
1804
- * @requiredField options.dataCollectionId
1805
- * @requiredField options.referringItemFieldName
1806
- * @requiredField options.referringItemId
1807
- * @param options - Options for replacing references.
1808
- * @permissionScope Write Data Items
1809
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1810
- * @applicableIdentity APP
1811
- */
1812
- export declare function replaceDataItemReferences(options?: ReplaceDataItemReferencesOptions): Promise<ReplaceDataItemReferencesResponse & ReplaceDataItemReferencesResponseNonNullableFields>;
1813
- export interface ReplaceDataItemReferencesOptions {
1814
- /** ID of the collection containing the referring item. */
1815
- dataCollectionId: string;
1816
- /** Field containing references in the referring item. */
1817
- referringItemFieldName: string;
1818
- /** ID of the referring item. */
1819
- referringItemId: string;
1820
- /** List of new referenced item IDs to replace the existing ones. */
1821
- newReferencedItemIds?: string[];
1822
- }
1823
- export {};