@adobe/aio-commerce-lib-app 2.2.0 → 2.3.0-alpha-20261203134759

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 (102) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/bin/cli.mjs +22 -1
  3. package/dist/cjs/actions/app-config/index.cjs +8 -8
  4. package/dist/cjs/actions/app-config/index.d.cts +2 -2
  5. package/dist/cjs/actions/association/index.cjs +4 -4
  6. package/dist/cjs/actions/config/index.cjs +19 -8
  7. package/dist/cjs/actions/config/index.d.cts +1 -1
  8. package/dist/cjs/actions/installation/index.cjs +39 -15
  9. package/dist/cjs/actions/installation/index.d.cts +3 -3
  10. package/dist/cjs/actions/scope-tree/index.cjs +6 -6
  11. package/dist/cjs/{app-B3bAEor-.d.cts → app-Cb6-5mKk.d.cts} +637 -45
  12. package/dist/cjs/config/index.browser.d.cts +1 -1
  13. package/dist/cjs/config/index.node.cjs +11 -7
  14. package/dist/cjs/config/index.node.d.cts +150 -14
  15. package/dist/cjs/{define-eBMdGAq6.d.cts → define-Dk0uzfO9.d.cts} +1 -1
  16. package/dist/cjs/{commands → deprecated/commands}/index.cjs +1828 -864
  17. package/dist/cjs/{environment-CW6M76gS.cjs → environment-CaV1hi2-.cjs} +1 -1
  18. package/dist/cjs/{index-BEeludy0.d.cts → index-Cmxlkzpm.d.cts} +2 -2
  19. package/dist/cjs/index.cjs +3 -3
  20. package/dist/cjs/index.d.cts +1 -1
  21. package/dist/cjs/index.node-QXhLROom.cjs +117 -0
  22. package/dist/cjs/{logging-Emi7P923.cjs → logging-r-r2bUWO.cjs} +1 -1
  23. package/dist/cjs/management/index.cjs +1 -1
  24. package/dist/cjs/management/index.d.cts +1 -1
  25. package/dist/cjs/{management-5Et1mEUp.cjs → management-BX9sUQw-.cjs} +123 -108
  26. package/dist/cjs/{openapi-DghfuM8S.cjs → openapi-BaKoO7GY.cjs} +177 -26
  27. package/dist/cjs/{index.node-9bfp79rs.cjs → parser-XcHKOYKN.cjs} +46 -16
  28. package/dist/cjs/project/index.cjs +637 -0
  29. package/dist/cjs/project/index.d.cts +212 -0
  30. package/dist/cjs/{rolldown-runtime-CoOt0iuZ.cjs → rolldown-runtime-BKfnhsn2.cjs} +4 -4
  31. package/dist/cjs/{schemas-B6ITl1bG.cjs → schemas-B-jCi6Oz.cjs} +1 -1
  32. package/dist/cjs/{utils-CoR_PBHz.cjs → utils-CuzJBLgo.cjs} +2 -2
  33. package/dist/cjs/{utils-DSS0XlXq.cjs → utils-bwFwJcPW.cjs} +1 -1
  34. package/dist/cjs/{validate-BC3rnRLc.cjs → validate-BumkVjJy.cjs} +22 -6
  35. package/dist/cjs/{version-5MonNzl5.cjs → version-Bczstmvz.cjs} +3 -3
  36. package/dist/{es/webhooks-DgaLfP36.d.mts → cjs/webhooks-BBuoVWq_.d.cts} +382 -43
  37. package/dist/cjs/{webhooks-ZPh2gVb3.cjs → webhooks-VZTBeI8L.cjs} +84 -23
  38. package/dist/es/actions/app-config/index.d.mts +2 -2
  39. package/dist/es/actions/app-config/index.mjs +6 -6
  40. package/dist/es/actions/association/index.mjs +3 -3
  41. package/dist/es/actions/config/index.d.mts +2 -2
  42. package/dist/es/actions/config/index.mjs +19 -8
  43. package/dist/es/actions/installation/index.d.mts +4 -4
  44. package/dist/es/actions/installation/index.mjs +38 -14
  45. package/dist/es/actions/scope-tree/index.mjs +5 -5
  46. package/dist/es/{app-B3bAEor-.d.mts → app-Cb6-5mKk.d.mts} +637 -45
  47. package/dist/es/config/index.browser.d.mts +1 -1
  48. package/dist/es/config/index.node.d.mts +151 -15
  49. package/dist/es/config/index.node.mjs +5 -4
  50. package/dist/es/{define-BdXyLAwb.d.mts → define-D7EjSr-Z.d.mts} +1 -1
  51. package/dist/es/{commands → deprecated/commands}/index.mjs +1773 -807
  52. package/dist/es/{environment-DUhU0_9z.mjs → environment-B1JJFHZw.mjs} +1 -1
  53. package/dist/es/{index-DE2KVXfH.d.mts → index-BkqV8WU_.d.mts} +4 -4
  54. package/dist/es/{index-DUJtT78x.d.mts → index-U7CXicoW.d.mts} +1 -1
  55. package/dist/es/index.d.mts +2 -2
  56. package/dist/es/index.mjs +3 -3
  57. package/dist/es/index.node-DipCrOq_.mjs +112 -0
  58. package/dist/es/management/index.d.mts +1 -1
  59. package/dist/es/management/index.mjs +1 -1
  60. package/dist/es/{management-BAQ64OyR.mjs → management-DSu69_ub.mjs} +128 -113
  61. package/dist/es/{openapi-BvPVTUMt.mjs → openapi-ChihLuvm.mjs} +177 -26
  62. package/dist/es/{index.node-CURztkP5.mjs → parser-DdhiGXVf.mjs} +33 -15
  63. package/dist/es/project/index.d.mts +212 -0
  64. package/dist/es/project/index.mjs +636 -0
  65. package/dist/es/{utils-DB8HaSj0.mjs → utils-Bg_LIAGV.mjs} +2 -2
  66. package/dist/es/{validate-xS9Dc-4m.mjs → validate-CYWj7Nzp.mjs} +10 -6
  67. package/dist/es/{version-BWgrh_QM.mjs → version-CVSRkbJP.mjs} +1 -1
  68. package/dist/es/{webhooks-HBe_DEKA.mjs → webhooks-Ba-OdU8e.mjs} +76 -21
  69. package/dist/{cjs/webhooks-DNLuuv9_.d.cts → es/webhooks-Deujdgcm.d.mts} +382 -43
  70. package/package.json +29 -24
  71. /package/dist/cjs/{commands → deprecated/commands}/index.d.cts +0 -0
  72. /package/dist/cjs/{commands → deprecated/commands}/templates/typescript/webpack-config.cjs +0 -0
  73. /package/dist/cjs/{commands → project}/templates/admin-ui/tsconfig.json +0 -0
  74. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/.babelrc +0 -0
  75. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/index.css +0 -0
  76. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/index.html +0 -0
  77. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/app.jsx +0 -0
  78. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/components/welcome.jsx +0 -0
  79. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/pages/main-page.jsx +0 -0
  80. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src-template.d.ts +0 -0
  81. /package/dist/cjs/{commands → project}/templates/app-management/app-config.js.template +0 -0
  82. /package/dist/cjs/{commands → project}/templates/app-management/association.js.template +0 -0
  83. /package/dist/cjs/{commands → project}/templates/app-management/custom-scripts.js.template +0 -0
  84. /package/dist/cjs/{commands → project}/templates/app-management/installation.js.template +0 -0
  85. /package/dist/cjs/{commands → project}/templates/business-configuration/config.js.template +0 -0
  86. /package/dist/cjs/{commands → project}/templates/business-configuration/scope-tree.js.template +0 -0
  87. /package/dist/es/{commands → deprecated/commands}/index.d.mts +0 -0
  88. /package/dist/es/{commands → deprecated/commands}/templates/typescript/webpack-config.cjs +0 -0
  89. /package/dist/es/{commands → project}/templates/admin-ui/tsconfig.json +0 -0
  90. /package/dist/es/{commands → project}/templates/admin-ui/web-src/.babelrc +0 -0
  91. /package/dist/es/{commands → project}/templates/admin-ui/web-src/index.css +0 -0
  92. /package/dist/es/{commands → project}/templates/admin-ui/web-src/index.html +0 -0
  93. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/app.jsx +0 -0
  94. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/components/welcome.jsx +0 -0
  95. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/pages/main-page.jsx +0 -0
  96. /package/dist/es/{commands → project}/templates/admin-ui/web-src-template.d.ts +0 -0
  97. /package/dist/es/{commands → project}/templates/app-management/app-config.js.template +0 -0
  98. /package/dist/es/{commands → project}/templates/app-management/association.js.template +0 -0
  99. /package/dist/es/{commands → project}/templates/app-management/custom-scripts.js.template +0 -0
  100. /package/dist/es/{commands → project}/templates/app-management/installation.js.template +0 -0
  101. /package/dist/es/{commands → project}/templates/business-configuration/config.js.template +0 -0
  102. /package/dist/es/{commands → project}/templates/business-configuration/scope-tree.js.template +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @adobe/aio-commerce-lib-app
