@wix/auto_sdk_benefit-programs_balances 1.0.22 → 1.0.24

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.
@@ -0,0 +1,539 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ ChangeBalanceRequestType: () => ChangeBalanceRequestType,
24
+ IdentityType: () => IdentityType,
25
+ LimitRule: () => LimitRule,
26
+ PoolStatus: () => PoolStatus,
27
+ SortOrder: () => SortOrder,
28
+ TransactionReversibility: () => TransactionReversibility,
29
+ Type: () => Type,
30
+ WebhookIdentityType: () => WebhookIdentityType,
31
+ changeBalance: () => changeBalance2,
32
+ getBalance: () => getBalance2,
33
+ listBalances: () => listBalances2,
34
+ queryBalances: () => queryBalances2,
35
+ revertBalanceChange: () => revertBalanceChange2
36
+ });
37
+ module.exports = __toCommonJS(index_typings_exports);
38
+
39
+ // src/benefit-programs-v1-balance-balances.universal.ts
40
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
41
+ var import_query_builder = require("@wix/sdk-runtime/query-builder");
42
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
43
+
44
+ // src/benefit-programs-v1-balance-balances.http.ts
45
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
46
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
47
+ var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
48
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
49
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
50
+ function resolveWixBenefitProgramsV1BalanceBalanceServiceUrl(opts) {
51
+ const domainToMappings = {
52
+ "api._api_base_domain_": [
53
+ {
54
+ srcPath: "/pool-accounts",
55
+ destPath: ""
56
+ }
57
+ ],
58
+ _: [
59
+ {
60
+ srcPath: "/_api/benefit-programs-pool-accounts",
61
+ destPath: ""
62
+ }
63
+ ],
64
+ "editor._base_domain_": [
65
+ {
66
+ srcPath: "/_api/benefit-programs-pool-accounts",
67
+ destPath: ""
68
+ },
69
+ {
70
+ srcPath: "/_api/benefit-programs/v1/balances",
71
+ destPath: "/v1/balances"
72
+ },
73
+ {
74
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
75
+ destPath: "/v1/bulk/balances"
76
+ }
77
+ ],
78
+ "blocks._base_domain_": [
79
+ {
80
+ srcPath: "/_api/benefit-programs-pool-accounts",
81
+ destPath: ""
82
+ },
83
+ {
84
+ srcPath: "/_api/benefit-programs/v1/balances",
85
+ destPath: "/v1/balances"
86
+ },
87
+ {
88
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
89
+ destPath: "/v1/bulk/balances"
90
+ }
91
+ ],
92
+ "create.editorx": [
93
+ {
94
+ srcPath: "/_api/benefit-programs-pool-accounts",
95
+ destPath: ""
96
+ },
97
+ {
98
+ srcPath: "/_api/benefit-programs/v1/balances",
99
+ destPath: "/v1/balances"
100
+ },
101
+ {
102
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
103
+ destPath: "/v1/bulk/balances"
104
+ }
105
+ ],
106
+ "editor.wixapps.net": [
107
+ {
108
+ srcPath: "/_api/benefit-programs-pool-accounts",
109
+ destPath: ""
110
+ },
111
+ {
112
+ srcPath: "/_api/benefit-programs/v1/balances",
113
+ destPath: "/v1/balances"
114
+ },
115
+ {
116
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
117
+ destPath: "/v1/bulk/balances"
118
+ }
119
+ ],
120
+ "manage._base_domain_": [
121
+ {
122
+ srcPath: "/_api/benefit-programs-pool-accounts",
123
+ destPath: ""
124
+ },
125
+ {
126
+ srcPath: "/_api/benefit-programs/v1/balances",
127
+ destPath: "/v1/balances"
128
+ },
129
+ {
130
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
131
+ destPath: "/v1/bulk/balances"
132
+ }
133
+ ],
134
+ "www._base_domain_": [
135
+ {
136
+ srcPath: "/_api/benefit-programs-pool-accounts",
137
+ destPath: ""
138
+ },
139
+ {
140
+ srcPath: "/_api/benefit-programs/v1/balances",
141
+ destPath: "/v1/balances"
142
+ },
143
+ {
144
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
145
+ destPath: "/v1/bulk/balances"
146
+ }
147
+ ],
148
+ "www.wixapis.com": [
149
+ {
150
+ srcPath: "/benefit-programs/v1/balances",
151
+ destPath: "/v1/balances"
152
+ },
153
+ {
154
+ srcPath: "/benefit-programs/v1/bulk/balances",
155
+ destPath: "/v1/bulk/balances"
156
+ }
157
+ ],
158
+ "*.dev.wix-code.com": [
159
+ {
160
+ srcPath: "/_api/benefit-programs/v1/balances",
161
+ destPath: "/v1/balances"
162
+ },
163
+ {
164
+ srcPath: "/_api/benefit-programs/v1/bulk/balances",
165
+ destPath: "/v1/bulk/balances"
166
+ }
167
+ ]
168
+ };
169
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
170
+ }
171
+ var PACKAGE_NAME = "@wix/auto_sdk_benefit-programs_balances";
172
+ function getBalance(payload) {
173
+ function __getBalance({ host }) {
174
+ const metadata = {
175
+ entityFqdn: "wix.benefit_programs.v1.balance",
176
+ method: "GET",
177
+ methodFqn: "wix.benefit_programs.v1.balance.BalanceService.GetBalance",
178
+ packageName: PACKAGE_NAME,
179
+ url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
180
+ protoPath: "/v1/balances/{poolId}",
181
+ data: payload,
182
+ host
183
+ }),
184
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
185
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
186
+ {
187
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
188
+ paths: [
189
+ { path: "balance.createdDate" },
190
+ { path: "balance.updatedDate" }
191
+ ]
192
+ }
193
+ ])
194
+ };
195
+ return metadata;
196
+ }
197
+ return __getBalance;
198
+ }
199
+ function listBalances(payload) {
200
+ function __listBalances({ host }) {
201
+ const metadata = {
202
+ entityFqdn: "wix.benefit_programs.v1.balance",
203
+ method: "GET",
204
+ methodFqn: "wix.benefit_programs.v1.balance.BalanceService.ListBalances",
205
+ packageName: PACKAGE_NAME,
206
+ url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
207
+ protoPath: "/v1/balances",
208
+ data: payload,
209
+ host
210
+ }),
211
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
212
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
213
+ {
214
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
215
+ paths: [
216
+ { path: "balances.createdDate" },
217
+ { path: "balances.updatedDate" }
218
+ ]
219
+ }
220
+ ])
221
+ };
222
+ return metadata;
223
+ }
224
+ return __listBalances;
225
+ }
226
+ function queryBalances(payload) {
227
+ function __queryBalances({ host }) {
228
+ const metadata = {
229
+ entityFqdn: "wix.benefit_programs.v1.balance",
230
+ method: "POST",
231
+ methodFqn: "wix.benefit_programs.v1.balance.BalanceService.QueryBalances",
232
+ packageName: PACKAGE_NAME,
233
+ url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
234
+ protoPath: "/v1/balances/query",
235
+ data: payload,
236
+ host
237
+ }),
238
+ data: payload,
239
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
240
+ {
241
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
242
+ paths: [
243
+ { path: "balances.createdDate" },
244
+ { path: "balances.updatedDate" }
245
+ ]
246
+ }
247
+ ])
248
+ };
249
+ return metadata;
250
+ }
251
+ return __queryBalances;
252
+ }
253
+ function changeBalance(payload) {
254
+ function __changeBalance({ host }) {
255
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
256
+ {
257
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
258
+ paths: [{ path: "transactionDetails.effectiveDate" }]
259
+ }
260
+ ]);
261
+ const metadata = {
262
+ entityFqdn: "wix.benefit_programs.v1.balance",
263
+ method: "POST",
264
+ methodFqn: "wix.benefit_programs.v1.balance.BalanceService.ChangeBalance",
265
+ packageName: PACKAGE_NAME,
266
+ url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
267
+ protoPath: "/v1/balances/{poolId}/change",
268
+ data: serializedData,
269
+ host
270
+ }),
271
+ data: serializedData,
272
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
273
+ {
274
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
275
+ paths: [
276
+ { path: "balance.createdDate" },
277
+ { path: "balance.updatedDate" }
278
+ ]
279
+ }
280
+ ])
281
+ };
282
+ return metadata;
283
+ }
284
+ return __changeBalance;
285
+ }
286
+ function revertBalanceChange(payload) {
287
+ function __revertBalanceChange({ host }) {
288
+ const metadata = {
289
+ entityFqdn: "wix.benefit_programs.v1.balance",
290
+ method: "POST",
291
+ methodFqn: "wix.benefit_programs.v1.balance.BalanceService.RevertBalanceChange",
292
+ packageName: PACKAGE_NAME,
293
+ url: resolveWixBenefitProgramsV1BalanceBalanceServiceUrl({
294
+ protoPath: "/v1/balances/changes/{transactionId}/revert",
295
+ data: payload,
296
+ host
297
+ }),
298
+ data: payload
299
+ };
300
+ return metadata;
301
+ }
302
+ return __revertBalanceChange;
303
+ }
304
+
305
+ // src/benefit-programs-v1-balance-balances.universal.ts
306
+ var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
307
+ var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
308
+ IdentityType2["UNKNOWN"] = "UNKNOWN";
309
+ IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
310
+ IdentityType2["MEMBER"] = "MEMBER";
311
+ IdentityType2["WIX_USER"] = "WIX_USER";
312
+ return IdentityType2;
313
+ })(IdentityType || {});
314
+ var PoolStatus = /* @__PURE__ */ ((PoolStatus2) => {
315
+ PoolStatus2["UNDEFINED"] = "UNDEFINED";
316
+ PoolStatus2["ACTIVE"] = "ACTIVE";
317
+ PoolStatus2["PAUSED"] = "PAUSED";
318
+ PoolStatus2["ENDED"] = "ENDED";
319
+ PoolStatus2["PROVISIONING"] = "PROVISIONING";
320
+ PoolStatus2["RENEWING"] = "RENEWING";
321
+ return PoolStatus2;
322
+ })(PoolStatus || {});
323
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
324
+ SortOrder2["ASC"] = "ASC";
325
+ SortOrder2["DESC"] = "DESC";
326
+ return SortOrder2;
327
+ })(SortOrder || {});
328
+ var ChangeBalanceRequestType = /* @__PURE__ */ ((ChangeBalanceRequestType2) => {
329
+ ChangeBalanceRequestType2["UNKNOWN_OPERATION"] = "UNKNOWN_OPERATION";
330
+ ChangeBalanceRequestType2["ADJUST"] = "ADJUST";
331
+ ChangeBalanceRequestType2["SET"] = "SET";
332
+ return ChangeBalanceRequestType2;
333
+ })(ChangeBalanceRequestType || {});
334
+ var LimitRule = /* @__PURE__ */ ((LimitRule2) => {
335
+ LimitRule2["UNKNOWN_LIMIT_RULE"] = "UNKNOWN_LIMIT_RULE";
336
+ LimitRule2["FAIL"] = "FAIL";
337
+ LimitRule2["SOFT_ENFORCE"] = "SOFT_ENFORCE";
338
+ LimitRule2["HARD_ENFORCE"] = "HARD_ENFORCE";
339
+ return LimitRule2;
340
+ })(LimitRule || {});
341
+ var Type = /* @__PURE__ */ ((Type2) => {
342
+ Type2["UNKNOWN_OPERATION"] = "UNKNOWN_OPERATION";
343
+ return Type2;
344
+ })(Type || {});
345
+ var TransactionReversibility = /* @__PURE__ */ ((TransactionReversibility2) => {
346
+ TransactionReversibility2["TRANSACTION_IS_REVERSIBLE"] = "TRANSACTION_IS_REVERSIBLE";
347
+ TransactionReversibility2["TRANSACTION_ALREADY_REVERSED"] = "TRANSACTION_ALREADY_REVERSED";
348
+ return TransactionReversibility2;
349
+ })(TransactionReversibility || {});
350
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
351
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
352
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
353
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
354
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
355
+ WebhookIdentityType2["APP"] = "APP";
356
+ return WebhookIdentityType2;
357
+ })(WebhookIdentityType || {});
358
+ async function getBalance2(poolId) {
359
+ const { httpClient, sideEffects } = arguments[1];
360
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ poolId });
361
+ const reqOpts = getBalance(payload);
362
+ sideEffects?.onSiteCall?.();
363
+ try {
364
+ const result = await httpClient.request(reqOpts);
365
+ sideEffects?.onSuccess?.(result);
366
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.balance;
367
+ } catch (err) {
368
+ const transformedError = (0, import_transform_error.transformError)(
369
+ err,
370
+ {
371
+ spreadPathsToArguments: {},
372
+ explicitPathsToArguments: { poolId: "$[0]" },
373
+ singleArgumentUnchanged: false
374
+ },
375
+ ["poolId"]
376
+ );
377
+ sideEffects?.onError?.(err);
378
+ throw transformedError;
379
+ }
380
+ }
381
+ async function listBalances2(options) {
382
+ const { httpClient, sideEffects } = arguments[1];
383
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
384
+ poolIds: options?.poolIds,
385
+ cursorPaging: options?.cursorPaging
386
+ });
387
+ const reqOpts = listBalances(payload);
388
+ sideEffects?.onSiteCall?.();
389
+ try {
390
+ const result = await httpClient.request(reqOpts);
391
+ sideEffects?.onSuccess?.(result);
392
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
393
+ } catch (err) {
394
+ const transformedError = (0, import_transform_error.transformError)(
395
+ err,
396
+ {
397
+ spreadPathsToArguments: {},
398
+ explicitPathsToArguments: {
399
+ poolIds: "$[0].poolIds",
400
+ cursorPaging: "$[0].cursorPaging"
401
+ },
402
+ singleArgumentUnchanged: false
403
+ },
404
+ ["options"]
405
+ );
406
+ sideEffects?.onError?.(err);
407
+ throw transformedError;
408
+ }
409
+ }
410
+ function queryBalances2() {
411
+ const { httpClient, sideEffects } = arguments[0];
412
+ return (0, import_query_builder.queryBuilder)({
413
+ func: async (payload) => {
414
+ const reqOpts = queryBalances(payload);
415
+ sideEffects?.onSiteCall?.();
416
+ try {
417
+ const result = await httpClient.request(reqOpts);
418
+ sideEffects?.onSuccess?.(result);
419
+ return result;
420
+ } catch (err) {
421
+ sideEffects?.onError?.(err);
422
+ throw err;
423
+ }
424
+ },
425
+ requestTransformer: (query) => {
426
+ const args = [query, {}];
427
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
428
+ ...args?.[1],
429
+ query: args?.[0]
430
+ });
431
+ },
432
+ responseTransformer: ({ data }) => {
433
+ const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
434
+ (0, import_transform_paths2.transformPaths)(data, [])
435
+ );
436
+ return {
437
+ items: transformedData?.balances,
438
+ pagingMetadata: transformedData?.metadata
439
+ };
440
+ },
441
+ errorTransformer: (err) => {
442
+ const transformedError = (0, import_transform_error.transformError)(err, {
443
+ spreadPathsToArguments: {},
444
+ explicitPathsToArguments: { query: "$[0]" },
445
+ singleArgumentUnchanged: false
446
+ });
447
+ throw transformedError;
448
+ },
449
+ pagingMethod: "CURSOR",
450
+ transformationPaths: {}
451
+ });
452
+ }
453
+ async function changeBalance2(poolId, idempotencyKey, options) {
454
+ const { httpClient, sideEffects } = arguments[3];
455
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
456
+ poolId,
457
+ idempotencyKey,
458
+ instructingParty: options?.instructingParty,
459
+ type: options?.type,
460
+ adjustOptions: options?.adjustOptions,
461
+ setOptions: options?.setOptions,
462
+ transactionDetails: options?.transactionDetails
463
+ });
464
+ const reqOpts = changeBalance(payload);
465
+ sideEffects?.onSiteCall?.();
466
+ try {
467
+ const result = await httpClient.request(reqOpts);
468
+ sideEffects?.onSuccess?.(result);
469
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
470
+ } catch (err) {
471
+ const transformedError = (0, import_transform_error.transformError)(
472
+ err,
473
+ {
474
+ spreadPathsToArguments: {},
475
+ explicitPathsToArguments: {
476
+ poolId: "$[0]",
477
+ idempotencyKey: "$[1]",
478
+ instructingParty: "$[2].instructingParty",
479
+ type: "$[2].type",
480
+ adjustOptions: "$[2].adjustOptions",
481
+ setOptions: "$[2].setOptions",
482
+ transactionDetails: "$[2].transactionDetails"
483
+ },
484
+ singleArgumentUnchanged: false
485
+ },
486
+ ["poolId", "idempotencyKey", "options"]
487
+ );
488
+ sideEffects?.onError?.(err);
489
+ throw transformedError;
490
+ }
491
+ }
492
+ async function revertBalanceChange2(transactionId, idempotencyKey, options) {
493
+ const { httpClient, sideEffects } = arguments[3];
494
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
495
+ transactionId,
496
+ idempotencyKey,
497
+ instructingParty: options?.instructingParty
498
+ });
499
+ const reqOpts = revertBalanceChange(payload);
500
+ sideEffects?.onSiteCall?.();
501
+ try {
502
+ const result = await httpClient.request(reqOpts);
503
+ sideEffects?.onSuccess?.(result);
504
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
505
+ } catch (err) {
506
+ const transformedError = (0, import_transform_error.transformError)(
507
+ err,
508
+ {
509
+ spreadPathsToArguments: {},
510
+ explicitPathsToArguments: {
511
+ transactionId: "$[0]",
512
+ idempotencyKey: "$[1]",
513
+ instructingParty: "$[2].instructingParty"
514
+ },
515
+ singleArgumentUnchanged: false
516
+ },
517
+ ["transactionId", "idempotencyKey", "options"]
518
+ );
519
+ sideEffects?.onError?.(err);
520
+ throw transformedError;
521
+ }
522
+ }
523
+ // Annotate the CommonJS export names for ESM import in node:
524
+ 0 && (module.exports = {
525
+ ChangeBalanceRequestType,
526
+ IdentityType,
527
+ LimitRule,
528
+ PoolStatus,
529
+ SortOrder,
530
+ TransactionReversibility,
531
+ Type,
532
+ WebhookIdentityType,
533
+ changeBalance,
534
+ getBalance,
535
+ listBalances,
536
+ queryBalances,
537
+ revertBalanceChange
538
+ });
539
+ //# sourceMappingURL=index.typings.js.map