@adobe/aio-commerce-lib-app 2.2.0 → 2.3.0-beta-20261202103723

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 (63) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/dist/cjs/actions/app-config/index.cjs +8 -8
  3. package/dist/cjs/actions/app-config/index.d.cts +2 -2
  4. package/dist/cjs/actions/association/index.cjs +4 -4
  5. package/dist/cjs/actions/config/index.cjs +19 -8
  6. package/dist/cjs/actions/config/index.d.cts +1 -1
  7. package/dist/cjs/actions/installation/index.cjs +39 -15
  8. package/dist/cjs/actions/installation/index.d.cts +3 -3
  9. package/dist/cjs/actions/scope-tree/index.cjs +6 -6
  10. package/dist/cjs/{app-B3bAEor-.d.cts → app-CLDvfJXp.d.cts} +634 -44
  11. package/dist/cjs/commands/index.cjs +174 -33
  12. package/dist/cjs/config/index.browser.d.cts +1 -1
  13. package/dist/cjs/config/index.node.cjs +3 -3
  14. package/dist/cjs/config/index.node.d.cts +50 -14
  15. package/dist/cjs/{define-eBMdGAq6.d.cts → define-BGpnO45V.d.cts} +1 -1
  16. package/dist/cjs/{environment-CW6M76gS.cjs → environment-CaV1hi2-.cjs} +1 -1
  17. package/dist/cjs/{index-BEeludy0.d.cts → index-p0duTbHE.d.cts} +2 -2
  18. package/dist/cjs/index.cjs +3 -3
  19. package/dist/cjs/index.d.cts +1 -1
  20. package/dist/cjs/{index.node-9bfp79rs.cjs → index.node-ECg3DGc8.cjs} +7 -6
  21. package/dist/cjs/{logging-Emi7P923.cjs → logging-r-r2bUWO.cjs} +1 -1
  22. package/dist/cjs/management/index.cjs +1 -1
  23. package/dist/cjs/management/index.d.cts +1 -1
  24. package/dist/cjs/{management-5Et1mEUp.cjs → management-CFQ4hjs6.cjs} +123 -108
  25. package/dist/cjs/{openapi-DghfuM8S.cjs → openapi-BaKoO7GY.cjs} +177 -26
  26. package/dist/cjs/{rolldown-runtime-CoOt0iuZ.cjs → rolldown-runtime-BKfnhsn2.cjs} +4 -4
  27. package/dist/cjs/{schemas-B6ITl1bG.cjs → schemas-B-jCi6Oz.cjs} +1 -1
  28. package/dist/cjs/{utils-CoR_PBHz.cjs → utils-CuzJBLgo.cjs} +2 -2
  29. package/dist/cjs/{utils-DSS0XlXq.cjs → utils-bwFwJcPW.cjs} +1 -1
  30. package/dist/cjs/{validate-BC3rnRLc.cjs → validate-DKMq3KNV.cjs} +13 -5
  31. package/dist/cjs/{version-5MonNzl5.cjs → version-BYcHBNng.cjs} +3 -3
  32. package/dist/{es/webhooks-DgaLfP36.d.mts → cjs/webhooks-BCYX3JqY.d.cts} +382 -43
  33. package/dist/cjs/{webhooks-ZPh2gVb3.cjs → webhooks-Bp1Roq8a.cjs} +70 -23
  34. package/dist/es/actions/app-config/index.d.mts +2 -2
  35. package/dist/es/actions/app-config/index.mjs +6 -6
  36. package/dist/es/actions/association/index.mjs +3 -3
  37. package/dist/es/actions/config/index.d.mts +2 -2
  38. package/dist/es/actions/config/index.mjs +19 -8
  39. package/dist/es/actions/installation/index.d.mts +4 -4
  40. package/dist/es/actions/installation/index.mjs +38 -14
  41. package/dist/es/actions/scope-tree/index.mjs +5 -5
  42. package/dist/es/{app-B3bAEor-.d.mts → app-CLDvfJXp.d.mts} +634 -44
  43. package/dist/es/commands/index.mjs +170 -29
  44. package/dist/es/config/index.browser.d.mts +1 -1
  45. package/dist/es/config/index.node.d.mts +51 -15
  46. package/dist/es/config/index.node.mjs +3 -3
  47. package/dist/es/{define-BdXyLAwb.d.mts → define-C-0hOMO3.d.mts} +1 -1
  48. package/dist/es/{environment-DUhU0_9z.mjs → environment-B1JJFHZw.mjs} +1 -1
  49. package/dist/es/{index-DE2KVXfH.d.mts → index-DYHaYwvJ.d.mts} +4 -4
  50. package/dist/es/{index-DUJtT78x.d.mts → index-U7CXicoW.d.mts} +1 -1
  51. package/dist/es/index.d.mts +2 -2
  52. package/dist/es/index.mjs +3 -3
  53. package/dist/es/{index.node-CURztkP5.mjs → index.node-ChWOTWnF.mjs} +5 -4
  54. package/dist/es/management/index.d.mts +1 -1
  55. package/dist/es/management/index.mjs +1 -1
  56. package/dist/es/{management-BAQ64OyR.mjs → management-CNMT6azj.mjs} +128 -113
  57. package/dist/es/{openapi-BvPVTUMt.mjs → openapi-ChihLuvm.mjs} +177 -26
  58. package/dist/es/{utils-DB8HaSj0.mjs → utils-Bg_LIAGV.mjs} +2 -2
  59. package/dist/es/{validate-xS9Dc-4m.mjs → validate-DeAMC-HS.mjs} +7 -5
  60. package/dist/es/{version-BWgrh_QM.mjs → version-Cj7a9rey.mjs} +1 -1
  61. package/dist/es/{webhooks-HBe_DEKA.mjs → webhooks-CyiUfRNG.mjs} +67 -20
  62. package/dist/{cjs/webhooks-DNLuuv9_.d.cts → es/webhooks-DyMAQMnm.d.mts} +382 -43
  63. package/package.json +14 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @adobe/aio-commerce-lib-app
