@wix/auto_sdk_automations_automations-v-2 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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -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 +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/automations-v2-automation-automations-v-2.context.d.ts +37 -0
  11. package/build/cjs/src/automations-v2-automation-automations-v-2.context.js +60 -0
  12. package/build/cjs/src/automations-v2-automation-automations-v-2.context.js.map +1 -0
  13. package/build/cjs/src/automations-v2-automation-automations-v-2.http.d.ts +74 -0
  14. package/build/cjs/src/automations-v2-automation-automations-v-2.http.js +666 -0
  15. package/build/cjs/src/automations-v2-automation-automations-v-2.http.js.map +1 -0
  16. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.d.ts +49 -0
  17. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.js +351 -0
  18. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.js.map +1 -0
  19. package/build/cjs/src/automations-v2-automation-automations-v-2.public.d.ts +172 -0
  20. package/build/cjs/src/automations-v2-automation-automations-v-2.public.js +166 -0
  21. package/build/cjs/src/automations-v2-automation-automations-v-2.public.js.map +1 -0
  22. package/build/cjs/src/automations-v2-automation-automations-v-2.types.d.ts +2153 -0
  23. package/build/cjs/src/automations-v2-automation-automations-v-2.types.js +268 -0
  24. package/build/cjs/src/automations-v2-automation-automations-v-2.types.js.map +1 -0
  25. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.d.ts +2804 -0
  26. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.js +1015 -0
  27. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/automations-v2-automation-automations-v-2.context.d.ts +37 -0
  39. package/build/es/src/automations-v2-automation-automations-v-2.context.js +37 -0
  40. package/build/es/src/automations-v2-automation-automations-v-2.context.js.map +1 -0
  41. package/build/es/src/automations-v2-automation-automations-v-2.http.d.ts +74 -0
  42. package/build/es/src/automations-v2-automation-automations-v-2.http.js +646 -0
  43. package/build/es/src/automations-v2-automation-automations-v-2.http.js.map +1 -0
  44. package/build/es/src/automations-v2-automation-automations-v-2.meta.d.ts +49 -0
  45. package/build/es/src/automations-v2-automation-automations-v-2.meta.js +308 -0
  46. package/build/es/src/automations-v2-automation-automations-v-2.meta.js.map +1 -0
  47. package/build/es/src/automations-v2-automation-automations-v-2.public.d.ts +172 -0
  48. package/build/es/src/automations-v2-automation-automations-v-2.public.js +126 -0
  49. package/build/es/src/automations-v2-automation-automations-v-2.public.js.map +1 -0
  50. package/build/es/src/automations-v2-automation-automations-v-2.types.d.ts +2153 -0
  51. package/build/es/src/automations-v2-automation-automations-v-2.types.js +265 -0
  52. package/build/es/src/automations-v2-automation-automations-v-2.types.js.map +1 -0
  53. package/build/es/src/automations-v2-automation-automations-v-2.universal.d.ts +2804 -0
  54. package/build/es/src/automations-v2-automation-automations-v-2.universal.js +972 -0
  55. package/build/es/src/automations-v2-automation-automations-v-2.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.d.ts +37 -0
  66. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.js +60 -0
  67. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.js.map +1 -0
  68. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.d.ts +74 -0
  69. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.js +666 -0
  70. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.js.map +1 -0
  71. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.d.ts +49 -0
  72. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.js +351 -0
  73. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.js.map +1 -0
  74. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.d.ts +172 -0
  75. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.js +166 -0
  76. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.js.map +1 -0
  77. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.d.ts +2153 -0
  78. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.js +268 -0
  79. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.js.map +1 -0
  80. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.d.ts +2804 -0
  81. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.js +1015 -0
  82. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.d.ts +37 -0
  93. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.js +37 -0
  94. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.js.map +1 -0
  95. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.d.ts +74 -0
  96. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.js +646 -0
  97. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.js.map +1 -0
  98. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.d.ts +49 -0
  99. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.js +308 -0
  100. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.js.map +1 -0
  101. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.d.ts +172 -0
  102. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.js +126 -0
  103. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.js.map +1 -0
  104. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.d.ts +2153 -0
  105. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.js +265 -0
  106. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.js.map +1 -0
  107. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.d.ts +2804 -0
  108. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.js +972 -0
  109. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,1015 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getAutomationRevision = exports.validateAutomationById = exports.validateAutomation = exports.publishDraftAutomation = exports.deleteDraftAutomation = exports.queryAutomationsWithDrafts = exports.updateDraftAutomation = exports.getOrCreateDraftAutomation = exports.createDraftAutomation = exports.copyAutomation = exports.queryAutomations = exports.generatePreinstalledAutomation = exports.bulkDeleteAutomations = exports.deleteAutomation = exports.updateAutomation = exports.getAutomation = exports.createAutomation = exports.AutomationErrorType = exports.AutomationValidationErrorValidationErrorType = exports.ActionErrorType = exports.ValidationErrorType = exports.ValidationErrorSeverity = exports.TriggerErrorType = exports.TriggerValidationErrorValidationErrorType = exports.DeleteStatus = exports.Namespace = exports.SiteCreatedContext = exports.State = exports.SortOrder = exports.RequestedFields = exports.WebhookIdentityType = exports.Origin = exports.Status = exports.Type = exports.Operator = exports.TimeUnit = exports.Domain = void 0;
