@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
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -34,9 +30,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
30
  Object.defineProperty(exports, "__esModule", { value: true });
35
31
  exports.replaceDataItemReferences = exports.bulkRemoveDataItemReferences = exports.bulkInsertDataItemReferences = exports.removeDataItemReference = exports.insertDataItemReference = exports.isReferencedDataItem = exports.queryReferencedDataItems = exports.bulkRemoveDataItems = exports.bulkSaveDataItems = exports.bulkUpdateDataItems = exports.bulkInsertDataItems = exports.queryDistinctValues = exports.countDataItems = exports.aggregateDataItems = exports.queryDataItems = exports.truncateDataItems = exports.removeDataItem = exports.getDataItem = exports.saveDataItem = exports.updateDataItem = exports.insertDataItem = exports.BulkActionType = exports.SortOrder = exports.Action = exports.Environment = exports.__debug = void 0;
36
32
  const velo_1 = require("@wix/metro-runtime/velo");
37
- const sdk_runtime_1 = require("@wix/sdk-runtime");
38
33
  const ambassadorWixDataV2DataItem = __importStar(require("./data-v2-data-item.http"));
39
34
  // @ts-ignore
35
+ const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
40
36
  let __verbose = false;
41
37
  function __log(...args) {
42
38
  __verbose && console.log(...args);
@@ -51,29 +47,72 @@ exports.__debug = {
51
47
  },
52
48
  };
53
49
  const _toVeloEntity = '$';
50
+ const _fromVeloEntity = '$';
54
51
  var Environment;
55
52
  (function (Environment) {
56
53
  Environment["LIVE"] = "LIVE";
57
54
  Environment["SANDBOX"] = "SANDBOX";
58
- })(Environment || (exports.Environment = Environment = {}));
55
+ })(Environment = exports.Environment || (exports.Environment = {}));
59
56
  var Action;
60
57
  (function (Action) {
61
58
  Action["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
62
59
  Action["INSERTED"] = "INSERTED";
63
60
  Action["UPDATED"] = "UPDATED";
64
- })(Action || (exports.Action = Action = {}));
61
+ })(Action = exports.Action || (exports.Action = {}));
65
62
  var SortOrder;
