@adobe/aio-commerce-lib-app 1.7.0 → 1.8.0-beta-20260714082406
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.
- package/CHANGELOG.md +83 -0
- package/dist/cjs/actions/app-config/index.cjs +41 -38
- package/dist/cjs/actions/app-config/index.d.cts +1 -1
- package/dist/cjs/actions/association/index.cjs +85 -0
- package/dist/cjs/actions/{registration → association}/index.d.cts +9 -13
- package/dist/cjs/actions/config/index.cjs +21 -32
- package/dist/cjs/actions/installation/index.cjs +72 -51
- package/dist/cjs/actions/installation/index.d.cts +2 -2
- package/dist/cjs/actions/scope-tree/index.cjs +18 -17
- package/dist/{es/app-DrYHK-z1.d.mts → cjs/app-D3P-Z6uY.d.cts} +1085 -1035
- package/dist/cjs/association-repository-BAs3-VkW.cjs +69 -0
- package/dist/cjs/commands/index.cjs +512 -298
- package/dist/cjs/commands/templates/admin-ui/tsconfig.json +14 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/index.css +5 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/index.html +17 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/src/app.jsx +13 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/src/components/welcome.jsx +12 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/src/pages/main-page.jsx +10 -0
- package/dist/cjs/commands/templates/{admin-ui-sdk/registration.js.template → admin-ui/web-src-template.d.ts} +11 -6
- package/dist/cjs/commands/templates/app-management/app-config.js.template +1 -14
- package/dist/cjs/commands/templates/app-management/association.js.template +6 -0
- package/dist/cjs/commands/templates/app-management/installation.js.template +1 -13
- package/dist/cjs/commands/templates/business-configuration/config.js.template +2 -15
- package/dist/cjs/commands/templates/business-configuration/scope-tree.js.template +0 -12
- package/dist/cjs/config/index.browser.cjs +18 -0
- package/dist/cjs/config/index.browser.d.cts +16 -0
- package/dist/cjs/config/{index.cjs → index.node.cjs} +9 -8
- package/dist/cjs/config/{index.d.cts → index.node.d.cts} +954 -386
- package/dist/cjs/define-DBxAlJfN.d.cts +34 -0
- package/dist/cjs/define-hlcQw7Cv.cjs +41 -0
- package/dist/cjs/environment-B7EnozSg.cjs +135 -0
- package/dist/cjs/{index-B5gJ-q4U.d.cts → index-CzReNwbF.d.cts} +17 -12
- package/dist/cjs/index.cjs +250 -0
- package/dist/cjs/index.d.cts +217 -0
- package/dist/cjs/{config-D-s0GSep.cjs → index.node-Dz4lV4qe.cjs} +119 -35
- package/dist/cjs/{logging-BVz3weoC.cjs → logging-udPuAJPt.cjs} +2 -2
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +1 -1
- package/dist/cjs/{management-Dehz9qSJ.cjs → management-B9ItB80R.cjs} +385 -582
- package/dist/cjs/{openapi-Cux6K4ZD.cjs → openapi-CwytYdWl.cjs} +476 -600
- package/dist/cjs/{router-BOR7T6qR.cjs → router-hA_Y9gZ1.cjs} +42 -44
- package/dist/cjs/{schemas-FngDuIeo.cjs → schemas-mLxMh_ko.cjs} +2 -2
- package/dist/cjs/utils-DSCmZ_iJ.cjs +408 -0
- package/dist/cjs/{validate-oAOpyFyb.cjs → validate-BfxhZ5Wv.cjs} +20 -20
- package/dist/cjs/{webhooks-tbZy9G3p.cjs → webhooks-B5tb9NeF.cjs} +159 -151
- package/dist/es/actions/app-config/index.d.mts +1 -1
- package/dist/es/actions/app-config/index.mjs +39 -36
- package/dist/es/actions/{registration → association}/index.d.mts +9 -13
- package/dist/es/actions/association/index.mjs +82 -0
- package/dist/es/actions/config/index.mjs +17 -28
- package/dist/es/actions/installation/index.d.mts +2 -2
- package/dist/es/actions/installation/index.mjs +69 -48
- package/dist/es/actions/scope-tree/index.mjs +14 -13
- package/dist/{cjs/app-DrYHK-z1.d.cts → es/app-D3P-Z6uY.d.mts} +1085 -1035
- package/dist/es/association-repository-BbQv9WCl.mjs +52 -0
- package/dist/es/commands/index.mjs +544 -328
- package/dist/es/commands/templates/admin-ui/tsconfig.json +14 -0
- package/dist/es/commands/templates/admin-ui/web-src/index.css +5 -0
- package/dist/es/commands/templates/admin-ui/web-src/index.html +17 -0
- package/dist/es/commands/templates/admin-ui/web-src/src/app.jsx +13 -0
- package/dist/es/commands/templates/admin-ui/web-src/src/components/welcome.jsx +12 -0
- package/dist/es/commands/templates/admin-ui/web-src/src/pages/main-page.jsx +10 -0
- package/dist/es/commands/templates/{admin-ui-sdk/registration.js.template → admin-ui/web-src-template.d.ts} +11 -6
- package/dist/es/commands/templates/app-management/app-config.js.template +1 -14
- package/dist/es/commands/templates/app-management/association.js.template +6 -0
- package/dist/es/commands/templates/app-management/installation.js.template +1 -13
- package/dist/es/commands/templates/business-configuration/config.js.template +2 -15
- package/dist/es/commands/templates/business-configuration/scope-tree.js.template +0 -12
- package/dist/es/config/index.browser.d.mts +16 -0
- package/dist/es/config/index.browser.mjs +17 -0
- package/dist/es/config/{index.d.mts → index.node.d.mts} +954 -386
- package/dist/es/config/{index.mjs → index.node.mjs} +5 -4
- package/dist/es/define-EoYRZbpe.d.mts +34 -0
- package/dist/es/define-Z_Glf1-_.mjs +35 -0
- package/dist/es/environment-C84BPRJZ.mjs +104 -0
- package/dist/es/{index-DLMbTtKS.d.mts → index-D52xglhZ.d.mts} +17 -12
- package/dist/es/index.d.mts +217 -0
- package/dist/es/index.mjs +242 -0
- package/dist/es/{config-3I4eLyyR.mjs → index.node-CDH5gwJE.mjs} +94 -30
- package/dist/es/management/index.d.mts +1 -1
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-BUX-w2Ji.mjs → management-B89ApQVY.mjs} +353 -550
- package/dist/es/{openapi-B6uP0SRn.mjs → openapi-CXonvevE.mjs} +476 -600
- package/dist/es/{router-D58JJHHA.mjs → router-B_h0cvjc.mjs} +40 -42
- package/dist/es/utils-_gj8L6eN.mjs +289 -0
- package/dist/es/{validate-Dfajrp99.mjs → validate-9cRZWGrA.mjs} +17 -17
- package/dist/es/{webhooks-B5oq9ULL.mjs → webhooks-BBPbY2mb.mjs} +150 -142
- package/package.json +40 -17
- package/dist/cjs/actions/registration/index.cjs +0 -50
- package/dist/cjs/admin-ui-sdk-EU915zlR.d.cts +0 -664
- package/dist/es/actions/registration/index.mjs +0 -49
- package/dist/es/admin-ui-sdk-BwnD0xjK.d.mts +0 -664
- /package/dist/cjs/{chunk-Cozy-1ZF.cjs → rolldown-runtime-Cozy-1ZF.cjs} +0 -0
|
@@ -12,34 +12,22 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { _ as getRegistrationName, a as findExistingProviderMetadata, b as sanitizeEventingIdentifier, c as generateInstanceId, d as getCommerceEventingExistingData, f as getIoEventCode, g as getRegistrationDescription, h as getNamespacedEvent, i as findExistingProvider, l as generateInstanceIdDeprecated, m as getLegacyRegistrationName, n as EVENTS_STORAGE_KEY, o as findExistingRegistrations, p as getIoEventsExistingData, r as EXTERNAL_PROVIDER_TYPE, s as findExistingSubscription, t as COMMERCE_PROVIDER_TYPE, u as getCommerceEventingConfigurationUpdateParams, v as groupEventsByRuntimeActions, y as makeWorkspaceConfig } from "./utils-_gj8L6eN.mjs";
|
|
15
16
|
import { t as stringifyError } from "./error-_RMwtrUA.mjs";
|
|
16
|
-
import { a as
|
|
17
|
+
import { a as parseOrThrow, i as getInstallCommerceEnv, t as appliesToEnv } from "./environment-C84BPRJZ.mjs";
|
|
18
|
+
import { a as hasCustomInstallationSteps, c as hasEventing, d as hasAdminUi, l as hasExternalEvents, n as hasWebhooks, s as hasCommerceEvents } from "./webhooks-BBPbY2mb.mjs";
|
|
17
19
|
import { t as inspect } from "./logging-DbJHXSKh.mjs";
|
|
18
|
-
import {
|
|
20
|
+
import { resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
21
|
+
import { getSystemConfigByKey, setSystemConfigByKey } from "@adobe/aio-commerce-lib-config";
|
|
22
|
+
import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
|
|
19
23
|
import * as v from "valibot";
|
|
20
24
|
import { unwrapHttpError } from "@adobe/aio-commerce-lib-api/utils";
|
|
21
25
|
import * as camelcaseModule from "camelcase";
|
|
22
26
|
import { createAdminUiApiClient } from "@adobe/aio-commerce-lib-admin-ui/api";
|
|
23
|
-
import { resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
24
|
-
import { resolveAuthParams, resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
|
|
25
27
|
import { createCustomCommerceEventsApiClient, createEventProvider, createEventSubscription, deleteEventProvider, deleteEventSubscription, getAllEventProviders, getAllEventSubscriptions, updateEventingConfiguration } from "@adobe/aio-commerce-lib-events/commerce";
|
|
26
28
|
import { createCustomAdobeIoEventsApiClient, createEventMetadataForProvider, createEventProvider as createEventProvider$1, createRegistration, deleteEventMetadataForProvider, deleteEventProvider as deleteEventProvider$1, deleteRegistration, getAllEventProviders as getAllEventProviders$1, getAllRegistrations } from "@adobe/aio-commerce-lib-events/io-events";
|
|
27
29
|
import { createCustomCommerceWebhooksApiClient, getWebhookList, subscribeWebhook, unsubscribeWebhook } from "@adobe/aio-commerce-lib-webhooks/api";
|
|
28
30
|
|
|
29
|
-
//#region ../../packages-private/common-utils/source/valibot/utils.ts
|
|
30
|
-
/**
|
|
31
|
-
* Parses the input using the provided schema and throws a {@link CommerceSdkValidationError} error if the input is invalid.
|
|
32
|
-
* @param schema - The schema to use for parsing.
|
|
33
|
-
* @param input - The input to parse.
|
|
34
|
-
* @param message - Optional custom error message for the validation error.
|
|
35
|
-
*/
|
|
36
|
-
function parseOrThrow(schema, input, message) {
|
|
37
|
-
const result = v.safeParse(schema, input);
|
|
38
|
-
if (!result.success) throw new CommerceSdkValidationError(message ?? "Invalid input", { issues: result.issues });
|
|
39
|
-
return result.output;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
31
|
//#region source/management/installation/workflow/hooks.ts
|
|
44
32
|
/** Helper to call a hook if it exists. */
|
|
45
33
|
async function callHook(hooks, hookName, ...args) {
|
|
@@ -74,13 +62,13 @@ function isBranchStep(step) {
|
|
|
74
62
|
*/
|
|
75
63
|
function defineLeafStep(options) {
|
|
76
64
|
return {
|
|
77
|
-
type: "leaf",
|
|
78
|
-
name: options.name,
|
|
79
|
-
meta: options.meta,
|
|
80
|
-
when: options.when,
|
|
81
65
|
install: options.install,
|
|
66
|
+
meta: options.meta,
|
|
67
|
+
name: options.name,
|
|
68
|
+
type: "leaf",
|
|
82
69
|
uninstall: options.uninstall,
|
|
83
|
-
validate: options.validate
|
|
70
|
+
validate: options.validate,
|
|
71
|
+
when: options.when
|
|
84
72
|
};
|
|
85
73
|
}
|
|
86
74
|
/**
|
|
@@ -99,13 +87,13 @@ function defineLeafStep(options) {
|
|
|
99
87
|
*/
|
|
100
88
|
function defineBranchStep(options) {
|
|
101
89
|
return {
|
|
102
|
-
type: "branch",
|
|
103
|
-
name: options.name,
|
|
104
|
-
meta: options.meta,
|
|
105
|
-
when: options.when,
|
|
106
|
-
context: options.context,
|
|
107
90
|
children: options.children,
|
|
108
|
-
|
|
91
|
+
context: options.context,
|
|
92
|
+
meta: options.meta,
|
|
93
|
+
name: options.name,
|
|
94
|
+
type: "branch",
|
|
95
|
+
validate: options.validate,
|
|
96
|
+
when: options.when
|
|
109
97
|
};
|
|
110
98
|
}
|
|
111
99
|
|
|
@@ -120,7 +108,7 @@ function setAtPath(data, path, value) {
|
|
|
120
108
|
const lastKey = path.at(-1);
|
|
121
109
|
if (!lastKey) return;
|
|
122
110
|
let current = data;
|
|
123
|
-
for (let i = 0; i < path.length - 1; i
|
|
111
|
+
for (let i = 0; i < path.length - 1; i += 1) {
|
|
124
112
|
const key = path[i];
|
|
125
113
|
current[key] ??= {};
|
|
126
114
|
current = current[key];
|
|
@@ -131,7 +119,7 @@ function setAtPath(data, path, value) {
|
|
|
131
119
|
function getAtPath(data, path) {
|
|
132
120
|
let current = data;
|
|
133
121
|
for (const key of path) {
|
|
134
|
-
if (current
|
|
122
|
+
if (current === null || current === void 0 || typeof current !== "object") return;
|
|
135
123
|
current = current[key];
|
|
136
124
|
}
|
|
137
125
|
return current;
|
|
@@ -139,26 +127,26 @@ function getAtPath(data, path) {
|
|
|
139
127
|
/** Creates an installation error from an exception. */
|
|
140
128
|
async function createInstallationError(err, path, key = "STEP_EXECUTION_FAILED") {
|
|
141
129
|
return {
|
|
142
|
-
path,
|
|
143
130
|
key,
|
|
144
|
-
message: await unwrapHttpError(err)
|
|
131
|
+
message: await unwrapHttpError(err),
|
|
132
|
+
path
|
|
145
133
|
};
|
|
146
134
|
}
|
|
147
135
|
/** Creates a succeeded installation state. */
|
|
148
136
|
function createSucceededState(base) {
|
|
149
137
|
return {
|
|
150
138
|
...base,
|
|
151
|
-
|
|
152
|
-
|
|
139
|
+
completedAt: nowIsoString(),
|
|
140
|
+
status: "succeeded"
|
|
153
141
|
};
|
|
154
142
|
}
|
|
155
143
|
/** Creates a failed installation state. */
|
|
156
144
|
function createFailedState(base, error) {
|
|
157
145
|
return {
|
|
158
146
|
...base,
|
|
159
|
-
status: "failed",
|
|
160
147
|
completedAt: nowIsoString(),
|
|
161
|
-
error
|
|
148
|
+
error,
|
|
149
|
+
status: "failed"
|
|
162
150
|
};
|
|
163
151
|
}
|
|
164
152
|
|
|
@@ -173,11 +161,12 @@ function createFailedState(base, error) {
|
|
|
173
161
|
function createInitialState(options) {
|
|
174
162
|
const { rootStep, config, mode } = options;
|
|
175
163
|
return {
|
|
164
|
+
config,
|
|
165
|
+
data: null,
|
|
176
166
|
id: crypto.randomUUID(),
|
|
177
167
|
startedAt: nowIsoString(),
|
|
178
168
|
status: "in-progress",
|
|
179
|
-
step: buildInitialStepStatus(rootStep, config, [], mode)
|
|
180
|
-
data: null
|
|
169
|
+
step: buildInitialStepStatus(rootStep, config, [], mode)
|
|
181
170
|
};
|
|
182
171
|
}
|
|
183
172
|
/**
|
|
@@ -187,19 +176,20 @@ function createInitialState(options) {
|
|
|
187
176
|
*/
|
|
188
177
|
function createRetryState(failedState) {
|
|
189
178
|
return {
|
|
179
|
+
config: failedState.config,
|
|
180
|
+
data: failedState.data,
|
|
190
181
|
id: failedState.id,
|
|
191
182
|
startedAt: failedState.startedAt,
|
|
192
183
|
status: "in-progress",
|
|
193
|
-
step: resetFailedSteps(failedState.step)
|
|
194
|
-
data: failedState.data
|
|
184
|
+
step: resetFailedSteps(failedState.step)
|
|
195
185
|
};
|
|
196
186
|
}
|
|
197
187
|
/** Recursively resets non-succeeded steps back to "pending". */
|
|
198
188
|
function resetFailedSteps(step) {
|
|
199
189
|
return {
|
|
200
190
|
...step,
|
|
201
|
-
|
|
202
|
-
|
|
191
|
+
children: step.children.map(resetFailedSteps),
|
|
192
|
+
status: step.status === "succeeded" ? "succeeded" : "pending"
|
|
203
193
|
};
|
|
204
194
|
}
|
|
205
195
|
/**
|
|
@@ -222,34 +212,36 @@ async function executeWorkflowWithMode(options, mode) {
|
|
|
222
212
|
const { rootStep, installationContext, config, initialState, hooks } = options;
|
|
223
213
|
const step = structuredClone(initialState.step);
|
|
224
214
|
const context = {
|
|
225
|
-
installationContext,
|
|
226
215
|
config,
|
|
227
|
-
id: initialState.id,
|
|
228
|
-
startedAt: initialState.startedAt,
|
|
229
|
-
step,
|
|
230
216
|
data: initialState.data,
|
|
231
217
|
error: null,
|
|
232
218
|
hooks,
|
|
233
|
-
|
|
219
|
+
id: initialState.id,
|
|
220
|
+
installationContext,
|
|
221
|
+
mode,
|
|
222
|
+
startedAt: initialState.startedAt,
|
|
223
|
+
step
|
|
234
224
|
};
|
|
235
225
|
await callHook(hooks, "onInstallationStart", snapshot(context));
|
|
236
226
|
try {
|
|
237
227
|
await executeStep(rootStep, context.step, {}, context);
|
|
238
228
|
const succeeded = createSucceededState({
|
|
229
|
+
config: context.config,
|
|
230
|
+
data: context.data,
|
|
239
231
|
id: context.id,
|
|
240
232
|
startedAt: context.startedAt,
|
|
241
|
-
step: context.step
|
|
242
|
-
data: context.data
|
|
233
|
+
step: context.step
|
|
243
234
|
});
|
|
244
235
|
await callHook(hooks, "onInstallationSuccess", succeeded);
|
|
245
236
|
return succeeded;
|
|
246
237
|
} catch (err) {
|
|
247
238
|
const error = context.error ?? await createInstallationError(err, [], "INSTALLATION_FAILED");
|
|
248
239
|
const failed = createFailedState({
|
|
249
|
-
|
|
240
|
+
config: context.config,
|
|
241
|
+
data: context.data,
|
|
250
242
|
id: context.id,
|
|
251
243
|
startedAt: context.startedAt,
|
|
252
|
-
|
|
244
|
+
step: context.step
|
|
253
245
|
}, error);
|
|
254
246
|
await callHook(hooks, "onInstallationFailure", failed);
|
|
255
247
|
return failed;
|
|
@@ -267,22 +259,23 @@ function buildInitialStepStatus(step, config, parentPath, mode) {
|
|
|
267
259
|
children.push(buildInitialStepStatus(child, config, path, mode));
|
|
268
260
|
}
|
|
269
261
|
return {
|
|
262
|
+
children,
|
|
270
263
|
id: crypto.randomUUID(),
|
|
264
|
+
meta: mode === "uninstall" && step.meta.uninstall ? step.meta.uninstall : step.meta.install,
|
|
271
265
|
name: step.name,
|
|
272
266
|
path,
|
|
273
|
-
|
|
274
|
-
status: "pending",
|
|
275
|
-
children
|
|
267
|
+
status: "pending"
|
|
276
268
|
};
|
|
277
269
|
}
|
|
278
270
|
/** Snapshot current execution as InProgressInstallationState. */
|
|
279
271
|
function snapshot(context) {
|
|
280
272
|
return {
|
|
273
|
+
config: context.config,
|
|
274
|
+
data: context.data,
|
|
281
275
|
id: context.id,
|
|
282
276
|
startedAt: context.startedAt,
|
|
283
277
|
status: "in-progress",
|
|
284
|
-
step: context.step
|
|
285
|
-
data: context.data
|
|
278
|
+
step: context.step
|
|
286
279
|
};
|
|
287
280
|
}
|
|
288
281
|
/** Executes a single step (branch or leaf) recursively. */
|
|
@@ -292,9 +285,9 @@ async function executeStep(step, stepStatus, inherited, context) {
|
|
|
292
285
|
const isLeaf = isLeafStep(step);
|
|
293
286
|
stepStatus.status = "in-progress";
|
|
294
287
|
await callHook(context.hooks, "onStepStart", {
|
|
288
|
+
isLeaf,
|
|
295
289
|
path,
|
|
296
|
-
stepName: step.name
|
|
297
|
-
isLeaf
|
|
290
|
+
stepName: step.name
|
|
298
291
|
}, snapshot(context));
|
|
299
292
|
try {
|
|
300
293
|
if (isBranchStep(step)) await executeBranchStep(step, stepStatus, inherited, context);
|
|
@@ -302,19 +295,19 @@ async function executeStep(step, stepStatus, inherited, context) {
|
|
|
302
295
|
stepStatus.status = "succeeded";
|
|
303
296
|
context.data ??= {};
|
|
304
297
|
await callHook(context.hooks, "onStepSuccess", {
|
|
305
|
-
path,
|
|
306
|
-
stepName: step.name,
|
|
307
298
|
isLeaf,
|
|
308
|
-
|
|
299
|
+
path,
|
|
300
|
+
result: getAtPath(context.data, path),
|
|
301
|
+
stepName: step.name
|
|
309
302
|
}, snapshot(context));
|
|
310
303
|
} catch (err) {
|
|
311
304
|
stepStatus.status = "failed";
|
|
312
305
|
context.error ??= await createInstallationError(err, path);
|
|
313
306
|
await callHook(context.hooks, "onStepFailure", {
|
|
314
|
-
|
|
315
|
-
stepName: step.name,
|
|
307
|
+
error: context.error,
|
|
316
308
|
isLeaf,
|
|
317
|
-
|
|
309
|
+
path,
|
|
310
|
+
stepName: step.name
|
|
318
311
|
}, snapshot(context));
|
|
319
312
|
throw err;
|
|
320
313
|
}
|
|
@@ -385,9 +378,9 @@ async function validateStepTree(options) {
|
|
|
385
378
|
const result = await validateStep(rootStep, config, validationContext, []);
|
|
386
379
|
const summary = aggregateSummary(result);
|
|
387
380
|
return {
|
|
388
|
-
valid: summary.errors === 0 && summary.warnings === 0,
|
|
389
381
|
result,
|
|
390
|
-
summary
|
|
382
|
+
summary,
|
|
383
|
+
valid: summary.errors === 0 && summary.warnings === 0
|
|
391
384
|
};
|
|
392
385
|
}
|
|
393
386
|
/** Recursively validates a single step and its children. */
|
|
@@ -404,11 +397,11 @@ async function validateStep(step, config, context, parentPath) {
|
|
|
404
397
|
}
|
|
405
398
|
}
|
|
406
399
|
return {
|
|
407
|
-
|
|
408
|
-
path,
|
|
409
|
-
meta: step.meta.install,
|
|
400
|
+
children,
|
|
410
401
|
issues,
|
|
411
|
-
|
|
402
|
+
meta: step.meta.install,
|
|
403
|
+
name: step.name,
|
|
404
|
+
path
|
|
412
405
|
};
|
|
413
406
|
}
|
|
414
407
|
/** Resolves the child context for a branch step, reporting errors as issues. */
|
|
@@ -454,16 +447,16 @@ async function runStepValidation(step, config, context) {
|
|
|
454
447
|
function aggregateSummary(result) {
|
|
455
448
|
let errors = 0;
|
|
456
449
|
let warnings = 0;
|
|
457
|
-
for (const issue of result.issues) if (issue.severity === "error") errors
|
|
458
|
-
else if (issue.severity === "warning") warnings
|
|
450
|
+
for (const issue of result.issues) if (issue.severity === "error") errors += 1;
|
|
451
|
+
else if (issue.severity === "warning") warnings += 1;
|
|
459
452
|
for (const child of result.children) {
|
|
460
453
|
const childSummary = aggregateSummary(child);
|
|
461
454
|
errors += childSummary.errors;
|
|
462
455
|
warnings += childSummary.warnings;
|
|
463
456
|
}
|
|
464
457
|
return {
|
|
465
|
-
totalIssues: errors + warnings,
|
|
466
458
|
errors,
|
|
459
|
+
totalIssues: errors + warnings,
|
|
467
460
|
warnings
|
|
468
461
|
};
|
|
469
462
|
}
|
|
@@ -490,10 +483,11 @@ function assertScriptModule(module) {
|
|
|
490
483
|
*
|
|
491
484
|
* @param customScripts - The customScripts context containing the loaded modules
|
|
492
485
|
* @param script - The script path to resolve the module for
|
|
486
|
+
* @returns The resolved script module, or `undefined` if the script is not present in the context.
|
|
493
487
|
*/
|
|
494
488
|
function getScriptModule(customScripts, script) {
|
|
495
489
|
let scriptModule = customScripts[script];
|
|
496
|
-
if (!scriptModule)
|
|
490
|
+
if (!scriptModule) return;
|
|
497
491
|
if (typeof scriptModule === "object" && "default" in scriptModule) scriptModule = scriptModule.default;
|
|
498
492
|
assertScriptModule(scriptModule);
|
|
499
493
|
return scriptModule;
|
|
@@ -509,28 +503,35 @@ function resolveCustomScriptHandler(scriptModule, handler) {
|
|
|
509
503
|
function createCustomScriptStep(scriptConfig) {
|
|
510
504
|
const { script, name, description } = scriptConfig;
|
|
511
505
|
return defineLeafStep({
|
|
512
|
-
name: camelcase(name),
|
|
513
|
-
meta: { install: {
|
|
514
|
-
label: name,
|
|
515
|
-
description
|
|
516
|
-
} },
|
|
517
506
|
install: async (config, context) => {
|
|
518
507
|
const { logger } = context;
|
|
519
508
|
const customScripts = context.customScripts || {};
|
|
520
509
|
logger.info(`Executing custom installation script: ${name}`);
|
|
521
510
|
logger.debug(`Script path: ${script}`);
|
|
522
|
-
const
|
|
511
|
+
const scriptModule = getScriptModule(customScripts, script);
|
|
512
|
+
if (!scriptModule) throw new Error(`Script ${script} not found in customScripts context. Make sure the script is defined in the configuration and the action was generated with custom scripts support.`);
|
|
513
|
+
const scriptResult = await resolveCustomScriptHandler(scriptModule, "install")(config, context);
|
|
523
514
|
logger.info(`Successfully executed script: ${name}`);
|
|
524
515
|
return {
|
|
525
|
-
|
|
526
|
-
|
|
516
|
+
data: scriptResult,
|
|
517
|
+
script
|
|
527
518
|
};
|
|
528
519
|
},
|
|
520
|
+
meta: { install: {
|
|
521
|
+
description,
|
|
522
|
+
label: name
|
|
523
|
+
} },
|
|
524
|
+
name: camelcase(name),
|
|
529
525
|
uninstall: async (config, context) => {
|
|
530
526
|
const { logger } = context;
|
|
531
527
|
const customScripts = context.customScripts || {};
|
|
532
528
|
logger.debug(`Uninstalling custom script: ${name}`);
|
|
533
|
-
const
|
|
529
|
+
const scriptModule = getScriptModule(customScripts, script);
|
|
530
|
+
if (!scriptModule) {
|
|
531
|
+
logger.warn(`Script ${script} not found in customScripts context, skipping uninstall. It may have been removed from the project after being configured.`);
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const uninstall = resolveCustomScriptHandler(scriptModule, "uninstall");
|
|
534
535
|
if (!uninstall) {
|
|
535
536
|
logger.debug(`Script ${script} does not export an uninstall function, skipping uninstall.`);
|
|
536
537
|
return;
|
|
@@ -555,19 +556,19 @@ function createCustomScriptSteps(config) {
|
|
|
555
556
|
//#region source/management/installation/custom-installation/branch.ts
|
|
556
557
|
/** Root custom installation step that executes custom installation scripts. */
|
|
557
558
|
const customInstallationStepBase = defineBranchStep({
|
|
558
|
-
|
|
559
|
+
children: [],
|
|
559
560
|
meta: {
|
|
560
561
|
install: {
|
|
561
|
-
|
|
562
|
-
|
|
562
|
+
description: "Executes custom installation scripts defined in the application configuration",
|
|
563
|
+
label: "Custom Installation Steps"
|
|
563
564
|
},
|
|
564
565
|
uninstall: {
|
|
565
|
-
|
|
566
|
-
|
|
566
|
+
description: "Executes custom uninstallation scripts defined in the application configuration",
|
|
567
|
+
label: "Custom Uninstallation Steps"
|
|
567
568
|
}
|
|
568
569
|
},
|
|
569
|
-
|
|
570
|
-
|
|
570
|
+
name: "customInstallationSteps",
|
|
571
|
+
when: hasCustomInstallationSteps
|
|
571
572
|
});
|
|
572
573
|
/**
|
|
573
574
|
* Creates the custom installation step with dynamic children based on config.
|
|
@@ -633,370 +634,127 @@ async function throwHttpError(logger, error, prefix) {
|
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
//#endregion
|
|
636
|
-
//#region source/management/installation/admin-ui
|
|
637
|
+
//#region source/management/installation/admin-ui/helpers.ts
|
|
638
|
+
/**
|
|
639
|
+
* Enables the Admin UI SDK in Commerce via PUT /V1/adminuisdk/config.
|
|
640
|
+
* Must run before {@link registerExtension} so Commerce accepts the extension.
|
|
641
|
+
*
|
|
642
|
+
* @param context - The execution context providing the Admin UI client and logger.
|
|
643
|
+
*/
|
|
644
|
+
async function enableAdminUiSdk(context) {
|
|
645
|
+
const { adminUiClient, logger } = context;
|
|
646
|
+
logger.info("Enabling Admin UI SDK in Adobe Commerce...");
|
|
647
|
+
await adminUiClient.enableAdminUiSdk().catch((error) => throwHttpError(logger, error, "Failed to enable Admin UI SDK"));
|
|
648
|
+
logger.info("Admin UI SDK enabled successfully.");
|
|
649
|
+
}
|
|
637
650
|
/**
|
|
638
651
|
* Registers the extension with Commerce via POST /V1/adminuisdk/extension.
|
|
639
652
|
*
|
|
640
|
-
* @param context - The execution context providing the Admin UI
|
|
653
|
+
* @param context - The execution context providing the Admin UI client and logger.
|
|
641
654
|
*/
|
|
642
655
|
async function registerExtension(context) {
|
|
643
656
|
const { adminUiClient, appData, logger } = context;
|
|
644
657
|
const extensionName = process.env.__OW_NAMESPACE;
|
|
645
658
|
if (!extensionName) throw new Error("__OW_NAMESPACE environment variable is not set");
|
|
646
|
-
logger.info(`Registering Admin UI
|
|
659
|
+
logger.info(`Registering Admin UI extension: ${appData.projectName}`);
|
|
647
660
|
const { extensionId } = await adminUiClient.registerExtension({
|
|
648
661
|
extensionName,
|
|
649
662
|
extensionTitle: appData.projectTitle,
|
|
650
|
-
extensionUrl: `https://${extensionName}.adobeio-static.net/index.html`,
|
|
651
663
|
extensionWorkspace: appData.workspaceName
|
|
652
|
-
}).catch((error) => throwHttpError(logger, error, "Failed to register Admin UI
|
|
653
|
-
logger.info(`Admin UI
|
|
664
|
+
}).catch((error) => throwHttpError(logger, error, "Failed to register Admin UI extension"));
|
|
665
|
+
logger.info(`Admin UI extension registered successfully: ${extensionId}`);
|
|
654
666
|
}
|
|
655
667
|
/**
|
|
656
668
|
* Unregisters the extension from Commerce via DELETE /V1/adminuisdk/extension/:workspace_name/:extension_name.
|
|
657
669
|
* Best-effort: errors are logged as warnings and do not stop the uninstall workflow.
|
|
658
670
|
*
|
|
659
|
-
* @param context - The execution context providing the Admin UI
|
|
671
|
+
* @param context - The execution context providing the Admin UI client and logger.
|
|
660
672
|
*/
|
|
661
673
|
async function unregisterExtension(context) {
|
|
662
674
|
const { adminUiClient, appData, logger } = context;
|
|
663
675
|
const extensionName = process.env.__OW_NAMESPACE;
|
|
664
676
|
if (!extensionName) {
|
|
665
|
-
logger.warn("__OW_NAMESPACE environment variable is not set; skipping Admin UI
|
|
677
|
+
logger.warn("__OW_NAMESPACE environment variable is not set; skipping Admin UI extension unregistration. Continuing uninstall.");
|
|
666
678
|
return;
|
|
667
679
|
}
|
|
668
|
-
logger.info(`Unregistering Admin UI
|
|
680
|
+
logger.info(`Unregistering Admin UI extension "${extensionName}" from workspace "${appData.workspaceName}"...`);
|
|
669
681
|
try {
|
|
670
682
|
await adminUiClient.unregisterExtension({
|
|
671
|
-
|
|
672
|
-
|
|
683
|
+
extensionName,
|
|
684
|
+
workspaceName: appData.workspaceName
|
|
673
685
|
});
|
|
674
|
-
logger.info(`Admin UI
|
|
686
|
+
logger.info(`Admin UI extension "${extensionName}" unregistered successfully.`);
|
|
675
687
|
} catch (error) {
|
|
676
688
|
const msg = await unwrapHttpError(error);
|
|
677
|
-
logger.warn(`Failed to unregister Admin UI
|
|
689
|
+
logger.warn(`Failed to unregister Admin UI extension "${extensionName}": ${msg}. Continuing uninstall.`);
|
|
678
690
|
}
|
|
679
691
|
}
|
|
680
692
|
|
|
681
693
|
//#endregion
|
|
682
|
-
//#region source/management/installation/admin-ui
|
|
694
|
+
//#region source/management/installation/admin-ui/utils.ts
|
|
683
695
|
function createAdminUiClient(params) {
|
|
684
696
|
return createAdminUiApiClient(resolveCommerceHttpClientParams(params, { tryForwardAuthProvider: true }));
|
|
685
697
|
}
|
|
686
|
-
/** Creates the Admin UI
|
|
687
|
-
const
|
|
698
|
+
/** Creates the Admin UI step context with a lazy-initialized API client. */
|
|
699
|
+
const createAdminUiStepContext = (installation) => {
|
|
688
700
|
const { params } = installation;
|
|
689
701
|
let adminUiClient = null;
|
|
690
702
|
return { get adminUiClient() {
|
|
691
|
-
|
|
703
|
+
adminUiClient ??= createAdminUiClient(params);
|
|
692
704
|
return adminUiClient;
|
|
693
705
|
} };
|
|
694
706
|
};
|
|
695
707
|
|
|
696
708
|
//#endregion
|
|
697
|
-
//#region source/management/installation/admin-ui
|
|
709
|
+
//#region source/management/installation/admin-ui/branch.ts
|
|
710
|
+
/**
|
|
711
|
+
* Leaf step that enables the Admin UI SDK (PUT) on install. Runs before
|
|
712
|
+
* {@link registerExtensionStep} so Commerce accepts the extension registration.
|
|
713
|
+
* Install-only: enabling the SDK is not reverted on uninstall since other
|
|
714
|
+
* extensions may still rely on it.
|
|
715
|
+
*/
|
|
716
|
+
const enableAdminUiSdkStep = defineLeafStep({
|
|
717
|
+
install: (_, context) => enableAdminUiSdk(context),
|
|
718
|
+
meta: { install: {
|
|
719
|
+
description: "Enables the Admin UI SDK in Adobe Commerce",
|
|
720
|
+
label: "Enable Admin UI SDK"
|
|
721
|
+
} },
|
|
722
|
+
name: "enable-admin-ui-sdk"
|
|
723
|
+
});
|
|
698
724
|
/** Leaf step that registers the extension (POST) on install and unregisters it (DELETE) on uninstall. */
|
|
699
725
|
const registerExtensionStep = defineLeafStep({
|
|
700
|
-
|
|
726
|
+
install: (_, context) => registerExtension(context),
|
|
701
727
|
meta: {
|
|
702
728
|
install: {
|
|
703
|
-
|
|
704
|
-
|
|
729
|
+
description: "Registers the Admin UI extension in Adobe Commerce",
|
|
730
|
+
label: "Register Extension"
|
|
705
731
|
},
|
|
706
732
|
uninstall: {
|
|
707
|
-
|
|
708
|
-
|
|
733
|
+
description: "Removes the Admin UI extension from Adobe Commerce",
|
|
734
|
+
label: "Unregister Extension"
|
|
709
735
|
}
|
|
710
736
|
},
|
|
711
|
-
|
|
737
|
+
name: "register-extension",
|
|
712
738
|
uninstall: (_, context) => unregisterExtension(context)
|
|
713
739
|
});
|
|
714
|
-
/** Branch step for setting up the Admin UI
|
|
715
|
-
const
|
|
716
|
-
|
|
740
|
+
/** Branch step for setting up the Admin UI extension registration. */
|
|
741
|
+
const adminUiStep = defineBranchStep({
|
|
742
|
+
children: [enableAdminUiSdkStep, registerExtensionStep],
|
|
743
|
+
context: createAdminUiStepContext,
|
|
717
744
|
meta: {
|
|
718
745
|
install: {
|
|
719
|
-
|
|
720
|
-
|
|
746
|
+
description: "Registers the extension with Adobe Commerce Admin UI",
|
|
747
|
+
label: "Admin UI"
|
|
721
748
|
},
|
|
722
749
|
uninstall: {
|
|
723
|
-
|
|
724
|
-
|
|
750
|
+
description: "Removes the extension from Adobe Commerce Admin UI",
|
|
751
|
+
label: "Admin UI"
|
|
725
752
|
}
|
|
726
753
|
},
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
children: [registerExtensionStep]
|
|
754
|
+
name: "admin-ui",
|
|
755
|
+
when: hasAdminUi
|
|
730
756
|
});
|
|
731
757
|
|
|
732
|
-
//#endregion
|
|
733
|
-
//#region source/management/installation/events/utils.ts
|
|
734
|
-
const COMMERCE_PROVIDER_TYPE = "dx_commerce_events";
|
|
735
|
-
const EXTERNAL_PROVIDER_TYPE = "3rd_party_custom_events";
|
|
736
|
-
const PROVIDER_TYPE_TO_LABEL = {
|
|
737
|
-
[COMMERCE_PROVIDER_TYPE]: "Commerce",
|
|
738
|
-
[EXTERNAL_PROVIDER_TYPE]: "External"
|
|
739
|
-
};
|
|
740
|
-
/** Max characters taken from `metadata.id` in the I/O Events provider `instance_id`. */
|
|
741
|
-
const METADATA_ID_MAX_LENGTH_FOR_INSTANCE_ID = 100;
|
|
742
|
-
/**
|
|
743
|
-
* Generates a unique instance ID for I/O Events for this app deployment.
|
|
744
|
-
* Uses `{metadata.id (first 100 chars)}-{providerKeyOrSlug}-{workspaceId}` (lowercased).
|
|
745
|
-
*
|
|
746
|
-
* @param metadata - The metadata of the application
|
|
747
|
-
* @param provider - The event provider (optional `key`, else label is slugified)
|
|
748
|
-
* @param workspaceId - Adobe I/O Developer Console workspace ID for this deployment
|
|
749
|
-
*/
|
|
750
|
-
function generateInstanceId(metadata, provider, workspaceId) {
|
|
751
|
-
const appId = metadata.id.slice(0, METADATA_ID_MAX_LENGTH_FOR_INSTANCE_ID);
|
|
752
|
-
const slugLabel = provider.label.toLowerCase().replace(/\s+/g, "-");
|
|
753
|
-
return `${appId}-${provider.key ?? slugLabel}-${workspaceId}`.toLowerCase();
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Old version of instanceId generator which can be not unique within the same ORG.
|
|
757
|
-
*
|
|
758
|
-
* @param metadata - The metadata of the application
|
|
759
|
-
* @param provider - The event provider for which to generate the instance ID
|
|
760
|
-
* @deprecated use {@link generateInstanceId} instead
|
|
761
|
-
*/
|
|
762
|
-
function generateInstanceIdDeprecated(metadata, provider) {
|
|
763
|
-
const slugLabel = provider.label.toLowerCase().replace(/\s+/g, "-");
|
|
764
|
-
return `${metadata.id}-${provider.key ?? slugLabel}`.toLowerCase();
|
|
765
|
-
}
|
|
766
|
-
/**
|
|
767
|
-
* Find an existing event provider by its instance ID.
|
|
768
|
-
* @param allProviders - The list of all existing event providers.
|
|
769
|
-
* @param instanceId - The instance ID to search for.
|
|
770
|
-
*/
|
|
771
|
-
function findExistingProvider(allProviders, instanceId) {
|
|
772
|
-
return allProviders.find((provider) => provider.instance_id === instanceId) ?? null;
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Find existing event metadata by its event name.
|
|
776
|
-
* @param allMetadata - The list of all existing event metadata.
|
|
777
|
-
* @param eventName - The event name to search for.
|
|
778
|
-
*/
|
|
779
|
-
function findExistingProviderMetadata(allMetadata, eventName) {
|
|
780
|
-
return allMetadata.find((meta) => meta.event_code === eventName) ?? null;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* Find existing event registrations by client ID and name.
|
|
784
|
-
* @param allRegistrations - The list of all existing event registrations.
|
|
785
|
-
* @param clientId - The client ID of the workspace where the registration was created.
|
|
786
|
-
* @param name - The name of the registration to search for.
|
|
787
|
-
*/
|
|
788
|
-
function findExistingRegistrations(allRegistrations, clientId, name) {
|
|
789
|
-
return allRegistrations.find((reg) => reg.client_id === clientId && reg.name === name);
|
|
790
|
-
}
|
|
791
|
-
/**
|
|
792
|
-
* Generates a namespaced event name by combining the application ID with the event name.
|
|
793
|
-
* @param metadata
|
|
794
|
-
* @param name
|
|
795
|
-
*/
|
|
796
|
-
function getNamespacedEvent(metadata, name) {
|
|
797
|
-
return `${metadata.id}.${name}`.toLowerCase();
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Get the fully qualified name of an event for I/O Events based on the provider type.
|
|
801
|
-
* @param name - The name of the event.
|
|
802
|
-
* @param providerType - The type of the event provider.
|
|
803
|
-
*/
|
|
804
|
-
function getIoEventCode(name, providerType) {
|
|
805
|
-
return providerType === "dx_commerce_events" ? `com.adobe.commerce.${name}` : name;
|
|
806
|
-
}
|
|
807
|
-
/** Maps a provider's metadata type to its human-readable label ("Commerce" or "External"). */
|
|
808
|
-
function getProviderTypeLabel(provider) {
|
|
809
|
-
return PROVIDER_TYPE_TO_LABEL[provider.provider_metadata];
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Generates a registration name based on the provider type, provider label, and runtime action.
|
|
813
|
-
*
|
|
814
|
-
* Prefixes with the provider type label ("Commerce" or "External") for readability, then the
|
|
815
|
-
* provider's own label to ensure uniqueness when multiple providers of the same type route
|
|
816
|
-
* events to the same runtime action.
|
|
817
|
-
*
|
|
818
|
-
* @param provider - The provider this registration is associated to.
|
|
819
|
-
* @param runtimeAction - The runtime action this registration points to.
|
|
820
|
-
*/
|
|
821
|
-
function getRegistrationName(provider, runtimeAction) {
|
|
822
|
-
const [packageName, actionName] = runtimeAction.split("/").map(kebabToTitleCase);
|
|
823
|
-
return `${getProviderTypeLabel(provider)} Event Registration: ${provider.label} - ${actionName} (${packageName})`;
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Returns the registration name in the legacy format used by SDK versions that built
|
|
827
|
-
* the name from the generic provider type label ("Commerce" / "External") rather than
|
|
828
|
-
* the provider's own label. Used during uninstall to match registrations that were
|
|
829
|
-
* created before the naming change.
|
|
830
|
-
*
|
|
831
|
-
* @param provider - The provider this registration is associated to.
|
|
832
|
-
* @param runtimeAction - The runtime action this registration points to.
|
|
833
|
-
* @deprecated Use {@link getRegistrationName} for all new registrations.
|
|
834
|
-
*/
|
|
835
|
-
function getLegacyRegistrationName(provider, runtimeAction) {
|
|
836
|
-
const [packageName, actionName] = runtimeAction.split("/").map(kebabToTitleCase);
|
|
837
|
-
return `${getProviderTypeLabel(provider)} Event Registration: ${actionName} (${packageName})`;
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Generates a registration name and description based on the provider, events, and runtime action.
|
|
841
|
-
* @param provider - The provider this registration is associated to.
|
|
842
|
-
* @param events - The events routed by this registration.
|
|
843
|
-
* @param runtimeAction - The runtime action this registration points to.
|
|
844
|
-
*/
|
|
845
|
-
function getRegistrationDescription(provider, events, runtimeAction) {
|
|
846
|
-
return [
|
|
847
|
-
"This registration was automatically created by @adobe/aio-commerce-lib-app. ",
|
|
848
|
-
`It belongs to the provider "${provider.label}" (instance ID: ${provider.instance_id}). `,
|
|
849
|
-
`It routes ${events.length} event(s) to the runtime action "${runtimeAction}".`
|
|
850
|
-
].join("\n");
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* Converts a kebab-case string to Title Case.
|
|
854
|
-
* @param str - The kebab-case string to convert.
|
|
855
|
-
*/
|
|
856
|
-
function kebabToTitleCase(str) {
|
|
857
|
-
return str.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Groups events by their runtime actions. Since each event can have multiple
|
|
861
|
-
* runtime actions, this function creates a mapping where each unique runtime
|
|
862
|
-
* action points to all events that target it.
|
|
863
|
-
*
|
|
864
|
-
* @param events - The events to group by runtime actions.
|
|
865
|
-
*/
|
|
866
|
-
function groupEventsByRuntimeActions(events) {
|
|
867
|
-
const actionEventsMap = /* @__PURE__ */ new Map();
|
|
868
|
-
for (const event of events) for (const runtimeAction of event.runtimeActions) {
|
|
869
|
-
const existingEvents = actionEventsMap.get(runtimeAction) ?? [];
|
|
870
|
-
actionEventsMap.set(runtimeAction, [...existingEvents, event]);
|
|
871
|
-
}
|
|
872
|
-
return actionEventsMap;
|
|
873
|
-
}
|
|
874
|
-
function findExistingSubscription(allSubscriptions, eventName) {
|
|
875
|
-
return allSubscriptions.get(eventName) ?? null;
|
|
876
|
-
}
|
|
877
|
-
/**
|
|
878
|
-
* Builds the payload to send to Commerce when configuring Eventing.
|
|
879
|
-
* Returns `null` when no update call is needed.
|
|
880
|
-
*
|
|
881
|
-
* @param initialParams - Initial Commerce Eventing configuration parameters.
|
|
882
|
-
* @param existingData - Existing Commerce Eventing state from the API.
|
|
883
|
-
*/
|
|
884
|
-
function getCommerceEventingConfigurationUpdateParams(initialParams, existingData) {
|
|
885
|
-
const { isDefaultProviderConfigured, isDefaultWorkspaceConfigurationEmpty } = existingData;
|
|
886
|
-
if (isDefaultProviderConfigured && !isDefaultWorkspaceConfigurationEmpty) return null;
|
|
887
|
-
const { workspace_configuration, ...configWithoutWorkspace } = initialParams;
|
|
888
|
-
let updateParams = { enabled: true };
|
|
889
|
-
if (isDefaultWorkspaceConfigurationEmpty) {
|
|
890
|
-
if (!workspace_configuration) throw new Error("Workspace configuration is required to enable Commerce Eventing when there is not an existing one.");
|
|
891
|
-
updateParams.workspace_configuration = workspace_configuration;
|
|
892
|
-
}
|
|
893
|
-
if (!isDefaultProviderConfigured) updateParams = {
|
|
894
|
-
...updateParams,
|
|
895
|
-
...configWithoutWorkspace
|
|
896
|
-
};
|
|
897
|
-
return updateParams;
|
|
898
|
-
}
|
|
899
|
-
/**
|
|
900
|
-
* Sanitizes a Commerce Eventing identifier.
|
|
901
|
-
* Preserves underscores, converts spaces to underscores, lowercases, and strips the rest.
|
|
902
|
-
*
|
|
903
|
-
* @param value - The raw identifier value to normalize.
|
|
904
|
-
*/
|
|
905
|
-
function sanitizeEventingIdentifier(value) {
|
|
906
|
-
return value.toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, "");
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* Creates a partially filled workspace configuration object based on the app credentials and parameters.
|
|
910
|
-
* This configuration is used when creating an event provider in Commerce.
|
|
911
|
-
*
|
|
912
|
-
* @param context - The execution context containing app credentials and parameters.
|
|
913
|
-
*/
|
|
914
|
-
function makeWorkspaceConfig(context) {
|
|
915
|
-
const { appData, params } = context;
|
|
916
|
-
const { consumerOrgId, orgName, projectId, projectName, projectTitle, workspaceId, workspaceName, workspaceTitle } = appData;
|
|
917
|
-
const authParams = resolveAuthParams(params);
|
|
918
|
-
if (authParams.strategy !== "ims") throw new Error("Failed to resolve IMS authentication parameters from the runtime action inputs.");
|
|
919
|
-
const { clientId, clientSecrets, technicalAccountEmail, technicalAccountId, imsOrgId, scopes } = authParams;
|
|
920
|
-
return { project: {
|
|
921
|
-
id: projectId,
|
|
922
|
-
name: projectName,
|
|
923
|
-
title: projectTitle,
|
|
924
|
-
org: {
|
|
925
|
-
id: consumerOrgId,
|
|
926
|
-
name: orgName,
|
|
927
|
-
ims_org_id: imsOrgId
|
|
928
|
-
},
|
|
929
|
-
workspace: {
|
|
930
|
-
id: workspaceId,
|
|
931
|
-
name: workspaceName,
|
|
932
|
-
title: workspaceTitle,
|
|
933
|
-
action_url: `https://${process.env.__OW_NAMESPACE}.adobeioruntime.net`,
|
|
934
|
-
app_url: `https://${process.env.__OW_NAMESPACE}.adobeio-static.net`,
|
|
935
|
-
details: { credentials: [{
|
|
936
|
-
id: "000000",
|
|
937
|
-
name: `aio-${workspaceId}`,
|
|
938
|
-
integration_type: "oauth_server_to_server",
|
|
939
|
-
oauth_server_to_server: {
|
|
940
|
-
client_id: clientId,
|
|
941
|
-
client_secrets: clientSecrets,
|
|
942
|
-
technical_account_email: technicalAccountEmail,
|
|
943
|
-
technical_account_id: technicalAccountId,
|
|
944
|
-
scopes: scopes.map((scope) => scope.trim())
|
|
945
|
-
}
|
|
946
|
-
}] }
|
|
947
|
-
}
|
|
948
|
-
} };
|
|
949
|
-
}
|
|
950
|
-
/**
|
|
951
|
-
* Retrieves the current existing data and returns it in a normalized way.
|
|
952
|
-
* @param context The execution context.
|
|
953
|
-
*/
|
|
954
|
-
async function getIoEventsExistingData(context) {
|
|
955
|
-
const { ioEventsClient, appData } = context;
|
|
956
|
-
const appCredentials = {
|
|
957
|
-
consumerOrgId: appData.consumerOrgId,
|
|
958
|
-
projectId: appData.projectId,
|
|
959
|
-
workspaceId: appData.workspaceId
|
|
960
|
-
};
|
|
961
|
-
const { _embedded: { providers: existingProviders } } = await ioEventsClient.getAllEventProviders({
|
|
962
|
-
consumerOrgId: appData.consumerOrgId,
|
|
963
|
-
withEventMetadata: true
|
|
964
|
-
});
|
|
965
|
-
const providersWithMetadata = existingProviders.map((providerHal) => {
|
|
966
|
-
const { _embedded, _links, ...providerData } = providerHal;
|
|
967
|
-
const actualMetadata = (_embedded?.eventmetadata ?? []).map(({ _embedded, _links, ...meta }) => ({
|
|
968
|
-
...meta,
|
|
969
|
-
sample: _embedded?.sample_event ?? null
|
|
970
|
-
}));
|
|
971
|
-
return {
|
|
972
|
-
...providerData,
|
|
973
|
-
metadata: actualMetadata
|
|
974
|
-
};
|
|
975
|
-
});
|
|
976
|
-
const { _embedded: { registrations: registrationsHal } } = await ioEventsClient.getAllRegistrations(appCredentials);
|
|
977
|
-
return {
|
|
978
|
-
providersWithMetadata,
|
|
979
|
-
registrations: registrationsHal.map(({ _links, ...reg }) => reg)
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
|
-
/**
|
|
983
|
-
* Retrieves the current existing Commerce eventing data and returns it in a normalized way.
|
|
984
|
-
* @param context - The execution context.
|
|
985
|
-
*/
|
|
986
|
-
async function getCommerceEventingExistingData(context) {
|
|
987
|
-
const { commerceEventsClient } = context;
|
|
988
|
-
const existingProviders = await commerceEventsClient.getAllEventProviders();
|
|
989
|
-
const existingSubscriptions = await commerceEventsClient.getAllEventSubscriptions();
|
|
990
|
-
const defaultProvider = existingProviders.find((provider) => !("id" in provider)) ?? null;
|
|
991
|
-
const isDefaultProviderConfigured = defaultProvider !== null;
|
|
992
|
-
return {
|
|
993
|
-
isDefaultProviderConfigured,
|
|
994
|
-
isDefaultWorkspaceConfigurationEmpty: isDefaultProviderConfigured ? !defaultProvider.workspace_configuration?.trim() : true,
|
|
995
|
-
providers: existingProviders,
|
|
996
|
-
subscriptions: new Map(existingSubscriptions.map((subscription) => [subscription.name, subscription]))
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
758
|
//#endregion
|
|
1001
759
|
//#region source/management/installation/events/helpers.ts
|
|
1002
760
|
/**
|
|
@@ -1014,10 +772,10 @@ async function createIoEventProvider(params) {
|
|
|
1014
772
|
logger.info(`Creating provider "${provider.label}" with instance ID "${provider.instanceId}"`);
|
|
1015
773
|
return ioEventsClient.createEventProvider({
|
|
1016
774
|
...appCredentials,
|
|
1017
|
-
|
|
1018
|
-
providerType: provider.type,
|
|
775
|
+
description: provider.description,
|
|
1019
776
|
instanceId: provider.instanceId,
|
|
1020
|
-
|
|
777
|
+
label: provider.label,
|
|
778
|
+
providerType: provider.type
|
|
1021
779
|
}).then((res) => {
|
|
1022
780
|
logger.info(`Provider "${provider.label}" created with ID '${res.id}'`);
|
|
1023
781
|
return res;
|
|
@@ -1061,10 +819,10 @@ async function createIoEventProviderEventMetadata(params) {
|
|
|
1061
819
|
logger.info(`Creating event metadata (${eventCode}) for provider "${provider.label}" (instance ID: ${provider.instance_id}))`);
|
|
1062
820
|
return ioEventsClient.createEventMetadataForProvider({
|
|
1063
821
|
...appCredentials,
|
|
1064
|
-
providerId: provider.id,
|
|
1065
|
-
label: event.label,
|
|
1066
822
|
description: event.description,
|
|
1067
|
-
eventCode
|
|
823
|
+
eventCode,
|
|
824
|
+
label: event.label,
|
|
825
|
+
providerId: provider.id
|
|
1068
826
|
}).then((res) => {
|
|
1069
827
|
logger.info(`Event metadata "${event.label}" created for provider "${provider.label}"`);
|
|
1070
828
|
return res;
|
|
@@ -1102,16 +860,16 @@ async function createIoEventRegistration(params) {
|
|
|
1102
860
|
const description = getRegistrationDescription(provider, events, runtimeAction);
|
|
1103
861
|
const payload = {
|
|
1104
862
|
...appCredentials,
|
|
1105
|
-
name,
|
|
1106
863
|
clientId: runtimeParams.AIO_COMMERCE_AUTH_IMS_CLIENT_ID,
|
|
1107
|
-
description,
|
|
1108
864
|
deliveryType: "webhook",
|
|
1109
|
-
|
|
865
|
+
description,
|
|
1110
866
|
enabled: true,
|
|
1111
867
|
eventsOfInterest: events.map((event) => ({
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
}))
|
|
868
|
+
eventCode: getIoEventCode(getNamespacedEvent(metadata, event.name), provider.provider_metadata),
|
|
869
|
+
providerId: provider.id
|
|
870
|
+
})),
|
|
871
|
+
name,
|
|
872
|
+
runtimeAction
|
|
1115
873
|
};
|
|
1116
874
|
return ioEventsClient.createRegistration(payload).then((res) => {
|
|
1117
875
|
logger.info(`Registration "${name}" created for provider "${provider.label}" with ID '${res.id}'`);
|
|
@@ -1206,15 +964,15 @@ async function createCommerceEventSubscription(params) {
|
|
|
1206
964
|
const eventName = getNamespacedEvent(metadata, event.config.name);
|
|
1207
965
|
logger.info(`Creating event subscription for event "${event.config.name}" to provider "${provider.label}" (instance ID: ${provider.instance_id})`);
|
|
1208
966
|
const eventSpec = {
|
|
1209
|
-
name: eventName,
|
|
1210
|
-
parent: event.config.name,
|
|
1211
|
-
fields: event.config.fields,
|
|
1212
|
-
rules: event.config.rules,
|
|
1213
|
-
provider_id: provider.id,
|
|
1214
967
|
destination: event.config.destination,
|
|
968
|
+
fields: event.config.fields,
|
|
969
|
+
force: event.config.force,
|
|
1215
970
|
hipaa_audit_required: event.config.hipaa_audit_required,
|
|
971
|
+
name: eventName,
|
|
972
|
+
parent: event.config.name,
|
|
1216
973
|
priority: event.config.priority,
|
|
1217
|
-
|
|
974
|
+
provider_id: provider.id,
|
|
975
|
+
rules: event.config.rules
|
|
1218
976
|
};
|
|
1219
977
|
logger.debug(`Event subscription specification for event "${event.config.name}": ${inspect(eventSpec)}`);
|
|
1220
978
|
return commerceEventsClient.createEventSubscription(eventSpec).then((_res) => {
|
|
@@ -1257,26 +1015,26 @@ async function onboardIoEvents(params, existingData) {
|
|
|
1257
1015
|
}
|
|
1258
1016
|
}, providersWithMetadata);
|
|
1259
1017
|
const metadataPromises = events.map((event) => createOrGetIoProviderEventMetadata({
|
|
1260
|
-
metadata,
|
|
1261
1018
|
context,
|
|
1262
|
-
|
|
1019
|
+
event,
|
|
1020
|
+
metadata,
|
|
1263
1021
|
provider: providerData,
|
|
1264
|
-
|
|
1022
|
+
type: providerType
|
|
1265
1023
|
}, providersWithMetadata.find((p) => p.id === providerData.id)?.metadata ?? []));
|
|
1266
1024
|
const actionEventsMap = groupEventsByRuntimeActions(events);
|
|
1267
1025
|
const registrationPromises = Array.from(actionEventsMap.entries()).map(([runtimeAction, groupedEvents]) => createOrGetIoEventRegistration({
|
|
1268
|
-
metadata,
|
|
1269
1026
|
context,
|
|
1270
1027
|
events: groupedEvents,
|
|
1028
|
+
metadata,
|
|
1271
1029
|
provider: providerData,
|
|
1272
1030
|
runtimeAction
|
|
1273
1031
|
}, registrations));
|
|
1274
1032
|
const [metadataData, registrationsData] = await Promise.all([Promise.all(metadataPromises), Promise.all(registrationPromises)]);
|
|
1275
1033
|
return {
|
|
1276
|
-
providerData,
|
|
1277
1034
|
eventsData: events.map((event, index) => {
|
|
1278
1035
|
const eventRegistrations = event.runtimeActions.map((runtimeAction) => {
|
|
1279
|
-
|
|
1036
|
+
const registrationIndex = Array.from(actionEventsMap.keys()).indexOf(runtimeAction);
|
|
1037
|
+
return registrationsData[registrationIndex];
|
|
1280
1038
|
});
|
|
1281
1039
|
return {
|
|
1282
1040
|
config: {
|
|
@@ -1288,7 +1046,8 @@ async function onboardIoEvents(params, existingData) {
|
|
|
1288
1046
|
registrations: eventRegistrations
|
|
1289
1047
|
}
|
|
1290
1048
|
};
|
|
1291
|
-
})
|
|
1049
|
+
}),
|
|
1050
|
+
providerData
|
|
1292
1051
|
};
|
|
1293
1052
|
}
|
|
1294
1053
|
/**
|
|
@@ -1299,26 +1058,24 @@ async function onboardCommerceEventing(params, existingData) {
|
|
|
1299
1058
|
const { context, metadata, ioData } = params;
|
|
1300
1059
|
const { events, provider, workspaceConfiguration } = ioData;
|
|
1301
1060
|
const instanceId = provider.instance_id;
|
|
1302
|
-
const subscriptions = [];
|
|
1303
1061
|
const { workspace_configuration: _, ...commerceProviderData } = await createOrGetCommerceProvider({
|
|
1304
1062
|
context,
|
|
1305
1063
|
provider: {
|
|
1064
|
+
description: provider.description,
|
|
1306
1065
|
id: provider.id,
|
|
1307
1066
|
instance_id: instanceId,
|
|
1308
1067
|
label: provider.label,
|
|
1309
|
-
description: provider.description,
|
|
1310
1068
|
workspace_configuration: workspaceConfiguration
|
|
1311
1069
|
}
|
|
1312
1070
|
}, existingData.providers);
|
|
1313
|
-
for (const event of events) subscriptions.push(await createOrGetCommerceEventSubscription({
|
|
1314
|
-
context,
|
|
1315
|
-
metadata,
|
|
1316
|
-
provider,
|
|
1317
|
-
event
|
|
1318
|
-
}, existingData.subscriptions));
|
|
1319
1071
|
return {
|
|
1320
1072
|
commerceProvider: commerceProviderData,
|
|
1321
|
-
subscriptions
|
|
1073
|
+
subscriptions: await Promise.all(events.map((event) => createOrGetCommerceEventSubscription({
|
|
1074
|
+
context,
|
|
1075
|
+
event,
|
|
1076
|
+
metadata,
|
|
1077
|
+
provider
|
|
1078
|
+
}, existingData.subscriptions)))
|
|
1322
1079
|
};
|
|
1323
1080
|
}
|
|
1324
1081
|
/**
|
|
@@ -1335,7 +1092,7 @@ async function deleteIoEventRegistrations(providerData, provider, events, regist
|
|
|
1335
1092
|
};
|
|
1336
1093
|
const actionEventsMap = groupEventsByRuntimeActions(events);
|
|
1337
1094
|
const runtimeActions = Array.from(actionEventsMap.keys());
|
|
1338
|
-
const registrationNames = new Set([...runtimeActions.map((runtimeAction) => getRegistrationName(providerData, runtimeAction)), ...runtimeActions.map((runtimeAction) => getLegacyRegistrationName(providerData, runtimeAction))]);
|
|
1095
|
+
const registrationNames = /* @__PURE__ */ new Set([...runtimeActions.map((runtimeAction) => getRegistrationName(providerData, runtimeAction)), ...runtimeActions.map((runtimeAction) => getLegacyRegistrationName(providerData, runtimeAction))]);
|
|
1339
1096
|
const providerRegistrations = registrations.filter((reg) => reg.client_id === runtimeParams.AIO_COMMERCE_AUTH_IMS_CLIENT_ID && registrationNames.has(reg.name));
|
|
1340
1097
|
if (providerRegistrations.length === 0) {
|
|
1341
1098
|
logger.info(`No I/O Events registrations found for provider "${provider.label}" (instance ID: "${providerData.instance_id}").`);
|
|
@@ -1378,8 +1135,8 @@ async function deleteIoEventMetadata(providerData, provider, context) {
|
|
|
1378
1135
|
try {
|
|
1379
1136
|
await ioEventsClient.deleteEventMetadataForProvider({
|
|
1380
1137
|
...appCredentials,
|
|
1381
|
-
|
|
1382
|
-
|
|
1138
|
+
eventCode: eventMetadata.event_code,
|
|
1139
|
+
providerId: providerData.id
|
|
1383
1140
|
});
|
|
1384
1141
|
logger.info(`Deleted event metadata "${eventMetadata.event_code}" from provider "${providerData.id}".`);
|
|
1385
1142
|
} catch (error) {
|
|
@@ -1507,20 +1264,20 @@ async function offboardCommerceEventing(params, existingData) {
|
|
|
1507
1264
|
//#region source/management/installation/events/commerce.ts
|
|
1508
1265
|
/** Leaf step for installing commerce event sources. */
|
|
1509
1266
|
const commerceEventsStep = defineLeafStep({
|
|
1510
|
-
|
|
1267
|
+
install: createCommerceEvents,
|
|
1511
1268
|
meta: {
|
|
1512
1269
|
install: {
|
|
1513
|
-
|
|
1514
|
-
|
|
1270
|
+
description: "Sets up I/O Events for Adobe Commerce event sources",
|
|
1271
|
+
label: "Configure Commerce Events"
|
|
1515
1272
|
},
|
|
1516
1273
|
uninstall: {
|
|
1517
|
-
|
|
1518
|
-
|
|
1274
|
+
description: "Removes I/O Events for Adobe Commerce event sources",
|
|
1275
|
+
label: "Remove Commerce Events"
|
|
1519
1276
|
}
|
|
1520
1277
|
},
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1278
|
+
name: "commerce",
|
|
1279
|
+
uninstall: removeCommerceEvents,
|
|
1280
|
+
when: hasCommerceEvents
|
|
1524
1281
|
});
|
|
1525
1282
|
/**
|
|
1526
1283
|
* Creates all needed entities for Eventing to work with Commerce and Adobe I/O Events.
|
|
@@ -1531,53 +1288,74 @@ async function createCommerceEvents(config, context) {
|
|
|
1531
1288
|
const { logger } = context;
|
|
1532
1289
|
logger.debug("Starting installation of Commerce Events with config:", config);
|
|
1533
1290
|
const stepData = [];
|
|
1291
|
+
const env = getInstallCommerceEnv(context.params);
|
|
1534
1292
|
const workspaceConfiguration = JSON.stringify(makeWorkspaceConfig(context));
|
|
1535
1293
|
const existingIoEventsData = await getIoEventsExistingData(context);
|
|
1536
1294
|
const commerceEventingExistingData = await getCommerceEventingExistingData(context);
|
|
1537
|
-
|
|
1538
|
-
|
|
1295
|
+
let eventingConfigured = false;
|
|
1296
|
+
const storedProviders = {};
|
|
1297
|
+
for (const { provider, events: providerEvents } of config.eventing.commerce) {
|
|
1298
|
+
const events = providerEvents.filter((event) => appliesToEnv(event, env));
|
|
1299
|
+
if (events.length === 0) {
|
|
1300
|
+
logger.debug(`Skipping Commerce event provider "${provider.label}": no events apply to environment "${env}".`);
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1539
1303
|
const { providerData, eventsData } = await onboardIoEvents({
|
|
1540
1304
|
context,
|
|
1305
|
+
events,
|
|
1541
1306
|
metadata: config.metadata,
|
|
1542
1307
|
provider,
|
|
1543
|
-
events,
|
|
1544
1308
|
providerType: COMMERCE_PROVIDER_TYPE
|
|
1545
1309
|
}, existingIoEventsData);
|
|
1546
|
-
if (
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1310
|
+
if (!eventingConfigured) {
|
|
1311
|
+
await configureCommerceEventing({
|
|
1312
|
+
config: {
|
|
1313
|
+
enabled: true,
|
|
1314
|
+
environment_id: sanitizeEventingIdentifier(context.appData.projectName),
|
|
1315
|
+
instance_id: providerData.instance_id,
|
|
1316
|
+
merchant_id: sanitizeEventingIdentifier(context.appData.orgName),
|
|
1317
|
+
workspace_configuration: workspaceConfiguration
|
|
1318
|
+
},
|
|
1319
|
+
context
|
|
1320
|
+
}, commerceEventingExistingData);
|
|
1321
|
+
eventingConfigured = true;
|
|
1322
|
+
}
|
|
1556
1323
|
const { commerceProvider, subscriptions } = await onboardCommerceEventing({
|
|
1557
1324
|
context,
|
|
1558
|
-
metadata: config.metadata,
|
|
1559
|
-
provider,
|
|
1560
1325
|
ioData: {
|
|
1561
|
-
provider: providerData,
|
|
1562
1326
|
events: eventsData,
|
|
1327
|
+
provider: providerData,
|
|
1563
1328
|
workspaceConfiguration
|
|
1564
|
-
}
|
|
1329
|
+
},
|
|
1330
|
+
metadata: config.metadata,
|
|
1331
|
+
provider
|
|
1565
1332
|
}, commerceEventingExistingData);
|
|
1566
1333
|
stepData.push({ provider: {
|
|
1567
1334
|
config: provider,
|
|
1568
1335
|
data: {
|
|
1569
|
-
ioEvents: providerData,
|
|
1570
1336
|
commerce: commerceProvider,
|
|
1571
|
-
events: eventsData.map(({ config, data }, index) => ({
|
|
1572
|
-
config,
|
|
1337
|
+
events: eventsData.map(({ config: eventConfig, data }, index) => ({
|
|
1338
|
+
config: eventConfig,
|
|
1573
1339
|
data: {
|
|
1574
1340
|
...data,
|
|
1575
1341
|
subscription: subscriptions[index]
|
|
1576
1342
|
}
|
|
1577
|
-
}))
|
|
1343
|
+
})),
|
|
1344
|
+
ioEvents: providerData
|
|
1578
1345
|
}
|
|
1579
1346
|
} });
|
|
1347
|
+
if (provider.key) storedProviders[provider.key] = {
|
|
1348
|
+
events: Object.fromEntries(eventsData.map(({ config: eventConfig, data: eventData }) => [eventConfig.name, {
|
|
1349
|
+
code: eventData.metadata.event_code,
|
|
1350
|
+
isPhiData: eventConfig.hipaa_audit_required ?? false
|
|
1351
|
+
}])),
|
|
1352
|
+
id: providerData.id
|
|
1353
|
+
};
|
|
1580
1354
|
}
|
|
1355
|
+
await setSystemConfigByKey(EVENTS_STORAGE_KEY, { providers: {
|
|
1356
|
+
...(await getSystemConfigByKey("events") ?? { providers: {} }).providers,
|
|
1357
|
+
...storedProviders
|
|
1358
|
+
} });
|
|
1581
1359
|
logger.debug("Completed Commerce Events installation step.");
|
|
1582
1360
|
return stepData;
|
|
1583
1361
|
}
|
|
@@ -1593,15 +1371,15 @@ async function removeCommerceEvents(config, context) {
|
|
|
1593
1371
|
for (const { provider, events } of config.eventing.commerce) {
|
|
1594
1372
|
await offboardCommerceEventing({
|
|
1595
1373
|
context,
|
|
1374
|
+
events,
|
|
1596
1375
|
metadata: config.metadata,
|
|
1597
|
-
provider
|
|
1598
|
-
events
|
|
1376
|
+
provider
|
|
1599
1377
|
}, commerceEventingExistingData);
|
|
1600
1378
|
await offboardIoEvents({
|
|
1601
1379
|
context,
|
|
1380
|
+
events,
|
|
1602
1381
|
metadata: config.metadata,
|
|
1603
|
-
provider
|
|
1604
|
-
events
|
|
1382
|
+
provider
|
|
1605
1383
|
}, existingIoEventsData);
|
|
1606
1384
|
}
|
|
1607
1385
|
logger.debug("Completed Commerce Events uninstall step.");
|
|
@@ -1619,10 +1397,10 @@ function createCommerceEventsApiClient(params) {
|
|
|
1619
1397
|
commerceClientParams.fetchOptions.timeout = 1e3 * 60 * 2;
|
|
1620
1398
|
return createCustomCommerceEventsApiClient(commerceClientParams, {
|
|
1621
1399
|
createEventProvider,
|
|
1622
|
-
getAllEventProviders,
|
|
1623
1400
|
createEventSubscription,
|
|
1624
1401
|
deleteEventProvider,
|
|
1625
1402
|
deleteEventSubscription,
|
|
1403
|
+
getAllEventProviders,
|
|
1626
1404
|
getAllEventSubscriptions,
|
|
1627
1405
|
updateEventingConfiguration
|
|
1628
1406
|
});
|
|
@@ -1636,8 +1414,8 @@ function createIoEventsApiClient(params) {
|
|
|
1636
1414
|
ioEventsClientParams.fetchOptions ??= {};
|
|
1637
1415
|
ioEventsClientParams.fetchOptions.timeout = 1e3 * 60 * 2;
|
|
1638
1416
|
return createCustomAdobeIoEventsApiClient(ioEventsClientParams, {
|
|
1639
|
-
createEventProvider: createEventProvider$1,
|
|
1640
1417
|
createEventMetadataForProvider,
|
|
1418
|
+
createEventProvider: createEventProvider$1,
|
|
1641
1419
|
createRegistration,
|
|
1642
1420
|
deleteEventMetadataForProvider,
|
|
1643
1421
|
deleteEventProvider: deleteEventProvider$1,
|
|
@@ -1667,20 +1445,20 @@ function createEventsStepContext(installation) {
|
|
|
1667
1445
|
//#region source/management/installation/events/external.ts
|
|
1668
1446
|
/** Leaf step for installing external event sources. */
|
|
1669
1447
|
const externalEventsStep = defineLeafStep({
|
|
1670
|
-
|
|
1448
|
+
install: createExternalEvents,
|
|
1671
1449
|
meta: {
|
|
1672
1450
|
install: {
|
|
1673
|
-
|
|
1674
|
-
|
|
1451
|
+
description: "Sets up I/O Events for external event sources",
|
|
1452
|
+
label: "Configure External Events"
|
|
1675
1453
|
},
|
|
1676
1454
|
uninstall: {
|
|
1677
|
-
|
|
1678
|
-
|
|
1455
|
+
description: "Removes I/O Events for external event sources",
|
|
1456
|
+
label: "Remove External Events"
|
|
1679
1457
|
}
|
|
1680
1458
|
},
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1459
|
+
name: "external",
|
|
1460
|
+
uninstall: removeExternalEvents,
|
|
1461
|
+
when: hasExternalEvents
|
|
1684
1462
|
});
|
|
1685
1463
|
/**
|
|
1686
1464
|
* Creates all needed entities for External Events to work with Adobe I/O Events.
|
|
@@ -1690,27 +1468,46 @@ const externalEventsStep = defineLeafStep({
|
|
|
1690
1468
|
async function createExternalEvents(config, context) {
|
|
1691
1469
|
const { logger } = context;
|
|
1692
1470
|
logger.debug("Starting installation of External Events with config:", config);
|
|
1693
|
-
const
|
|
1471
|
+
const env = getInstallCommerceEnv(context.params);
|
|
1694
1472
|
const existingIoEventsData = await getIoEventsExistingData(context);
|
|
1695
|
-
|
|
1473
|
+
const storedProviders = {};
|
|
1474
|
+
const eligibleProviders = config.eventing.external.map(({ provider, events: providerEvents }) => ({
|
|
1475
|
+
events: providerEvents.filter((event) => appliesToEnv(event, env)),
|
|
1476
|
+
provider
|
|
1477
|
+
})).filter(({ events, provider }) => {
|
|
1478
|
+
if (events.length === 0) logger.debug(`Skipping external event provider "${provider.label}": no events apply to environment "${env}".`);
|
|
1479
|
+
return events.length > 0;
|
|
1480
|
+
});
|
|
1481
|
+
const stepData = await Promise.all(eligibleProviders.map(async ({ provider, events }) => {
|
|
1696
1482
|
const { providerData, eventsData } = await onboardIoEvents({
|
|
1697
1483
|
context,
|
|
1484
|
+
events,
|
|
1698
1485
|
metadata: config.metadata,
|
|
1699
1486
|
provider,
|
|
1700
|
-
events,
|
|
1701
1487
|
providerType: EXTERNAL_PROVIDER_TYPE
|
|
1702
1488
|
}, existingIoEventsData);
|
|
1703
|
-
|
|
1489
|
+
if (provider.key) storedProviders[provider.key] = {
|
|
1490
|
+
events: Object.fromEntries(eventsData.map(({ config: eventConfig, data: eventData }) => [eventConfig.name, {
|
|
1491
|
+
code: eventData.metadata.event_code,
|
|
1492
|
+
isPhiData: eventConfig.hipaa_audit_required ?? false
|
|
1493
|
+
}])),
|
|
1494
|
+
id: providerData.id
|
|
1495
|
+
};
|
|
1496
|
+
return { provider: {
|
|
1704
1497
|
config: provider,
|
|
1705
1498
|
data: {
|
|
1706
|
-
ioEvents: providerData,
|
|
1707
1499
|
events: {
|
|
1708
1500
|
config: events,
|
|
1709
1501
|
data: eventsData
|
|
1710
|
-
}
|
|
1502
|
+
},
|
|
1503
|
+
ioEvents: providerData
|
|
1711
1504
|
}
|
|
1712
|
-
} }
|
|
1713
|
-
}
|
|
1505
|
+
} };
|
|
1506
|
+
}));
|
|
1507
|
+
await setSystemConfigByKey(EVENTS_STORAGE_KEY, { providers: {
|
|
1508
|
+
...(await getSystemConfigByKey("events") ?? { providers: {} }).providers,
|
|
1509
|
+
...storedProviders
|
|
1510
|
+
} });
|
|
1714
1511
|
logger.debug("Completed External Events installation step.");
|
|
1715
1512
|
return stepData;
|
|
1716
1513
|
}
|
|
@@ -1725,9 +1522,9 @@ async function removeExternalEvents(config, context) {
|
|
|
1725
1522
|
const existingIoEventsData = await getIoEventsExistingData(context);
|
|
1726
1523
|
for (const { provider, events } of config.eventing.external) await offboardIoEvents({
|
|
1727
1524
|
context,
|
|
1525
|
+
events,
|
|
1728
1526
|
metadata: config.metadata,
|
|
1729
|
-
provider
|
|
1730
|
-
events
|
|
1527
|
+
provider
|
|
1731
1528
|
}, existingIoEventsData);
|
|
1732
1529
|
logger.debug("Completed External Events uninstall step.");
|
|
1733
1530
|
}
|
|
@@ -1736,20 +1533,20 @@ async function removeExternalEvents(config, context) {
|
|
|
1736
1533
|
//#region source/management/installation/events/branch.ts
|
|
1737
1534
|
/** Root eventing step that contains commerce and external event sub-steps. */
|
|
1738
1535
|
const eventingStep = defineBranchStep({
|
|
1739
|
-
|
|
1536
|
+
children: [commerceEventsStep, externalEventsStep],
|
|
1537
|
+
context: createEventsStepContext,
|
|
1740
1538
|
meta: {
|
|
1741
1539
|
install: {
|
|
1742
|
-
|
|
1743
|
-
|
|
1540
|
+
description: "Sets up the I/O Events and the Commerce events required by the application",
|
|
1541
|
+
label: "Eventing"
|
|
1744
1542
|
},
|
|
1745
1543
|
uninstall: {
|
|
1746
|
-
|
|
1747
|
-
|
|
1544
|
+
description: "Removes the I/O Events and Commerce events configured by the application",
|
|
1545
|
+
label: "Eventing"
|
|
1748
1546
|
}
|
|
1749
1547
|
},
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
children: [commerceEventsStep, externalEventsStep]
|
|
1548
|
+
name: "eventing",
|
|
1549
|
+
when: hasEventing
|
|
1753
1550
|
});
|
|
1754
1551
|
|
|
1755
1552
|
//#endregion
|
|
@@ -1802,8 +1599,9 @@ const ENVIRONMENT_STAGING = "staging";
|
|
|
1802
1599
|
* @param context - The webhooks execution context (provides the Commerce API client and logger).
|
|
1803
1600
|
*/
|
|
1804
1601
|
async function validateWebhookConflicts(config, context) {
|
|
1805
|
-
const { logger, commerceWebhooksClient } = context;
|
|
1806
|
-
const
|
|
1602
|
+
const { logger, commerceWebhooksClient, params } = context;
|
|
1603
|
+
const env = getInstallCommerceEnv(params);
|
|
1604
|
+
const modificationWebhooks = config.webhooks.filter((entry) => entry.category === "modification" && appliesToEnv(entry, env));
|
|
1807
1605
|
if (modificationWebhooks.length === 0) {
|
|
1808
1606
|
logger.debug("No modification webhooks to validate, skipping conflict check.");
|
|
1809
1607
|
return [];
|
|
@@ -1826,9 +1624,9 @@ async function validateWebhookConflicts(config, context) {
|
|
|
1826
1624
|
}
|
|
1827
1625
|
if (conflictedWebhooks.length > 0) return [{
|
|
1828
1626
|
code: "WEBHOOK_CONFLICTS",
|
|
1627
|
+
details: { conflictedWebhooks },
|
|
1829
1628
|
message: `Webhook conflicts detected: ${conflictedWebhooks.length} webhook(s) already registered for the same method and type by another app`,
|
|
1830
|
-
severity: "warning"
|
|
1831
|
-
details: { conflictedWebhooks }
|
|
1629
|
+
severity: "warning"
|
|
1832
1630
|
}];
|
|
1833
1631
|
logger.info("No webhook conflicts found.");
|
|
1834
1632
|
return [];
|
|
@@ -1842,19 +1640,25 @@ async function validateWebhookConflicts(config, context) {
|
|
|
1842
1640
|
*/
|
|
1843
1641
|
async function createWebhookSubscriptions(config, context) {
|
|
1844
1642
|
const { logger, commerceWebhooksClient, params } = context;
|
|
1845
|
-
|
|
1643
|
+
const env = getInstallCommerceEnv(params);
|
|
1644
|
+
const webhooks = config.webhooks.filter((entry) => appliesToEnv(entry, env));
|
|
1645
|
+
if (webhooks.length === 0) {
|
|
1646
|
+
logger.info("No webhooks apply to this environment, skipping subscription.");
|
|
1647
|
+
return { subscribedWebhooks: [] };
|
|
1648
|
+
}
|
|
1649
|
+
logger.info(`Subscribing ${webhooks.length} webhook(s) to Commerce...`);
|
|
1846
1650
|
const idPrefix = buildWebhookIdPrefix(config.metadata.id);
|
|
1847
1651
|
const subscribedWebhooks = [];
|
|
1848
1652
|
const existingWebhooks = await commerceWebhooksClient.getWebhookList();
|
|
1849
|
-
for (const entry of
|
|
1653
|
+
for (const entry of webhooks) {
|
|
1850
1654
|
const { webhook } = entry;
|
|
1851
1655
|
const resolvedUrl = "runtimeAction" in entry ? generateUrlForRuntimeAction(entry.runtimeAction) : entry.webhook.url;
|
|
1852
1656
|
logger.debug(`Subscribing webhook "${getWebhookName(webhook)}" (runtimeAction: ${"runtimeAction" in entry ? entry.runtimeAction : "none"})`);
|
|
1853
1657
|
const resolvedWebhook = {
|
|
1854
1658
|
...webhook,
|
|
1855
|
-
url: resolvedUrl,
|
|
1856
1659
|
batch_name: `${idPrefix}${webhook.batch_name}`,
|
|
1857
1660
|
hook_name: `${idPrefix}${webhook.hook_name}`,
|
|
1661
|
+
url: resolvedUrl,
|
|
1858
1662
|
..."runtimeAction" in entry && entry.requireAdobeAuth !== false && { developer_console_oauth: resolveDeveloperConsoleOAuthCredentials(params) }
|
|
1859
1663
|
};
|
|
1860
1664
|
subscribedWebhooks.push(await createOrGetWebhookSubscription(existingWebhooks, commerceWebhooksClient, resolvedWebhook, logger));
|
|
@@ -1873,17 +1677,15 @@ async function deleteWebhookSubscriptions(config, context) {
|
|
|
1873
1677
|
const { logger, commerceWebhooksClient } = context;
|
|
1874
1678
|
logger.info(`Unsubscribing ${config.webhooks.length} webhook(s) from Commerce...`);
|
|
1875
1679
|
const idPrefix = buildWebhookIdPrefix(config.metadata.id);
|
|
1876
|
-
const unsubscribedWebhooks = [];
|
|
1877
1680
|
const existingWebhooks = await commerceWebhooksClient.getWebhookList();
|
|
1681
|
+
const unsubscribedWebhooks = [];
|
|
1878
1682
|
for (const entry of config.webhooks) {
|
|
1879
1683
|
const { webhook } = entry;
|
|
1880
|
-
const resolvedBatch = `${idPrefix}${webhook.batch_name}`;
|
|
1881
|
-
const resolvedHook = `${idPrefix}${webhook.hook_name}`;
|
|
1882
1684
|
const params = {
|
|
1685
|
+
batch_name: `${idPrefix}${webhook.batch_name}`,
|
|
1686
|
+
hook_name: `${idPrefix}${webhook.hook_name}`,
|
|
1883
1687
|
webhook_method: webhook.webhook_method,
|
|
1884
|
-
webhook_type: webhook.webhook_type
|
|
1885
|
-
batch_name: resolvedBatch,
|
|
1886
|
-
hook_name: resolvedHook
|
|
1688
|
+
webhook_type: webhook.webhook_type
|
|
1887
1689
|
};
|
|
1888
1690
|
if (!isWebhookInList(existingWebhooks, params)) {
|
|
1889
1691
|
logger.debug(`Webhook not found, skipping unsubscribe: ${getWebhookName(webhook)}`);
|
|
@@ -1957,8 +1759,8 @@ function resolveDeveloperConsoleOAuthCredentials(params) {
|
|
|
1957
1759
|
return {
|
|
1958
1760
|
client_id: clientId,
|
|
1959
1761
|
client_secret: clientSecrets[0],
|
|
1960
|
-
|
|
1961
|
-
|
|
1762
|
+
environment: !imsEnvironment || String(imsEnvironment).startsWith("prod") ? ENVIRONMENT_PRODUCTION : ENVIRONMENT_STAGING,
|
|
1763
|
+
org_id: imsOrgId
|
|
1962
1764
|
};
|
|
1963
1765
|
}
|
|
1964
1766
|
/**
|
|
@@ -2025,39 +1827,39 @@ function getWebhookName(webhook) {
|
|
|
2025
1827
|
//#endregion
|
|
2026
1828
|
//#region source/management/installation/webhooks/branch.ts
|
|
2027
1829
|
const subscriptionsStep = defineLeafStep({
|
|
2028
|
-
|
|
1830
|
+
install: (config, context) => createWebhookSubscriptions(config, context),
|
|
2029
1831
|
meta: {
|
|
2030
1832
|
install: {
|
|
2031
|
-
|
|
2032
|
-
|
|
1833
|
+
description: "Creates webhook subscriptions in Adobe Commerce",
|
|
1834
|
+
label: "Create Subscriptions"
|
|
2033
1835
|
},
|
|
2034
1836
|
uninstall: {
|
|
2035
|
-
|
|
2036
|
-
|
|
1837
|
+
description: "Deletes webhook subscriptions from Adobe Commerce",
|
|
1838
|
+
label: "Delete Subscriptions"
|
|
2037
1839
|
}
|
|
2038
1840
|
},
|
|
2039
|
-
|
|
2040
|
-
install: (config, context) => createWebhookSubscriptions(config, context),
|
|
1841
|
+
name: "subscriptions",
|
|
2041
1842
|
uninstall: async (config, context) => {
|
|
2042
1843
|
await deleteWebhookSubscriptions(config, context);
|
|
2043
|
-
}
|
|
1844
|
+
},
|
|
1845
|
+
validate: (config, context) => validateWebhookConflicts(config, context)
|
|
2044
1846
|
});
|
|
2045
1847
|
/** Branch step for setting up Commerce webhooks. */
|
|
2046
1848
|
const webhooksStep = defineBranchStep({
|
|
2047
|
-
|
|
1849
|
+
children: [subscriptionsStep],
|
|
1850
|
+
context: createWebhooksStepContext,
|
|
2048
1851
|
meta: {
|
|
2049
1852
|
install: {
|
|
2050
|
-
|
|
2051
|
-
|
|
1853
|
+
description: "Sets up Commerce webhooks",
|
|
1854
|
+
label: "Webhooks"
|
|
2052
1855
|
},
|
|
2053
1856
|
uninstall: {
|
|
2054
|
-
|
|
2055
|
-
|
|
1857
|
+
description: "Removes Commerce webhooks",
|
|
1858
|
+
label: "Webhooks"
|
|
2056
1859
|
}
|
|
2057
1860
|
},
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
children: [subscriptionsStep]
|
|
1861
|
+
name: "webhooks",
|
|
1862
|
+
when: hasWebhooks
|
|
2061
1863
|
});
|
|
2062
1864
|
|
|
2063
1865
|
//#endregion
|
|
@@ -2069,7 +1871,7 @@ function createDefaultChildSteps(config) {
|
|
|
2069
1871
|
return [
|
|
2070
1872
|
eventingStep,
|
|
2071
1873
|
webhooksStep,
|
|
2072
|
-
|
|
1874
|
+
adminUiStep,
|
|
2073
1875
|
createCustomInstallationStep(config)
|
|
2074
1876
|
];
|
|
2075
1877
|
}
|
|
@@ -2078,12 +1880,12 @@ function createDefaultChildSteps(config) {
|
|
|
2078
1880
|
*/
|
|
2079
1881
|
function createRootInstallationStep(config) {
|
|
2080
1882
|
return defineBranchStep({
|
|
2081
|
-
|
|
1883
|
+
children: createDefaultChildSteps(config),
|
|
2082
1884
|
meta: { install: {
|
|
2083
|
-
|
|
2084
|
-
|
|
1885
|
+
description: "App installation workflow",
|
|
1886
|
+
label: "Installation"
|
|
2085
1887
|
} },
|
|
2086
|
-
|
|
1888
|
+
name: "installation"
|
|
2087
1889
|
});
|
|
2088
1890
|
}
|
|
2089
1891
|
/**
|
|
@@ -2091,12 +1893,12 @@ function createRootInstallationStep(config) {
|
|
|
2091
1893
|
*/
|
|
2092
1894
|
function createRootUninstallationStep(config) {
|
|
2093
1895
|
return defineBranchStep({
|
|
2094
|
-
|
|
1896
|
+
children: createDefaultChildSteps(config),
|
|
2095
1897
|
meta: { install: {
|
|
2096
|
-
|
|
2097
|
-
|
|
1898
|
+
description: "App uninstallation workflow",
|
|
1899
|
+
label: "Uninstallation"
|
|
2098
1900
|
} },
|
|
2099
|
-
|
|
1901
|
+
name: "uninstallation"
|
|
2100
1902
|
});
|
|
2101
1903
|
}
|
|
2102
1904
|
|
|
@@ -2110,8 +1912,8 @@ function createRootUninstallationStep(config) {
|
|
|
2110
1912
|
function createInitialInstallationState(options) {
|
|
2111
1913
|
const { config } = options;
|
|
2112
1914
|
return createInitialState({
|
|
2113
|
-
|
|
2114
|
-
config
|
|
1915
|
+
config,
|
|
1916
|
+
rootStep: createRootInstallationStep(config)
|
|
2115
1917
|
});
|
|
2116
1918
|
}
|
|
2117
1919
|
/**
|
|
@@ -2124,36 +1926,37 @@ async function runInstallation(options) {
|
|
|
2124
1926
|
const { installationContext, config, initialState, hooks } = options;
|
|
2125
1927
|
const rootStep = createRootInstallationStep(config);
|
|
2126
1928
|
const firstResult = await executeWorkflow({
|
|
2127
|
-
rootStep,
|
|
2128
|
-
installationContext,
|
|
2129
1929
|
config,
|
|
2130
|
-
initialState,
|
|
2131
1930
|
hooks: {
|
|
2132
1931
|
...hooks,
|
|
2133
1932
|
onInstallationFailure: void 0,
|
|
2134
1933
|
onStepFailure: void 0
|
|
2135
|
-
}
|
|
1934
|
+
},
|
|
1935
|
+
initialState,
|
|
1936
|
+
installationContext,
|
|
1937
|
+
rootStep
|
|
2136
1938
|
});
|
|
2137
1939
|
if (firstResult.status === "succeeded") return firstResult;
|
|
2138
1940
|
const { error } = firstResult;
|
|
2139
1941
|
installationContext.logger.warn(`Installation attempt 1 failed: step "${error.path.join(".")}", key "${error.key}"${error.message ? `, message "${error.message}"` : ""}. Retrying once.`);
|
|
1942
|
+
const retryState = createRetryState(firstResult);
|
|
2140
1943
|
return {
|
|
2141
1944
|
...await executeWorkflow({
|
|
2142
|
-
rootStep,
|
|
2143
|
-
installationContext,
|
|
2144
1945
|
config,
|
|
2145
|
-
initialState: createRetryState(firstResult),
|
|
2146
1946
|
hooks: hooks && {
|
|
2147
1947
|
...hooks,
|
|
2148
|
-
|
|
1948
|
+
onInstallationFailure: (state) => hooks.onInstallationFailure?.({
|
|
2149
1949
|
...state,
|
|
2150
1950
|
metadata: { isRetry: true }
|
|
2151
1951
|
}),
|
|
2152
|
-
|
|
1952
|
+
onInstallationSuccess: (state) => hooks.onInstallationSuccess?.({
|
|
2153
1953
|
...state,
|
|
2154
1954
|
metadata: { isRetry: true }
|
|
2155
1955
|
})
|
|
2156
|
-
}
|
|
1956
|
+
},
|
|
1957
|
+
initialState: retryState,
|
|
1958
|
+
installationContext,
|
|
1959
|
+
rootStep
|
|
2157
1960
|
}),
|
|
2158
1961
|
metadata: { isRetry: true }
|
|
2159
1962
|
};
|
|
@@ -2164,9 +1967,9 @@ async function runInstallation(options) {
|
|
|
2164
1967
|
function createInitialUninstallationState(options) {
|
|
2165
1968
|
const { config } = options;
|
|
2166
1969
|
return createInitialState({
|
|
2167
|
-
rootStep: createRootUninstallationStep(config),
|
|
2168
1970
|
config,
|
|
2169
|
-
mode: "uninstall"
|
|
1971
|
+
mode: "uninstall",
|
|
1972
|
+
rootStep: createRootUninstallationStep(config)
|
|
2170
1973
|
});
|
|
2171
1974
|
}
|
|
2172
1975
|
/**
|
|
@@ -2175,11 +1978,11 @@ function createInitialUninstallationState(options) {
|
|
|
2175
1978
|
function runUninstallation(options) {
|
|
2176
1979
|
const { installationContext, config, initialState, hooks } = options;
|
|
2177
1980
|
return executeUninstallWorkflow({
|
|
2178
|
-
rootStep: createRootUninstallationStep(config),
|
|
2179
|
-
installationContext,
|
|
2180
1981
|
config,
|
|
1982
|
+
hooks,
|
|
2181
1983
|
initialState,
|
|
2182
|
-
|
|
1984
|
+
installationContext,
|
|
1985
|
+
rootStep: createRootUninstallationStep(config)
|
|
2183
1986
|
});
|
|
2184
1987
|
}
|
|
2185
1988
|
/**
|
|
@@ -2193,9 +1996,9 @@ function runUninstallation(options) {
|
|
|
2193
1996
|
function runValidation(options) {
|
|
2194
1997
|
const { validationContext, config } = options;
|
|
2195
1998
|
return validateStepTree({
|
|
1999
|
+
config,
|
|
2196
2000
|
rootStep: createRootInstallationStep(config),
|
|
2197
|
-
validationContext
|
|
2198
|
-
config
|
|
2001
|
+
validationContext
|
|
2199
2002
|
});
|
|
2200
2003
|
}
|
|
2201
2004
|
|