@adobe/aio-commerce-lib-app 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/cjs/actions/app-config/index.cjs +202 -0
  3. package/dist/cjs/actions/{app-config.d.cts → app-config/index.d.cts} +11 -9
  4. package/dist/cjs/actions/{config.cjs → config/index.cjs} +79 -46
  5. package/dist/{es/actions/config.d.mts → cjs/actions/config/index.d.cts} +10 -8
  6. package/dist/cjs/actions/{installation.cjs → installation/index.cjs} +55 -36
  7. package/dist/{es/actions/installation.d.mts → cjs/actions/installation/index.d.cts} +11 -10
  8. package/dist/cjs/actions/{registration.cjs → registration/index.cjs} +16 -7
  9. package/dist/cjs/actions/{registration.d.cts → registration/index.d.cts} +8 -9
  10. package/dist/cjs/actions/{scope-tree.cjs → scope-tree/index.cjs} +52 -15
  11. package/dist/{es/actions/scope-tree.d.mts → cjs/actions/scope-tree/index.d.cts} +2 -5
  12. package/dist/cjs/{admin-ui-sdk-BiSopnKI.d.cts → admin-ui-sdk-EU915zlR.d.cts} +7 -8
  13. package/dist/cjs/app-DrYHK-z1.d.cts +1629 -0
  14. package/dist/cjs/commands/index.cjs +241 -56
  15. package/dist/cjs/commands/templates/app-management/app-config.js.template +2 -2
  16. package/dist/cjs/config/index.cjs +3 -3
  17. package/dist/cjs/config/index.d.cts +181 -1158
  18. package/dist/cjs/{config-ct-qMOGj.cjs → config-D-s0GSep.cjs} +4 -6
  19. package/dist/cjs/{error-C5LNOZ4f.cjs → error-D-N0PKSl.cjs} +0 -1
  20. package/dist/cjs/{index-B5WKJ3hJ.d.cts → index-B5gJ-q4U.d.cts} +172 -3
  21. package/dist/cjs/index-BXm8UbK7.d.cts +16 -0
  22. package/dist/cjs/{logging-BTevALnL.cjs → logging-BVz3weoC.cjs} +1 -1
  23. package/dist/cjs/management/index.cjs +1 -1
  24. package/dist/cjs/management/index.d.cts +2 -3
  25. package/dist/cjs/{management-D1QXg4YU.cjs → management-Dehz9qSJ.cjs} +114 -51
  26. package/dist/cjs/openapi-Cux6K4ZD.cjs +3072 -0
  27. package/dist/cjs/{router-CFErodHU.cjs → router-BOR7T6qR.cjs} +1 -1
  28. package/dist/cjs/{schemas-CukVpc19.cjs → schemas-FngDuIeo.cjs} +1 -1
  29. package/dist/cjs/{validate-b_bI4mDb.cjs → validate-oAOpyFyb.cjs} +49 -17
  30. package/dist/cjs/{webhooks-DS1BtgED.cjs → webhooks-tbZy9G3p.cjs} +4 -4
  31. package/dist/es/actions/{app-config.d.mts → app-config/index.d.mts} +11 -9
  32. package/dist/es/actions/app-config/index.mjs +199 -0
  33. package/dist/{cjs/actions/config.d.cts → es/actions/config/index.d.mts} +10 -8
  34. package/dist/es/actions/{config.mjs → config/index.mjs} +78 -45
  35. package/dist/{cjs/actions/installation.d.cts → es/actions/installation/index.d.mts} +11 -10
  36. package/dist/es/actions/{installation.mjs → installation/index.mjs} +54 -36
  37. package/dist/es/actions/{registration.d.mts → registration/index.d.mts} +8 -9
  38. package/dist/es/actions/{registration.mjs → registration/index.mjs} +16 -6
  39. package/dist/{cjs/actions/scope-tree.d.cts → es/actions/scope-tree/index.d.mts} +2 -5
  40. package/dist/es/actions/{scope-tree.mjs → scope-tree/index.mjs} +51 -14
  41. package/dist/es/{admin-ui-sdk-CCo2SWiL.d.mts → admin-ui-sdk-BwnD0xjK.d.mts} +6 -9
  42. package/dist/es/app-DrYHK-z1.d.mts +1629 -0
  43. package/dist/es/commands/index.mjs +223 -38
  44. package/dist/es/commands/templates/app-management/app-config.js.template +2 -2
  45. package/dist/es/config/index.d.mts +181 -1157
  46. package/dist/es/config/index.mjs +3 -3
  47. package/dist/es/{config-DGPFTk6w.mjs → config-3I4eLyyR.mjs} +4 -5
  48. package/dist/es/index-B0XqHwY5.d.mts +16 -0
  49. package/dist/es/{index-CCov0odd.d.mts → index-DLMbTtKS.d.mts} +172 -3
  50. package/dist/es/management/index.d.mts +2 -3
  51. package/dist/es/management/index.mjs +1 -1
  52. package/dist/es/{management-CCsOfniv.mjs → management-BUX-w2Ji.mjs} +113 -51
  53. package/dist/es/openapi-B6uP0SRn.mjs +3024 -0
  54. package/dist/es/{validate-Dn3lLTGj.mjs → validate-Dfajrp99.mjs} +37 -17
  55. package/dist/es/{webhooks-Dhrkkip7.mjs → webhooks-B5oq9ULL.mjs} +3 -3
  56. package/package.json +29 -17
  57. package/dist/cjs/actions/app-config.cjs +0 -41
  58. package/dist/cjs/app-C6kImBl7.d.cts +0 -564
  59. package/dist/cjs/step-CWYnKbga.d.cts +0 -187
  60. package/dist/es/actions/app-config.mjs +0 -39
  61. package/dist/es/app-DcY6dJiQ.d.mts +0 -564
  62. package/dist/es/step-0eI2x4C9.d.mts +0 -187
  63. /package/dist/cjs/{chunk-DS2yp5vX.cjs → chunk-Cozy-1ZF.cjs} +0 -0
  64. /package/dist/es/{error-DHlYzkbb.mjs → error-_RMwtrUA.mjs} +0 -0
  65. /package/dist/es/{logging-XIUXDK5T.mjs → logging-DbJHXSKh.mjs} +0 -0
  66. /package/dist/es/{router-BxaxEEu3.mjs → router-D58JJHHA.mjs} +0 -0
  67. /package/dist/es/{schemas-DOcnD16x.mjs → schemas-hRovglBF.mjs} +0 -0
