@wix/data 1.0.62 → 1.0.64

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 +1 -5
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/index.typings.js +1 -5
  4. package/build/cjs/index.typings.js.map +1 -1
  5. package/build/cjs/meta.js +1 -5
  6. package/build/cjs/meta.js.map +1 -1
  7. package/build/cjs/src/data-v1-external-database-connection.http.js +54 -14
  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 +1 -5
  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 +149 -53
  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 +29 -10
  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 +1 -5
  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 +48 -43
  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 +190 -46
  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 +1 -5
  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 +669 -354
  38. package/build/cjs/src/data-v2-data-item.universal.js.map +1 -1
  39. package/build/cjs/src/data-v2-index.http.js +28 -10
  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 +1 -5
  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 +93 -43
  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 +54 -14
  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 +144 -44
  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 +29 -10
  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 +34 -25
  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 +190 -46
  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 +665 -346
  68. package/build/es/src/data-v2-data-item.universal.js.map +1 -1
  69. package/build/es/src/data-v2-index.http.js +28 -10
  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 +89 -35
  74. package/build/es/src/data-v2-index.universal.js.map +1 -1
  75. package/package.json +6 -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 { resolveQueryFieldsTransformationPaths } from '@wix/metro-runtime/velo';
11
- import { transformError as sdkTransformError, renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, queryBuilder, } from '@wix/sdk-runtime';
10
+ import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo';
12
11
  import * as ambassadorWixDataV2DataItem from './data-v2-data-item.http';
13
12
  // @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,6 +25,7 @@ export const __debug = {
25
25
  },
26
26
  };
27
27
  const _toVeloEntity = '$';
28
+ const _fromVeloEntity = '$';
28
29
  export var Environment;