27
+ const transform_error_1 = require("@wix/sdk-runtime/transform-error");
28
+ const query_builder_1 = require("@wix/sdk-runtime/query-builder");
29
+ const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
30
+ const ambassadorWixAutomationsV2Automation = __importStar(require("./automations-v2-automation-automations-v-2.http.js"));
31
+ var Domain;
32
+ (function (Domain) {
33
+ /** User domain (default). */
34
+ Domain["USER"] = "USER";
35
+ /** Wix domain. */
36
+ Domain["WIX"] = "WIX";
37
+ /** Wix account-level domain. */
38
+ Domain["WIX_ACCOUNT"] = "WIX_ACCOUNT";
39
+ })(Domain || (exports.Domain = Domain = {}));
40
+ var TimeUnit;
41
+ (function (TimeUnit) {
42
+ TimeUnit["UNKNOWN_TIME_UNIT"] = "UNKNOWN_TIME_UNIT";
43
+ /** Minutes. */
44
+ TimeUnit["MINUTES"] = "MINUTES";
45
+ /** Hours. */
46
+ TimeUnit["HOURS"] = "HOURS";
47
+ /** Days. */
48
+ TimeUnit["DAYS"] = "DAYS";
49
+ /** Weeks. */
50
+ TimeUnit["WEEKS"] = "WEEKS";
51
+ /** Months. */
52
+ TimeUnit["MONTHS"] = "MONTHS";
53
+ })(TimeUnit || (exports.TimeUnit = TimeUnit = {}));
54
+ var Operator;
55
+ (function (Operator) {
56
+ /** Unknown. */
57
+ Operator["UNKNOWN_OPERATOR"] = "UNKNOWN_OPERATOR";
58
+ /** `OR` operator. */
59
+ Operator["OR"] = "OR";
60
+ /** `AND` operator. */
61
+ Operator["AND"] = "AND";
62
+ })(Operator || (exports.Operator = Operator = {}));
63
+ var Type;
64
+ (function (Type) {
65
+ /** Based on the trigger. */
66
+ Type["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
67
+ /** Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/about-automation-configuration#app-defined-actions). This action type is available in the site dashboard. */
68
+ Type["APP_DEFINED"] = "APP_DEFINED";
69
+ /** Condition. This determines which action runs next. */
70
+ Type["CONDITION"] = "CONDITION";
71
+ /** Delay. The automation must wait before executing the next step. */
72
+ Type["DELAY"] = "DELAY";
73
+ /** Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions. */
74
+ Type["RATE_LIMIT"] = "RATE_LIMIT";
75
+ })(Type || (exports.Type = Type = {}));
76
+ var Status;
77
+ (function (Status) {
78
+ /** Unknown. */
79
+ Status["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
80
+ /** Active. Active automations can be triggered. */
81
+ Status["ACTIVE"] = "ACTIVE";
82
+ /** Inactive. Inactive automations cannot be triggered. */
83
+ Status["INACTIVE"] = "INACTIVE";
84
+ })(Status || (exports.Status = Status = {}));
85
+ var Origin;
86
+ (function (Origin) {
87
+ /** Default value. */
88
+ Origin["UNKNOWN_ORIGIN"] = "UNKNOWN_ORIGIN";
89
+ /** Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary#wix-user). */
90
+ Origin["USER"] = "USER";
91
+ /** Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary#wix-app) for a particular site. */
92
+ Origin["APPLICATION"] = "APPLICATION";
93
+ /** [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations). */
94
+ Origin["PREINSTALLED"] = "PREINSTALLED";
95
+ })(Origin || (exports.Origin = Origin = {}));
96
+ var WebhookIdentityType;
97
+ (function (WebhookIdentityType) {
98
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
99
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
100
+ WebhookIdentityType["MEMBER"] = "MEMBER";
101
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
102
+ WebhookIdentityType["APP"] = "APP";
103
+ })(WebhookIdentityType || (exports.WebhookIdentityType = WebhookIdentityType = {}));
104
+ var RequestedFields;
105
+ (function (RequestedFields) {
106
+ RequestedFields["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
107
+ /** whether to return in response `configuration.trigger.override_output_schema` field and in `configuration.actions` the `override_output_schema` field */
108
+ RequestedFields["OVERRIDE_SCHEMA"] = "OVERRIDE_SCHEMA";
109
+ })(RequestedFields || (exports.RequestedFields = RequestedFields = {}));
110
+ var SortOrder;
111
+ (function (SortOrder) {
112
+ SortOrder["ASC"] = "ASC";
113
+ SortOrder["DESC"] = "DESC";
114
+ })(SortOrder || (exports.SortOrder = SortOrder = {}));
115
+ var State;
116
+ (function (State) {
117
+ State["UNKNOWN"] = "UNKNOWN";
118
+ State["ENABLED"] = "ENABLED";
119
+ State["DISABLED"] = "DISABLED";
120
+ State["PENDING"] = "PENDING";
121
+ State["DEMO"] = "DEMO";
122
+ })(State || (exports.State = State = {}));
123
+ var SiteCreatedContext;
124
+ (function (SiteCreatedContext) {
125
+ /** A valid option, we don't expose all reasons why site might be created. */
126
+ SiteCreatedContext["OTHER"] = "OTHER";
127
+ /** A meta site was created from template. */
128
+ SiteCreatedContext["FROM_TEMPLATE"] = "FROM_TEMPLATE";
129
+ /** A meta site was created by copying of the transfferred meta site. */
130
+ SiteCreatedContext["DUPLICATE_BY_SITE_TRANSFER"] = "DUPLICATE_BY_SITE_TRANSFER";
131
+ /** A copy of existing meta site. */
132
+ SiteCreatedContext["DUPLICATE"] = "DUPLICATE";
133
+ /** A meta site was created as a transfferred site (copy of the original), old flow, should die soon. */
134
+ SiteCreatedContext["OLD_SITE_TRANSFER"] = "OLD_SITE_TRANSFER";
135
+ /** deprecated A meta site was created for Flash editor. */
136
+ SiteCreatedContext["FLASH"] = "FLASH";
137
+ })(SiteCreatedContext || (exports.SiteCreatedContext = SiteCreatedContext = {}));
138
+ var Namespace;
139
+ (function (Namespace) {
140
+ Namespace["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
141
+ /** Default namespace for UGC sites. MetaSites with this namespace will be shown in a user's site list by default. */
142
+ Namespace["WIX"] = "WIX";
143
+ /** ShoutOut stand alone product. These are siteless (no actual Wix site, no HtmlWeb). MetaSites with this namespace will *not* be shown in a user's site list by default. */
144
+ Namespace["SHOUT_OUT"] = "SHOUT_OUT";
145
+ /** MetaSites created by the Albums product, they appear as part of the Albums app. MetaSites with this namespace will *not* be shown in a user's site list by default. */
146
+ Namespace["ALBUMS"] = "ALBUMS";
147
+ /** Part of the WixStores migration flow, a user tries to migrate and gets this site to view and if the user likes it then stores removes this namespace and deletes the old site with the old stores. MetaSites with this namespace will *not* be shown in a user's site list by default. */
148
+ Namespace["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
149
+ /** Hotels standalone (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
150
+ Namespace["HOTELS"] = "HOTELS";
151
+ /** Clubs siteless MetaSites, a club without a wix website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
152
+ Namespace["CLUBS"] = "CLUBS";
153
+ /** A partially created ADI website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
154
+ Namespace["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
155
+ /** AppBuilder for AppStudio / shmite (c). MetaSites with this namespace will *not* be shown in a user's site list by default. */
156
+ Namespace["DEV_SITE"] = "DEV_SITE";
157
+ /** LogoMaker websites offered to the user after logo purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
158
+ Namespace["LOGOS"] = "LOGOS";
159
+ /** VideoMaker websites offered to the user after video purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
160
+ Namespace["VIDEO_MAKER"] = "VIDEO_MAKER";
161
+ /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
162
+ Namespace["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
163
+ /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
164
+ Namespace["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
165
+ /**
166
+ * A draft created by HTML editor on open. Upon "first save" it will be moved to be of WIX domain.
167
+ *
168
+ * Meta site with this namespace will *not* be shown in a user's site list by default.
169
+ */
170
+ Namespace["HTML_DRAFT"] = "HTML_DRAFT";
171
+ /**
172
+ * the user-journey for Fitness users who want to start from managing their business instead of designing their website.
173
+ * Will be accessible from Site List and will not have a website app.
174
+ * Once the user attaches a site, the site will become a regular wixsite.
175
+ */
176
+ Namespace["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
177
+ /** Belongs to "strategic products" company. Supports new product in the creator's economy space. */
178
+ Namespace["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
179
+ /** It is to be used in the Business First efforts. */
180
+ Namespace["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
181
+ /** Bookings business flow with no site. */
182
+ Namespace["ANYWHERE"] = "ANYWHERE";
183
+ /** Namespace for Headless Backoffice with no editor */
184
+ Namespace["HEADLESS"] = "HEADLESS";
185
+ /**
186
+ * Namespace for master site that will exist in parent account that will be referenced by subaccounts
187
+ * The site will be used for account level CSM feature for enterprise
188
+ */
189
+ Namespace["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
190
+ /** Rise.ai Siteless account management for Gift Cards and Store Credit. */
191
+ Namespace["RISE"] = "RISE";
192
+ /**
193
+ * As part of the branded app new funnel, users now can create a meta site that will be branded app first.
194
+ * There's a blank site behind the scene but it's blank).
195
+ * The Mobile company will be the owner of this namespace.
196
+ */
197
+ Namespace["BRANDED_FIRST"] = "BRANDED_FIRST";
198
+ /** Nownia.com Siteless account management for Ai Scheduling Assistant. */
199
+ Namespace["NOWNIA"] = "NOWNIA";
200
+ /**
201
+ * UGC Templates are templates that are created by users for personal use and to sale to other users.
202
+ * The Partners company owns this namespace.
203
+ */
204
+ Namespace["UGC_TEMPLATE"] = "UGC_TEMPLATE";
205
+ /** Codux Headless Sites */
206
+ Namespace["CODUX"] = "CODUX";
207
+ /** Bobb - AI Design Creator. */
208
+ Namespace["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
209
+ /**
210
+ * Shared Blog Site is a unique single site across Enterprise account,
211
+ * This site will hold all Blog posts related to the Marketing product.
212
+ */
213
+ Namespace["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
214
+ /** Standalone forms (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
215
+ Namespace["STANDALONE_FORMS"] = "STANDALONE_FORMS";
216
+ /** Standalone events (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
217
+ Namespace["STANDALONE_EVENTS"] = "STANDALONE_EVENTS";
218
+ /** MIMIR - Siteless account for MIMIR Ai Job runner. */
219
+ Namespace["MIMIR"] = "MIMIR";
220
+ })(Namespace || (exports.Namespace = Namespace = {}));
221
+ var DeleteStatus;
222
+ (function (DeleteStatus) {
223
+ DeleteStatus["UNKNOWN"] = "UNKNOWN";
224
+ DeleteStatus["TRASH"] = "TRASH";
225
+ DeleteStatus["DELETED"] = "DELETED";
226
+ DeleteStatus["PENDING_PURGE"] = "PENDING_PURGE";
227
+ DeleteStatus["PURGED_EXTERNALLY"] = "PURGED_EXTERNALLY";
228
+ })(DeleteStatus || (exports.DeleteStatus = DeleteStatus = {}));
229
+ var TriggerValidationErrorValidationErrorType;
230
+ (function (TriggerValidationErrorValidationErrorType) {
231
+ TriggerValidationErrorValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
232
+ /** Configuration error. */
233
+ TriggerValidationErrorValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
234
+ /** Provider error. */
235
+ TriggerValidationErrorValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
236
+ })(TriggerValidationErrorValidationErrorType || (exports.TriggerValidationErrorValidationErrorType = TriggerValidationErrorValidationErrorType = {}));
237
+ var TriggerErrorType;
238
+ (function (TriggerErrorType) {
239
+ TriggerErrorType["UNKNOWN_TRIGGER_ERROR_TYPE"] = "UNKNOWN_TRIGGER_ERROR_TYPE";
240
+ /** Trigger not found. */
241
+ TriggerErrorType["NOT_FOUND"] = "NOT_FOUND";
242
+ /** App not installed. */
243
+ TriggerErrorType["APP_NOT_INSTALLED"] = "APP_NOT_INSTALLED";
244
+ /** Moderation mismatch. */
245
+ TriggerErrorType["MODERATION_MISMATCH"] = "MODERATION_MISMATCH";
246
+ /** Deprecated. */
247
+ TriggerErrorType["DEPRECATED"] = "DEPRECATED";
248
+ /** Invalid trigger key. */
249
+ TriggerErrorType["INVALID_TRIGGER_KEY"] = "INVALID_TRIGGER_KEY";
250
+ /** Invalid filter field key. */
251
+ TriggerErrorType["INVALID_FILTER_FIELD_KEY"] = "INVALID_FILTER_FIELD_KEY";
252
+ /** Invalid filter expression. */
253
+ TriggerErrorType["INVALID_FILTER_EXPRESSION"] = "INVALID_FILTER_EXPRESSION";
254
+ })(TriggerErrorType || (exports.TriggerErrorType = TriggerErrorType = {}));
255
+ var ValidationErrorSeverity;
256
+ (function (ValidationErrorSeverity) {
257
+ ValidationErrorSeverity["UNKNOWN_VALIDATION_ERROR_SEVERITY"] = "UNKNOWN_VALIDATION_ERROR_SEVERITY";
258
+ /** Warning. */
259
+ ValidationErrorSeverity["WARNING"] = "WARNING";
260
+ /** Error. */
261
+ ValidationErrorSeverity["ERROR"] = "ERROR";
262
+ })(ValidationErrorSeverity || (exports.ValidationErrorSeverity = ValidationErrorSeverity = {}));
263
+ var ValidationErrorType;
264
+ (function (ValidationErrorType) {
265
+ ValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
266
+ /** Configuration error. */
267
+ ValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
268
+ /** Provider error. */
269
+ ValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
270
+ })(ValidationErrorType || (exports.ValidationErrorType = ValidationErrorType = {}));
271
+ var ActionErrorType;
272
+ (function (ActionErrorType) {
273
+ ActionErrorType["UNKNOWN_ACTION_ERROR_TYPE"] = "UNKNOWN_ACTION_ERROR_TYPE";
274
+ ActionErrorType["NOT_FOUND"] = "NOT_FOUND";
275
+ ActionErrorType["APP_NOT_INSTALLED"] = "APP_NOT_INSTALLED";
276
+ ActionErrorType["MODERATION_MISMATCH"] = "MODERATION_MISMATCH";
277
+ ActionErrorType["DEPRECATED"] = "DEPRECATED";
278
+ ActionErrorType["INVALID_ACTION_KEY"] = "INVALID_ACTION_KEY";
279
+ ActionErrorType["INVALID_MAPPING"] = "INVALID_MAPPING";
280
+ ActionErrorType["MAPPING_TYPE_MISMATCH"] = "MAPPING_TYPE_MISMATCH";
281
+ ActionErrorType["MAPPING_MISSING_REQUIRED_FIELD"] = "MAPPING_MISSING_REQUIRED_FIELD";
282
+ ActionErrorType["MAPPING_SCHEMA_MISMATCH"] = "MAPPING_SCHEMA_MISMATCH";
283
+ ActionErrorType["MAPPING_VARIABLE_MISSING_FROM_SCHEMA"] = "MAPPING_VARIABLE_MISSING_FROM_SCHEMA";
284
+ })(ActionErrorType || (exports.ActionErrorType = ActionErrorType = {}));
285
+ var AutomationValidationErrorValidationErrorType;
286
+ (function (AutomationValidationErrorValidationErrorType) {
287
+ AutomationValidationErrorValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
288
+ AutomationValidationErrorValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
289
+ AutomationValidationErrorValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
290
+ })(AutomationValidationErrorValidationErrorType || (exports.AutomationValidationErrorValidationErrorType = AutomationValidationErrorValidationErrorType = {}));
291
+ var AutomationErrorType;
292
+ (function (AutomationErrorType) {
293
+ AutomationErrorType["UNKNOWN_AUTOMATION_ERROR_TYPE"] = "UNKNOWN_AUTOMATION_ERROR_TYPE";
294
+ })(AutomationErrorType || (exports.AutomationErrorType = AutomationErrorType = {}));
295
+ /**
296
+ * Creates an automation.
297
+ * @param automation - Automation to create.
298
+ * @public
299
+ * @documentationMaturity preview
300
+ * @requiredField automation
301
+ * @requiredField automation.configuration
302
+ * @requiredField automation.configuration.actions
303
+ * @requiredField automation.configuration.rootActionIds
304
+ * @requiredField automation.configuration.status
305
+ * @requiredField automation.configuration.trigger
306
+ * @requiredField automation.configuration.trigger.appId
307
+ * @requiredField automation.configuration.trigger.triggerKey
308
+ * @requiredField automation.name
309
+ * @requiredField automation.origin
310
+ * @permissionId AUTOMATIONS.AUTOMATION_CREATE
311
+ * @permissionScope Manage Stores
312
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
313
+ * @permissionScope Set Up Automations
314
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
315
+ * @applicableIdentity APP
316
+ * @returns Details of the created automation.
317
+ * @fqn wix.automations.v2.AutomationsService.CreateAutomation
318
+ */
319
+ async function createAutomation(automation) {
320
+ // @ts-ignore
321
+ const { httpClient, sideEffects } = arguments[1];
322
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
323
+ automation: automation,
324
+ });
325
+ const reqOpts = ambassadorWixAutomationsV2Automation.createAutomation(payload);
326
+ sideEffects?.onSiteCall?.();
327
+ try {
328
+ const result = await httpClient.request(reqOpts);
329
+ sideEffects?.onSuccess?.(result);
330
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data)?.automation;
331
+ }
332
+ catch (err) {
333
+ const transformedError = (0, transform_error_1.transformError)(err, {
334
+ spreadPathsToArguments: {},
335
+ explicitPathsToArguments: { automation: '$[0]' },
336
+ singleArgumentUnchanged: false,
337
+ }, ['automation']);
338
+ sideEffects?.onError?.(err);
339
+ throw transformedError;
340
+ }
341
+ }
342
+ exports.createAutomation = createAutomation;
343
+ /**
344
+ * Retrieves an automation by ID.
345
+ * @param automationId - Automation ID.
346
+ * @public
347
+ * @documentationMaturity preview
348
+ * @requiredField automationId
349
+ * @permissionId AUTOMATIONS.AUTOMATION_READ
350
+ * @permissionScope Manage Stores
351
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
352
+ * @permissionScope Set Up Automations
353
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
354
+ * @applicableIdentity APP
355
+ * @returns Retrieved automation.
356
+ * @fqn wix.automations.v2.AutomationsService.GetAutomation
357
+ */
358
+ async function getAutomation(automationId) {
359
+ // @ts-ignore
360
+ const { httpClient, sideEffects } = arguments[1];
361
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
362
+ automationId: automationId,
363
+ });
364
+ const reqOpts = ambassadorWixAutomationsV2Automation.getAutomation(payload);
365
+ sideEffects?.onSiteCall?.();
366
+ try {
367
+ const result = await httpClient.request(reqOpts);
368
+ sideEffects?.onSuccess?.(result);
369
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data)?.automation;
370
+ }
371
+ catch (err) {
372
+ const transformedError = (0, transform_error_1.transformError)(err, {
373
+ spreadPathsToArguments: {},
374
+ explicitPathsToArguments: { automationId: '$[0]' },
375
+ singleArgumentUnchanged: false,
376
+ }, ['automationId']);
377
+ sideEffects?.onError?.(err);
378
+ throw transformedError;
379
+ }
380
+ }
381
+ exports.getAutomation = getAutomation;
382
+ /**
383
+ * Updates the specified automation.
384
+ *
385
+ * When an automation is updated, its `revision` property is incremented by 1. When updating an automation, you must specify the current revision number.
386
+ * @param _id - Automation ID.
387
+ * @public
388
+ * @documentationMaturity preview
389
+ * @requiredField _id
390
+ * @requiredField automation
391
+ * @requiredField automation.revision
392
+ * @permissionId AUTOMATIONS.AUTOMATION_UPDATE
393
+ * @permissionScope Manage Stores
394
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
395
+ * @permissionScope Set Up Automations
396
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
397
+ * @applicableIdentity APP
398
+ * @returns Updated automation.
399
+ * @fqn wix.automations.v2.AutomationsService.UpdateAutomation
400
+ */
401
+ async function updateAutomation(_id, automation) {
402
+ // @ts-ignore
403
+ const { httpClient, sideEffects } = arguments[2];
404
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
405
+ automation: { ...automation, id: _id },
406
+ });
407
+ const reqOpts = ambassadorWixAutomationsV2Automation.updateAutomation(payload);
408
+ sideEffects?.onSiteCall?.();
409
+ try {
410
+ const result = await httpClient.request(reqOpts);
411
+ sideEffects?.onSuccess?.(result);
412
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data)?.automation;
413
+ }
414
+ catch (err) {
415
+ const transformedError = (0, transform_error_1.transformError)(err, {
416
+ spreadPathsToArguments: { automation: '$[1]' },
417
+ explicitPathsToArguments: { 'automation.id': '$[0]' },
418
+ singleArgumentUnchanged: false,
419
+ }, ['_id', 'automation']);
420
+ sideEffects?.onError?.(err);
421
+ throw transformedError;
422
+ }
423
+ }
424
+ exports.updateAutomation = updateAutomation;
425
+ /**
426
+ * Deletes the specified automation.
427
+ * @param automationId - Automation ID.
428
+ * @public
429
+ * @documentationMaturity preview
430
+ * @requiredField automationId
431
+ * @permissionId AUTOMATIONS.AUTOMATION_DELETE
432
+ * @permissionScope Manage Stores
433
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
434
+ * @permissionScope Set Up Automations
435
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
436
+ * @applicableIdentity APP
437
+ * @fqn wix.automations.v2.AutomationsService.DeleteAutomation
438
+ */
439
+ async function deleteAutomation(automationId) {
440
+ // @ts-ignore
441
+ const { httpClient, sideEffects } = arguments[1];
442
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
443
+ automationId: automationId,
444
+ });
445
+ const reqOpts = ambassadorWixAutomationsV2Automation.deleteAutomation(payload);
446
+ sideEffects?.onSiteCall?.();
447
+ try {
448
+ const result = await httpClient.request(reqOpts);
449
+ sideEffects?.onSuccess?.(result);
450
+ }
451
+ catch (err) {
452
+ const transformedError = (0, transform_error_1.transformError)(err, {
453
+ spreadPathsToArguments: {},
454
+ explicitPathsToArguments: { automationId: '$[0]' },
455
+ singleArgumentUnchanged: false,
456
+ }, ['automationId']);
457
+ sideEffects?.onError?.(err);
458
+ throw transformedError;
459
+ }
460
+ }
461
+ exports.deleteAutomation = deleteAutomation;
462
+ /**
463
+ * Deletes one or more automations.
464
+ * @param automationIds - IDs of the automations to delete.
465
+ * @public
466
+ * @documentationMaturity preview
467
+ * @requiredField automationIds
468
+ * @permissionId AUTOMATIONS.AUTOMATION_DELETE
469
+ * @permissionScope Manage Stores
470
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
471
+ * @permissionScope Set Up Automations
472
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
473
+ * @applicableIdentity APP
474
+ * @fqn wix.automations.v2.AutomationsService.BulkDeleteAutomations
475
+ */
476
+ async function bulkDeleteAutomations(automationIds) {
477
+ // @ts-ignore
478
+ const { httpClient, sideEffects } = arguments[1];
479
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
480
+ automationIds: automationIds,
481
+ });
482
+ const reqOpts = ambassadorWixAutomationsV2Automation.bulkDeleteAutomations(payload);
483
+ sideEffects?.onSiteCall?.();
484
+ try {
485
+ const result = await httpClient.request(reqOpts);
486
+ sideEffects?.onSuccess?.(result);
487
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
488
+ }
489
+ catch (err) {
490
+ const transformedError = (0, transform_error_1.transformError)(err, {
491
+ spreadPathsToArguments: {},
492
+ explicitPathsToArguments: { automationIds: '$[0]' },
493
+ singleArgumentUnchanged: false,
494
+ }, ['automationIds']);
495
+ sideEffects?.onError?.(err);
496
+ throw transformedError;
497
+ }
498
+ }
499
+ exports.bulkDeleteAutomations = bulkDeleteAutomations;
500
+ /**
501
+ * Generates a preinstalled automation from another automation.
502
+ *
503
+ * Calls the action providers for changes needed to make a preinstalled automation, such as changes made to email template.
504
+ *
505
+ * > **Note**: You must have an account permission to edit an app.
506
+ * @param automation - Automation.
507
+ * @public
508
+ * @documentationMaturity preview
509
+ * @requiredField automation
510
+ * @fqn wix.automations.v2.AutomationsService.GeneratePreinstalledAutomation
511
+ */
512
+ async function generatePreinstalledAutomation(automation, options) {
513
+ // @ts-ignore
514
+ const { httpClient, sideEffects } = arguments[2];
515
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
516
+ automation: automation,
517
+ appId: options?.appId,
518
+ });
519
+ const reqOpts = ambassadorWixAutomationsV2Automation.generatePreinstalledAutomation(payload);
520
+ sideEffects?.onSiteCall?.();
521
+ try {
522
+ const result = await httpClient.request(reqOpts);
523
+ sideEffects?.onSuccess?.(result);
524
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
525
+ }
526
+ catch (err) {
527
+ const transformedError = (0, transform_error_1.transformError)(err, {
528
+ spreadPathsToArguments: {},
529
+ explicitPathsToArguments: { automation: '$[0]', appId: '$[1].appId' },
530
+ singleArgumentUnchanged: false,
531
+ }, ['automation', 'options']);
532
+ sideEffects?.onError?.(err);
533
+ throw transformedError;
534
+ }
535
+ }
536
+ exports.generatePreinstalledAutomation = generatePreinstalledAutomation;
537
+ /**
538
+ * Retrieves a list of automations. This includes both automations overridden on a site and preinstalled automations. If a preinstalled automation has been overridden on the site, the method returns the override automation.
539
+ *
540
+ * > **Note**: The method only returns automations by apps installed on the site.
541
+ *
542
+ * Learn more about [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
543
+ * @public
544
+ * @documentationMaturity preview
545
+ * @permissionScope Manage Stores
546
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
547
+ * @permissionScope Set Up Automations
548
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
549
+ * @permissionId AUTOMATIONS.AUTOMATION_READ
550
+ * @applicableIdentity APP
551
+ * @fqn wix.automations.v2.AutomationsService.QueryAutomations
552
+ */
553
+ function queryAutomations(options) {
554
+ // @ts-ignore
555
+ const { httpClient, sideEffects } = arguments[1];
556
+ return (0, query_builder_1.queryBuilder)({
557
+ func: async (payload) => {
558
+ const reqOpts = ambassadorWixAutomationsV2Automation.queryAutomations({
559
+ ...payload,
560
+ ...(options ?? {}),
561
+ });
562
+ sideEffects?.onSiteCall?.();
563
+ try {
564
+ const result = await httpClient.request(reqOpts);
565
+ sideEffects?.onSuccess?.(result);
566
+ return result;
567
+ }
568
+ catch (err) {
569
+ sideEffects?.onError?.(err);
570
+ throw err;
571
+ }
572
+ },
573
+ requestTransformer: (query) => {
574
+ const args = [query, options];
575
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
576
+ ...args?.[1],
577
+ query: args?.[0],
578
+ });
579
+ },
580
+ responseTransformer: ({ data }) => {
581
+ const transformedData = (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(data);
582
+ return {
583
+ items: transformedData?.automations,
584
+ pagingMetadata: transformedData?.pagingMetadata,
585
+ };
586
+ },
587
+ errorTransformer: (err) => {
588
+ const transformedError = (0, transform_error_1.transformError)(err, {
589
+ spreadPathsToArguments: {},
590
+ explicitPathsToArguments: { query: '$[0]' },
591
+ singleArgumentUnchanged: false,
592
+ });
593
+ throw transformedError;
594
+ },
595
+ pagingMethod: 'CURSOR',
596
+ transformationPaths: {},
597
+ });
598
+ }
599
+ exports.queryAutomations = queryAutomations;
600
+ /**
601
+ * Creates a copy of an action with a new ID, and changes the action's input mapping if necessary.
602
+ *
603
+ * The action copy isn't saved automatically. To save it, the user must perform an action
604
+ * such as clicking the **Save** button.
605
+ * @param automationId - ID of the automation to copy.
606
+ * @public
607
+ * @documentationMaturity preview
608
+ * @requiredField automationId
609
+ * @permissionId AUTOMATIONS.AUTOMATION_COPY
610
+ * @permissionScope Manage Stores
611
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
612
+ * @permissionScope Set Up Automations
613
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
614
+ * @applicableIdentity APP
615
+ * @fqn wix.automations.v2.AutomationsService.CopyAutomation
616
+ */
617
+ async function copyAutomation(automationId, options) {
618
+ // @ts-ignore
619
+ const { httpClient, sideEffects } = arguments[2];
620
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
621
+ automationId: automationId,
622
+ origin: options?.origin,
623
+ automation: options?.automation,
624
+ });
625
+ const reqOpts = ambassadorWixAutomationsV2Automation.copyAutomation(payload);
626
+ sideEffects?.onSiteCall?.();
627
+ try {
628
+ const result = await httpClient.request(reqOpts);
629
+ sideEffects?.onSuccess?.(result);
630
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
631
+ }
632
+ catch (err) {
633
+ const transformedError = (0, transform_error_1.transformError)(err, {
634
+ spreadPathsToArguments: {},
635
+ explicitPathsToArguments: {
636
+ automationId: '$[0]',
637
+ origin: '$[1].origin',
638
+ automation: '$[1].automation',
639
+ },
640
+ singleArgumentUnchanged: false,
641
+ }, ['automationId', 'options']);
642
+ sideEffects?.onError?.(err);
643
+ throw transformedError;
644
+ }
645
+ }
646
+ exports.copyAutomation = copyAutomation;
647
+ /**
648
+ * Creates a draft automation.
649
+ * @public
650
+ * @documentationMaturity preview
651
+ * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_CREATE
652
+ * @permissionScope Manage Stores
653
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
654
+ * @permissionScope Set Up Automations
655
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
656
+ * @applicableIdentity APP
657
+ * @fqn wix.automations.v2.AutomationsService.CreateDraftAutomation
658
+ */
659
+ async function createDraftAutomation(options) {
660
+ // @ts-ignore
661
+ const { httpClient, sideEffects } = arguments[1];
662
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
663
+ automation: options?.automation,
664
+ });
665
+ const reqOpts = ambassadorWixAutomationsV2Automation.createDraftAutomation(payload);
666
+ sideEffects?.onSiteCall?.();
667
+ try {
668
+ const result = await httpClient.request(reqOpts);
669
+ sideEffects?.onSuccess?.(result);
670
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
671
+ }
672
+ catch (err) {
673
+ const transformedError = (0, transform_error_1.transformError)(err, {
674
+ spreadPathsToArguments: {},
675
+ explicitPathsToArguments: { automation: '$[0].automation' },
676
+ singleArgumentUnchanged: false,
677
+ }, ['options']);
678
+ sideEffects?.onError?.(err);
679
+ throw transformedError;
680
+ }
681
+ }
682
+ exports.createDraftAutomation = createDraftAutomation;
683
+ /**
684
+ * Retrieves the draft of the specified automation. If a draft doesn't exist, the method creates one.
685
+ *
686
+ * > **Note**: If the specified automation is a draft, the method returns it.
687
+ * @param originalAutomationId - ID of the original automation on which the draft is based.
688
+ * @public
689
+ * @documentationMaturity preview
690
+ * @requiredField originalAutomationId
691
+ * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_CREATE
692
+ * @permissionScope Manage Stores
693
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
694
+ * @permissionScope Set Up Automations
695
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
696
+ * @applicableIdentity APP
697
+ * @fqn wix.automations.v2.AutomationsService.GetOrCreateDraftAutomation
698
+ */
699
+ async function getOrCreateDraftAutomation(originalAutomationId) {
700
+ // @ts-ignore
701
+ const { httpClient, sideEffects } = arguments[1];
702
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
703
+ originalAutomationId: originalAutomationId,
704
+ });
705
+ const reqOpts = ambassadorWixAutomationsV2Automation.getOrCreateDraftAutomation(payload);
706
+ sideEffects?.onSiteCall?.();
707
+ try {
708
+ const result = await httpClient.request(reqOpts);
709
+ sideEffects?.onSuccess?.(result);
710
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
711
+ }
712
+ catch (err) {
713
+ const transformedError = (0, transform_error_1.transformError)(err, {
714
+ spreadPathsToArguments: {},
715
+ explicitPathsToArguments: { originalAutomationId: '$[0]' },
716
+ singleArgumentUnchanged: false,
717
+ }, ['originalAutomationId']);
718
+ sideEffects?.onError?.(err);
719
+ throw transformedError;
720
+ }
721
+ }
722
+ exports.getOrCreateDraftAutomation = getOrCreateDraftAutomation;
723
+ /**
724
+ * Updates a draft automation.
725
+ * @param _id - Automation ID.
726
+ * @public
727
+ * @documentationMaturity preview
728
+ * @requiredField _id
729
+ * @requiredField automation
730
+ * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_UPDATE
731
+ * @permissionScope Manage Stores
732
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
733
+ * @permissionScope Set Up Automations
734
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
735
+ * @applicableIdentity APP
736
+ * @fqn wix.automations.v2.AutomationsService.UpdateDraftAutomation
737
+ */
738
+ async function updateDraftAutomation(_id, automation) {
739
+ // @ts-ignore
740
+ const { httpClient, sideEffects } = arguments[2];
741
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
742
+ automation: { ...automation, id: _id },
743
+ });
744
+ const reqOpts = ambassadorWixAutomationsV2Automation.updateDraftAutomation(payload);
745
+ sideEffects?.onSiteCall?.();
746
+ try {
747
+ const result = await httpClient.request(reqOpts);
748
+ sideEffects?.onSuccess?.(result);
749
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
750
+ }
751
+ catch (err) {
752
+ const transformedError = (0, transform_error_1.transformError)(err, {
753
+ spreadPathsToArguments: { automation: '$[1]' },
754
+ explicitPathsToArguments: { 'automation.id': '$[0]' },
755
+ singleArgumentUnchanged: false,
756
+ }, ['_id', 'automation']);
757
+ sideEffects?.onError?.(err);
758
+ throw transformedError;
759
+ }
760
+ }
761
+ exports.updateDraftAutomation = updateDraftAutomation;
762
+ /**
763
+ * Retrieves a list of automations, including drafts. Max query filter depth is 3.
764
+ *
765
+ * Relevant automations for the query are returned. This includes automations created on the site and pre-installed automations.
766
+ * If there's an existing override for a pre-installed automation, the override is returned in the query result.
767
+ * The query only returns automations from apps that are installed on the site.
768
+ *
769
+ * - new drafts that are not related to existing automations will be returned in the list
770
+ * - the response will contain a map of originalAutomationId => relatedDrafts
771
+ *
772
+ * To learn about working with _Query_ endpoints, see
773
+ * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
774
+ * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
775
+ * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
776
+ * @public
777
+ * @documentationMaturity preview
778
+ * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_READ
779
+ * @permissionScope Manage Stores
780
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
781
+ * @permissionScope Manage Restaurants - all permissions
782
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
783
+ * @permissionScope Set Up Automations
784
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
785
+ * @applicableIdentity APP
786
+ * @fqn wix.automations.v2.AutomationsService.QueryAutomationsWithDrafts
787
+ */
788
+ async function queryAutomationsWithDrafts(options) {
789
+ // @ts-ignore
790
+ const { httpClient, sideEffects } = arguments[1];
791
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
792
+ query: options?.query,
793
+ });
794
+ const reqOpts = ambassadorWixAutomationsV2Automation.queryAutomationsWithDrafts(payload);
795
+ sideEffects?.onSiteCall?.();
796
+ try {
797
+ const result = await httpClient.request(reqOpts);
798
+ sideEffects?.onSuccess?.(result);
799
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
800
+ }
801
+ catch (err) {
802
+ const transformedError = (0, transform_error_1.transformError)(err, {
803
+ spreadPathsToArguments: {},
804
+ explicitPathsToArguments: { query: '$[0].query' },
805
+ singleArgumentUnchanged: false,
806
+ }, ['options']);
807
+ sideEffects?.onError?.(err);
808
+ throw transformedError;
809
+ }
810
+ }
811
+ exports.queryAutomationsWithDrafts = queryAutomationsWithDrafts;
812
+ /**
813
+ * Deletes a draft automation.
814
+ * @param automationId - ID of the draft automation to delete.
815
+ * @public
816
+ * @documentationMaturity preview
817
+ * @requiredField automationId
818
+ * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_DELETE
819
+ * @permissionScope Manage Stores
820
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
821
+ * @permissionScope Set Up Automations
822
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
823
+ * @applicableIdentity APP
824
+ * @fqn wix.automations.v2.AutomationsService.DeleteDraftAutomation
825
+ */
826
+ async function deleteDraftAutomation(automationId) {
827
+ // @ts-ignore
828
+ const { httpClient, sideEffects } = arguments[1];
829
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
830
+ automationId: automationId,
831
+ });
832
+ const reqOpts = ambassadorWixAutomationsV2Automation.deleteDraftAutomation(payload);
833
+ sideEffects?.onSiteCall?.();
834
+ try {
835
+ const result = await httpClient.request(reqOpts);
836
+ sideEffects?.onSuccess?.(result);
837
+ }
838
+ catch (err) {
839
+ const transformedError = (0, transform_error_1.transformError)(err, {
840
+ spreadPathsToArguments: {},
841
+ explicitPathsToArguments: { automationId: '$[0]' },
842
+ singleArgumentUnchanged: false,
843
+ }, ['automationId']);
844
+ sideEffects?.onError?.(err);
845
+ throw transformedError;
846
+ }
847
+ }
848
+ exports.deleteDraftAutomation = deleteDraftAutomation;
849
+ /**
850
+ * Publishes a draft automation. This applies any changes to the live automation.
851
+ * @param automationId - ID of the draft automation to publish.
852
+ * @public
853
+ * @documentationMaturity preview
854
+ * @requiredField automationId
855
+ * @permissionId AUTOMATIONS.AUTOMATION_UPDATE
856
+ * @permissionScope Manage Stores
857
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
858
+ * @permissionScope Set Up Automations
859
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
860
+ * @applicableIdentity APP
861
+ * @fqn wix.automations.v2.AutomationsService.PublishDraftAutomation
862
+ */
863
+ async function publishDraftAutomation(automationId) {
864
+ // @ts-ignore
865
+ const { httpClient, sideEffects } = arguments[1];
866
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
867
+ automationId: automationId,
868
+ });
869
+ const reqOpts = ambassadorWixAutomationsV2Automation.publishDraftAutomation(payload);
870
+ sideEffects?.onSiteCall?.();
871
+ try {
872
+ const result = await httpClient.request(reqOpts);
873
+ sideEffects?.onSuccess?.(result);
874
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
875
+ }
876
+ catch (err) {
877
+ const transformedError = (0, transform_error_1.transformError)(err, {
878
+ spreadPathsToArguments: {},
879
+ explicitPathsToArguments: { automationId: '$[0]' },
880
+ singleArgumentUnchanged: false,
881
+ }, ['automationId']);
882
+ sideEffects?.onError?.(err);
883
+ throw transformedError;
884
+ }
885
+ }
886
+ exports.publishDraftAutomation = publishDraftAutomation;
887
+ /**
888
+ * Validates the specified automation.
889
+ * @param automation - Automation to validate.
890
+ * @public
891
+ * @documentationMaturity preview
892
+ * @requiredField automation
893
+ * @permissionId AUTOMATIONS.AUTOMATION_VALIDATE
894
+ * @permissionScope Manage Stores
895
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
896
+ * @permissionScope Set Up Automations
897
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
898
+ * @applicableIdentity APP
899
+ * @fqn wix.automations.v2.AutomationsService.ValidateAutomation
900
+ */
901
+ async function validateAutomation(automation, options) {
902
+ // @ts-ignore
903
+ const { httpClient, sideEffects } = arguments[2];
904
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
905
+ automation: automation,
906
+ validationSettings: options?.validationSettings,
907
+ });
908
+ const reqOpts = ambassadorWixAutomationsV2Automation.validateAutomation(payload);
909
+ sideEffects?.onSiteCall?.();
910
+ try {
911
+ const result = await httpClient.request(reqOpts);
912
+ sideEffects?.onSuccess?.(result);
913
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
914
+ }
915
+ catch (err) {
916
+ const transformedError = (0, transform_error_1.transformError)(err, {
917
+ spreadPathsToArguments: {},
918
+ explicitPathsToArguments: {
919
+ automation: '$[0]',
920
+ validationSettings: '$[1].validationSettings',
921
+ },
922
+ singleArgumentUnchanged: false,
923
+ }, ['automation', 'options']);
924
+ sideEffects?.onError?.(err);
925
+ throw transformedError;
926
+ }
927
+ }
928
+ exports.validateAutomation = validateAutomation;
929
+ /**
930
+ * Validates the automation specified by ID.
931
+ * @param automationId - Automation ID.
932
+ * @public
933
+ * @documentationMaturity preview
934
+ * @requiredField automationId
935
+ * @permissionId AUTOMATIONS.AUTOMATION_VALIDATE
936
+ * @permissionScope Manage Stores
937
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
938
+ * @permissionScope Set Up Automations
939
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
940
+ * @applicableIdentity APP
941
+ * @fqn wix.automations.v2.AutomationsService.ValidateAutomationById
942
+ */
943
+ async function validateAutomationById(automationId, options) {
944
+ // @ts-ignore
945
+ const { httpClient, sideEffects } = arguments[2];
946
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
947
+ automationId: automationId,
948
+ validationSettings: options?.validationSettings,
949
+ });
950
+ const reqOpts = ambassadorWixAutomationsV2Automation.validateAutomationById(payload);
951
+ sideEffects?.onSiteCall?.();
952
+ try {
953
+ const result = await httpClient.request(reqOpts);
954
+ sideEffects?.onSuccess?.(result);
955
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
956
+ }
957
+ catch (err) {
958
+ const transformedError = (0, transform_error_1.transformError)(err, {
959
+ spreadPathsToArguments: {},
960
+ explicitPathsToArguments: {
961
+ automationId: '$[0]',
962
+ validationSettings: '$[1].validationSettings',
963
+ },
964
+ singleArgumentUnchanged: false,
965
+ }, ['automationId', 'options']);
966
+ sideEffects?.onError?.(err);
967
+ throw transformedError;
968
+ }
969
+ }
970
+ exports.validateAutomationById = validateAutomationById;
971
+ /**
972
+ * Gets the specified automation revision.
973
+ * @param automationId - Automation ID.
974
+ * @public
975
+ * @documentationMaturity preview
976
+ * @requiredField automationId
977
+ * @permissionId AUTOMATIONS.AUTOMATION_REVISION_READ
978
+ * @permissionScope Manage Stores
979
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
980
+ * @permissionScope Set Up Automations
981
+ * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
982
+ * @applicableIdentity APP
983
+ * @fqn wix.automations.v2.AutomationRevisionsService.GetAutomationRevision
984
+ */
985
+ async function getAutomationRevision(automationId, options) {
986
+ // @ts-ignore
987
+ const { httpClient, sideEffects } = arguments[2];
988
+ const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
989
+ automationId: automationId,
990
+ revision: options?.revision,
991
+ fields: options?.fields,
992
+ });
993
+ const reqOpts = ambassadorWixAutomationsV2Automation.getAutomationRevision(payload);
994
+ sideEffects?.onSiteCall?.();
995
+ try {
996
+ const result = await httpClient.request(reqOpts);
997
+ sideEffects?.onSuccess?.(result);
998
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
999
+ }
1000
+ catch (err) {
1001
+ const transformedError = (0, transform_error_1.transformError)(err, {
1002
+ spreadPathsToArguments: {},
1003
+ explicitPathsToArguments: {
1004
+ automationId: '$[0]',
1005
+ revision: '$[1].revision',
1006
+ fields: '$[1].fields',
1007
+ },
1008
+ singleArgumentUnchanged: false,
1009
+ }, ['automationId', 'options']);
1010
+ sideEffects?.onError?.(err);
1011
+ throw transformedError;
1012
+ }
1013
+ }
1014
+ exports.getAutomationRevision = getAutomationRevision;
1015
+ //# sourceMappingURL=automations-v2-automation-automations-v-2.universal.js.map