@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
@@ -0,0 +1,636 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { n as isTypeScriptConfig, o as typeScriptConfigPaths } from "../parser-DdhiGXVf.mjs";
16
+ import { a as hasCustomInstallationSteps, d as ADMIN_UI_MASS_ACTION_ENTITIES, f as ADMIN_UI_VIEW_BUTTON_ENTITIES, g as hasBackendUiV2Components, h as hasAdminUiView, u as ADMIN_UI_GRID_COLUMN_ENTITIES } from "../webhooks-Ba-OdU8e.mjs";
17
+ import { f as hasBusinessConfigSchema } from "../validate-CYWj7Nzp.mjs";
18
+ import { posix } from "path";
19
+ import { hasDynamicSchema } from "@adobe/aio-commerce-lib-config";
20
+ import { stringify as stringify$1 } from "safe-stable-stringify";
21
+
22
+ // source/project/paths.ts
23
+ /** The id of the extensibility extension point. */
24
+ const EXTENSIBILITY_EXTENSION_POINT_ID = "commerce/extensibility/1";
25
+ /** The id of the business configuration extension point. */
26
+ const CONFIGURATION_EXTENSION_POINT_ID = "commerce/configuration/1";
27
+ /** The id of the Admin UI extension point. */
28
+ const BACKEND_UI_V2_EXTENSION_POINT_ID = "commerce/backend-ui/2";
29
+ /** The runtime package of every action lib-app generates. */
30
+ const PACKAGE_NAME = "app-management";
31
+ /** The generated actions folder, relative to an extension point's folder. */
32
+ const GENERATED_ACTIONS_DIR = `.generated/actions/${PACKAGE_NAME}`;
33
+ /** The package import alias generated actions use for the app config. */
34
+ const APP_CONFIG_IMPORT_ALIAS = "#app.commerce.config";
35
+ /**
36
+ * A path as an ESM import specifier relative to a folder.
37
+ *
38
+ * @param fromDir - The folder that imports, relative to the project root.
39
+ * @param path - The imported file, relative to the project root.
40
+ */
41
+ function getImportSpecifier(fromDir, path) {
42
+ const specifier = posix.relative(fromDir, path);
43
+ return specifier.startsWith(".") ? specifier : `./${specifier}`;
44
+ }
45
+ /**
46
+ * The folder of an extension point, relative to the project root.
47
+ *
48
+ * @param id - The extension point id, such as `commerce/extensibility/1`.
49
+ */
50
+ function getExtensionFolder(id) {
51
+ return `src/${id.replaceAll("/", "-")}`;
52
+ }
53
+ /**
54
+ * The `ext.config.yaml` of an extension point, relative to the project root.
55
+ *
56
+ * @param id - The extension point id, such as `commerce/extensibility/1`.
57
+ */
58
+ function getExtConfigPath(id) {
59
+ return `${getExtensionFolder(id)}/ext.config.yaml`;
60
+ }
61
+ /**
62
+ * A generated file of an extension point, relative to the project root.
63
+ *
64
+ * @param id - The extension point id, such as `commerce/extensibility/1`.
65
+ * @param path - The file, relative to the extension point's `.generated` folder.
66
+ */
67
+ function getGeneratedPath(id, path) {
68
+ return posix.join(getExtensionFolder(id), ".generated", path);
69
+ }
70
+ /**
71
+ * A generated action file, relative to the project root.
72
+ *
73
+ * @param id - The extension point id, such as `commerce/extensibility/1`.
74
+ * @param action - The action name.
75
+ */
76
+ function getGeneratedActionPath(id, action) {
77
+ return posix.join(getExtensionFolder(id), GENERATED_ACTIONS_DIR, `${action}.js`);
78
+ }
79
+ /** The app manifest that generated actions read, relative to the project root. */
80
+ const MANIFEST_PATH = getGeneratedPath(EXTENSIBILITY_EXTENSION_POINT_ID, "app.commerce.manifest.json");
81
+ /** The runtime config module that generated actions import, relative to the project root. */
82
+ const RUNTIME_APP_CONFIG_PATH = getGeneratedPath(EXTENSIBILITY_EXTENSION_POINT_ID, "app.commerce.config.js");
83
+ /** The business config schema, relative to the project root. */
84
+ const CONFIG_SCHEMA_PATH = getGeneratedPath(CONFIGURATION_EXTENSION_POINT_ID, "configuration-schema.json");
85
+
86
+ // source/project/app-config.ts
87
+ /**
88
+ * An ESM module that re-exports an app config file.
89
+ *
90
+ * @param configPath - The app config file, relative to the project root.
91
+ */
92
+ function passthroughModule(configPath) {
93
+ const specifier = getImportSpecifier(posix.dirname(RUNTIME_APP_CONFIG_PATH), configPath);
94
+ return [
95
+ "// This file has been auto-generated by `@adobe/aio-commerce-lib-app`",
96
+ "// Do not modify this file directly",
97
+ "",
98
+ ...configPath.endsWith(".json") ? [
99
+ `import appConfig from "${specifier}" with { type: "json" };`,
100
+ "",
101
+ `export default /** @type {import("@adobe/aio-commerce-lib-app/config").CommerceAppConfig} */ (appConfig);`
102
+ ] : [
103
+ `import appConfig from "${specifier}";`,
104
+ "",
105
+ `export * from "${specifier}";`,
106
+ "export default appConfig;"
107
+ ],
108
+ ""
109
+ ].join("\n");
110
+ }
111
+ /**
112
+ * The app config files to generate and to remove, and the bundle to build when a TypeScript config
113
+ * can't be re-exported as is.
114
+ *
115
+ * @param config - The app config, written as the manifest when JSON can hold it.
116
+ * @param source - Where the app config comes from.
117
+ */
118
+ function describeAppConfigFiles(config, source) {
119
+ const isDynamic = hasBusinessConfigSchema(config) && hasDynamicSchema(config.businessConfig.schema);
120
+ const usesConfigModule = isDynamic || source.hasNamedExports;
121
+ const generated = {};
122
+ const obsolete = [];
123
+ let bundleAppConfig;
124
+ if (!usesConfigModule) {
125
+ generated[MANIFEST_PATH] = stringify$1(config, null, 2);
126
+ generated[RUNTIME_APP_CONFIG_PATH] = passthroughModule(MANIFEST_PATH);
127
+ } else if (isTypeScriptConfig(source.path)) {
128
+ obsolete.push(MANIFEST_PATH);
129
+ bundleAppConfig = {
130
+ entry: source.path,
131
+ outfile: RUNTIME_APP_CONFIG_PATH
132
+ };
133
+ } else {
134
+ obsolete.push(MANIFEST_PATH);
135
+ generated[RUNTIME_APP_CONFIG_PATH] = passthroughModule(source.path);
136
+ }
137
+ if (isDynamic) obsolete.push(CONFIG_SCHEMA_PATH);
138
+ else if (hasBusinessConfigSchema(config)) generated[CONFIG_SCHEMA_PATH] = stringify$1(config.businessConfig.schema, null, 2);
139
+ return {
140
+ bundleAppConfig,
141
+ generated,
142
+ obsolete
143
+ };
144
+ }
145
+
146
+ // source/project/templates/admin-ui/web-src/index.css?raw
147
+ var web_src_default$1 = "html,\nbody {\n margin: 0;\n font-family: \"Adobe Clean\", sans-serif;\n}\n";
148
+
149
+ // source/project/templates/admin-ui/web-src/index.html?raw
150
+ var web_src_default = "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta\n content=\"width=device-width, initial-scale=1.0, shrink-to-fit=no\"\n name=\"viewport\"\n >\n <title>APP_TITLE</title>\n <link href=\"./index.css\" rel=\"stylesheet\">\n </head>\n <body>\n <noscript>You need to enable JavaScript to run this app.</noscript>\n <div id=\"root\"></div>\n <script async src=\"./src/app.jsx\" type=\"module\"><\/script>\n </body>\n</html>\n";
151
+
152
+ // source/project/templates/admin-ui/web-src/src/app.jsx?raw
153
+ var app_default = "import { createExtensionApp } from \"@adobe/aio-commerce-lib-admin-ui/web\";\nimport \"@react-spectrum/s2/page.css\";\n\nimport config from \"#app.commerce.config\";\nimport { MainPage } from \"#web/pages/main-page.jsx\";\n\ncreateExtensionApp({\n menu: <MainPage />,\n metadata: {\n extensionId: config.metadata.id,\n },\n});\n";
154
+
155
+ // source/project/templates/admin-ui/web-src/src/components/welcome.jsx?raw
156
+ var welcome_default = "import { useIms } from \"@adobe/aio-commerce-lib-admin-ui/web\";\n\n/** A simple welcome component that displays the IMS token and org ID. */\nexport function Welcome() {\n const { data, error } = useIms();\n if (error) {\n throw error;\n }\n\n return (\n <>\n <h1>Welcome to your Adobe Commerce App</h1>\n <p>Your IMS Org ID is {data.imsOrgId}</p>\n </>\n );\n}\n";
157
+
158
+ // source/project/templates/admin-ui/web-src/src/pages/main-page.jsx?raw
159
+ var main_page_default = "import { Welcome } from \"#web/components/welcome.jsx\";\n\n/** Entrypoint for the main page of the app. */\nexport function MainPage() {\n return (\n <main>\n <Welcome />\n </main>\n );\n}\n";
160
+
161
+ // source/project/templates/admin-ui/web-src/.babelrc?raw
162
+ var _babelrc_raw_default = "{\n \"env\": {\n \"development\": {\n \"presets\": [\n [\"@babel/preset-react\", { \"runtime\": \"automatic\", \"development\": true }]\n ]\n },\n \"production\": {\n \"presets\": [\n [\"@babel/preset-react\", { \"runtime\": \"automatic\", \"development\": false }]\n ]\n }\n }\n}\n";
163
+
164
+ // source/project/templates/app-management/app-config.js.template?raw
165
+ var app_config_js_default = "// This file has been auto-generated by `@adobe/aio-commerce-lib-app`\n// Do not modify this file directly\n\nimport { appConfigRuntimeAction } from \"@adobe/aio-commerce-lib-app/actions/app-config\";\n\nimport appConfig from \"#app.commerce.config\";\n\nconst args = { appConfig };\nexport const main = appConfigRuntimeAction(args);\n";
166
+
167
+ // source/project/templates/app-management/association.js.template?raw
168
+ var association_js_default = "// This file has been auto-generated by `@adobe/aio-commerce-lib-app`\n// Do not modify this file directly\n\nimport { associationRuntimeAction } from \"@adobe/aio-commerce-lib-app/actions/association\";\n\nexport const main = associationRuntimeAction();\n";
169
+
170
+ // source/project/templates/app-management/custom-scripts.js.template?raw
171
+ var custom_scripts_js_default = "// {{CUSTOM_SCRIPTS_IMPORTS}}\n\nimport { defineCustomScriptsLoader } from \"@adobe/aio-commerce-lib-app/actions/installation\";\n\n/**\n * Loads custom installation scripts defined in the manifest\n */\nexport const customScriptsLoader = defineCustomScriptsLoader((appConfig, logger) => {\n const customSteps = appConfig.installation?.customInstallationSteps ?? [];\n\n if (customSteps.length === 0) {\n logger.debug(\"No custom installation scripts configured\");\n return {};\n }\n\n try {\n const loadedScripts = {\n// {{CUSTOM_SCRIPTS_MAP}}\n };\n\n logger.debug(`Loaded ${Object.keys(loadedScripts).length} custom installation script(s)`);\n return loadedScripts;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to load custom installation scripts: ${reason}`);\n throw new Error(`Failed to load custom installation scripts: ${reason}`, {\n cause: error,\n });\n }\n});\n";
172
+
173
+ // source/project/templates/app-management/installation.js.template?raw
174
+ var installation_js_default = "// This file has been auto-generated by `@adobe/aio-commerce-lib-app`\n// Do not modify this file directly\n\nimport { installationRuntimeAction } from \"@adobe/aio-commerce-lib-app/actions/installation\"\nimport appConfig from \"#app.commerce.config\";\n\n// {{CUSTOM_SCRIPTS_LOADER}}\nconst args = { appConfig };\nexport const main = installationRuntimeAction(args);\n";
175
+
176
+ // source/project/templates/business-configuration/config.js.template?raw
177
+ var config_js_default = "// This file has been auto-generated by `@adobe/aio-commerce-lib-app`\n// Do not modify this file directly\n\nimport { configRuntimeAction } from \"@adobe/aio-commerce-lib-app/actions/config\";\n\nimport config from \"#app.commerce.config\";\n\nconst businessConfig = /** @type {NonNullable<typeof config.businessConfig>} */ (\n config.businessConfig\n);\nconst configSchema = /** @type {NonNullable<typeof businessConfig.schema>} */ (\n businessConfig.schema\n);\nconst args = { configSchema };\nexport const main = configRuntimeAction(args);\n";
178
+
179
+ // source/project/templates/business-configuration/scope-tree.js.template?raw
180
+ var scope_tree_js_default = "// This file has been auto-generated by `@adobe/aio-commerce-lib-app`\n// Do not modify this file directly\n\nimport { scopeTreeRuntimeAction } from \"@adobe/aio-commerce-lib-app/actions/scope-tree\";\n\nexport const main = scopeTreeRuntimeAction;\n";
181
+
182
+ // source/project/templates.ts
183
+ /** The web-src scaffold templates, by path relative to the web-src folder. */
184
+ const WEB_SRC_TEMPLATES = {
185
+ "index.css": web_src_default$1,
186
+ "index.html": web_src_default,
187
+ "src/app.jsx": app_default,
188
+ "src/components/welcome.jsx": welcome_default,
189
+ "src/pages/main-page.jsx": main_page_default
190
+ };
191
+
192
+ // source/project/actions.ts
193
+ /** The placeholder of the custom script imports in the installation template. */
194
+ const CUSTOM_SCRIPTS_IMPORTS = "// {{CUSTOM_SCRIPTS_IMPORTS}}";
195
+ /** The placeholder of the custom script map in the installation template. */
196
+ const CUSTOM_SCRIPTS_MAP = "// {{CUSTOM_SCRIPTS_MAP}}";
197
+ /** The placeholder of the custom script loader in the installation template. */
198
+ const CUSTOM_SCRIPTS_LOADER = "// {{CUSTOM_SCRIPTS_LOADER}}";
199
+ /**
200
+ * Renders the source of the installation action, with a loader for the custom installation scripts
201
+ * when the config has any.
202
+ *
203
+ * @param config - The app config, which lists the custom installation steps.
204
+ */
205
+ function renderInstallationAction(config) {
206
+ const template = installation_js_default;
207
+ if (!hasCustomInstallationSteps(config)) return template.replace(CUSTOM_SCRIPTS_LOADER, "// No custom installation scripts configured");
208
+ const actionDir = posix.join(getExtensionFolder(EXTENSIBILITY_EXTENSION_POINT_ID), GENERATED_ACTIONS_DIR);
209
+ const steps = config.installation.customInstallationSteps;
210
+ const imports = steps.map((step, index) => `import * as customScript${index} from "${getImportSpecifier(actionDir, step.script)}";`).join("\n");
211
+ const scripts = steps.map((step, index) => ` "${step.script}": customScript${index},`).join("\n");
212
+ const loader = custom_scripts_js_default.replace(CUSTOM_SCRIPTS_IMPORTS, imports).replace(CUSTOM_SCRIPTS_MAP, scripts);
213
+ return template.replace(CUSTOM_SCRIPTS_LOADER, loader).replace("const args = { appConfig };", "const args = { appConfig, customScriptsLoader };");
214
+ }
215
+
216
+ // source/project/references.ts
217
+ /**
218
+ * The runtime actions of the worker entries in an `adminUi` config: the grid columns, then the
219
+ * worker mass actions, then the worker view buttons.
220
+ *
221
+ * @param adminUi - The Admin UI config, whose worker entries reference the actions.
222
+ */
223
+ function findAdminUiReferences(adminUi) {
224
+ const references = [];
225
+ for (const entity of ADMIN_UI_GRID_COLUMN_ENTITIES) {
226
+ const action = adminUi[entity]?.gridColumns?.runtimeAction;
227
+ if (action !== void 0) references.push({
228
+ action,
229
+ configPath: `adminUi.${entity}.gridColumns.runtimeAction`
230
+ });
231
+ }
232
+ for (const entity of ADMIN_UI_MASS_ACTION_ENTITIES) for (const [index, entry] of (adminUi[entity]?.massActions ?? []).entries()) if (entry.type === "worker") references.push({
233
+ action: entry.runtimeAction,
234
+ configPath: `adminUi.${entity}.massActions.${index}.runtimeAction`
235
+ });
236
+ for (const entity of ADMIN_UI_VIEW_BUTTON_ENTITIES) for (const [index, entry] of (adminUi[entity]?.viewButtons ?? []).entries()) if (entry.type === "worker") references.push({
237
+ action: entry.runtimeAction,
238
+ configPath: `adminUi.${entity}.viewButtons.${index}.runtimeAction`
239
+ });
240
+ return references;
241
+ }
242
+ /**
243
+ * The runtime actions the config references, with the extension point that must declare each one.
244
+ *
245
+ * @param config - The app config, whose events, webhooks and Admin UI reference the actions.
246
+ */
247
+ function findActionReferences(config) {
248
+ const references = [];
249
+ for (const source of ["commerce", "external"]) for (const [i, provider] of (config.eventing?.[source] ?? []).entries()) for (const [j, event] of provider.events.entries()) for (const [k, action] of event.runtimeActions.entries()) references.push({
250
+ action,
251
+ configPath: `eventing.${source}.${i}.events.${j}.runtimeActions.${k}`,
252
+ extensionPointId: EXTENSIBILITY_EXTENSION_POINT_ID,
253
+ web: false
254
+ });
255
+ for (const [index, webhook] of (config.webhooks ?? []).entries()) if ("runtimeAction" in webhook) references.push({
256
+ action: webhook.runtimeAction,
257
+ configPath: `webhooks.${index}.runtimeAction`,
258
+ extensionPointId: EXTENSIBILITY_EXTENSION_POINT_ID,
259
+ web: true
260
+ });
261
+ if (hasBackendUiV2Components(config)) for (const reference of findAdminUiReferences(config.adminUi)) references.push({
262
+ ...reference,
263
+ extensionPointId: BACKEND_UI_V2_EXTENSION_POINT_ID,
264
+ web: false
265
+ });
266
+ return references;
267
+ }
268
+
269
+ // source/project/extensions.ts
270
+ /** The hook commands of the deprecated `aio-commerce-lib-app` binary. */
271
+ const OBSOLETE_HOOK_COMMANDS = ["aio-commerce-lib-app hooks"];
272
+ /** Inputs superseded by the `include-ims-credentials` action annotation. */
273
+ const LEGACY_IMS_CREDENTIAL_INPUTS = [
274
+ "AIO_COMMERCE_AUTH_IMS_CLIENT_ID",
275
+ "AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS",
276
+ "AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID",
277
+ "AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL",
278
+ "AIO_COMMERCE_AUTH_IMS_ORG_ID",
279
+ "AIO_COMMERCE_AUTH_IMS_SCOPES"
280
+ ];
281
+ /** The input that gives an action its log level. */
282
+ const LOG_LEVEL_INPUT = "LOG_LEVEL";
283
+ /** The value of {@link LOG_LEVEL_INPUT}, read from the environment. */
284
+ const LOG_LEVEL_VALUE = "$LOG_LEVEL";
285
+ /** The input that gives an action the business config encryption key. */
286
+ const ENCRYPTION_KEY_INPUT = "AIO_COMMERCE_CONFIG_ENCRYPTION_KEY";
287
+ /**
288
+ * Hook commands for an extension point.
289
+ *
290
+ * @param id - The extension point id, such as `commerce/extensibility/1`.
291
+ * @param hooks - The App Builder hooks it needs, such as `pre-app-build`.
292
+ */
293
+ function hookCommands(id, hooks) {
294
+ return Object.fromEntries(hooks.map((hook) => [hook, `aio commerce app hooks ${hook} --extension ${id}`]));
295
+ }
296
+ /**
297
+ * A generated runtime action.
298
+ *
299
+ * @param name - The action name, which names its file.
300
+ * @param content - The content of its file.
301
+ * @param options - What the action needs besides the defaults.
302
+ */
303
+ function action(name, content, { encryptionKey = false, imsCredentials = false, timeout } = {}) {
304
+ const needs = {
305
+ annotations: {
306
+ final: true,
307
+ "require-adobe-auth": true
308
+ },
309
+ defaults: { runtime: "nodejs:26" },
310
+ function: `${GENERATED_ACTIONS_DIR}/${name}.js`,
311
+ inputs: {},
312
+ web: "yes"
313
+ };
314
+ if (imsCredentials) needs.annotations["include-ims-credentials"] = true;
315
+ if (encryptionKey) needs.inputs[ENCRYPTION_KEY_INPUT] = `$${ENCRYPTION_KEY_INPUT}`;
316
+ if (timeout !== void 0) needs.limits = { timeout };
317
+ return {
318
+ content,
319
+ needs
320
+ };
321
+ }
322
+ /**
323
+ * Action inputs that the package inputs and the `include-ims-credentials` annotation replaced.
324
+ *
325
+ * @param actions - The generated actions by name.
326
+ */
327
+ function obsoleteInputs(actions) {
328
+ return Object.entries(actions).flatMap(([name, { annotations }]) => {
329
+ const id = `${PACKAGE_NAME}/${name}`;
330
+ return [...annotations["include-ims-credentials"] ? LEGACY_IMS_CREDENTIAL_INPUTS.map((input) => ({
331
+ action: id,
332
+ input
333
+ })) : [], {
334
+ action: id,
335
+ input: LOG_LEVEL_INPUT,
336
+ value: LOG_LEVEL_VALUE
337
+ }];
338
+ });
339
+ }
340
+ /**
341
+ * An extension point that holds generated actions, and the files of those actions by path.
342
+ *
343
+ * @param id - The extension point id, such as `commerce/extensibility/1`.
344
+ * @param hooks - The App Builder hooks it needs, such as `pre-app-build`.
345
+ * @param generatedActions - The generated actions by name.
346
+ */
347
+ function actionsExtension(id, hooks, generatedActions) {
348
+ const actions = {};
349
+ const files = {};
350
+ for (const [name, { content, needs }] of Object.entries(generatedActions)) {
351
+ actions[name] = needs;
352
+ files[getGeneratedActionPath(id, name)] = content;
353
+ }
354
+ return {
355
+ extension: {
356
+ extConfigPath: getExtConfigPath(id),
357
+ extensionPointId: id,
358
+ hooks: hookCommands(id, hooks),
359
+ obsoleteInputs: obsoleteInputs(actions),
360
+ packages: { [PACKAGE_NAME]: {
361
+ actions,
362
+ inputs: { [LOG_LEVEL_INPUT]: LOG_LEVEL_VALUE },
363
+ license: "Apache-2.0"
364
+ } },
365
+ view: [],
366
+ workerProcess: Object.keys(actions).map((name) => `${PACKAGE_NAME}/${name}`)
367
+ },
368
+ files
369
+ };
370
+ }
371
+ /**
372
+ * The extensibility extension point, which every app needs for app management.
373
+ *
374
+ * @param config - The app config, whose custom installation steps the installation action loads.
375
+ * @param needsEncryptionKey - Whether the installation action needs the encryption key of the
376
+ * business config.
377
+ */
378
+ function describeExtensibilityExtension(config, needsEncryptionKey) {
379
+ return actionsExtension(EXTENSIBILITY_EXTENSION_POINT_ID, ["pre-app-build", "post-app-deploy"], {
380
+ "app-config": action("app-config", app_config_js_default),
381
+ association: action("association", association_js_default, { imsCredentials: true }),
382
+ installation: action("installation", renderInstallationAction(config), {
383
+ encryptionKey: needsEncryptionKey,
384
+ imsCredentials: true,
385
+ timeout: 6e5
386
+ })
387
+ });
388
+ }
389
+ /** The configuration extension point, which serves the business configuration. */
390
+ function describeConfigurationExtension() {
391
+ return actionsExtension(CONFIGURATION_EXTENSION_POINT_ID, ["pre-app-build"], {
392
+ config: action("config", config_js_default, { encryptionKey: true }),
393
+ "scope-tree": action("scope-tree", scope_tree_js_default)
394
+ });
395
+ }
396
+ /**
397
+ * The Admin UI extension point.
398
+ *
399
+ * @param adminUi - The Admin UI config, whose worker entries name the actions.
400
+ */
401
+ function describeBackendUiExtension(adminUi) {
402
+ const id = BACKEND_UI_V2_EXTENSION_POINT_ID;
403
+ const extension = {
404
+ extConfigPath: getExtConfigPath(id),
405
+ extensionPointId: id,
406
+ hooks: hookCommands(id, [
407
+ "pre-app-build",
408
+ "pre-app-dev",
409
+ "pre-app-run"
410
+ ]),
411
+ obsoleteInputs: [],
412
+ packages: {},
413
+ view: [],
414
+ workerProcess: [...new Set(findAdminUiReferences(adminUi).map((reference) => reference.action))]
415
+ };
416
+ if (hasAdminUiView(adminUi)) {
417
+ extension.view = ["index.html"];
418
+ extension.web = "web-src";
419
+ }
420
+ return extension;
421
+ }
422
+
423
+ // source/project/typescript.ts
424
+ /** The content of the root `tsconfig.json`. */
425
+ const ROOT_TYPESCRIPT_CONFIG = {
426
+ compilerOptions: {
427
+ allowJs: true,
428
+ checkJs: true,
429
+ module: "esnext",
430
+ moduleResolution: "bundler",
431
+ noEmit: true
432
+ },
433
+ exclude: ["src/**/web-src/**"],
434
+ extends: [
435
+ "@tsconfig/bases/recommended",
436
+ "@tsconfig/bases/node-ts",
437
+ "@tsconfig/bases/node24"
438
+ ],
439
+ include: [
440
+ "src/**/.generated/actions/**/*.js",
441
+ ...typeScriptConfigPaths,
442
+ "src/**/*.ts",
443
+ "src/**/*.mts",
444
+ "src/**/*.cts"
445
+ ]
446
+ };
447
+ /** The root `tsconfig.json`, which type-checks the app config and the generated actions. */
448
+ const TYPESCRIPT_SCAFFOLD = { files: { "tsconfig.json": `${JSON.stringify(ROOT_TYPESCRIPT_CONFIG, null, 2)}\n` } };
449
+ /** What `package.json` needs to type-check a TypeScript project. */
450
+ const TYPESCRIPT_PACKAGE = {
451
+ devDependencies: {
452
+ "@tsconfig/bases": "^1.0.26",
453
+ "@types/node": "^24.12.0",
454
+ typescript: "^6.0.3"
455
+ },
456
+ scripts: [{
457
+ command: "tsc --noEmit -p tsconfig.json",
458
+ name: "typecheck:actions",
459
+ partOf: "typecheck"
460
+ }]
461
+ };
462
+
463
+ // source/project/web-src.ts
464
+ /** The web-src folder of the Admin UI extension point, relative to the project root. */
465
+ const WEB_SRC_DIR = posix.join(getExtensionFolder(BACKEND_UI_V2_EXTENSION_POINT_ID), "web-src");
466
+ /** The placeholder of the app title in the web-src templates. */
467
+ const APP_TITLE_PLACEHOLDER = "APP_TITLE";
468
+ const JSX_FILE = /\.jsx$/u;
469
+ /** The Babel packages that the web-src `.babelrc` needs. */
470
+ const BABEL_DEV_DEPENDENCIES = {
471
+ "@babel/core": "^7.29.7",
472
+ "@babel/preset-react": "^7.29.7"
473
+ };
474
+ /** The content of the web-src `tsconfig.json`. */
475
+ const WEB_SRC_TYPESCRIPT_CONFIG = {
476
+ compilerOptions: {
477
+ allowImportingTsExtensions: true,
478
+ allowJs: true,
479
+ checkJs: true,
480
+ jsx: "react-jsx",
481
+ jsxImportSource: "react",
482
+ module: "esnext",
483
+ moduleResolution: "bundler",
484
+ noEmit: true,
485
+ rewriteRelativeImportExtensions: false
486
+ },
487
+ extends: ["@tsconfig/bases/recommended"],
488
+ include: [
489
+ "src/**/*.js",
490
+ "src/**/*.ts",
491
+ "src/**/*.tsx",
492
+ "src/**/*.jsx"
493
+ ]
494
+ };
495
+ /** Settings Parcel needs to bundle React Spectrum S2 and the ESM exports of lib-admin-ui. */
496
+ const PARCEL_FIELDS = [{
497
+ path: ["@parcel/bundler-default", "manualSharedBundles"],
498
+ value: [{
499
+ assets: ["**/@react-spectrum/s2/**", `${WEB_SRC_DIR}/*.{js,jsx,ts,tsx}`],
500
+ name: "s2-styles",
501
+ types: ["css"]
502
+ }]
503
+ }, {
504
+ path: ["@parcel/resolver-default", "packageExports"],
505
+ value: true
506
+ }];
507
+ /** The import alias of the web-src source folder. */
508
+ const WEB_SRC_IMPORT_ALIAS = { "#web/*": `./${WEB_SRC_DIR}/src/*` };
509
+ /**
510
+ * A web-src template as a TypeScript file: `.jsx` files and the imports of them become `.tsx`.
511
+ *
512
+ * @param path - The template path.
513
+ * @param content - The template content.
514
+ */
515
+ function toTypeScript(path, content) {
516
+ return {
517
+ content: content.replaceAll(".jsx\"", ".tsx\""),
518
+ path: path.replace(JSX_FILE, ".tsx")
519
+ };
520
+ }
521
+ /**
522
+ * The web-src scaffolds of an Admin UI with a view.
523
+ *
524
+ * @param appTitle - The title of the generated page.
525
+ * @param typeScript - Whether the scaffold uses TypeScript.
526
+ */
527
+ function describeWebSrcScaffolds(appTitle, typeScript) {
528
+ const entrypoint = posix.join(WEB_SRC_DIR, "index.html");
529
+ const files = {};
530
+ for (const [templatePath, template] of Object.entries(WEB_SRC_TEMPLATES)) {
531
+ const { path, content } = typeScript ? toTypeScript(templatePath, template) : {
532
+ content: template,
533
+ path: templatePath
534
+ };
535
+ files[posix.join(WEB_SRC_DIR, path)] = content.replaceAll(APP_TITLE_PLACEHOLDER, appTitle);
536
+ }
537
+ const packageNeeds = {
538
+ dependencies: {
539
+ "@adobe/aio-commerce-lib-admin-ui": "^1.3.1-alpha-20261203134759",
540
+ "@react-spectrum/s2": "^1.5.1",
541
+ react: "^19.2.7",
542
+ "react-dom": "^19.2.7"
543
+ },
544
+ devDependencies: {
545
+ ...BABEL_DEV_DEPENDENCIES,
546
+ "@types/react": "^19.2.17",
547
+ "@types/react-dom": "^19.2.3"
548
+ },
549
+ fields: PARCEL_FIELDS
550
+ };
551
+ if (typeScript) {
552
+ const tsconfigPath = posix.join(WEB_SRC_DIR, "tsconfig.json");
553
+ files[tsconfigPath] = `${JSON.stringify(WEB_SRC_TYPESCRIPT_CONFIG, null, 2)}\n`;
554
+ packageNeeds.scripts = [{
555
+ command: `tsc --noEmit -p ${tsconfigPath}`,
556
+ name: "typecheck:web-src",
557
+ partOf: "typecheck"
558
+ }];
559
+ }
560
+ return [{
561
+ files,
562
+ package: packageNeeds,
563
+ unlessExists: [entrypoint]
564
+ }, {
565
+ files: { [posix.join(WEB_SRC_DIR, ".babelrc")]: _babelrc_raw_default },
566
+ package: { devDependencies: BABEL_DEV_DEPENDENCIES }
567
+ }];
568
+ }
569
+
570
+ // source/project/describe.ts
571
+ /**
572
+ * Describes what a project needs to work with this version of lib-app: the files lib-app owns, the
573
+ * extension points and their `ext.config.yaml` entries, and what `package.json` needs. The result
574
+ * depends only on the arguments.
575
+ *
576
+ * @param config - The validated app config.
577
+ * @param source - Where the app config comes from.
578
+ *
579
+ * @example
580
+ * ```ts
581
+ * import { hasNamedCommerceAppConfigExports, parseCommerceAppConfig } from "@adobe/aio-commerce-lib-app/config";
582
+ * import { describeProject } from "@adobe/aio-commerce-lib-app/project";
583
+ *
584
+ * const description = describeProject(await parseCommerceAppConfig(root), {
585
+ * path: "app.commerce.config.ts",
586
+ * hasNamedExports: await hasNamedCommerceAppConfigExports(root),
587
+ * });
588
+ * ```
589
+ */
590
+ function describeProject(config, source) {
591
+ const typeScript = isTypeScriptConfig(source.path);
592
+ const businessConfigSchema = hasBusinessConfigSchema(config);
593
+ const backendUi = hasBackendUiV2Components(config) ? describeBackendUiExtension(config.adminUi) : void 0;
594
+ const web = backendUi?.web !== void 0;
595
+ const encryptionKey = businessConfigSchema && config.businessConfig.schema.some((field) => field.type === "password");
596
+ const appConfig = describeAppConfigFiles(config, source);
597
+ const configuration = businessConfigSchema ? describeConfigurationExtension() : void 0;
598
+ const extensibility = describeExtensibilityExtension(config, encryptionKey);
599
+ const extensions = [
600
+ backendUi,
601
+ configuration?.extension,
602
+ extensibility.extension
603
+ ].filter((extension) => extension !== void 0);
604
+ const generated = {
605
+ ...appConfig.generated,
606
+ ...configuration?.files,
607
+ ...extensibility.files
608
+ };
609
+ const scaffolds = [...typeScript ? [TYPESCRIPT_SCAFFOLD] : [], ...web ? describeWebSrcScaffolds(config.metadata.displayName, typeScript) : []];
610
+ const packageNeeds = {
611
+ ...typeScript && TYPESCRIPT_PACKAGE,
612
+ dependencies: businessConfigSchema ? { "@adobe/aio-commerce-lib-config": "^1.10.0-alpha-20261203134759" } : {},
613
+ imports: {
614
+ [APP_CONFIG_IMPORT_ALIAS]: `./${RUNTIME_APP_CONFIG_PATH}`,
615
+ ...web && WEB_SRC_IMPORT_ALIAS
616
+ }
617
+ };
618
+ return {
619
+ actionReferences: findActionReferences(config),
620
+ after: {
621
+ bundleAppConfig: appConfig.bundleAppConfig,
622
+ encryptionKey
623
+ },
624
+ extensions,
625
+ files: {
626
+ generated,
627
+ obsolete: appConfig.obsolete,
628
+ scaffolds
629
+ },
630
+ obsoleteHookCommands: OBSOLETE_HOOK_COMMANDS,
631
+ package: packageNeeds,
632
+ typeScriptActions: typeScript
633
+ };
634
+ }
635
+
636
+ export { describeProject };
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { t as appliesToEnv } from "./environment-DUhU0_9z.mjs";
16
- import { getSystemConfigByKey, setSystemConfigByKey } from "@adobe/aio-commerce-lib-config";
17
15
  import { resolveAuthParams } from "@adobe/aio-commerce-lib-auth";
16
+ import { getSystemConfigByKey, setSystemConfigByKey } from "@adobe/aio-commerce-lib-config";
17
+ import { t as appliesToEnv } from "./environment-B1JJFHZw.mjs";
18
18
 
19
19
  // source/management/domains/events/utils.ts
20
20
  const COMMERCE_PROVIDER_TYPE = "dx_commerce_events";