@wix/data 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/build/cjs/index.d.ts +4 -0
  2. package/build/cjs/index.js +27 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/data-v1-external-database-connection.http.d.ts +29 -0
  5. package/build/cjs/src/data-v1-external-database-connection.http.js +397 -0
  6. package/build/cjs/src/data-v1-external-database-connection.http.js.map +1 -0
  7. package/build/cjs/src/data-v1-external-database-connection.public.d.ts +11 -0
  8. package/build/cjs/src/data-v1-external-database-connection.public.js +36 -0
  9. package/build/cjs/src/data-v1-external-database-connection.public.js.map +1 -0
  10. package/build/cjs/src/data-v1-external-database-connection.types.d.ts +53 -0
  11. package/build/cjs/src/data-v1-external-database-connection.types.js +3 -0
  12. package/build/cjs/src/data-v1-external-database-connection.types.js.map +1 -0
  13. package/build/cjs/src/data-v1-external-database-connection.universal.d.ts +129 -0
  14. package/build/cjs/src/data-v1-external-database-connection.universal.js +334 -0
  15. package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -0
  16. package/build/cjs/src/data-v2-data-collection.http.d.ts +37 -0
  17. package/build/cjs/src/data-v2-data-collection.http.js +458 -0
  18. package/build/cjs/src/data-v2-data-collection.http.js.map +1 -0
  19. package/build/cjs/src/data-v2-data-collection.public.d.ts +12 -0
  20. package/build/cjs/src/data-v2-data-collection.public.js +48 -0
  21. package/build/cjs/src/data-v2-data-collection.public.js.map +1 -0
  22. package/build/cjs/src/data-v2-data-collection.types.d.ts +638 -0
  23. package/build/cjs/src/data-v2-data-collection.types.js +143 -0
  24. package/build/cjs/src/data-v2-data-collection.types.js.map +1 -0
  25. package/build/cjs/src/data-v2-data-collection.universal.d.ts +732 -0
  26. package/build/cjs/src/data-v2-data-collection.universal.js +532 -0
  27. package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -0
  28. package/build/cjs/src/data-v2-data-item.http.d.ts +192 -0
  29. package/build/cjs/src/data-v2-data-item.http.js +944 -0
  30. package/build/cjs/src/data-v2-data-item.http.js.map +1 -0
  31. package/build/cjs/src/data-v2-data-item.public.d.ts +28 -0
  32. package/build/cjs/src/data-v2-data-item.public.js +137 -0
  33. package/build/cjs/src/data-v2-data-item.public.js.map +1 -0
  34. package/build/cjs/src/data-v2-data-item.types.d.ts +656 -0
  35. package/build/cjs/src/data-v2-data-item.types.js +27 -0
  36. package/build/cjs/src/data-v2-data-item.types.js.map +1 -0
  37. package/build/cjs/src/data-v2-data-item.universal.d.ts +1343 -0
  38. package/build/cjs/src/data-v2-data-item.universal.js +1435 -0
  39. package/build/cjs/src/data-v2-data-item.universal.js.map +1 -0
  40. package/build/cjs/src/data-v2-index.http.d.ts +29 -0
  41. package/build/cjs/src/data-v2-index.http.js +349 -0
  42. package/build/cjs/src/data-v2-index.http.js.map +1 -0
  43. package/build/cjs/src/data-v2-index.public.d.ts +10 -0
  44. package/build/cjs/src/data-v2-index.public.js +28 -0
  45. package/build/cjs/src/data-v2-index.public.js.map +1 -0
  46. package/build/cjs/src/data-v2-index.types.d.ts +120 -0
  47. package/build/cjs/src/data-v2-index.types.js +35 -0
  48. package/build/cjs/src/data-v2-index.types.js.map +1 -0
  49. package/build/cjs/src/data-v2-index.universal.d.ts +182 -0
  50. package/build/cjs/src/data-v2-index.universal.js +261 -0
  51. package/build/cjs/src/data-v2-index.universal.js.map +1 -0
  52. package/build/es/index.d.ts +4 -0
  53. package/build/es/index.js +5 -0
  54. package/build/es/index.js.map +1 -0
  55. package/build/es/src/data-v1-external-database-connection.http.d.ts +29 -0
  56. package/build/es/src/data-v1-external-database-connection.http.js +389 -0
  57. package/build/es/src/data-v1-external-database-connection.http.js.map +1 -0
  58. package/build/es/src/data-v1-external-database-connection.public.d.ts +11 -0
  59. package/build/es/src/data-v1-external-database-connection.public.js +28 -0
  60. package/build/es/src/data-v1-external-database-connection.public.js.map +1 -0
  61. package/build/es/src/data-v1-external-database-connection.types.d.ts +53 -0
  62. package/build/es/src/data-v1-external-database-connection.types.js +2 -0
  63. package/build/es/src/data-v1-external-database-connection.types.js.map +1 -0
  64. package/build/es/src/data-v1-external-database-connection.universal.d.ts +129 -0
  65. package/build/es/src/data-v1-external-database-connection.universal.js +307 -0
  66. package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -0
  67. package/build/es/src/data-v2-data-collection.http.d.ts +37 -0
  68. package/build/es/src/data-v2-data-collection.http.js +450 -0
  69. package/build/es/src/data-v2-data-collection.http.js.map +1 -0
  70. package/build/es/src/data-v2-data-collection.public.d.ts +12 -0
  71. package/build/es/src/data-v2-data-collection.public.js +29 -0
  72. package/build/es/src/data-v2-data-collection.public.js.map +1 -0
  73. package/build/es/src/data-v2-data-collection.types.d.ts +638 -0
  74. package/build/es/src/data-v2-data-collection.types.js +140 -0
  75. package/build/es/src/data-v2-data-collection.types.js.map +1 -0
  76. package/build/es/src/data-v2-data-collection.universal.d.ts +732 -0
  77. package/build/es/src/data-v2-data-collection.universal.js +505 -0
  78. package/build/es/src/data-v2-data-collection.universal.js.map +1 -0
  79. package/build/es/src/data-v2-data-item.http.d.ts +192 -0
  80. package/build/es/src/data-v2-data-item.http.js +920 -0
  81. package/build/es/src/data-v2-data-item.http.js.map +1 -0
  82. package/build/es/src/data-v2-data-item.public.d.ts +28 -0
  83. package/build/es/src/data-v2-data-item.public.js +109 -0
  84. package/build/es/src/data-v2-data-item.public.js.map +1 -0
  85. package/build/es/src/data-v2-data-item.types.d.ts +656 -0
  86. package/build/es/src/data-v2-data-item.types.js +24 -0
  87. package/build/es/src/data-v2-data-item.types.js.map +1 -0
  88. package/build/es/src/data-v2-data-item.universal.d.ts +1343 -0
  89. package/build/es/src/data-v2-data-item.universal.js +1392 -0
  90. package/build/es/src/data-v2-data-item.universal.js.map +1 -0
  91. package/build/es/src/data-v2-index.http.d.ts +29 -0
  92. package/build/es/src/data-v2-index.http.js +343 -0
  93. package/build/es/src/data-v2-index.http.js.map +1 -0
  94. package/build/es/src/data-v2-index.public.d.ts +10 -0
  95. package/build/es/src/data-v2-index.public.js +19 -0
  96. package/build/es/src/data-v2-index.public.js.map +1 -0
  97. package/build/es/src/data-v2-index.types.d.ts +120 -0
  98. package/build/es/src/data-v2-index.types.js +32 -0
  99. package/build/es/src/data-v2-index.types.js.map +1 -0
  100. package/build/es/src/data-v2-index.universal.d.ts +182 -0
  101. package/build/es/src/data-v2-index.universal.js +236 -0
  102. package/build/es/src/data-v2-index.universal.js.map +1 -0
  103. package/package.json +37 -0