2
2
 
3
+ ## 2.3.0-alpha-20261203134759
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
+ - [`91f409a`](https://github.com/adobe/aio-commerce-sdk/commit/91f409adba180f17623a3c154b641e8c3d6116bc) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Deprecate the CLI binary in favor of the `aio commerce app` commands of the aio plugin `@adobe/aio-cli-plugin-commerce`. Running a deprecated command prints a warning that names its replacement.
12
+
13
+ - [`7e72d0e`](https://github.com/adobe/aio-commerce-sdk/commit/7e72d0e717ae0bf24ae2ae08ac0948df17defd9d) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Add the `./project` entry point. Its `describeProject` function returns what a project needs to work with the installed version of the library, for the `aio commerce app sync` command. The `config` entry point now exports `COMMERCE_APP_CONFIG_DOMAINS`, `COMMERCE_APP_CONFIG_DOMAIN_DEFAULTS` and `hasNamedCommerceAppConfigExports`. The deprecated `postinstall` hook removes itself from `package.json` once the project's hooks call `aio commerce app hooks`.
14
+
15
+ - [#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.
16
+
17
+ Provide optional section labels and descriptions for App Management lifecycle summaries.
18
+
19
+ - [#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.
20
+
21
+ Report clearly in the `post-app-deploy` hook when another upgrade of the app is in progress or an automatic upgrade is pending.
22
+
23
+ - [#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.
24
+
25
+ ### Patch Changes
26
+
27
+ - [`110d416`](https://github.com/adobe/aio-commerce-sdk/commit/110d416c65708e5c69aa240bf04d51eafa1f54c9) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - The deprecated CLI commands that write `.env` now quote values with `#`, quotes or whitespace so they read back as written. They create a missing `.env` without a leading blank line and end the file with a newline.
28
+
29
+ - [`00457e4`](https://github.com/adobe/aio-commerce-sdk/commit/00457e424651991d778ed968b5e25b4911fdf624) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - The log of the background upgrade watcher is now readable only by your user.
30
+
31
+ - [#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.
32
+
33
+ - [#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.
34
+
35
+ - [`8816d60`](https://github.com/adobe/aio-commerce-sdk/commit/8816d60a61ffcfc4e515cd58789be279b9cfdb39) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Upgrade commands and the post-deploy hook skip the workspace's unassociated extensions, so they act on its current association after the app was associated with another instance.
36
+
37
+ - [`101fe8e`](https://github.com/adobe/aio-commerce-sdk/commit/101fe8e64ff5c6f526c45279c5ccf0f5f13aba71) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - The `post-app-deploy` hook now keeps following an upgrade when the Commerce App Management Service answers 408, 425, 429, 500 or 504 without saying whether to retry, as it already did for 502 and 503.
38
+ - Updated dependencies [[`0c71244`](https://github.com/adobe/aio-commerce-sdk/commit/0c712442ab25b5bded5cbb9e8011c7f2534f0a80), [`91f409a`](https://github.com/adobe/aio-commerce-sdk/commit/91f409adba180f17623a3c154b641e8c3d6116bc), [`110d416`](https://github.com/adobe/aio-commerce-sdk/commit/110d416c65708e5c69aa240bf04d51eafa1f54c9), [`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)]:
39
+ - @adobe/aio-commerce-lib-core@1.4.1-alpha-20261203134759
40
+ - @adobe/aio-commerce-lib-config@1.10.0-alpha-20261203134759
41
+ - @adobe/aio-commerce-lib-auth@1.3.1-alpha-20261203134759
42
+ - @adobe/aio-commerce-lib-admin-ui@1.3.1-alpha-20261203134759
43
+ - @adobe/aio-commerce-lib-api@1.5.1-alpha-20261203134759
44
+ - @adobe/aio-commerce-lib-events@1.6.1-alpha-20261203134759
45
+ - @adobe/aio-commerce-lib-webhooks@1.3.1-alpha-20261203134759
46
+
3
47
  ## 2.2.0
4
48
 
5
49
  ### Minor Changes
@@ -71,7 +115,6 @@
71
115
  - [#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
116
 
73
117
  - [#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
118
  - 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
119
 
77
120
  - 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.
package/bin/cli.mjs CHANGED
@@ -12,8 +12,29 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
+ const REPLACEMENTS = {
16
+ generate: "aio commerce app sync",
17
+ init: "aio commerce app init",
18
+ upgrade: "aio commerce app upgrade status",
19
+ };
20
+
21
+ const [command, target] = process.argv.slice(2);
22
+
23
+ const isHookRun =
24
+ command === "hooks" || (command === "upgrade" && target === "watch");
25
+
26
+ if (!isHookRun) {
27
+ const replacement = Object.hasOwn(REPLACEMENTS, command)
28
+ ? REPLACEMENTS[command]
29
+ : "the aio commerce app commands";
30
+
31
+ console.warn(
32
+ `Warning: the aio-commerce-lib-app CLI is deprecated and will be removed in the next major version. Use ${replacement} instead, from the aio plugin @adobe/aio-cli-plugin-commerce.`,
33
+ );
34
+ }
35
+
15
36
  try {
16
- await import("../dist/es/commands/index.mjs");
37
+ await import("../dist/es/deprecated/commands/index.mjs");
17
38
  } catch (e) {
18
39
  if (e.code && e.code === "ERR_MODULE_NOT_FOUND") {
19
40
  console.error("CLI was not built!");
@@ -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-Bczstmvz.cjs");
21
+ let valibot = require("valibot");
22
+ const require_environment = require("../../environment-CaV1hi2-.cjs");
23
+ const require_validate = require("../../validate-BumkVjJy.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-alpha-20261203134759:${[...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-Cb6-5mKk.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-Bczstmvz.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-Bczstmvz.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-Bczstmvz.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-BX9sUQw-.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-VZTBeI8L.cjs");
33
29
  let openwhisk = require("openwhisk");
30
+ const require_validate = require("../../validate-BumkVjJy.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-Cmxlkzpm.cjs";
18
+ import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-Cb6-5mKk.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-Bczstmvz.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({