@wix/auto_sdk_bookings_resources 1.0.33 → 1.0.34

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 (29) hide show
  1. package/build/cjs/{bookings-resources-v2-resource-resources.universal-RnzqwcCV.d.ts → bookings-resources-v2-resource-resources.universal-BmmDoUqF.d.ts} +286 -2
  2. package/build/cjs/index.d.ts +14 -6
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +24 -0
  5. package/build/cjs/index.typings.js +812 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -1
  8. package/build/es/{bookings-resources-v2-resource-resources.universal-RnzqwcCV.d.mts → bookings-resources-v2-resource-resources.universal-BmmDoUqF.d.mts} +286 -2
  9. package/build/es/index.d.mts +14 -6
  10. package/build/es/index.mjs.map +1 -1
  11. package/build/es/index.typings.d.mts +24 -0
  12. package/build/es/index.typings.mjs +768 -0
  13. package/build/es/index.typings.mjs.map +1 -0
  14. package/build/es/meta.d.mts +1 -1
  15. package/build/internal/cjs/{bookings-resources-v2-resource-resources.universal-RnzqwcCV.d.ts → bookings-resources-v2-resource-resources.universal-BmmDoUqF.d.ts} +286 -2
  16. package/build/internal/cjs/index.d.ts +14 -6
  17. package/build/internal/cjs/index.js.map +1 -1
  18. package/build/internal/cjs/index.typings.d.ts +24 -0
  19. package/build/internal/cjs/index.typings.js +812 -0
  20. package/build/internal/cjs/index.typings.js.map +1 -0
  21. package/build/internal/cjs/meta.d.ts +1 -1
  22. package/build/internal/es/{bookings-resources-v2-resource-resources.universal-RnzqwcCV.d.mts → bookings-resources-v2-resource-resources.universal-BmmDoUqF.d.mts} +286 -2
  23. package/build/internal/es/index.d.mts +14 -6
  24. package/build/internal/es/index.mjs.map +1 -1
  25. package/build/internal/es/index.typings.d.mts +24 -0
  26. package/build/internal/es/index.typings.mjs +768 -0
  27. package/build/internal/es/index.typings.mjs.map +1 -0
  28. package/build/internal/es/meta.d.mts +1 -1
  29. package/package.json +2 -2