2
2
 
3
+ ## 2.3.0-beta-20261202103723
4
+
5
+ ### Minor Changes
6
+
7
+ - [#831](https://github.com/adobe/aio-commerce-sdk/pull/831) [`6784f81`](https://github.com/adobe/aio-commerce-sdk/commit/6784f810a893a86ae84575677a7da9a22776368e) Thanks [@asalloum5](https://github.com/asalloum5)! - Add an optional `allow` field to iframe-based Admin UI entries (view mass actions, view buttons, menu, and native UI replaced pages) to grant the iframe `autoplay` and `microphone` permissions.
8
+
9
+ - [#819](https://github.com/adobe/aio-commerce-sdk/pull/819) [`7e9043f`](https://github.com/adobe/aio-commerce-sdk/commit/7e9043fc004f902c940ffe6d87e80cf10c2756c3) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Validate `runtimeAction` and `runtimeActions` references at build time. The `pre-app-build` hook now fails when a referenced action is not declared in the extension point that uses it (`commerce/backend-ui/2` for `adminUi`, `commerce/extensibility/1` for `eventing` and `webhooks`), when its `function` file is missing, or when a webhook action is not a web action. Webhook `runtimeAction` values must use the `<package>/<action>` format, and event `runtimeActions` now accept every character OpenWhisk allows in package and action names, such as `_` and `.`.
10
+
11
+ - [#811](https://github.com/adobe/aio-commerce-sdk/pull/811) [`97919e0`](https://github.com/adobe/aio-commerce-sdk/commit/97919e0f2fa652781ead6f8ff92cc9ee707f98d5) Thanks [@jcuerdo](https://github.com/jcuerdo)! - Declare Credit Memo custom-attribute grid columns with validated filters and lifecycle support, without Runtime handlers.
12
+
13
+ Provide optional section labels and descriptions for App Management lifecycle summaries.
14
+
15
+ - [#821](https://github.com/adobe/aio-commerce-sdk/pull/821) [`1a92f5e`](https://github.com/adobe/aio-commerce-sdk/commit/1a92f5e2b282975037d904ae5c60a5de88c5e890) Thanks [@jcuerdo](https://github.com/jcuerdo)! - Return the `upgradeMode` of the target config in upgrade plan previews, so App Management can tell an automatic upgrade from a manual one.
16
+
17
+ Report clearly in the `post-app-deploy` hook when another upgrade of the app is in progress or an automatic upgrade is pending.
18
+
19
+ - [#807](https://github.com/adobe/aio-commerce-sdk/pull/807) [`39206c7`](https://github.com/adobe/aio-commerce-sdk/commit/39206c7ad2c33eec537d4cfa54e7d45b4a73a1c7) Thanks [@asalloum5](https://github.com/asalloum5)! - Support `requiredFor` validation for saved business configuration values and prevent installation or upgrade from starting when required global values are missing.
20
+
21
+ ### Patch Changes
22
+
23
+ - [#822](https://github.com/adobe/aio-commerce-sdk/pull/822) [`71d7405`](https://github.com/adobe/aio-commerce-sdk/commit/71d74058ee243f182a88067e654a332c356d4ffc) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Document that the `post-app-deploy` hook works in CI with the workspace's OAuth Server-to-Server credential, and hint at the missing access when the service denies it.
24
+
25
+ - [#830](https://github.com/adobe/aio-commerce-sdk/pull/830) [`8b2859d`](https://github.com/adobe/aio-commerce-sdk/commit/8b2859dace902ec3ce72e74603aea494d9ef0733) Thanks [@asalloum5](https://github.com/asalloum5)! - Return empty password values as empty instead of masked, so clients can tell when a password is not set.
26
+ - Updated dependencies [[`39206c7`](https://github.com/adobe/aio-commerce-sdk/commit/39206c7ad2c33eec537d4cfa54e7d45b4a73a1c7), [`9b2bae1`](https://github.com/adobe/aio-commerce-sdk/commit/9b2bae1b6a20e6830a697c1fe65ea4617dcd719c), [`5763fae`](https://github.com/adobe/aio-commerce-sdk/commit/5763faeac0546809a4e468d23d2dab320a75d1ca)]:
27
+ - @adobe/aio-commerce-lib-config@1.10.0-beta-20261202103723
28
+ - @adobe/aio-commerce-lib-core@1.4.1-beta-20261202103723
29
+ - @adobe/aio-commerce-lib-admin-ui@1.3.1-beta-20261202103723
30
+ - @adobe/aio-commerce-lib-api@1.5.1-beta-20261202103723
31
+ - @adobe/aio-commerce-lib-auth@1.3.1-beta-20261202103723
32
+ - @adobe/aio-commerce-lib-events@1.6.1-beta-20261202103723
33
+ - @adobe/aio-commerce-lib-webhooks@1.3.1-beta-20261202103723
34
+
3
35
  ## 2.2.0
4
36
 
5
37
  ### Minor Changes
@@ -71,7 +103,6 @@
71
103
  - [#717](https://github.com/adobe/aio-commerce-sdk/pull/717) [`fe9135b`](https://github.com/adobe/aio-commerce-sdk/commit/fe9135b4d1a88f65cee94fe03f8bbe167bb0e1bc) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Upgrades now fix webhooks that a failed upgrade or a manual edit left missing, different or no longer declared.
72
104
 
73
105
  - [#724](https://github.com/adobe/aio-commerce-sdk/pull/724) [`36cd90a`](https://github.com/adobe/aio-commerce-sdk/commit/36cd90acde5e8713a289ad2d9470525a708cdb8d) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Several issues fixed:
74
-
75
106
  - An upgrade request that runs into another one in progress, or whose plan another request replaced, now gets a `409` with code `in-progress` or `stale-plan` instead of a `500`.
76
107
 
77
108
  - An upgrade that cannot start, for example because the app was deployed again after planning, is recorded as failed right away instead of blocking new upgrades until its deadline.
@@ -13,23 +13,23 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
17
- const require_version = require("../../version-5MonNzl5.cjs");
18
- const require_environment = require("../../environment-CW6M76gS.cjs");
19
- const require_validate = require("../../validate-BC3rnRLc.cjs");
16
+ const require_rolldown_runtime = require("../../rolldown-runtime-BKfnhsn2.cjs");
20
17
  let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
21
18
  let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
22
- let valibot = require("valibot");
23
- valibot = require_rolldown_runtime.__toESM(valibot, 1);
24
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
+ const require_version = require("../../version-BYcHBNng.cjs");
21
+ let valibot = require("valibot");
22
+ const require_environment = require("../../environment-CaV1hi2-.cjs");
23
+ const require_validate = require("../../validate-DKMq3KNV.cjs");
25
24
  let crypto = require("crypto");
25
+ valibot = require_rolldown_runtime.__toESM(valibot, 1);
26
26
 
27
27
  // source/actions/app-config/openapi.ts
28
28
  /**
29
29
  * Loads the committed OpenAPI spec via dynamic import so it
30
30
  * lands in its own chunk and is not parsed on every cold start.
31
31
  */
32
- const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-DghfuM8S.cjs"));
32
+ const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-BaKoO7GY.cjs"));
33
33
  /** Matches component schema `$ref` strings, capturing the schema name. */
34
34
  const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(?<schema>\w+)"/gu;
35
35
  /**
@@ -80,7 +80,7 @@ function pruneUnusedTags(spec) {
80
80
  * @param domains - The active config domains.
81
81
  */
82
82
  function getOpenApiCacheKey(domains) {
83
- const input = `2.2.0:${[...domains].sort().join(",")}:4.2.0`;
83
+ const input = `2.3.0-beta-20261202103723:${[...domains].sort().join(",")}:4.3.0`;
84
84
  return (0, crypto.createHash)("sha256").update(input).digest("hex").slice(0, 8);
85
85
  }
86
86
  /** 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-vAue-u_y.cjs";
16
- import { n as CommerceAppConfig } from "../../app-B3bAEor-.cjs";
17
15
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
16
+ import "../../index-vAue-u_y.cjs";
17
+ import { n as CommerceAppConfig } from "../../app-CLDvfJXp.cjs";
18
18
  /** The arguments required to create the runtime action for the app-config action. */
19
19
  type RuntimeActionFactoryArgs = {
20
20
  appConfig: CommerceAppConfig;
@@ -13,14 +13,14 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
17
- const require_version = require("../../version-5MonNzl5.cjs");
18
- const require_repository = require("../../repository-C3nn0Mon.cjs");
16
+ const require_rolldown_runtime = require("../../rolldown-runtime-BKfnhsn2.cjs");
19
17
  let _adobe_aio_commerce_lib_auth = require("@adobe/aio-commerce-lib-auth");
18
+ let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
19
+ const require_version = require("../../version-BYcHBNng.cjs");
20
+ const require_repository = require("../../repository-C3nn0Mon.cjs");
20
21
  let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
21
22
  let valibot = require("valibot");
22
23
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
23
- let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
24
24
 
25
25
  // source/actions/association/schema.ts
26
26
  /** Request body for POST / — store association data. */
@@ -13,15 +13,16 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
17
- const require_version = require("../../version-5MonNzl5.cjs");
18
- const require_environment = require("../../environment-CW6M76gS.cjs");
19
- const require_schemas = require("../../schemas-B6ITl1bG.cjs");
16
+ const require_rolldown_runtime = require("../../rolldown-runtime-BKfnhsn2.cjs");
20
17
  let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
18
+ let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
19
+ let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
+ const require_version = require("../../version-BYcHBNng.cjs");
21
+ const require_environment = require("../../environment-CaV1hi2-.cjs");
21
22
  let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
23
+ const require_schemas = require("../../schemas-B-jCi6Oz.cjs");
22
24
  let valibot = require("valibot");
23
25
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
24
- let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
25
26
 
26
27
  // source/actions/config/schema.ts
27
28
  const AcceptedConfigurationValuesSchema = valibot.union([
@@ -46,14 +47,15 @@ const PatchConfigBodySchema = valibot.object({
46
47
  // source/actions/config/router.ts
47
48
  const MASKED_PASSWORD_VALUE = "*****";
48
49
  /**
49
- * Filters password fields from the configuration values.
50
+ * Masks non-empty password values. Empty values are returned as-is so clients can tell
51
+ * whether a password is set.
50
52
  *
51
53
  * @param schema - The schema to use to filter the values.
52
54
  * @param values - The values to filter.
53
55
  */
54
56
  function filterPasswordFields(schema, values) {
55
57
  return values.map((item) => {
56
- if (schema.find((field) => field.name === item.name)?.type === "password") return {
58
+ if (schema.find((field) => field.name === item.name)?.type === "password" && (0, _adobe_aio_commerce_lib_config.isNonEmptyConfigurationValue)(item.value)) return {
57
59
  ...item,
58
60
  value: MASKED_PASSWORD_VALUE
59
61
  };
@@ -103,7 +105,16 @@ router.patch("/", {
103
105
  params: rawParams,
104
106
  schema: rawParams.configSchema
105
107
  });
106
- 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
+ let result;
109
+ try {
110
+ 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 });
111
+ } catch (error) {
112
+ if (error instanceof _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError) return (0, _adobe_aio_commerce_lib_core_responses.badRequest)({ body: {
113
+ issues: error.issues,
114
+ message: error.message
115
+ } });
116
+ throw error;
117
+ }
107
118
  result.config = filterPasswordFields(configSchema, result.config);
108
119
  return (0, _adobe_aio_commerce_lib_core_responses.ok)({
109
120
  body: result,
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
+ import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
15
16
  import "../../index-vAue-u_y.cjs";
16
17
  import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
17
- import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
18
18
  /** The arguments required to create the runtime action for the config action. */
19
19
  type ConfigActionFactoryArgs = {
20
20
  configSchema: BusinessConfigSchema;
@@ -13,25 +13,27 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
17
- const require_version = require("../../version-5MonNzl5.cjs");
18
- const require_schemas = require("../../schemas-B6ITl1bG.cjs");
19
- const require_management = require("../../management-5Et1mEUp.cjs");
20
- const require_repository = require("../../repository-C3nn0Mon.cjs");
21
- const require_webhooks = require("../../webhooks-ZPh2gVb3.cjs");
22
- const require_validate = require("../../validate-BC3rnRLc.cjs");
23
- let _adobe_aio_lib_state = require("@adobe/aio-lib-state");
24
- let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
25
- let _adobe_aio_commerce_lib_auth = require("@adobe/aio-commerce-lib-auth");
16
+ const require_rolldown_runtime = require("../../rolldown-runtime-BKfnhsn2.cjs");
17
+ let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
18
+ const require_version = require("../../version-BYcHBNng.cjs");
26
19
  let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
20
+ const require_schemas = require("../../schemas-B-jCi6Oz.cjs");
27
21
  let valibot = require("valibot");
28
- valibot = require_rolldown_runtime.__toESM(valibot, 1);
29
- let safe_stable_stringify = require("safe-stable-stringify");
30
- safe_stable_stringify = require_rolldown_runtime.__toESM(safe_stable_stringify, 1);
31
- let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
32
22
  let _adobe_aio_lib_files = require("@adobe/aio-lib-files");
23
+ let _adobe_aio_lib_state = require("@adobe/aio-lib-state");
24
+ const require_management = require("../../management-CFQ4hjs6.cjs");
25
+ let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
26
+ let _adobe_aio_commerce_lib_auth = require("@adobe/aio-commerce-lib-auth");
27
+ const require_repository = require("../../repository-C3nn0Mon.cjs");
28
+ const require_webhooks = require("../../webhooks-Bp1Roq8a.cjs");
33
29
  let openwhisk = require("openwhisk");
30
+ const require_validate = require("../../validate-DKMq3KNV.cjs");
31
+ let safe_stable_stringify = require("safe-stable-stringify");
32
+ let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
33
+ const require_environment = require("../../environment-CaV1hi2-.cjs");
34
+ valibot = require_rolldown_runtime.__toESM(valibot, 1);
34
35
  openwhisk = require_rolldown_runtime.__toESM(openwhisk, 1);
36
+ safe_stable_stringify = require_rolldown_runtime.__toESM(safe_stable_stringify, 1);
35
37
 
36
38
  // source/management/common/workflow/execute.ts
37
39
  /**
@@ -1632,7 +1634,8 @@ function toPlanPreview(plan) {
1632
1634
  })),
1633
1635
  operation: plan.operation,
1634
1636
  sourceVersion: plan.source?.appVersion ?? null,
1635
- targetVersion: plan.target?.appVersion ?? null
1637
+ targetVersion: plan.target?.appVersion ?? null,
1638
+ upgradeMode: plan.operation === "upgrade" ? plan.target?.config.metadata.upgradeMode ?? "manual" : null
1636
1639
  };
1637
1640
  }
1638
1641
 
@@ -2117,6 +2120,8 @@ async function startPlannedRequest(args) {
2117
2120
  logger.warn(`Refused to start plan ${planId} because it is for an ${pendingPlan.operation}, but the app now needs an ${operation}.`);
2118
2121
  return stalePlanConflict(`The plan is for an ${pendingPlan.operation}, but the app now needs an ${operation}. Call POST /plan again.`);
2119
2122
  }
2123
+ const validation = await validateLifecycleConfiguration(request, operation);
2124
+ if (validation) return validation;
2120
2125
  if (businessConfigOnlyVersion && !request.baseline && state) await writeBusinessConfigOnlyBaseline(request, state, businessConfigOnlyVersion);
2121
2126
  const planned = await planOperation({
2122
2127
  ...getPlanInputs(operation, request.appConfig, businessConfigOnlyVersion),
@@ -2135,6 +2140,25 @@ async function startPlannedRequest(args) {
2135
2140
  runtime: request.runtime
2136
2141
  });
2137
2142
  }
2143
+ /** Refuses a start when global configuration required by the operation is missing. */
2144
+ async function validateLifecycleConfiguration(request, operation) {
2145
+ if (operation === "uninstall" || !request.appConfig.businessConfig?.schema) return null;
2146
+ const lifecycleOperation = operation === "install" ? "installation" : "upgrade";
2147
+ if (!request.appConfig.businessConfig.schema.some((field) => field.requiredFor?.includes(lifecycleOperation))) return null;
2148
+ const schema = require_environment.filterSchemaByEnv(request.appConfig.businessConfig.schema, require_environment.getInstallCommerceEnv(request.params));
2149
+ if (!schema.some((field) => field.requiredFor?.includes(lifecycleOperation))) return null;
2150
+ await (0, _adobe_aio_commerce_lib_config.initialize)({
2151
+ params: request.params,
2152
+ schema
2153
+ });
2154
+ const missing = (await (0, _adobe_aio_commerce_lib_config.filterConfigurationFields)((field, value) => (field.requiredFor?.includes(lifecycleOperation) ?? false) && !(0, _adobe_aio_commerce_lib_config.isNonEmptyConfigurationValue)(value))).map((field) => field.name);
2155
+ if (missing.length === 0) return null;
2156
+ return (0, _adobe_aio_commerce_lib_core_responses.conflict)({ body: {
2157
+ code: "missing-required-configuration",
2158
+ fields: missing,
2159
+ message: `Required global configuration is missing for ${lifecycleOperation}: ${missing.join(", ")}.`
2160
+ } });
2161
+ }
2138
2162
  /**
2139
2163
  * Stores the Commerce instance of the request as the association record, unless a record exists.
2140
2164
  * Does nothing when the request did not supply the instance.
@@ -12,11 +12,11 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
+ import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
15
16
  import "../../index-vAue-u_y.cjs";
16
- import { it as LifecycleContext } from "../../index-BEeludy0.cjs";
17
- import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-B3bAEor-.cjs";
17
+ import { it as LifecycleContext } from "../../index-p0duTbHE.cjs";
18
+ import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-CLDvfJXp.cjs";
18
19
  import "../../types-DslZGym8.cjs";
19
- import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
20
20
  /** Loads generated custom installation script modules. */
21
21
  type CustomScriptsLoader = (config: CommerceAppConfigOutputModel, logger: LifecycleContext["logger"]) => Record<string, unknown>;
22
22
  /** Arguments for the runtime action factory. */
@@ -13,17 +13,17 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
17
- const require_version = require("../../version-5MonNzl5.cjs");
18
- const require_logging = require("../../logging-Emi7P923.cjs");
19
- const require_constants = require("../../constants-CgeVvu6f.cjs");
20
- const require_schemas = require("../../schemas-B6ITl1bG.cjs");
16
+ const require_rolldown_runtime = require("../../rolldown-runtime-BKfnhsn2.cjs");
21
17
  let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
22
18
  let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
19
+ let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
+ const require_version = require("../../version-BYcHBNng.cjs");
21
+ const require_logging = require("../../logging-r-r2bUWO.cjs");
22
+ const require_constants = require("../../constants-CgeVvu6f.cjs");
23
23
  let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
24
+ const require_schemas = require("../../schemas-B-jCi6Oz.cjs");
24
25
  let valibot = require("valibot");
25
26
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
26
- let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
27
27
 
28
28
  // source/actions/scope-tree/schema.ts
29
29
  const CustomScopeInputSchema = valibot.object({