29
30
  (function (Environment) {
30
31
  Environment["LIVE"] = "LIVE";
@@ -48,6 +49,48 @@ export var BulkActionType;
48
49
  BulkActionType["UPDATE"] = "UPDATE";
49
50
  BulkActionType["DELETE"] = "DELETE";
50
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 = {};
51
94
  /**
52
95
  * Adds an item to a collection.
53
96
  *
@@ -72,31 +115,44 @@ export var BulkActionType;
72
115
  export function insertDataItem(options) {
73
116
  var _a, _b, _c;
74
117
  return __awaiter(this, arguments, void 0, function* () {
118
+ const requestTransformation = {
119
+ dataCollectionId: '$[0].dataCollectionId',
120
+ dataItem: '$[0].dataItem',
121
+ };
122
+ const responseTransformation = '$';
75
123
  // @ts-ignore
76
124
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
81
144
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItem(payload);
82
145
  __log(`"InsertDataItem" sending request with: ${__inspect(reqOpts)}`);
83
146
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
84
147
  try {
85
148
  const result = yield httpClient.request(reqOpts);
86
149
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
87
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
88
- 'dataItem.data',
89
- ]);
150
+ return fromJSON(result.data, ['dataItem.data']);
90
151
  }
91
152
  catch (err) {
92
- const transformedError = sdkTransformError(err, {
93
- spreadPathsToArguments: {},
94
- explicitPathsToArguments: {
95
- dataCollectionId: '$[0].dataCollectionId',
96
- dataItem: '$[0].dataItem',
97
- },
98
- singleArgumentUnchanged: false,
99
- }, ['options']);
153
+ const transformedError = transformError(err, requestTransformation, [
154
+ 'options',
155
+ ]);
100
156
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
101
157
  throw transformedError;
102
158
  }
@@ -131,31 +187,45 @@ export function insertDataItem(options) {
131
187
  export function updateDataItem(_id, options) {
132
188
  var _a, _b, _c;
133
189
  return __awaiter(this, arguments, void 0, function* () {
190
+ const requestTransformation = {
191
+ dataItem: { '*': '$[1].dataItem', id: '$[0]' },
192
+ dataCollectionId: '$[1].dataCollectionId',
193
+ };
194
+ const responseTransformation = '$';
134
195
  // @ts-ignore
135
196
  const { httpClient, sideEffects } = arguments[2];
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']);
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']);
140
216
  const reqOpts = ambassadorWixDataV2DataItem.updateDataItem(payload);
141
217
  __log(`"UpdateDataItem" sending request with: ${__inspect(reqOpts)}`);
142
218
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
143
219
  try {
144
220
  const result = yield httpClient.request(reqOpts);
145
221
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
146
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
147
- 'dataItem.data',
148
- ]);
222
+ return fromJSON(result.data, ['dataItem.data']);
149
223
  }
150
224
  catch (err) {
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']);
225
+ const transformedError = transformError(err, requestTransformation, [
226
+ '_id',
227
+ 'options',
228
+ ]);
159
229
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
160
230
  throw transformedError;
161
231
  }
@@ -187,31 +257,44 @@ export function updateDataItem(_id, options) {
187
257
  export function saveDataItem(options) {
188
258
  var _a, _b, _c;
189
259
  return __awaiter(this, arguments, void 0, function* () {
260
+ const requestTransformation = {
261
+ dataCollectionId: '$[0].dataCollectionId',
262
+ dataItem: '$[0].dataItem',
263
+ };
264
+ const responseTransformation = '$';
190
265
  // @ts-ignore
191
266
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
196
286
  const reqOpts = ambassadorWixDataV2DataItem.saveDataItem(payload);
197
287
  __log(`"SaveDataItem" sending request with: ${__inspect(reqOpts)}`);
198
288
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
199
289
  try {
200
290
  const result = yield httpClient.request(reqOpts);
201
291
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
202
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
203
- 'dataItem.data',
204
- ]);
292
+ return fromJSON(result.data, ['dataItem.data']);
205
293
  }
206
294
  catch (err) {
207
- const transformedError = sdkTransformError(err, {
208
- spreadPathsToArguments: {},
209
- explicitPathsToArguments: {
210
- dataCollectionId: '$[0].dataCollectionId',
211
- dataItem: '$[0].dataItem',
212
- },
213
- singleArgumentUnchanged: false,
214
- }, ['options']);
295
+ const transformedError = transformError(err, requestTransformation, [
296
+ 'options',
297
+ ]);
215
298
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
216
299
  throw transformedError;
217
300
  }
@@ -233,36 +316,49 @@ export function saveDataItem(options) {
233
316
  * @returns Retrieved item.
234
317
  */
235
318
  export function getDataItem(dataItemId, options) {
236
- var _a, _b, _c, _d;
319
+ var _a, _b, _c;
237
320
  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';
238
327
  // @ts-ignore
239
328
  const { httpClient, sideEffects } = arguments[2];
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
- }, []);
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], []);
245
348
  const reqOpts = ambassadorWixDataV2DataItem.getDataItem(payload);
246
349
  __log(`"GetDataItem" sending request with: ${__inspect(reqOpts)}`);
247
350
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
248
351
  try {
249
352
  const result = yield httpClient.request(reqOpts);
250
353
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
251
- return renameKeysFromRESTResponseToSDKResponse((_c = result.data) === null || _c === void 0 ? void 0 : _c.dataItem, [
252
- 'dataItem.data',
253
- ]);
354
+ return fromJSON(result.data, ['dataItem.data']);
254
355
  }
255
356
  catch (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);
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);
266
362
  throw transformedError;
267
363
  }
268
364
  });
