@wix/data 1.0.60 → 1.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/build/cjs/index.js +5 -1
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/index.typings.js +5 -1
  4. package/build/cjs/index.typings.js.map +1 -1
  5. package/build/cjs/meta.js +5 -1
  6. package/build/cjs/meta.js.map +1 -1
  7. package/build/cjs/src/data-v1-external-database-connection.http.js +14 -54
  8. package/build/cjs/src/data-v1-external-database-connection.http.js.map +1 -1
  9. package/build/cjs/src/data-v1-external-database-connection.meta.d.ts +1 -1
  10. package/build/cjs/src/data-v1-external-database-connection.meta.js +5 -1
  11. package/build/cjs/src/data-v1-external-database-connection.meta.js.map +1 -1
  12. package/build/cjs/src/data-v1-external-database-connection.public.d.ts +1 -1
  13. package/build/cjs/src/data-v1-external-database-connection.types.js +4 -4
  14. package/build/cjs/src/data-v1-external-database-connection.types.js.map +1 -1
  15. package/build/cjs/src/data-v1-external-database-connection.universal.js +53 -149
  16. package/build/cjs/src/data-v1-external-database-connection.universal.js.map +1 -1
  17. package/build/cjs/src/data-v2-data-collection.http.js +10 -29
  18. package/build/cjs/src/data-v2-data-collection.http.js.map +1 -1
  19. package/build/cjs/src/data-v2-data-collection.meta.d.ts +1 -1
  20. package/build/cjs/src/data-v2-data-collection.meta.js +5 -1
  21. package/build/cjs/src/data-v2-data-collection.meta.js.map +1 -1
  22. package/build/cjs/src/data-v2-data-collection.public.d.ts +1 -1
  23. package/build/cjs/src/data-v2-data-collection.types.js +13 -13
  24. package/build/cjs/src/data-v2-data-collection.types.js.map +1 -1
  25. package/build/cjs/src/data-v2-data-collection.universal.js +43 -48
  26. package/build/cjs/src/data-v2-data-collection.universal.js.map +1 -1
  27. package/build/cjs/src/data-v2-data-item.http.js +46 -190
  28. package/build/cjs/src/data-v2-data-item.http.js.map +1 -1
  29. package/build/cjs/src/data-v2-data-item.meta.d.ts +1 -1
  30. package/build/cjs/src/data-v2-data-item.meta.js +5 -1
  31. package/build/cjs/src/data-v2-data-item.meta.js.map +1 -1
  32. package/build/cjs/src/data-v2-data-item.public.d.ts +13 -13
  33. package/build/cjs/src/data-v2-data-item.public.js.map +1 -1
  34. package/build/cjs/src/data-v2-data-item.types.js +4 -4
  35. package/build/cjs/src/data-v2-data-item.types.js.map +1 -1
  36. package/build/cjs/src/data-v2-data-item.universal.d.ts +15 -15
  37. package/build/cjs/src/data-v2-data-item.universal.js +354 -669
  38. package/build/cjs/src/data-v2-data-item.universal.js.map +1 -1
  39. package/build/cjs/src/data-v2-index.http.js +10 -28
  40. package/build/cjs/src/data-v2-index.http.js.map +1 -1
  41. package/build/cjs/src/data-v2-index.meta.d.ts +1 -1
  42. package/build/cjs/src/data-v2-index.meta.js +5 -1
  43. package/build/cjs/src/data-v2-index.meta.js.map +1 -1
  44. package/build/cjs/src/data-v2-index.public.d.ts +1 -1
  45. package/build/cjs/src/data-v2-index.types.js +3 -3
  46. package/build/cjs/src/data-v2-index.types.js.map +1 -1
  47. package/build/cjs/src/data-v2-index.universal.js +43 -93
  48. package/build/cjs/src/data-v2-index.universal.js.map +1 -1
  49. package/build/es/src/data-v1-external-database-connection.http.js +14 -54
  50. package/build/es/src/data-v1-external-database-connection.http.js.map +1 -1
  51. package/build/es/src/data-v1-external-database-connection.meta.d.ts +1 -1
  52. package/build/es/src/data-v1-external-database-connection.public.d.ts +1 -1
  53. package/build/es/src/data-v1-external-database-connection.universal.js +44 -144
  54. package/build/es/src/data-v1-external-database-connection.universal.js.map +1 -1
  55. package/build/es/src/data-v2-data-collection.http.js +10 -29
  56. package/build/es/src/data-v2-data-collection.http.js.map +1 -1
  57. package/build/es/src/data-v2-data-collection.meta.d.ts +1 -1
  58. package/build/es/src/data-v2-data-collection.public.d.ts +1 -1
  59. package/build/es/src/data-v2-data-collection.universal.js +25 -34
  60. package/build/es/src/data-v2-data-collection.universal.js.map +1 -1
  61. package/build/es/src/data-v2-data-item.http.js +46 -190
  62. package/build/es/src/data-v2-data-item.http.js.map +1 -1
  63. package/build/es/src/data-v2-data-item.meta.d.ts +1 -1
  64. package/build/es/src/data-v2-data-item.public.d.ts +13 -13
  65. package/build/es/src/data-v2-data-item.public.js.map +1 -1
  66. package/build/es/src/data-v2-data-item.universal.d.ts +15 -15
  67. package/build/es/src/data-v2-data-item.universal.js +346 -665
  68. package/build/es/src/data-v2-data-item.universal.js.map +1 -1
  69. package/build/es/src/data-v2-index.http.js +10 -28
  70. package/build/es/src/data-v2-index.http.js.map +1 -1
  71. package/build/es/src/data-v2-index.meta.d.ts +1 -1
  72. package/build/es/src/data-v2-index.public.d.ts +1 -1
  73. package/build/es/src/data-v2-index.universal.js +35 -89
  74. package/build/es/src/data-v2-index.universal.js.map +1 -1
  75. package/package.json +8 -8
