@wix/data 1.0.60 → 1.0.62

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 (75) hide show
  1. package/build/cjs/index.js +5 -1
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/index.typings.js +5 -1
  4. package/build/cjs/index.typings.js.map +1 -1
  5. package/build/cjs/meta.js +5 -1
  6. package/build/cjs/meta.js.map +1 -1
  7. package/build/cjs/src/data-v1-external-database-connection.http.js +14 -54
  8. package/build/cjs/src/data-v1-external-database-connection.http.js.map +1 -1
  9. package/build/cjs/src/data-v1-external-database-connection.meta.d.ts +1 -1
  10. package/build/cjs/src/data-v1-external-database-connection.meta.js +5 -1
  11. package/build/cjs/src/data-v1-external-database-connection.meta.js.map +1 -1
  12. package/build/cjs/src/data-v1-external-database-connection.public.d.ts +1 -1
  13. package/build/cjs/src/data-v1-external-database-connection.types.js +4 -4
  14. package/build/cjs/src/data-v1-external-database-connection.types.js.map +1 -1
  15. package/build/cjs/src/data-v1-external-database-connection.universal.js +53 -149
  16. package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -1
  17. package/build/cjs/src/data-v2-data-collection.http.js +10 -29
  18. package/build/cjs/src/data-v2-data-collection.http.js.map +1 -1
  19. package/build/cjs/src/data-v2-data-collection.meta.d.ts +1 -1
  20. package/build/cjs/src/data-v2-data-collection.meta.js +5 -1
  21. package/build/cjs/src/data-v2-data-collection.meta.js.map +1 -1
  22. package/build/cjs/src/data-v2-data-collection.public.d.ts +1 -1
  23. package/build/cjs/src/data-v2-data-collection.types.js +13 -13
  24. package/build/cjs/src/data-v2-data-collection.types.js.map +1 -1
  25. package/build/cjs/src/data-v2-data-collection.universal.js +43 -48
  26. package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -1
  27. package/build/cjs/src/data-v2-data-item.http.js +46 -190
  28. package/build/cjs/src/data-v2-data-item.http.js.map +1 -1
  29. package/build/cjs/src/data-v2-data-item.meta.d.ts +1 -1
  30. package/build/cjs/src/data-v2-data-item.meta.js +5 -1
  31. package/build/cjs/src/data-v2-data-item.meta.js.map +1 -1
  32. package/build/cjs/src/data-v2-data-item.public.d.ts +13 -13
  33. package/build/cjs/src/data-v2-data-item.public.js.map +1 -1
  34. package/build/cjs/src/data-v2-data-item.types.js +4 -4
  35. package/build/cjs/src/data-v2-data-item.types.js.map +1 -1
  36. package/build/cjs/src/data-v2-data-item.universal.d.ts +15 -15
  37. package/build/cjs/src/data-v2-data-item.universal.js +354 -669
  38. package/build/cjs/src/data-v2-data-item.universal.js.map +1 -1
  39. package/build/cjs/src/data-v2-index.http.js +10 -28
  40. package/build/cjs/src/data-v2-index.http.js.map +1 -1
  41. package/build/cjs/src/data-v2-index.meta.d.ts +1 -1
  42. package/build/cjs/src/data-v2-index.meta.js +5 -1
  43. package/build/cjs/src/data-v2-index.meta.js.map +1 -1
  44. package/build/cjs/src/data-v2-index.public.d.ts +1 -1
  45. package/build/cjs/src/data-v2-index.types.js +3 -3
  46. package/build/cjs/src/data-v2-index.types.js.map +1 -1
  47. package/build/cjs/src/data-v2-index.universal.js +43 -93
  48. package/build/cjs/src/data-v2-index.universal.js.map +1 -1
  49. package/build/es/src/data-v1-external-database-connection.http.js +14 -54
  50. package/build/es/src/data-v1-external-database-connection.http.js.map +1 -1
  51. package/build/es/src/data-v1-external-database-connection.meta.d.ts +1 -1
  52. package/build/es/src/data-v1-external-database-connection.public.d.ts +1 -1
  53. package/build/es/src/data-v1-external-database-connection.universal.js +44 -144
  54. package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -1
  55. package/build/es/src/data-v2-data-collection.http.js +10 -29
  56. package/build/es/src/data-v2-data-collection.http.js.map +1 -1
  57. package/build/es/src/data-v2-data-collection.meta.d.ts +1 -1
  58. package/build/es/src/data-v2-data-collection.public.d.ts +1 -1
  59. package/build/es/src/data-v2-data-collection.universal.js +25 -34
  60. package/build/es/src/data-v2-data-collection.universal.js.map +1 -1
  61. package/build/es/src/data-v2-data-item.http.js +46 -190
  62. package/build/es/src/data-v2-data-item.http.js.map +1 -1
  63. package/build/es/src/data-v2-data-item.meta.d.ts +1 -1
  64. package/build/es/src/data-v2-data-item.public.d.ts +13 -13
  65. package/build/es/src/data-v2-data-item.public.js.map +1 -1
  66. package/build/es/src/data-v2-data-item.universal.d.ts +15 -15
  67. package/build/es/src/data-v2-data-item.universal.js +346 -665
  68. package/build/es/src/data-v2-data-item.universal.js.map +1 -1
  69. package/build/es/src/data-v2-index.http.js +10 -28
  70. package/build/es/src/data-v2-index.http.js.map +1 -1
  71. package/build/es/src/data-v2-index.meta.d.ts +1 -1
  72. package/build/es/src/data-v2-index.public.d.ts +1 -1
  73. package/build/es/src/data-v2-index.universal.js +35 -89
  74. package/build/es/src/data-v2-index.universal.js.map +1 -1
  75. package/package.json +8 -8
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo';
10
+ import { resolveQueryFieldsTransformationPaths } from '@wix/metro-runtime/velo';
11
+ import { transformError as sdkTransformError, renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, queryBuilder, } from '@wix/sdk-runtime';
11
12
  import * as ambassadorWixDataV2DataItem from './data-v2-data-item.http';
12
13
  // @ts-ignore
13
- import { wrapWithQueryBuilder } from '@wix/motion-edm-autogen-query-wrapper';
14
14
  let __verbose = false;
15
15
  function __log(...args) {
16
16
  __verbose && console.log(...args);
@@ -25,7 +25,6 @@ export const __debug = {
25
25
  },
26
26
  };
27
27
  const _toVeloEntity = '$';
28
- const _fromVeloEntity = '$';
29
28
  export var Environment;