@@ -288,28 +384,45 @@ export function getDataItem(dataItemId, options) {
288
384
  export function removeDataItem(dataItemId, options) {
289
385
  var _a, _b, _c;
290
386
  return __awaiter(this, arguments, void 0, function* () {
387
+ const requestTransformation = {
388
+ dataItemId: '$[0]',
389
+ dataCollectionId: '$[1].dataCollectionId',
390
+ };
391
+ const responseTransformation = '$';
291
392
  // @ts-ignore
292
393
  const { httpClient, sideEffects } = arguments[2];
293
- const payload = renameKeysFromSDKRequestToRESTRequest({ dataItemId: dataItemId, dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
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], []);
294
413
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItem(payload);
295
414
  __log(`"RemoveDataItem" sending request with: ${__inspect(reqOpts)}`);
296
415
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
297
416
  try {
298
417
  const result = yield httpClient.request(reqOpts);
299
418
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
300
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
301
- 'dataItem.data',
302
- ]);
419
+ return fromJSON(result.data, ['dataItem.data']);
303
420
  }
304
421
  catch (err) {
305
- const transformedError = sdkTransformError(err, {
306
- spreadPathsToArguments: {},
307
- explicitPathsToArguments: {
308
- dataItemId: '$[0]',
309
- dataCollectionId: '$[1].dataCollectionId',
310
- },
311
- singleArgumentUnchanged: false,
312
- }, ['dataItemId', 'options']);
422
+ const transformedError = transformError(err, requestTransformation, [
423
+ 'dataItemId',
424
+ 'options',
425
+ ]);
313
426
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
314
427
  throw transformedError;
315
428
  }
@@ -334,22 +447,41 @@ export function removeDataItem(dataItemId, options) {
334
447
  export function truncateDataItems(options) {
335
448
  var _a, _b, _c;
336
449
  return __awaiter(this, arguments, void 0, function* () {
450
+ const requestTransformation = { dataCollectionId: '$[0].dataCollectionId' };
451
+ const responseTransformation = '$';
337
452
  // @ts-ignore
338
453
  const { httpClient, sideEffects } = arguments[1];
339
- const payload = renameKeysFromSDKRequestToRESTRequest({ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
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], []);
340
473
  const reqOpts = ambassadorWixDataV2DataItem.truncateDataItems(payload);
341
474
  __log(`"TruncateDataItems" sending request with: ${__inspect(reqOpts)}`);
342
475
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
343
476
  try {
344
477
  const result = yield httpClient.request(reqOpts);
345
478
  (_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, []);
346
480
  }
347
481
  catch (err) {
348
- const transformedError = sdkTransformError(err, {
349
- spreadPathsToArguments: {},
350
- explicitPathsToArguments: { dataCollectionId: '$[0].dataCollectionId' },
351
- singleArgumentUnchanged: false,
352
- }, ['options']);
482
+ const transformedError = transformError(err, requestTransformation, [
483
+ 'options',
484
+ ]);
353
485
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
354
486
  throw transformedError;
355
487
  }
@@ -385,9 +517,32 @@ export function truncateDataItems(options) {
385
517
  * @applicableIdentity APP
386
518
  */
387
519
  export function queryDataItems(options) {
520
+ const requestTransformation = { '*': '$[1]', query: '$[0]' };
521
+ const responseTransformation = {
522
+ items: '$.dataItems',
523
+ pagingMetadata: '$.pagingMetadata',
524
+ };
388
525
  // @ts-ignore
389
526
  const { httpClient, sideEffects } = arguments[1];
390
- return queryBuilder({
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({
391
546
  func: (payload) => __awaiter(this, void 0, void 0, function* () {
392
547
  var _a, _b, _c;
393
548
  const reqOpts = ambassadorWixDataV2DataItem.queryDataItems(Object.assign(Object.assign({}, payload), options));
@@ -402,22 +557,15 @@ export function queryDataItems(options) {
402
557
  throw err;
403
558
  }
404
559
  }),
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']),
560
+ requestTransformer: (...args) => toAmbassadorRequest(args, []),
561
+ responseTransformer: ({ data }) => fromJSON(data, ['dataItems.data']),
410
562
  errorTransformer: (err) => {
411
- const transformedError = sdkTransformError(err, {
412
- spreadPathsToArguments: {},
413
- explicitPathsToArguments: { query: '$[0]' },
414
- singleArgumentUnchanged: false,
415
- });
563
+ const transformedError = transformError(err, requestTransformation);
416
564
  throw transformedError;
417
565
  },
418
566
  pagingMethod: 'OFFSET',
419
567
  transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity),
420
- });
568
+ })({ cursorWithEmptyFilterAndSort: true });
421
569
  }
422
570
  /**
423
571
  * Runs an aggregation on a data collection and returns the resulting list of items.
@@ -435,43 +583,51 @@ export function queryDataItems(options) {
435
583
  export function aggregateDataItems(options) {
436
584
  var _a, _b, _c;
437
585
  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 = '$';
438
598
  // @ts-ignore
439
599
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
451
619
  const reqOpts = ambassadorWixDataV2DataItem.aggregateDataItems(payload);
452
620
  __log(`"AggregateDataItems" sending request with: ${__inspect(reqOpts)}`);
453
621
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
454
622
  try {
455
623
  const result = yield httpClient.request(reqOpts);
456
624
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
457
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
625
+ return fromJSON(result.data, []);
458
626
  }
459
627
  catch (err) {
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']);
628
+ const transformedError = transformError(err, requestTransformation, [
629
+ 'options',
630
+ ]);
475
631
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
476
632
  throw transformedError;
477
633
  }
@@ -491,31 +647,45 @@ export function aggregateDataItems(options) {
491
647
  export function countDataItems(options) {
492
648
  var _a, _b, _c;
493
649
  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 = '$';
494
656
  // @ts-ignore
495
657
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
501
677
  const reqOpts = ambassadorWixDataV2DataItem.countDataItems(payload);
502
678
  __log(`"CountDataItems" sending request with: ${__inspect(reqOpts)}`);
503
679
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
504
680
  try {
505
681
  const result = yield httpClient.request(reqOpts);
506
682
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
507
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
683
+ return fromJSON(result.data, []);
508
684
  }
509
685
  catch (err) {
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']);
686
+ const transformedError = transformError(err, requestTransformation, [
687
+ 'options',
688
+ ]);
519
689
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
520
690
  throw transformedError;
521
691
  }
@@ -543,41 +713,50 @@ export function countDataItems(options) {
543
713
  export function queryDistinctValues(options) {
544
714
  var _a, _b, _c;
545
715
  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 = '$';
546
727
  // @ts-ignore
547
728
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
558
748
  const reqOpts = ambassadorWixDataV2DataItem.queryDistinctValues(payload);
559
749
  __log(`"QueryDistinctValues" sending request with: ${__inspect(reqOpts)}`);
560
750
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
561
751
  try {
562
752
  const result = yield httpClient.request(reqOpts);
563
753
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
564
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
754
+ return fromJSON(result.data, []);
565
755
  }
566
756
  catch (err) {
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']);
757
+ const transformedError = transformError(err, requestTransformation, [
758
+ 'options',
759
+ ]);
581
760
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
582
761
  throw transformedError;
583
762
  }
@@ -600,33 +779,45 @@ export function queryDistinctValues(options) {
600
779
  export function bulkInsertDataItems(options) {
601
780
  var _a, _b, _c;
602
781
  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 = '$';
603
788
  // @ts-ignore
604
789
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
610
809
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItems(payload);
611
810
  __log(`"BulkInsertDataItems" sending request with: ${__inspect(reqOpts)}`);
612
811
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
613
812
  try {
614
813
  const result = yield httpClient.request(reqOpts);
615
814
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
616
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
617
- 'results.dataItem.data',
618
- ]);
815
+ return fromJSON(result.data, ['results.dataItem.data']);
619
816
  }
620
817
  catch (err) {
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']);
818
+ const transformedError = transformError(err, requestTransformation, [
819
+ 'options',
820
+ ]);
630
821
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
631
822
  throw transformedError;
632
823
  }
@@ -657,33 +848,45 @@ export function bulkInsertDataItems(options) {
657
848
  export function bulkUpdateDataItems(options) {
658
849
  var _a, _b, _c;
659
850
  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 = '$';
660
857
  // @ts-ignore
661
858
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
667
878
  const reqOpts = ambassadorWixDataV2DataItem.bulkUpdateDataItems(payload);
668
879
  __log(`"BulkUpdateDataItems" sending request with: ${__inspect(reqOpts)}`);
669
880
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
670
881
  try {
671
882
  const result = yield httpClient.request(reqOpts);
672
883
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
673
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
674
- 'results.dataItem.data',
675
- ]);
884
+ return fromJSON(result.data, ['results.dataItem.data']);
676
885
  }
677
886
  catch (err) {
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']);
887
+ const transformedError = transformError(err, requestTransformation, [
888
+ 'options',
889
+ ]);
687
890
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
688
891
  throw transformedError;
689
892
  }
@@ -714,33 +917,45 @@ export function bulkUpdateDataItems(options) {
714
917
  export function bulkSaveDataItems(options) {
715
918
  var _a, _b, _c;
716
919
  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 = '$';
717
926
  // @ts-ignore
718
927
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
724
947
  const reqOpts = ambassadorWixDataV2DataItem.bulkSaveDataItems(payload);
725
948
  __log(`"BulkSaveDataItems" sending request with: ${__inspect(reqOpts)}`);
726
949
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
727
950
  try {
728
951
  const result = yield httpClient.request(reqOpts);
729
952
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
730
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
731
- 'results.dataItem.data',
732
- ]);
953
+ return fromJSON(result.data, ['results.dataItem.data']);
733
954
  }
734
955
  catch (err) {
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']);
956
+ const transformedError = transformError(err, requestTransformation, [
957
+ 'options',
958
+ ]);
744
959
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
745
960
  throw transformedError;
746
961
  }
@@ -765,31 +980,44 @@ export function bulkSaveDataItems(options) {
765
980
  export function bulkRemoveDataItems(options) {
766
981
  var _a, _b, _c;
767
982
  return __awaiter(this, arguments, void 0, function* () {
983
+ const requestTransformation = {
984
+ dataCollectionId: '$[0].dataCollectionId',
985
+ dataItemIds: '$[0].dataItemIds',
986
+ };
987
+ const responseTransformation = '$';
768
988
  // @ts-ignore
769
989
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
774
1009
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItems(payload);
775
1010
  __log(`"BulkRemoveDataItems" sending request with: ${__inspect(reqOpts)}`);
776
1011
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
777
1012
  try {
778
1013
  const result = yield httpClient.request(reqOpts);
779
1014
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
780
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
781
- 'results.dataItem.data',
782
- ]);
1015
+ return fromJSON(result.data, ['results.dataItem.data']);
783
1016
  }
784
1017
  catch (err) {
785
- const transformedError = sdkTransformError(err, {
786
- spreadPathsToArguments: {},
787
- explicitPathsToArguments: {
788
- dataCollectionId: '$[0].dataCollectionId',
789
- dataItemIds: '$[0].dataItemIds',
790
- },
791
- singleArgumentUnchanged: false,
792
- }, ['options']);
1018
+ const transformedError = transformError(err, requestTransformation, [
1019
+ 'options',
1020
+ ]);
793
1021
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
794
1022
  throw transformedError;
795
1023
  }
@@ -817,43 +1045,50 @@ export function bulkRemoveDataItems(options) {
817
1045
  export function queryReferencedDataItems(options) {
818
1046
  var _a, _b, _c;
819
1047
  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 = '$';
820
1059
  // @ts-ignore
821
1060
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
832
1080
  const reqOpts = ambassadorWixDataV2DataItem.queryReferencedDataItems(payload);
833
1081
  __log(`"QueryReferencedDataItems" sending request with: ${__inspect(reqOpts)}`);
834
1082
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
835
1083
  try {
836
1084
  const result = yield httpClient.request(reqOpts);
837
1085
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
838
- return renameKeysFromRESTResponseToSDKResponse(result.data, [
839
- 'results.dataItem.data',
840
- ]);
1086
+ return fromJSON(result.data, ['results.dataItem.data']);
841
1087
  }
842
1088
  catch (err) {
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']);
1089
+ const transformedError = transformError(err, requestTransformation, [
1090
+ 'options',
1091
+ ]);
857
1092
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
858
1093
  throw transformedError;
859
1094
  }
@@ -876,35 +1111,47 @@ export function queryReferencedDataItems(options) {
876
1111
  export function isReferencedDataItem(options) {
877
1112
  var _a, _b, _c;
878
1113
  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 = '$';
879
1122
  // @ts-ignore
880
1123
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
888
1143
  const reqOpts = ambassadorWixDataV2DataItem.isReferencedDataItem(payload);
889
1144
  __log(`"IsReferencedDataItem" sending request with: ${__inspect(reqOpts)}`);
890
1145
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
891
1146
  try {
892
1147
  const result = yield httpClient.request(reqOpts);
893
1148
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
894
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1149
+ return fromJSON(result.data, []);
895
1150
  }
896
1151
  catch (err) {
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']);
1152
+ const transformedError = transformError(err, requestTransformation, [
1153
+ 'options',
1154
+ ]);
908
1155
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
909
1156
  throw transformedError;
910
1157
  }
@@ -928,29 +1175,44 @@ export function isReferencedDataItem(options) {
928
1175
  export function insertDataItemReference(options) {
929
1176
  var _a, _b, _c;
930
1177
  return __awaiter(this, arguments, void 0, function* () {
1178
+ const requestTransformation = {
1179
+ dataCollectionId: '$[0].dataCollectionId',
1180
+ dataItemReference: '$[0].dataItemReference',
1181
+ };
1182
+ const responseTransformation = '$';
931
1183
  // @ts-ignore
932
1184
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
937
1204
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItemReference(payload);
938
1205
  __log(`"InsertDataItemReference" sending request with: ${__inspect(reqOpts)}`);
939
1206
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
940
1207
  try {
941
1208
  const result = yield httpClient.request(reqOpts);
942
1209
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
943
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1210
+ return fromJSON(result.data, []);
944
1211
  }
945
1212
  catch (err) {
946
- const transformedError = sdkTransformError(err, {
947
- spreadPathsToArguments: {},
948
- explicitPathsToArguments: {
949
- dataCollectionId: '$[0].dataCollectionId',
950
- dataItemReference: '$[0].dataItemReference',
951
- },
952
- singleArgumentUnchanged: false,
953
- }, ['options']);
1213
+ const transformedError = transformError(err, requestTransformation, [
1214
+ 'options',
1215
+ ]);
954
1216
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
955
1217
  throw transformedError;
956
1218
  }
@@ -973,29 +1235,44 @@ export function insertDataItemReference(options) {
973
1235
  export function removeDataItemReference(options) {
974
1236
  var _a, _b, _c;
975
1237
  return __awaiter(this, arguments, void 0, function* () {
1238
+ const requestTransformation = {
1239
+ dataCollectionId: '$[0].dataCollectionId',
1240
+ dataItemReference: '$[0].dataItemReference',
1241
+ };
1242
+ const responseTransformation = '$';
976
1243
  // @ts-ignore
977
1244
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
982
1264
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItemReference(payload);
983
1265
  __log(`"RemoveDataItemReference" sending request with: ${__inspect(reqOpts)}`);
984
1266
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
985
1267
  try {
986
1268
  const result = yield httpClient.request(reqOpts);
987
1269
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
988
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1270
+ return fromJSON(result.data, []);
989
1271
  }
990
1272
  catch (err) {
991
- const transformedError = sdkTransformError(err, {
992
- spreadPathsToArguments: {},
993
- explicitPathsToArguments: {
994
- dataCollectionId: '$[0].dataCollectionId',
995
- dataItemReference: '$[0].dataItemReference',
996
- },
997
- singleArgumentUnchanged: false,
998
- }, ['options']);
1273
+ const transformedError = transformError(err, requestTransformation, [
1274
+ 'options',
1275
+ ]);
999
1276
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1000
1277
  throw transformedError;
1001
1278
  }
@@ -1021,31 +1298,45 @@ export function removeDataItemReference(options) {
1021
1298
  export function bulkInsertDataItemReferences(options) {
1022
1299
  var _a, _b, _c;
1023
1300
  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 = '$';
1024
1307
  // @ts-ignore
1025
1308
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
1031
1328
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItemReferences(payload);
1032
1329
  __log(`"BulkInsertDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1033
1330
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1034
1331
  try {
1035
1332
  const result = yield httpClient.request(reqOpts);
1036
1333
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1037
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1334
+ return fromJSON(result.data, []);
1038
1335
  }
1039
1336
  catch (err) {
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']);
1337
+ const transformedError = transformError(err, requestTransformation, [
1338
+ 'options',
1339
+ ]);
1049
1340
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1050
1341
  throw transformedError;
1051
1342
  }
@@ -1068,29 +1359,44 @@ export function bulkInsertDataItemReferences(options) {
1068
1359
  export function bulkRemoveDataItemReferences(options) {
1069
1360
  var _a, _b, _c;
1070
1361
  return __awaiter(this, arguments, void 0, function* () {
1362
+ const requestTransformation = {
1363
+ dataCollectionId: '$[0].dataCollectionId',
1364
+ dataItemReferences: '$[0].dataItemReferences',
1365
+ };
1366
+ const responseTransformation = '$';
1071
1367
  // @ts-ignore
1072
1368
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
1077
1388
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItemReferences(payload);
1078
1389
  __log(`"BulkRemoveDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1079
1390
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1080
1391
  try {
1081
1392
  const result = yield httpClient.request(reqOpts);
1082
1393
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1083
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1394
+ return fromJSON(result.data, []);
1084
1395
  }
1085
1396
  catch (err) {
1086
- const transformedError = sdkTransformError(err, {
1087
- spreadPathsToArguments: {},
1088
- explicitPathsToArguments: {
1089
- dataCollectionId: '$[0].dataCollectionId',
1090
- dataItemReferences: '$[0].dataItemReferences',
1091
- },
1092
- singleArgumentUnchanged: false,
1093
- }, ['options']);
1397
+ const transformedError = transformError(err, requestTransformation, [
1398
+ 'options',
1399
+ ]);
1094
1400
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1095
1401
  throw transformedError;
1096
1402
  }
@@ -1116,33 +1422,46 @@ export function bulkRemoveDataItemReferences(options) {
1116
1422
  export function replaceDataItemReferences(options) {
1117
1423
  var _a, _b, _c;
1118
1424
  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 = '$';
1119
1432
  // @ts-ignore
1120
1433
  const { httpClient, sideEffects } = arguments[1];
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
- }, []);
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], []);
1127
1453
  const reqOpts = ambassadorWixDataV2DataItem.replaceDataItemReferences(payload);
1128
1454
  __log(`"ReplaceDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1129
1455
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1130
1456
  try {
1131
1457
  const result = yield httpClient.request(reqOpts);
1132
1458
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1133
- return renameKeysFromRESTResponseToSDKResponse(result.data, []);
1459
+ return fromJSON(result.data, []);
1134
1460
  }
1135
1461
  catch (err) {
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']);
1462
+ const transformedError = transformError(err, requestTransformation, [
1463
+ 'options',
1464
+ ]);
1146
1465
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1147
1466
  throw transformedError;
1148
1467
  }