@@ -1,7 +1,11 @@
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
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -30,9 +34,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
30
34
  Object.defineProperty(exports, "__esModule", { value: true });
31
35
  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;
32
36
  const velo_1 = require("@wix/metro-runtime/velo");
37
+ const sdk_runtime_1 = require("@wix/sdk-runtime");
33
38
  const ambassadorWixDataV2DataItem = __importStar(require("./data-v2-data-item.http"));
34
39
  // @ts-ignore
35
- const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
36
40
  let __verbose = false;
37
41
  function __log(...args) {
38
42
  __verbose && console.log(...args);
@@ -47,72 +51,29 @@ exports.__debug = {
47
51
  },
48
52
  };
49
53
  const _toVeloEntity = '$';
50
- const _fromVeloEntity = '$';
51
54
  var Environment;
52
55
  (function (Environment) {
53
56
  Environment["LIVE"] = "LIVE";
54
57
  Environment["SANDBOX"] = "SANDBOX";
55
- })(Environment = exports.Environment || (exports.Environment = {}));
58
+ })(Environment || (exports.Environment = Environment = {}));
56
59
  var Action;
57
60
  (function (Action) {
58
61
  Action["UNKNOWN_ACTION"] = "UNKNOWN_ACTION";
59
62
  Action["INSERTED"] = "INSERTED";
60
63
  Action["UPDATED"] = "UPDATED";
61
- })(Action = exports.Action || (exports.Action = {}));
64
+ })(Action || (exports.Action = Action = {}));
62
65
  var SortOrder;
63
66
  (function (SortOrder) {
64
67
  SortOrder["ASC"] = "ASC";
65
68
  SortOrder["DESC"] = "DESC";
66
- })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
69
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
67
70
  var BulkActionType;