66
63
  (function (SortOrder) {
67
64
  SortOrder["ASC"] = "ASC";
68
65
  SortOrder["DESC"] = "DESC";
69
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
66
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
70
67
  var BulkActionType;
71
68
  (function (BulkActionType) {
72
69
  BulkActionType["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
73
70
  BulkActionType["INSERT"] = "INSERT";
74
71
  BulkActionType["UPDATE"] = "UPDATE";
75
72
  BulkActionType["DELETE"] = "DELETE";
76
- })(BulkActionType || (exports.BulkActionType = BulkActionType = {}));
73
+ })(BulkActionType = exports.BulkActionType || (exports.BulkActionType = {}));
74
+ const _aggregateDataItemsRequest = {};
75
+ const _aggregateDataItemsResponse = {};
76
+ const _bulkInsertDataItemReferencesRequest = {};
77
+ const _bulkInsertDataItemReferencesResponse = {};
78
+ const _bulkInsertDataItemsRequest = {};
79
+ const _bulkInsertDataItemsResponse = {};
80
+ const _bulkRemoveDataItemReferencesRequest = {};
81
+ const _bulkRemoveDataItemReferencesResponse = {};
82
+ const _bulkRemoveDataItemsRequest = {};
83
+ const _bulkRemoveDataItemsResponse = {};
84
+ const _bulkSaveDataItemsRequest = {};
85
+ const _bulkSaveDataItemsResponse = {};
86
+ const _bulkUpdateDataItemsRequest = {};
87
+ const _bulkUpdateDataItemsResponse = {};
88
+ const _countDataItemsRequest = {};
89
+ const _countDataItemsResponse = {};
90
+ const _getDataItemRequest = {};
91
+ const _getDataItemResponse = {};
92
+ const _insertDataItemReferenceRequest = {};
93
+ const _insertDataItemReferenceResponse = {};
94
+ const _insertDataItemRequest = {};
95
+ const _insertDataItemResponse = {};
96
+ const _isReferencedDataItemRequest = {};
97
+ const _isReferencedDataItemResponse = {};
98
+ const _queryDataItemsRequest = {};
99
+ const _queryDataItemsResponse = {};
100
+ const _queryDistinctValuesRequest = {};
101
+ const _queryDistinctValuesResponse = {};
102
+ const _queryReferencedDataItemsRequest = {};
103
+ const _queryReferencedDataItemsResponse = {};
104
+ const _removeDataItemReferenceRequest = {};
105
+ const _removeDataItemReferenceResponse = {};
106
+ const _removeDataItemRequest = {};
107
+ const _removeDataItemResponse = {};
108
+ const _replaceDataItemReferencesRequest = {};
109
+ const _replaceDataItemReferencesResponse = {};
110
+ const _saveDataItemRequest = {};
111
+ const _saveDataItemResponse = {};
112
+ const _truncateDataItemsRequest = {};
113
+ const _truncateDataItemsResponse = {};
114
+ const _updateDataItemRequest = {};
115
+ const _updateDataItemResponse = {};
77
116
  /**
78
117
  * Adds an item to a collection.
79
118
  *
@@ -98,31 +137,44 @@ var BulkActionType;
98
137
  function insertDataItem(options) {
99
138
  var _a, _b, _c;
100
139
  return __awaiter(this, arguments, void 0, function* () {
140
+ const requestTransformation = {
141
+ dataCollectionId: '$[0].dataCollectionId',
142
+ dataItem: '$[0].dataItem',
143
+ };
144
+ const responseTransformation = '$';
101
145
  // @ts-ignore
102
146
  const { httpClient, sideEffects } = arguments[1];
103
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
104
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
105
- dataItem: options === null || options === void 0 ? void 0 : options.dataItem,
106
- }, ['dataItem.data']);
147
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
148
+ rootSchema: _insertDataItemRequest,
149
+ depSchemas: {},
150
+ fqdnTransformation: {
151
+ paths: [...['dataItem']],
152
+ transformation: _fromVeloEntity,
153
+ },
154
+ customTransformation: requestTransformation,
155
+ });
156
+ const { fromJSON } = (0, velo_1.serializer)({
157
+ rootSchema: _insertDataItemResponse,
158
+ depSchemas: {},
159
+ fqdnTransformation: {
160
+ paths: [...['dataItem']],
161
+ transformation: _toVeloEntity,
162
+ },
163
+ customTransformation: responseTransformation,
164
+ });
165
+ const payload = toAmbassadorRequest([options], ['dataItem.data']);
107
166
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItem(payload);
108
167
  __log(`"InsertDataItem" sending request with: ${__inspect(reqOpts)}`);
109
168
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
110
169
  try {
111
170
  const result = yield httpClient.request(reqOpts);
112
171
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
113
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
114
- 'dataItem.data',
115
- ]);
172
+ return fromJSON(result.data, ['dataItem.data']);
116
173
  }
117
174
  catch (err) {
118
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
119
- spreadPathsToArguments: {},
120
- explicitPathsToArguments: {
121
- dataCollectionId: '$[0].dataCollectionId',
122
- dataItem: '$[0].dataItem',
123
- },
124
- singleArgumentUnchanged: false,
125
- }, ['options']);
175
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
176
+ 'options',
177
+ ]);
126
178
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
127
179
  throw transformedError;
128
180
  }
@@ -158,31 +210,45 @@ exports.insertDataItem = insertDataItem;
158
210
  function updateDataItem(_id, options) {
159
211
  var _a, _b, _c;
160
212
  return __awaiter(this, arguments, void 0, function* () {
213
+ const requestTransformation = {
214
+ dataItem: { '*': '$[1].dataItem', id: '$[0]' },
215
+ dataCollectionId: '$[1].dataCollectionId',
216
+ };
217
+ const responseTransformation = '$';
161
218
  // @ts-ignore
162
219
  const { httpClient, sideEffects } = arguments[2];
163
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
164
- dataItem: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.dataItem), { id: _id }),
165
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
166
- }, ['dataItem.data']);
220
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
221
+ rootSchema: _updateDataItemRequest,
222
+ depSchemas: {},
223
+ fqdnTransformation: {
224
+ paths: [...['dataItem']],
225
+ transformation: _fromVeloEntity,
226
+ },
227
+ customTransformation: requestTransformation,
228
+ });
229
+ const { fromJSON } = (0, velo_1.serializer)({
230
+ rootSchema: _updateDataItemResponse,
231
+ depSchemas: {},
232
+ fqdnTransformation: {
233
+ paths: [...['dataItem']],
234
+ transformation: _toVeloEntity,
235
+ },
236
+ customTransformation: responseTransformation,
237
+ });
238
+ const payload = toAmbassadorRequest([_id, options], ['dataItem.data']);
167
239
  const reqOpts = ambassadorWixDataV2DataItem.updateDataItem(payload);
168
240
  __log(`"UpdateDataItem" sending request with: ${__inspect(reqOpts)}`);
169
241
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
170
242
  try {
171
243
  const result = yield httpClient.request(reqOpts);
172
244
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
173
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
174
- 'dataItem.data',
175
- ]);
245
+ return fromJSON(result.data, ['dataItem.data']);
176
246
  }
177
247
  catch (err) {
178
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
179
- spreadPathsToArguments: { dataItem: '$[1].dataItem' },
180
- explicitPathsToArguments: {
181
- 'dataItem.id': '$[0]',
182
- dataCollectionId: '$[1].dataCollectionId',
183
- },
184
- singleArgumentUnchanged: false,
185
- }, ['_id', 'options']);
248
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
249
+ '_id',
250
+ 'options',
251
+ ]);
186
252
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
187
253
  throw transformedError;
188
254
  }
@@ -215,31 +281,44 @@ exports.updateDataItem = updateDataItem;
215
281
  function saveDataItem(options) {
216
282
  var _a, _b, _c;
217
283
  return __awaiter(this, arguments, void 0, function* () {
284
+ const requestTransformation = {
285
+ dataCollectionId: '$[0].dataCollectionId',
286
+ dataItem: '$[0].dataItem',
287
+ };
288
+ const responseTransformation = '$';
218
289
  // @ts-ignore
219
290
  const { httpClient, sideEffects } = arguments[1];
220
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
221
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
222
- dataItem: options === null || options === void 0 ? void 0 : options.dataItem,
223
- }, ['dataItem.data']);
291
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
292
+ rootSchema: _saveDataItemRequest,
293
+ depSchemas: {},
294
+ fqdnTransformation: {
295
+ paths: [...['dataItem']],
296
+ transformation: _fromVeloEntity,
297
+ },
298
+ customTransformation: requestTransformation,
299
+ });
300
+ const { fromJSON } = (0, velo_1.serializer)({
301
+ rootSchema: _saveDataItemResponse,
302
+ depSchemas: {},
303
+ fqdnTransformation: {
304
+ paths: [...['dataItem']],
305
+ transformation: _toVeloEntity,
306
+ },
307
+ customTransformation: responseTransformation,
308
+ });
309
+ const payload = toAmbassadorRequest([options], ['dataItem.data']);
224
310
  const reqOpts = ambassadorWixDataV2DataItem.saveDataItem(payload);
225
311
  __log(`"SaveDataItem" sending request with: ${__inspect(reqOpts)}`);
226
312
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
227
313
  try {
228
314
  const result = yield httpClient.request(reqOpts);
229
315
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
230
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
231
- 'dataItem.data',
232
- ]);
316
+ return fromJSON(result.data, ['dataItem.data']);
233
317
  }
234
318
  catch (err) {
235
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
236
- spreadPathsToArguments: {},
237
- explicitPathsToArguments: {
238
- dataCollectionId: '$[0].dataCollectionId',
239
- dataItem: '$[0].dataItem',
240
- },
241
- singleArgumentUnchanged: false,
242
- }, ['options']);
319
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
320
+ 'options',
321
+ ]);
243
322
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
244
323
  throw transformedError;
245
324
  }
@@ -262,36 +341,49 @@ exports.saveDataItem = saveDataItem;
262
341
  * @returns Retrieved item.
263
342
  */
264
343
  function getDataItem(dataItemId, options) {
265
- var _a, _b, _c, _d;
344
+ var _a, _b, _c;
266
345
  return __awaiter(this, arguments, void 0, function* () {
346
+ const requestTransformation = {
347
+ dataItemId: '$[0]',
348
+ dataCollectionId: '$[1].dataCollectionId',
349
+ consistentRead: '$[1].consistentRead',
350
+ };
351
+ const responseTransformation = '$.dataItem';
267
352
  // @ts-ignore
268
353
  const { httpClient, sideEffects } = arguments[2];
269
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
270
- dataItemId: dataItemId,
271
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
272
- consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
273
- }, []);
354
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
355
+ rootSchema: _getDataItemRequest,
356
+ depSchemas: {},
357
+ fqdnTransformation: {
358
+ paths: [],
359
+ transformation: _fromVeloEntity,
360
+ },
361
+ customTransformation: requestTransformation,
362
+ });
363
+ const { fromJSON } = (0, velo_1.serializer)({
364
+ rootSchema: _getDataItemResponse,
365
+ depSchemas: {},
366
+ fqdnTransformation: {
367
+ paths: [...['dataItem']],
368
+ transformation: _toVeloEntity,
369
+ },
370
+ customTransformation: responseTransformation,
371
+ });
372
+ const payload = toAmbassadorRequest([dataItemId, options], []);
274
373
  const reqOpts = ambassadorWixDataV2DataItem.getDataItem(payload);
275
374
  __log(`"GetDataItem" sending request with: ${__inspect(reqOpts)}`);
276
375
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
277
376
  try {
278
377
  const result = yield httpClient.request(reqOpts);
279
378
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
280
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)((_c = result.data) === null || _c === void 0 ? void 0 : _c.dataItem, [
281
- 'dataItem.data',
282
- ]);
379
+ return fromJSON(result.data, ['dataItem.data']);
283
380
  }
284
381
  catch (err) {
285
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
286
- spreadPathsToArguments: {},
287
- explicitPathsToArguments: {
288
- dataItemId: '$[0]',
289
- dataCollectionId: '$[1].dataCollectionId',
290
- consistentRead: '$[1].consistentRead',
291
- },
292
- singleArgumentUnchanged: false,
293
- }, ['dataItemId', 'options']);
294
- (_d = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _d === void 0 ? void 0 : _d.call(sideEffects, err);
382
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
383
+ 'dataItemId',
384
+ 'options',
385
+ ]);
386
+ (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
295
387
  throw transformedError;
296
388
  }
297
389
  });
