@wix/auto_sdk_automations_automation-templates 1.0.0

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 (39) hide show
  1. package/build/cjs/index.d.ts +1491 -0
  2. package/build/cjs/index.js +895 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +809 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1353 -0
  8. package/build/cjs/meta.js +728 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/es/index.d.mts +1491 -0
  11. package/build/es/index.mjs +852 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/es/index.typings.d.mts +1 -0
  14. package/build/es/index.typings.mjs +766 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/meta.d.mts +1353 -0
  17. package/build/es/meta.mjs +682 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/es/package.json +3 -0
  20. package/build/internal/cjs/index.d.ts +110 -0
  21. package/build/internal/cjs/index.js +895 -0
  22. package/build/internal/cjs/index.js.map +1 -0
  23. package/build/internal/cjs/index.typings.d.ts +1608 -0
  24. package/build/internal/cjs/index.typings.js +809 -0
  25. package/build/internal/cjs/index.typings.js.map +1 -0
  26. package/build/internal/cjs/meta.d.ts +1354 -0
  27. package/build/internal/cjs/meta.js +728 -0
  28. package/build/internal/cjs/meta.js.map +1 -0
  29. package/build/internal/es/index.d.mts +110 -0
  30. package/build/internal/es/index.mjs +852 -0
  31. package/build/internal/es/index.mjs.map +1 -0
  32. package/build/internal/es/index.typings.d.mts +1608 -0
  33. package/build/internal/es/index.typings.mjs +766 -0
  34. package/build/internal/es/index.typings.mjs.map +1 -0
  35. package/build/internal/es/meta.d.mts +1354 -0
  36. package/build/internal/es/meta.mjs +682 -0
  37. package/build/internal/es/meta.mjs.map +1 -0
  38. package/meta/package.json +3 -0
  39. package/package.json +55 -0