@@ -1,187 +0,0 @@
1
- /**
2
- * @license
3
- *
4
- * Copyright 2026 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
-
15
- import { n as CommerceAppConfigOutputModel } from "./app-C6kImBl7.cjs";
16
- import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
17
- import * as v from "valibot";
18
- import AioLogger from "@adobe/aio-lib-core-logging";
19
-
20
- //#region source/management/installation/schema.d.ts
21
- /** Schema for validating Adobe I/O app credentials required for installation. */
22
- declare const AppDataSchema: v.ObjectSchema<{
23
- readonly consumerOrgId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
24
- readonly orgName: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
25
- readonly projectId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
26
- readonly projectName: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
27
- readonly projectTitle: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
28
- readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
29
- readonly workspaceName: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
30
- readonly workspaceTitle: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
31
- }, undefined>;
32
- /** Type for Adobe I/O app credentials. */
33
- type AppData = v.InferOutput<typeof AppDataSchema>;
34
- //#endregion
35
- //#region source/management/installation/workflow/step.d.ts
36
- /** Severity level of a validation issue. */
37
- type ValidationIssueSeverity = "error" | "warning" | "info";
38
- /** A single validation issue reported by a step's validate handler. */
39
- type ValidationIssue = {
40
- /** Machine-readable code identifying the issue type. */code: string; /** Human-readable description of the issue. */
41
- message: string; /** Severity of the issue. Only "error" severity blocks installation. */
42
- severity: ValidationIssueSeverity; /** Optional additional context about the issue. */
43
- details?: Record<string, unknown>;
44
- };
45
- /** Shared context available to all steps during installation. */
46
- type InstallationContext = {
47
- /** The credentials of the app being installed */appData: AppData; /** The raw action parameters from the App Builder runtime action. */
48
- params: RuntimeActionParams & {
49
- AIO_COMMERCE_AUTH_IMS_CLIENT_ID: string;
50
- AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS: string | string[];
51
- AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID: string;
52
- AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL: string;
53
- AIO_COMMERCE_AUTH_IMS_ORG_ID: string;
54
- AIO_COMMERCE_AUTH_IMS_SCOPES: string | string[];
55
- }; /** Logger instance for installation logging. */
56
- logger: ReturnType<typeof AioLogger>; /** Custom scripts defined in the configuration (if any). */
57
- customScripts?: Record<string, unknown>;
58
- };
59
- /** Factory function type for creating step-specific context. */
60
- type StepContextFactory<TStepCtx extends Record<string, unknown> = Record<string, unknown>> = (context: InstallationContext) => TStepCtx | Promise<TStepCtx>;
61
- /** The execution context passed to leaf step run handlers. */
62
- type ExecutionContext<TStepCtx extends Record<string, unknown> = Record<string, unknown>> = InstallationContext & TStepCtx;
63
- /**
64
- * A narrowed context available to step `validate` handlers.
65
- * Excludes `customScripts` — those only apply during installation, not pre-flight validation.
66
- */
67
- type ValidationContext = Omit<InstallationContext, "customScripts">;
68
- /** The context passed to step `validate` handlers (base validation context merged with step-level context). */
69
- type ValidationExecutionContext<TStepCtx extends Record<string, unknown> = Record<string, unknown>> = ValidationContext & TStepCtx;
70
- /** Metadata info for a step (used for UI display). */
71
- type StepMetaInfo = {
72
- label: string;
73
- description?: string;
74
- };
75
- /** Step metadata keyed by execution mode. */
76
- type StepMeta = {
77
- install: StepMetaInfo;
78
- uninstall?: StepMetaInfo;
79
- };
80
- /** Defines the base properties of a step. */
81
- type StepBase<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel> = {
82
- /** The name of this step. */name: TName; /** Metadata associated with the step, keyed by execution mode. */
83
- meta: StepMeta; /** Whether the step should be taken into consideration. */
84
- when?: (config: CommerceAppConfigOutputModel) => config is TConfig;
85
- };
86
- /** A leaf step that executes work (no children). */
87
- 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"; /** The execution handler for the step. */
89
- install: (config: TConfig, context: ExecutionContext<TStepCtx>) => TOutput | Promise<TOutput>;
90
- /**
91
- * Optional pre-installation validation handler.
92
- * Called before installation begins to surface issues (errors or warnings).
93
- * Returning an empty array means the step has no issues.
94
- */
95
- validate?: (config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>;
96
- /**
97
- * Optional uninstall handler for the step.
98
- * Called during uninstallation to reverse the work done by `install`.
99
- * If absent, the step is silently skipped during uninstallation.
100
- */
101
- uninstall?: (config: TConfig, context: ExecutionContext<TStepCtx>) => void | Promise<void>;
102
- };
103
- /** A branch step that contains children (no execution). */
104
- 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"; /** An optional factory function to setup shared context for the children steps. */
106
- context?: StepContextFactory<TStepCtx>; /** The children steps of this branch. */
107
- children: TChildren;
108
- /**
109
- * Optional pre-installation validation handler for the branch itself.
110
- * Called before children are validated. Returning an empty array means
111
- * the branch has no issues at this level.
112
- */
113
- validate?: (config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>;
114
- };
115
- /** A step in the installation tree (discriminated union by `type`). */
116
- type Step<TName extends string = string, TConfig extends CommerceAppConfigOutputModel = CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> = LeafStep<TName, TConfig, TStepCtx, TOutput> | BranchStep<TName, TConfig, TStepCtx>;
117
- /** Loosely-typed step for use in non type-safe contexts. */
118
- interface AnyStep {
119
- children?: AnyStep[];
120
- context?: (context: InstallationContext) => any;
121
- install?: (config: any, context: any) => unknown | Promise<unknown>;
122
- meta: StepMeta;
123
- name: string;
124
- type: "leaf" | "branch";
125
- uninstall?: (config: any, context: any) => void | Promise<void>;
126
- validate?: (config: any, context: any) => ValidationIssue[] | Promise<ValidationIssue[]>;
127
- when?: (config: CommerceAppConfigOutputModel) => boolean;
128
- }
129
- /** Check if a step is a leaf step. */
130
- declare function isLeafStep(step: AnyStep): step is LeafStep;
131
- /** Check if a step is a branch step. */
132
- declare function isBranchStep(step: AnyStep): step is BranchStep;
133
- /** Options for defining a leaf step. */
134
- type LeafStepOptions<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> = Omit<LeafStep<TName, TConfig, TStepCtx, TOutput>, "type">;
135
- /** Options for defining a branch step. */
136
- type BranchStepOptions<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TChildren extends AnyStep[] = AnyStep[]> = Omit<BranchStep<TName, TConfig, TStepCtx, TChildren>, "type">;
137
- /**
138
- * Define a leaf step (executable, no children).
139
- *
140
- * @example
141
- * ```typescript
142
- * const createProviders = defineLeafStep({
143
- * name: "providers",
144
- * meta: { install: { label: "Create Providers", description: "Creates I/O Events providers" } },
145
- * install: async ({ config, stepContext }) => {
146
- * const { eventsClient } = stepContext;
147
- * return eventsClient.createProvider(config.eventing);
148
- * },
149
- * });
150
- * ```
151
- */
152
- declare function defineLeafStep<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown>(options: LeafStepOptions<TName, TConfig, TStepCtx, TOutput>): {
153
- type: "leaf";
154
- name: TName;
155
- meta: StepMeta;
156
- when: ((config: CommerceAppConfigOutputModel) => config is TConfig) | undefined;
157
- install: (config: TConfig, context: ExecutionContext<TStepCtx>) => TOutput | Promise<TOutput>;
158
- uninstall: ((config: TConfig, context: ExecutionContext<TStepCtx>) => void | Promise<void>) | undefined;
159
- validate: ((config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>) | undefined;
160
- };
161
- /**
162
- * Define a branch step (container with children, no runner).
163
- *
164
- * @example
165
- * ```typescript
166
- * const eventing = defineBranchStep({
167
- * name: "eventing",
168
- * meta: { install: { label: "Eventing", description: "Sets up I/O Events" } },
169
- * when: hasEventing,
170
- * context: async (ctx) => ({ eventsClient: await createEventsClient(ctx) }),
171
- * children: [commerceEventsStep, externalEventsStep],
172
- * });
173
- * ```
174
- */
175
- declare function defineBranchStep<TName extends string, TConfig extends CommerceAppConfigOutputModel, TStepCtx extends Record<string, unknown> = Record<string, unknown>, const TChildren extends AnyStep[] = AnyStep[]>(options: BranchStepOptions<TName, TConfig, TStepCtx, TChildren>): {
176
- type: "branch";
177
- name: TName;
178
- meta: StepMeta;
179
- when: ((config: CommerceAppConfigOutputModel) => config is TConfig) | undefined;
180
- context: StepContextFactory<TStepCtx> | undefined;
181
- children: TChildren;
182
- validate: ((config: TConfig, context: ValidationExecutionContext<TStepCtx>) => ValidationIssue[] | Promise<ValidationIssue[]>) | undefined;
183
- };
184
- /** Infer the output type from a leaf step. */
185
- type InferStepOutput<TStep> = TStep extends LeafStep<infer _TName, infer _TConfig, infer _TStepCtx, infer TOutput> ? Awaited<TOutput> : never;
186
- //#endregion
187
- export { defineBranchStep as _, InferStepOutput as a, isLeafStep as b, LeafStepOptions as c, StepMeta as d, StepMetaInfo as f, ValidationIssueSeverity as g, ValidationIssue as h, ExecutionContext as i, Step as l, ValidationExecutionContext as m, BranchStep as n, InstallationContext as o, ValidationContext as p, BranchStepOptions as r, LeafStep as s, AnyStep as t, StepContextFactory as u, defineLeafStep as v, isBranchStep as y };
@@ -1,39 +0,0 @@
1
- /**
2
- * @license
3
- *
4
- * Copyright 2026 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
-
15
- import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
16
- import { t as validateCommerceAppConfig } from "../validate-Dn3lLTGj.mjs";
17
- import { ok } from "@adobe/aio-commerce-lib-core/responses";
18
-
19
- //#region source/actions/app-config.ts
20
- /** Router for the app config actions. */
21
- const router = new HttpActionRouter().use(logger({ name: () => "app-config" }));
22
- /** GET / - Get app config */
23
- router.get("/", { handler: async (_req, { logger, rawParams }) => {
24
- logger.debug("Validating app config...");
25
- const { appConfig } = rawParams;
26
- const config = validateCommerceAppConfig(appConfig);
27
- logger.debug("Successfully validated the app config");
28
- return ok({ body: config });
29
- } });
30
- /** Factory to create the route handler for the `app-config` action. */
31
- const appConfigRuntimeAction = ({ appConfig }) => async (params) => {
32
- return await router.handler()({
33
- ...params,
34
- appConfig
35
- });
36
- };
37
-
38
- //#endregion
39
- export { appConfigRuntimeAction };