@@ -318,28 +410,45 @@ exports.getDataItem = getDataItem;
318
410
  function removeDataItem(dataItemId, options) {
319
411
  var _a, _b, _c;
320
412
  return __awaiter(this, arguments, void 0, function* () {
413
+ const requestTransformation = {
414
+ dataItemId: '$[0]',
415
+ dataCollectionId: '$[1].dataCollectionId',
416
+ };
417
+ const responseTransformation = '$';
321
418
  // @ts-ignore
322
419
  const { httpClient, sideEffects } = arguments[2];
323
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({ dataItemId: dataItemId, dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
420
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
421
+ rootSchema: _removeDataItemRequest,
422
+ depSchemas: {},
423
+ fqdnTransformation: {
424
+ paths: [],
425
+ transformation: _fromVeloEntity,
426
+ },
427
+ customTransformation: requestTransformation,
428
+ });
429
+ const { fromJSON } = (0, velo_1.serializer)({
430
+ rootSchema: _removeDataItemResponse,
431
+ depSchemas: {},
432
+ fqdnTransformation: {
433
+ paths: [...['dataItem']],
434
+ transformation: _toVeloEntity,
435
+ },
436
+ customTransformation: responseTransformation,
437
+ });
438
+ const payload = toAmbassadorRequest([dataItemId, options], []);
324
439
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItem(payload);
325
440
  __log(`"RemoveDataItem" sending request with: ${__inspect(reqOpts)}`);
326
441
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
327
442
  try {
328
443
  const result = yield httpClient.request(reqOpts);
329
444
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
330
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
331
- 'dataItem.data',
332
- ]);
445
+ return fromJSON(result.data, ['dataItem.data']);
333
446
  }
334
447
  catch (err) {
335
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
336
- spreadPathsToArguments: {},
337
- explicitPathsToArguments: {
338
- dataItemId: '$[0]',
339
- dataCollectionId: '$[1].dataCollectionId',
340
- },
341
- singleArgumentUnchanged: false,
342
- }, ['dataItemId', 'options']);
448
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
449
+ 'dataItemId',
450
+ 'options',
451
+ ]);
343
452
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
344
453
  throw transformedError;
345
454
  }
@@ -365,22 +474,41 @@ exports.removeDataItem = removeDataItem;
365
474
  function truncateDataItems(options) {
366
475
  var _a, _b, _c;
367
476
  return __awaiter(this, arguments, void 0, function* () {
477
+ const requestTransformation = { dataCollectionId: '$[0].dataCollectionId' };
478
+ const responseTransformation = '$';
368
479
  // @ts-ignore
369
480
  const { httpClient, sideEffects } = arguments[1];
370
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
481
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
482
+ rootSchema: _truncateDataItemsRequest,
483
+ depSchemas: {},
484
+ fqdnTransformation: {
485
+ paths: [],
486
+ transformation: _fromVeloEntity,
487
+ },
488
+ customTransformation: requestTransformation,
489
+ });
490
+ const { fromJSON } = (0, velo_1.serializer)({
491
+ rootSchema: _truncateDataItemsResponse,
492
+ depSchemas: {},
493
+ fqdnTransformation: {
494
+ paths: [],
495
+ transformation: _toVeloEntity,
496
+ },
497
+ customTransformation: responseTransformation,
498
+ });
499
+ const payload = toAmbassadorRequest([options], []);
371
500
  const reqOpts = ambassadorWixDataV2DataItem.truncateDataItems(payload);
372
501
  __log(`"TruncateDataItems" sending request with: ${__inspect(reqOpts)}`);
373
502
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
374
503
  try {
375
504
  const result = yield httpClient.request(reqOpts);
376
505
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
506
+ return fromJSON(result.data, []);
377
507
  }
378
508
  catch (err) {
379
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
380
- spreadPathsToArguments: {},
381
- explicitPathsToArguments: { dataCollectionId: '$[0].dataCollectionId' },
382
- singleArgumentUnchanged: false,
383
- }, ['options']);
509
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
510
+ 'options',
511
+ ]);
384
512
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
385
513
  throw transformedError;
386
514
  }
@@ -417,9 +545,32 @@ exports.truncateDataItems = truncateDataItems;
417
545
  * @applicableIdentity APP
418
546
  */
419
547
  function queryDataItems(options) {
548
+ const requestTransformation = { '*': '$[1]', query: '$[0]' };
549
+ const responseTransformation = {
550
+ items: '$.dataItems',
551
+ pagingMetadata: '$.pagingMetadata',
552
+ };
420
553
  // @ts-ignore
421
554
  const { httpClient, sideEffects } = arguments[1];
422
- return (0, sdk_runtime_1.queryBuilder)({
555
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
556
+ rootSchema: _queryDataItemsRequest,
557
+ depSchemas: {},
558
+ fqdnTransformation: {
559
+ paths: [],
560
+ transformation: _fromVeloEntity,
561
+ },
562
+ customTransformation: requestTransformation,
563
+ });
564
+ const { fromJSON } = (0, velo_1.serializer)({
565
+ rootSchema: _queryDataItemsResponse,
566
+ depSchemas: {},
567
+ fqdnTransformation: {
568
+ paths: [...['Array#dataItems']],
569
+ transformation: _toVeloEntity,
570
+ },
571
+ customTransformation: responseTransformation,
572
+ });
573
+ return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({
423
574
  func: (payload) => __awaiter(this, void 0, void 0, function* () {
424
575
  var _a, _b, _c;
425
576
  const reqOpts = ambassadorWixDataV2DataItem.queryDataItems(Object.assign(Object.assign({}, payload), options));
@@ -434,22 +585,15 @@ function queryDataItems(options) {
434
585
  throw err;
435
586
  }
436
587
  }),
437
- requestTransformer: (query) => {
438
- const args = [query, options];
439
- return (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)(Object.assign(Object.assign({}, args === null || args === void 0 ? void 0 : args[1]), { query: args === null || args === void 0 ? void 0 : args[0] }), []);
440
- },
441
- responseTransformer: ({ data }) => (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)({ items: data === null || data === void 0 ? void 0 : data.dataItems, pagingMetadata: data === null || data === void 0 ? void 0 : data.pagingMetadata }, ['dataItems.data']),
588
+ requestTransformer: (...args) => toAmbassadorRequest(args, []),
589
+ responseTransformer: ({ data }) => fromJSON(data, ['dataItems.data']),
442
590
  errorTransformer: (err) => {
443
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
444
- spreadPathsToArguments: {},
445
- explicitPathsToArguments: { query: '$[0]' },
446
- singleArgumentUnchanged: false,
447
- });
591
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation);
448
592
  throw transformedError;
449
593
  },
450
594
  pagingMethod: 'OFFSET',
451
595
  transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity),
452
- });
596
+ })({ cursorWithEmptyFilterAndSort: true });
453
597
  }
454
598
  exports.queryDataItems = queryDataItems;