@@ -0,0 +1,1392 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo';
11
+ import * as ambassadorWixDataV2DataItem from './data-v2-data-item.http';
12
+ // @ts-ignore
13
+ import { wrapWithQueryBuilder } from '@wix/motion-edm-autogen-query-wrapper';
14
+ let __verbose = false;
15
+ function __log(...args) {
16
+ __verbose && console.log(...args);
17
+ }
18
+ function __inspect(obj) {
19
+ return obj;
20
+ }
21
+ export const __debug = {
22
+ verboseLogging: {
23
+ on: () => (__verbose = true),
24
+ off: () => (__verbose = false),
25
+ },
26
+ };
27
+ const _toVeloEntity = '$';
28
+ const _fromVeloEntity = '$';
29
+ export var Environment;
30
+ (function (Environment) {
31
+ Environment["LIVE"] = "LIVE";
32
+ Environment["SANDBOX"] = "SANDBOX";
33
+ })(Environment || (Environment = {}));
34
+ export var Action;
35
+ (function (Action) {
36
+ Action["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
37
+ Action["INSERTED"] = "INSERTED";
38
+ Action["UPDATED"] = "UPDATED";
39
+ })(Action || (Action = {}));
40
+ export var SortOrder;
41
+ (function (SortOrder) {
42
+ SortOrder["ASC"] = "ASC";
43
+ SortOrder["DESC"] = "DESC";
44
+ })(SortOrder || (SortOrder = {}));
45
+ export var BulkActionType;
46
+ (function (BulkActionType) {
47
+ BulkActionType["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
48
+ BulkActionType["INSERT"] = "INSERT";
49
+ BulkActionType["UPDATE"] = "UPDATE";
50
+ BulkActionType["DELETE"] = "DELETE";
51
+ })(BulkActionType || (BulkActionType = {}));
52
+ const _aggregateDataItemsRequest = {};
53
+ const _aggregateDataItemsResponse = {};
54
+ const _bulkInsertDataItemReferencesRequest = {};
55
+ const _bulkInsertDataItemReferencesResponse = {};
56
+ const _bulkInsertDataItemsRequest = {};
57
+ const _bulkInsertDataItemsResponse = {};
58
+ const _bulkRemoveDataItemReferencesRequest = {};
59
+ const _bulkRemoveDataItemReferencesResponse = {};
60
+ const _bulkRemoveDataItemsRequest = {};
61
+ const _bulkRemoveDataItemsResponse = {};
62
+ const _bulkSaveDataItemsRequest = {};
63
+ const _bulkSaveDataItemsResponse = {};
64
+ const _bulkUpdateDataItemsRequest = {};
65
+ const _bulkUpdateDataItemsResponse = {};
66
+ const _countDataItemsRequest = {};
67
+ const _countDataItemsResponse = {};
68
+ const _getDataItemRequest = {};
69
+ const _getDataItemResponse = {};
70
+ const _insertDataItemReferenceRequest = {};
71
+ const _insertDataItemReferenceResponse = {};
72
+ const _insertDataItemRequest = {};
73
+ const _insertDataItemResponse = {};
74
+ const _isReferencedDataItemRequest = {};
75
+ const _isReferencedDataItemResponse = {};
76
+ const _queryDataItemsRequest = {};
77
+ const _queryDataItemsResponse = {};
78
+ const _queryDistinctValuesRequest = {};
79
+ const _queryDistinctValuesResponse = {};
80
+ const _queryReferencedDataItemsRequest = {};
81
+ const _queryReferencedDataItemsResponse = {};
82
+ const _removeDataItemReferenceRequest = {};
83
+ const _removeDataItemReferenceResponse = {};
84
+ const _removeDataItemRequest = {};
85
+ const _removeDataItemResponse = {};
86
+ const _replaceDataItemReferencesRequest = {};
87
+ const _replaceDataItemReferencesResponse = {};
88
+ const _saveDataItemRequest = {};
89
+ const _saveDataItemResponse = {};
90
+ const _truncateDataItemsRequest = {};
91
+ const _truncateDataItemsResponse = {};
92
+ const _updateDataItemRequest = {};
93
+ const _updateDataItemResponse = {};
94
+ /**
95
+ * Adds an item to a collection.
96
+ *
97
+ *
98
+ * An item can only be inserted into an existing connection.
99
+ * You can create a new collection using the [Data Collections API](https://dev.wix.com/api/rest/wix-data/wix-data/data-collections).
100
+ *
101
+ * When an item is inserted into a collection, the item's ID is automatically assigned a random value.
102
+ * You can optionally provide a custom ID in `dataItem.id` when inserting the item.
103
+ * If you specify an ID that already exists in the collection, the insertion will fail.
104
+ *
105
+ * If `dataItem.data` is empty, a new item is created with no data fields.
106
+ * @public
107
+ * @documentationMaturity preview
108
+ * @requiredField options
109
+ * @requiredField options.dataCollectionId
110
+ * @requiredField options.dataItem
111
+ */
112
+ export function insertDataItem(options) {
113
+ var _a, _b, _c;
114
+ return __awaiter(this, arguments, void 0, function* () {
115
+ const requestTransformation = {
116
+ dataCollectionId: '$[0].dataCollectionId',
117
+ dataItem: '$[0].dataItem',
118
+ };
119
+ const responseTransformation = '$';
120
+ // @ts-ignore
121
+ const { httpClient, sideEffects } = arguments[1];
122
+ const { toAmbassadorRequest } = serializer({
123
+ rootSchema: _insertDataItemRequest,
124
+ depSchemas: {},
125
+ fqdnTransformation: {
126
+ paths: [...['dataItem']],
127
+ transformation: _fromVeloEntity,
128
+ },
129
+ customTransformation: requestTransformation,
130
+ });
131
+ const { fromJSON } = serializer({
132
+ rootSchema: _insertDataItemResponse,
133
+ depSchemas: {},
134
+ fqdnTransformation: {
135
+ paths: [...['dataItem']],
136
+ transformation: _toVeloEntity,
137
+ },
138
+ customTransformation: responseTransformation,
139
+ });
140
+ const payload = toAmbassadorRequest([options]);
141
+ const reqOpts = ambassadorWixDataV2DataItem.insertDataItem(payload);
142
+ __log(`"InsertDataItem" sending request with: ${__inspect(reqOpts)}`);
143
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
144
+ try {
145
+ const result = yield httpClient.request(reqOpts);
146
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
147
+ return fromJSON(result.data);
148
+ }
149
+ catch (err) {
150
+ const transformedError = transformError(err, requestTransformation, [
151
+ 'options',
152
+ ]);
153
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
154
+ throw transformedError;
155
+ }
156
+ });
157
+ }
158
+ /**
159
+ * Updates an item in a collection.
160
+ *
161
+ *
162
+ * This endpoint replaces the data item's existing data with the payload provided in `dataItem.data` in the request.
163
+ *
164
+ * To update an item, you need to specify an item ID and a collection ID.
165
+ * If an item is found in the specified collection with the specified ID, that item is updated.
166
+ * If the collection doesn't contain an item with that ID, the request fails.
167
+ *
168
+ * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
169
+ *
170
+ * > **Note:**
171
+ * > After an item is updated, it only contains the fields included in the `dataItem.data` payload in Update Data Item request.
172
+ * > If the existing item has fields with values and those fields aren't included in the updated item, their values are lost.
173
+ * @param _id - Data item ID.
174
+ * @public
175
+ * @documentationMaturity preview
176
+ * @requiredField _id
177
+ * @requiredField options
178
+ * @requiredField options.dataCollectionId
179
+ * @requiredField options.dataItem
180
+ */
181
+ export function updateDataItem(_id, options) {
182
+ var _a, _b, _c;
183
+ return __awaiter(this, arguments, void 0, function* () {
184
+ const requestTransformation = {
185
+ dataItem: { '*': '$[1].dataItem', id: '$[0]' },
186
+ dataCollectionId: '$[1].dataCollectionId',
187
+ };
188
+ const responseTransformation = '$';
189
+ // @ts-ignore
190
+ const { httpClient, sideEffects } = arguments[2];
191
+ const { toAmbassadorRequest } = serializer({
192
+ rootSchema: _updateDataItemRequest,
193
+ depSchemas: {},
194
+ fqdnTransformation: {
195
+ paths: [...['dataItem']],
196
+ transformation: _fromVeloEntity,
197
+ },
198
+ customTransformation: requestTransformation,
199
+ });
200
+ const { fromJSON } = serializer({
201
+ rootSchema: _updateDataItemResponse,
202
+ depSchemas: {},
203
+ fqdnTransformation: {
204
+ paths: [...['dataItem']],
205
+ transformation: _toVeloEntity,
206
+ },
207
+ customTransformation: responseTransformation,
208
+ });
209
+ const payload = toAmbassadorRequest([_id, options]);
210
+ const reqOpts = ambassadorWixDataV2DataItem.updateDataItem(payload);
211
+ __log(`"UpdateDataItem" sending request with: ${__inspect(reqOpts)}`);
212
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
213
+ try {
214
+ const result = yield httpClient.request(reqOpts);
215
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
216
+ return fromJSON(result.data);
217
+ }
218
+ catch (err) {
219
+ const transformedError = transformError(err, requestTransformation, [
220
+ '_id',
221
+ 'options',
222
+ ]);
223
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
224
+ throw transformedError;
225
+ }
226
+ });
227
+ }
228
+ /**
229
+ * Inserts or updates an item in a collection.
230
+ *
231
+ *
232
+ * The Save Data Item endpoint inserts or updates the specified item, depending on whether it already exists in the collection.
233
+ *
234
+ * + If you don't provide an ID, a new item is created.
235
+ *
236
+ * + If you provide an ID that does not exist in the collection, a new item is created with that ID.
237
+ *
238
+ * + 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.
239
+ *
240
+ * > **Note:** When you provide an item with an ID that already exists in the collection, the payload you provide in `dataItem.data` replaces the existing item with that ID.
241
+ * > This means that the item's previous fields and values are lost.
242
+ * @public
243
+ * @documentationMaturity preview
244
+ * @requiredField options
245
+ * @requiredField options.dataCollectionId
246
+ * @requiredField options.dataItem
247
+ */
248
+ export function saveDataItem(options) {
249
+ var _a, _b, _c;
250
+ return __awaiter(this, arguments, void 0, function* () {
251
+ const requestTransformation = {
252
+ dataCollectionId: '$[0].dataCollectionId',
253
+ dataItem: '$[0].dataItem',
254
+ };
255
+ const responseTransformation = '$';
256
+ // @ts-ignore
257
+ const { httpClient, sideEffects } = arguments[1];
258
+ const { toAmbassadorRequest } = serializer({
259
+ rootSchema: _saveDataItemRequest,
260
+ depSchemas: {},
261
+ fqdnTransformation: {
262
+ paths: [...['dataItem']],
263
+ transformation: _fromVeloEntity,
264
+ },
265
+ customTransformation: requestTransformation,
266
+ });
267
+ const { fromJSON } = serializer({
268
+ rootSchema: _saveDataItemResponse,
269
+ depSchemas: {},
270
+ fqdnTransformation: {
271
+ paths: [...['dataItem']],
272
+ transformation: _toVeloEntity,
273
+ },
274
+ customTransformation: responseTransformation,
275
+ });
276
+ const payload = toAmbassadorRequest([options]);
277
+ const reqOpts = ambassadorWixDataV2DataItem.saveDataItem(payload);
278
+ __log(`"SaveDataItem" sending request with: ${__inspect(reqOpts)}`);
279
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
280
+ try {
281
+ const result = yield httpClient.request(reqOpts);
282
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
283
+ return fromJSON(result.data);
284
+ }
285
+ catch (err) {
286
+ const transformedError = transformError(err, requestTransformation, [
287
+ 'options',
288
+ ]);
289
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
290
+ throw transformedError;
291
+ }
292
+ });
293
+ }
294
+ /**
295
+ * Retrieves an item from a collection.
296
+ * @param dataItemId - ID of the data item to retrieve.
297
+ * @public
298
+ * @documentationMaturity preview
299
+ * @requiredField dataItemId
300
+ * @requiredField options
301
+ * @requiredField options.dataCollectionId
302
+ * @returns Retrieved item.
303
+ */
304
+ export function getDataItem(dataItemId, options) {
305
+ var _a, _b, _c;
306
+ return __awaiter(this, arguments, void 0, function* () {
307
+ const requestTransformation = {
308
+ dataItemId: '$[0]',
309
+ dataCollectionId: '$[1].dataCollectionId',
310
+ consistentRead: '$[1].consistentRead',
311
+ };
312
+ const responseTransformation = '$.dataItem';
313
+ // @ts-ignore
314
+ const { httpClient, sideEffects } = arguments[2];
315
+ const { toAmbassadorRequest } = serializer({
316
+ rootSchema: _getDataItemRequest,
317
+ depSchemas: {},
318
+ fqdnTransformation: {
319
+ paths: [],
320
+ transformation: _fromVeloEntity,
321
+ },
322
+ customTransformation: requestTransformation,
323
+ });
324
+ const { fromJSON } = serializer({
325
+ rootSchema: _getDataItemResponse,
326
+ depSchemas: {},
327
+ fqdnTransformation: {
328
+ paths: [...['dataItem']],
329
+ transformation: _toVeloEntity,
330
+ },
331
+ customTransformation: responseTransformation,
332
+ });
333
+ const payload = toAmbassadorRequest([dataItemId, options]);
334
+ const reqOpts = ambassadorWixDataV2DataItem.getDataItem(payload);
335
+ __log(`"GetDataItem" sending request with: ${__inspect(reqOpts)}`);
336
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
337
+ try {
338
+ const result = yield httpClient.request(reqOpts);
339
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
340
+ return fromJSON(result.data);
341
+ }
342
+ catch (err) {
343
+ const transformedError = transformError(err, requestTransformation, [
344
+ 'dataItemId',
345
+ 'options',
346
+ ]);
347
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
348
+ throw transformedError;
349
+ }
350
+ });
351
+ }
352
+ /**
353
+ * Removes an item from a collection.
354
+ *
355
+ *
356
+ * If any items in other collections reference the removed item in reference or multi-reference fields, those fields are cleared.
357
+ *
358
+ * > **Note:**
359
+ * > Once an item has been removed from a collection, it can't be restored.
360
+ * @param dataItemId - ID of the item to remove.
361
+ * @public
362
+ * @documentationMaturity preview
363
+ * @requiredField dataItemId
364
+ * @requiredField options
365
+ * @requiredField options.dataCollectionId
366
+ */
367
+ export function removeDataItem(dataItemId, options) {
368
+ var _a, _b, _c;
369
+ return __awaiter(this, arguments, void 0, function* () {
370
+ const requestTransformation = {
371
+ dataItemId: '$[0]',
372
+ dataCollectionId: '$[1].dataCollectionId',
373
+ };
374
+ const responseTransformation = '$';
375
+ // @ts-ignore
376
+ const { httpClient, sideEffects } = arguments[2];
377
+ const { toAmbassadorRequest } = serializer({
378
+ rootSchema: _removeDataItemRequest,
379
+ depSchemas: {},
380
+ fqdnTransformation: {
381
+ paths: [],
382
+ transformation: _fromVeloEntity,
383
+ },
384
+ customTransformation: requestTransformation,
385
+ });
386
+ const { fromJSON } = serializer({
387
+ rootSchema: _removeDataItemResponse,
388
+ depSchemas: {},
389
+ fqdnTransformation: {
390
+ paths: [...['dataItem']],
391
+ transformation: _toVeloEntity,
392
+ },
393
+ customTransformation: responseTransformation,
394
+ });
395
+ const payload = toAmbassadorRequest([dataItemId, options]);
396
+ const reqOpts = ambassadorWixDataV2DataItem.removeDataItem(payload);
397
+ __log(`"RemoveDataItem" sending request with: ${__inspect(reqOpts)}`);
398
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
399
+ try {
400
+ const result = yield httpClient.request(reqOpts);
401
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
402
+ return fromJSON(result.data);
403
+ }
404
+ catch (err) {
405
+ const transformedError = transformError(err, requestTransformation, [
406
+ 'dataItemId',
407
+ 'options',
408
+ ]);
409
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
410
+ throw transformedError;
411
+ }
412
+ });
413
+ }
414
+ /**
415
+ * Removes all items from a collection.
416
+ *
417
+ *
418
+ * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
419
+ *
420
+ * > **Note:**
421
+ * > Once items have been removed from a collection, they can't be restored.
422
+ * @public
423
+ * @documentationMaturity preview
424
+ * @requiredField options
425
+ * @requiredField options.dataCollectionId
426
+ */
427
+ export function truncateDataItems(options) {
428
+ var _a, _b, _c;
429
+ return __awaiter(this, arguments, void 0, function* () {
430
+ const requestTransformation = { dataCollectionId: '$[0].dataCollectionId' };
431
+ const responseTransformation = '$';
432
+ // @ts-ignore
433
+ const { httpClient, sideEffects } = arguments[1];
434
+ const { toAmbassadorRequest } = serializer({
435
+ rootSchema: _truncateDataItemsRequest,
436
+ depSchemas: {},
437
+ fqdnTransformation: {
438
+ paths: [],
439
+ transformation: _fromVeloEntity,
440
+ },
441
+ customTransformation: requestTransformation,
442
+ });
443
+ const { fromJSON } = serializer({
444
+ rootSchema: _truncateDataItemsResponse,
445
+ depSchemas: {},
446
+ fqdnTransformation: {
447
+ paths: [],
448
+ transformation: _toVeloEntity,
449
+ },
450
+ customTransformation: responseTransformation,
451
+ });
452
+ const payload = toAmbassadorRequest([options]);
453
+ const reqOpts = ambassadorWixDataV2DataItem.truncateDataItems(payload);
454
+ __log(`"TruncateDataItems" sending request with: ${__inspect(reqOpts)}`);
455
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
456
+ try {
457
+ const result = yield httpClient.request(reqOpts);
458
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
459
+ return fromJSON(result.data);
460
+ }
461
+ catch (err) {
462
+ const transformedError = transformError(err, requestTransformation, [
463
+ 'options',
464
+ ]);
465
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
466
+ throw transformedError;
467
+ }
468
+ });
469
+ }
470
+ /**
471
+ * Retrieves a list of items, on the basis of the filtering, sorting, and paging preferences you provide.
472
+ *
473
+ *
474
+ * For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
475
+ * @public
476
+ * @documentationMaturity preview
477
+ * @requiredField options.options
478
+ * @requiredField options.options.dataCollectionId
479
+ */
480
+ export function queryDataItems(options) {
481
+ const requestTransformation = { '*': '$[1]', query: '$[0]' };
482
+ const responseTransformation = {
483
+ items: '$.dataItems',
484
+ pagingMetadata: '$.pagingMetadata',
485
+ };
486
+ // @ts-ignore
487
+ const { httpClient, sideEffects } = arguments[1];
488
+ const { toAmbassadorRequest } = serializer({
489
+ rootSchema: _queryDataItemsRequest,
490
+ depSchemas: {},
491
+ fqdnTransformation: {
492
+ paths: [],
493
+ transformation: _fromVeloEntity,
494
+ },
495
+ customTransformation: requestTransformation,
496
+ });
497
+ const { fromJSON } = serializer({
498
+ rootSchema: _queryDataItemsResponse,
499
+ depSchemas: {},
500
+ fqdnTransformation: {
501
+ paths: [...['Array#dataItems']],
502
+ transformation: _toVeloEntity,
503
+ },
504
+ customTransformation: responseTransformation,
505
+ });
506
+ return wrapWithQueryBuilder({
507
+ func: (payload) => __awaiter(this, void 0, void 0, function* () {
508
+ var _a, _b, _c;
509
+ const reqOpts = ambassadorWixDataV2DataItem.queryDataItems(Object.assign(Object.assign({}, payload), options));
510
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
511
+ try {
512
+ const result = yield httpClient.request(reqOpts);
513
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
514
+ return result;
515
+ }
516
+ catch (err) {
517
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
518
+ throw err;
519
+ }
520
+ }),
521
+ requestTransformer: (...args) => toAmbassadorRequest(args),
522
+ responseTransformer: ({ data }) => fromJSON(data),
523
+ errorTransformer: (err) => {
524
+ const transformedError = transformError(err, requestTransformation);
525
+ throw transformedError;
526
+ },
527
+ pagingMethod: 'OFFSET',
528
+ transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity),
529
+ })({ cursorWithEmptyFilterAndSort: true });
530
+ }
531
+ /**
532
+ * Runs an aggregation on a data collection and returns the resulting list of items.
533
+ *
534
+ *
535
+ * An aggregation enables you to perform certain calculations on your collection data, or on groups of items that you define, to retrieve meaningful summaries.
536
+ * You can also add paging, filtering, and sorting preferences to your aggregation to retrieve exactly what you need.
537
+ * @public
538
+ * @documentationMaturity preview
539
+ * @requiredField options
540
+ * @requiredField options.dataCollectionId
541
+ */
542
+ export function aggregateDataItems(options) {
543
+ var _a, _b, _c;
544
+ return __awaiter(this, arguments, void 0, function* () {
545
+ const requestTransformation = {
546
+ dataCollectionId: '$[0].dataCollectionId',
547
+ initialFilter: '$[0].initialFilter',
548
+ aggregation: '$[0].aggregation',
549
+ finalFilter: '$[0].finalFilter',
550
+ paging: '$[0].paging',
551
+ cursorPaging: '$[0].cursorPaging',
552
+ sort: '$[0].sort',
553
+ returnTotalCount: '$[0].returnTotalCount',
554
+ consistentRead: '$[0].consistentRead',
555
+ };
556
+ const responseTransformation = '$';
557
+ // @ts-ignore
558
+ const { httpClient, sideEffects } = arguments[1];
559
+ const { toAmbassadorRequest } = serializer({
560
+ rootSchema: _aggregateDataItemsRequest,
561
+ depSchemas: {},
562
+ fqdnTransformation: {
563
+ paths: [],
564
+ transformation: _fromVeloEntity,
565
+ },
566
+ customTransformation: requestTransformation,
567
+ });
568
+ const { fromJSON } = serializer({
569
+ rootSchema: _aggregateDataItemsResponse,
570
+ depSchemas: {},
571
+ fqdnTransformation: {
572
+ paths: [],
573
+ transformation: _toVeloEntity,
574
+ },
575
+ customTransformation: responseTransformation,
576
+ });
577
+ const payload = toAmbassadorRequest([options]);
578
+ const reqOpts = ambassadorWixDataV2DataItem.aggregateDataItems(payload);
579
+ __log(`"AggregateDataItems" sending request with: ${__inspect(reqOpts)}`);
580
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
581
+ try {
582
+ const result = yield httpClient.request(reqOpts);
583
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
584
+ return fromJSON(result.data);
585
+ }
586
+ catch (err) {
587
+ const transformedError = transformError(err, requestTransformation, [
588
+ 'options',
589
+ ]);
590
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
591
+ throw transformedError;
592
+ }
593
+ });
594
+ }
595
+ /**
596
+ * Counts the number of items in a data collection that match the provided filtering preferences.
597
+ * @public
598
+ * @documentationMaturity preview
599
+ * @requiredField options
600
+ * @requiredField options.dataCollectionId
601
+ */
602
+ export function countDataItems(options) {
603
+ var _a, _b, _c;
604
+ return __awaiter(this, arguments, void 0, function* () {
605
+ const requestTransformation = {
606
+ dataCollectionId: '$[0].dataCollectionId',
607
+ filter: '$[0].filter',
608
+ consistentRead: '$[0].consistentRead',
609
+ };
610
+ const responseTransformation = '$';
611
+ // @ts-ignore
612
+ const { httpClient, sideEffects } = arguments[1];
613
+ const { toAmbassadorRequest } = serializer({
614
+ rootSchema: _countDataItemsRequest,
615
+ depSchemas: {},
616
+ fqdnTransformation: {
617
+ paths: [],
618
+ transformation: _fromVeloEntity,
619
+ },
620
+ customTransformation: requestTransformation,
621
+ });
622
+ const { fromJSON } = serializer({
623
+ rootSchema: _countDataItemsResponse,
624
+ depSchemas: {},
625
+ fqdnTransformation: {
626
+ paths: [],
627
+ transformation: _toVeloEntity,
628
+ },
629
+ customTransformation: responseTransformation,
630
+ });
631
+ const payload = toAmbassadorRequest([options]);
632
+ const reqOpts = ambassadorWixDataV2DataItem.countDataItems(payload);
633
+ __log(`"CountDataItems" sending request with: ${__inspect(reqOpts)}`);
634
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
635
+ try {
636
+ const result = yield httpClient.request(reqOpts);
637
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
638
+ return fromJSON(result.data);
639
+ }
640
+ catch (err) {
641
+ const transformedError = transformError(err, requestTransformation, [
642
+ 'options',
643
+ ]);
644
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
645
+ throw transformedError;
646
+ }
647
+ });
648
+ }
649
+ /**
650
+ * Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
651
+ *
652
+ *
653
+ * As with the [Query Data Items](https://dev.wix.com/api/rest/wix-data/wix-data/data-items/query-data-items) endpoint, this endpoint retrieves items based on the filtering, sorting, and paging preferences you provide.
654
+ * However, the Query Distinct Values endpoint doesn't return all of the full items that match the query.
655
+ * Rather, it returns all unique values of the field you specify in `fieldName` for items that match the query.
656
+ * If more than one item has the same value for that field, that value appears only once.
657
+ *
658
+ * For more details on using queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
659
+ * @public
660
+ * @documentationMaturity preview
661
+ * @requiredField options
662
+ * @requiredField options.dataCollectionId
663
+ */
664
+ export function queryDistinctValues(options) {
665
+ var _a, _b, _c;
666
+ return __awaiter(this, arguments, void 0, function* () {
667
+ const requestTransformation = {
668
+ dataCollectionId: '$[0].dataCollectionId',
669
+ fieldName: '$[0].fieldName',
670
+ filter: '$[0].filter',
671
+ order: '$[0].order',
672
+ paging: '$[0].paging',
673
+ cursorPaging: '$[0].cursorPaging',
674
+ returnTotalCount: '$[0].returnTotalCount',
675
+ consistentRead: '$[0].consistentRead',
676
+ };
677
+ const responseTransformation = '$';
678
+ // @ts-ignore
679
+ const { httpClient, sideEffects } = arguments[1];
680
+ const { toAmbassadorRequest } = serializer({
681
+ rootSchema: _queryDistinctValuesRequest,
682
+ depSchemas: {},
683
+ fqdnTransformation: {
684
+ paths: [],
685
+ transformation: _fromVeloEntity,
686
+ },
687
+ customTransformation: requestTransformation,
688
+ });
689
+ const { fromJSON } = serializer({
690
+ rootSchema: _queryDistinctValuesResponse,
691
+ depSchemas: {},
692
+ fqdnTransformation: {
693
+ paths: [],
694
+ transformation: _toVeloEntity,
695
+ },
696
+ customTransformation: responseTransformation,
697
+ });
698
+ const payload = toAmbassadorRequest([options]);
699
+ const reqOpts = ambassadorWixDataV2DataItem.queryDistinctValues(payload);
700
+ __log(`"QueryDistinctValues" sending request with: ${__inspect(reqOpts)}`);
701
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
702
+ try {
703
+ const result = yield httpClient.request(reqOpts);
704
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
705
+ return fromJSON(result.data);
706
+ }
707
+ catch (err) {
708
+ const transformedError = transformError(err, requestTransformation, [
709
+ 'options',
710
+ ]);
711
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
712
+ throw transformedError;
713
+ }
714
+ });
715
+ }
716
+ /**
717
+ * Adds multiple items to a collection.
718
+ *
719
+ *
720
+ * When each item is inserted into a collection, its ID is automatically assigned to random value.
721
+ * 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.
722
+ * @public
723
+ * @documentationMaturity preview
724
+ * @requiredField options
725
+ * @requiredField options.dataCollectionId
726
+ * @requiredField options.dataItems
727
+ */
728
+ export function bulkInsertDataItems(options) {
729
+ var _a, _b, _c;
730
+ return __awaiter(this, arguments, void 0, function* () {
731
+ const requestTransformation = {
732
+ dataCollectionId: '$[0].dataCollectionId',
733
+ dataItems: '$[0].dataItems',
734
+ returnEntity: '$[0].returnEntity',
735
+ };
736
+ const responseTransformation = '$';
737
+ // @ts-ignore
738
+ const { httpClient, sideEffects } = arguments[1];
739
+ const { toAmbassadorRequest } = serializer({
740
+ rootSchema: _bulkInsertDataItemsRequest,
741
+ depSchemas: {},
742
+ fqdnTransformation: {
743
+ paths: [...['Array#dataItems']],
744
+ transformation: _fromVeloEntity,
745
+ },
746
+ customTransformation: requestTransformation,
747
+ });
748
+ const { fromJSON } = serializer({
749
+ rootSchema: _bulkInsertDataItemsResponse,
750
+ depSchemas: {},
751
+ fqdnTransformation: {
752
+ paths: [...['Array#results.dataItem']],
753
+ transformation: _toVeloEntity,
754
+ },
755
+ customTransformation: responseTransformation,
756
+ });
757
+ const payload = toAmbassadorRequest([options]);
758
+ const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItems(payload);
759
+ __log(`"BulkInsertDataItems" sending request with: ${__inspect(reqOpts)}`);
760
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
761
+ try {
762
+ const result = yield httpClient.request(reqOpts);
763
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
764
+ return fromJSON(result.data);
765
+ }
766
+ catch (err) {
767
+ const transformedError = transformError(err, requestTransformation, [
768
+ 'options',
769
+ ]);
770
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
771
+ throw transformedError;
772
+ }
773
+ });
774
+ }
775
+ /**
776
+ * Updates multiple items in a collection.
777
+ *
778
+ *
779
+ * This endpoint replaces each specified data item's existing data with the payload provided in the request.
780
+ *
781
+ * Each item in the request must include an ID. If an item is found in the specified collection with
782
+ * the same ID, that item is updated. If the collection doesn't contain an item with that ID, the update fails.
783
+ *
784
+ * When an item is updated, its `data._updatedDate` field is changed to the current date and time.
785
+ *
786
+ * > **Note:**
787
+ * > 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
788
+ * > aren't included in the updated item, their values are lost.
789
+ * @public
790
+ * @documentationMaturity preview
791
+ * @requiredField options
792
+ * @requiredField options.dataCollectionId
793
+ * @requiredField options.dataItems
794
+ */
795
+ export function bulkUpdateDataItems(options) {
796
+ var _a, _b, _c;
797
+ return __awaiter(this, arguments, void 0, function* () {
798
+ const requestTransformation = {
799
+ dataCollectionId: '$[0].dataCollectionId',
800
+ dataItems: '$[0].dataItems',
801
+ returnEntity: '$[0].returnEntity',
802
+ };
803
+ const responseTransformation = '$';
804
+ // @ts-ignore
805
+ const { httpClient, sideEffects } = arguments[1];
806
+ const { toAmbassadorRequest } = serializer({
807
+ rootSchema: _bulkUpdateDataItemsRequest,
808
+ depSchemas: {},
809
+ fqdnTransformation: {
810
+ paths: [...['Array#dataItems']],
811
+ transformation: _fromVeloEntity,
812
+ },
813
+ customTransformation: requestTransformation,
814
+ });
815
+ const { fromJSON } = serializer({
816
+ rootSchema: _bulkUpdateDataItemsResponse,
817
+ depSchemas: {},
818
+ fqdnTransformation: {
819
+ paths: [...['Array#results.dataItem']],
820
+ transformation: _toVeloEntity,
821
+ },
822
+ customTransformation: responseTransformation,
823
+ });
824
+ const payload = toAmbassadorRequest([options]);
825
+ const reqOpts = ambassadorWixDataV2DataItem.bulkUpdateDataItems(payload);
826
+ __log(`"BulkUpdateDataItems" sending request with: ${__inspect(reqOpts)}`);
827
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
828
+ try {
829
+ const result = yield httpClient.request(reqOpts);
830
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
831
+ return fromJSON(result.data);
832
+ }
833
+ catch (err) {
834
+ const transformedError = transformError(err, requestTransformation, [
835
+ 'options',
836
+ ]);
837
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
838
+ throw transformedError;
839
+ }
840
+ });
841
+ }
842
+ /**
843
+ * Inserts or updates multiple items in a collection.
844
+ *
845
+ *
846
+ * The Bulk Save Data Items endpoint inserts or updates each item provided, depending on whether it already exists in the collection. For each item:
847
+ *
848
+ * + If you don't provide an ID, a new item is created.
849
+ *
850
+ * + If you provide an ID that doesn't exist in the collection, a new item is created with that ID.
851
+ *
852
+ * + 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.
853
+ *
854
+ * > **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.
855
+ * > This means that all of the item's previous fields and values are lost.
856
+ * @public
857
+ * @documentationMaturity preview
858
+ * @requiredField options
859
+ * @requiredField options.dataCollectionId
860
+ * @requiredField options.dataItems
861
+ */
862
+ export function bulkSaveDataItems(options) {
863
+ var _a, _b, _c;
864
+ return __awaiter(this, arguments, void 0, function* () {
865
+ const requestTransformation = {
866
+ dataCollectionId: '$[0].dataCollectionId',
867
+ dataItems: '$[0].dataItems',
868
+ returnEntity: '$[0].returnEntity',
869
+ };
870
+ const responseTransformation = '$';
871
+ // @ts-ignore
872
+ const { httpClient, sideEffects } = arguments[1];
873
+ const { toAmbassadorRequest } = serializer({
874
+ rootSchema: _bulkSaveDataItemsRequest,
875
+ depSchemas: {},
876
+ fqdnTransformation: {
877
+ paths: [...['Array#dataItems']],
878
+ transformation: _fromVeloEntity,
879
+ },
880
+ customTransformation: requestTransformation,
881
+ });
882
+ const { fromJSON } = serializer({
883
+ rootSchema: _bulkSaveDataItemsResponse,
884
+ depSchemas: {},
885
+ fqdnTransformation: {
886
+ paths: [...['Array#results.dataItem']],
887
+ transformation: _toVeloEntity,
888
+ },
889
+ customTransformation: responseTransformation,
890
+ });
891
+ const payload = toAmbassadorRequest([options]);
892
+ const reqOpts = ambassadorWixDataV2DataItem.bulkSaveDataItems(payload);
893
+ __log(`"BulkSaveDataItems" sending request with: ${__inspect(reqOpts)}`);
894
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
895
+ try {
896
+ const result = yield httpClient.request(reqOpts);
897
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
898
+ return fromJSON(result.data);
899
+ }
900
+ catch (err) {
901
+ const transformedError = transformError(err, requestTransformation, [
902
+ 'options',
903
+ ]);
904
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
905
+ throw transformedError;
906
+ }
907
+ });
908
+ }
909
+ /**
910
+ * Removes multiple items from a collection.
911
+ *
912
+ *
913
+ * If any items in other collections reference the removed items in reference or multi-reference fields, those fields are cleared.
914
+ *
915
+ * > **Note:** Once an item has been removed from a collection, it can't be restored.
916
+ * @public
917
+ * @documentationMaturity preview
918
+ * @requiredField options
919
+ * @requiredField options.dataCollectionId
920
+ * @requiredField options.dataItemIds
921
+ */
922
+ export function bulkRemoveDataItems(options) {
923
+ var _a, _b, _c;
924
+ return __awaiter(this, arguments, void 0, function* () {
925
+ const requestTransformation = {
926
+ dataCollectionId: '$[0].dataCollectionId',
927
+ dataItemIds: '$[0].dataItemIds',
928
+ };
929
+ const responseTransformation = '$';
930
+ // @ts-ignore
931
+ const { httpClient, sideEffects } = arguments[1];
932
+ const { toAmbassadorRequest } = serializer({
933
+ rootSchema: _bulkRemoveDataItemsRequest,
934
+ depSchemas: {},
935
+ fqdnTransformation: {
936
+ paths: [],
937
+ transformation: _fromVeloEntity,
938
+ },
939
+ customTransformation: requestTransformation,
940
+ });
941
+ const { fromJSON } = serializer({
942
+ rootSchema: _bulkRemoveDataItemsResponse,
943
+ depSchemas: {},
944
+ fqdnTransformation: {
945
+ paths: [...['Array#results.dataItem']],
946
+ transformation: _toVeloEntity,
947
+ },
948
+ customTransformation: responseTransformation,
949
+ });
950
+ const payload = toAmbassadorRequest([options]);
951
+ const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItems(payload);
952
+ __log(`"BulkRemoveDataItems" sending request with: ${__inspect(reqOpts)}`);
953
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
954
+ try {
955
+ const result = yield httpClient.request(reqOpts);
956
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
957
+ return fromJSON(result.data);
958
+ }
959
+ catch (err) {
960
+ const transformedError = transformError(err, requestTransformation, [
961
+ 'options',
962
+ ]);
963
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
964
+ throw transformedError;
965
+ }
966
+ });
967
+ }
968
+ /**
969
+ * Retrieves the full items referenced in the specified field of an item.
970
+ *
971
+ *
972
+ * Reference and multi-reference fields refer to items in different collections.
973
+ * Use this endpoint to retrieve the full details of the referenced items themselves.
974
+ *
975
+ * For example, suppose you have a **Movies** collection with an **Actors** field that contains references to items in a **People** collection.
976
+ * Querying the **Movies** collection using the Query Referenced Data Items endpoint returns the relevant **People** items referenced in the **Actors** field of the specified **Movie** item.
977
+ * This gives you information from the **People** collection about each of the actors in the specified movie.
978
+ * @public
979
+ * @documentationMaturity preview
980
+ * @requiredField options
981
+ * @requiredField options.dataCollectionId
982
+ */
983
+ export function queryReferencedDataItems(options) {
984
+ var _a, _b, _c;
985
+ return __awaiter(this, arguments, void 0, function* () {
986
+ const requestTransformation = {
987
+ dataCollectionId: '$[0].dataCollectionId',
988
+ referringItemId: '$[0].referringItemId',
989
+ referringItemFieldName: '$[0].referringItemFieldName',
990
+ order: '$[0].order',
991
+ paging: '$[0].paging',
992
+ cursorPaging: '$[0].cursorPaging',
993
+ returnTotalCount: '$[0].returnTotalCount',
994
+ consistentRead: '$[0].consistentRead',
995
+ };
996
+ const responseTransformation = '$';
997
+ // @ts-ignore
998
+ const { httpClient, sideEffects } = arguments[1];
999
+ const { toAmbassadorRequest } = serializer({
1000
+ rootSchema: _queryReferencedDataItemsRequest,
1001
+ depSchemas: {},
1002
+ fqdnTransformation: {
1003
+ paths: [],
1004
+ transformation: _fromVeloEntity,
1005
+ },
1006
+ customTransformation: requestTransformation,
1007
+ });
1008
+ const { fromJSON } = serializer({
1009
+ rootSchema: _queryReferencedDataItemsResponse,
1010
+ depSchemas: {},
1011
+ fqdnTransformation: {
1012
+ paths: [...['Array#results.dataItem']],
1013
+ transformation: _toVeloEntity,
1014
+ },
1015
+ customTransformation: responseTransformation,
1016
+ });
1017
+ const payload = toAmbassadorRequest([options]);
1018
+ const reqOpts = ambassadorWixDataV2DataItem.queryReferencedDataItems(payload);
1019
+ __log(`"QueryReferencedDataItems" sending request with: ${__inspect(reqOpts)}`);
1020
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1021
+ try {
1022
+ const result = yield httpClient.request(reqOpts);
1023
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1024
+ return fromJSON(result.data);
1025
+ }
1026
+ catch (err) {
1027
+ const transformedError = transformError(err, requestTransformation, [
1028
+ 'options',
1029
+ ]);
1030
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1031
+ throw transformedError;
1032
+ }
1033
+ });
1034
+ }
1035
+ /**
1036
+ * Checks whether a field in a referring item contains a reference to a specified item.
1037
+ * @public
1038
+ * @documentationMaturity preview
1039
+ * @requiredField options
1040
+ * @requiredField options.dataCollectionId
1041
+ * @requiredField options.referencedItemId
1042
+ * @requiredField options.referringItemFieldName
1043
+ * @requiredField options.referringItemId
1044
+ */
1045
+ export function isReferencedDataItem(options) {
1046
+ var _a, _b, _c;
1047
+ return __awaiter(this, arguments, void 0, function* () {
1048
+ const requestTransformation = {
1049
+ dataCollectionId: '$[0].dataCollectionId',
1050
+ referringItemFieldName: '$[0].referringItemFieldName',
1051
+ referringItemId: '$[0].referringItemId',
1052
+ referencedItemId: '$[0].referencedItemId',
1053
+ consistentRead: '$[0].consistentRead',
1054
+ };
1055
+ const responseTransformation = '$';
1056
+ // @ts-ignore
1057
+ const { httpClient, sideEffects } = arguments[1];
1058
+ const { toAmbassadorRequest } = serializer({
1059
+ rootSchema: _isReferencedDataItemRequest,
1060
+ depSchemas: {},
1061
+ fqdnTransformation: {
1062
+ paths: [],
1063
+ transformation: _fromVeloEntity,
1064
+ },
1065
+ customTransformation: requestTransformation,
1066
+ });
1067
+ const { fromJSON } = serializer({
1068
+ rootSchema: _isReferencedDataItemResponse,
1069
+ depSchemas: {},
1070
+ fqdnTransformation: {
1071
+ paths: [],
1072
+ transformation: _toVeloEntity,
1073
+ },
1074
+ customTransformation: responseTransformation,
1075
+ });
1076
+ const payload = toAmbassadorRequest([options]);
1077
+ const reqOpts = ambassadorWixDataV2DataItem.isReferencedDataItem(payload);
1078
+ __log(`"IsReferencedDataItem" sending request with: ${__inspect(reqOpts)}`);
1079
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1080
+ try {
1081
+ const result = yield httpClient.request(reqOpts);
1082
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1083
+ return fromJSON(result.data);
1084
+ }
1085
+ catch (err) {
1086
+ const transformedError = transformError(err, requestTransformation, [
1087
+ 'options',
1088
+ ]);
1089
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1090
+ throw transformedError;
1091
+ }
1092
+ });
1093
+ }
1094
+ /**
1095
+ * Inserts a reference in the specified field in an item in a collection.
1096
+ *
1097
+ *
1098
+ * A reference in the `dataItemReference` field specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
1099
+ * @public
1100
+ * @documentationMaturity preview
1101
+ * @requiredField options
1102
+ * @requiredField options.dataCollectionId
1103
+ * @requiredField options.dataItemReference.referencedItemId
1104
+ * @requiredField options.dataItemReference.referringItemFieldName
1105
+ * @requiredField options.dataItemReference.referringItemId
1106
+ */
1107
+ export function insertDataItemReference(options) {
1108
+ var _a, _b, _c;
1109
+ return __awaiter(this, arguments, void 0, function* () {
1110
+ const requestTransformation = {
1111
+ dataCollectionId: '$[0].dataCollectionId',
1112
+ dataItemReference: '$[0].dataItemReference',
1113
+ };
1114
+ const responseTransformation = '$';
1115
+ // @ts-ignore
1116
+ const { httpClient, sideEffects } = arguments[1];
1117
+ const { toAmbassadorRequest } = serializer({
1118
+ rootSchema: _insertDataItemReferenceRequest,
1119
+ depSchemas: {},
1120
+ fqdnTransformation: {
1121
+ paths: [],
1122
+ transformation: _fromVeloEntity,
1123
+ },
1124
+ customTransformation: requestTransformation,
1125
+ });
1126
+ const { fromJSON } = serializer({
1127
+ rootSchema: _insertDataItemReferenceResponse,
1128
+ depSchemas: {},
1129
+ fqdnTransformation: {
1130
+ paths: [],
1131
+ transformation: _toVeloEntity,
1132
+ },
1133
+ customTransformation: responseTransformation,
1134
+ });
1135
+ const payload = toAmbassadorRequest([options]);
1136
+ const reqOpts = ambassadorWixDataV2DataItem.insertDataItemReference(payload);
1137
+ __log(`"InsertDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1138
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1139
+ try {
1140
+ const result = yield httpClient.request(reqOpts);
1141
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1142
+ return fromJSON(result.data);
1143
+ }
1144
+ catch (err) {
1145
+ const transformedError = transformError(err, requestTransformation, [
1146
+ 'options',
1147
+ ]);
1148
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1149
+ throw transformedError;
1150
+ }
1151
+ });
1152
+ }
1153
+ /**
1154
+ * Removes the specified reference from the specified field.
1155
+ * @public
1156
+ * @documentationMaturity preview
1157
+ * @requiredField options
1158
+ * @requiredField options.dataCollectionId
1159
+ * @requiredField options.dataItemReference
1160
+ * @requiredField options.dataItemReference.referencedItemId
1161
+ * @requiredField options.dataItemReference.referringItemFieldName
1162
+ * @requiredField options.dataItemReference.referringItemId
1163
+ */
1164
+ export function removeDataItemReference(options) {
1165
+ var _a, _b, _c;
1166
+ return __awaiter(this, arguments, void 0, function* () {
1167
+ const requestTransformation = {
1168
+ dataCollectionId: '$[0].dataCollectionId',
1169
+ dataItemReference: '$[0].dataItemReference',
1170
+ };
1171
+ const responseTransformation = '$';
1172
+ // @ts-ignore
1173
+ const { httpClient, sideEffects } = arguments[1];
1174
+ const { toAmbassadorRequest } = serializer({
1175
+ rootSchema: _removeDataItemReferenceRequest,
1176
+ depSchemas: {},
1177
+ fqdnTransformation: {
1178
+ paths: [],
1179
+ transformation: _fromVeloEntity,
1180
+ },
1181
+ customTransformation: requestTransformation,
1182
+ });
1183
+ const { fromJSON } = serializer({
1184
+ rootSchema: _removeDataItemReferenceResponse,
1185
+ depSchemas: {},
1186
+ fqdnTransformation: {
1187
+ paths: [],
1188
+ transformation: _toVeloEntity,
1189
+ },
1190
+ customTransformation: responseTransformation,
1191
+ });
1192
+ const payload = toAmbassadorRequest([options]);
1193
+ const reqOpts = ambassadorWixDataV2DataItem.removeDataItemReference(payload);
1194
+ __log(`"RemoveDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1195
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1196
+ try {
1197
+ const result = yield httpClient.request(reqOpts);
1198
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1199
+ return fromJSON(result.data);
1200
+ }
1201
+ catch (err) {
1202
+ const transformedError = transformError(err, requestTransformation, [
1203
+ 'options',
1204
+ ]);
1205
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1206
+ throw transformedError;
1207
+ }
1208
+ });
1209
+ }
1210
+ /**
1211
+ * Inserts one or more references in the specified fields of items in a collection.
1212
+ *
1213
+ *
1214
+ * This endpoint adds one or more references to a collection.
1215
+ * Each new reference in the `dataItemReferences` field specifies a referring item's ID, the field in which to insert the reference, and the ID of the referenced item.
1216
+ * @public
1217
+ * @documentationMaturity preview
1218
+ * @requiredField options
1219
+ * @requiredField options.dataCollectionId
1220
+ * @requiredField options.dataItemReferences
1221
+ * @requiredField options.dataItemReferences.referencedItemId
1222
+ * @requiredField options.dataItemReferences.referringItemFieldName
1223
+ * @requiredField options.dataItemReferences.referringItemId
1224
+ */
1225
+ export function bulkInsertDataItemReferences(options) {
1226
+ var _a, _b, _c;
1227
+ return __awaiter(this, arguments, void 0, function* () {
1228
+ const requestTransformation = {
1229
+ dataCollectionId: '$[0].dataCollectionId',
1230
+ dataItemReferences: '$[0].dataItemReferences',
1231
+ returnEntity: '$[0].returnEntity',
1232
+ };
1233
+ const responseTransformation = '$';
1234
+ // @ts-ignore
1235
+ const { httpClient, sideEffects } = arguments[1];
1236
+ const { toAmbassadorRequest } = serializer({
1237
+ rootSchema: _bulkInsertDataItemReferencesRequest,
1238
+ depSchemas: {},
1239
+ fqdnTransformation: {
1240
+ paths: [],
1241
+ transformation: _fromVeloEntity,
1242
+ },
1243
+ customTransformation: requestTransformation,
1244
+ });
1245
+ const { fromJSON } = serializer({
1246
+ rootSchema: _bulkInsertDataItemReferencesResponse,
1247
+ depSchemas: {},
1248
+ fqdnTransformation: {
1249
+ paths: [],
1250
+ transformation: _toVeloEntity,
1251
+ },
1252
+ customTransformation: responseTransformation,
1253
+ });
1254
+ const payload = toAmbassadorRequest([options]);
1255
+ const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItemReferences(payload);
1256
+ __log(`"BulkInsertDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1257
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1258
+ try {
1259
+ const result = yield httpClient.request(reqOpts);
1260
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1261
+ return fromJSON(result.data);
1262
+ }
1263
+ catch (err) {
1264
+ const transformedError = transformError(err, requestTransformation, [
1265
+ 'options',
1266
+ ]);
1267
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1268
+ throw transformedError;
1269
+ }
1270
+ });
1271
+ }
1272
+ /**
1273
+ * Removes one or more references.
1274
+ * @public
1275
+ * @documentationMaturity preview
1276
+ * @requiredField options
1277
+ * @requiredField options.dataCollectionId
1278
+ * @requiredField options.dataItemReferences
1279
+ * @requiredField options.dataItemReferences.referencedItemId
1280
+ * @requiredField options.dataItemReferences.referringItemFieldName
1281
+ * @requiredField options.dataItemReferences.referringItemId
1282
+ */
1283
+ export function bulkRemoveDataItemReferences(options) {
1284
+ var _a, _b, _c;
1285
+ return __awaiter(this, arguments, void 0, function* () {
1286
+ const requestTransformation = {
1287
+ dataCollectionId: '$[0].dataCollectionId',
1288
+ dataItemReferences: '$[0].dataItemReferences',
1289
+ };
1290
+ const responseTransformation = '$';
1291
+ // @ts-ignore
1292
+ const { httpClient, sideEffects } = arguments[1];
1293
+ const { toAmbassadorRequest } = serializer({
1294
+ rootSchema: _bulkRemoveDataItemReferencesRequest,
1295
+ depSchemas: {},
1296
+ fqdnTransformation: {
1297
+ paths: [],
1298
+ transformation: _fromVeloEntity,
1299
+ },
1300
+ customTransformation: requestTransformation,
1301
+ });
1302
+ const { fromJSON } = serializer({
1303
+ rootSchema: _bulkRemoveDataItemReferencesResponse,
1304
+ depSchemas: {},
1305
+ fqdnTransformation: {
1306
+ paths: [],
1307
+ transformation: _toVeloEntity,
1308
+ },
1309
+ customTransformation: responseTransformation,
1310
+ });
1311
+ const payload = toAmbassadorRequest([options]);
1312
+ const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItemReferences(payload);
1313
+ __log(`"BulkRemoveDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1314
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1315
+ try {
1316
+ const result = yield httpClient.request(reqOpts);
1317
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1318
+ return fromJSON(result.data);
1319
+ }
1320
+ catch (err) {
1321
+ const transformedError = transformError(err, requestTransformation, [
1322
+ 'options',
1323
+ ]);
1324
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1325
+ throw transformedError;
1326
+ }
1327
+ });
1328
+ }
1329
+ /**
1330
+ * Replaces references in a specified field of a specified data item.
1331
+ *
1332
+ *
1333
+ * This endpoint replaces the existing reference or references contained in the field specified in `referringItemFieldName` within the data item specified in `referringItemId`.
1334
+ * The endpoint removes existing references and in their place it adds references to the items specified in `newReferencedItemIds`.
1335
+ *
1336
+ * > **Note:** If you pass an empty array in `newReferencedItemIds`, all existing references are removed.
1337
+ * @public
1338
+ * @documentationMaturity preview
1339
+ * @requiredField options
1340
+ * @requiredField options.dataCollectionId
1341
+ * @requiredField options.referringItemFieldName
1342
+ * @requiredField options.referringItemId
1343
+ */
1344
+ export function replaceDataItemReferences(options) {
1345
+ var _a, _b, _c;
1346
+ return __awaiter(this, arguments, void 0, function* () {
1347
+ const requestTransformation = {
1348
+ dataCollectionId: '$[0].dataCollectionId',
1349
+ referringItemFieldName: '$[0].referringItemFieldName',
1350
+ referringItemId: '$[0].referringItemId',
1351
+ newReferencedItemIds: '$[0].newReferencedItemIds',
1352
+ };
1353
+ const responseTransformation = '$';
1354
+ // @ts-ignore
1355
+ const { httpClient, sideEffects } = arguments[1];
1356
+ const { toAmbassadorRequest } = serializer({
1357
+ rootSchema: _replaceDataItemReferencesRequest,
1358
+ depSchemas: {},
1359
+ fqdnTransformation: {
1360
+ paths: [],
1361
+ transformation: _fromVeloEntity,
1362
+ },
1363
+ customTransformation: requestTransformation,
1364
+ });
1365
+ const { fromJSON } = serializer({
1366
+ rootSchema: _replaceDataItemReferencesResponse,
1367
+ depSchemas: {},
1368
+ fqdnTransformation: {
1369
+ paths: [],
1370
+ transformation: _toVeloEntity,
1371
+ },
1372
+ customTransformation: responseTransformation,
1373
+ });
1374
+ const payload = toAmbassadorRequest([options]);
1375
+ const reqOpts = ambassadorWixDataV2DataItem.replaceDataItemReferences(payload);
1376
+ __log(`"ReplaceDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1377
+ (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1378
+ try {
1379
+ const result = yield httpClient.request(reqOpts);
1380
+ (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1381
+ return fromJSON(result.data);
1382
+ }
1383
+ catch (err) {
1384
+ const transformedError = transformError(err, requestTransformation, [
1385
+ 'options',
1386
+ ]);
1387
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1388
+ throw transformedError;
1389
+ }
1390
+ });
1391
+ }
1392
+ //# sourceMappingURL=data-v2-data-item.universal.js.map