@@ -0,0 +1,768 @@
1
+ // src/bookings-resources-v2-resource-resources.universal.ts
2
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
3
+ import { queryBuilder } from "@wix/sdk-runtime/query-builder";
4
+ import {
5
+ renameKeysFromSDKRequestToRESTRequest,
6
+ renameKeysFromRESTResponseToSDKResponse
7
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
8
+
9
+ // src/bookings-resources-v2-resource-resources.http.ts
10
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
11
+ import { transformSDKFloatToRESTFloat } from "@wix/sdk-runtime/transformations/float";
12
+ import { transformRESTFloatToSDKFloat } from "@wix/sdk-runtime/transformations/float";
13
+ import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
14
+ import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
15
+ import { transformSDKFieldMaskToRESTFieldMask } from "@wix/sdk-runtime/transformations/field-mask";
16
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
17
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
18
+ function resolveWixBookingsResourcesV2ResourcesServiceUrl(opts) {
19
+ const domainToMappings = {
20
+ "manage._base_domain_": [
21
+ {
22
+ srcPath: "/bookings/v2/resources",
23
+ destPath: "/v2/resources"
24
+ },
25
+ {
26
+ srcPath: "/_api/bookings/v2/resources",
27
+ destPath: "/v2/resources"
28
+ },
29
+ {
30
+ srcPath: "/v2/bulk/resources",
31
+ destPath: "/v2/bulk/resources"
32
+ }
33
+ ],
34
+ "api._api_base_domain_": [
35
+ {
36
+ srcPath: "/resources-2",
37
+ destPath: ""
38
+ }
39
+ ],
40
+ "www.wixapis.com": [
41
+ {
42
+ srcPath: "/bookings/v2/resources",
43
+ destPath: "/v2/resources"
44
+ },
45
+ {
46
+ srcPath: "/bookings/v2/bulk/resources",
47
+ destPath: "/v2/bulk/resources"
48
+ }
49
+ ],
50
+ "*.dev.wix-code.com": [
51
+ {
52
+ srcPath: "/_api/resources-2",
53
+ destPath: ""
54
+ }
55
+ ]
56
+ };
57
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
58
+ }
59
+ var PACKAGE_NAME = "@wix/auto_sdk_bookings_resources";
60
+ function createResource(payload) {
61
+ function __createResource({ host }) {
62
+ const serializedData = transformPaths(payload, [
63
+ {
64
+ transformFn: transformSDKTimestampToRESTTimestamp,
65
+ paths: [
66
+ { path: "resource.createdDate" },
67
+ { path: "resource.updatedDate" }
68
+ ]
69
+ }
70
+ ]);
71
+ const metadata = {
72
+ entityFqdn: "wix.bookings.resources.v2.resource",
73
+ method: "POST",
74
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.CreateResource",
75
+ packageName: PACKAGE_NAME,
76
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
77
+ protoPath: "/v2/resources",
78
+ data: serializedData,
79
+ host
80
+ }),
81
+ data: serializedData,
82
+ transformResponse: (payload2) => transformPaths(payload2, [
83
+ {
84
+ transformFn: transformRESTTimestampToSDKTimestamp,
85
+ paths: [
86
+ { path: "resource.createdDate" },
87
+ { path: "resource.updatedDate" }
88
+ ]
89
+ }
90
+ ])
91
+ };
92
+ return metadata;
93
+ }
94
+ return __createResource;
95
+ }
96
+ function bulkCreateResources(payload) {
97
+ function __bulkCreateResources({ host }) {
98
+ const serializedData = transformPaths(payload, [
99
+ {
100
+ transformFn: transformSDKTimestampToRESTTimestamp,
101
+ paths: [
102
+ { path: "resources.createdDate" },
103
+ { path: "resources.updatedDate" }
104
+ ]
105
+ }
106
+ ]);
107
+ const metadata = {
108
+ entityFqdn: "wix.bookings.resources.v2.resource",
109
+ method: "POST",
110
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.BulkCreateResources",
111
+ packageName: PACKAGE_NAME,
112
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
113
+ protoPath: "/v2/bulk/resources/create",
114
+ data: serializedData,
115
+ host
116
+ }),
117
+ data: serializedData,
118
+ transformResponse: (payload2) => transformPaths(payload2, [
119
+ {
120
+ transformFn: transformRESTTimestampToSDKTimestamp,
121
+ paths: [
122
+ { path: "results.item.createdDate" },
123
+ { path: "results.item.updatedDate" }
124
+ ]
125
+ }
126
+ ])
127
+ };
128
+ return metadata;
129
+ }
130
+ return __bulkCreateResources;
131
+ }
132
+ function getResource(payload) {
133
+ function __getResource({ host }) {
134
+ const metadata = {
135
+ entityFqdn: "wix.bookings.resources.v2.resource",
136
+ method: "GET",
137
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.GetResource",
138
+ packageName: PACKAGE_NAME,
139
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
140
+ protoPath: "/v2/resources/{resourceId}",
141
+ data: payload,
142
+ host
143
+ }),
144
+ params: toURLSearchParams(payload),
145
+ transformResponse: (payload2) => transformPaths(payload2, [
146
+ {
147
+ transformFn: transformRESTTimestampToSDKTimestamp,
148
+ paths: [
149
+ { path: "resource.createdDate" },
150
+ { path: "resource.updatedDate" }
151
+ ]
152
+ }
153
+ ])
154
+ };
155
+ return metadata;
156
+ }
157
+ return __getResource;
158
+ }
159
+ function updateResource(payload) {
160
+ function __updateResource({ host }) {
161
+ const serializedData = transformPaths(payload, [
162
+ {
163
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
164
+ paths: [{ path: "mask" }]
165
+ },
166
+ {
167
+ transformFn: transformSDKTimestampToRESTTimestamp,
168
+ paths: [
169
+ { path: "resource.createdDate" },
170
+ { path: "resource.updatedDate" }
171
+ ]
172
+ }
173
+ ]);
174
+ const metadata = {
175
+ entityFqdn: "wix.bookings.resources.v2.resource",
176
+ method: "PATCH",
177
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.UpdateResource",
178
+ packageName: PACKAGE_NAME,
179
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
180
+ protoPath: "/v2/resources/{resource.id}",
181
+ data: serializedData,
182
+ host
183
+ }),
184
+ data: serializedData,
185
+ transformResponse: (payload2) => transformPaths(payload2, [
186
+ {
187
+ transformFn: transformRESTTimestampToSDKTimestamp,
188
+ paths: [
189
+ { path: "resource.createdDate" },
190
+ { path: "resource.updatedDate" }
191
+ ]
192
+ }
193
+ ])
194
+ };
195
+ return metadata;
196
+ }
197
+ return __updateResource;
198
+ }
199
+ function bulkUpdateResources(payload) {
200
+ function __bulkUpdateResources({ host }) {
201
+ const serializedData = transformPaths(payload, [
202
+ {
203
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
204
+ paths: [{ path: "resources.fieldMask" }]
205
+ },
206
+ {
207
+ transformFn: transformSDKTimestampToRESTTimestamp,
208
+ paths: [
209
+ { path: "resources.resource.createdDate" },
210
+ { path: "resources.resource.updatedDate" }
211
+ ]
212
+ }
213
+ ]);
214
+ const metadata = {
215
+ entityFqdn: "wix.bookings.resources.v2.resource",
216
+ method: "POST",
217
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.BulkUpdateResources",
218
+ packageName: PACKAGE_NAME,
219
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
220
+ protoPath: "/v2/bulk/resources/update",
221
+ data: serializedData,
222
+ host
223
+ }),
224
+ data: serializedData,
225
+ transformResponse: (payload2) => transformPaths(payload2, [
226
+ {
227
+ transformFn: transformRESTTimestampToSDKTimestamp,
228
+ paths: [
229
+ { path: "results.item.createdDate" },
230
+ { path: "results.item.updatedDate" }
231
+ ]
232
+ }
233
+ ])
234
+ };
235
+ return metadata;
236
+ }
237
+ return __bulkUpdateResources;
238
+ }
239
+ function deleteResource(payload) {
240
+ function __deleteResource({ host }) {
241
+ const metadata = {
242
+ entityFqdn: "wix.bookings.resources.v2.resource",
243
+ method: "DELETE",
244
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.DeleteResource",
245
+ packageName: PACKAGE_NAME,
246
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
247
+ protoPath: "/v2/resources/{resourceId}",
248
+ data: payload,
249
+ host
250
+ }),
251
+ params: toURLSearchParams(payload)
252
+ };
253
+ return metadata;
254
+ }
255
+ return __deleteResource;
256
+ }
257
+ function bulkDeleteResources(payload) {
258
+ function __bulkDeleteResources({ host }) {
259
+ const metadata = {
260
+ entityFqdn: "wix.bookings.resources.v2.resource",
261
+ method: "POST",
262
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.BulkDeleteResources",
263
+ packageName: PACKAGE_NAME,
264
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
265
+ protoPath: "/v2/bulk/resources/delete",
266
+ data: payload,
267
+ host
268
+ }),
269
+ data: payload,
270
+ transformResponse: (payload2) => transformPaths(payload2, [
271
+ {
272
+ transformFn: transformRESTTimestampToSDKTimestamp,
273
+ paths: [
274
+ { path: "results.item.createdDate" },
275
+ { path: "results.item.updatedDate" }
276
+ ]
277
+ }
278
+ ])
279
+ };
280
+ return metadata;
281
+ }
282
+ return __bulkDeleteResources;
283
+ }
284
+ function searchResources(payload) {
285
+ function __searchResources({ host }) {
286
+ const serializedData = transformPaths(payload, [
287
+ {
288
+ transformFn: transformSDKFloatToRESTFloat,
289
+ paths: [
290
+ { path: "search.aggregations.range.buckets.from" },
291
+ { path: "search.aggregations.range.buckets.to" },
292
+ {
293
+ path: "search.aggregations.nested.nestedAggregations.range.buckets.from"
294
+ },
295
+ {
296
+ path: "search.aggregations.nested.nestedAggregations.range.buckets.to"
297
+ }
298
+ ]
299
+ }
300
+ ]);
301
+ const metadata = {
302
+ entityFqdn: "wix.bookings.resources.v2.resource",
303
+ method: "POST",
304
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.SearchResources",
305
+ packageName: PACKAGE_NAME,
306
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
307
+ protoPath: "/v2/resources/search",
308
+ data: serializedData,
309
+ host
310
+ }),
311
+ data: serializedData,
312
+ transformResponse: (payload2) => transformPaths(payload2, [
313
+ {
314
+ transformFn: transformRESTTimestampToSDKTimestamp,
315
+ paths: [
316
+ { path: "resources.createdDate" },
317
+ { path: "resources.updatedDate" }
318
+ ]
319
+ },
320
+ {
321
+ transformFn: transformRESTFloatToSDKFloat,
322
+ paths: [
323
+ { path: "aggregationData.results.ranges.results.from" },
324
+ { path: "aggregationData.results.ranges.results.to" },
325
+ {
326
+ path: "aggregationData.results.groupedByValue.results.nestedResults.ranges.results.from"
327
+ },
328
+ {
329
+ path: "aggregationData.results.groupedByValue.results.nestedResults.ranges.results.to"
330
+ },
331
+ {
332
+ path: "aggregationData.results.nested.results.results.*.range.from"
333
+ },
334
+ {
335
+ path: "aggregationData.results.nested.results.results.*.range.to"
336
+ },
337
+ { path: "aggregationData.results.scalar.value" },
338
+ {
339
+ path: "aggregationData.results.groupedByValue.results.nestedResults.scalar.value"
340
+ },
341
+ {
342
+ path: "aggregationData.results.nested.results.results.*.scalar.value"
343
+ }
344
+ ]
345
+ }
346
+ ])
347
+ };
348
+ return metadata;
349
+ }
350
+ return __searchResources;
351
+ }
352
+ function queryResources(payload) {
353
+ function __queryResources({ host }) {
354
+ const metadata = {
355
+ entityFqdn: "wix.bookings.resources.v2.resource",
356
+ method: "POST",
357
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.QueryResources",
358
+ packageName: PACKAGE_NAME,
359
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
360
+ protoPath: "/v2/resources/query",
361
+ data: payload,
362
+ host
363
+ }),
364
+ data: payload,
365
+ transformResponse: (payload2) => transformPaths(payload2, [
366
+ {
367
+ transformFn: transformRESTTimestampToSDKTimestamp,
368
+ paths: [
369
+ { path: "resources.createdDate" },
370
+ { path: "resources.updatedDate" }
371
+ ]
372
+ }
373
+ ])
374
+ };
375
+ return metadata;
376
+ }
377
+ return __queryResources;
378
+ }
379
+ function countResources(payload) {
380
+ function __countResources({ host }) {
381
+ const metadata = {
382
+ entityFqdn: "wix.bookings.resources.v2.resource",
383
+ method: "POST",
384
+ methodFqn: "wix.bookings.resources.v2.ResourcesService.CountResources",
385
+ packageName: PACKAGE_NAME,
386
+ url: resolveWixBookingsResourcesV2ResourcesServiceUrl({
387
+ protoPath: "/v2/resources/count",
388
+ data: payload,
389
+ host
390
+ }),
391
+ data: payload
392
+ };
393
+ return metadata;
394
+ }
395
+ return __countResources;
396
+ }
397
+
398
+ // src/bookings-resources-v2-resource-resources.universal.ts
399
+ import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
400
+ var ManagementType = /* @__PURE__ */ ((ManagementType2) => {
401
+ ManagementType2["WIX_USER"] = "WIX_USER";
402
+ return ManagementType2;
403
+ })(ManagementType || {});
404
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
405
+ SortOrder2["ASC"] = "ASC";
406
+ SortOrder2["DESC"] = "DESC";
407
+ return SortOrder2;
408
+ })(SortOrder || {});
409
+ var SortType = /* @__PURE__ */ ((SortType2) => {
410
+ SortType2["COUNT"] = "COUNT";
411
+ SortType2["VALUE"] = "VALUE";
412
+ return SortType2;
413
+ })(SortType || {});
414
+ var SortDirection = /* @__PURE__ */ ((SortDirection2) => {
415
+ SortDirection2["DESC"] = "DESC";
416
+ SortDirection2["ASC"] = "ASC";
417
+ return SortDirection2;
418
+ })(SortDirection || {});
419
+ var MissingValues = /* @__PURE__ */ ((MissingValues2) => {
420
+ MissingValues2["EXCLUDE"] = "EXCLUDE";
421
+ MissingValues2["INCLUDE"] = "INCLUDE";
422
+ return MissingValues2;
423
+ })(MissingValues || {});
424
+ var ScalarType = /* @__PURE__ */ ((ScalarType2) => {
425
+ ScalarType2["UNKNOWN_SCALAR_TYPE"] = "UNKNOWN_SCALAR_TYPE";
426
+ ScalarType2["COUNT_DISTINCT"] = "COUNT_DISTINCT";
427
+ ScalarType2["MIN"] = "MIN";
428
+ ScalarType2["MAX"] = "MAX";
429
+ return ScalarType2;
430
+ })(ScalarType || {});
431
+ var NestedAggregationType = /* @__PURE__ */ ((NestedAggregationType2) => {
432
+ NestedAggregationType2["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
433
+ NestedAggregationType2["VALUE"] = "VALUE";
434
+ NestedAggregationType2["RANGE"] = "RANGE";
435
+ NestedAggregationType2["SCALAR"] = "SCALAR";
436
+ NestedAggregationType2["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
437
+ return NestedAggregationType2;
438
+ })(NestedAggregationType || {});
439
+ var Interval = /* @__PURE__ */ ((Interval2) => {
440
+ Interval2["UNKNOWN_INTERVAL"] = "UNKNOWN_INTERVAL";
441
+ Interval2["YEAR"] = "YEAR";
442
+ Interval2["MONTH"] = "MONTH";
443
+ Interval2["WEEK"] = "WEEK";
444
+ Interval2["DAY"] = "DAY";
445
+ Interval2["HOUR"] = "HOUR";
446
+ Interval2["MINUTE"] = "MINUTE";
447
+ Interval2["SECOND"] = "SECOND";
448
+ return Interval2;
449
+ })(Interval || {});
450
+ var AggregationType = /* @__PURE__ */ ((AggregationType2) => {
451
+ AggregationType2["UNKNOWN_AGGREGATION_TYPE"] = "UNKNOWN_AGGREGATION_TYPE";
452
+ AggregationType2["VALUE"] = "VALUE";
453
+ AggregationType2["RANGE"] = "RANGE";
454
+ AggregationType2["SCALAR"] = "SCALAR";
455
+ AggregationType2["DATE_HISTOGRAM"] = "DATE_HISTOGRAM";
456
+ AggregationType2["NESTED"] = "NESTED";
457
+ return AggregationType2;
458
+ })(AggregationType || {});
459
+ var Mode = /* @__PURE__ */ ((Mode2) => {
460
+ Mode2["OR"] = "OR";
461
+ Mode2["AND"] = "AND";
462
+ return Mode2;
463
+ })(Mode || {});
464
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
465
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
466
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
467
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
468
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
469
+ WebhookIdentityType2["APP"] = "APP";
470
+ return WebhookIdentityType2;
471
+ })(WebhookIdentityType || {});
472
+ async function createResource2(resource) {
473
+ const { httpClient, sideEffects } = arguments[1];
474
+ const payload = renameKeysFromSDKRequestToRESTRequest({ resource });
475
+ const reqOpts = createResource(payload);
476
+ sideEffects?.onSiteCall?.();
477
+ try {
478
+ const result = await httpClient.request(reqOpts);
479
+ sideEffects?.onSuccess?.(result);
480
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.resource;
481
+ } catch (err) {
482
+ const transformedError = sdkTransformError(
483
+ err,
484
+ {
485
+ spreadPathsToArguments: {},
486
+ explicitPathsToArguments: { resource: "$[0]" },
487
+ singleArgumentUnchanged: false
488
+ },
489
+ ["resource"]
490
+ );
491
+ sideEffects?.onError?.(err);
492
+ throw transformedError;
493
+ }
494
+ }
495
+ async function bulkCreateResources2(resources, options) {
496
+ const { httpClient, sideEffects } = arguments[2];
497
+ const payload = renameKeysFromSDKRequestToRESTRequest({
498
+ resources,
499
+ returnEntity: options?.returnEntity
500
+ });
501
+ const reqOpts = bulkCreateResources(payload);
502
+ sideEffects?.onSiteCall?.();
503
+ try {
504
+ const result = await httpClient.request(reqOpts);
505
+ sideEffects?.onSuccess?.(result);
506
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
507
+ } catch (err) {
508
+ const transformedError = sdkTransformError(
509
+ err,
510
+ {
511
+ spreadPathsToArguments: {},
512
+ explicitPathsToArguments: {
513
+ resources: "$[0]",
514
+ returnEntity: "$[1].returnEntity"
515
+ },
516
+ singleArgumentUnchanged: false
517
+ },
518
+ ["resources", "options"]
519
+ );
520
+ sideEffects?.onError?.(err);
521
+ throw transformedError;
522
+ }
523
+ }
524
+ async function getResource2(resourceId) {
525
+ const { httpClient, sideEffects } = arguments[1];
526
+ const payload = renameKeysFromSDKRequestToRESTRequest({
527
+ resourceId
528
+ });
529
+ const reqOpts = getResource(payload);
530
+ sideEffects?.onSiteCall?.();
531
+ try {
532
+ const result = await httpClient.request(reqOpts);
533
+ sideEffects?.onSuccess?.(result);
534
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.resource;
535
+ } catch (err) {
536
+ const transformedError = sdkTransformError(
537
+ err,
538
+ {
539
+ spreadPathsToArguments: {},
540
+ explicitPathsToArguments: { resourceId: "$[0]" },
541
+ singleArgumentUnchanged: false
542
+ },
543
+ ["resourceId"]
544
+ );
545
+ sideEffects?.onError?.(err);
546
+ throw transformedError;
547
+ }
548
+ }
549
+ async function updateResource2(_id, resource) {
550
+ const { httpClient, sideEffects } = arguments[2];
551
+ const payload = renameKeysFromSDKRequestToRESTRequest({
552
+ resource: { ...resource, id: _id }
553
+ });
554
+ const reqOpts = updateResource(payload);
555
+ sideEffects?.onSiteCall?.();
556
+ try {
557
+ const result = await httpClient.request(reqOpts);
558
+ sideEffects?.onSuccess?.(result);
559
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.resource;
560
+ } catch (err) {
561
+ const transformedError = sdkTransformError(
562
+ err,
563
+ {
564
+ spreadPathsToArguments: { resource: "$[1]" },
565
+ explicitPathsToArguments: { "resource.id": "$[0]" },
566
+ singleArgumentUnchanged: false
567
+ },
568
+ ["_id", "resource"]
569
+ );
570
+ sideEffects?.onError?.(err);
571
+ throw transformedError;
572
+ }
573
+ }
574
+ async function bulkUpdateResources2(resources, options) {
575
+ const { httpClient, sideEffects } = arguments[2];
576
+ const payload = renameKeysFromSDKRequestToRESTRequest({
577
+ resources,
578
+ returnEntity: options?.returnEntity
579
+ });
580
+ const reqOpts = bulkUpdateResources(payload);
581
+ sideEffects?.onSiteCall?.();
582
+ try {
583
+ const result = await httpClient.request(reqOpts);
584
+ sideEffects?.onSuccess?.(result);
585
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
586
+ } catch (err) {
587
+ const transformedError = sdkTransformError(
588
+ err,
589
+ {
590
+ spreadPathsToArguments: {},
591
+ explicitPathsToArguments: {
592
+ resources: "$[0]",
593
+ returnEntity: "$[1].returnEntity"
594
+ },
595
+ singleArgumentUnchanged: false
596
+ },
597
+ ["resources", "options"]
598
+ );
599
+ sideEffects?.onError?.(err);
600
+ throw transformedError;
601
+ }
602
+ }
603
+ async function deleteResource2(resourceId) {
604
+ const { httpClient, sideEffects } = arguments[1];
605
+ const payload = renameKeysFromSDKRequestToRESTRequest({
606
+ resourceId
607
+ });
608
+ const reqOpts = deleteResource(payload);
609
+ sideEffects?.onSiteCall?.();
610
+ try {
611
+ const result = await httpClient.request(reqOpts);
612
+ sideEffects?.onSuccess?.(result);
613
+ } catch (err) {
614
+ const transformedError = sdkTransformError(
615
+ err,
616
+ {
617
+ spreadPathsToArguments: {},
618
+ explicitPathsToArguments: { resourceId: "$[0]" },
619
+ singleArgumentUnchanged: false
620
+ },
621
+ ["resourceId"]
622
+ );
623
+ sideEffects?.onError?.(err);
624
+ throw transformedError;
625
+ }
626
+ }
627
+ async function bulkDeleteResources2(ids) {
628
+ const { httpClient, sideEffects } = arguments[1];
629
+ const payload = renameKeysFromSDKRequestToRESTRequest({ ids });
630
+ const reqOpts = bulkDeleteResources(payload);
631
+ sideEffects?.onSiteCall?.();
632
+ try {
633
+ const result = await httpClient.request(reqOpts);
634
+ sideEffects?.onSuccess?.(result);
635
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
636
+ } catch (err) {
637
+ const transformedError = sdkTransformError(
638
+ err,
639
+ {
640
+ spreadPathsToArguments: {},
641
+ explicitPathsToArguments: { ids: "$[0]" },
642
+ singleArgumentUnchanged: false
643
+ },
644
+ ["ids"]
645
+ );
646
+ sideEffects?.onError?.(err);
647
+ throw transformedError;
648
+ }
649
+ }
650
+ async function searchResources2(search) {
651
+ const { httpClient, sideEffects } = arguments[1];
652
+ const payload = renameKeysFromSDKRequestToRESTRequest({ search });
653
+ const reqOpts = searchResources(payload);
654
+ sideEffects?.onSiteCall?.();
655
+ try {
656
+ const result = await httpClient.request(reqOpts);
657
+ sideEffects?.onSuccess?.(result);
658
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
659
+ } catch (err) {
660
+ const transformedError = sdkTransformError(
661
+ err,
662
+ {
663
+ spreadPathsToArguments: {},
664
+ explicitPathsToArguments: { search: "$[0]" },
665
+ singleArgumentUnchanged: false
666
+ },
667
+ ["search"]
668
+ );
669
+ sideEffects?.onError?.(err);
670
+ throw transformedError;
671
+ }
672
+ }
673
+ function queryResources2() {
674
+ const { httpClient, sideEffects } = arguments[0];
675
+ return queryBuilder({
676
+ func: async (payload) => {
677
+ const reqOpts = queryResources(payload);
678
+ sideEffects?.onSiteCall?.();
679
+ try {
680
+ const result = await httpClient.request(reqOpts);
681
+ sideEffects?.onSuccess?.(result);
682
+ return result;
683
+ } catch (err) {
684
+ sideEffects?.onError?.(err);
685
+ throw err;
686
+ }
687
+ },
688
+ requestTransformer: (query) => {
689
+ const args = [query, {}];
690
+ return renameKeysFromSDKRequestToRESTRequest({
691
+ ...args?.[1],
692
+ query: args?.[0]
693
+ });
694
+ },
695
+ responseTransformer: ({ data }) => {
696
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(
697
+ transformPaths2(data, [])
698
+ );
699
+ return {
700
+ items: transformedData?.resources,
701
+ pagingMetadata: transformedData?.pagingMetadata
702
+ };
703
+ },
704
+ errorTransformer: (err) => {
705
+ const transformedError = sdkTransformError(err, {
706
+ spreadPathsToArguments: {},
707
+ explicitPathsToArguments: { query: "$[0]" },
708
+ singleArgumentUnchanged: false
709
+ });
710
+ throw transformedError;
711
+ },
712
+ pagingMethod: "CURSOR",
713
+ transformationPaths: {}
714
+ });
715
+ }
716
+ async function countResources2(options) {
717
+ const { httpClient, sideEffects } = arguments[1];
718
+ const payload = renameKeysFromSDKRequestToRESTRequest({
719
+ filter: options?.filter,
720
+ search: options?.search
721
+ });
722
+ const reqOpts = countResources(payload);
723
+ sideEffects?.onSiteCall?.();
724
+ try {
725
+ const result = await httpClient.request(reqOpts);
726
+ sideEffects?.onSuccess?.(result);
727
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
728
+ } catch (err) {
729
+ const transformedError = sdkTransformError(
730
+ err,
731
+ {
732
+ spreadPathsToArguments: {},
733
+ explicitPathsToArguments: {
734
+ filter: "$[0].filter",
735
+ search: "$[0].search"
736
+ },
737
+ singleArgumentUnchanged: false
738
+ },
739
+ ["options"]
740
+ );
741
+ sideEffects?.onError?.(err);
742
+ throw transformedError;
743
+ }
744
+ }
745
+ export {
746
+ AggregationType,
747
+ Interval,
748
+ ManagementType,
749
+ MissingValues,
750
+ Mode,
751
+ NestedAggregationType,
752
+ ScalarType,
753
+ SortDirection,
754
+ SortOrder,
755
+ SortType,
756
+ WebhookIdentityType,
757
+ bulkCreateResources2 as bulkCreateResources,
758
+ bulkDeleteResources2 as bulkDeleteResources,
759
+ bulkUpdateResources2 as bulkUpdateResources,
760
+ countResources2 as countResources,
761
+ createResource2 as createResource,
762
+ deleteResource2 as deleteResource,
763
+ getResource2 as getResource,
764
+ queryResources2 as queryResources,
765
+ searchResources2 as searchResources,
766
+ updateResource2 as updateResource
767
+ };
768
+ //# sourceMappingURL=index.typings.mjs.map