@adobe/aio-commerce-lib-app 1.1.0 → 1.3.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 (40) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/actions/app-config.cjs +1 -1
  3. package/dist/cjs/actions/app-config.d.cts +3 -3
  4. package/dist/cjs/actions/config.cjs +33 -2
  5. package/dist/cjs/actions/config.d.cts +2 -2
  6. package/dist/cjs/actions/installation.cjs +167 -43
  7. package/dist/cjs/actions/installation.d.cts +4 -4
  8. package/dist/cjs/actions/scope-tree.d.cts +3 -3
  9. package/dist/cjs/{app-lymFcs59.d.cts → app-DcQMhW2N.d.cts} +13 -1
  10. package/dist/cjs/commands/index.cjs +3 -3
  11. package/dist/cjs/config/index.cjs +3 -3
  12. package/dist/cjs/config/index.d.cts +39 -3
  13. package/dist/cjs/{config-YEeaEqzi.cjs → config-BppBKCFj.cjs} +1 -1
  14. package/dist/{es/index-D33OCH0D.d.mts → cjs/index-BVwQk9bx.d.cts} +103 -34
  15. package/dist/cjs/management/index.cjs +3 -1
  16. package/dist/cjs/management/index.d.cts +2 -2
  17. package/dist/cjs/{management-PZtLe4Ji.cjs → management-C6xG5bfl.cjs} +731 -163
  18. package/dist/cjs/{validate-CwwYD8aC.cjs → validate-CeUCT_7k.cjs} +7 -3
  19. package/dist/cjs/{webhooks-CbZpv9y_.cjs → webhooks-CLtDxwMa.cjs} +33 -0
  20. package/dist/es/actions/app-config.d.mts +3 -3
  21. package/dist/es/actions/app-config.mjs +1 -1
  22. package/dist/es/actions/config.d.mts +2 -2
  23. package/dist/es/actions/config.mjs +34 -3
  24. package/dist/es/actions/installation.d.mts +4 -4
  25. package/dist/es/actions/installation.mjs +168 -44
  26. package/dist/es/actions/scope-tree.d.mts +3 -3
  27. package/dist/es/actions/scope-tree.mjs +1 -1
  28. package/dist/es/{app-Ct7Y0NP8.d.mts → app-DJr-mN9d.d.mts} +13 -1
  29. package/dist/es/commands/index.mjs +3 -3
  30. package/dist/es/config/index.d.mts +39 -3
  31. package/dist/es/config/index.mjs +3 -3
  32. package/dist/es/{config-BbrkH0Xt.mjs → config-BohwKkQS.mjs} +1 -1
  33. package/dist/{cjs/index-DRhLtRrX.d.cts → es/index-BENO5T7n.d.mts} +103 -34
  34. package/dist/es/management/index.d.mts +2 -2
  35. package/dist/es/management/index.mjs +2 -2
  36. package/dist/es/{management-CIoVWirU.mjs → management-ByHvVJ12.mjs} +723 -167
  37. package/dist/es/{validate-qRpfubPo.mjs → validate-CqJdGzyZ.mjs} +8 -4
  38. package/dist/es/{webhooks-NgM6k3_r.mjs → webhooks-CYo-pqbR.mjs} +23 -2
  39. package/package.json +5 -4
  40. /package/dist/es/{schemas-BvPxQwgQ.mjs → schemas-CVXHgUhv.mjs} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @adobe/aio-commerce-lib-app
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#369](https://github.com/adobe/aio-commerce-sdk/pull/369) [`d8b0fa9`](https://github.com/adobe/aio-commerce-sdk/commit/d8b0fa9e3370b7abd0fb71b42d0078c375f63fb3) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Add uninstallation flow for both native steps and custom steps. `defineCustomInstallationStep` now accepts an object with `install` and an optional `uninstall` handler in addition to a plain function, enabling per-step cleanup logic.
8
+
9
+ - [#387](https://github.com/adobe/aio-commerce-sdk/pull/387) [`0803ecb`](https://github.com/adobe/aio-commerce-sdk/commit/0803ecb143ee6a0e6d4113cb380d625e20ee4e2f) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Adding new PATCH endpoint for configuration which allows to partially set configuration values. Deprecating PUT endpoint in favor of PATCH.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#375](https://github.com/adobe/aio-commerce-sdk/pull/375) [`f5ac1a1`](https://github.com/adobe/aio-commerce-sdk/commit/f5ac1a1a400a6e609f296ef8de21ef6b20602120) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Fix an issue where the Commerce Eventing module was constantly being updated for each provider of an app.
14
+
15
+ - Updated dependencies [[`d8b0fa9`](https://github.com/adobe/aio-commerce-sdk/commit/d8b0fa9e3370b7abd0fb71b42d0078c375f63fb3), [`0803ecb`](https://github.com/adobe/aio-commerce-sdk/commit/0803ecb143ee6a0e6d4113cb380d625e20ee4e2f)]:
16
+ - @adobe/aio-commerce-lib-events@1.1.0
17
+ - @adobe/aio-commerce-lib-config@1.2.0
18
+
19
+ ## 1.2.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [#351](https://github.com/adobe/aio-commerce-sdk/pull/351) [`8af56e1`](https://github.com/adobe/aio-commerce-sdk/commit/8af56e142179b4d15249ce385bda23117003c133) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Add workspace ID to the event provider instance ID to ensure uniqueness within the IMS org.
24
+
25
+ - [#372](https://github.com/adobe/aio-commerce-sdk/pull/372) [`a04ee2b`](https://github.com/adobe/aio-commerce-sdk/commit/a04ee2b511aa7169e9fcc827f8eddab6192f00ba) Thanks [@asalloum5](https://github.com/asalloum5)! - Added Admin UI SDK installation step to correctly configure extensions in Adobe Commerce instance.
26
+
27
+ ### Patch Changes
28
+
29
+ - [#370](https://github.com/adobe/aio-commerce-sdk/pull/370) [`a627efc`](https://github.com/adobe/aio-commerce-sdk/commit/a627efc95d8176ff20a4506f9cadd828c9886d84) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Only configure the Commerce Eventing Module when it doesn't have a default provider or a workspace configuration.
30
+
31
+ - Updated dependencies [[`fe79660`](https://github.com/adobe/aio-commerce-sdk/commit/fe79660a9f010b5651f36e4e9d85bb11fc856296), [`fe79660`](https://github.com/adobe/aio-commerce-sdk/commit/fe79660a9f010b5651f36e4e9d85bb11fc856296), [`eeef589`](https://github.com/adobe/aio-commerce-sdk/commit/eeef589461f9bd684ed1fcf23ff97dfeba88723e), [`3e4b765`](https://github.com/adobe/aio-commerce-sdk/commit/3e4b7657cd34ff45317d29067846a4a113a3d37f)]:
32
+ - @adobe/aio-commerce-lib-config@1.1.0
33
+
3
34
  ## 1.1.0
4
35
 
5
36
  ### Minor Changes
@@ -15,7 +15,7 @@
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
16
  const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
17
  const require_router = require('../router-KeQRduO3.cjs');
18
- const require_validate = require('../validate-CwwYD8aC.cjs');
18
+ const require_validate = require('../validate-CeUCT_7k.cjs');
19
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
20
 
21
21
  //#region source/actions/app-config.ts
@@ -12,8 +12,8 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel } from "../app-lymFcs59.cjs";
16
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
15
+ import { n as CommerceAppConfigOutputModel } from "../app-DcQMhW2N.cjs";
16
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
17
17
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
18
18
 
19
19
  //#region source/actions/app-config.d.ts
@@ -24,6 +24,6 @@ type RuntimeActionFactoryArgs = {
24
24
  /** Factory to create the route handler for the `app-config` action. */
25
25
  declare const appConfigRuntimeAction: ({
26
26
  appConfig
27
- }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
27
+ }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
28
28
  //#endregion
29
29
  export { appConfigRuntimeAction };
@@ -15,7 +15,7 @@
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
16
  const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
17
  const require_router = require('../router-KeQRduO3.cjs');
18
- const require_validate = require('../validate-CwwYD8aC.cjs');
18
+ const require_validate = require('../validate-CeUCT_7k.cjs');
19
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
20
  let valibot = require("valibot");
21
21
  valibot = require_schemas.__toESM(valibot);
@@ -59,7 +59,11 @@ router.get("/", {
59
59
  } });
60
60
  }
61
61
  });
62
- /** POST / - Set configuration */
62
+ /**
63
+ * PUT / - Set configuration (deprecated)
64
+ * @deprecated Use PATCH instead. This endpoint overwrites all values for the scope
65
+ * and does not support partial updates or unset semantics.
66
+ */
63
67
  router.put("/", {
64
68
  body: valibot.object({
65
69
  scopeId: require_schemas.nonEmptyStringValueSchema("scopeId"),
@@ -73,8 +77,35 @@ router.put("/", {
73
77
  const { configSchema } = rawParams;
74
78
  logger.debug(`Setting configuration with scope id: ${req.body.scopeId}`);
75
79
  const { scopeId, config } = req.body;
80
+ (0, _adobe_aio_commerce_lib_config.initialize)({ schema: require_validate.validateCommerceAppConfigDomain(configSchema, "businessConfig.schema") });
76
81
  const result = await (0, _adobe_aio_commerce_lib_config.setConfiguration)({ config: config.filter((item) => item.value !== MASKED_PASSWORD_VALUE) }, (0, _adobe_aio_commerce_lib_config.byScopeId)(scopeId), { encryptionKey: rawParams.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY });
77
82
  result.config = filterPasswordFields(configSchema, result.config);
83
+ return (0, _adobe_aio_commerce_lib_core_responses.ok)({
84
+ body: result,
85
+ headers: {
86
+ "Cache-Control": "no-store",
87
+ Deprecation: "Wed, 15 Apr 2026 00:00:00 GMT"
88
+ }
89
+ });
90
+ }
91
+ });
92
+ /** PATCH / - Partially update configuration */
93
+ router.patch("/", {
94
+ body: valibot.object({
95
+ scopeId: require_schemas.nonEmptyStringValueSchema("scopeId"),
96
+ config: valibot.array(valibot.object({
97
+ name: require_schemas.nonEmptyStringValueSchema("config.name"),
98
+ value: valibot.nullable(valibot.union([valibot.string(), valibot.array(valibot.string())]))
99
+ }))
100
+ }),
101
+ handler: async (req, ctx) => {
102
+ const { logger, rawParams } = ctx;
103
+ const { configSchema } = rawParams;
104
+ logger.debug(`Patching configuration with scope id: ${req.body.scopeId}`);
105
+ const { scopeId, config } = req.body;
106
+ (0, _adobe_aio_commerce_lib_config.initialize)({ schema: require_validate.validateCommerceAppConfigDomain(configSchema, "businessConfig.schema") });
107
+ const result = await (0, _adobe_aio_commerce_lib_config.setConfiguration)({ config }, (0, _adobe_aio_commerce_lib_config.byScopeId)(scopeId), { encryptionKey: rawParams.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY });
108
+ result.config = filterPasswordFields(configSchema, result.config);
78
109
  return (0, _adobe_aio_commerce_lib_core_responses.ok)({
79
110
  body: result,
80
111
  headers: { "Cache-Control": "no-store" }
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
15
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
16
16
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
17
17
  import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
18
18
 
@@ -24,6 +24,6 @@ type ConfigActionFactoryArgs = {
24
24
  /** Factory to create the route handler for the `config` action. */
25
25
  declare const configRuntimeAction: ({
26
26
  configSchema
27
- }: ConfigActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
27
+ }: ConfigActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
28
28
  //#endregion
29
29
  export { configRuntimeAction };
@@ -15,7 +15,7 @@
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
16
  const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
17
  const require_router = require('../router-KeQRduO3.cjs');
18
- const require_management = require('../management-PZtLe4Ji.cjs');
18
+ const require_management = require('../management-C6xG5bfl.cjs');
19
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
20
  let valibot = require("valibot");
21
21
  valibot = require_schemas.__toESM(valibot);
@@ -268,21 +268,68 @@ const InstallationRequestBodySchema = (0, valibot.object)({
268
268
  ioEventsUrl: (0, valibot.string)(),
269
269
  ioEventsEnv: (0, valibot.string)()
270
270
  });
271
- /** Creates an installation state store using lib-core combined storage. */
272
- function createInstallationStore() {
271
+ /** Creates a workflow state store with the given prefix. */
272
+ function createWorkflowStore(prefix) {
273
273
  return createCombinedStore({
274
- cache: { keyPrefix: "installation" },
274
+ cache: { keyPrefix: prefix },
275
275
  persistent: {
276
- dirPrefix: "installation",
276
+ dirPrefix: prefix,
277
277
  shouldPersist: require_management.isCompletedState
278
278
  }
279
279
  });
280
280
  }
281
+ /** Creates the installation state store. */
282
+ function createInstallationStore() {
283
+ return createWorkflowStore("installation");
284
+ }
285
+ /** Creates the uninstallation state store. */
286
+ function createUninstallationStore() {
287
+ return createWorkflowStore("uninstallation");
288
+ }
281
289
  /** Returns the storage key used to store the current installation ID. */
282
290
  function getStorageKey() {
283
291
  return "current";
284
292
  }
285
293
  /**
294
+ * Merges rawParams with body fields, overriding API URLs.
295
+ * Shared by POST /, POST /execution, POST /uninstallation, POST /uninstallation/execution.
296
+ */
297
+ function buildWorkflowParams(body, rawParams) {
298
+ return {
299
+ ...rawParams,
300
+ appData: body.appData,
301
+ AIO_EVENTS_API_BASE_URL: body.ioEventsUrl,
302
+ AIO_COMMERCE_AUTH_IMS_ENVIRONMENT: body.ioEventsEnv,
303
+ AIO_COMMERCE_API_BASE_URL: body.commerceBaseUrl,
304
+ AIO_COMMERCE_API_FLAVOR: body.commerceEnv
305
+ };
306
+ }
307
+ /**
308
+ * Builds an InstallationContext from merged workflow params.
309
+ * Shared by POST /execution and POST /uninstallation/execution.
310
+ */
311
+ function buildInstallationContext(params, appConfig, logFn) {
312
+ return {
313
+ appData: params.appData,
314
+ params,
315
+ logger: logFn,
316
+ customScripts: params.customScriptsLoader?.(appConfig, logFn) ?? {}
317
+ };
318
+ }
319
+ /**
320
+ * Reads state from a store and returns 200 with body or 204.
321
+ * Shared by GET / and GET /uninstallation.
322
+ */
323
+ async function readStateFromStore(store, logFn) {
324
+ const state = await store.get(getStorageKey());
325
+ if (state) {
326
+ logFn(`Found state: ${state.status}`);
327
+ return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: state });
328
+ }
329
+ logFn("No state found");
330
+ return (0, _adobe_aio_commerce_lib_core_responses.noContent)();
331
+ }
332
+ /**
286
333
  * Creates hooks to sync installation state to storage.
287
334
  */
288
335
  function createInstallationHooks(store, logFn) {
@@ -303,9 +350,14 @@ function createInstallationHooks(store, logFn) {
303
350
  * Installation action router.
304
351
  *
305
352
  * Routes:
306
- * - POST /installation - Start installation (creates plan, invokes execution async)
307
- * - GET /installation/execution - Get current execution status
308
- * - POST /installation/execution - Execute installation (internal, called async)
353
+ * - GET /installation - Get current installation status
354
+ * - POST /installation - Start installation (creates plan, invokes execution async)
355
+ * - POST /installation/execution - Execute installation (internal, called async)
356
+ * - POST /installation/validation - Pre-installation validation
357
+ * - POST /installation/uninstallation - Start uninstallation (async)
358
+ * - GET /installation/uninstallation - Get current uninstallation status
359
+ * - POST /installation/uninstallation/execution - Execute uninstallation (internal, called async)
360
+ * - DELETE /installation/uninstallation - Clear uninstallation state only (no offboarding)
309
361
  */
310
362
  const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "installation" }));
311
363
  /**
@@ -318,13 +370,7 @@ const router = new require_router.HttpActionRouter().use(require_router.logger({
318
370
  */
319
371
  router.get("/", { handler: async (_req, { logger }) => {
320
372
  logger.debug("Getting installation execution status...");
321
- const state = await (await createInstallationStore()).get(getStorageKey());
322
- if (state) {
323
- logger.debug(`Found execution: ${state.status}`);
324
- return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: state });
325
- }
326
- logger.debug("No execution found");
327
- return (0, _adobe_aio_commerce_lib_core_responses.noContent)();
373
+ return readStateFromStore(await createInstallationStore(), (msg) => logger.debug(msg));
328
374
  } });
329
375
  /**
330
376
  * POST / - Start installation
@@ -356,17 +402,14 @@ router.post("/", {
356
402
  const initialState = require_management.createInitialInstallationState({ config: appConfig });
357
403
  logger.debug(`Created initial state: ${initialState.id}`);
358
404
  await store.put(getStorageKey(), initialState);
359
- const activation = await (0, openwhisk.default)().actions.invoke({
405
+ const ow = (0, openwhisk.default)();
406
+ const mergedParams = buildWorkflowParams(req.body, rawParams);
407
+ const activation = await ow.actions.invoke({
360
408
  name: DEFAULT_ACTION_NAME,
361
409
  blocking: false,
362
410
  result: false,
363
411
  params: {
364
- ...rawParams,
365
- appData: req.body.appData,
366
- AIO_EVENTS_API_BASE_URL: req.body.ioEventsUrl,
367
- AIO_COMMERCE_AUTH_IMS_ENVIRONMENT: req.body.ioEventsEnv,
368
- AIO_COMMERCE_API_BASE_URL: req.body.commerceBaseUrl,
369
- AIO_COMMERCE_API_FLAVOR: req.body.commerceEnv,
412
+ ...mergedParams,
370
413
  initialState,
371
414
  appConfig,
372
415
  __ow_path: "/execution",
@@ -388,18 +431,13 @@ router.post("/", {
388
431
  * It runs the actual installation workflow and saves state.
389
432
  */
390
433
  router.post("/execution", { handler: async (_req, { logger, rawParams }) => {
391
- const { appData, ...params } = rawParams;
434
+ const params = rawParams;
392
435
  const { initialState, appConfig } = params;
393
436
  if (!initialState) return (0, _adobe_aio_commerce_lib_core_responses.badRequest)("initialState is required for execution");
394
437
  if (!appConfig) return (0, _adobe_aio_commerce_lib_core_responses.badRequest)("appConfig is required for execution");
395
438
  const store = await createInstallationStore();
396
439
  const hooks = createInstallationHooks(store, (msg) => logger.debug(msg));
397
- const installationContext = {
398
- appData,
399
- params,
400
- logger,
401
- customScripts: params.customScriptsLoader?.(appConfig, logger) || {}
402
- };
440
+ const installationContext = buildInstallationContext(params, appConfig, logger);
403
441
  logger.debug(`Executing installation: ${initialState.id}`);
404
442
  const result = await require_management.runInstallation({
405
443
  installationContext,
@@ -434,14 +472,7 @@ router.post("/validation", {
434
472
  logger.debug("Running pre-installation validation...");
435
473
  const appConfig = rawParams.appConfig;
436
474
  if (!appConfig) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)("Could not find or parse the app.commerce.manifest.json file, is it present and valid?");
437
- const { appData, ...params } = {
438
- ...rawParams,
439
- appData: req.body.appData,
440
- AIO_EVENTS_API_BASE_URL: req.body.ioEventsUrl,
441
- AIO_COMMERCE_AUTH_IMS_ENVIRONMENT: req.body.ioEventsEnv,
442
- AIO_COMMERCE_API_BASE_URL: req.body.commerceBaseUrl,
443
- AIO_COMMERCE_API_FLAVOR: req.body.commerceEnv
444
- };
475
+ const { appData, ...params } = buildWorkflowParams(req.body, rawParams);
445
476
  const result = await require_management.runValidation({
446
477
  validationContext: {
447
478
  appData,
@@ -455,14 +486,107 @@ router.post("/validation", {
455
486
  }
456
487
  });
457
488
  /**
458
- * DELETE / - Clear installation state
489
+ * GET /uninstallation - Get current uninstallation status
490
+ *
491
+ * Returns 200 with state if an uninstallation has been started, 204 otherwise.
492
+ */
493
+ router.get("/uninstallation", { handler: async (_req, { logger }) => {
494
+ logger.debug("Getting uninstallation execution status...");
495
+ return readStateFromStore(await createUninstallationStore(), (msg) => logger.debug(msg));
496
+ } });
497
+ /**
498
+ * POST /uninstallation - Start uninstallation (async)
499
+ *
500
+ * Flow:
501
+ * 1. Check uninstallation store for existing state
502
+ * 2. If in-progress: return 409 Conflict
503
+ * 3. Create initial uninstall state, save to store
504
+ * 4. Invoke POST /uninstallation/execution async via openwhisk
505
+ * 5. Return 202 Accepted with initial state
506
+ */
507
+ router.post("/uninstallation", {
508
+ body: InstallationRequestBodySchema,
509
+ handler: async (req, { logger, rawParams }) => {
510
+ logger.debug("Starting async uninstallation...");
511
+ const appConfig = rawParams.appConfig;
512
+ if (!appConfig) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)("Could not find or parse the app.commerce.manifest.json file, is it present and valid?");
513
+ const store = await createUninstallationStore();
514
+ const existingState = await store.get(getStorageKey());
515
+ if (existingState && require_management.isInProgressState(existingState)) {
516
+ logger.debug(`Uninstallation already in progress: ${existingState.status}`);
517
+ return (0, _adobe_aio_commerce_lib_core_responses.conflict)("Uninstallation is already in progress. Wait for it to complete.");
518
+ }
519
+ const initialState = require_management.createInitialUninstallationState({ config: appConfig });
520
+ logger.debug(`Created initial uninstall state: ${initialState.id}`);
521
+ await store.put(getStorageKey(), initialState);
522
+ const workflowParams = buildWorkflowParams(req.body, rawParams);
523
+ const activation = await (0, openwhisk.default)().actions.invoke({
524
+ name: DEFAULT_ACTION_NAME,
525
+ blocking: false,
526
+ result: false,
527
+ params: {
528
+ ...workflowParams,
529
+ initialState,
530
+ appConfig,
531
+ __ow_path: "/uninstallation/execution",
532
+ __ow_method: "post"
533
+ }
534
+ });
535
+ logger.debug(`Async uninstallation started: ${activation.activationId}`);
536
+ return (0, _adobe_aio_commerce_lib_core_responses.accepted)({ body: {
537
+ message: "Uninstallation started",
538
+ activationId: activation.activationId,
539
+ ...initialState
540
+ } });
541
+ }
542
+ });
543
+ /**
544
+ * POST /uninstallation/execution - Execute uninstallation (internal, called async by POST /uninstallation)
545
+ *
546
+ * Flow:
547
+ * 1. Build InstallationContext from params
548
+ * 2. Run uninstallation workflow with hooks (hooks persist state per step)
549
+ * 3. Save final state to uninstallation store
550
+ * 4. On success, clear installation store
551
+ * 5. Return 200 on success, 500 on failure
552
+ */
553
+ router.post("/uninstallation/execution", { handler: async (_req, { logger, rawParams }) => {
554
+ const params = rawParams;
555
+ const { initialState, appConfig } = params;
556
+ if (!initialState) return (0, _adobe_aio_commerce_lib_core_responses.badRequest)("initialState is required for execution");
557
+ if (!appConfig) return (0, _adobe_aio_commerce_lib_core_responses.badRequest)("appConfig is required for execution");
558
+ const store = await createUninstallationStore();
559
+ const hooks = createInstallationHooks(store, (msg) => logger.debug(msg));
560
+ const installationContext = buildInstallationContext(params, appConfig, logger);
561
+ logger.debug(`Executing uninstallation: ${initialState.id}`);
562
+ const result = await require_management.runUninstallation({
563
+ installationContext,
564
+ config: appConfig,
565
+ initialState,
566
+ hooks
567
+ });
568
+ await store.put(getStorageKey(), result);
569
+ logger.debug(`Uninstallation completed: ${result.status}`);
570
+ if (require_management.isSucceededState(result)) {
571
+ await (await createInstallationStore()).delete(getStorageKey());
572
+ logger.debug("Cleared installation state after successful uninstallation");
573
+ }
574
+ if (require_management.isFailedState(result)) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)({ body: {
575
+ message: "Uninstallation failed",
576
+ error: result.error,
577
+ state: result
578
+ } });
579
+ return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: result });
580
+ } });
581
+ /**
582
+ * DELETE /uninstallation - Clear uninstallation state
459
583
  *
460
- * This endpoint allows clearing the installation state.
584
+ * Removes the stored uninstallation state without triggering any offboarding.
461
585
  */
462
- router.delete("/", { handler: async (_req, { logger }) => {
463
- logger.debug("Clearing installation state...");
464
- await (await createInstallationStore()).delete(getStorageKey());
465
- logger.debug("Installation state cleared");
586
+ router.delete("/uninstallation", { handler: async (_req, { logger }) => {
587
+ logger.debug("Clearing uninstallation state...");
588
+ await (await createUninstallationStore()).delete(getStorageKey());
589
+ logger.debug("Uninstallation state cleared");
466
590
  return (0, _adobe_aio_commerce_lib_core_responses.noContent)();
467
591
  } });
468
592
  /** Factory to create the route handler for the `installation` action. */
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel } from "../app-lymFcs59.cjs";
16
- import { V as InstallationContext } from "../index-DRhLtRrX.cjs";
17
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
15
+ import { n as CommerceAppConfigOutputModel } from "../app-DcQMhW2N.cjs";
16
+ import { q as InstallationContext } from "../index-BVwQk9bx.cjs";
17
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
18
18
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
19
19
 
20
20
  //#region source/actions/installation.d.ts
@@ -28,6 +28,6 @@ type RuntimeActionFactoryArgs = {
28
28
  declare const installationRuntimeAction: ({
29
29
  appConfig,
30
30
  customScriptsLoader
31
- }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
31
+ }: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
32
32
  //#endregion
33
33
  export { installationRuntimeAction };
@@ -12,11 +12,11 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
16
- import * as _adobe_aio_commerce_lib_core_params0 from "@adobe/aio-commerce-lib-core/params";
15
+ import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
16
+ import * as _$_adobe_aio_commerce_lib_core_params0 from "@adobe/aio-commerce-lib-core/params";
17
17
 
18
18
  //#region source/actions/scope-tree.d.ts
19
19
  /** The handler method for the `scope-tree` action. */
20
- declare const scopeTreeRuntimeAction: (args: _adobe_aio_commerce_lib_core_params0.RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
20
+ declare const scopeTreeRuntimeAction: (args: _$_adobe_aio_commerce_lib_core_params0.RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
21
21
  //#endregion
22
22
  export { scopeTreeRuntimeAction };
@@ -18,7 +18,7 @@ import * as v from "valibot";
18
18
  /** The schema used to validate the commerce app config file. */
19
19
  declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
20
20
  readonly metadata: v.ObjectSchema<{
21
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
21
+ readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 100, "The application id must not be longer than 100 characters">]>;
22
22
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
23
23
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
24
24
  readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
@@ -171,6 +171,18 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
171
171
  }, undefined>, "Expected an array of external events">;
172
172
  }, undefined>, "Expected an array of external event sources">, undefined>;
173
173
  }, undefined>, undefined>;
174
+ readonly adminUiSdk: v.OptionalSchema<v.ObjectSchema<{
175
+ readonly registration: v.ObjectSchema<{
176
+ readonly menuItems: v.ArraySchema<v.ObjectSchema<{
177
+ readonly id: v.StringSchema<undefined>;
178
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
179
+ readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
180
+ readonly sortOrder: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
181
+ readonly sandbox: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
182
+ readonly isSection: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
183
+ }, undefined>, undefined>;
184
+ }, undefined>;
185
+ }, undefined>, undefined>;
174
186
  readonly installation: v.OptionalSchema<v.ObjectSchema<{
175
187
  readonly messages: v.OptionalSchema<v.ObjectSchema<{
176
188
  readonly preInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The preInstallation message must not be longer than 1000 characters">]>, undefined>;
@@ -14,9 +14,9 @@
14
14
  */
15
15
 
16
16
  const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
- const require_validate = require('../validate-CwwYD8aC.cjs');
18
- const require_webhooks = require('../webhooks-CbZpv9y_.cjs');
19
- const require_config = require('../config-YEeaEqzi.cjs');
17
+ const require_webhooks = require('../webhooks-CLtDxwMa.cjs');
18
+ const require_validate = require('../validate-CeUCT_7k.cjs');
19
+ const require_config = require('../config-BppBKCFj.cjs');
20
20
  const require_error = require('../error-Dn7ool6k.cjs');
21
21
  const require_logging = require('../logging-4s36JTiN.cjs');
22
22
  let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
@@ -13,9 +13,9 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_validate = require('../validate-CwwYD8aC.cjs');
17
- const require_webhooks = require('../webhooks-CbZpv9y_.cjs');
18
- const require_config = require('../config-YEeaEqzi.cjs');
16
+ const require_webhooks = require('../webhooks-CLtDxwMa.cjs');
17
+ const require_validate = require('../validate-CeUCT_7k.cjs');
18
+ const require_config = require('../config-BppBKCFj.cjs');
19
19
 
20
20
  exports.CommerceAppConfigSchemas = require_validate.CommerceAppConfigSchemas;
21
21
  exports.defineConfig = require_config.defineConfig;
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as CommerceAppConfigOutputModel, t as CommerceAppConfig } from "../app-lymFcs59.cjs";
15
+ import { n as CommerceAppConfigOutputModel, t as CommerceAppConfig } from "../app-DcQMhW2N.cjs";
16
16
  import * as v from "valibot";
17
17
  import { Get, SetRequiredDeep } from "type-fest";
18
18
 
@@ -134,6 +134,18 @@ declare function defineConfig(config: CommerceAppConfig): {
134
134
  }[];
135
135
  }[] | undefined;
136
136
  } | undefined;
137
+ adminUiSdk?: {
138
+ registration: {
139
+ menuItems: {
140
+ id: string;
141
+ title?: string | undefined;
142
+ parent?: string | undefined;
143
+ sortOrder?: number | undefined;
144
+ sandbox?: string | undefined;
145
+ isSection?: boolean | undefined;
146
+ }[];
147
+ };
148
+ } | undefined;
137
149
  installation?: {
138
150
  messages?: {
139
151
  preInstallation?: string | undefined;
@@ -355,6 +367,18 @@ declare function parseCommerceAppConfig(cwd?: string): Promise<{
355
367
  }[];
356
368
  }[] | undefined;
357
369
  } | undefined;
370
+ adminUiSdk?: {
371
+ registration: {
372
+ menuItems: {
373
+ id: string;
374
+ title?: string | undefined;
375
+ parent?: string | undefined;
376
+ sortOrder?: number | undefined;
377
+ sandbox?: string | undefined;
378
+ isSection?: boolean | undefined;
379
+ }[];
380
+ };
381
+ } | undefined;
358
382
  installation?: {
359
383
  messages?: {
360
384
  preInstallation?: string | undefined;
@@ -440,7 +464,7 @@ declare function parseCommerceAppConfig(cwd?: string): Promise<{
440
464
  /** The individual validatable domains of the app config. */
441
465
  declare const CommerceAppConfigSchemas: {
442
466
  readonly metadata: v.ObjectSchema<{
443
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
467
+ readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 100, "The application id must not be longer than 100 characters">]>;
444
468
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
445
469
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
446
470
  readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
@@ -888,6 +912,18 @@ declare const CommerceAppConfigSchemas: {
888
912
  readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step name must not be longer than 255 characters">]>;
889
913
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step description must not be longer than 255 characters">]>;
890
914
  }, undefined>, "Expected an array of custom installation steps">;
915
+ readonly adminUiSdk: v.ObjectSchema<{
916
+ readonly registration: v.ObjectSchema<{
917
+ readonly menuItems: v.ArraySchema<v.ObjectSchema<{
918
+ readonly id: v.StringSchema<undefined>;
919
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
920
+ readonly parent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
921
+ readonly sortOrder: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
922
+ readonly sandbox: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
923
+ readonly isSection: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
924
+ }, undefined>, undefined>;
925
+ }, undefined>;
926
+ }, undefined>;
891
927
  };
892
928
  /** Individual validatable domains of the commerce app config. */
893
929
  type CommerceAppConfigDomain = keyof typeof CommerceAppConfigSchemas;
@@ -1169,7 +1205,7 @@ declare function hasCustomInstallationSteps(config: CommerceAppConfigOutputModel
1169
1205
  //#region source/config/schema/metadata.d.ts
1170
1206
  /** The schema for the metadata of the application. */
1171
1207
  declare const MetadataSchema: v.ObjectSchema<{
1172
- readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
1208
+ readonly id: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 100, "The application id must not be longer than 100 characters">]>;
1173
1209
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
1174
1210
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
1175
1211
  readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  const require_schemas = require('./schemas-nkIxa8sL.cjs');
16
- const require_validate = require('./validate-CwwYD8aC.cjs');
16
+ const require_validate = require('./validate-CeUCT_7k.cjs');
17
17
  const require_error = require('./error-Dn7ool6k.cjs');
18
18
  let path = require("path");
19
19
  let fs = require("fs");