@wix/data 1.0.89 → 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 -442
  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 -622
  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 -936
  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 -913
  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 -1748
  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 -411
  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 -591
  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 -912
  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 -913
  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 -1748
  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,1748 +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 InsertDataItemResponseNonNullableFields {
720
- dataItem?: {
721
- _id: string;
722
- dataCollectionId: string;
723
- };
724
- }
725
- export interface UpdateDataItemResponseNonNullableFields {
726
- dataItem?: {
727
- _id: string;
728
- dataCollectionId: string;
729
- };
730
- }
731
- export interface SaveDataItemResponseNonNullableFields {
732
- action: Action;
733
- dataItem?: {
734
- _id: string;
735
- dataCollectionId: string;
736
- };
737
- }
738
- export interface GetDataItemResponseNonNullableFields {
739
- dataItem?: {
740
- _id: string;
741
- dataCollectionId: string;
742
- };
743
- }
744
- export interface RemoveDataItemResponseNonNullableFields {
745
- dataItem?: {
746
- _id: string;
747
- dataCollectionId: string;
748
- };
749
- }
750
- export interface QueryDataItemsResponseNonNullableFields {
751
- dataItems: {
752
- _id: string;
753
- dataCollectionId: string;
754
- }[];
755
- }
756
- export interface CountDataItemsResponseNonNullableFields {
757
- totalCount: number;
758
- }
759
- export interface BulkInsertDataItemsResponseNonNullableFields {
760
- results: {
761
- action: BulkActionType;
762
- itemMetadata?: {
763
- originalIndex: number;
764
- success: boolean;
765
- error?: {
766
- code: string;
767
- description: string;
768
- };
769
- };
770
- dataItem?: {
771
- _id: string;
772
- dataCollectionId: string;
773
- };
774
- }[];
775
- bulkActionMetadata?: {
776
- totalSuccesses: number;
777
- totalFailures: number;
778
- };
779
- }
780
- export interface BulkUpdateDataItemsResponseNonNullableFields {
781
- results: {
782
- action: BulkActionType;
783
- itemMetadata?: {
784
- originalIndex: number;
785
- success: boolean;
786
- error?: {
787
- code: string;
788
- description: string;
789
- };
790
- };
791
- dataItem?: {
792
- _id: string;
793
- dataCollectionId: string;
794
- };
795
- }[];
796
- bulkActionMetadata?: {
797
- totalSuccesses: number;
798
- totalFailures: number;
799
- };
800
- }
801
- export interface BulkSaveDataItemsResponseNonNullableFields {
802
- results: {
803
- action: BulkActionType;
804
- itemMetadata?: {
805
- originalIndex: number;
806
- success: boolean;
807
- error?: {
808
- code: string;
809
- description: string;
810
- };
811
- };
812
- dataItem?: {
813
- _id: string;
814
- dataCollectionId: string;
815
- };
816
- }[];
817
- bulkActionMetadata?: {
818
- totalSuccesses: number;
819
- totalFailures: number;
820
- };
821
- }
822
- export interface BulkRemoveDataItemsResponseNonNullableFields {
823
- results: {
824
- action: BulkActionType;
825
- itemMetadata?: {
826
- originalIndex: number;
827
- success: boolean;
828
- error?: {
829
- code: string;
830
- description: string;
831
- };
832
- };
833
- dataItem?: {
834
- _id: string;
835
- dataCollectionId: string;
836
- };
837
- }[];
838
- bulkActionMetadata?: {
839
- totalSuccesses: number;
840
- totalFailures: number;
841
- };
842
- }
843
- export interface QueryReferencedDataItemsResponseNonNullableFields {
844
- results: {
845
- dataItem?: {
846
- _id: string;
847
- dataCollectionId: string;
848
- };
849
- unresolvedReference?: {
850
- referringItemId: string;
851
- referringItemFieldName: string;
852
- };
853
- }[];
854
- }
855
- export interface IsReferencedDataItemResponseNonNullableFields {
856
- isReferenced: boolean;
857
- }
858
- export interface InsertDataItemReferenceResponseNonNullableFields {
859
- dataItemReference?: {
860
- referringItemFieldName: string;
861
- referringItemId: string;
862
- referencedItemId: string;
863
- };
864
- }
865
- export interface RemoveDataItemReferenceResponseNonNullableFields {
866
- dataItemReference?: {
867
- referringItemFieldName: string;
868
- referringItemId: string;
869
- referencedItemId: string;
870
- };
871
- }
872
- export interface BulkInsertDataItemReferencesResponseNonNullableFields {
873
- results: {
874
- action: BulkActionType;
875
- referenceMetadata?: {
876
- originalIndex: number;
877
- success: boolean;
878
- error?: {
879
- code: string;
880
- description: string;
881
- };
882
- };
883
- dataItemReference?: {
884
- referringItemFieldName: string;
885
- referringItemId: string;
886
- referencedItemId: string;
887
- };
888
- }[];
889
- bulkActionMetadata?: {
890
- totalSuccesses: number;
891
- totalFailures: number;
892
- };
893
- }
894
- export interface BulkRemoveDataItemReferencesResponseNonNullableFields {
895
- results: {
896
- action: BulkActionType;
897
- referenceMetadata?: {
898
- originalIndex: number;
899
- success: boolean;
900
- error?: {
901
- code: string;
902
- description: string;
903
- };
904
- };
905
- dataItemReference?: {
906
- referringItemFieldName: string;
907
- referringItemId: string;
908
- referencedItemId: string;
909
- };
910
- }[];
911
- bulkActionMetadata?: {
912
- totalSuccesses: number;
913
- totalFailures: number;
914
- };
915
- }
916
- export interface ReplaceDataItemReferencesResponseNonNullableFields {
917
- dataItemReferences: {
918
- referringItemFieldName: string;
919
- referringItemId: string;
920
- referencedItemId: string;
921
- }[];
922
- }
923
- /**
924
- * Adds an item to a collection.
925
- *
926
- *
927
- * An item can only be inserted into an existing connection.
928
- * You can create a new collection using the Data Collections API.
929
- *
930
- * When an item is inserted into a collection, the item's ID is automatically assigned a random value.
931
- * You can optionally provide a custom ID in `dataItem.id` when inserting the item.
932
- * If you specify an ID that already exists in the collection, the insertion will fail.
933
- *
934
- * If `options.dataItem.data` is empty, a new item is created with no data fields.
935
- * @public
936
- * @documentationMaturity preview
937
- * @requiredField options
938
- * @requiredField options.dataCollectionId
939
- * @requiredField options.dataItem
940
- * @param options - Options for adding an item to a collection.
941
- * @permissionScope Write Data Items
942
- * @permissionScopeId SCOPE.DC-DATA.WRITE
943
- * @applicableIdentity APP
944
- */
945
- export declare function insertDataItem(options: InsertDataItemOptions): Promise<InsertDataItemResponse & InsertDataItemResponseNonNullableFields>;
946
- export interface InsertDataItemOptions {
947
- /** ID of the collection in which to insert the item. */
948
- dataCollectionId: string;
949
- /** Item to insert. */
950
- dataItem: DataItem;
951
- }
952
- /**
953
- * Updates an item in a collection.
954
- *
955
- *
956
- * This function replaces the data item's existing data with the payload provided in `options.dataItem.data` in the request.
957
- *
958
- * To update an item, you need to specify an item ID and a collection ID.
959
- * If an item is found in the specified collection with the specified ID, that item is updated.
960
- * If the collection doesn't contain an item with that ID, the request fails.
961
- *
962
- * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
963
- *
964
- * > **Note:**
965
- * > After an item is updated, it only contains the fields included in the `options.dataItem.data` payload in the `updateDataItem()` call.
966
- * > If the existing item has fields with values and those fields aren't included in the updated item, their values are lost.
967
- * @param _id - Data item ID.
968
- * @public
969
- * @documentationMaturity preview
970
- * @requiredField _id
971
- * @requiredField options
972
- * @requiredField options.dataCollectionId
973
- * @requiredField options.dataItem
974
- * @param options - Options for updating an item in a collection.
975
- * @permissionScope Write Data Items
976
- * @permissionScopeId SCOPE.DC-DATA.WRITE
977
- * @applicableIdentity APP
978
- */
979
- export declare function updateDataItem(_id: string, options: UpdateDataItemOptions): Promise<UpdateDataItemResponse & UpdateDataItemResponseNonNullableFields>;
980
- export interface UpdateDataItemOptions {
981
- /** Updated data item content. The existing data item's content is replaced entirely. */
982
- dataItem: {
983
- /** Data item ID. */
984
- _id?: string;
985
- /**
986
- * ID of the collection this item belongs to
987
- * @readonly
988
- */
989
- dataCollectionId?: string;
990
- /**
991
- * Data item contents.
992
- *
993
- * Property-value pairs representing the data item's payload. When retrieving a data item, it also includes the following read-only fields:
994
- *
995
- * + `_id`: Item ID.
996
- * + `_createdDate`: Date and time the item was added to the collection.
997
- * + `_updatedDate`: Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have the same value.
998
- * + `_ownerId`: ID of the user who created the item. Can be modified with site owner permissions.
999
- */
1000
- data?: Record<string, any> | null;
1001
- };
1002
- /** ID of the collection containing the existing item. */
1003
- dataCollectionId: string;
1004
- }
1005
- /**
1006
- * Inserts or updates an item in a collection.
1007
- *
1008
- *
1009
- * The `saveDataItem()` function inserts or updates the specified item, depending on whether it already exists in the collection.
1010
- *
1011
- * + If you don't provide an ID, a new item is created.
1012
- *
1013
- * + If you provide an ID that does not exist in the collection, a new item is created with that ID.
1014
- *
1015
- * + 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.
1016
- *
1017
- * > **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.
1018
- * > This means that the item's previous fields and values are lost.
1019
- * @public
1020
- * @documentationMaturity preview
1021
- * @requiredField options
1022
- * @requiredField options.dataCollectionId
1023
- * @requiredField options.dataItem
1024
- * @param options - Options for saving an item in a collection.
1025
- * @permissionScope Write Data Items
1026
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1027
- * @applicableIdentity APP
1028
- */
1029
- export declare function saveDataItem(options: SaveDataItemOptions): Promise<SaveDataItemResponse & SaveDataItemResponseNonNullableFields>;
1030
- export interface SaveDataItemOptions {
1031
- /** ID of the collection in which to insert or update the item. */
1032
- dataCollectionId: string;
1033
- /** Data item to insert or update. */
1034
- dataItem: DataItem;
1035
- }
1036
- /**
1037
- * Retrieves an item from a collection.
1038
- *
1039
- *
1040
- * > **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`.
1041
- * @param dataItemId - ID of the data item to retrieve.
1042
- * @public
1043
- * @documentationMaturity preview
1044
- * @requiredField dataItemId
1045
- * @requiredField options.dataCollectionId
1046
- * @param options - Options for retrieving an item from a collection.
1047
- * @permissionScope Read Data Items
1048
- * @permissionScopeId SCOPE.DC-DATA.READ
1049
- * @applicableIdentity APP
1050
- * @returns Retrieved item.
1051
- */
1052
- export declare function getDataItem(dataItemId: string, options?: GetDataItemOptions): Promise<DataItem & NonNullable<GetDataItemResponseNonNullableFields>['dataItem']>;
1053
- export interface GetDataItemOptions {
1054
- /** ID of the collection from which to retrieve the data item. */
1055
- dataCollectionId: string;
1056
- /**
1057
- * Whether to retrieve data from the primary database instance.
1058
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1059
- *
1060
- * Default: `false`
1061
- */
1062
- consistentRead?: boolean;
1063
- /**
1064
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1065
- * If provided, the result text is returned in the specified language.
1066
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1067
- *
1068
- * If not provided, result text is not translated.
1069
- */
1070
- language?: string | null;
1071
- }
1072
- /**
1073
- * Removes an item from a collection.
1074
- *
1075
- *
1076
- * If any items in other collections reference the removed item in reference or multi-reference fields, those fields are cleared.
1077
- *
1078
- * > **Note:**
1079
- * > Once an item has been removed from a collection, it can't be restored.
1080
- * @param dataItemId - ID of the item to remove.
1081
- * @public
1082
- * @documentationMaturity preview
1083
- * @requiredField dataItemId
1084
- * @requiredField options
1085
- * @requiredField options.dataCollectionId
1086
- * @param options - Options for removing an item from a collection.
1087
- * @permissionScope Write Data Items
1088
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1089
- * @applicableIdentity APP
1090
- */
1091
- export declare function removeDataItem(dataItemId: string, options: RemoveDataItemOptions): Promise<RemoveDataItemResponse & RemoveDataItemResponseNonNullableFields>;
1092
- export interface RemoveDataItemOptions {
1093
- /** ID of the collection from which to remove the item. */
1094
- dataCollectionId: string;
1095
- }
1096
- /**
1097
- * Removes all items from a collection.
1098
- *
1099
- *
1100
- * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
1101
- *
1102
- * > **Note:**
1103
- * > Once items have been removed from a collection, they can't be restored.
1104
- * @public
1105
- * @documentationMaturity preview
1106
- * @requiredField options
1107
- * @requiredField options.dataCollectionId
1108
- * @param options - Options for truncating data items from a collection.
1109
- * @permissionScope Write Data Items
1110
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1111
- * @applicableIdentity APP
1112
- */
1113
- export declare function truncateDataItems(options: TruncateDataItemsOptions): Promise<void>;
1114
- export interface TruncateDataItemsOptions {
1115
- /** ID of the collection to truncate. */
1116
- dataCollectionId: string;
1117
- }
1118
- /**
1119
- * Creates a query to retrieve items from a database collection.
1120
- *
1121
- * The `queryDataItems()` function builds a query to retrieve data items from a collection and returns a `DataItemsQueryBuilder` object.
1122
- *
1123
- * The returned object contains the query definition which is typically used to run the query using the `find()` function.
1124
- *
1125
- * 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.
1126
- *
1127
- * The `queryDataItems()` function runs with the following `DataItemsQueryBuilder` defaults that you can override:
1128
- *
1129
- * + `skip`: 0
1130
- * + `limit`: 50
1131
- * + `descending`: by `_createdDate`
1132
- *
1133
- * 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.
1134
- *
1135
- * 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.
1136
- *
1137
- * > **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`.
1138
- *
1139
- *
1140
- * @public
1141
- * @documentationMaturity preview
1142
- * @requiredField options.options.dataCollectionId
1143
- * @param options - Options for querying data items.
1144
- * @permissionScope Read Data Items
1145
- * @permissionScopeId SCOPE.DC-DATA.READ
1146
- * @applicableIdentity APP
1147
- */
1148
- export declare function queryDataItems(options: QueryDataItemsOptions): DataItemsQueryBuilder;
1149
- export interface QueryDataItemsOptions {
1150
- /** ID of the collection to query. */
1151
- dataCollectionId: string;
1152
- /**
1153
- * Whether to return the total count in the response for a query with offset paging.
1154
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1155
- *
1156
- * Default: `false`
1157
- */
1158
- returnTotalCount?: boolean | undefined;
1159
- /**
1160
- * Properties for which to include referenced items in the query's results.
1161
- * Up to 50 referenced items can be included for each item that matches the query.
1162
- */
1163
- includeReferencedItems?: string[] | undefined;
1164
- /**
1165
- * Whether to retrieve data from the primary database instance.
1166
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1167
- *
1168
- * Default: `false`
1169
- */
1170
- consistentRead?: boolean | undefined;
1171
- /**
1172
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1173
- * If provided, the result text is returned in the specified language.
1174
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1175
- *
1176
- * If not provided, result text is not translated.
1177
- */
1178
- language?: string | null | undefined;
1179
- }
1180
- interface QueryOffsetResult {
1181
- currentPage: number | undefined;
1182
- totalPages: number | undefined;
1183
- totalCount: number | undefined;
1184
- hasNext: () => boolean;
1185
- hasPrev: () => boolean;
1186
- length: number;
1187
- pageSize: number;
1188
- }
1189
- export interface DataItemsQueryResult extends QueryOffsetResult {
1190
- items: DataItem[];
1191
- query: DataItemsQueryBuilder;
1192
- next: () => Promise<DataItemsQueryResult>;
1193
- prev: () => Promise<DataItemsQueryResult>;
1194
- }
1195
- export interface DataItemsQueryBuilder {
1196
- /** @param propertyName - Property whose value is compared with `value`.
1197
- * @param value - Value to compare against.
1198
- * @documentationMaturity preview
1199
- */
1200
- eq: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: any) => DataItemsQueryBuilder;
1201
- /** @param propertyName - Property whose value is compared with `value`.
1202
- * @param value - Value to compare against.
1203
- * @documentationMaturity preview
1204
- */
1205
- ne: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: any) => DataItemsQueryBuilder;
1206
- /** @param propertyName - Property whose value is compared with `string`.
1207
- * @param string - String to compare against. Case-insensitive.
1208
- * @documentationMaturity preview
1209
- */
1210
- startsWith: (propertyName: '_id' | 'dataCollectionId' | string, value: string) => DataItemsQueryBuilder;
1211
- /** @documentationMaturity preview */
1212
- in: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: any) => DataItemsQueryBuilder;
1213
- /** @documentationMaturity preview */
1214
- exists: (propertyName: '_id' | 'dataCollectionId' | 'data' | string, value: boolean) => DataItemsQueryBuilder;
1215
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1216
- * @documentationMaturity preview
1217
- */
1218
- ascending: (...propertyNames: Array<'_id' | 'dataCollectionId' | 'data' | string>) => DataItemsQueryBuilder;
1219
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
1220
- * @documentationMaturity preview
1221
- */
1222
- descending: (...propertyNames: Array<'_id' | 'dataCollectionId' | 'data' | string>) => DataItemsQueryBuilder;
1223
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
1224
- * @documentationMaturity preview
1225
- */
1226
- limit: (limit: number) => DataItemsQueryBuilder;
1227
- /** @param skip - Number of items to skip in the query results before returning the results.
1228
- * @documentationMaturity preview
1229
- */
1230
- skip: (skip: number) => DataItemsQueryBuilder;
1231
- /** @documentationMaturity preview */
1232
- find: () => Promise<DataItemsQueryResult>;
1233
- }
1234
- /**
1235
- * Runs an aggregation on a data collection and returns the resulting list of items.
1236
- *
1237
- *
1238
- * An aggregation enables you to perform certain calculations on your collection data, or on groups of items that you define, to retrieve meaningful summaries.
1239
- * You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
1240
- * @public
1241
- * @documentationMaturity preview
1242
- * @requiredField options.dataCollectionId
1243
- * @param options - Options for running an aggregation.
1244
- * @permissionScope Read Data Items
1245
- * @permissionScopeId SCOPE.DC-DATA.READ
1246
- * @applicableIdentity APP
1247
- */
1248
- export declare function aggregateDataItems(options?: AggregateDataItemsOptions): Promise<AggregateDataItemsResponse>;
1249
- export interface AggregateDataItemsOptions extends AggregateDataItemsRequestPagingMethodOneOf {
1250
- /** ID of the collection on which to run the aggregation. */
1251
- dataCollectionId: string;
1252
- /** 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. */
1253
- initialFilter?: Record<string, any> | null;
1254
- /** Aggregation applied to the data. */
1255
- aggregation?: Aggregation;
1256
- /** 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. */
1257
- finalFilter?: Record<string, any> | null;
1258
- /** Paging options to limit and skip the number of items. */
1259
- paging?: Paging;
1260
- /** 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`. */
1261
- cursorPaging?: CursorPaging;
1262
- /**
1263
- * Sort object in the following format:
1264
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1265
- */
1266
- sort?: Sorting[];
1267
- /**
1268
- * Whether to return the total count in the response for a query with offset paging.
1269
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1270
- *
1271
- * Default: `false`
1272
- */
1273
- returnTotalCount?: boolean;
1274
- /**
1275
- * Whether to retrieve data from the primary database instance.
1276
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1277
- *
1278
- * Default: `false`
1279
- */
1280
- consistentRead?: boolean;
1281
- /**
1282
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1283
- * If provided, the result text is returned in the specified language.
1284
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1285
- *
1286
- * If not provided, result text is not translated.
1287
- */
1288
- language?: string | null;
1289
- }
1290
- /**
1291
- * Counts the number of items in a data collection that match the provided filtering preferences.
1292
- *
1293
- * > **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`.
1294
- * @public
1295
- * @documentationMaturity preview
1296
- * @requiredField options.dataCollectionId
1297
- * @param options - Options for counting the number of items in a data collection.
1298
- * @permissionScope Read Data Items
1299
- * @permissionScopeId SCOPE.DC-DATA.READ
1300
- * @applicableIdentity APP
1301
- */
1302
- export declare function countDataItems(options?: CountDataItemsOptions): Promise<CountDataItemsResponse & CountDataItemsResponseNonNullableFields>;
1303
- export interface CountDataItemsOptions {
1304
- /** ID of the collection for which to count query results. */
1305
- dataCollectionId: string;
1306
- /**
1307
- * Filter object in the following format:
1308
- *
1309
- * `"filter" : {
1310
- * "fieldName1": "value1",
1311
- * "fieldName2":{"$operator":"value2"}
1312
- * }`.
1313
- *
1314
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
1315
- */
1316
- filter?: Record<string, any> | null;
1317
- /**
1318
- * Whether to retrieve data from the primary database instance.
1319
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1320
- *
1321
- * Default: `false`
1322
- */
1323
- consistentRead?: boolean;
1324
- /**
1325
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1326
- * If provided, the result text is returned in the specified language.
1327
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1328
- *
1329
- * If not provided, result text is not translated.
1330
- */
1331
- language?: string | null;
1332
- }
1333
- /**
1334
- * Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
1335
- *
1336
- *
1337
- * As with `queryDataItems()`, this endpoint retrieves items based on the filtering, sorting, and paging preferences you provide.
1338
- * However, `queryDistinctValues()` doesn't return all of the full items that match the query.
1339
- * Rather, it returns all unique values of the field you specify in `options.fieldName` for items that match the query.
1340
- * If more than one item has the same value for that field, that value appears only once.
1341
- *
1342
- * For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
1343
- *
1344
- * > **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`.
1345
- * @public
1346
- * @documentationMaturity preview
1347
- * @requiredField options.dataCollectionId
1348
- * @param options - Options for querying distinct values.
1349
- * @permissionScope Read Data Items
1350
- * @permissionScopeId SCOPE.DC-DATA.READ
1351
- * @applicableIdentity APP
1352
- */
1353
- export declare function queryDistinctValues(options?: QueryDistinctValuesOptions): Promise<QueryDistinctValuesResponse>;
1354
- export interface QueryDistinctValuesOptions extends QueryDistinctValuesRequestPagingMethodOneOf {
1355
- /** ID of the collection to query. */
1356
- dataCollectionId: string;
1357
- /** Item field name for which to return all distinct values. */
1358
- fieldName?: string;
1359
- /**
1360
- * Filter object in the following format:
1361
- *
1362
- * `"filter" : {
1363
- * "fieldName1": "value1",
1364
- * "fieldName2":{"$operator":"value2"}
1365
- * }`.
1366
- *
1367
- * Examples of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`.
1368
- */
1369
- filter?: Record<string, any> | null;
1370
- /**
1371
- * Sort order.
1372
- *
1373
- * Supported values: `ASC`, `DESC`.
1374
- */
1375
- order?: SortOrder;
1376
- /** Paging options to limit and skip the number of items. */
1377
- paging?: Paging;
1378
- /** 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`. */
1379
- cursorPaging?: CursorPaging;
1380
- /**
1381
- * Whether to return the total count in the response for a query with offset paging.
1382
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1383
- *
1384
- * Default: `false`
1385
- */
1386
- returnTotalCount?: boolean;
1387
- /**
1388
- * Whether to retrieve data from the primary database instance.
1389
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1390
- *
1391
- * Default: `false`
1392
- */
1393
- consistentRead?: boolean;
1394
- /**
1395
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1396
- * If provided, the result text is returned in the specified language.
1397
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1398
- *
1399
- * If not provided, result text is not translated.
1400
- */
1401
- language?: string | null;
1402
- }
1403
- /**
1404
- * Adds multiple items to a collection.
1405
- *
1406
- *
1407
- * When each item is inserted into a collection, its ID is automatically assigned a random value.
1408
- * 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.
1409
- * @public
1410
- * @documentationMaturity preview
1411
- * @requiredField options.dataCollectionId
1412
- * @requiredField options.dataItems
1413
- * @param options - Options for adding multiple items to a collection.
1414
- * @permissionScope Write Data Items
1415
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1416
- * @applicableIdentity APP
1417
- */
1418
- export declare function bulkInsertDataItems(options?: BulkInsertDataItemsOptions): Promise<BulkInsertDataItemsResponse & BulkInsertDataItemsResponseNonNullableFields>;
1419
- export interface BulkInsertDataItemsOptions {
1420
- /** ID of the collection in which to insert the items. */
1421
- dataCollectionId: string;
1422
- /** Data items to insert. */
1423
- dataItems: DataItem[];
1424
- /**
1425
- * Whether to return the inserted data items.
1426
- * When `true`, the `results` objects contain a `dataItem` field.
1427
- *
1428
- * Default: `false`
1429
- */
1430
- returnEntity?: boolean;
1431
- }
1432
- /**
1433
- * Updates multiple items in a collection.
1434
- *
1435
- *
1436
- * This function replaces each specified data item's existing data with the payload provided in the request.
1437
- *
1438
- * Each item in the request must include an ID. If an item is found in the specified collection with
1439
- * the same ID, that item is updated. If the collection doesn't contain an item with that ID, the update fails.
1440
- *
1441
- * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
1442
- *
1443
- * > **Note:**
1444
- * > 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
1445
- * > aren't included in the updated item, their values are lost.
1446
- * @public
1447
- * @documentationMaturity preview
1448
- * @requiredField options.dataCollectionId
1449
- * @requiredField options.dataItems
1450
- * @param options - Options for updating multiple items in a collection.
1451
- * @permissionScope Write Data Items
1452
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1453
- * @applicableIdentity APP
1454
- */
1455
- export declare function bulkUpdateDataItems(options?: BulkUpdateDataItemsOptions): Promise<BulkUpdateDataItemsResponse & BulkUpdateDataItemsResponseNonNullableFields>;
1456
- export interface BulkUpdateDataItemsOptions {
1457
- /** ID of the collection in which to update items. */
1458
- dataCollectionId: string;
1459
- /** Data items to update. */
1460
- dataItems: DataItem[];
1461
- /**
1462
- * Whether to return the updated data items.
1463
- * When `true`, the `results` objects contain a `dataItem` field.
1464
- *
1465
- * Default: `false`
1466
- */
1467
- returnEntity?: boolean;
1468
- }
1469
- /**
1470
- * Inserts or updates multiple items in a collection.
1471
- *
1472
- *
1473
- * This function inserts or updates each item provided, depending on whether it already exists in the collection. For each item:
1474
- *
1475
- * + If you don't provide an ID, a new item is created.
1476
- *
1477
- * + If you provide an ID that doesn't exist in the collection, a new item is created with that ID.
1478
- *
1479
- * + 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.
1480
- *
1481
- * > **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.
1482
- * > This means that all of the item's previous fields and values are lost.
1483
- * @public
1484
- * @documentationMaturity preview
1485
- * @requiredField options.dataCollectionId
1486
- * @requiredField options.dataItems
1487
- * @param options - Options for saving multiple items in a collection.
1488
- * @permissionScope Write Data Items
1489
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1490
- * @applicableIdentity APP
1491
- */
1492
- export declare function bulkSaveDataItems(options?: BulkSaveDataItemsOptions): Promise<BulkSaveDataItemsResponse & BulkSaveDataItemsResponseNonNullableFields>;
1493
- export interface BulkSaveDataItemsOptions {
1494
- /** ID of the collection in which to insert or update the items. */
1495
- dataCollectionId: string;
1496
- /** Data items to insert or update. */
1497
- dataItems: DataItem[];
1498
- /**
1499
- * Whether to return the saved data item.
1500
- * When `true`, the `results` objects contain a `dataItem` field.
1501
- *
1502
- * Default: `false`
1503
- */
1504
- returnEntity?: boolean;
1505
- }
1506
- /**
1507
- * Removes multiple items from a collection.
1508
- *
1509
- *
1510
- * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
1511
- *
1512
- * > **Note:** Once an item has been removed from a collection, it can't be restored.
1513
- * @public
1514
- * @documentationMaturity preview
1515
- * @requiredField options
1516
- * @requiredField options.dataCollectionId
1517
- * @requiredField options.dataItemIds
1518
- * @param options - Options for removing multiple items from a collection.
1519
- * @permissionScope Write Data Items
1520
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1521
- * @applicableIdentity APP
1522
- */
1523
- export declare function bulkRemoveDataItems(options: BulkRemoveDataItemsOptions): Promise<BulkRemoveDataItemsResponse & BulkRemoveDataItemsResponseNonNullableFields>;
1524
- export interface BulkRemoveDataItemsOptions {
1525
- /** ID of the collection from which to remove the item. */
1526
- dataCollectionId: string;
1527
- /** IDs of data items to remove. */
1528
- dataItemIds: string[];
1529
- }
1530
- /**
1531
- * Retrieves the full items referenced in the specified field of an item.
1532
- *
1533
- *
1534
- * Reference and multi-reference fields refer to items in different collections.
1535
- * Use this function to retrieve the full details of the referenced items themselves.
1536
- *
1537
- * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection.
1538
- * Querying the **Movies** collection using `queryReferencedDataItems()` returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
1539
- * This gives you information from the **People** collection about each of the actors in the specified movie.
1540
- *
1541
- * > **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`.
1542
- * @public
1543
- * @documentationMaturity preview
1544
- * @requiredField options.dataCollectionId
1545
- * @param options - Options for querying referenced data items.
1546
- * @permissionScope Read Data Items
1547
- * @permissionScopeId SCOPE.DC-DATA.READ
1548
- * @applicableIdentity APP
1549
- */
1550
- export declare function queryReferencedDataItems(options?: QueryReferencedDataItemsOptions): Promise<QueryReferencedDataItemsResponse & QueryReferencedDataItemsResponseNonNullableFields>;
1551
- export interface QueryReferencedDataItemsOptions extends QueryReferencedDataItemsRequestPagingMethodOneOf {
1552
- /** ID of the collection containing the referring item. */
1553
- dataCollectionId: string;
1554
- /** ID of the referring item. */
1555
- referringItemId?: string;
1556
- /** Field containing references in the referring item. */
1557
- referringItemFieldName?: string;
1558
- /** Order of the returned referenced items. Sorted by the date each item was referenced. */
1559
- order?: SortOrder;
1560
- /** Paging options to limit and skip the number of items. */
1561
- paging?: Paging;
1562
- /** 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`. */
1563
- cursorPaging?: CursorPaging;
1564
- /**
1565
- * Whether to return the total count in the response.
1566
- * When `true`, the `pagingMetadata` object in the response contains a `total` field.
1567
- *
1568
- * Default: `false`
1569
- */
1570
- returnTotalCount?: boolean;
1571
- /**
1572
- * Whether to retrieve data from the primary database instance.
1573
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1574
- *
1575
- * Default: `false`
1576
- */
1577
- consistentRead?: boolean;
1578
- /**
1579
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
1580
- * If provided, the result text is returned in the specified language.
1581
- * **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
1582
- *
1583
- * If not provided, result text is not translated.
1584
- */
1585
- language?: string | null;
1586
- }
1587
- /**
1588
- * Checks whether a field in a referring item contains a reference to a specified item.
1589
- *
1590
- * > **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`.
1591
- * @public
1592
- * @documentationMaturity preview
1593
- * @requiredField options.dataCollectionId
1594
- * @requiredField options.referencedItemId
1595
- * @requiredField options.referringItemFieldName
1596
- * @requiredField options.referringItemId
1597
- * @param options - Options for checking whether a field contains a reference to an item.
1598
- * @permissionScope Read Data Items
1599
- * @permissionScopeId SCOPE.DC-DATA.READ
1600
- * @applicableIdentity APP
1601
- */
1602
- export declare function isReferencedDataItem(options?: IsReferencedDataItemOptions): Promise<IsReferencedDataItemResponse & IsReferencedDataItemResponseNonNullableFields>;
1603
- export interface IsReferencedDataItemOptions {
1604
- /** ID of the collection containing the referring data item. */
1605
- dataCollectionId: string;
1606
- /** Field to check for a reference to the item that may be referenced. */
1607
- referringItemFieldName: string;
1608
- /** ID of the referring item. */
1609
- referringItemId: string;
1610
- /** ID of the item that may be referenced. */
1611
- referencedItemId: string;
1612
- /**
1613
- * Whether to retrieve data from the primary database instance.
1614
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1615
- *
1616
- * Default: `false`
1617
- */
1618
- consistentRead?: boolean;
1619
- }
1620
- /**
1621
- * Inserts a reference in the specified field in an item in a collection.
1622
- *
1623
- *
1624
- * 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.
1625
- * @public
1626
- * @documentationMaturity preview
1627
- * @requiredField options.dataCollectionId
1628
- * @requiredField options.dataItemReference.referencedItemId
1629
- * @requiredField options.dataItemReference.referringItemFieldName
1630
- * @requiredField options.dataItemReference.referringItemId
1631
- * @param options - Options for inserting a reference.
1632
- * @permissionScope Write Data Items
1633
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1634
- * @applicableIdentity APP
1635
- */
1636
- export declare function insertDataItemReference(options?: InsertDataItemReferenceOptions): Promise<InsertDataItemReferenceResponse & InsertDataItemReferenceResponseNonNullableFields>;
1637
- export interface InsertDataItemReferenceOptions {
1638
- /** ID of the collection in which to insert the reference. */
1639
- dataCollectionId: string;
1640
- /** Reference to insert */
1641
- dataItemReference?: DataItemReference;
1642
- }
1643
- /**
1644
- * Removes the specified reference from the specified field.
1645
- * @public
1646
- * @documentationMaturity preview
1647
- * @requiredField options
1648
- * @requiredField options.dataCollectionId
1649
- * @requiredField options.dataItemReference
1650
- * @requiredField options.dataItemReference.referencedItemId
1651
- * @requiredField options.dataItemReference.referringItemFieldName
1652
- * @requiredField options.dataItemReference.referringItemId
1653
- * @param options - Options for removing a reference.
1654
- * @permissionScope Write Data Items
1655
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1656
- * @applicableIdentity APP
1657
- */
1658
- export declare function removeDataItemReference(options: RemoveDataItemReferenceOptions): Promise<RemoveDataItemReferenceResponse & RemoveDataItemReferenceResponseNonNullableFields>;
1659
- export interface RemoveDataItemReferenceOptions {
1660
- /** ID of the collection containing the referring item. */
1661
- dataCollectionId: string;
1662
- /** Reference to remove. */
1663
- dataItemReference: DataItemReference;
1664
- }
1665
- /**
1666
- * Inserts one or more references in the specified fields of items in a collection.
1667
- *
1668
- *
1669
- * This endpoint adds one or more references to a collection.
1670
- * 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.
1671
- * @public
1672
- * @documentationMaturity preview
1673
- * @requiredField options.dataCollectionId
1674
- * @requiredField options.dataItemReferences
1675
- * @requiredField options.dataItemReferences.referencedItemId
1676
- * @requiredField options.dataItemReferences.referringItemFieldName
1677
- * @requiredField options.dataItemReferences.referringItemId
1678
- * @param options - Options for inserting one or more references.
1679
- * @permissionScope Write Data Items
1680
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1681
- * @applicableIdentity APP
1682
- */
1683
- export declare function bulkInsertDataItemReferences(options?: BulkInsertDataItemReferencesOptions): Promise<BulkInsertDataItemReferencesResponse & BulkInsertDataItemReferencesResponseNonNullableFields>;
1684
- export interface BulkInsertDataItemReferencesOptions {
1685
- /** ID of the collection containing the referring items. */
1686
- dataCollectionId: string;
1687
- /** References to insert. */
1688
- dataItemReferences: DataItemReference[];
1689
- /**
1690
- * Whether to return the inserted data item references.
1691
- * When `true`, the `results` objects contain a `dataItemReference` field.
1692
- *
1693
- * Default: `false`
1694
- */
1695
- returnEntity?: boolean;
1696
- }
1697
- /**
1698
- * Removes one or more references.
1699
- * @public
1700
- * @documentationMaturity preview
1701
- * @requiredField options
1702
- * @requiredField options.dataCollectionId
1703
- * @requiredField options.dataItemReferences
1704
- * @requiredField options.dataItemReferences.referencedItemId
1705
- * @requiredField options.dataItemReferences.referringItemFieldName
1706
- * @requiredField options.dataItemReferences.referringItemId
1707
- * @param options - Options for removing one or more references.
1708
- * @permissionScope Write Data Items
1709
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1710
- * @applicableIdentity APP
1711
- */
1712
- export declare function bulkRemoveDataItemReferences(options: BulkRemoveDataItemReferencesOptions): Promise<BulkRemoveDataItemReferencesResponse & BulkRemoveDataItemReferencesResponseNonNullableFields>;
1713
- export interface BulkRemoveDataItemReferencesOptions {
1714
- /** ID of the collection containing the referring items. */
1715
- dataCollectionId: string;
1716
- /** References to remove. */
1717
- dataItemReferences: DataItemReference[];
1718
- }
1719
- /**
1720
- * Replaces references in a specified field of a specified data item.
1721
- *
1722
- *
1723
- * This function replaces the existing reference or references contained in the field specified in `options.referringItemFieldName` within the data item specified in `options.referringItemId`.
1724
- * The function removes existing references and in their place it adds references to the items specified in `options.newReferencedItemIds`.
1725
- *
1726
- * > **Note:** If you pass an empty array in `options.newReferencedItemIds`, all existing references are removed.
1727
- * @public
1728
- * @documentationMaturity preview
1729
- * @requiredField options.dataCollectionId
1730
- * @requiredField options.referringItemFieldName
1731
- * @requiredField options.referringItemId
1732
- * @param options - Options for replacing references.
1733
- * @permissionScope Write Data Items
1734
- * @permissionScopeId SCOPE.DC-DATA.WRITE
1735
- * @applicableIdentity APP
1736
- */
1737
- export declare function replaceDataItemReferences(options?: ReplaceDataItemReferencesOptions): Promise<ReplaceDataItemReferencesResponse & ReplaceDataItemReferencesResponseNonNullableFields>;
1738
- export interface ReplaceDataItemReferencesOptions {
1739
- /** ID of the collection containing the referring item. */
1740
- dataCollectionId: string;
1741
- /** Field containing references in the referring item. */
1742
- referringItemFieldName: string;
1743
- /** ID of the referring item. */
1744
- referringItemId: string;
1745
- /** List of new referenced item IDs to replace the existing ones. */
1746
- newReferencedItemIds?: string[];
1747
- }
1748
- export {};