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