68
71
  (function (BulkActionType) {
69
72
  BulkActionType["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
70
73
  BulkActionType["INSERT"] = "INSERT";
71
74
  BulkActionType["UPDATE"] = "UPDATE";
72
75
  BulkActionType["DELETE"] = "DELETE";
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 = {};
76
+ })(BulkActionType || (exports.BulkActionType = BulkActionType = {}));
116
77
  /**
117
78
  * Adds an item to a collection.
118
79
  *
@@ -137,44 +98,31 @@ const _updateDataItemResponse = {};
137
98
  function insertDataItem(options) {
138
99
  var _a, _b, _c;
139
100
  return __awaiter(this, arguments, void 0, function* () {
140
- const requestTransformation = {
141
- dataCollectionId: '$[0].dataCollectionId',
142
- dataItem: '$[0].dataItem',
143
- };
144
- const responseTransformation = '$';
145
101
  // @ts-ignore
146
102
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
166
107
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItem(payload);
167
108
  __log(`"InsertDataItem" sending request with: ${__inspect(reqOpts)}`);
168
109
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
169
110
  try {
170
111
  const result = yield httpClient.request(reqOpts);
171
112
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
172
- return fromJSON(result.data, ['dataItem.data']);
113
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
114
+ 'dataItem.data',
115
+ ]);
173
116
  }
174
117
  catch (err) {
175
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
176
- 'options',
177
- ]);
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']);
178
126
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
179
127
  throw transformedError;
180
128
  }
@@ -210,45 +158,31 @@ exports.insertDataItem = insertDataItem;
210
158
  function updateDataItem(_id, options) {
211
159
  var _a, _b, _c;
212
160
  return __awaiter(this, arguments, void 0, function* () {
213
- const requestTransformation = {
214
- dataItem: { '*': '$[1].dataItem', id: '$[0]' },
215
- dataCollectionId: '$[1].dataCollectionId',
216
- };
217
- const responseTransformation = '$';
218
161
  // @ts-ignore
219
162
  const { httpClient, sideEffects } = arguments[2];
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']);
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']);
239
167
  const reqOpts = ambassadorWixDataV2DataItem.updateDataItem(payload);
240
168
  __log(`"UpdateDataItem" sending request with: ${__inspect(reqOpts)}`);
241
169
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
242
170
  try {
243
171
  const result = yield httpClient.request(reqOpts);
244
172
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
245
- return fromJSON(result.data, ['dataItem.data']);
173
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
174
+ 'dataItem.data',
175
+ ]);
246
176
  }
247
177
  catch (err) {
248
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
249
- '_id',
250
- 'options',
251
- ]);
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']);
252
186
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
253
187
  throw transformedError;
254
188
  }
@@ -281,44 +215,31 @@ exports.updateDataItem = updateDataItem;
281
215
  function saveDataItem(options) {
282
216
  var _a, _b, _c;
283
217
  return __awaiter(this, arguments, void 0, function* () {
284
- const requestTransformation = {
285
- dataCollectionId: '$[0].dataCollectionId',
286
- dataItem: '$[0].dataItem',
287
- };
288
- const responseTransformation = '$';
289
218
  // @ts-ignore
290
219
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
310
224
  const reqOpts = ambassadorWixDataV2DataItem.saveDataItem(payload);
311
225
  __log(`"SaveDataItem" sending request with: ${__inspect(reqOpts)}`);
312
226
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
313
227
  try {
314
228
  const result = yield httpClient.request(reqOpts);
315
229
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
316
- return fromJSON(result.data, ['dataItem.data']);
230
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
231
+ 'dataItem.data',
232
+ ]);
317
233
  }
318
234
  catch (err) {
319
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
320
- 'options',
321
- ]);
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']);
322
243
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
323
244
  throw transformedError;
324
245
  }
@@ -341,49 +262,36 @@ exports.saveDataItem = saveDataItem;
341
262
  * @returns Retrieved item.
342
263
  */
343
264
  function getDataItem(dataItemId, options) {
344
- var _a, _b, _c;
265
+ var _a, _b, _c, _d;
345
266
  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';
352
267
  // @ts-ignore
353
268
  const { httpClient, sideEffects } = arguments[2];
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], []);
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
+ }, []);
373
274
  const reqOpts = ambassadorWixDataV2DataItem.getDataItem(payload);
374
275
  __log(`"GetDataItem" sending request with: ${__inspect(reqOpts)}`);
375
276
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
376
277
  try {
377
278
  const result = yield httpClient.request(reqOpts);
378
279
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
379
- return fromJSON(result.data, ['dataItem.data']);
280
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)((_c = result.data) === null || _c === void 0 ? void 0 : _c.dataItem, [
281
+ 'dataItem.data',
282
+ ]);
380
283
  }
381
284
  catch (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);
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);
387
295
  throw transformedError;
388
296
  }
389
297
  });
