@adobe/aio-commerce-lib-app 1.8.0 → 1.9.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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/actions/app-config/index.cjs +3 -3
- package/dist/cjs/actions/app-config/index.d.cts +2 -2
- package/dist/cjs/actions/association/index.d.cts +0 -1
- package/dist/cjs/actions/config/index.d.cts +1 -1
- package/dist/cjs/actions/installation/index.cjs +2 -2
- package/dist/cjs/actions/installation/index.d.cts +3 -3
- package/dist/cjs/{app-BwehWeu1.d.cts → app-e4bCHpek.d.cts} +0 -1
- package/dist/cjs/commands/index.cjs +8 -8
- package/dist/cjs/commands/index.d.cts +1 -1
- package/dist/cjs/config/index.browser.d.cts +1 -1
- package/dist/cjs/config/index.node.cjs +3 -3
- package/dist/cjs/config/index.node.d.cts +3 -13
- package/dist/{es/define-DxH1BFia.d.mts → cjs/define-B__VyRtO.d.cts} +1 -2
- package/dist/{es/index-B0XqHwY5.d.mts → cjs/index-DWEigxhy.d.cts} +3 -1
- package/dist/{es/index-DSk-RmwM.d.mts → cjs/index-Ds7AyoNv.d.cts} +139 -64
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +3 -2
- package/dist/cjs/{index.node-BWZuZLgs.cjs → index.node-Bv_FUgST.cjs} +1 -1
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +1 -1
- package/dist/cjs/{management-DEsRVP2L.cjs → management-DmH7fVxy.cjs} +4 -2
- package/dist/cjs/{openapi-C36q3dCZ.cjs → openapi-BzRN5Lc6.cjs} +1 -1
- package/dist/cjs/{utils-DSCmZ_iJ.cjs → utils-CGZGfXuy.cjs} +25 -0
- package/dist/cjs/{validate-C_eCKp21.cjs → validate-Dt0Fdj1L.cjs} +1 -1
- package/dist/cjs/{webhooks-L4DWHSOl.cjs → webhooks-CrHGA-sO.cjs} +0 -2
- package/dist/es/actions/app-config/index.d.mts +2 -2
- package/dist/es/actions/app-config/index.mjs +3 -3
- package/dist/es/actions/association/index.d.mts +0 -1
- package/dist/es/actions/config/index.d.mts +1 -1
- package/dist/es/actions/installation/index.d.mts +3 -3
- package/dist/es/actions/installation/index.mjs +2 -2
- package/dist/es/{app-BwehWeu1.d.mts → app-e4bCHpek.d.mts} +0 -1
- package/dist/es/commands/index.d.mts +1 -1
- package/dist/es/commands/index.mjs +7 -7
- package/dist/es/config/index.browser.d.mts +1 -1
- package/dist/es/config/index.node.d.mts +3 -14
- package/dist/es/config/index.node.mjs +3 -3
- package/dist/{cjs/define-DOqVyexT.d.cts → es/define-BEY_Q6rS.d.mts} +1 -2
- package/dist/{cjs/index-BXm8UbK7.d.cts → es/index-CgsSXApi.d.mts} +4 -1
- package/dist/{cjs/index-B3ISkC54.d.cts → es/index-Dsg4LZde.d.mts} +139 -64
- package/dist/es/index.d.mts +3 -2
- package/dist/es/index.mjs +1 -1
- package/dist/es/{index.node-DuvW9Sha.mjs → index.node-DsJ0QRGh.mjs} +1 -1
- package/dist/es/management/index.d.mts +1 -1
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-D5pmBBec.mjs → management-BpFkwoig.mjs} +4 -2
- package/dist/es/{openapi-BSc2NRd2.mjs → openapi-QEV7W6DH.mjs} +1 -1
- package/dist/es/{utils-_gj8L6eN.mjs → utils-D0O4r9jr.mjs} +20 -1
- package/dist/es/{validate-t0T0F2MF.mjs → validate-yqa8uIyb.mjs} +1 -1
- package/dist/es/{webhooks-D7DExIDM.mjs → webhooks-CVbZOxYS.mjs} +0 -2
- package/package.json +3 -3
|
@@ -12,11 +12,10 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { r as CommerceAppConfigOutputModel } from "./app-
|
|
16
|
-
import * as v from "valibot";
|
|
17
|
-
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
15
|
+
import { r as CommerceAppConfigOutputModel } from "./app-e4bCHpek.cjs";
|
|
18
16
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
19
|
-
|
|
17
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
18
|
+
import * as v from "valibot";
|
|
20
19
|
//#region source/management/installation/schema.d.ts
|
|
21
20
|
/** Schema for validating Adobe I/O app credentials required for installation. */
|
|
22
21
|
declare const AppDataSchema: v.ObjectSchema<{
|
|
@@ -37,14 +36,20 @@ type AppData = v.InferOutput<typeof AppDataSchema>;
|
|
|
37
36
|
type ValidationIssueSeverity = "error" | "warning" | "info";
|
|
38
37
|
/** A single validation issue reported by a step's validate handler. */
|
|
39
38
|
type ValidationIssue = {
|
|
40
|
-
/** Machine-readable code identifying the issue type. */
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
/** Machine-readable code identifying the issue type. */
|
|
40
|
+
code: string;
|
|
41
|
+
/** Human-readable description of the issue. */
|
|
42
|
+
message: string;
|
|
43
|
+
/** Severity of the issue. Only "error" severity blocks installation. */
|
|
44
|
+
severity: ValidationIssueSeverity;
|
|
45
|
+
/** Optional additional context about the issue. */
|
|
43
46
|
details?: Record<string, unknown>;
|
|
44
47
|
};
|
|
45
48
|
/** Shared context available to all steps during installation. */
|
|
46
49
|
type InstallationContext = {
|
|
47
|
-
/** The credentials of the app being installed */
|
|
50
|
+
/** The credentials of the app being installed */
|
|
51
|
+
appData: AppData;
|
|
52
|
+
/** The raw action parameters from the App Builder runtime action. */
|
|
48
53
|
params: RuntimeActionParams & {
|
|
49
54
|
AIO_COMMERCE_AUTH_IMS_CLIENT_ID: string;
|
|
50
55
|
AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS: string | string[];
|
|
@@ -52,8 +57,10 @@ type InstallationContext = {
|
|
|
52
57
|
AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL: string;
|
|
53
58
|
AIO_COMMERCE_AUTH_IMS_ORG_ID: string;
|
|
54
59
|
AIO_COMMERCE_AUTH_IMS_SCOPES: string | string[];
|
|
55
|
-
};
|
|
56
|
-
|
|
60
|
+
};
|
|
61
|
+
/** Logger instance for installation logging. */
|
|
62
|
+
logger: ReturnType<typeof AioLogger>;
|
|
63
|
+
/** Custom scripts defined in the configuration (if any). */
|
|
57
64
|
customScripts?: Record<string, unknown>;
|
|
58
65
|
};
|
|
59
66
|
/** Factory function type for creating step-specific context. */
|
|
@@ -79,13 +86,17 @@ type StepMeta = {
|
|
|
79
86
|
};
|
|
80
87
|
/** Defines the base properties of a step. */
|
|
81
88
|
type StepBase<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel> = {
|
|
82
|
-
/** The name of this step. */
|
|
83
|
-
|
|
89
|
+
/** The name of this step. */
|
|
90
|
+
name: TName;
|
|
91
|
+
/** Metadata associated with the step, keyed by execution mode. */
|
|
92
|
+
meta: StepMeta;
|
|
93
|
+
/** Whether the step should be taken into consideration. */
|
|
84
94
|
when?: (config: CommerceAppConfigOutputModel) => config is TConfig;
|
|
85
95
|
};
|
|
86
96
|
/** A leaf step that executes work (no children). */
|
|
87
97
|
type LeafStep<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> = StepBase<TName, TConfig> & {
|
|
88
|
-
type: "leaf";
|
|
98
|
+
type: "leaf";
|
|
99
|
+
/** The execution handler for the step. */
|
|
89
100
|
install: (config: TConfig, context: ExecutionContext<TStepCtx>) => TOutput | Promise<TOutput>;
|
|
90
101
|
/**
|
|
91
102
|
* Optional pre-installation validation handler.
|
|
@@ -102,8 +113,10 @@ type LeafStep<TName extends string = string, TConfig extends CommerceAppConfigOu
|
|
|
102
113
|
};
|
|
103
114
|
/** A branch step that contains children (no execution). */
|
|
104
115
|
type BranchStep<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TChildren extends AnyStep[] = AnyStep[]> = StepBase<TName, TConfig> & {
|
|
105
|
-
type: "branch";
|
|
106
|
-
|
|
116
|
+
type: "branch";
|
|
117
|
+
/** An optional factory function to setup shared context for the children steps. */
|
|
118
|
+
context?: StepContextFactory<TStepCtx>;
|
|
119
|
+
/** The children steps of this branch. */
|
|
107
120
|
children: TChildren;
|
|
108
121
|
/**
|
|
109
122
|
* Optional pre-installation validation handler for the branch itself.
|
|
@@ -191,18 +204,28 @@ type ExecutionStatus = "pending" | "in-progress" | "succeeded" | "failed";
|
|
|
191
204
|
type InstallationStatus = "pending" | "in-progress" | "succeeded" | "failed";
|
|
192
205
|
/** A structured error with path to the failing step. */
|
|
193
206
|
type InstallationError<TPayload = unknown> = {
|
|
194
|
-
/** Path to the step that failed (e.g., ["eventing", "commerce", "providers"]). */
|
|
195
|
-
|
|
196
|
-
|
|
207
|
+
/** Path to the step that failed (e.g., ["eventing", "commerce", "providers"]). */
|
|
208
|
+
path: string[];
|
|
209
|
+
/** Error key for easy identification. */
|
|
210
|
+
key: string;
|
|
211
|
+
/** Human-readable error message. */
|
|
212
|
+
message?: string;
|
|
213
|
+
/** Additional error payload. */
|
|
197
214
|
payload?: TPayload;
|
|
198
215
|
};
|
|
199
216
|
/** Status of a step in the installation tree. */
|
|
200
217
|
type StepStatus = {
|
|
201
|
-
/** Step name (unique among siblings). */
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
218
|
+
/** Step name (unique among siblings). */
|
|
219
|
+
name: string;
|
|
220
|
+
/** Unique step identifier (e.g., UUID). */
|
|
221
|
+
id: string;
|
|
222
|
+
/** Full path from root to this step. */
|
|
223
|
+
path: string[];
|
|
224
|
+
/** Step metadata (for display purposes). */
|
|
225
|
+
meta: StepMetaInfo;
|
|
226
|
+
/** Current execution status. */
|
|
227
|
+
status: ExecutionStatus;
|
|
228
|
+
/** Child step statuses (empty for leaf steps). */
|
|
206
229
|
children: StepStatus[];
|
|
207
230
|
};
|
|
208
231
|
/** Data collected during installation as a nested structure following step paths. */
|
|
@@ -211,8 +234,11 @@ type InstallationData = {
|
|
|
211
234
|
};
|
|
212
235
|
/** Base properties shared by all installation states. */
|
|
213
236
|
type InstallationStateBase = {
|
|
214
|
-
/** Unique installation identifier. */
|
|
215
|
-
|
|
237
|
+
/** Unique installation identifier. */
|
|
238
|
+
id: string;
|
|
239
|
+
/** Root step status. */
|
|
240
|
+
step: StepStatus;
|
|
241
|
+
/** Results from executed leaf steps, keyed by path. */
|
|
216
242
|
data: InstallationData | null;
|
|
217
243
|
/**
|
|
218
244
|
* The validated app configuration that drove this workflow. May be
|
|
@@ -222,26 +248,35 @@ type InstallationStateBase = {
|
|
|
222
248
|
};
|
|
223
249
|
/** Installation state when in progress. */
|
|
224
250
|
type InProgressInstallationState = InstallationStateBase & {
|
|
225
|
-
status: "in-progress";
|
|
251
|
+
status: "in-progress";
|
|
252
|
+
/** ISO timestamp when installation started. */
|
|
226
253
|
startedAt: string;
|
|
227
254
|
};
|
|
228
255
|
/** Metadata set when a retry was attempted, regardless of outcome. */
|
|
229
256
|
type InstallationRetryMetadata = {
|
|
230
|
-
/** True when installation was attempted more than once. */
|
|
257
|
+
/** True when installation was attempted more than once. */
|
|
258
|
+
isRetry: boolean;
|
|
231
259
|
};
|
|
232
260
|
/** Installation state when completed successfully. */
|
|
233
261
|
type SucceededInstallationState = InstallationStateBase & {
|
|
234
|
-
status: "succeeded";
|
|
235
|
-
|
|
236
|
-
|
|
262
|
+
status: "succeeded";
|
|
263
|
+
/** ISO timestamp when installation started. */
|
|
264
|
+
startedAt: string;
|
|
265
|
+
/** ISO timestamp when installation completed. */
|
|
266
|
+
completedAt: string;
|
|
267
|
+
/** Retry metadata, present when a retry was attempted. */
|
|
237
268
|
metadata?: InstallationRetryMetadata;
|
|
238
269
|
};
|
|
239
270
|
/** Installation state when failed. */
|
|
240
271
|
type FailedInstallationState = InstallationStateBase & {
|
|
241
|
-
status: "failed";
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
272
|
+
status: "failed";
|
|
273
|
+
/** ISO timestamp when installation started. */
|
|
274
|
+
startedAt: string;
|
|
275
|
+
/** ISO timestamp when installation failed. */
|
|
276
|
+
completedAt: string;
|
|
277
|
+
/** Error information about the failure. */
|
|
278
|
+
error: InstallationError;
|
|
279
|
+
/** Retry metadata, present when a retry was attempted. */
|
|
245
280
|
metadata?: InstallationRetryMetadata;
|
|
246
281
|
};
|
|
247
282
|
/**
|
|
@@ -266,19 +301,24 @@ type HookFunction<TEvent> = (event: TEvent, state: InstallationState) => void |
|
|
|
266
301
|
type InstallationHook = (state: InstallationState) => void | Promise<void>;
|
|
267
302
|
/** Base event payload for step events. */
|
|
268
303
|
type StepEvent = {
|
|
269
|
-
/** Full path to the step (e.g., ["eventing", "commerce", "providers"]). */
|
|
270
|
-
|
|
304
|
+
/** Full path to the step (e.g., ["eventing", "commerce", "providers"]). */
|
|
305
|
+
path: string[];
|
|
306
|
+
/** Step name (last element of path, for convenience). */
|
|
307
|
+
stepName: string;
|
|
308
|
+
/** Whether this is a leaf step (executable) or branch step (container). */
|
|
271
309
|
isLeaf: boolean;
|
|
272
310
|
};
|
|
273
311
|
/** Event payload when a step starts execution. */
|
|
274
312
|
type StepStartedEvent = StepEvent;
|
|
275
313
|
/** Event payload when a step succeeds. */
|
|
276
314
|
type StepSucceededEvent = StepEvent & {
|
|
277
|
-
/** Result returned by the step (only for leaf steps). */
|
|
315
|
+
/** Result returned by the step (only for leaf steps). */
|
|
316
|
+
result: unknown;
|
|
278
317
|
};
|
|
279
318
|
/** Event payload when a step fails. */
|
|
280
319
|
type StepFailedEvent = StepEvent & {
|
|
281
|
-
/** Error information. */
|
|
320
|
+
/** Error information. */
|
|
321
|
+
error: InstallationError;
|
|
282
322
|
};
|
|
283
323
|
/** Lifecycle hooks for installation execution. */
|
|
284
324
|
type InstallationHooks = {
|
|
@@ -293,16 +333,24 @@ type InstallationHooks = {
|
|
|
293
333
|
//#region source/management/installation/workflow/runner.d.ts
|
|
294
334
|
/** Options for creating an initial installation state. */
|
|
295
335
|
type CreateInitialStateOptions = {
|
|
296
|
-
/** The root branch step to build the state from. */
|
|
297
|
-
|
|
336
|
+
/** The root branch step to build the state from. */
|
|
337
|
+
rootStep: BranchStep;
|
|
338
|
+
/** The app configuration used to determine applicable steps. */
|
|
339
|
+
config: CommerceAppConfigOutputModel;
|
|
340
|
+
/** The execution mode. When "uninstall", steps use `meta.uninstall` if defined; defaults to "install". */
|
|
298
341
|
mode?: ExecutionMode;
|
|
299
342
|
};
|
|
300
343
|
/** Options for executing a workflow. */
|
|
301
344
|
type ExecuteWorkflowOptions = {
|
|
302
|
-
/** The root branch step to execute. */
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
345
|
+
/** The root branch step to execute. */
|
|
346
|
+
rootStep: BranchStep;
|
|
347
|
+
/** Shared installation context (params, logger, etc.). */
|
|
348
|
+
installationContext: InstallationContext;
|
|
349
|
+
/** The app configuration. */
|
|
350
|
+
config: CommerceAppConfigOutputModel;
|
|
351
|
+
/** The initial installation state (with all steps pending). */
|
|
352
|
+
initialState: InProgressInstallationState;
|
|
353
|
+
/** Lifecycle hooks for status change notifications. */
|
|
306
354
|
hooks?: InstallationHooks;
|
|
307
355
|
};
|
|
308
356
|
/** Execution mode: "install" or "uninstall". */
|
|
@@ -333,16 +381,24 @@ declare function executeUninstallWorkflow(options: ExecuteWorkflowOptions): Prom
|
|
|
333
381
|
//#region source/management/installation/workflow/validation.d.ts
|
|
334
382
|
/** Validation result for a single step, mirroring the step hierarchy. */
|
|
335
383
|
type StepValidationResult = {
|
|
336
|
-
/** Step name (unique among siblings). */
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
384
|
+
/** Step name (unique among siblings). */
|
|
385
|
+
name: string;
|
|
386
|
+
/** Full path from root to this step. */
|
|
387
|
+
path: string[];
|
|
388
|
+
/** Step metadata (for display purposes). */
|
|
389
|
+
meta: StepMetaInfo;
|
|
390
|
+
/** Issues found for this specific step (not including children). */
|
|
391
|
+
issues: ValidationIssue[];
|
|
392
|
+
/** Validation results for child steps (empty for leaf steps). */
|
|
340
393
|
children: StepValidationResult[];
|
|
341
394
|
};
|
|
342
395
|
/** Aggregated summary counts across the entire validation tree. */
|
|
343
396
|
type ValidationSummary = {
|
|
344
|
-
/** Total number of issues across all steps. */
|
|
345
|
-
|
|
397
|
+
/** Total number of issues across all steps. */
|
|
398
|
+
totalIssues: number;
|
|
399
|
+
/** Number of error-severity issues (these block installation). */
|
|
400
|
+
errors: number;
|
|
401
|
+
/** Number of warning-severity issues (allow proceeding with confirmation). */
|
|
346
402
|
warnings: number;
|
|
347
403
|
};
|
|
348
404
|
/** The complete validation result returned by the validation endpoint. */
|
|
@@ -351,14 +407,19 @@ type ValidationResult = {
|
|
|
351
407
|
* Whether installation can proceed without any confirmation.
|
|
352
408
|
* False if there are any error or warning severity issues.
|
|
353
409
|
*/
|
|
354
|
-
valid: boolean;
|
|
355
|
-
|
|
410
|
+
valid: boolean;
|
|
411
|
+
/** The full validation tree mirroring the step structure. */
|
|
412
|
+
result: StepValidationResult;
|
|
413
|
+
/** Flat summary of issue counts for quick frontend decisions. */
|
|
356
414
|
summary: ValidationSummary;
|
|
357
415
|
};
|
|
358
416
|
/** Options for running validation over the step tree. */
|
|
359
417
|
type ValidateStepTreeOptions = {
|
|
360
|
-
/** The root branch step to validate. */
|
|
361
|
-
|
|
418
|
+
/** The root branch step to validate. */
|
|
419
|
+
rootStep: BranchStep;
|
|
420
|
+
/** Validation context (params, logger, appData). */
|
|
421
|
+
validationContext: ValidationContext;
|
|
422
|
+
/** The app configuration used to determine applicable steps. */
|
|
362
423
|
config: CommerceAppConfigOutputModel;
|
|
363
424
|
};
|
|
364
425
|
/**
|
|
@@ -386,7 +447,9 @@ type CustomInstallationStepHandler<TResult = unknown> = (config: CommerceAppConf
|
|
|
386
447
|
* @template TResult - The return type of the install handler
|
|
387
448
|
*/
|
|
388
449
|
type CustomInstallationStepDefinition<TResult = unknown> = {
|
|
389
|
-
/** The installation handler, called when the app is installed. */
|
|
450
|
+
/** The installation handler, called when the app is installed. */
|
|
451
|
+
install: CustomInstallationStepHandler<TResult>;
|
|
452
|
+
/** The optional uninstall handler, called when the app is uninstalled. */
|
|
390
453
|
uninstall?: CustomInstallationStepHandler<void>;
|
|
391
454
|
};
|
|
392
455
|
/**
|
|
@@ -427,13 +490,18 @@ declare function defineCustomInstallationStep<TResult = unknown>(handlerOrDefini
|
|
|
427
490
|
//#region source/management/installation/runner.d.ts
|
|
428
491
|
/** Options for creating an initial installation state. */
|
|
429
492
|
type CreateInitialInstallationStateOptions = {
|
|
430
|
-
/** The app configuration used to determine applicable steps. */
|
|
493
|
+
/** The app configuration used to determine applicable steps. */
|
|
494
|
+
config: CommerceAppConfigOutputModel;
|
|
431
495
|
};
|
|
432
496
|
/** Options for running an installation. */
|
|
433
497
|
type RunInstallationOptions = {
|
|
434
|
-
/** Shared installation context (params, logger, etc.). */
|
|
435
|
-
|
|
436
|
-
|
|
498
|
+
/** Shared installation context (params, logger, etc.). */
|
|
499
|
+
installationContext: InstallationContext;
|
|
500
|
+
/** The app configuration. */
|
|
501
|
+
config: CommerceAppConfigOutputModel;
|
|
502
|
+
/** The initial installation state (with all steps pending). */
|
|
503
|
+
initialState: InProgressInstallationState;
|
|
504
|
+
/** Lifecycle hooks for status change notifications. */
|
|
437
505
|
hooks?: InstallationHooks;
|
|
438
506
|
};
|
|
439
507
|
/**
|
|
@@ -451,13 +519,18 @@ declare function createInitialInstallationState(options: CreateInitialInstallati
|
|
|
451
519
|
declare function runInstallation(options: RunInstallationOptions): Promise<SucceededInstallationState | FailedInstallationState>;
|
|
452
520
|
/** Options for creating an initial uninstallation state. */
|
|
453
521
|
type CreateInitialUninstallationStateOptions = {
|
|
454
|
-
/** The app configuration used to determine applicable steps. */
|
|
522
|
+
/** The app configuration used to determine applicable steps. */
|
|
523
|
+
config: CommerceAppConfigOutputModel;
|
|
455
524
|
};
|
|
456
525
|
/** Options for running an uninstallation. */
|
|
457
526
|
type RunUninstallationOptions = {
|
|
458
|
-
/** Shared installation context (params, logger, etc.). */
|
|
459
|
-
|
|
460
|
-
|
|
527
|
+
/** Shared installation context (params, logger, etc.). */
|
|
528
|
+
installationContext: InstallationContext;
|
|
529
|
+
/** The app configuration. */
|
|
530
|
+
config: CommerceAppConfigOutputModel;
|
|
531
|
+
/** The initial uninstallation state (with all steps pending). */
|
|
532
|
+
initialState: InProgressInstallationState;
|
|
533
|
+
/** Lifecycle hooks for status change notifications. */
|
|
461
534
|
hooks?: InstallationHooks;
|
|
462
535
|
};
|
|
463
536
|
/**
|
|
@@ -470,7 +543,9 @@ declare function createInitialUninstallationState(options: CreateInitialUninstal
|
|
|
470
543
|
declare function runUninstallation(options: RunUninstallationOptions): Promise<SucceededInstallationState | FailedInstallationState>;
|
|
471
544
|
/** Options for running pre-installation validation. */
|
|
472
545
|
type RunValidationOptions = {
|
|
473
|
-
/** Validation context (params, logger, appData — no customScripts). */
|
|
546
|
+
/** Validation context (params, logger, appData — no customScripts). */
|
|
547
|
+
validationContext: ValidationContext;
|
|
548
|
+
/** The app configuration. */
|
|
474
549
|
config: CommerceAppConfigOutputModel;
|
|
475
550
|
};
|
|
476
551
|
/**
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_repository = require('./repository-CbceYZqc.cjs');
|
|
17
|
-
const require_utils = require('./utils-
|
|
17
|
+
const require_utils = require('./utils-CGZGfXuy.cjs');
|
|
18
18
|
let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
|
|
19
19
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
20
20
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -17,11 +17,12 @@ import { ImsAuthParams, ImsAuthProvider } from "@adobe/aio-commerce-lib-auth";
|
|
|
17
17
|
import { CommerceEnv } from "@adobe/aio-commerce-lib-core/commerce";
|
|
18
18
|
import { CommerceSdkErrorBase, CommerceSdkErrorBaseOptions } from "@adobe/aio-commerce-lib-core/error";
|
|
19
19
|
import { AdobeIoEventsApiClient } from "@adobe/aio-commerce-lib-events/io-events";
|
|
20
|
-
|
|
21
20
|
//#region source/management/association/types.d.ts
|
|
22
21
|
/** The Commerce instance data an app is associated with. */
|
|
23
22
|
type AssociatedCommerceData = {
|
|
24
|
-
/** Commerce API base URL. */
|
|
23
|
+
/** Commerce API base URL. */
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
/** Deployment type of the Commerce instance. */
|
|
25
26
|
env: CommerceEnv;
|
|
26
27
|
};
|
|
27
28
|
//#endregion
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
|
|
16
16
|
const require_error = require('./error-D-N0PKSl.cjs');
|
|
17
|
-
const require_validate = require('./validate-
|
|
17
|
+
const require_validate = require('./validate-Dt0Fdj1L.cjs');
|
|
18
18
|
let path = require("path");
|
|
19
19
|
let fs = require("fs");
|
|
20
20
|
let fs_promises = require("fs/promises");
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_management = require('../management-
|
|
16
|
+
const require_management = require('../management-DmH7fVxy.cjs');
|
|
17
17
|
|
|
18
18
|
exports.createInitialInstallationState = require_management.createInitialInstallationState;
|
|
19
19
|
exports.createInitialUninstallationState = require_management.createInitialUninstallationState;
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { $ as StepContextFactory, A as ExecutionStatus, B as isCompletedState, C as executeUninstallWorkflow, D as StepFailedEvent, E as StepEvent, F as InstallationRetryMetadata, G as BranchStep, H as isInProgressState, I as InstallationState, J as InferStepOutput, K as BranchStepOptions, L as InstallationStatus, M as InProgressInstallationState, N as InstallationData, O as StepStartedEvent, P as InstallationError, Q as Step, R as StepStatus, S as createRetryState, T as InstallationHooks, U as isSucceededState, V as isFailedState, W as AnyStep, X as LeafStep, Y as InstallationContext, Z as LeafStepOptions, _ as ValidationSummary, a as RunValidationOptions, at as ValidationIssueSeverity, b as ExecuteWorkflowOptions, c as runInstallation, ct as isBranchStep, d as CustomInstallationStepDefinition, et as StepMeta, f as CustomInstallationStepHandler, g as ValidationResult, h as ValidateStepTreeOptions, i as RunUninstallationOptions, it as ValidationIssue, j as FailedInstallationState, k as StepSucceededEvent, l as runUninstallation, lt as isLeafStep, m as StepValidationResult, n as CreateInitialUninstallationStateOptions, nt as ValidationContext, o as createInitialInstallationState, ot as defineBranchStep, p as defineCustomInstallationStep, q as ExecutionContext, r as RunInstallationOptions, rt as ValidationExecutionContext, s as createInitialUninstallationState, st as defineLeafStep, t as CreateInitialInstallationStateOptions, tt as StepMetaInfo, u as runValidation, v as validateStepTree, w as executeWorkflow, x as createInitialState, y as CreateInitialStateOptions, z as SucceededInstallationState } from "../index-
|
|
15
|
+
import { $ as StepContextFactory, A as ExecutionStatus, B as isCompletedState, C as executeUninstallWorkflow, D as StepFailedEvent, E as StepEvent, F as InstallationRetryMetadata, G as BranchStep, H as isInProgressState, I as InstallationState, J as InferStepOutput, K as BranchStepOptions, L as InstallationStatus, M as InProgressInstallationState, N as InstallationData, O as StepStartedEvent, P as InstallationError, Q as Step, R as StepStatus, S as createRetryState, T as InstallationHooks, U as isSucceededState, V as isFailedState, W as AnyStep, X as LeafStep, Y as InstallationContext, Z as LeafStepOptions, _ as ValidationSummary, a as RunValidationOptions, at as ValidationIssueSeverity, b as ExecuteWorkflowOptions, c as runInstallation, ct as isBranchStep, d as CustomInstallationStepDefinition, et as StepMeta, f as CustomInstallationStepHandler, g as ValidationResult, h as ValidateStepTreeOptions, i as RunUninstallationOptions, it as ValidationIssue, j as FailedInstallationState, k as StepSucceededEvent, l as runUninstallation, lt as isLeafStep, m as StepValidationResult, n as CreateInitialUninstallationStateOptions, nt as ValidationContext, o as createInitialInstallationState, ot as defineBranchStep, p as defineCustomInstallationStep, q as ExecutionContext, r as RunInstallationOptions, rt as ValidationExecutionContext, s as createInitialUninstallationState, st as defineLeafStep, t as CreateInitialInstallationStateOptions, tt as StepMetaInfo, u as runValidation, v as validateStepTree, w as executeWorkflow, x as createInitialState, y as CreateInitialStateOptions, z as SucceededInstallationState } from "../index-Ds7AyoNv.cjs";
|
|
16
16
|
export { type AnyStep, type BranchStep, type BranchStepOptions, type CreateInitialInstallationStateOptions, type CreateInitialStateOptions, type CreateInitialUninstallationStateOptions, type CustomInstallationStepDefinition, type CustomInstallationStepHandler, type ExecuteWorkflowOptions, type ExecutionContext, type ExecutionStatus, type FailedInstallationState, type InProgressInstallationState, type InferStepOutput, type InstallationContext, type InstallationData, type InstallationError, type InstallationHooks, type InstallationRetryMetadata, type InstallationState, type InstallationStatus, type LeafStep, type LeafStepOptions, type RunInstallationOptions, type RunUninstallationOptions, type RunValidationOptions, type Step, type StepContextFactory, type StepEvent, type StepFailedEvent, type StepMeta, type StepMetaInfo, type StepStartedEvent, type StepStatus, type StepSucceededEvent, type StepValidationResult, type SucceededInstallationState, type ValidateStepTreeOptions, type ValidationContext, type ValidationExecutionContext, type ValidationIssue, type ValidationIssueSeverity, type ValidationResult, type ValidationSummary, createInitialInstallationState, type createInitialState, createInitialUninstallationState, type createRetryState, type defineBranchStep, defineCustomInstallationStep, type defineLeafStep, type executeUninstallWorkflow, type executeWorkflow, type isBranchStep, isCompletedState, isFailedState, isInProgressState, type isLeafStep, isSucceededState, runInstallation, runUninstallation, runValidation, type validateStepTree };
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
|
|
16
|
-
const require_utils = require('./utils-
|
|
16
|
+
const require_utils = require('./utils-CGZGfXuy.cjs');
|
|
17
17
|
const require_error = require('./error-D-N0PKSl.cjs');
|
|
18
18
|
const require_environment = require('./environment-B7EnozSg.cjs');
|
|
19
|
-
const require_webhooks = require('./webhooks-
|
|
19
|
+
const require_webhooks = require('./webhooks-CrHGA-sO.cjs');
|
|
20
20
|
const require_logging = require('./logging-udPuAJPt.cjs');
|
|
21
21
|
let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
|
|
22
22
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
@@ -1385,6 +1385,7 @@ async function removeCommerceEvents(config, context) {
|
|
|
1385
1385
|
provider
|
|
1386
1386
|
}, existingIoEventsData);
|
|
1387
1387
|
}
|
|
1388
|
+
await require_utils.removeStoredEventProviders(config.eventing.commerce.map(({ provider }) => provider.key).filter((key) => typeof key === "string"));
|
|
1388
1389
|
logger.debug("Completed Commerce Events uninstall step.");
|
|
1389
1390
|
}
|
|
1390
1391
|
|
|
@@ -1529,6 +1530,7 @@ async function removeExternalEvents(config, context) {
|
|
|
1529
1530
|
metadata: config.metadata,
|
|
1530
1531
|
provider
|
|
1531
1532
|
}, existingIoEventsData);
|
|
1533
|
+
await require_utils.removeStoredEventProviders(config.eventing.external.map(({ provider }) => provider.key).filter((key) => typeof key === "string"));
|
|
1532
1534
|
logger.debug("Completed External Events uninstall step.");
|
|
1533
1535
|
}
|
|
1534
1536
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
15
16
|
let _adobe_aio_commerce_lib_auth = require("@adobe/aio-commerce-lib-auth");
|
|
16
17
|
|
|
17
18
|
//#region source/management/installation/events/utils.ts
|
|
@@ -26,6 +27,24 @@ const METADATA_ID_MAX_LENGTH_FOR_INSTANCE_ID = 100;
|
|
|
26
27
|
/** Storage key used for the events installation data in system config. */
|
|
27
28
|
const EVENTS_STORAGE_KEY = "events";
|
|
28
29
|
/**
|
|
30
|
+
* Removes event providers from installation storage.
|
|
31
|
+
*
|
|
32
|
+
* @param providerKeys - The provider keys to remove.
|
|
33
|
+
*/
|
|
34
|
+
async function removeStoredEventProviders(providerKeys) {
|
|
35
|
+
if (providerKeys.length === 0) return;
|
|
36
|
+
const existing = await (0, _adobe_aio_commerce_lib_config.getSystemConfigByKey)(EVENTS_STORAGE_KEY);
|
|
37
|
+
if (!existing) return;
|
|
38
|
+
const providerKeysToRemove = new Set(providerKeys);
|
|
39
|
+
if (!providerKeys.some((key) => Object.hasOwn(existing.providers, key))) return;
|
|
40
|
+
const providers = Object.fromEntries(Object.entries(existing.providers).filter(([key]) => !providerKeysToRemove.has(key)));
|
|
41
|
+
if (Object.keys(providers).length === 0) {
|
|
42
|
+
await (0, _adobe_aio_commerce_lib_config.setSystemConfigByKey)(EVENTS_STORAGE_KEY, null);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await (0, _adobe_aio_commerce_lib_config.setSystemConfigByKey)(EVENTS_STORAGE_KEY, { providers });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
29
48
|
* Generates a unique instance ID for I/O Events for this app deployment.
|
|
30
49
|
* Uses `{metadata.id (first 100 chars)}-{providerKeyOrSlug}-{workspaceId}` (lowercased).
|
|
31
50
|
*
|
|
@@ -400,6 +419,12 @@ Object.defineProperty(exports, 'makeWorkspaceConfig', {
|
|
|
400
419
|
return makeWorkspaceConfig;
|
|
401
420
|
}
|
|
402
421
|
});
|
|
422
|
+
Object.defineProperty(exports, 'removeStoredEventProviders', {
|
|
423
|
+
enumerable: true,
|
|
424
|
+
get: function () {
|
|
425
|
+
return removeStoredEventProviders;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
403
428
|
Object.defineProperty(exports, 'sanitizeEventingIdentifier', {
|
|
404
429
|
enumerable: true,
|
|
405
430
|
get: function () {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
|
|
16
16
|
const require_schemas = require('./schemas-mLxMh_ko.cjs');
|
|
17
|
-
const require_webhooks = require('./webhooks-
|
|
17
|
+
const require_webhooks = require('./webhooks-CrHGA-sO.cjs');
|
|
18
18
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
19
19
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
20
20
|
let valibot = require("valibot");
|
|
@@ -153,7 +153,6 @@ const MenuSchema = valibot.object({
|
|
|
153
153
|
/**
|
|
154
154
|
* Schema for the `adminUi` config section.
|
|
155
155
|
* Supports grid column extensions, mass actions, order view buttons, and menu on `commerce/backend-ui/2`.
|
|
156
|
-
* @experimental
|
|
157
156
|
*/
|
|
158
157
|
const AdminUiSchema = valibot.object({
|
|
159
158
|
customer: valibot.optional(AdminUiCustomerSchema),
|
|
@@ -163,7 +162,6 @@ const AdminUiSchema = valibot.object({
|
|
|
163
162
|
});
|
|
164
163
|
/**
|
|
165
164
|
* Check if config has Admin UI configuration.
|
|
166
|
-
* @experimental
|
|
167
165
|
*/
|
|
168
166
|
function hasAdminUi(config) {
|
|
169
167
|
return config.adminUi !== void 0;
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import "../../index-CgsSXApi.mjs";
|
|
16
|
+
import { n as CommerceAppConfig } from "../../app-e4bCHpek.mjs";
|
|
16
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
17
|
-
|
|
18
18
|
//#region source/actions/app-config/router.d.ts
|
|
19
19
|
/** The arguments required to create the runtime action for the app-config action. */
|
|
20
20
|
type RuntimeActionFactoryArgs = {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { n as filterAppConfigByEnv } from "../../environment-C84BPRJZ.mjs";
|
|
16
|
-
import { i as requiresInstallationFromDomains, o as getConfigDomains, t as validateCommerceAppConfig, u as hasBusinessConfigSchema } from "../../validate-
|
|
16
|
+
import { i as requiresInstallationFromDomains, o as getConfigDomains, t as validateCommerceAppConfig, u as hasBusinessConfigSchema } from "../../validate-yqa8uIyb.mjs";
|
|
17
17
|
import { n as logger, t as HttpActionRouter } from "../../router-B_h0cvjc.mjs";
|
|
18
18
|
import { resolveBusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
19
19
|
import * as v from "valibot";
|
|
@@ -26,7 +26,7 @@ import { createHash } from "crypto";
|
|
|
26
26
|
* Loads the committed OpenAPI spec via dynamic import so it
|
|
27
27
|
* lands in its own chunk and is not parsed on every cold start.
|
|
28
28
|
*/
|
|
29
|
-
const importOpenApi = () => import("../../openapi-
|
|
29
|
+
const importOpenApi = () => import("../../openapi-QEV7W6DH.mjs");
|
|
30
30
|
/** Matches component schema `$ref` strings, capturing the schema name. */
|
|
31
31
|
const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(\w+)"/g;
|
|
32
32
|
/**
|
|
@@ -77,7 +77,7 @@ function pruneUnusedTags(spec) {
|
|
|
77
77
|
* @param domains - The active config domains.
|
|
78
78
|
*/
|
|
79
79
|
function getOpenApiCacheKey(domains) {
|
|
80
|
-
const input = `1.
|
|
80
|
+
const input = `1.9.0:${[...domains].sort().join(",")}:2.0.0`;
|
|
81
81
|
return createHash("sha256").update(input).digest("hex").slice(0, 8);
|
|
82
82
|
}
|
|
83
83
|
/** Returns the server URL to be set in the OpenAPI spec, based on the current namespace. */
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import "../../index-CgsSXApi.mjs";
|
|
15
16
|
import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
16
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
17
|
-
|
|
18
18
|
//#region source/actions/config/router.d.ts
|
|
19
19
|
/** The arguments required to create the runtime action for the config action. */
|
|
20
20
|
type ConfigActionFactoryArgs = {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
15
|
+
import "../../index-CgsSXApi.mjs";
|
|
16
|
+
import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-e4bCHpek.mjs";
|
|
17
|
+
import { Y as InstallationContext } from "../../index-Dsg4LZde.mjs";
|
|
17
18
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
18
|
-
|
|
19
19
|
//#region source/actions/installation/router.d.ts
|
|
20
20
|
type CustomScriptsLoader = (config: CommerceAppConfigOutputModel, logger: InstallationContext["logger"]) => Record<string, unknown>;
|
|
21
21
|
/** Arguments for the runtime action factory. */
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { r as nonEmptyStringValueSchema } from "../../schemas-hRovglBF.mjs";
|
|
16
|
-
import { t as validateCommerceAppConfig } from "../../validate-
|
|
17
|
-
import { a as runValidation, c as isFailedState, i as runUninstallation, l as isInProgressState, n as createInitialUninstallationState, r as runInstallation, s as isCompletedState, t as createInitialInstallationState, u as isSucceededState } from "../../management-
|
|
16
|
+
import { t as validateCommerceAppConfig } from "../../validate-yqa8uIyb.mjs";
|
|
17
|
+
import { a as runValidation, c as isFailedState, i as runUninstallation, l as isInProgressState, n as createInitialUninstallationState, r as runInstallation, s as isCompletedState, t as createInitialInstallationState, u as isSucceededState } from "../../management-BpFkwoig.mjs";
|
|
18
18
|
import { n as logger, t as HttpActionRouter } from "../../router-B_h0cvjc.mjs";
|
|
19
19
|
import { init } from "@adobe/aio-lib-state";
|
|
20
20
|
import * as v from "valibot";
|