@@ -0,0 +1,852 @@
1
+ // src/automations-templates-v1-automation-template-automation-templates.universal.ts
2
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
3
+ import {
4
+ renameKeysFromSDKRequestToRESTRequest,
5
+ renameKeysFromRESTResponseToSDKResponse
6
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
7
+
8
+ // src/automations-templates-v1-automation-template-automation-templates.http.ts
9
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
10
+ import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
11
+ import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
12
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
13
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
14
+ function resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl(opts) {
15
+ const domainToMappings = {
16
+ "manage._base_domain_": [
17
+ {
18
+ srcPath: "/_api/automation-templates",
19
+ destPath: "/api"
20
+ },
21
+ {
22
+ srcPath: "/automation-templates",
23
+ destPath: ""
24
+ }
25
+ ]
26
+ };
27
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
28
+ }
29
+ var PACKAGE_NAME = "@wix/auto_sdk_automations_automation-templates";
30
+ function createAutomationTemplate(payload) {
31
+ function __createAutomationTemplate({ host }) {
32
+ const serializedData = transformPaths(payload, [
33
+ {
34
+ transformFn: transformSDKTimestampToRESTTimestamp,
35
+ paths: [
36
+ { path: "automationTemplate.createdDate" },
37
+ { path: "automationTemplate.updatedDate" },
38
+ { path: "automationTemplate.automation.createdDate" },
39
+ { path: "automationTemplate.automation.updatedDate" },
40
+ { path: "automationTemplate.automation.draftUpdatedDate" },
41
+ {
42
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
43
+ }
44
+ ]
45
+ }
46
+ ]);
47
+ const metadata = {
48
+ entityFqdn: "wix.automations.templates.v1.automation_template",
49
+ method: "POST",
50
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.CreateAutomationTemplate",
51
+ packageName: PACKAGE_NAME,
52
+ migrationOptions: {
53
+ optInTransformResponse: true
54
+ },
55
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
56
+ protoPath: "/v1/automation-templates",
57
+ data: serializedData,
58
+ host
59
+ }),
60
+ data: serializedData,
61
+ transformResponse: (payload2) => transformPaths(payload2, [
62
+ {
63
+ transformFn: transformRESTTimestampToSDKTimestamp,
64
+ paths: [
65
+ { path: "automationTemplate.createdDate" },
66
+ { path: "automationTemplate.updatedDate" },
67
+ { path: "automationTemplate.automation.createdDate" },
68
+ { path: "automationTemplate.automation.updatedDate" },
69
+ { path: "automationTemplate.automation.draftUpdatedDate" },
70
+ {
71
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
72
+ }
73
+ ]
74
+ }
75
+ ])
76
+ };
77
+ return metadata;
78
+ }
79
+ return __createAutomationTemplate;
80
+ }
81
+ function createDraftAutomationTemplate(payload) {
82
+ function __createDraftAutomationTemplate({ host }) {
83
+ const serializedData = transformPaths(payload, [
84
+ {
85
+ transformFn: transformSDKTimestampToRESTTimestamp,
86
+ paths: [
87
+ { path: "automationTemplate.createdDate" },
88
+ { path: "automationTemplate.updatedDate" },
89
+ { path: "automationTemplate.automation.createdDate" },
90
+ { path: "automationTemplate.automation.updatedDate" },
91
+ { path: "automationTemplate.automation.draftUpdatedDate" },
92
+ {
93
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
94
+ }
95
+ ]
96
+ }
97
+ ]);
98
+ const metadata = {
99
+ entityFqdn: "wix.automations.templates.v1.automation_template",
100
+ method: "POST",
101
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.CreateDraftAutomationTemplate",
102
+ packageName: PACKAGE_NAME,
103
+ migrationOptions: {
104
+ optInTransformResponse: true
105
+ },
106
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
107
+ protoPath: "/v1/automation-templates/drafts",
108
+ data: serializedData,
109
+ host
110
+ }),
111
+ data: serializedData,
112
+ transformResponse: (payload2) => transformPaths(payload2, [
113
+ {
114
+ transformFn: transformRESTTimestampToSDKTimestamp,
115
+ paths: [
116
+ { path: "automationTemplate.createdDate" },
117
+ { path: "automationTemplate.updatedDate" },
118
+ { path: "automationTemplate.automation.createdDate" },
119
+ { path: "automationTemplate.automation.updatedDate" },
120
+ { path: "automationTemplate.automation.draftUpdatedDate" },
121
+ {
122
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
123
+ }
124
+ ]
125
+ }
126
+ ])
127
+ };
128
+ return metadata;
129
+ }
130
+ return __createDraftAutomationTemplate;
131
+ }
132
+ function getAutomationTemplate(payload) {
133
+ function __getAutomationTemplate({ host }) {
134
+ const metadata = {
135
+ entityFqdn: "wix.automations.templates.v1.automation_template",
136
+ method: "GET",
137
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.GetAutomationTemplate",
138
+ packageName: PACKAGE_NAME,
139
+ migrationOptions: {
140
+ optInTransformResponse: true
141
+ },
142
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
143
+ protoPath: "/v1/automation-templates/{automationTemplateId}",
144
+ data: payload,
145
+ host
146
+ }),
147
+ params: toURLSearchParams(payload),
148
+ transformResponse: (payload2) => transformPaths(payload2, [
149
+ {
150
+ transformFn: transformRESTTimestampToSDKTimestamp,
151
+ paths: [
152
+ { path: "automationTemplate.createdDate" },
153
+ { path: "automationTemplate.updatedDate" },
154
+ { path: "automationTemplate.automation.createdDate" },
155
+ { path: "automationTemplate.automation.updatedDate" },
156
+ { path: "automationTemplate.automation.draftUpdatedDate" },
157
+ {
158
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
159
+ }
160
+ ]
161
+ }
162
+ ])
163
+ };
164
+ return metadata;
165
+ }
166
+ return __getAutomationTemplate;
167
+ }
168
+ function updateAutomationTemplate(payload) {
169
+ function __updateAutomationTemplate({ host }) {
170
+ const serializedData = transformPaths(payload, [
171
+ {
172
+ transformFn: transformSDKTimestampToRESTTimestamp,
173
+ paths: [
174
+ { path: "automationTemplate.createdDate" },
175
+ { path: "automationTemplate.updatedDate" },
176
+ { path: "automationTemplate.automation.createdDate" },
177
+ { path: "automationTemplate.automation.updatedDate" },
178
+ { path: "automationTemplate.automation.draftUpdatedDate" },
179
+ {
180
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
181
+ }
182
+ ]
183
+ }
184
+ ]);
185
+ const metadata = {
186
+ entityFqdn: "wix.automations.templates.v1.automation_template",
187
+ method: "PATCH",
188
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.UpdateAutomationTemplate",
189
+ packageName: PACKAGE_NAME,
190
+ migrationOptions: {
191
+ optInTransformResponse: true
192
+ },
193
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
194
+ protoPath: "/v1/automation-templates/{automationTemplate.id}",
195
+ data: serializedData,
196
+ host
197
+ }),
198
+ data: serializedData,
199
+ transformResponse: (payload2) => transformPaths(payload2, [
200
+ {
201
+ transformFn: transformRESTTimestampToSDKTimestamp,
202
+ paths: [
203
+ { path: "automationTemplate.createdDate" },
204
+ { path: "automationTemplate.updatedDate" },
205
+ { path: "automationTemplate.automation.createdDate" },
206
+ { path: "automationTemplate.automation.updatedDate" },
207
+ { path: "automationTemplate.automation.draftUpdatedDate" },
208
+ {
209
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
210
+ }
211
+ ]
212
+ }
213
+ ])
214
+ };
215
+ return metadata;
216
+ }
217
+ return __updateAutomationTemplate;
218
+ }
219
+ function updateDraftAutomationTemplate(payload) {
220
+ function __updateDraftAutomationTemplate({ host }) {
221
+ const serializedData = transformPaths(payload, [
222
+ {
223
+ transformFn: transformSDKTimestampToRESTTimestamp,
224
+ paths: [
225
+ { path: "automationTemplate.createdDate" },
226
+ { path: "automationTemplate.updatedDate" },
227
+ { path: "automationTemplate.automation.createdDate" },
228
+ { path: "automationTemplate.automation.updatedDate" },
229
+ { path: "automationTemplate.automation.draftUpdatedDate" },
230
+ {
231
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
232
+ }
233
+ ]
234
+ }
235
+ ]);
236
+ const metadata = {
237
+ entityFqdn: "wix.automations.templates.v1.automation_template",
238
+ method: "PATCH",
239
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.UpdateDraftAutomationTemplate",
240
+ packageName: PACKAGE_NAME,
241
+ migrationOptions: {
242
+ optInTransformResponse: true
243
+ },
244
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
245
+ protoPath: "/v1/automation-templates/drafts/{automationTemplate.id}",
246
+ data: serializedData,
247
+ host
248
+ }),
249
+ data: serializedData,
250
+ transformResponse: (payload2) => transformPaths(payload2, [
251
+ {
252
+ transformFn: transformRESTTimestampToSDKTimestamp,
253
+ paths: [
254
+ { path: "automationTemplate.createdDate" },
255
+ { path: "automationTemplate.updatedDate" },
256
+ { path: "automationTemplate.automation.createdDate" },
257
+ { path: "automationTemplate.automation.updatedDate" },
258
+ { path: "automationTemplate.automation.draftUpdatedDate" },
259
+ {
260
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
261
+ }
262
+ ]
263
+ }
264
+ ])
265
+ };
266
+ return metadata;
267
+ }
268
+ return __updateDraftAutomationTemplate;
269
+ }
270
+ function deleteAutomationTemplate(payload) {
271
+ function __deleteAutomationTemplate({ host }) {
272
+ const metadata = {
273
+ entityFqdn: "wix.automations.templates.v1.automation_template",
274
+ method: "DELETE",
275
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.DeleteAutomationTemplate",
276
+ packageName: PACKAGE_NAME,
277
+ migrationOptions: {
278
+ optInTransformResponse: true
279
+ },
280
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
281
+ protoPath: "/v1/automation-templates/{componentId}",
282
+ data: payload,
283
+ host
284
+ }),
285
+ params: toURLSearchParams(payload)
286
+ };
287
+ return metadata;
288
+ }
289
+ return __deleteAutomationTemplate;
290
+ }
291
+ function resolveAutomationTemplates(payload) {
292
+ function __resolveAutomationTemplates({ host }) {
293
+ const metadata = {
294
+ entityFqdn: "wix.automations.templates.v1.automation_template",
295
+ method: "POST",
296
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.ResolveAutomationTemplates",
297
+ packageName: PACKAGE_NAME,
298
+ migrationOptions: {
299
+ optInTransformResponse: true
300
+ },
301
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
302
+ protoPath: "/v1/automation-templates/resolve",
303
+ data: payload,
304
+ host
305
+ }),
306
+ data: payload,
307
+ transformResponse: (payload2) => transformPaths(payload2, [
308
+ {
309
+ transformFn: transformRESTTimestampToSDKTimestamp,
310
+ paths: [
311
+ { path: "automationTemplates.createdDate" },
312
+ { path: "automationTemplates.updatedDate" },
313
+ { path: "automationTemplates.automation.createdDate" },
314
+ { path: "automationTemplates.automation.updatedDate" },
315
+ { path: "automationTemplates.automation.draftUpdatedDate" },
316
+ {
317
+ path: "automationTemplates.automation.autoArchivePolicy.archiveDate"
318
+ }
319
+ ]
320
+ }
321
+ ])
322
+ };
323
+ return metadata;
324
+ }
325
+ return __resolveAutomationTemplates;
326
+ }
327
+ function queryAutomationTemplatesForApp(payload) {
328
+ function __queryAutomationTemplatesForApp({ host }) {
329
+ const metadata = {
330
+ entityFqdn: "wix.automations.templates.v1.automation_template",
331
+ method: "POST",
332
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.QueryAutomationTemplatesForApp",
333
+ packageName: PACKAGE_NAME,
334
+ migrationOptions: {
335
+ optInTransformResponse: true
336
+ },
337
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
338
+ protoPath: "/v1/automation-templates/query-for-app",
339
+ data: payload,
340
+ host
341
+ }),
342
+ data: payload,
343
+ transformResponse: (payload2) => transformPaths(payload2, [
344
+ {
345
+ transformFn: transformRESTTimestampToSDKTimestamp,
346
+ paths: [
347
+ { path: "automationTemplates.createdDate" },
348
+ { path: "automationTemplates.updatedDate" },
349
+ { path: "automationTemplates.automation.createdDate" },
350
+ { path: "automationTemplates.automation.updatedDate" },
351
+ { path: "automationTemplates.automation.draftUpdatedDate" },
352
+ {
353
+ path: "automationTemplates.automation.autoArchivePolicy.archiveDate"
354
+ }
355
+ ]
356
+ }
357
+ ])
358
+ };
359
+ return metadata;
360
+ }
361
+ return __queryAutomationTemplatesForApp;
362
+ }
363
+ function generateTemplateFromAutomation(payload) {
364
+ function __generateTemplateFromAutomation({ host }) {
365
+ const serializedData = transformPaths(payload, [
366
+ {
367
+ transformFn: transformSDKTimestampToRESTTimestamp,
368
+ paths: [
369
+ { path: "automation.createdDate" },
370
+ { path: "automation.updatedDate" },
371
+ { path: "automation.draftUpdatedDate" },
372
+ { path: "automation.autoArchivePolicy.archiveDate" }
373
+ ]
374
+ }
375
+ ]);
376
+ const metadata = {
377
+ entityFqdn: "wix.automations.templates.v1.automation_template",
378
+ method: "POST",
379
+ methodFqn: "wix.automations.templates.v1.AutomationTemplatesService.GenerateTemplateFromAutomation",
380
+ packageName: PACKAGE_NAME,
381
+ migrationOptions: {
382
+ optInTransformResponse: true
383
+ },
384
+ url: resolveWixAutomationsTemplatesV1AutomationTemplatesServiceUrl({
385
+ protoPath: "/v1/automation-templates/generate",
386
+ data: serializedData,
387
+ host
388
+ }),
389
+ data: serializedData,
390
+ transformResponse: (payload2) => transformPaths(payload2, [
391
+ {
392
+ transformFn: transformRESTTimestampToSDKTimestamp,
393
+ paths: [
394
+ { path: "automationTemplate.createdDate" },
395
+ { path: "automationTemplate.updatedDate" },
396
+ { path: "automationTemplate.automation.createdDate" },
397
+ { path: "automationTemplate.automation.updatedDate" },
398
+ { path: "automationTemplate.automation.draftUpdatedDate" },
399
+ {
400
+ path: "automationTemplate.automation.autoArchivePolicy.archiveDate"
401
+ }
402
+ ]
403
+ }
404
+ ])
405
+ };
406
+ return metadata;
407
+ }
408
+ return __generateTemplateFromAutomation;
409
+ }
410
+
411
+ // src/automations-templates-v1-automation-template-automation-templates.universal.ts
412
+ var Category = /* @__PURE__ */ ((Category2) => {
413
+ Category2["SELL_MORE_ONLINE"] = "SELL_MORE_ONLINE";
414
+ Category2["ENGAGE_WITH_CLIENTS"] = "ENGAGE_WITH_CLIENTS";
415
+ Category2["GET_PAID_ON_TIME"] = "GET_PAID_ON_TIME";
416
+ Category2["MANAGE_BUSINESS"] = "MANAGE_BUSINESS";
417
+ Category2["RETAIN_CUSTOMERS"] = "RETAIN_CUSTOMERS";
418
+ Category2["POPULAR"] = "POPULAR";
419
+ return Category2;
420
+ })(Category || {});
421
+ var Domain = /* @__PURE__ */ ((Domain2) => {
422
+ Domain2["USER"] = "USER";
423
+ Domain2["WIX"] = "WIX";
424
+ Domain2["WIX_ACCOUNT"] = "WIX_ACCOUNT";
425
+ return Domain2;
426
+ })(Domain || {});
427
+ var TimeUnit = /* @__PURE__ */ ((TimeUnit2) => {
428
+ TimeUnit2["MINUTES"] = "MINUTES";
429
+ TimeUnit2["HOURS"] = "HOURS";
430
+ TimeUnit2["DAYS"] = "DAYS";
431
+ TimeUnit2["WEEKS"] = "WEEKS";
432
+ TimeUnit2["MONTHS"] = "MONTHS";
433
+ return TimeUnit2;
434
+ })(TimeUnit || {});
435
+ var Operator = /* @__PURE__ */ ((Operator2) => {
436
+ Operator2["OR"] = "OR";
437
+ Operator2["AND"] = "AND";
438
+ return Operator2;
439
+ })(Operator || {});
440
+ var Language = /* @__PURE__ */ ((Language2) => {
441
+ Language2["JAVASCRIPT"] = "JAVASCRIPT";
442
+ return Language2;
443
+ })(Language || {});
444
+ var Type = /* @__PURE__ */ ((Type2) => {
445
+ Type2["APP_DEFINED"] = "APP_DEFINED";
446
+ Type2["CONDITION"] = "CONDITION";
447
+ Type2["CODE_CONDITION"] = "CODE_CONDITION";
448
+ Type2["DELAY"] = "DELAY";
449
+ Type2["RATE_LIMIT"] = "RATE_LIMIT";
450
+ return Type2;
451
+ })(Type || {});
452
+ var Status = /* @__PURE__ */ ((Status2) => {
453
+ Status2["ACTIVE"] = "ACTIVE";
454
+ Status2["INACTIVE"] = "INACTIVE";
455
+ return Status2;
456
+ })(Status || {});
457
+ var Origin = /* @__PURE__ */ ((Origin2) => {
458
+ Origin2["USER"] = "USER";
459
+ Origin2["APPLICATION"] = "APPLICATION";
460
+ Origin2["PREINSTALLED"] = "PREINSTALLED";
461
+ return Origin2;
462
+ })(Origin || {});
463
+ var CommonSortOrder = /* @__PURE__ */ ((CommonSortOrder2) => {
464
+ CommonSortOrder2["ASC"] = "ASC";
465
+ CommonSortOrder2["DESC"] = "DESC";
466
+ return CommonSortOrder2;
467
+ })(CommonSortOrder || {});
468
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
469
+ SortOrder2["ASC"] = "ASC";
470
+ SortOrder2["DESC"] = "DESC";
471
+ return SortOrder2;
472
+ })(SortOrder || {});
473
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
474
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
475
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
476
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
477
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
478
+ WebhookIdentityType2["APP"] = "APP";
479
+ return WebhookIdentityType2;
480
+ })(WebhookIdentityType || {});
481
+ async function createAutomationTemplate2(automationTemplate, options) {
482
+ const { httpClient, sideEffects } = arguments[2];
483
+ const payload = renameKeysFromSDKRequestToRESTRequest({
484
+ automationTemplate,
485
+ appId: options?.appId,
486
+ originalMetaSiteId: options?.originalMetaSiteId
487
+ });
488
+ const reqOpts = createAutomationTemplate(
489
+ payload
490
+ );
491
+ sideEffects?.onSiteCall?.();
492
+ try {
493
+ const result = await httpClient.request(reqOpts);
494
+ sideEffects?.onSuccess?.(result);
495
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.automationTemplate;
496
+ } catch (err) {
497
+ const transformedError = sdkTransformError(
498
+ err,
499
+ {
500
+ spreadPathsToArguments: {},
501
+ explicitPathsToArguments: {
502
+ automationTemplate: "$[0]",
503
+ appId: "$[1].appId",
504
+ originalMetaSiteId: "$[1].originalMetaSiteId"
505
+ },
506
+ singleArgumentUnchanged: false
507
+ },
508
+ ["automationTemplate", "options"]
509
+ );
510
+ sideEffects?.onError?.(err);
511
+ throw transformedError;
512
+ }
513
+ }
514
+ async function createDraftAutomationTemplate2(automationTemplate, options) {
515
+ const { httpClient, sideEffects } = arguments[2];
516
+ const payload = renameKeysFromSDKRequestToRESTRequest({
517
+ automationTemplate,
518
+ appId: options?.appId
519
+ });
520
+ const reqOpts = createDraftAutomationTemplate(
521
+ payload
522
+ );
523
+ sideEffects?.onSiteCall?.();
524
+ try {
525
+ const result = await httpClient.request(reqOpts);
526
+ sideEffects?.onSuccess?.(result);
527
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
528
+ } catch (err) {
529
+ const transformedError = sdkTransformError(
530
+ err,
531
+ {
532
+ spreadPathsToArguments: {},
533
+ explicitPathsToArguments: {
534
+ automationTemplate: "$[0]",
535
+ appId: "$[1].appId"
536
+ },
537
+ singleArgumentUnchanged: false
538
+ },
539
+ ["automationTemplate", "options"]
540
+ );
541
+ sideEffects?.onError?.(err);
542
+ throw transformedError;
543
+ }
544
+ }
545
+ async function getAutomationTemplate2(automationTemplateId) {
546
+ const { httpClient, sideEffects } = arguments[1];
547
+ const payload = renameKeysFromSDKRequestToRESTRequest({
548
+ automationTemplateId
549
+ });
550
+ const reqOpts = getAutomationTemplate(
551
+ payload
552
+ );
553
+ sideEffects?.onSiteCall?.();
554
+ try {
555
+ const result = await httpClient.request(reqOpts);
556
+ sideEffects?.onSuccess?.(result);
557
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.automationTemplate;
558
+ } catch (err) {
559
+ const transformedError = sdkTransformError(
560
+ err,
561
+ {
562
+ spreadPathsToArguments: {},
563
+ explicitPathsToArguments: { automationTemplateId: "$[0]" },
564
+ singleArgumentUnchanged: false
565
+ },
566
+ ["automationTemplateId"]
567
+ );
568
+ sideEffects?.onError?.(err);
569
+ throw transformedError;
570
+ }
571
+ }
572
+ async function updateAutomationTemplate2(_id, automationTemplate, options) {
573
+ const { httpClient, sideEffects } = arguments[3];
574
+ const payload = renameKeysFromSDKRequestToRESTRequest({
575
+ automationTemplate: { ...automationTemplate, id: _id },
576
+ appId: options?.appId
577
+ });
578
+ const reqOpts = updateAutomationTemplate(
579
+ payload
580
+ );
581
+ sideEffects?.onSiteCall?.();
582
+ try {
583
+ const result = await httpClient.request(reqOpts);
584
+ sideEffects?.onSuccess?.(result);
585
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.automationTemplate;
586
+ } catch (err) {
587
+ const transformedError = sdkTransformError(
588
+ err,
589
+ {
590
+ spreadPathsToArguments: { automationTemplate: "$[1]" },
591
+ explicitPathsToArguments: {
592
+ "automationTemplate.id": "$[0]",
593
+ appId: "$[2].appId"
594
+ },
595
+ singleArgumentUnchanged: false
596
+ },
597
+ ["_id", "automationTemplate", "options"]
598
+ );
599
+ sideEffects?.onError?.(err);
600
+ throw transformedError;
601
+ }
602
+ }
603
+ async function updateDraftAutomationTemplate2(_id, automationTemplate, options) {
604
+ const { httpClient, sideEffects } = arguments[3];
605
+ const payload = renameKeysFromSDKRequestToRESTRequest({
606
+ automationTemplate: { ...automationTemplate, id: _id },
607
+ appId: options?.appId,
608
+ metaSiteId: options?.metaSiteId
609
+ });
610
+ const reqOpts = updateDraftAutomationTemplate(
611
+ payload
612
+ );
613
+ sideEffects?.onSiteCall?.();
614
+ try {
615
+ const result = await httpClient.request(reqOpts);
616
+ sideEffects?.onSuccess?.(result);
617
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
618
+ } catch (err) {
619
+ const transformedError = sdkTransformError(
620
+ err,
621
+ {
622
+ spreadPathsToArguments: { automationTemplate: "$[1]" },
623
+ explicitPathsToArguments: {
624
+ "automationTemplate.id": "$[0]",
625
+ appId: "$[2].appId",
626
+ metaSiteId: "$[2].metaSiteId"
627
+ },
628
+ singleArgumentUnchanged: false
629
+ },
630
+ ["_id", "automationTemplate", "options"]
631
+ );
632
+ sideEffects?.onError?.(err);
633
+ throw transformedError;
634
+ }
635
+ }
636
+ async function deleteAutomationTemplate2(componentId, appId) {
637
+ const { httpClient, sideEffects } = arguments[2];
638
+ const payload = renameKeysFromSDKRequestToRESTRequest({
639
+ componentId,
640
+ appId
641
+ });
642
+ const reqOpts = deleteAutomationTemplate(
643
+ payload
644
+ );
645
+ sideEffects?.onSiteCall?.();
646
+ try {
647
+ const result = await httpClient.request(reqOpts);
648
+ sideEffects?.onSuccess?.(result);
649
+ } catch (err) {
650
+ const transformedError = sdkTransformError(
651
+ err,
652
+ {
653
+ spreadPathsToArguments: {},
654
+ explicitPathsToArguments: { componentId: "$[0]", appId: "$[1]" },
655
+ singleArgumentUnchanged: false
656
+ },
657
+ ["componentId", "appId"]
658
+ );
659
+ sideEffects?.onError?.(err);
660
+ throw transformedError;
661
+ }
662
+ }
663
+ async function resolveAutomationTemplates2(query) {
664
+ const { httpClient, sideEffects } = arguments[1];
665
+ const payload = renameKeysFromSDKRequestToRESTRequest({ query });
666
+ const reqOpts = resolveAutomationTemplates(
667
+ payload
668
+ );
669
+ sideEffects?.onSiteCall?.();
670
+ try {
671
+ const result = await httpClient.request(reqOpts);
672
+ sideEffects?.onSuccess?.(result);
673
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
674
+ } catch (err) {
675
+ const transformedError = sdkTransformError(
676
+ err,
677
+ {
678
+ spreadPathsToArguments: {},
679
+ explicitPathsToArguments: { query: "$[0]" },
680
+ singleArgumentUnchanged: false
681
+ },
682
+ ["query"]
683
+ );
684
+ sideEffects?.onError?.(err);
685
+ throw transformedError;
686
+ }
687
+ }
688
+ async function queryAutomationTemplatesForApp2(query, options) {
689
+ const { httpClient, sideEffects } = arguments[2];
690
+ const payload = renameKeysFromSDKRequestToRESTRequest({
691
+ query,
692
+ appId: options?.appId
693
+ });
694
+ const reqOpts = queryAutomationTemplatesForApp(
695
+ payload
696
+ );
697
+ sideEffects?.onSiteCall?.();
698
+ try {
699
+ const result = await httpClient.request(reqOpts);
700
+ sideEffects?.onSuccess?.(result);
701
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
702
+ } catch (err) {
703
+ const transformedError = sdkTransformError(
704
+ err,
705
+ {
706
+ spreadPathsToArguments: {},
707
+ explicitPathsToArguments: { query: "$[0]", appId: "$[1].appId" },
708
+ singleArgumentUnchanged: false
709
+ },
710
+ ["query", "options"]
711
+ );
712
+ sideEffects?.onError?.(err);
713
+ throw transformedError;
714
+ }
715
+ }
716
+ async function generateTemplateFromAutomation2(automation, options) {
717
+ const { httpClient, sideEffects } = arguments[2];
718
+ const payload = renameKeysFromSDKRequestToRESTRequest({
719
+ automation,
720
+ appId: options?.appId
721
+ });
722
+ const reqOpts = generateTemplateFromAutomation(
723
+ payload
724
+ );
725
+ sideEffects?.onSiteCall?.();
726
+ try {
727
+ const result = await httpClient.request(reqOpts);
728
+ sideEffects?.onSuccess?.(result);
729
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
730
+ } catch (err) {
731
+ const transformedError = sdkTransformError(
732
+ err,
733
+ {
734
+ spreadPathsToArguments: {},
735
+ explicitPathsToArguments: { automation: "$[0]", appId: "$[1].appId" },
736
+ singleArgumentUnchanged: false
737
+ },
738
+ ["automation", "options"]
739
+ );
740
+ sideEffects?.onError?.(err);
741
+ throw transformedError;
742
+ }
743
+ }
744
+
745
+ // src/automations-templates-v1-automation-template-automation-templates.public.ts
746
+ function createAutomationTemplate3(httpClient) {
747
+ return (automationTemplate, options) => createAutomationTemplate2(
748
+ automationTemplate,
749
+ options,
750
+ // @ts-ignore
751
+ { httpClient }
752
+ );
753
+ }
754
+ function createDraftAutomationTemplate3(httpClient) {
755
+ return (automationTemplate, options) => createDraftAutomationTemplate2(
756
+ automationTemplate,
757
+ options,
758
+ // @ts-ignore
759
+ { httpClient }
760
+ );
761
+ }
762
+ function getAutomationTemplate3(httpClient) {
763
+ return (automationTemplateId) => getAutomationTemplate2(
764
+ automationTemplateId,
765
+ // @ts-ignore
766
+ { httpClient }
767
+ );
768
+ }
769
+ function updateAutomationTemplate3(httpClient) {
770
+ return (_id, automationTemplate, options) => updateAutomationTemplate2(
771
+ _id,
772
+ automationTemplate,
773
+ options,
774
+ // @ts-ignore
775
+ { httpClient }
776
+ );
777
+ }
778
+ function updateDraftAutomationTemplate3(httpClient) {
779
+ return (_id, automationTemplate, options) => updateDraftAutomationTemplate2(
780
+ _id,
781
+ automationTemplate,
782
+ options,
783
+ // @ts-ignore
784
+ { httpClient }
785
+ );
786
+ }
787
+ function deleteAutomationTemplate3(httpClient) {
788
+ return (componentId, appId) => deleteAutomationTemplate2(
789
+ componentId,
790
+ appId,
791
+ // @ts-ignore
792
+ { httpClient }
793
+ );
794
+ }
795
+ function resolveAutomationTemplates3(httpClient) {
796
+ return (query) => resolveAutomationTemplates2(
797
+ query,
798
+ // @ts-ignore
799
+ { httpClient }
800
+ );
801
+ }
802
+ function queryAutomationTemplatesForApp3(httpClient) {
803
+ return (query, options) => queryAutomationTemplatesForApp2(
804
+ query,
805
+ options,
806
+ // @ts-ignore
807
+ { httpClient }
808
+ );
809
+ }
810
+ function generateTemplateFromAutomation3(httpClient) {
811
+ return (automation, options) => generateTemplateFromAutomation2(
812
+ automation,
813
+ options,
814
+ // @ts-ignore
815
+ { httpClient }
816
+ );
817
+ }
818
+
819
+ // src/automations-templates-v1-automation-template-automation-templates.context.ts
820
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
821
+ var createAutomationTemplate4 = /* @__PURE__ */ createRESTModule(createAutomationTemplate3);
822
+ var createDraftAutomationTemplate4 = /* @__PURE__ */ createRESTModule(createDraftAutomationTemplate3);
823
+ var getAutomationTemplate4 = /* @__PURE__ */ createRESTModule(getAutomationTemplate3);
824
+ var updateAutomationTemplate4 = /* @__PURE__ */ createRESTModule(updateAutomationTemplate3);
825
+ var updateDraftAutomationTemplate4 = /* @__PURE__ */ createRESTModule(updateDraftAutomationTemplate3);
826
+ var deleteAutomationTemplate4 = /* @__PURE__ */ createRESTModule(deleteAutomationTemplate3);
827
+ var resolveAutomationTemplates4 = /* @__PURE__ */ createRESTModule(resolveAutomationTemplates3);
828
+ var queryAutomationTemplatesForApp4 = /* @__PURE__ */ createRESTModule(queryAutomationTemplatesForApp3);
829
+ var generateTemplateFromAutomation4 = /* @__PURE__ */ createRESTModule(generateTemplateFromAutomation3);
830
+ export {
831
+ Category,
832
+ CommonSortOrder,
833
+ Domain,
834
+ Language,
835
+ Operator,
836
+ Origin,
837
+ SortOrder,
838
+ Status,
839
+ TimeUnit,
840
+ Type,
841
+ WebhookIdentityType,
842
+ createAutomationTemplate4 as createAutomationTemplate,
843
+ createDraftAutomationTemplate4 as createDraftAutomationTemplate,
844
+ deleteAutomationTemplate4 as deleteAutomationTemplate,
845
+ generateTemplateFromAutomation4 as generateTemplateFromAutomation,
846
+ getAutomationTemplate4 as getAutomationTemplate,
847
+ queryAutomationTemplatesForApp4 as queryAutomationTemplatesForApp,
848
+ resolveAutomationTemplates4 as resolveAutomationTemplates,
849
+ updateAutomationTemplate4 as updateAutomationTemplate,
850
+ updateDraftAutomationTemplate4 as updateDraftAutomationTemplate
851
+ };
852
+ //# sourceMappingURL=index.mjs.map