@@ -410,45 +318,28 @@ exports.getDataItem = getDataItem;
410
318
  function removeDataItem(dataItemId, options) {
411
319
  var _a, _b, _c;
412
320
  return __awaiter(this, arguments, void 0, function* () {
413
- const requestTransformation = {
414
- dataItemId: '$[0]',
415
- dataCollectionId: '$[1].dataCollectionId',
416
- };
417
- const responseTransformation = '$';
418
321
  // @ts-ignore
419
322
  const { httpClient, sideEffects } = arguments[2];
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], []);
323
+ const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({ dataItemId: dataItemId, dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
439
324
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItem(payload);
440
325
  __log(`"RemoveDataItem" sending request with: ${__inspect(reqOpts)}`);
441
326
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
442
327
  try {
443
328
  const result = yield httpClient.request(reqOpts);
444
329
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
445
- return fromJSON(result.data, ['dataItem.data']);
330
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
331
+ 'dataItem.data',
332
+ ]);
446
333
  }
447
334
  catch (err) {
448
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
449
- 'dataItemId',
450
- 'options',
451
- ]);
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']);
452
343
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
453
344
  throw transformedError;
454
345
  }
@@ -474,41 +365,22 @@ exports.removeDataItem = removeDataItem;
474
365
  function truncateDataItems(options) {
475
366
  var _a, _b, _c;
476
367
  return __awaiter(this, arguments, void 0, function* () {
477
- const requestTransformation = { dataCollectionId: '$[0].dataCollectionId' };
478
- const responseTransformation = '$';
479
368
  // @ts-ignore
480
369
  const { httpClient, sideEffects } = arguments[1];
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], []);
370
+ const payload = (0, sdk_runtime_1.renameKeysFromSDKRequestToRESTRequest)({ dataCollectionId: options === null || options === void 0 ? void 0 : options.dataCollectionId }, []);
500
371
  const reqOpts = ambassadorWixDataV2DataItem.truncateDataItems(payload);
501
372
  __log(`"TruncateDataItems" sending request with: ${__inspect(reqOpts)}`);
502
373
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
503
374
  try {
504
375
  const result = yield httpClient.request(reqOpts);
505
376
  (_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, []);
507
377
  }
508
378
  catch (err) {
509
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
510
- 'options',
511
- ]);
379
+ const transformedError = (0, sdk_runtime_1.transformError)(err, {
380
+ spreadPathsToArguments: {},
381
+ explicitPathsToArguments: { dataCollectionId: '$[0].dataCollectionId' },
382
+ singleArgumentUnchanged: false,
383
+ }, ['options']);
512
384
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
513
385
  throw transformedError;
514
386
  }
@@ -545,32 +417,9 @@ exports.truncateDataItems = truncateDataItems;
545
417
  * @applicableIdentity APP
546
418
  */
547
419
  function queryDataItems(options) {
548
- const requestTransformation = { '*': '$[1]', query: '$[0]' };
549
- const responseTransformation = {
550
- items: '$.dataItems',
551
- pagingMetadata: '$.pagingMetadata',
552
- };
553
420
  // @ts-ignore
554
421
  const { httpClient, sideEffects } = arguments[1];
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)({
422
+ return (0, sdk_runtime_1.queryBuilder)({
574
423
  func: (payload) => __awaiter(this, void 0, void 0, function* () {
575
424
  var _a, _b, _c;
576
425
  const reqOpts = ambassadorWixDataV2DataItem.queryDataItems(Object.assign(Object.assign({}, payload), options));
@@ -585,15 +434,22 @@ function queryDataItems(options) {
585
434
  throw err;
586
435
  }
587
436
  }),
588
- requestTransformer: (...args) => toAmbassadorRequest(args, []),
589
- responseTransformer: ({ data }) => fromJSON(data, ['dataItems.data']),
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']),
590
442
  errorTransformer: (err) => {
591
- const transformedError = (0, velo_1.transformError)(err, requestTransformation);
443
+ const transformedError = (0, sdk_runtime_1.transformError)(err, {
444
+ spreadPathsToArguments: {},
445
+ explicitPathsToArguments: { query: '$[0]' },
446
+ singleArgumentUnchanged: false,
447
+ });
592
448
  throw transformedError;
593
449
  },
594
450
  pagingMethod: 'OFFSET',
595
451
  transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity),
596
- })({ cursorWithEmptyFilterAndSort: true });
452
+ });
597
453
  }
598
454
  exports.queryDataItems = queryDataItems;