30
29
  (function (Environment) {
31
30
  Environment["LIVE"] = "LIVE";
@@ -49,48 +48,6 @@ export var BulkActionType;
49
48
  BulkActionType["UPDATE"] = "UPDATE";
50
49
  BulkActionType["DELETE"] = "DELETE";
51
50
  })(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
51
  /**
95
52
  * Adds an item to a collection.
96
53
  *
@@ -115,44 +72,31 @@ const _updateDataItemResponse = {};
115
72
  export function insertDataItem(options) {
116
73
  var _a, _b, _c;
117
74
  return __awaiter(this, arguments, void 0, function* () {
118
- const requestTransformation = {
119
- dataCollectionId: '$[0].dataCollectionId',
120
- dataItem: '$[0].dataItem',
121
- };
122
- const responseTransformation = '$';
123
75
  // @ts-ignore
124
76
  const { httpClient, sideEffects } = arguments[1];
125
- const { toAmbassadorRequest } = serializer({
126
- rootSchema: _insertDataItemRequest,
127
- depSchemas: {},
128
- fqdnTransformation: {
129
- paths: [...['dataItem']],
130
- transformation: _fromVeloEntity,
131
- },
132
- customTransformation: requestTransformation,
133
- });
134
- const { fromJSON } = serializer({
135
- rootSchema: _insertDataItemResponse,
136
- depSchemas: {},
137
- fqdnTransformation: {
138
- paths: [...['dataItem']],
139
- transformation: _toVeloEntity,
140
- },
141
- customTransformation: responseTransformation,
142
- });
143
- const payload = toAmbassadorRequest([options], ['dataItem.data']);
77
+ const payload = renameKeysFromSDKRequestToRESTRequest({
78
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
79
+ dataItem: options === null || options === void 0 ? void 0 : options.dataItem,
80
+ }, ['dataItem.data']);
144
81
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItem(payload);
145
82
  __log(`"InsertDataItem" sending request with: ${__inspect(reqOpts)}`);
146
83
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
147
84
  try {
148
85
  const result = yield httpClient.request(reqOpts);
149
86
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
150
- return fromJSON(result.data, ['dataItem.data']);
87
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
88
+ 'dataItem.data',
89
+ ]);
151
90
  }
152
91
  catch (err) {
153
- const transformedError = transformError(err, requestTransformation, [
154
- 'options',
155
- ]);
92
+ const transformedError = sdkTransformError(err, {
93
+ spreadPathsToArguments: {},
94
+ explicitPathsToArguments: {
95
+ dataCollectionId: '$[0].dataCollectionId',
96
+ dataItem: '$[0].dataItem',
97
+ },
98
+ singleArgumentUnchanged: false,
99
+ }, ['options']);
156
100
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
157
101
  throw transformedError;
158
102
  }
@@ -187,45 +131,31 @@ export function insertDataItem(options) {
187
131
  export function updateDataItem(_id, options) {
188
132
  var _a, _b, _c;
189
133
  return __awaiter(this, arguments, void 0, function* () {
190
- const requestTransformation = {
191
- dataItem: { '*': '$[1].dataItem', id: '$[0]' },
192
- dataCollectionId: '$[1].dataCollectionId',
193
- };
194
- const responseTransformation = '$';
195
134
  // @ts-ignore
196
135
  const { httpClient, sideEffects } = arguments[2];
197
- const { toAmbassadorRequest } = serializer({
198
- rootSchema: _updateDataItemRequest,
199
- depSchemas: {},
200
- fqdnTransformation: {
201
- paths: [...['dataItem']],
202
- transformation: _fromVeloEntity,
203
- },
204
- customTransformation: requestTransformation,
205
- });
206
- const { fromJSON } = serializer({
207
- rootSchema: _updateDataItemResponse,
208
- depSchemas: {},
209
- fqdnTransformation: {
210
- paths: [...['dataItem']],
211
- transformation: _toVeloEntity,
212
- },
213
- customTransformation: responseTransformation,
214
- });
215
- const payload = toAmbassadorRequest([_id, options], ['dataItem.data']);
136
+ const payload = renameKeysFromSDKRequestToRESTRequest({
137
+ dataItem: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.dataItem), { id: _id }),
138
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
139
+ }, ['dataItem.data']);
216
140
  const reqOpts = ambassadorWixDataV2DataItem.updateDataItem(payload);
217
141
  __log(`"UpdateDataItem" sending request with: ${__inspect(reqOpts)}`);
218
142
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
219
143
  try {
220
144
  const result = yield httpClient.request(reqOpts);
221
145
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
222
- return fromJSON(result.data, ['dataItem.data']);
146
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
147
+ 'dataItem.data',
148
+ ]);
223
149
  }
224
150
  catch (err) {
225
- const transformedError = transformError(err, requestTransformation, [
226
- '_id',
227
- 'options',
228
- ]);
151
+ const transformedError = sdkTransformError(err, {
152
+ spreadPathsToArguments: { dataItem: '$[1].dataItem' },
153
+ explicitPathsToArguments: {
154
+ 'dataItem.id': '$[0]',
155
+ dataCollectionId: '$[1].dataCollectionId',
156
+ },
157
+ singleArgumentUnchanged: false,
158
+ }, ['_id', 'options']);
229
159
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
230
160
  throw transformedError;
231
161
  }
@@ -257,44 +187,31 @@ export function updateDataItem(_id, options) {
257
187
  export function saveDataItem(options) {
258
188
  var _a, _b, _c;
259
189
  return __awaiter(this, arguments, void 0, function* () {
260
- const requestTransformation = {
261
- dataCollectionId: '$[0].dataCollectionId',
262
- dataItem: '$[0].dataItem',
263
- };
264
- const responseTransformation = '$';
265
190
  // @ts-ignore
266
191
  const { httpClient, sideEffects } = arguments[1];
267
- const { toAmbassadorRequest } = serializer({
268
- rootSchema: _saveDataItemRequest,
269
- depSchemas: {},
270
- fqdnTransformation: {
271
- paths: [...['dataItem']],
272
- transformation: _fromVeloEntity,
273
- },
274
- customTransformation: requestTransformation,
275
- });
276
- const { fromJSON } = serializer({
277
- rootSchema: _saveDataItemResponse,
278
- depSchemas: {},
279
- fqdnTransformation: {
280
- paths: [...['dataItem']],
281
- transformation: _toVeloEntity,
282
- },
283
- customTransformation: responseTransformation,
284
- });
285
- const payload = toAmbassadorRequest([options], ['dataItem.data']);
192
+ const payload = renameKeysFromSDKRequestToRESTRequest({
193
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
194
+ dataItem: options === null || options === void 0 ? void 0 : options.dataItem,
195
+ }, ['dataItem.data']);
286
196
  const reqOpts = ambassadorWixDataV2DataItem.saveDataItem(payload);
287
197
  __log(`"SaveDataItem" sending request with: ${__inspect(reqOpts)}`);
288
198
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
289
199
  try {
290
200
  const result = yield httpClient.request(reqOpts);
291
201
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
292
- return fromJSON(result.data, ['dataItem.data']);
202
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
203
+ 'dataItem.data',
204
+ ]);
293
205
  }
294
206
  catch (err) {
295
- const transformedError = transformError(err, requestTransformation, [
296
- 'options',
297
- ]);
207
+ const transformedError = sdkTransformError(err, {
208
+ spreadPathsToArguments: {},
209
+ explicitPathsToArguments: {
210
+ dataCollectionId: '$[0].dataCollectionId',
211
+ dataItem: '$[0].dataItem',
212
+ },
213
+ singleArgumentUnchanged: false,
214
+ }, ['options']);
298
215
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
299
216
  throw transformedError;
300
217
  }
@@ -316,49 +233,36 @@ export function saveDataItem(options) {
316
233
  * @returns Retrieved item.
317
234
  */
318
235
  export function getDataItem(dataItemId, options) {
319
- var _a, _b, _c;
236
+ var _a, _b, _c, _d;
320
237
  return __awaiter(this, arguments, void 0, function* () {
321
- const requestTransformation = {
322
- dataItemId: '$[0]',
323
- dataCollectionId: '$[1].dataCollectionId',
324
- consistentRead: '$[1].consistentRead',
325
- };
326
- const responseTransformation = '$.dataItem';
327
238
  // @ts-ignore
328
239
  const { httpClient, sideEffects } = arguments[2];
329
- const { toAmbassadorRequest } = serializer({
330
- rootSchema: _getDataItemRequest,
331
- depSchemas: {},
332
- fqdnTransformation: {
333
- paths: [],
334
- transformation: _fromVeloEntity,
335
- },
336
- customTransformation: requestTransformation,
337
- });
338
- const { fromJSON } = serializer({
339
- rootSchema: _getDataItemResponse,
340
- depSchemas: {},
341
- fqdnTransformation: {
342
- paths: [...['dataItem']],
343
- transformation: _toVeloEntity,
344
- },
345
- customTransformation: responseTransformation,
346
- });
347
- const payload = toAmbassadorRequest([dataItemId, options], []);
240
+ const payload = renameKeysFromSDKRequestToRESTRequest({
241
+ dataItemId: dataItemId,
242
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
243
+ consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
244
+ }, []);
348
245
  const reqOpts = ambassadorWixDataV2DataItem.getDataItem(payload);
349
246
  __log(`"GetDataItem" sending request with: ${__inspect(reqOpts)}`);
350
247
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
351
248
  try {
352
249
  const result = yield httpClient.request(reqOpts);
353
250
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
354
- return fromJSON(result.data, ['dataItem.data']);
251
+ return renameKeysFromRESTResponseToSDKResponse((_c = result.data) === null || _c === void 0 ? void 0 : _c.dataItem, [
252
+ 'dataItem.data',
253
+ ]);
355
254
  }
356
255
  catch (err) {
357
- const transformedError = transformError(err, requestTransformation, [
358
- 'dataItemId',
359
- 'options',
360
- ]);
361
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
256
+ const transformedError = sdkTransformError(err, {
257
+ spreadPathsToArguments: {},
258
+ explicitPathsToArguments: {
259
+ dataItemId: '$[0]',
260
+ dataCollectionId: '$[1].dataCollectionId',
261
+ consistentRead: '$[1].consistentRead',
262
+ },
263
+ singleArgumentUnchanged: false,
264
+ }, ['dataItemId', 'options']);
265
+ (_d = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _d === void 0 ? void 0 : _d.call(sideEffects, err);
362
266
  throw transformedError;
363
267
  }
364
268
  });
@@ -384,45 +288,28 @@ export function getDataItem(dataItemId, options) {
384
288
  export function removeDataItem(dataItemId, options) {
385
289
  var _a, _b, _c;
386
290
  return __awaiter(this, arguments, void 0, function* () {
387
- const requestTransformation = {
388
- dataItemId: '$[0]',
389
- dataCollectionId: '$[1].dataCollectionId',
390
- };
391
- const responseTransformation = '$';
392
291
  // @ts-ignore
393
292
  const { httpClient, sideEffects } = arguments[2];
394
- const { toAmbassadorRequest } = serializer({
395
- rootSchema: _removeDataItemRequest,
396
- depSchemas: {},
397
- fqdnTransformation: {
398
- paths: [],
399
- transformation: _fromVeloEntity,
400
- },
401
- customTransformation: requestTransformation,
402
- });
403
- const { fromJSON } = serializer({
404
- rootSchema: _removeDataItemResponse,
405
- depSchemas: {},
406
- fqdnTransformation: {
407
- paths: [...['dataItem']],
408
- transformation: _toVeloEntity,
409
- },
410
- customTransformation: responseTransformation,
411
- });
412
- const payload = toAmbassadorRequest([dataItemId, options], []);
293
+ const payload = renameKeysFromSDKRequestToRESTRequest({ dataItemId: dataItemId, dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
413
294
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItem(payload);
414
295
  __log(`"RemoveDataItem" sending request with: ${__inspect(reqOpts)}`);
415
296
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
416
297
  try {
417
298
  const result = yield httpClient.request(reqOpts);
418
299
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
419
- return fromJSON(result.data, ['dataItem.data']);
300
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
301
+ 'dataItem.data',
302
+ ]);
420
303
  }
421
304
  catch (err) {
422
- const transformedError = transformError(err, requestTransformation, [
423
- 'dataItemId',
424
- 'options',
425
- ]);
305
+ const transformedError = sdkTransformError(err, {
306
+ spreadPathsToArguments: {},
307
+ explicitPathsToArguments: {
308
+ dataItemId: '$[0]',
309
+ dataCollectionId: '$[1].dataCollectionId',
310
+ },
311
+ singleArgumentUnchanged: false,
312
+ }, ['dataItemId', 'options']);
426
313
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
427
314
  throw transformedError;
428
315
  }
@@ -447,41 +334,22 @@ export function removeDataItem(dataItemId, options) {
447
334
  export function truncateDataItems(options) {
448
335
  var _a, _b, _c;
449
336
  return __awaiter(this, arguments, void 0, function* () {
450
- const requestTransformation = { dataCollectionId: '$[0].dataCollectionId' };
451
- const responseTransformation = '$';
452
337
  // @ts-ignore
453
338
  const { httpClient, sideEffects } = arguments[1];
454
- const { toAmbassadorRequest } = serializer({
455
- rootSchema: _truncateDataItemsRequest,
456
- depSchemas: {},
457
- fqdnTransformation: {
458
- paths: [],
459
- transformation: _fromVeloEntity,
460
- },
461
- customTransformation: requestTransformation,
462
- });
463
- const { fromJSON } = serializer({
464
- rootSchema: _truncateDataItemsResponse,
465
- depSchemas: {},
466
- fqdnTransformation: {
467
- paths: [],
468
- transformation: _toVeloEntity,
469
- },
470
- customTransformation: responseTransformation,
471
- });
472
- const payload = toAmbassadorRequest([options], []);
339
+ const payload = renameKeysFromSDKRequestToRESTRequest({ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
473
340
  const reqOpts = ambassadorWixDataV2DataItem.truncateDataItems(payload);
474
341
  __log(`"TruncateDataItems" sending request with: ${__inspect(reqOpts)}`);
475
342
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
476
343
  try {
477
344
  const result = yield httpClient.request(reqOpts);
478
345
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
479
- return fromJSON(result.data, []);
480
346
  }
481
347
  catch (err) {
482
- const transformedError = transformError(err, requestTransformation, [
483
- 'options',
484
- ]);
348
+ const transformedError = sdkTransformError(err, {
349
+ spreadPathsToArguments: {},
350
+ explicitPathsToArguments: { dataCollectionId: '$[0].dataCollectionId' },
351
+ singleArgumentUnchanged: false,
352
+ }, ['options']);
485
353
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
486
354
  throw transformedError;
487
355
  }
@@ -517,32 +385,9 @@ export function truncateDataItems(options) {
517
385
  * @applicableIdentity APP
518
386
  */
519
387
  export function queryDataItems(options) {
520
- const requestTransformation = { '*': '$[1]', query: '$[0]' };
521
- const responseTransformation = {
522
- items: '$.dataItems',
523
- pagingMetadata: '$.pagingMetadata',
524
- };
525
388
  // @ts-ignore
526
389
  const { httpClient, sideEffects } = arguments[1];
527
- const { toAmbassadorRequest } = serializer({
528
- rootSchema: _queryDataItemsRequest,
529
- depSchemas: {},
530
- fqdnTransformation: {
531
- paths: [],
532
- transformation: _fromVeloEntity,
533
- },
534
- customTransformation: requestTransformation,
535
- });
536
- const { fromJSON } = serializer({
537
- rootSchema: _queryDataItemsResponse,
538
- depSchemas: {},
539
- fqdnTransformation: {
540
- paths: [...['Array#dataItems']],
541
- transformation: _toVeloEntity,
542
- },
543
- customTransformation: responseTransformation,
544
- });
545
- return wrapWithQueryBuilder({
390
+ return queryBuilder({
546
391
  func: (payload) => __awaiter(this, void 0, void 0, function* () {
547
392
  var _a, _b, _c;
548
393
  const reqOpts = ambassadorWixDataV2DataItem.queryDataItems(Object.assign(Object.assign({}, payload), options));
@@ -557,15 +402,22 @@ export function queryDataItems(options) {
557
402
  throw err;
558
403
  }
559
404
  }),
560
- requestTransformer: (...args) => toAmbassadorRequest(args, []),
561
- responseTransformer: ({ data }) => fromJSON(data, ['dataItems.data']),
405
+ requestTransformer: (query) => {
406
+ const args = [query, options];
407
+ return renameKeysFromSDKRequestToRESTRequest(Object.assign(Object.assign({}, args === null || args === void 0 ? void 0 : args[1]), { query: args === null || args === void 0 ? void 0 : args[0] }), []);
408
+ },
409
+ responseTransformer: ({ data }) => renameKeysFromRESTResponseToSDKResponse({ items: data === null || data === void 0 ? void 0 : data.dataItems, pagingMetadata: data === null || data === void 0 ? void 0 : data.pagingMetadata }, ['dataItems.data']),
562
410
  errorTransformer: (err) => {
563
- const transformedError = transformError(err, requestTransformation);
411
+ const transformedError = sdkTransformError(err, {
412
+ spreadPathsToArguments: {},
413
+ explicitPathsToArguments: { query: '$[0]' },
414
+ singleArgumentUnchanged: false,
415
+ });
564
416
  throw transformedError;
565
417
  },
566
418
  pagingMethod: 'OFFSET',
567
419
  transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity),
568
- })({ cursorWithEmptyFilterAndSort: true });
420
+ });
569
421
  }
570
422
  /**
571
423
  * Runs an aggregation on a data collection and returns the resulting list of items.
@@ -583,51 +435,43 @@ export function queryDataItems(options) {
583
435
  export function aggregateDataItems(options) {
584
436
  var _a, _b, _c;
585
437
  return __awaiter(this, arguments, void 0, function* () {
586
- const requestTransformation = {
587
- dataCollectionId: '$[0].dataCollectionId',
588
- initialFilter: '$[0].initialFilter',
589
- aggregation: '$[0].aggregation',
590
- finalFilter: '$[0].finalFilter',
591
- paging: '$[0].paging',
592
- cursorPaging: '$[0].cursorPaging',
593
- sort: '$[0].sort',
594
- returnTotalCount: '$[0].returnTotalCount',
595
- consistentRead: '$[0].consistentRead',
596
- };
597
- const responseTransformation = '$';
598
438
  // @ts-ignore
599
439
  const { httpClient, sideEffects } = arguments[1];
600
- const { toAmbassadorRequest } = serializer({
601
- rootSchema: _aggregateDataItemsRequest,
602
- depSchemas: {},
603
- fqdnTransformation: {
604
- paths: [],
605
- transformation: _fromVeloEntity,
606
- },
607
- customTransformation: requestTransformation,
608
- });
609
- const { fromJSON } = serializer({
610
- rootSchema: _aggregateDataItemsResponse,
611
- depSchemas: {},
612
- fqdnTransformation: {
613
- paths: [],
614
- transformation: _toVeloEntity,
615
- },
616
- customTransformation: responseTransformation,
617
- });
618
- const payload = toAmbassadorRequest([options], []);
440
+ const payload = renameKeysFromSDKRequestToRESTRequest({
441
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
442
+ initialFilter: options === null || options === void 0 ? void 0 : options.initialFilter,
443
+ aggregation: options === null || options === void 0 ? void 0 : options.aggregation,
444
+ finalFilter: options === null || options === void 0 ? void 0 : options.finalFilter,
445
+ paging: options === null || options === void 0 ? void 0 : options.paging,
446
+ cursorPaging: options === null || options === void 0 ? void 0 : options.cursorPaging,
447
+ sort: options === null || options === void 0 ? void 0 : options.sort,
448
+ returnTotalCount: options === null || options === void 0 ? void 0 : options.returnTotalCount,
449
+ consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
450
+ }, []);
619
451
  const reqOpts = ambassadorWixDataV2DataItem.aggregateDataItems(payload);
620
452
  __log(`"AggregateDataItems" sending request with: ${__inspect(reqOpts)}`);
621
453
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
622
454
  try {
623
455
  const result = yield httpClient.request(reqOpts);
624
456
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
625
- return fromJSON(result.data, []);
457
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
626
458
  }
627
459
  catch (err) {
628
- const transformedError = transformError(err, requestTransformation, [
629
- 'options',
630
- ]);
460
+ const transformedError = sdkTransformError(err, {
461
+ spreadPathsToArguments: {},
462
+ explicitPathsToArguments: {
463
+ dataCollectionId: '$[0].dataCollectionId',
464
+ initialFilter: '$[0].initialFilter',
465
+ aggregation: '$[0].aggregation',
466
+ finalFilter: '$[0].finalFilter',
467
+ paging: '$[0].paging',
468
+ cursorPaging: '$[0].cursorPaging',
469
+ sort: '$[0].sort',
470
+ returnTotalCount: '$[0].returnTotalCount',
471
+ consistentRead: '$[0].consistentRead',
472
+ },
473
+ singleArgumentUnchanged: false,
474
+ }, ['options']);
631
475
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
632
476
  throw transformedError;
633
477
  }
@@ -647,45 +491,31 @@ export function aggregateDataItems(options) {
647
491
  export function countDataItems(options) {
648
492
  var _a, _b, _c;
649
493
  return __awaiter(this, arguments, void 0, function* () {
650
- const requestTransformation = {
651
- dataCollectionId: '$[0].dataCollectionId',
652
- filter: '$[0].filter',
653
- consistentRead: '$[0].consistentRead',
654
- };
655
- const responseTransformation = '$';
656
494
  // @ts-ignore
657
495
  const { httpClient, sideEffects } = arguments[1];
658
- const { toAmbassadorRequest } = serializer({
659
- rootSchema: _countDataItemsRequest,
660
- depSchemas: {},
661
- fqdnTransformation: {
662
- paths: [],
663
- transformation: _fromVeloEntity,
664
- },
665
- customTransformation: requestTransformation,
666
- });
667
- const { fromJSON } = serializer({
668
- rootSchema: _countDataItemsResponse,
669
- depSchemas: {},
670
- fqdnTransformation: {
671
- paths: [],
672
- transformation: _toVeloEntity,
673
- },
674
- customTransformation: responseTransformation,
675
- });
676
- const payload = toAmbassadorRequest([options], []);
496
+ const payload = renameKeysFromSDKRequestToRESTRequest({
497
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
498
+ filter: options === null || options === void 0 ? void 0 : options.filter,
499
+ consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
500
+ }, []);
677
501
  const reqOpts = ambassadorWixDataV2DataItem.countDataItems(payload);
678
502
  __log(`"CountDataItems" sending request with: ${__inspect(reqOpts)}`);
679
503
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
680
504
  try {
681
505
  const result = yield httpClient.request(reqOpts);
682
506
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
683
- return fromJSON(result.data, []);
507
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
684
508
  }
685
509
  catch (err) {
686
- const transformedError = transformError(err, requestTransformation, [
687
- 'options',
688
- ]);
510
+ const transformedError = sdkTransformError(err, {
511
+ spreadPathsToArguments: {},
512
+ explicitPathsToArguments: {
513
+ dataCollectionId: '$[0].dataCollectionId',
514
+ filter: '$[0].filter',
515
+ consistentRead: '$[0].consistentRead',
516
+ },
517
+ singleArgumentUnchanged: false,
518
+ }, ['options']);
689
519
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
690
520
  throw transformedError;
691
521
  }
@@ -713,50 +543,41 @@ export function countDataItems(options) {
713
543
  export function queryDistinctValues(options) {
714
544
  var _a, _b, _c;
715
545
  return __awaiter(this, arguments, void 0, function* () {
716
- const requestTransformation = {
717
- dataCollectionId: '$[0].dataCollectionId',
718
- fieldName: '$[0].fieldName',
719
- filter: '$[0].filter',
720
- order: '$[0].order',
721
- paging: '$[0].paging',
722
- cursorPaging: '$[0].cursorPaging',
723
- returnTotalCount: '$[0].returnTotalCount',
724
- consistentRead: '$[0].consistentRead',
725
- };
726
- const responseTransformation = '$';
727
546
  // @ts-ignore
728
547
  const { httpClient, sideEffects } = arguments[1];
729
- const { toAmbassadorRequest } = serializer({
730
- rootSchema: _queryDistinctValuesRequest,
731
- depSchemas: {},
732
- fqdnTransformation: {
733
- paths: [],
734
- transformation: _fromVeloEntity,
735
- },
736
- customTransformation: requestTransformation,
737
- });
738
- const { fromJSON } = serializer({
739
- rootSchema: _queryDistinctValuesResponse,
740
- depSchemas: {},
741
- fqdnTransformation: {
742
- paths: [],
743
- transformation: _toVeloEntity,
744
- },
745
- customTransformation: responseTransformation,
746
- });
747
- const payload = toAmbassadorRequest([options], []);
548
+ const payload = renameKeysFromSDKRequestToRESTRequest({
549
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
550
+ fieldName: options === null || options === void 0 ? void 0 : options.fieldName,
551
+ filter: options === null || options === void 0 ? void 0 : options.filter,
552
+ order: options === null || options === void 0 ? void 0 : options.order,
553
+ paging: options === null || options === void 0 ? void 0 : options.paging,
554
+ cursorPaging: options === null || options === void 0 ? void 0 : options.cursorPaging,
555
+ returnTotalCount: options === null || options === void 0 ? void 0 : options.returnTotalCount,
556
+ consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
557
+ }, []);
748
558
  const reqOpts = ambassadorWixDataV2DataItem.queryDistinctValues(payload);
749
559
  __log(`"QueryDistinctValues" sending request with: ${__inspect(reqOpts)}`);
750
560
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
751
561
  try {
752
562
  const result = yield httpClient.request(reqOpts);
753
563
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
754
- return fromJSON(result.data, []);
564
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
755
565
  }
756
566
  catch (err) {
757
- const transformedError = transformError(err, requestTransformation, [
758
- 'options',
759
- ]);
567
+ const transformedError = sdkTransformError(err, {
568
+ spreadPathsToArguments: {},
569
+ explicitPathsToArguments: {
570
+ dataCollectionId: '$[0].dataCollectionId',
571
+ fieldName: '$[0].fieldName',
572
+ filter: '$[0].filter',
573
+ order: '$[0].order',
574
+ paging: '$[0].paging',
575
+ cursorPaging: '$[0].cursorPaging',
576
+ returnTotalCount: '$[0].returnTotalCount',
577
+ consistentRead: '$[0].consistentRead',
578
+ },
579
+ singleArgumentUnchanged: false,
580
+ }, ['options']);
760
581
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
761
582
  throw transformedError;
762
583
  }
@@ -779,45 +600,33 @@ export function queryDistinctValues(options) {
779
600
  export function bulkInsertDataItems(options) {
780
601
  var _a, _b, _c;
781
602
  return __awaiter(this, arguments, void 0, function* () {
782
- const requestTransformation = {
783
- dataCollectionId: '$[0].dataCollectionId',
784
- dataItems: '$[0].dataItems',
785
- returnEntity: '$[0].returnEntity',
786
- };
787
- const responseTransformation = '$';
788
603
  // @ts-ignore
789
604
  const { httpClient, sideEffects } = arguments[1];
790
- const { toAmbassadorRequest } = serializer({
791
- rootSchema: _bulkInsertDataItemsRequest,
792
- depSchemas: {},
793
- fqdnTransformation: {
794
- paths: [...['Array#dataItems']],
795
- transformation: _fromVeloEntity,
796
- },
797
- customTransformation: requestTransformation,
798
- });
799
- const { fromJSON } = serializer({
800
- rootSchema: _bulkInsertDataItemsResponse,
801
- depSchemas: {},
802
- fqdnTransformation: {
803
- paths: [...['Array#results.dataItem']],
804
- transformation: _toVeloEntity,
805
- },
806
- customTransformation: responseTransformation,
807
- });
808
- const payload = toAmbassadorRequest([options], ['dataItems.data']);
605
+ const payload = renameKeysFromSDKRequestToRESTRequest({
606
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
607
+ dataItems: options === null || options === void 0 ? void 0 : options.dataItems,
608
+ returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
609
+ }, ['dataItems.data']);
809
610
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItems(payload);
810
611
  __log(`"BulkInsertDataItems" sending request with: ${__inspect(reqOpts)}`);
811
612
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
812
613
  try {
813
614
  const result = yield httpClient.request(reqOpts);
814
615
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
815
- return fromJSON(result.data, ['results.dataItem.data']);
616
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
617
+ 'results.dataItem.data',
618
+ ]);
816
619
  }
817
620
  catch (err) {
818
- const transformedError = transformError(err, requestTransformation, [
819
- 'options',
820
- ]);
621
+ const transformedError = sdkTransformError(err, {
622
+ spreadPathsToArguments: {},
623
+ explicitPathsToArguments: {
624
+ dataCollectionId: '$[0].dataCollectionId',
625
+ dataItems: '$[0].dataItems',
626
+ returnEntity: '$[0].returnEntity',
627
+ },
628
+ singleArgumentUnchanged: false,
629
+ }, ['options']);
821
630
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
822
631
  throw transformedError;
823
632
  }
@@ -848,45 +657,33 @@ export function bulkInsertDataItems(options) {
848
657
  export function bulkUpdateDataItems(options) {
849
658
  var _a, _b, _c;
850
659
  return __awaiter(this, arguments, void 0, function* () {
851
- const requestTransformation = {
852
- dataCollectionId: '$[0].dataCollectionId',
853
- dataItems: '$[0].dataItems',
854
- returnEntity: '$[0].returnEntity',
855
- };
856
- const responseTransformation = '$';
857
660
  // @ts-ignore
858
661
  const { httpClient, sideEffects } = arguments[1];
859
- const { toAmbassadorRequest } = serializer({
860
- rootSchema: _bulkUpdateDataItemsRequest,
861
- depSchemas: {},
862
- fqdnTransformation: {
863
- paths: [...['Array#dataItems']],
864
- transformation: _fromVeloEntity,
865
- },
866
- customTransformation: requestTransformation,
867
- });
868
- const { fromJSON } = serializer({
869
- rootSchema: _bulkUpdateDataItemsResponse,
870
- depSchemas: {},
871
- fqdnTransformation: {
872
- paths: [...['Array#results.dataItem']],
873
- transformation: _toVeloEntity,
874
- },
875
- customTransformation: responseTransformation,
876
- });
877
- const payload = toAmbassadorRequest([options], ['dataItems.data']);
662
+ const payload = renameKeysFromSDKRequestToRESTRequest({
663
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
664
+ dataItems: options === null || options === void 0 ? void 0 : options.dataItems,
665
+ returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
666
+ }, ['dataItems.data']);
878
667
  const reqOpts = ambassadorWixDataV2DataItem.bulkUpdateDataItems(payload);
879
668
  __log(`"BulkUpdateDataItems" sending request with: ${__inspect(reqOpts)}`);
880
669
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
881
670
  try {
882
671
  const result = yield httpClient.request(reqOpts);
883
672
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
884
- return fromJSON(result.data, ['results.dataItem.data']);
673
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
674
+ 'results.dataItem.data',
675
+ ]);
885
676
  }
886
677
  catch (err) {
887
- const transformedError = transformError(err, requestTransformation, [
888
- 'options',
889
- ]);
678
+ const transformedError = sdkTransformError(err, {
679
+ spreadPathsToArguments: {},
680
+ explicitPathsToArguments: {
681
+ dataCollectionId: '$[0].dataCollectionId',
682
+ dataItems: '$[0].dataItems',
683
+ returnEntity: '$[0].returnEntity',
684
+ },
685
+ singleArgumentUnchanged: false,
686
+ }, ['options']);
890
687
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
891
688
  throw transformedError;
892
689
  }
@@ -917,45 +714,33 @@ export function bulkUpdateDataItems(options) {
917
714
  export function bulkSaveDataItems(options) {
918
715
  var _a, _b, _c;
919
716
  return __awaiter(this, arguments, void 0, function* () {
920
- const requestTransformation = {
921
- dataCollectionId: '$[0].dataCollectionId',
922
- dataItems: '$[0].dataItems',
923
- returnEntity: '$[0].returnEntity',
924
- };
925
- const responseTransformation = '$';
926
717
  // @ts-ignore
927
718
  const { httpClient, sideEffects } = arguments[1];
928
- const { toAmbassadorRequest } = serializer({
929
- rootSchema: _bulkSaveDataItemsRequest,
930
- depSchemas: {},
931
- fqdnTransformation: {
932
- paths: [...['Array#dataItems']],
933
- transformation: _fromVeloEntity,
934
- },
935
- customTransformation: requestTransformation,
936
- });
937
- const { fromJSON } = serializer({
938
- rootSchema: _bulkSaveDataItemsResponse,
939
- depSchemas: {},
940
- fqdnTransformation: {
941
- paths: [...['Array#results.dataItem']],
942
- transformation: _toVeloEntity,
943
- },
944
- customTransformation: responseTransformation,
945
- });
946
- const payload = toAmbassadorRequest([options], ['dataItems.data']);
719
+ const payload = renameKeysFromSDKRequestToRESTRequest({
720
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
721
+ dataItems: options === null || options === void 0 ? void 0 : options.dataItems,
722
+ returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
723
+ }, ['dataItems.data']);
947
724
  const reqOpts = ambassadorWixDataV2DataItem.bulkSaveDataItems(payload);
948
725
  __log(`"BulkSaveDataItems" sending request with: ${__inspect(reqOpts)}`);
949
726
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
950
727
  try {
951
728
  const result = yield httpClient.request(reqOpts);
952
729
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
953
- return fromJSON(result.data, ['results.dataItem.data']);
730
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
731
+ 'results.dataItem.data',
732
+ ]);
954
733
  }
955
734
  catch (err) {
956
- const transformedError = transformError(err, requestTransformation, [
957
- 'options',
958
- ]);
735
+ const transformedError = sdkTransformError(err, {
736
+ spreadPathsToArguments: {},
737
+ explicitPathsToArguments: {
738
+ dataCollectionId: '$[0].dataCollectionId',
739
+ dataItems: '$[0].dataItems',
740
+ returnEntity: '$[0].returnEntity',
741
+ },
742
+ singleArgumentUnchanged: false,
743
+ }, ['options']);
959
744
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
960
745
  throw transformedError;
961
746
  }
@@ -980,44 +765,31 @@ export function bulkSaveDataItems(options) {
980
765
  export function bulkRemoveDataItems(options) {
981
766
  var _a, _b, _c;
982
767
  return __awaiter(this, arguments, void 0, function* () {
983
- const requestTransformation = {
984
- dataCollectionId: '$[0].dataCollectionId',
985
- dataItemIds: '$[0].dataItemIds',
986
- };
987
- const responseTransformation = '$';
988
768
  // @ts-ignore
989
769
  const { httpClient, sideEffects } = arguments[1];
990
- const { toAmbassadorRequest } = serializer({
991
- rootSchema: _bulkRemoveDataItemsRequest,
992
- depSchemas: {},
993
- fqdnTransformation: {
994
- paths: [],
995
- transformation: _fromVeloEntity,
996
- },
997
- customTransformation: requestTransformation,
998
- });
999
- const { fromJSON } = serializer({
1000
- rootSchema: _bulkRemoveDataItemsResponse,
1001
- depSchemas: {},
1002
- fqdnTransformation: {
1003
- paths: [...['Array#results.dataItem']],
1004
- transformation: _toVeloEntity,
1005
- },
1006
- customTransformation: responseTransformation,
1007
- });
1008
- const payload = toAmbassadorRequest([options], []);
770
+ const payload = renameKeysFromSDKRequestToRESTRequest({
771
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
772
+ dataItemIds: options === null || options === void 0 ? void 0 : options.dataItemIds,
773
+ }, []);
1009
774
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItems(payload);
1010
775
  __log(`"BulkRemoveDataItems" sending request with: ${__inspect(reqOpts)}`);
1011
776
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1012
777
  try {
1013
778
  const result = yield httpClient.request(reqOpts);
1014
779
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1015
- return fromJSON(result.data, ['results.dataItem.data']);
780
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
781
+ 'results.dataItem.data',
782
+ ]);
1016
783
  }
1017
784
  catch (err) {
1018
- const transformedError = transformError(err, requestTransformation, [
1019
- 'options',
1020
- ]);
785
+ const transformedError = sdkTransformError(err, {
786
+ spreadPathsToArguments: {},
787
+ explicitPathsToArguments: {
788
+ dataCollectionId: '$[0].dataCollectionId',
789
+ dataItemIds: '$[0].dataItemIds',
790
+ },
791
+ singleArgumentUnchanged: false,
792
+ }, ['options']);
1021
793
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1022
794
  throw transformedError;
1023
795
  }
@@ -1045,50 +817,43 @@ export function bulkRemoveDataItems(options) {
1045
817
  export function queryReferencedDataItems(options) {
1046
818
  var _a, _b, _c;
1047
819
  return __awaiter(this, arguments, void 0, function* () {
1048
- const requestTransformation = {
1049
- dataCollectionId: '$[0].dataCollectionId',
1050
- referringItemId: '$[0].referringItemId',
1051
- referringItemFieldName: '$[0].referringItemFieldName',
1052
- order: '$[0].order',
1053
- paging: '$[0].paging',
1054
- cursorPaging: '$[0].cursorPaging',
1055
- returnTotalCount: '$[0].returnTotalCount',
1056
- consistentRead: '$[0].consistentRead',
1057
- };
1058
- const responseTransformation = '$';
1059
820
  // @ts-ignore
1060
821
  const { httpClient, sideEffects } = arguments[1];
1061
- const { toAmbassadorRequest } = serializer({
1062
- rootSchema: _queryReferencedDataItemsRequest,
1063
- depSchemas: {},
1064
- fqdnTransformation: {
1065
- paths: [],
1066
- transformation: _fromVeloEntity,
1067
- },
1068
- customTransformation: requestTransformation,
1069
- });
1070
- const { fromJSON } = serializer({
1071
- rootSchema: _queryReferencedDataItemsResponse,
1072
- depSchemas: {},
1073
- fqdnTransformation: {
1074
- paths: [...['Array#results.dataItem']],
1075
- transformation: _toVeloEntity,
1076
- },
1077
- customTransformation: responseTransformation,
1078
- });
1079
- const payload = toAmbassadorRequest([options], []);
822
+ const payload = renameKeysFromSDKRequestToRESTRequest({
823
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
824
+ referringItemId: options === null || options === void 0 ? void 0 : options.referringItemId,
825
+ referringItemFieldName: options === null || options === void 0 ? void 0 : options.referringItemFieldName,
826
+ order: options === null || options === void 0 ? void 0 : options.order,
827
+ paging: options === null || options === void 0 ? void 0 : options.paging,
828
+ cursorPaging: options === null || options === void 0 ? void 0 : options.cursorPaging,
829
+ returnTotalCount: options === null || options === void 0 ? void 0 : options.returnTotalCount,
830
+ consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
831
+ }, []);
1080
832
  const reqOpts = ambassadorWixDataV2DataItem.queryReferencedDataItems(payload);
1081
833
  __log(`"QueryReferencedDataItems" sending request with: ${__inspect(reqOpts)}`);
1082
834
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1083
835
  try {
1084
836
  const result = yield httpClient.request(reqOpts);
1085
837
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1086
- return fromJSON(result.data, ['results.dataItem.data']);
838
+ return renameKeysFromRESTResponseToSDKResponse(result.data, [
839
+ 'results.dataItem.data',
840
+ ]);
1087
841
  }
1088
842
  catch (err) {
1089
- const transformedError = transformError(err, requestTransformation, [
1090
- 'options',
1091
- ]);
843
+ const transformedError = sdkTransformError(err, {
844
+ spreadPathsToArguments: {},
845
+ explicitPathsToArguments: {
846
+ dataCollectionId: '$[0].dataCollectionId',
847
+ referringItemId: '$[0].referringItemId',
848
+ referringItemFieldName: '$[0].referringItemFieldName',
849
+ order: '$[0].order',
850
+ paging: '$[0].paging',
851
+ cursorPaging: '$[0].cursorPaging',
852
+ returnTotalCount: '$[0].returnTotalCount',
853
+ consistentRead: '$[0].consistentRead',
854
+ },
855
+ singleArgumentUnchanged: false,
856
+ }, ['options']);
1092
857
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1093
858
  throw transformedError;
1094
859
  }
@@ -1111,47 +876,35 @@ export function queryReferencedDataItems(options) {
1111
876
  export function isReferencedDataItem(options) {
1112
877
  var _a, _b, _c;
1113
878
  return __awaiter(this, arguments, void 0, function* () {
1114
- const requestTransformation = {
1115
- dataCollectionId: '$[0].dataCollectionId',
1116
- referringItemFieldName: '$[0].referringItemFieldName',
1117
- referringItemId: '$[0].referringItemId',
1118
- referencedItemId: '$[0].referencedItemId',
1119
- consistentRead: '$[0].consistentRead',
1120
- };
1121
- const responseTransformation = '$';
1122
879
  // @ts-ignore
1123
880
  const { httpClient, sideEffects } = arguments[1];
1124
- const { toAmbassadorRequest } = serializer({
1125
- rootSchema: _isReferencedDataItemRequest,
1126
- depSchemas: {},
1127
- fqdnTransformation: {
1128
- paths: [],
1129
- transformation: _fromVeloEntity,
1130
- },
1131
- customTransformation: requestTransformation,
1132
- });
1133
- const { fromJSON } = serializer({
1134
- rootSchema: _isReferencedDataItemResponse,
1135
- depSchemas: {},
1136
- fqdnTransformation: {
1137
- paths: [],
1138
- transformation: _toVeloEntity,
1139
- },
1140
- customTransformation: responseTransformation,
1141
- });
1142
- const payload = toAmbassadorRequest([options], []);
881
+ const payload = renameKeysFromSDKRequestToRESTRequest({
882
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
883
+ referringItemFieldName: options === null || options === void 0 ? void 0 : options.referringItemFieldName,
884
+ referringItemId: options === null || options === void 0 ? void 0 : options.referringItemId,
885
+ referencedItemId: options === null || options === void 0 ? void 0 : options.referencedItemId,
886
+ consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
887
+ }, []);
1143
888
  const reqOpts = ambassadorWixDataV2DataItem.isReferencedDataItem(payload);
1144
889
  __log(`"IsReferencedDataItem" sending request with: ${__inspect(reqOpts)}`);
1145
890
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1146
891
  try {
1147
892
  const result = yield httpClient.request(reqOpts);
1148
893
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1149
- return fromJSON(result.data, []);
894
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1150
895
  }
1151
896
  catch (err) {
1152
- const transformedError = transformError(err, requestTransformation, [
1153
- 'options',
1154
- ]);
897
+ const transformedError = sdkTransformError(err, {
898
+ spreadPathsToArguments: {},
899
+ explicitPathsToArguments: {
900
+ dataCollectionId: '$[0].dataCollectionId',
901
+ referringItemFieldName: '$[0].referringItemFieldName',
902
+ referringItemId: '$[0].referringItemId',
903
+ referencedItemId: '$[0].referencedItemId',
904
+ consistentRead: '$[0].consistentRead',
905
+ },
906
+ singleArgumentUnchanged: false,
907
+ }, ['options']);
1155
908
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1156
909
  throw transformedError;
1157
910
  }
@@ -1175,44 +928,29 @@ export function isReferencedDataItem(options) {
1175
928
  export function insertDataItemReference(options) {
1176
929
  var _a, _b, _c;
1177
930
  return __awaiter(this, arguments, void 0, function* () {
1178
- const requestTransformation = {
1179
- dataCollectionId: '$[0].dataCollectionId',
1180
- dataItemReference: '$[0].dataItemReference',
1181
- };
1182
- const responseTransformation = '$';
1183
931
  // @ts-ignore
1184
932
  const { httpClient, sideEffects } = arguments[1];
1185
- const { toAmbassadorRequest } = serializer({
1186
- rootSchema: _insertDataItemReferenceRequest,
1187
- depSchemas: {},
1188
- fqdnTransformation: {
1189
- paths: [],
1190
- transformation: _fromVeloEntity,
1191
- },
1192
- customTransformation: requestTransformation,
1193
- });
1194
- const { fromJSON } = serializer({
1195
- rootSchema: _insertDataItemReferenceResponse,
1196
- depSchemas: {},
1197
- fqdnTransformation: {
1198
- paths: [],
1199
- transformation: _toVeloEntity,
1200
- },
1201
- customTransformation: responseTransformation,
1202
- });
1203
- const payload = toAmbassadorRequest([options], []);
933
+ const payload = renameKeysFromSDKRequestToRESTRequest({
934
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
935
+ dataItemReference: options === null || options === void 0 ? void 0 : options.dataItemReference,
936
+ }, []);
1204
937
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItemReference(payload);
1205
938
  __log(`"InsertDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1206
939
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1207
940
  try {
1208
941
  const result = yield httpClient.request(reqOpts);
1209
942
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1210
- return fromJSON(result.data, []);
943
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1211
944
  }
1212
945
  catch (err) {
1213
- const transformedError = transformError(err, requestTransformation, [
1214
- 'options',
1215
- ]);
946
+ const transformedError = sdkTransformError(err, {
947
+ spreadPathsToArguments: {},
948
+ explicitPathsToArguments: {
949
+ dataCollectionId: '$[0].dataCollectionId',
950
+ dataItemReference: '$[0].dataItemReference',
951
+ },
952
+ singleArgumentUnchanged: false,
953
+ }, ['options']);
1216
954
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1217
955
  throw transformedError;
1218
956
  }
@@ -1235,44 +973,29 @@ export function insertDataItemReference(options) {
1235
973
  export function removeDataItemReference(options) {
1236
974
  var _a, _b, _c;
1237
975
  return __awaiter(this, arguments, void 0, function* () {
1238
- const requestTransformation = {
1239
- dataCollectionId: '$[0].dataCollectionId',
1240
- dataItemReference: '$[0].dataItemReference',
1241
- };
1242
- const responseTransformation = '$';
1243
976
  // @ts-ignore
1244
977
  const { httpClient, sideEffects } = arguments[1];
1245
- const { toAmbassadorRequest } = serializer({
1246
- rootSchema: _removeDataItemReferenceRequest,
1247
- depSchemas: {},
1248
- fqdnTransformation: {
1249
- paths: [],
1250
- transformation: _fromVeloEntity,
1251
- },
1252
- customTransformation: requestTransformation,
1253
- });
1254
- const { fromJSON } = serializer({
1255
- rootSchema: _removeDataItemReferenceResponse,
1256
- depSchemas: {},
1257
- fqdnTransformation: {
1258
- paths: [],
1259
- transformation: _toVeloEntity,
1260
- },
1261
- customTransformation: responseTransformation,
1262
- });
1263
- const payload = toAmbassadorRequest([options], []);
978
+ const payload = renameKeysFromSDKRequestToRESTRequest({
979
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
980
+ dataItemReference: options === null || options === void 0 ? void 0 : options.dataItemReference,
981
+ }, []);
1264
982
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItemReference(payload);
1265
983
  __log(`"RemoveDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1266
984
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1267
985
  try {
1268
986
  const result = yield httpClient.request(reqOpts);
1269
987
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1270
- return fromJSON(result.data, []);
988
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1271
989
  }
1272
990
  catch (err) {
1273
- const transformedError = transformError(err, requestTransformation, [
1274
- 'options',
1275
- ]);
991
+ const transformedError = sdkTransformError(err, {
992
+ spreadPathsToArguments: {},
993
+ explicitPathsToArguments: {
994
+ dataCollectionId: '$[0].dataCollectionId',
995
+ dataItemReference: '$[0].dataItemReference',
996
+ },
997
+ singleArgumentUnchanged: false,
998
+ }, ['options']);
1276
999
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1277
1000
  throw transformedError;
1278
1001
  }
@@ -1298,45 +1021,31 @@ export function removeDataItemReference(options) {
1298
1021
  export function bulkInsertDataItemReferences(options) {
1299
1022
  var _a, _b, _c;
1300
1023
  return __awaiter(this, arguments, void 0, function* () {
1301
- const requestTransformation = {
1302
- dataCollectionId: '$[0].dataCollectionId',
1303
- dataItemReferences: '$[0].dataItemReferences',
1304
- returnEntity: '$[0].returnEntity',
1305
- };
1306
- const responseTransformation = '$';
1307
1024
  // @ts-ignore
1308
1025
  const { httpClient, sideEffects } = arguments[1];
1309
- const { toAmbassadorRequest } = serializer({
1310
- rootSchema: _bulkInsertDataItemReferencesRequest,
1311
- depSchemas: {},
1312
- fqdnTransformation: {
1313
- paths: [],
1314
- transformation: _fromVeloEntity,
1315
- },
1316
- customTransformation: requestTransformation,
1317
- });
1318
- const { fromJSON } = serializer({
1319
- rootSchema: _bulkInsertDataItemReferencesResponse,
1320
- depSchemas: {},
1321
- fqdnTransformation: {
1322
- paths: [],
1323
- transformation: _toVeloEntity,
1324
- },
1325
- customTransformation: responseTransformation,
1326
- });
1327
- const payload = toAmbassadorRequest([options], []);
1026
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1027
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1028
+ dataItemReferences: options === null || options === void 0 ? void 0 : options.dataItemReferences,
1029
+ returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
1030
+ }, []);
1328
1031
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItemReferences(payload);
1329
1032
  __log(`"BulkInsertDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1330
1033
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1331
1034
  try {
1332
1035
  const result = yield httpClient.request(reqOpts);
1333
1036
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1334
- return fromJSON(result.data, []);
1037
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1335
1038
  }
1336
1039
  catch (err) {
1337
- const transformedError = transformError(err, requestTransformation, [
1338
- 'options',
1339
- ]);
1040
+ const transformedError = sdkTransformError(err, {
1041
+ spreadPathsToArguments: {},
1042
+ explicitPathsToArguments: {
1043
+ dataCollectionId: '$[0].dataCollectionId',
1044
+ dataItemReferences: '$[0].dataItemReferences',
1045
+ returnEntity: '$[0].returnEntity',
1046
+ },
1047
+ singleArgumentUnchanged: false,
1048
+ }, ['options']);
1340
1049
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1341
1050
  throw transformedError;
1342
1051
  }
@@ -1359,44 +1068,29 @@ export function bulkInsertDataItemReferences(options) {
1359
1068
  export function bulkRemoveDataItemReferences(options) {
1360
1069
  var _a, _b, _c;
1361
1070
  return __awaiter(this, arguments, void 0, function* () {
1362
- const requestTransformation = {
1363
- dataCollectionId: '$[0].dataCollectionId',
1364
- dataItemReferences: '$[0].dataItemReferences',
1365
- };
1366
- const responseTransformation = '$';
1367
1071
  // @ts-ignore
1368
1072
  const { httpClient, sideEffects } = arguments[1];
1369
- const { toAmbassadorRequest } = serializer({
1370
- rootSchema: _bulkRemoveDataItemReferencesRequest,
1371
- depSchemas: {},
1372
- fqdnTransformation: {
1373
- paths: [],
1374
- transformation: _fromVeloEntity,
1375
- },
1376
- customTransformation: requestTransformation,
1377
- });
1378
- const { fromJSON } = serializer({
1379
- rootSchema: _bulkRemoveDataItemReferencesResponse,
1380
- depSchemas: {},
1381
- fqdnTransformation: {
1382
- paths: [],
1383
- transformation: _toVeloEntity,
1384
- },
1385
- customTransformation: responseTransformation,
1386
- });
1387
- const payload = toAmbassadorRequest([options], []);
1073
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1074
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1075
+ dataItemReferences: options === null || options === void 0 ? void 0 : options.dataItemReferences,
1076
+ }, []);
1388
1077
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItemReferences(payload);
1389
1078
  __log(`"BulkRemoveDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1390
1079
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1391
1080
  try {
1392
1081
  const result = yield httpClient.request(reqOpts);
1393
1082
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1394
- return fromJSON(result.data, []);
1083
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1395
1084
  }
1396
1085
  catch (err) {
1397
- const transformedError = transformError(err, requestTransformation, [
1398
- 'options',
1399
- ]);
1086
+ const transformedError = sdkTransformError(err, {
1087
+ spreadPathsToArguments: {},
1088
+ explicitPathsToArguments: {
1089
+ dataCollectionId: '$[0].dataCollectionId',
1090
+ dataItemReferences: '$[0].dataItemReferences',
1091
+ },
1092
+ singleArgumentUnchanged: false,
1093
+ }, ['options']);
1400
1094
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1401
1095
  throw transformedError;
1402
1096
  }
@@ -1422,46 +1116,33 @@ export function bulkRemoveDataItemReferences(options) {
1422
1116
  export function replaceDataItemReferences(options) {
1423
1117
  var _a, _b, _c;
1424
1118
  return __awaiter(this, arguments, void 0, function* () {
1425
- const requestTransformation = {
1426
- dataCollectionId: '$[0].dataCollectionId',
1427
- referringItemFieldName: '$[0].referringItemFieldName',
1428
- referringItemId: '$[0].referringItemId',
1429
- newReferencedItemIds: '$[0].newReferencedItemIds',
1430
- };
1431
- const responseTransformation = '$';
1432
1119
  // @ts-ignore
1433
1120
  const { httpClient, sideEffects } = arguments[1];
1434
- const { toAmbassadorRequest } = serializer({
1435
- rootSchema: _replaceDataItemReferencesRequest,
1436
- depSchemas: {},
1437
- fqdnTransformation: {
1438
- paths: [],
1439
- transformation: _fromVeloEntity,
1440
- },
1441
- customTransformation: requestTransformation,
1442
- });
1443
- const { fromJSON } = serializer({
1444
- rootSchema: _replaceDataItemReferencesResponse,
1445
- depSchemas: {},
1446
- fqdnTransformation: {
1447
- paths: [],
1448
- transformation: _toVeloEntity,
1449
- },
1450
- customTransformation: responseTransformation,
1451
- });
1452
- const payload = toAmbassadorRequest([options], []);
1121
+ const payload = renameKeysFromSDKRequestToRESTRequest({
1122
+ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1123
+ referringItemFieldName: options === null || options === void 0 ? void 0 : options.referringItemFieldName,
1124
+ referringItemId: options === null || options === void 0 ? void 0 : options.referringItemId,
1125
+ newReferencedItemIds: options === null || options === void 0 ? void 0 : options.newReferencedItemIds,
1126
+ }, []);
1453
1127
  const reqOpts = ambassadorWixDataV2DataItem.replaceDataItemReferences(payload);
1454
1128
  __log(`"ReplaceDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1455
1129
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1456
1130
  try {
1457
1131
  const result = yield httpClient.request(reqOpts);
1458
1132
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1459
- return fromJSON(result.data, []);
1133
+ return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1460
1134
  }
1461
1135
  catch (err) {
1462
- const transformedError = transformError(err, requestTransformation, [
1463
- 'options',
1464
- ]);
1136
+ const transformedError = sdkTransformError(err, {
1137
+ spreadPathsToArguments: {},
1138
+ explicitPathsToArguments: {
1139
+ dataCollectionId: '$[0].dataCollectionId',
1140
+ referringItemFieldName: '$[0].referringItemFieldName',
1141
+ referringItemId: '$[0].referringItemId',
1142
+ newReferencedItemIds: '$[0].newReferencedItemIds',
1143
+ },
1144
+ singleArgumentUnchanged: false,
1145
+ }, ['options']);
1465
1146
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1466
1147
  throw transformedError;
1467
1148
  }