455
599
  /**
@@ -468,43 +612,51 @@ exports.queryDataItems = queryDataItems;
468
612
  function aggregateDataItems(options) {
469
613
  var _a, _b, _c;
470
614
  return __awaiter(this, arguments, void 0, function* () {
615
+ const requestTransformation = {
616
+ dataCollectionId: '$[0].dataCollectionId',
617
+ initialFilter: '$[0].initialFilter',
618
+ aggregation: '$[0].aggregation',
619
+ finalFilter: '$[0].finalFilter',
620
+ paging: '$[0].paging',
621
+ cursorPaging: '$[0].cursorPaging',
622
+ sort: '$[0].sort',
623
+ returnTotalCount: '$[0].returnTotalCount',
624
+ consistentRead: '$[0].consistentRead',
625
+ };
626
+ const responseTransformation = '$';
471
627
  // @ts-ignore
472
628
  const { httpClient, sideEffects } = arguments[1];
473
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
474
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
475
- initialFilter: options === null || options === void 0 ? void 0 : options.initialFilter,
476
- aggregation: options === null || options === void 0 ? void 0 : options.aggregation,
477
- finalFilter: options === null || options === void 0 ? void 0 : options.finalFilter,
478
- paging: options === null || options === void 0 ? void 0 : options.paging,
479
- cursorPaging: options === null || options === void 0 ? void 0 : options.cursorPaging,
480
- sort: options === null || options === void 0 ? void 0 : options.sort,
481
- returnTotalCount: options === null || options === void 0 ? void 0 : options.returnTotalCount,
482
- consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
483
- }, []);
629
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
630
+ rootSchema: _aggregateDataItemsRequest,
631
+ depSchemas: {},
632
+ fqdnTransformation: {
633
+ paths: [],
634
+ transformation: _fromVeloEntity,
635
+ },
636
+ customTransformation: requestTransformation,
637
+ });
638
+ const { fromJSON } = (0, velo_1.serializer)({
639
+ rootSchema: _aggregateDataItemsResponse,
640
+ depSchemas: {},
641
+ fqdnTransformation: {
642
+ paths: [],
643
+ transformation: _toVeloEntity,
644
+ },
645
+ customTransformation: responseTransformation,
646
+ });
647
+ const payload = toAmbassadorRequest([options], []);
484
648
  const reqOpts = ambassadorWixDataV2DataItem.aggregateDataItems(payload);
485
649
  __log(`"AggregateDataItems" sending request with: ${__inspect(reqOpts)}`);
486
650
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
487
651
  try {
488
652
  const result = yield httpClient.request(reqOpts);
489
653
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
490
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
654
+ return fromJSON(result.data, []);
491
655
  }
492
656
  catch (err) {
493
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
494
- spreadPathsToArguments: {},
495
- explicitPathsToArguments: {
496
- dataCollectionId: '$[0].dataCollectionId',
497
- initialFilter: '$[0].initialFilter',
498
- aggregation: '$[0].aggregation',
499
- finalFilter: '$[0].finalFilter',
500
- paging: '$[0].paging',
501
- cursorPaging: '$[0].cursorPaging',
502
- sort: '$[0].sort',
503
- returnTotalCount: '$[0].returnTotalCount',
504
- consistentRead: '$[0].consistentRead',
505
- },
506
- singleArgumentUnchanged: false,
507
- }, ['options']);
657
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
658
+ 'options',
659
+ ]);
508
660
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
509
661
  throw transformedError;
510
662
  }
@@ -525,31 +677,45 @@ exports.aggregateDataItems = aggregateDataItems;
525
677
  function countDataItems(options) {
526
678
  var _a, _b, _c;
527
679
  return __awaiter(this, arguments, void 0, function* () {
680
+ const requestTransformation = {
681
+ dataCollectionId: '$[0].dataCollectionId',
682
+ filter: '$[0].filter',
683
+ consistentRead: '$[0].consistentRead',
684
+ };
685
+ const responseTransformation = '$';
528
686
  // @ts-ignore
529
687
  const { httpClient, sideEffects } = arguments[1];
530
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
531
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
532
- filter: options === null || options === void 0 ? void 0 : options.filter,
533
- consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
534
- }, []);
688
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
689
+ rootSchema: _countDataItemsRequest,
690
+ depSchemas: {},
691
+ fqdnTransformation: {
692
+ paths: [],
693
+ transformation: _fromVeloEntity,
694
+ },
695
+ customTransformation: requestTransformation,
696
+ });
697
+ const { fromJSON } = (0, velo_1.serializer)({
698
+ rootSchema: _countDataItemsResponse,
699
+ depSchemas: {},
700
+ fqdnTransformation: {
701
+ paths: [],
702
+ transformation: _toVeloEntity,
703
+ },
704
+ customTransformation: responseTransformation,
705
+ });
706
+ const payload = toAmbassadorRequest([options], []);
535
707
  const reqOpts = ambassadorWixDataV2DataItem.countDataItems(payload);
536
708
  __log(`"CountDataItems" sending request with: ${__inspect(reqOpts)}`);
537
709
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
538
710
  try {
539
711
  const result = yield httpClient.request(reqOpts);
540
712
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
541
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
713
+ return fromJSON(result.data, []);
542
714
  }
543
715
  catch (err) {
544
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
545
- spreadPathsToArguments: {},
546
- explicitPathsToArguments: {
547
- dataCollectionId: '$[0].dataCollectionId',
548
- filter: '$[0].filter',
549
- consistentRead: '$[0].consistentRead',
550
- },
551
- singleArgumentUnchanged: false,
552
- }, ['options']);
716
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
717
+ 'options',
718
+ ]);
553
719
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
554
720
  throw transformedError;
555
721
  }
@@ -578,41 +744,50 @@ exports.countDataItems = countDataItems;
578
744
  function queryDistinctValues(options) {
579
745
  var _a, _b, _c;
580
746
  return __awaiter(this, arguments, void 0, function* () {
747
+ const requestTransformation = {
748
+ dataCollectionId: '$[0].dataCollectionId',
749
+ fieldName: '$[0].fieldName',
750
+ filter: '$[0].filter',
751
+ order: '$[0].order',
752
+ paging: '$[0].paging',
753
+ cursorPaging: '$[0].cursorPaging',
754
+ returnTotalCount: '$[0].returnTotalCount',
755
+ consistentRead: '$[0].consistentRead',
756
+ };
757
+ const responseTransformation = '$';
581
758
  // @ts-ignore
582
759
  const { httpClient, sideEffects } = arguments[1];
583
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
584
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
585
- fieldName: options === null || options === void 0 ? void 0 : options.fieldName,
586
- filter: options === null || options === void 0 ? void 0 : options.filter,
587
- order: options === null || options === void 0 ? void 0 : options.order,
588
- paging: options === null || options === void 0 ? void 0 : options.paging,
589
- cursorPaging: options === null || options === void 0 ? void 0 : options.cursorPaging,
590
- returnTotalCount: options === null || options === void 0 ? void 0 : options.returnTotalCount,
591
- consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
592
- }, []);
760
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
761
+ rootSchema: _queryDistinctValuesRequest,
762
+ depSchemas: {},
763
+ fqdnTransformation: {
764
+ paths: [],
765
+ transformation: _fromVeloEntity,
766
+ },
767
+ customTransformation: requestTransformation,
768
+ });
769
+ const { fromJSON } = (0, velo_1.serializer)({
770
+ rootSchema: _queryDistinctValuesResponse,
771
+ depSchemas: {},
772
+ fqdnTransformation: {
773
+ paths: [],
774
+ transformation: _toVeloEntity,
775
+ },
776
+ customTransformation: responseTransformation,
777
+ });
778
+ const payload = toAmbassadorRequest([options], []);
593
779
  const reqOpts = ambassadorWixDataV2DataItem.queryDistinctValues(payload);
594
780
  __log(`"QueryDistinctValues" sending request with: ${__inspect(reqOpts)}`);
595
781
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
596
782
  try {
597
783
  const result = yield httpClient.request(reqOpts);
598
784
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
599
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
785
+ return fromJSON(result.data, []);
600
786
  }
601
787
  catch (err) {
602
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
603
- spreadPathsToArguments: {},
604
- explicitPathsToArguments: {
605
- dataCollectionId: '$[0].dataCollectionId',
606
- fieldName: '$[0].fieldName',
607
- filter: '$[0].filter',
608
- order: '$[0].order',
609
- paging: '$[0].paging',
610
- cursorPaging: '$[0].cursorPaging',
611
- returnTotalCount: '$[0].returnTotalCount',
612
- consistentRead: '$[0].consistentRead',
613
- },
614
- singleArgumentUnchanged: false,
615
- }, ['options']);
788
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
789
+ 'options',
790
+ ]);
616
791
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
617
792
  throw transformedError;
618
793
  }
@@ -636,33 +811,45 @@ exports.queryDistinctValues = queryDistinctValues;
636
811
  function bulkInsertDataItems(options) {
637
812
  var _a, _b, _c;
638
813
  return __awaiter(this, arguments, void 0, function* () {
814
+ const requestTransformation = {
815
+ dataCollectionId: '$[0].dataCollectionId',
816
+ dataItems: '$[0].dataItems',
817
+ returnEntity: '$[0].returnEntity',
818
+ };
819
+ const responseTransformation = '$';
639
820
  // @ts-ignore
640
821
  const { httpClient, sideEffects } = arguments[1];
641
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
642
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
643
- dataItems: options === null || options === void 0 ? void 0 : options.dataItems,
644
- returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
645
- }, ['dataItems.data']);
822
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
823
+ rootSchema: _bulkInsertDataItemsRequest,
824
+ depSchemas: {},
825
+ fqdnTransformation: {
826
+ paths: [...['Array#dataItems']],
827
+ transformation: _fromVeloEntity,
828
+ },
829
+ customTransformation: requestTransformation,
830
+ });
831
+ const { fromJSON } = (0, velo_1.serializer)({
832
+ rootSchema: _bulkInsertDataItemsResponse,
833
+ depSchemas: {},
834
+ fqdnTransformation: {
835
+ paths: [...['Array#results.dataItem']],
836
+ transformation: _toVeloEntity,
837
+ },
838
+ customTransformation: responseTransformation,
839
+ });
840
+ const payload = toAmbassadorRequest([options], ['dataItems.data']);
646
841
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItems(payload);
647
842
  __log(`"BulkInsertDataItems" sending request with: ${__inspect(reqOpts)}`);
648
843
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
649
844
  try {
650
845
  const result = yield httpClient.request(reqOpts);
651
846
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
652
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
653
- 'results.dataItem.data',
654
- ]);
847
+ return fromJSON(result.data, ['results.dataItem.data']);
655
848
  }
656
849
  catch (err) {
657
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
658
- spreadPathsToArguments: {},
659
- explicitPathsToArguments: {
660
- dataCollectionId: '$[0].dataCollectionId',
661
- dataItems: '$[0].dataItems',
662
- returnEntity: '$[0].returnEntity',
663
- },
664
- singleArgumentUnchanged: false,
665
- }, ['options']);
850
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
851
+ 'options',
852
+ ]);
666
853
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
667
854
  throw transformedError;
668
855
  }
@@ -694,33 +881,45 @@ exports.bulkInsertDataItems = bulkInsertDataItems;
694
881
  function bulkUpdateDataItems(options) {
695
882
  var _a, _b, _c;
696
883
  return __awaiter(this, arguments, void 0, function* () {
884
+ const requestTransformation = {
885
+ dataCollectionId: '$[0].dataCollectionId',
886
+ dataItems: '$[0].dataItems',
887
+ returnEntity: '$[0].returnEntity',
888
+ };
889
+ const responseTransformation = '$';
697
890
  // @ts-ignore
698
891
  const { httpClient, sideEffects } = arguments[1];
699
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
700
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
701
- dataItems: options === null || options === void 0 ? void 0 : options.dataItems,
702
- returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
703
- }, ['dataItems.data']);
892
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
893
+ rootSchema: _bulkUpdateDataItemsRequest,
894
+ depSchemas: {},
895
+ fqdnTransformation: {
896
+ paths: [...['Array#dataItems']],
897
+ transformation: _fromVeloEntity,
898
+ },
899
+ customTransformation: requestTransformation,
900
+ });
901
+ const { fromJSON } = (0, velo_1.serializer)({
902
+ rootSchema: _bulkUpdateDataItemsResponse,
903
+ depSchemas: {},
904
+ fqdnTransformation: {
905
+ paths: [...['Array#results.dataItem']],
906
+ transformation: _toVeloEntity,
907
+ },
908
+ customTransformation: responseTransformation,
909
+ });
910
+ const payload = toAmbassadorRequest([options], ['dataItems.data']);
704
911
  const reqOpts = ambassadorWixDataV2DataItem.bulkUpdateDataItems(payload);
705
912
  __log(`"BulkUpdateDataItems" sending request with: ${__inspect(reqOpts)}`);
706
913
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
707
914
  try {
708
915
  const result = yield httpClient.request(reqOpts);
709
916
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
710
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
711
- 'results.dataItem.data',
712
- ]);
917
+ return fromJSON(result.data, ['results.dataItem.data']);
713
918
  }
714
919
  catch (err) {
715
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
716
- spreadPathsToArguments: {},
717
- explicitPathsToArguments: {
718
- dataCollectionId: '$[0].dataCollectionId',
719
- dataItems: '$[0].dataItems',
720
- returnEntity: '$[0].returnEntity',
721
- },
722
- singleArgumentUnchanged: false,
723
- }, ['options']);
920
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
921
+ 'options',
922
+ ]);
724
923
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
725
924
  throw transformedError;
726
925
  }
@@ -752,33 +951,45 @@ exports.bulkUpdateDataItems = bulkUpdateDataItems;
752
951
  function bulkSaveDataItems(options) {
753
952
  var _a, _b, _c;
754
953
  return __awaiter(this, arguments, void 0, function* () {
954
+ const requestTransformation = {
955
+ dataCollectionId: '$[0].dataCollectionId',
956
+ dataItems: '$[0].dataItems',
957
+ returnEntity: '$[0].returnEntity',
958
+ };
959
+ const responseTransformation = '$';
755
960
  // @ts-ignore
756
961
  const { httpClient, sideEffects } = arguments[1];
757
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
758
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
759
- dataItems: options === null || options === void 0 ? void 0 : options.dataItems,
760
- returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
761
- }, ['dataItems.data']);
962
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
963
+ rootSchema: _bulkSaveDataItemsRequest,
964
+ depSchemas: {},
965
+ fqdnTransformation: {
966
+ paths: [...['Array#dataItems']],
967
+ transformation: _fromVeloEntity,
968
+ },
969
+ customTransformation: requestTransformation,
970
+ });
971
+ const { fromJSON } = (0, velo_1.serializer)({
972
+ rootSchema: _bulkSaveDataItemsResponse,
973
+ depSchemas: {},
974
+ fqdnTransformation: {
975
+ paths: [...['Array#results.dataItem']],
976
+ transformation: _toVeloEntity,
977
+ },
978
+ customTransformation: responseTransformation,
979
+ });
980
+ const payload = toAmbassadorRequest([options], ['dataItems.data']);
762
981
  const reqOpts = ambassadorWixDataV2DataItem.bulkSaveDataItems(payload);
763
982
  __log(`"BulkSaveDataItems" sending request with: ${__inspect(reqOpts)}`);
764
983
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
765
984
  try {
766
985
  const result = yield httpClient.request(reqOpts);
767
986
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
768
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
769
- 'results.dataItem.data',
770
- ]);
987
+ return fromJSON(result.data, ['results.dataItem.data']);
771
988
  }
772
989
  catch (err) {
773
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
774
- spreadPathsToArguments: {},
775
- explicitPathsToArguments: {
776
- dataCollectionId: '$[0].dataCollectionId',
777
- dataItems: '$[0].dataItems',
778
- returnEntity: '$[0].returnEntity',
779
- },
780
- singleArgumentUnchanged: false,
781
- }, ['options']);
990
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
991
+ 'options',
992
+ ]);
782
993
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
783
994
  throw transformedError;
784
995
  }
@@ -804,31 +1015,44 @@ exports.bulkSaveDataItems = bulkSaveDataItems;
804
1015
  function bulkRemoveDataItems(options) {
805
1016
  var _a, _b, _c;
806
1017
  return __awaiter(this, arguments, void 0, function* () {
1018
+ const requestTransformation = {
1019
+ dataCollectionId: '$[0].dataCollectionId',
1020
+ dataItemIds: '$[0].dataItemIds',
1021
+ };
1022
+ const responseTransformation = '$';
807
1023
  // @ts-ignore
808
1024
  const { httpClient, sideEffects } = arguments[1];
809
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
810
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
811
- dataItemIds: options === null || options === void 0 ? void 0 : options.dataItemIds,
812
- }, []);
1025
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1026
+ rootSchema: _bulkRemoveDataItemsRequest,
1027
+ depSchemas: {},
1028
+ fqdnTransformation: {
1029
+ paths: [],
1030
+ transformation: _fromVeloEntity,
1031
+ },
1032
+ customTransformation: requestTransformation,
1033
+ });
1034
+ const { fromJSON } = (0, velo_1.serializer)({
1035
+ rootSchema: _bulkRemoveDataItemsResponse,
1036
+ depSchemas: {},
1037
+ fqdnTransformation: {
1038
+ paths: [...['Array#results.dataItem']],
1039
+ transformation: _toVeloEntity,
1040
+ },
1041
+ customTransformation: responseTransformation,
1042
+ });
1043
+ const payload = toAmbassadorRequest([options], []);
813
1044
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItems(payload);
814
1045
  __log(`"BulkRemoveDataItems" sending request with: ${__inspect(reqOpts)}`);
815
1046
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
816
1047
  try {
817
1048
  const result = yield httpClient.request(reqOpts);
818
1049
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
819
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
820
- 'results.dataItem.data',
821
- ]);
1050
+ return fromJSON(result.data, ['results.dataItem.data']);
822
1051
  }
823
1052
  catch (err) {
824
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
825
- spreadPathsToArguments: {},
826
- explicitPathsToArguments: {
827
- dataCollectionId: '$[0].dataCollectionId',
828
- dataItemIds: '$[0].dataItemIds',
829
- },
830
- singleArgumentUnchanged: false,
831
- }, ['options']);
1053
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1054
+ 'options',
1055
+ ]);
832
1056
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
833
1057
  throw transformedError;
834
1058
  }
@@ -857,43 +1081,50 @@ exports.bulkRemoveDataItems = bulkRemoveDataItems;
857
1081
  function queryReferencedDataItems(options) {
858
1082
  var _a, _b, _c;
859
1083
  return __awaiter(this, arguments, void 0, function* () {
1084
+ const requestTransformation = {
1085
+ dataCollectionId: '$[0].dataCollectionId',
1086
+ referringItemId: '$[0].referringItemId',
1087
+ referringItemFieldName: '$[0].referringItemFieldName',
1088
+ order: '$[0].order',
1089
+ paging: '$[0].paging',
1090
+ cursorPaging: '$[0].cursorPaging',
1091
+ returnTotalCount: '$[0].returnTotalCount',
1092
+ consistentRead: '$[0].consistentRead',
1093
+ };
1094
+ const responseTransformation = '$';
860
1095
  // @ts-ignore
861
1096
  const { httpClient, sideEffects } = arguments[1];
862
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
863
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
864
- referringItemId: options === null || options === void 0 ? void 0 : options.referringItemId,
865
- referringItemFieldName: options === null || options === void 0 ? void 0 : options.referringItemFieldName,
866
- order: options === null || options === void 0 ? void 0 : options.order,
867
- paging: options === null || options === void 0 ? void 0 : options.paging,
868
- cursorPaging: options === null || options === void 0 ? void 0 : options.cursorPaging,
869
- returnTotalCount: options === null || options === void 0 ? void 0 : options.returnTotalCount,
870
- consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
871
- }, []);
1097
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1098
+ rootSchema: _queryReferencedDataItemsRequest,
1099
+ depSchemas: {},
1100
+ fqdnTransformation: {
1101
+ paths: [],
1102
+ transformation: _fromVeloEntity,
1103
+ },
1104
+ customTransformation: requestTransformation,
1105
+ });
1106
+ const { fromJSON } = (0, velo_1.serializer)({
1107
+ rootSchema: _queryReferencedDataItemsResponse,
1108
+ depSchemas: {},
1109
+ fqdnTransformation: {
1110
+ paths: [...['Array#results.dataItem']],
1111
+ transformation: _toVeloEntity,
1112
+ },
1113
+ customTransformation: responseTransformation,
1114
+ });
1115
+ const payload = toAmbassadorRequest([options], []);
872
1116
  const reqOpts = ambassadorWixDataV2DataItem.queryReferencedDataItems(payload);
873
1117
  __log(`"QueryReferencedDataItems" sending request with: ${__inspect(reqOpts)}`);
874
1118
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
875
1119
  try {
876
1120
  const result = yield httpClient.request(reqOpts);
877
1121
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
878
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
879
- 'results.dataItem.data',
880
- ]);
1122
+ return fromJSON(result.data, ['results.dataItem.data']);
881
1123
  }
882
1124
  catch (err) {
883
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
884
- spreadPathsToArguments: {},
885
- explicitPathsToArguments: {
886
- dataCollectionId: '$[0].dataCollectionId',
887
- referringItemId: '$[0].referringItemId',
888
- referringItemFieldName: '$[0].referringItemFieldName',
889
- order: '$[0].order',
890
- paging: '$[0].paging',
891
- cursorPaging: '$[0].cursorPaging',
892
- returnTotalCount: '$[0].returnTotalCount',
893
- consistentRead: '$[0].consistentRead',
894
- },
895
- singleArgumentUnchanged: false,
896
- }, ['options']);
1125
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1126
+ 'options',
1127
+ ]);
897
1128
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
898
1129
  throw transformedError;
899
1130
  }
@@ -917,35 +1148,47 @@ exports.queryReferencedDataItems = queryReferencedDataItems;
917
1148
  function isReferencedDataItem(options) {
918
1149
  var _a, _b, _c;
919
1150
  return __awaiter(this, arguments, void 0, function* () {
1151
+ const requestTransformation = {
1152
+ dataCollectionId: '$[0].dataCollectionId',
1153
+ referringItemFieldName: '$[0].referringItemFieldName',
1154
+ referringItemId: '$[0].referringItemId',
1155
+ referencedItemId: '$[0].referencedItemId',
1156
+ consistentRead: '$[0].consistentRead',
1157
+ };
1158
+ const responseTransformation = '$';
920
1159
  // @ts-ignore
921
1160
  const { httpClient, sideEffects } = arguments[1];
922
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
923
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
924
- referringItemFieldName: options === null || options === void 0 ? void 0 : options.referringItemFieldName,
925
- referringItemId: options === null || options === void 0 ? void 0 : options.referringItemId,
926
- referencedItemId: options === null || options === void 0 ? void 0 : options.referencedItemId,
927
- consistentRead: options === null || options === void 0 ? void 0 : options.consistentRead,
928
- }, []);
1161
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1162
+ rootSchema: _isReferencedDataItemRequest,
1163
+ depSchemas: {},
1164
+ fqdnTransformation: {
1165
+ paths: [],
1166
+ transformation: _fromVeloEntity,
1167
+ },
1168
+ customTransformation: requestTransformation,
1169
+ });
1170
+ const { fromJSON } = (0, velo_1.serializer)({
1171
+ rootSchema: _isReferencedDataItemResponse,
1172
+ depSchemas: {},
1173
+ fqdnTransformation: {
1174
+ paths: [],
1175
+ transformation: _toVeloEntity,
1176
+ },
1177
+ customTransformation: responseTransformation,
1178
+ });
1179
+ const payload = toAmbassadorRequest([options], []);
929
1180
  const reqOpts = ambassadorWixDataV2DataItem.isReferencedDataItem(payload);
930
1181
  __log(`"IsReferencedDataItem" sending request with: ${__inspect(reqOpts)}`);
931
1182
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
932
1183
  try {
933
1184
  const result = yield httpClient.request(reqOpts);
934
1185
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
935
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1186
+ return fromJSON(result.data, []);
936
1187
  }
937
1188
  catch (err) {
938
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
939
- spreadPathsToArguments: {},
940
- explicitPathsToArguments: {
941
- dataCollectionId: '$[0].dataCollectionId',
942
- referringItemFieldName: '$[0].referringItemFieldName',
943
- referringItemId: '$[0].referringItemId',
944
- referencedItemId: '$[0].referencedItemId',
945
- consistentRead: '$[0].consistentRead',
946
- },
947
- singleArgumentUnchanged: false,
948
- }, ['options']);
1189
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1190
+ 'options',
1191
+ ]);
949
1192
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
950
1193
  throw transformedError;
951
1194
  }
@@ -970,29 +1213,44 @@ exports.isReferencedDataItem = isReferencedDataItem;
970
1213
  function insertDataItemReference(options) {
971
1214
  var _a, _b, _c;
972
1215
  return __awaiter(this, arguments, void 0, function* () {
1216
+ const requestTransformation = {
1217
+ dataCollectionId: '$[0].dataCollectionId',
1218
+ dataItemReference: '$[0].dataItemReference',
1219
+ };
1220
+ const responseTransformation = '$';
973
1221
  // @ts-ignore
974
1222
  const { httpClient, sideEffects } = arguments[1];
975
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
976
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
977
- dataItemReference: options === null || options === void 0 ? void 0 : options.dataItemReference,
978
- }, []);
1223
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1224
+ rootSchema: _insertDataItemReferenceRequest,
1225
+ depSchemas: {},
1226
+ fqdnTransformation: {
1227
+ paths: [],
1228
+ transformation: _fromVeloEntity,
1229
+ },
1230
+ customTransformation: requestTransformation,
1231
+ });
1232
+ const { fromJSON } = (0, velo_1.serializer)({
1233
+ rootSchema: _insertDataItemReferenceResponse,
1234
+ depSchemas: {},
1235
+ fqdnTransformation: {
1236
+ paths: [],
1237
+ transformation: _toVeloEntity,
1238
+ },
1239
+ customTransformation: responseTransformation,
1240
+ });
1241
+ const payload = toAmbassadorRequest([options], []);
979
1242
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItemReference(payload);
980
1243
  __log(`"InsertDataItemReference" sending request with: ${__inspect(reqOpts)}`);
981
1244
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
982
1245
  try {
983
1246
  const result = yield httpClient.request(reqOpts);
984
1247
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
985
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1248
+ return fromJSON(result.data, []);
986
1249
  }
987
1250
  catch (err) {
988
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
989
- spreadPathsToArguments: {},
990
- explicitPathsToArguments: {
991
- dataCollectionId: '$[0].dataCollectionId',
992
- dataItemReference: '$[0].dataItemReference',
993
- },
994
- singleArgumentUnchanged: false,
995
- }, ['options']);
1251
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1252
+ 'options',
1253
+ ]);
996
1254
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
997
1255
  throw transformedError;
998
1256
  }
@@ -1016,29 +1274,44 @@ exports.insertDataItemReference = insertDataItemReference;
1016
1274
  function removeDataItemReference(options) {
1017
1275
  var _a, _b, _c;
1018
1276
  return __awaiter(this, arguments, void 0, function* () {
1277
+ const requestTransformation = {
1278
+ dataCollectionId: '$[0].dataCollectionId',
1279
+ dataItemReference: '$[0].dataItemReference',
1280
+ };
1281
+ const responseTransformation = '$';
1019
1282
  // @ts-ignore
1020
1283
  const { httpClient, sideEffects } = arguments[1];
1021
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
1022
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1023
- dataItemReference: options === null || options === void 0 ? void 0 : options.dataItemReference,
1024
- }, []);
1284
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1285
+ rootSchema: _removeDataItemReferenceRequest,
1286
+ depSchemas: {},
1287
+ fqdnTransformation: {
1288
+ paths: [],
1289
+ transformation: _fromVeloEntity,
1290
+ },
1291
+ customTransformation: requestTransformation,
1292
+ });
1293
+ const { fromJSON } = (0, velo_1.serializer)({
1294
+ rootSchema: _removeDataItemReferenceResponse,
1295
+ depSchemas: {},
1296
+ fqdnTransformation: {
1297
+ paths: [],
1298
+ transformation: _toVeloEntity,
1299
+ },
1300
+ customTransformation: responseTransformation,
1301
+ });
1302
+ const payload = toAmbassadorRequest([options], []);
1025
1303
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItemReference(payload);
1026
1304
  __log(`"RemoveDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1027
1305
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1028
1306
  try {
1029
1307
  const result = yield httpClient.request(reqOpts);
1030
1308
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1031
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1309
+ return fromJSON(result.data, []);
1032
1310
  }
1033
1311
  catch (err) {
1034
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
1035
- spreadPathsToArguments: {},
1036
- explicitPathsToArguments: {
1037
- dataCollectionId: '$[0].dataCollectionId',
1038
- dataItemReference: '$[0].dataItemReference',
1039
- },
1040
- singleArgumentUnchanged: false,
1041
- }, ['options']);
1312
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1313
+ 'options',
1314
+ ]);
1042
1315
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1043
1316
  throw transformedError;
1044
1317
  }
@@ -1065,31 +1338,45 @@ exports.removeDataItemReference = removeDataItemReference;
1065
1338
  function bulkInsertDataItemReferences(options) {
1066
1339
  var _a, _b, _c;
1067
1340
  return __awaiter(this, arguments, void 0, function* () {
1341
+ const requestTransformation = {
1342
+ dataCollectionId: '$[0].dataCollectionId',
1343
+ dataItemReferences: '$[0].dataItemReferences',
1344
+ returnEntity: '$[0].returnEntity',
1345
+ };
1346
+ const responseTransformation = '$';
1068
1347
  // @ts-ignore
1069
1348
  const { httpClient, sideEffects } = arguments[1];
1070
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
1071
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1072
- dataItemReferences: options === null || options === void 0 ? void 0 : options.dataItemReferences,
1073
- returnEntity: options === null || options === void 0 ? void 0 : options.returnEntity,
1074
- }, []);
1349
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1350
+ rootSchema: _bulkInsertDataItemReferencesRequest,
1351
+ depSchemas: {},
1352
+ fqdnTransformation: {
1353
+ paths: [],
1354
+ transformation: _fromVeloEntity,
1355
+ },
1356
+ customTransformation: requestTransformation,
1357
+ });
1358
+ const { fromJSON } = (0, velo_1.serializer)({
1359
+ rootSchema: _bulkInsertDataItemReferencesResponse,
1360
+ depSchemas: {},
1361
+ fqdnTransformation: {
1362
+ paths: [],
1363
+ transformation: _toVeloEntity,
1364
+ },
1365
+ customTransformation: responseTransformation,
1366
+ });
1367
+ const payload = toAmbassadorRequest([options], []);
1075
1368
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItemReferences(payload);
1076
1369
  __log(`"BulkInsertDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1077
1370
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1078
1371
  try {
1079
1372
  const result = yield httpClient.request(reqOpts);
1080
1373
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1081
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1374
+ return fromJSON(result.data, []);
1082
1375
  }
1083
1376
  catch (err) {
1084
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
1085
- spreadPathsToArguments: {},
1086
- explicitPathsToArguments: {
1087
- dataCollectionId: '$[0].dataCollectionId',
1088
- dataItemReferences: '$[0].dataItemReferences',
1089
- returnEntity: '$[0].returnEntity',
1090
- },
1091
- singleArgumentUnchanged: false,
1092
- }, ['options']);
1377
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1378
+ 'options',
1379
+ ]);
1093
1380
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1094
1381
  throw transformedError;
1095
1382
  }
@@ -1113,29 +1400,44 @@ exports.bulkInsertDataItemReferences = bulkInsertDataItemReferences;
1113
1400
  function bulkRemoveDataItemReferences(options) {
1114
1401
  var _a, _b, _c;
1115
1402
  return __awaiter(this, arguments, void 0, function* () {
1403
+ const requestTransformation = {
1404
+ dataCollectionId: '$[0].dataCollectionId',
1405
+ dataItemReferences: '$[0].dataItemReferences',
1406
+ };
1407
+ const responseTransformation = '$';
1116
1408
  // @ts-ignore
1117
1409
  const { httpClient, sideEffects } = arguments[1];
1118
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
1119
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1120
- dataItemReferences: options === null || options === void 0 ? void 0 : options.dataItemReferences,
1121
- }, []);
1410
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1411
+ rootSchema: _bulkRemoveDataItemReferencesRequest,
1412
+ depSchemas: {},
1413
+ fqdnTransformation: {
1414
+ paths: [],
1415
+ transformation: _fromVeloEntity,
1416
+ },
1417
+ customTransformation: requestTransformation,
1418
+ });
1419
+ const { fromJSON } = (0, velo_1.serializer)({
1420
+ rootSchema: _bulkRemoveDataItemReferencesResponse,
1421
+ depSchemas: {},
1422
+ fqdnTransformation: {
1423
+ paths: [],
1424
+ transformation: _toVeloEntity,
1425
+ },
1426
+ customTransformation: responseTransformation,
1427
+ });
1428
+ const payload = toAmbassadorRequest([options], []);
1122
1429
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItemReferences(payload);
1123
1430
  __log(`"BulkRemoveDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1124
1431
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1125
1432
  try {
1126
1433
  const result = yield httpClient.request(reqOpts);
1127
1434
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1128
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1435
+ return fromJSON(result.data, []);
1129
1436
  }
1130
1437
  catch (err) {
1131
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
1132
- spreadPathsToArguments: {},
1133
- explicitPathsToArguments: {
1134
- dataCollectionId: '$[0].dataCollectionId',
1135
- dataItemReferences: '$[0].dataItemReferences',
1136
- },
1137
- singleArgumentUnchanged: false,
1138
- }, ['options']);
1438
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1439
+ 'options',
1440
+ ]);
1139
1441
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1140
1442
  throw transformedError;
1141
1443
  }
@@ -1162,33 +1464,46 @@ exports.bulkRemoveDataItemReferences = bulkRemoveDataItemReferences;
1162
1464
  function replaceDataItemReferences(options) {
1163
1465
  var _a, _b, _c;
1164
1466
  return __awaiter(this, arguments, void 0, function* () {
1467
+ const requestTransformation = {
1468
+ dataCollectionId: '$[0].dataCollectionId',
1469
+ referringItemFieldName: '$[0].referringItemFieldName',
1470
+ referringItemId: '$[0].referringItemId',
1471
+ newReferencedItemIds: '$[0].newReferencedItemIds',
1472
+ };
1473
+ const responseTransformation = '$';
1165
1474
  // @ts-ignore
1166
1475
  const { httpClient, sideEffects } = arguments[1];
1167
- const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({
1168
- dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId,
1169
- referringItemFieldName: options === null || options === void 0 ? void 0 : options.referringItemFieldName,
1170
- referringItemId: options === null || options === void 0 ? void 0 : options.referringItemId,
1171
- newReferencedItemIds: options === null || options === void 0 ? void 0 : options.newReferencedItemIds,
1172
- }, []);
1476
+ const { toAmbassadorRequest } = (0, velo_1.serializer)({
1477
+ rootSchema: _replaceDataItemReferencesRequest,
1478
+ depSchemas: {},
1479
+ fqdnTransformation: {
1480
+ paths: [],
1481
+ transformation: _fromVeloEntity,
1482
+ },
1483
+ customTransformation: requestTransformation,
1484
+ });
1485
+ const { fromJSON } = (0, velo_1.serializer)({
1486
+ rootSchema: _replaceDataItemReferencesResponse,
1487
+ depSchemas: {},
1488
+ fqdnTransformation: {
1489
+ paths: [],
1490
+ transformation: _toVeloEntity,
1491
+ },
1492
+ customTransformation: responseTransformation,
1493
+ });
1494
+ const payload = toAmbassadorRequest([options], []);
1173
1495
  const reqOpts = ambassadorWixDataV2DataItem.replaceDataItemReferences(payload);
1174
1496
  __log(`"ReplaceDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1175
1497
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1176
1498
  try {
1177
1499
  const result = yield httpClient.request(reqOpts);
1178
1500
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1179
- return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1501
+ return fromJSON(result.data, []);
1180
1502
  }
1181
1503
  catch (err) {
1182
- const transformedError = (0, sdk_runtime_1.transformError)(err, {
1183
- spreadPathsToArguments: {},
1184
- explicitPathsToArguments: {
1185
- dataCollectionId: '$[0].dataCollectionId',
1186
- referringItemFieldName: '$[0].referringItemFieldName',
1187
- referringItemId: '$[0].referringItemId',
1188
- newReferencedItemIds: '$[0].newReferencedItemIds',
1189
- },
1190
- singleArgumentUnchanged: false,
1191
- }, ['options']);
1504
+ const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1505
+ 'options',
1506
+ ]);
1192
1507
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1193
1508
  throw transformedError;
1194
1509
  }