599
455
  /**
@@ -612,51 +468,43 @@ exports.queryDataItems = queryDataItems;
612
468
  function aggregateDataItems(options) {
613
469
  var _a, _b, _c;
614
470
  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 = '$';
627
471
  // @ts-ignore
628
472
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
648
484
  const reqOpts = ambassadorWixDataV2DataItem.aggregateDataItems(payload);
649
485
  __log(`"AggregateDataItems" sending request with: ${__inspect(reqOpts)}`);
650
486
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
651
487
  try {
652
488
  const result = yield httpClient.request(reqOpts);
653
489
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
654
- return fromJSON(result.data, []);
490
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
655
491
  }
656
492
  catch (err) {
657
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
658
- 'options',
659
- ]);
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']);
660
508
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
661
509
  throw transformedError;
662
510
  }
@@ -677,45 +525,31 @@ exports.aggregateDataItems = aggregateDataItems;
677
525
  function countDataItems(options) {
678
526
  var _a, _b, _c;
679
527
  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 = '$';
686
528
  // @ts-ignore
687
529
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
707
535
  const reqOpts = ambassadorWixDataV2DataItem.countDataItems(payload);
708
536
  __log(`"CountDataItems" sending request with: ${__inspect(reqOpts)}`);
709
537
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
710
538
  try {
711
539
  const result = yield httpClient.request(reqOpts);
712
540
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
713
- return fromJSON(result.data, []);
541
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
714
542
  }
715
543
  catch (err) {
716
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
717
- 'options',
718
- ]);
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']);
719
553
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
720
554
  throw transformedError;
721
555
  }
@@ -744,50 +578,41 @@ exports.countDataItems = countDataItems;
744
578
  function queryDistinctValues(options) {
745
579
  var _a, _b, _c;
746
580
  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 = '$';
758
581
  // @ts-ignore
759
582
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
779
593
  const reqOpts = ambassadorWixDataV2DataItem.queryDistinctValues(payload);
780
594
  __log(`"QueryDistinctValues" sending request with: ${__inspect(reqOpts)}`);
781
595
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
782
596
  try {
783
597
  const result = yield httpClient.request(reqOpts);
784
598
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
785
- return fromJSON(result.data, []);
599
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
786
600
  }
787
601
  catch (err) {
788
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
789
- 'options',
790
- ]);
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']);
791
616
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
792
617
  throw transformedError;
793
618
  }
@@ -811,45 +636,33 @@ exports.queryDistinctValues = queryDistinctValues;
811
636
  function bulkInsertDataItems(options) {
812
637
  var _a, _b, _c;
813
638
  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 = '$';
820
639
  // @ts-ignore
821
640
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
841
646
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItems(payload);
842
647
  __log(`"BulkInsertDataItems" sending request with: ${__inspect(reqOpts)}`);
843
648
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
844
649
  try {
845
650
  const result = yield httpClient.request(reqOpts);
846
651
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
847
- return fromJSON(result.data, ['results.dataItem.data']);
652
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
653
+ 'results.dataItem.data',
654
+ ]);
848
655
  }
849
656
  catch (err) {
850
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
851
- 'options',
852
- ]);
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']);
853
666
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
854
667
  throw transformedError;
855
668
  }
@@ -881,45 +694,33 @@ exports.bulkInsertDataItems = bulkInsertDataItems;
881
694
  function bulkUpdateDataItems(options) {
882
695
  var _a, _b, _c;
883
696
  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 = '$';
890
697
  // @ts-ignore
891
698
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
911
704
  const reqOpts = ambassadorWixDataV2DataItem.bulkUpdateDataItems(payload);
912
705
  __log(`"BulkUpdateDataItems" sending request with: ${__inspect(reqOpts)}`);
913
706
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
914
707
  try {
915
708
  const result = yield httpClient.request(reqOpts);
916
709
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
917
- return fromJSON(result.data, ['results.dataItem.data']);
710
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
711
+ 'results.dataItem.data',
712
+ ]);
918
713
  }
919
714
  catch (err) {
920
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
921
- 'options',
922
- ]);
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']);
923
724
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
924
725
  throw transformedError;
925
726
  }
@@ -951,45 +752,33 @@ exports.bulkUpdateDataItems = bulkUpdateDataItems;
951
752
  function bulkSaveDataItems(options) {
952
753
  var _a, _b, _c;
953
754
  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 = '$';
960
755
  // @ts-ignore
961
756
  const { httpClient, sideEffects } = arguments[1];
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']);
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']);
981
762
  const reqOpts = ambassadorWixDataV2DataItem.bulkSaveDataItems(payload);
982
763
  __log(`"BulkSaveDataItems" sending request with: ${__inspect(reqOpts)}`);
983
764
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
984
765
  try {
985
766
  const result = yield httpClient.request(reqOpts);
986
767
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
987
- return fromJSON(result.data, ['results.dataItem.data']);
768
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
769
+ 'results.dataItem.data',
770
+ ]);
988
771
  }
989
772
  catch (err) {
990
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
991
- 'options',
992
- ]);
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']);
993
782
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
994
783
  throw transformedError;
995
784
  }
@@ -1015,44 +804,31 @@ exports.bulkSaveDataItems = bulkSaveDataItems;
1015
804
  function bulkRemoveDataItems(options) {
1016
805
  var _a, _b, _c;
1017
806
  return __awaiter(this, arguments, void 0, function* () {
1018
- const requestTransformation = {
1019
- dataCollectionId: '$[0].dataCollectionId',
1020
- dataItemIds: '$[0].dataItemIds',
1021
- };
1022
- const responseTransformation = '$';
1023
807
  // @ts-ignore
1024
808
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1044
813
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItems(payload);
1045
814
  __log(`"BulkRemoveDataItems" sending request with: ${__inspect(reqOpts)}`);
1046
815
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1047
816
  try {
1048
817
  const result = yield httpClient.request(reqOpts);
1049
818
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1050
- return fromJSON(result.data, ['results.dataItem.data']);
819
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
820
+ 'results.dataItem.data',
821
+ ]);
1051
822
  }
1052
823
  catch (err) {
1053
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1054
- 'options',
1055
- ]);
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']);
1056
832
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1057
833
  throw transformedError;
1058
834
  }
@@ -1081,50 +857,43 @@ exports.bulkRemoveDataItems = bulkRemoveDataItems;
1081
857
  function queryReferencedDataItems(options) {
1082
858
  var _a, _b, _c;
1083
859
  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 = '$';
1095
860
  // @ts-ignore
1096
861
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1116
872
  const reqOpts = ambassadorWixDataV2DataItem.queryReferencedDataItems(payload);
1117
873
  __log(`"QueryReferencedDataItems" sending request with: ${__inspect(reqOpts)}`);
1118
874
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1119
875
  try {
1120
876
  const result = yield httpClient.request(reqOpts);
1121
877
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1122
- return fromJSON(result.data, ['results.dataItem.data']);
878
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, [
879
+ 'results.dataItem.data',
880
+ ]);
1123
881
  }
1124
882
  catch (err) {
1125
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1126
- 'options',
1127
- ]);
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']);
1128
897
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1129
898
  throw transformedError;
1130
899
  }
@@ -1148,47 +917,35 @@ exports.queryReferencedDataItems = queryReferencedDataItems;
1148
917
  function isReferencedDataItem(options) {
1149
918
  var _a, _b, _c;
1150
919
  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 = '$';
1159
920
  // @ts-ignore
1160
921
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1180
929
  const reqOpts = ambassadorWixDataV2DataItem.isReferencedDataItem(payload);
1181
930
  __log(`"IsReferencedDataItem" sending request with: ${__inspect(reqOpts)}`);
1182
931
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1183
932
  try {
1184
933
  const result = yield httpClient.request(reqOpts);
1185
934
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1186
- return fromJSON(result.data, []);
935
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1187
936
  }
1188
937
  catch (err) {
1189
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1190
- 'options',
1191
- ]);
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']);
1192
949
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1193
950
  throw transformedError;
1194
951
  }
@@ -1213,44 +970,29 @@ exports.isReferencedDataItem = isReferencedDataItem;
1213
970
  function insertDataItemReference(options) {
1214
971
  var _a, _b, _c;
1215
972
  return __awaiter(this, arguments, void 0, function* () {
1216
- const requestTransformation = {
1217
- dataCollectionId: '$[0].dataCollectionId',
1218
- dataItemReference: '$[0].dataItemReference',
1219
- };
1220
- const responseTransformation = '$';
1221
973
  // @ts-ignore
1222
974
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1242
979
  const reqOpts = ambassadorWixDataV2DataItem.insertDataItemReference(payload);
1243
980
  __log(`"InsertDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1244
981
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1245
982
  try {
1246
983
  const result = yield httpClient.request(reqOpts);
1247
984
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1248
- return fromJSON(result.data, []);
985
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1249
986
  }
1250
987
  catch (err) {
1251
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1252
- 'options',
1253
- ]);
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']);
1254
996
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1255
997
  throw transformedError;
1256
998
  }
@@ -1274,44 +1016,29 @@ exports.insertDataItemReference = insertDataItemReference;
1274
1016
  function removeDataItemReference(options) {
1275
1017
  var _a, _b, _c;
1276
1018
  return __awaiter(this, arguments, void 0, function* () {
1277
- const requestTransformation = {
1278
- dataCollectionId: '$[0].dataCollectionId',
1279
- dataItemReference: '$[0].dataItemReference',
1280
- };
1281
- const responseTransformation = '$';
1282
1019
  // @ts-ignore
1283
1020
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1303
1025
  const reqOpts = ambassadorWixDataV2DataItem.removeDataItemReference(payload);
1304
1026
  __log(`"RemoveDataItemReference" sending request with: ${__inspect(reqOpts)}`);
1305
1027
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1306
1028
  try {
1307
1029
  const result = yield httpClient.request(reqOpts);
1308
1030
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1309
- return fromJSON(result.data, []);
1031
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1310
1032
  }
1311
1033
  catch (err) {
1312
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1313
- 'options',
1314
- ]);
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']);
1315
1042
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1316
1043
  throw transformedError;
1317
1044
  }
@@ -1338,45 +1065,31 @@ exports.removeDataItemReference = removeDataItemReference;
1338
1065
  function bulkInsertDataItemReferences(options) {
1339
1066
  var _a, _b, _c;
1340
1067
  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 = '$';
1347
1068
  // @ts-ignore
1348
1069
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1368
1075
  const reqOpts = ambassadorWixDataV2DataItem.bulkInsertDataItemReferences(payload);
1369
1076
  __log(`"BulkInsertDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1370
1077
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1371
1078
  try {
1372
1079
  const result = yield httpClient.request(reqOpts);
1373
1080
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1374
- return fromJSON(result.data, []);
1081
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1375
1082
  }
1376
1083
  catch (err) {
1377
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1378
- 'options',
1379
- ]);
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']);
1380
1093
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1381
1094
  throw transformedError;
1382
1095
  }
@@ -1400,44 +1113,29 @@ exports.bulkInsertDataItemReferences = bulkInsertDataItemReferences;
1400
1113
  function bulkRemoveDataItemReferences(options) {
1401
1114
  var _a, _b, _c;
1402
1115
  return __awaiter(this, arguments, void 0, function* () {
1403
- const requestTransformation = {
1404
- dataCollectionId: '$[0].dataCollectionId',
1405
- dataItemReferences: '$[0].dataItemReferences',
1406
- };
1407
- const responseTransformation = '$';
1408
1116
  // @ts-ignore
1409
1117
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1429
1122
  const reqOpts = ambassadorWixDataV2DataItem.bulkRemoveDataItemReferences(payload);
1430
1123
  __log(`"BulkRemoveDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1431
1124
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1432
1125
  try {
1433
1126
  const result = yield httpClient.request(reqOpts);
1434
1127
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1435
- return fromJSON(result.data, []);
1128
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1436
1129
  }
1437
1130
  catch (err) {
1438
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1439
- 'options',
1440
- ]);
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']);
1441
1139
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1442
1140
  throw transformedError;
1443
1141
  }
@@ -1464,46 +1162,33 @@ exports.bulkRemoveDataItemReferences = bulkRemoveDataItemReferences;
1464
1162
  function replaceDataItemReferences(options) {
1465
1163
  var _a, _b, _c;
1466
1164
  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 = '$';
1474
1165
  // @ts-ignore
1475
1166
  const { httpClient, sideEffects } = arguments[1];
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], []);
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
+ }, []);
1495
1173
  const reqOpts = ambassadorWixDataV2DataItem.replaceDataItemReferences(payload);
1496
1174
  __log(`"ReplaceDataItemReferences" sending request with: ${__inspect(reqOpts)}`);
1497
1175
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1498
1176
  try {
1499
1177
  const result = yield httpClient.request(reqOpts);
1500
1178
  (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1501
- return fromJSON(result.data, []);
1179
+ return (0, sdk_runtime_1.renameKeysFromRESTResponseToSDKResponse)(result.data, []);
1502
1180
  }
1503
1181
  catch (err) {
1504
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
1505
- 'options',
1506
- ]);
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']);
1507
1192
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1508
1193
  throw transformedError;
1509
1194
  }