@adobe/aio-commerce-lib-app 1.8.0-beta-20260721105643 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -47
- package/dist/cjs/actions/app-config/index.cjs +2 -2
- package/dist/cjs/commands/index.cjs +16 -11
- package/dist/cjs/config/index.node.cjs +1 -1
- package/dist/cjs/{index.node-gWAIhXSG.cjs → index.node-BWZuZLgs.cjs} +25 -9
- package/dist/cjs/{openapi-CwytYdWl.cjs → openapi-C36q3dCZ.cjs} +1 -1
- package/dist/es/actions/app-config/index.mjs +2 -2
- package/dist/es/commands/index.mjs +15 -10
- package/dist/es/config/index.node.mjs +1 -1
- package/dist/es/{index.node-BkSA7XIO.mjs → index.node-DuvW9Sha.mjs} +20 -10
- package/dist/es/{openapi-CXonvevE.mjs → openapi-BSc2NRd2.mjs} +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,96 +1,59 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-app
|
|
2
2
|
|
|
3
|
-
## 1.8.0
|
|
4
|
-
### Minor Changes
|
|
5
|
-
|
|
3
|
+
## 1.8.0
|
|
6
4
|
|
|
5
|
+
### Minor Changes
|
|
7
6
|
|
|
8
7
|
- [#528](https://github.com/adobe/aio-commerce-sdk/pull/528) [`0bb7d15`](https://github.com/adobe/aio-commerce-sdk/commit/0bb7d150961f631116b1ac421124960b5b857896) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Add the optional `aclProtected` field to Admin UI grid columns, mass actions, and order view buttons. When `true`, Commerce auto-generates a per-app ACL resource for the component from `metadata.id` for role-based access control, matching the existing menu behaviour.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
9
|
- [#522](https://github.com/adobe/aio-commerce-sdk/pull/522) [`4396a64`](https://github.com/adobe/aio-commerce-sdk/commit/4396a647ad22dba063cdf03a16e04aef9387212f) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Add optional `aclProtected` field to Admin UI menu configuration. When `true`, Commerce auto-generates a per-app ACL resource from `metadata.id` for role-based menu access control.
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
11
|
- [#561](https://github.com/adobe/aio-commerce-sdk/pull/561) [`e85bec4`](https://github.com/adobe/aio-commerce-sdk/commit/e85bec40f1eaa91dd6bb7bc6954b2ecfc3ea4029) Thanks [@jcuerdo](https://github.com/jcuerdo)! - New `publishEvent` export for publishing a configured I/O Event from a runtime action by provider key and event name as declared in `app.commerce.config.ts`. Provider and event resolution happens automatically from metadata stored at installation time.
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
13
|
- [#511](https://github.com/adobe/aio-commerce-sdk/pull/511) [`caed6d5`](https://github.com/adobe/aio-commerce-sdk/commit/caed6d5cbc526bc980221a06a59542427752a1ab) Thanks [@vinayrao2000](https://github.com/vinayrao2000)! - Add helpers to retrieve the Commerce instance an app is associated with from any runtime action: `getCommerceInstance()` returns the stored instance data, and `getCommerceClient(auth)` returns a ready-to-use Commerce HTTP client built from that instance.
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
15
|
- [#508](https://github.com/adobe/aio-commerce-sdk/pull/508) [`c36f825`](https://github.com/adobe/aio-commerce-sdk/commit/c36f825aff7329fc2831d8aaca032d17bbee373a) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Add support for Admin UI menus in `commerce/backend-ui/2` via `adminUi.menu`.
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
17
|
- [#577](https://github.com/adobe/aio-commerce-sdk/pull/577) [`c78eae9`](https://github.com/adobe/aio-commerce-sdk/commit/c78eae9bb656f1b9698703685619f7d7f922be75) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Added `resolveIoEventCode` to compute an event's I/O Events event code from an app ID, event name, and provider type.
|
|
29
18
|
|
|
30
|
-
|
|
31
|
-
|
|
32
19
|
- [#551](https://github.com/adobe/aio-commerce-sdk/pull/551) [`a66f389`](https://github.com/adobe/aio-commerce-sdk/commit/a66f3892622584d27cd6b5d2fc633e15bf9942a8) Thanks [@asalloum5](https://github.com/asalloum5)! - The app installation flow now enables the Admin UI SDK in Commerce before registering the extension, so Admin UI extensions are served correctly after install.
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
21
|
- [#510](https://github.com/adobe/aio-commerce-sdk/pull/510) [`ce7768e`](https://github.com/adobe/aio-commerce-sdk/commit/ce7768e0ddc6ca35ad6ccec60f584c8bb5a743f0) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Webhooks and events now accept an optional `env` array (`"paas"` / `"saas"`) to scope them to specific Commerce environments. Items without `env` apply everywhere; scoped items are only installed on matching environments, and an event provider left with no applicable events is skipped entirely. The `app-config` action also accepts an optional `commerceEnv` query param that returns business-config fields, webhooks, and events already filtered to that environment. The installation and `scope-tree` actions now validate `commerceEnv` against the supported values (`"paas"` / `"saas"`) instead of accepting any string; this only rejects values that were never valid in practice.
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
|
|
40
23
|
- [#578](https://github.com/adobe/aio-commerce-sdk/pull/578) [`bcc02f2`](https://github.com/adobe/aio-commerce-sdk/commit/bcc02f26e8e5a58c8618f6b1b94dee70dd86a1a7) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - The generated `#app.commerce.config` module now re-exports any named exports from your `app.commerce.config.*` file, in addition to its default export.
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
|
|
44
25
|
- [#486](https://github.com/adobe/aio-commerce-sdk/pull/486) [`413da36`](https://github.com/adobe/aio-commerce-sdk/commit/413da36dcd83e5a41c194f5af50611097659e725) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Add support for Admin UI grid column extensions on `commerce/backend-ui/2`.
|
|
45
26
|
|
|
46
|
-
|
|
47
|
-
|
|
48
27
|
- [#512](https://github.com/adobe/aio-commerce-sdk/pull/512) [`b259e61`](https://github.com/adobe/aio-commerce-sdk/commit/b259e61c05bcb7a025486d1515ce644fb6f4265b) Thanks [@jcuerdo](https://github.com/jcuerdo)! - Remove `commerce/backend-ui/1` support and the `adminUiSdk` config key. Migrate to `adminUi` and `commerce/backend-ui/2`.
|
|
49
|
-
|
|
50
|
-
**Migration:** Replace `adminUiSdk` in your `app.commerce.config.*` with the `adminUi` config key. See the updated `usage.md` for the new shape. The generated `src/commerce-backend-ui-1/` directory and its `pre-app-build` hook can be removed from your project.
|
|
51
28
|
|
|
29
|
+
**Migration:** Replace `adminUiSdk` in your `app.commerce.config.*` with the `adminUi` config key. See the updated `usage.md` for the new shape. The generated `src/commerce-backend-ui-1/` directory and its `pre-app-build` hook can be removed from your project.
|
|
52
30
|
|
|
53
31
|
- [#492](https://github.com/adobe/aio-commerce-sdk/pull/492) [`ce63b2b`](https://github.com/adobe/aio-commerce-sdk/commit/ce63b2b46f7ef1f2f68780b13e52d1c13fd5fe6e) Thanks [@jcuerdo](https://github.com/jcuerdo)! - Support Admin UI SDK v2 mass actions. Declare mass actions under `adminUi` with explicit `type: "view"` (iframe) or `type: "worker"` (runtime action), support for notifications, and a unified `selectionLimit` across Order, Product, and Customer entities.
|
|
54
32
|
|
|
55
|
-
|
|
56
|
-
|
|
57
33
|
- [#534](https://github.com/adobe/aio-commerce-sdk/pull/534) [`b33ad74`](https://github.com/adobe/aio-commerce-sdk/commit/b33ad741c30262279180496ab28a82516569a17f) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Uninstallation now removes exactly the resources that were created at install time, even when the app configuration has since changed. Installs created before this change fall back to the current request config. The installation/uninstallation status responses now include an optional `config` field recording what was applied.
|
|
58
34
|
|
|
59
|
-
|
|
60
|
-
|
|
61
35
|
- [#548](https://github.com/adobe/aio-commerce-sdk/pull/548) [`7670e39`](https://github.com/adobe/aio-commerce-sdk/commit/7670e39ae3cdf1172d9d9f09f0f100c19966d5a0) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Implement initial web source scaffolding for projects with Admin UI view operations
|
|
62
36
|
|
|
63
|
-
|
|
64
|
-
|
|
65
37
|
- [#506](https://github.com/adobe/aio-commerce-sdk/pull/506) [`a18d900`](https://github.com/adobe/aio-commerce-sdk/commit/a18d900771df65a025dde2146da8422f08c5e4ae) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Add `adminUi.order.viewButtons` support on `commerce/backend-ui/2`, with `type: "view"` (iframe) and `type: "worker"` (runtime action) variants.
|
|
66
38
|
|
|
67
|
-
|
|
68
39
|
### Patch Changes
|
|
69
40
|
|
|
70
|
-
|
|
71
|
-
|
|
72
41
|
- [#576](https://github.com/adobe/aio-commerce-sdk/pull/576) [`b0c86a5`](https://github.com/adobe/aio-commerce-sdk/commit/b0c86a512965a691b3497ff1c286249508297388) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Commerce and external event names are now validated to be non-empty and unique within each provider in `app.commerce.config.ts`.
|
|
73
42
|
|
|
74
|
-
|
|
75
|
-
|
|
76
43
|
- [#525](https://github.com/adobe/aio-commerce-sdk/pull/525) [`2e40262`](https://github.com/adobe/aio-commerce-sdk/commit/2e402628f1cd21a85dfb7c8dc3660a454f1053c0) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Characters in `metadata.id` that are disallowed by the Commerce Eventing API, such as hyphens, are now normalized to underscores in the generated event code.
|
|
77
44
|
|
|
78
|
-
|
|
79
|
-
|
|
80
45
|
- [#528](https://github.com/adobe/aio-commerce-sdk/pull/528) [`0bb7d15`](https://github.com/adobe/aio-commerce-sdk/commit/0bb7d150961f631116b1ac421124960b5b857896) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Grid column entries in `adminUi` config now reject unknown keys (strict validation), so a mistyped field such as `aclprotected` surfaces a validation error instead of being silently dropped — matching the existing behavior of mass actions and view buttons.
|
|
81
46
|
|
|
82
|
-
|
|
83
|
-
|
|
84
47
|
- [#548](https://github.com/adobe/aio-commerce-sdk/pull/548) [`7670e39`](https://github.com/adobe/aio-commerce-sdk/commit/7670e39ae3cdf1172d9d9f09f0f100c19966d5a0) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - For static business configs, the `#app.commerce.config` alias now resolves to a generated ESM module that re-exports the app manifest, so generated runtime actions can import it directly without needing a JSON import attribute.
|
|
85
48
|
|
|
86
49
|
- Updated dependencies [[`0bb7d15`](https://github.com/adobe/aio-commerce-sdk/commit/0bb7d150961f631116b1ac421124960b5b857896), [`4396a64`](https://github.com/adobe/aio-commerce-sdk/commit/4396a647ad22dba063cdf03a16e04aef9387212f), [`c15b50f`](https://github.com/adobe/aio-commerce-sdk/commit/c15b50f667e6d1288270dbd4192c150db0ff0914), [`c36f825`](https://github.com/adobe/aio-commerce-sdk/commit/c36f825aff7329fc2831d8aaca032d17bbee373a), [`bdcced9`](https://github.com/adobe/aio-commerce-sdk/commit/bdcced9297ae5e1b87ce86490a2b6fad76b2e341), [`19400fb`](https://github.com/adobe/aio-commerce-sdk/commit/19400fbdfc03c5bbfc30f995a2acdd4272c5e032), [`e85bec4`](https://github.com/adobe/aio-commerce-sdk/commit/e85bec40f1eaa91dd6bb7bc6954b2ecfc3ea4029), [`a66f389`](https://github.com/adobe/aio-commerce-sdk/commit/a66f3892622584d27cd6b5d2fc633e15bf9942a8), [`ce7768e`](https://github.com/adobe/aio-commerce-sdk/commit/ce7768e0ddc6ca35ad6ccec60f584c8bb5a743f0), [`4396a64`](https://github.com/adobe/aio-commerce-sdk/commit/4396a647ad22dba063cdf03a16e04aef9387212f), [`e85bec4`](https://github.com/adobe/aio-commerce-sdk/commit/e85bec40f1eaa91dd6bb7bc6954b2ecfc3ea4029), [`413da36`](https://github.com/adobe/aio-commerce-sdk/commit/413da36dcd83e5a41c194f5af50611097659e725), [`a5b6d61`](https://github.com/adobe/aio-commerce-sdk/commit/a5b6d6138d5f048426ef655c4dc37f470aa74e2b), [`413da36`](https://github.com/adobe/aio-commerce-sdk/commit/413da36dcd83e5a41c194f5af50611097659e725), [`ca2c4fe`](https://github.com/adobe/aio-commerce-sdk/commit/ca2c4febcdfbe52b933775f08e9a53765fc306ab), [`ce63b2b`](https://github.com/adobe/aio-commerce-sdk/commit/ce63b2b46f7ef1f2f68780b13e52d1c13fd5fe6e), [`caed6d5`](https://github.com/adobe/aio-commerce-sdk/commit/caed6d5cbc526bc980221a06a59542427752a1ab), [`19400fb`](https://github.com/adobe/aio-commerce-sdk/commit/19400fbdfc03c5bbfc30f995a2acdd4272c5e032)]:
|
|
87
|
-
- @adobe/aio-commerce-lib-admin-ui@0.2.0
|
|
88
|
-
- @adobe/aio-commerce-lib-core@1.2.0
|
|
89
|
-
- @adobe/aio-commerce-lib-events@1.3.0
|
|
90
|
-
- @adobe/aio-commerce-lib-api@1.3.0
|
|
91
|
-
- @adobe/aio-commerce-lib-auth@1.1.2
|
|
92
|
-
- @adobe/aio-commerce-lib-config@1.6.0
|
|
93
|
-
- @adobe/aio-commerce-lib-webhooks@1.2.0
|
|
50
|
+
- @adobe/aio-commerce-lib-admin-ui@0.2.0
|
|
51
|
+
- @adobe/aio-commerce-lib-core@1.2.0
|
|
52
|
+
- @adobe/aio-commerce-lib-events@1.3.0
|
|
53
|
+
- @adobe/aio-commerce-lib-api@1.3.0
|
|
54
|
+
- @adobe/aio-commerce-lib-auth@1.1.2
|
|
55
|
+
- @adobe/aio-commerce-lib-config@1.6.0
|
|
56
|
+
- @adobe/aio-commerce-lib-webhooks@1.2.0
|
|
94
57
|
|
|
95
58
|
## 1.7.0
|
|
96
59
|
|
|
@@ -29,7 +29,7 @@ let crypto = require("crypto");
|
|
|
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-
|
|
32
|
+
const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-C36q3dCZ.cjs"));
|
|
33
33
|
/** Matches component schema `$ref` strings, capturing the schema name. */
|
|
34
34
|
const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(\w+)"/g;
|
|
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 = `1.8.0
|
|
83
|
+
const input = `1.8.0:${[...domains].sort().join(",")}:2.0.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. */
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
|
|
16
16
|
const require_rolldown_runtime = require('../rolldown-runtime-Cozy-1ZF.cjs');
|
|
17
17
|
const require_error = require('../error-D-N0PKSl.cjs');
|
|
18
|
-
const require_index_node = require('../index.node-
|
|
18
|
+
const require_index_node = require('../index.node-BWZuZLgs.cjs');
|
|
19
19
|
const require_webhooks = require('../webhooks-L4DWHSOl.cjs');
|
|
20
20
|
const require_validate = require('../validate-C_eCKp21.cjs');
|
|
21
21
|
const require_logging = require('../logging-udPuAJPt.cjs');
|
|
22
22
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
23
23
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
24
|
-
let consola = require("consola");
|
|
25
|
-
consola = require_rolldown_runtime.__toESM(consola, 1);
|
|
26
|
-
let child_process = require("child_process");
|
|
27
24
|
let path = require("path");
|
|
28
25
|
path = require_rolldown_runtime.__toESM(path, 1);
|
|
29
26
|
let fs = require("fs");
|
|
30
27
|
let fs_promises = require("fs/promises");
|
|
28
|
+
let consola = require("consola");
|
|
29
|
+
consola = require_rolldown_runtime.__toESM(consola, 1);
|
|
30
|
+
let child_process = require("child_process");
|
|
31
31
|
let prettier = require("prettier");
|
|
32
32
|
prettier = require_rolldown_runtime.__toESM(prettier, 1);
|
|
33
33
|
let url = require("url");
|
|
@@ -147,6 +147,10 @@ function hasDynamicAppConfig(appConfig) {
|
|
|
147
147
|
const schema = appConfig.businessConfig?.schema;
|
|
148
148
|
return Array.isArray(schema) && (0, _adobe_aio_commerce_lib_config.hasDynamicSchema)(schema);
|
|
149
149
|
}
|
|
150
|
+
/** Whether preserving the app config requires generating a JavaScript module. */
|
|
151
|
+
async function requiresJavaScriptAppConfig(appConfig) {
|
|
152
|
+
return hasDynamicAppConfig(appConfig) || await require_index_node.hasNamedCommerceAppConfigExports();
|
|
153
|
+
}
|
|
150
154
|
/**
|
|
151
155
|
* Path to an extension point's `.generated` directory, relative to the project root.
|
|
152
156
|
* @param extensionPointId - The extension point ID, e.g. "commerce/extensibility/1"
|
|
@@ -226,7 +230,7 @@ const WEB_SOURCE_IMPORT_ALIAS = "#web/*";
|
|
|
226
230
|
const WEB_SOURCE_DEPENDENCIES = [
|
|
227
231
|
{
|
|
228
232
|
name: "@adobe/aio-commerce-lib-admin-ui",
|
|
229
|
-
version: "^0.2.0
|
|
233
|
+
version: "^0.2.0"
|
|
230
234
|
},
|
|
231
235
|
{
|
|
232
236
|
name: "react",
|
|
@@ -754,7 +758,7 @@ async function generateRuntimeAppConfigModule() {
|
|
|
754
758
|
await require_index_node.makeOutputDirFor((0, path.dirname)(runtimeConfigPath));
|
|
755
759
|
const outputPath = (0, path.join)(projectRoot, runtimeConfigPath);
|
|
756
760
|
const configFilePath = await require_index_node.resolveCommerceAppConfig(projectRoot);
|
|
757
|
-
if (!configFilePath) throw new Error("
|
|
761
|
+
if (!configFilePath) throw new Error("Generating a JavaScript app config module requires an app.commerce.config.* file.");
|
|
758
762
|
consola.consola.info("Generating JS config module...");
|
|
759
763
|
if (TYPESCRIPT_CONFIG_EXTENSIONS.has((0, path.extname)(configFilePath))) await bundleTypeScriptAppConfigModule(configFilePath, outputPath);
|
|
760
764
|
else await writeJavaScriptAppConfigModule(configFilePath, outputPath);
|
|
@@ -777,10 +781,11 @@ async function prepareStaticAppConfigImportAlias() {
|
|
|
777
781
|
* Prepare runtime-side config artifacts consumed by generated actions: the
|
|
778
782
|
* bundled ESM module and its `#app.commerce.config` package import alias.
|
|
779
783
|
*
|
|
780
|
-
*
|
|
784
|
+
* Configs that require JavaScript use the source config file, while serializable
|
|
785
|
+
* default-only configs use the generated JSON manifest.
|
|
781
786
|
*/
|
|
782
787
|
async function prepareRuntimeAppConfigModule(appManifest) {
|
|
783
|
-
if (
|
|
788
|
+
if (await requiresJavaScriptAppConfig(appManifest)) {
|
|
784
789
|
await generateRuntimeAppConfigModule();
|
|
785
790
|
return;
|
|
786
791
|
}
|
|
@@ -1043,7 +1048,7 @@ async function exec$5() {
|
|
|
1043
1048
|
//#endregion
|
|
1044
1049
|
//#region source/commands/generate/manifest/main.ts
|
|
1045
1050
|
async function run$4(appConfig) {
|
|
1046
|
-
if (
|
|
1051
|
+
if (await requiresJavaScriptAppConfig(appConfig)) {
|
|
1047
1052
|
const stalePath = (0, path.join)(await require_index_node.getProjectRootDirectory(), getManifestPath());
|
|
1048
1053
|
if (await (0, fs_promises.access)(stalePath).then(() => true, () => false)) {
|
|
1049
1054
|
await (0, fs_promises.rm)(stalePath, { force: true });
|
|
@@ -1618,7 +1623,7 @@ async function ensureAppConfig(domains, cwd = process.cwd()) {
|
|
|
1618
1623
|
*/
|
|
1619
1624
|
function installDependencies(packageManager, domains, cwd = process.cwd()) {
|
|
1620
1625
|
const packages = [];
|
|
1621
|
-
if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.6.0
|
|
1626
|
+
if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.6.0`);
|
|
1622
1627
|
if (packages.length === 0) {
|
|
1623
1628
|
consola.consola.info("No additional domain dependencies to install.");
|
|
1624
1629
|
return;
|
|
@@ -1645,7 +1650,7 @@ async function ensureInstallYaml(domains, cwd = process.cwd()) {
|
|
|
1645
1650
|
|
|
1646
1651
|
//#endregion
|
|
1647
1652
|
//#region source/commands/init/main.ts
|
|
1648
|
-
const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@1.8.0
|
|
1653
|
+
const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@1.8.0`];
|
|
1649
1654
|
/** Initialize the project */
|
|
1650
1655
|
async function run(flags, extraOptions) {
|
|
1651
1656
|
consola.consola.start("Initializing app...");
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_index_node = require('../index.node-gWAIhXSG.cjs');
|
|
17
16
|
const require_define = require('../define-hlcQw7Cv.cjs');
|
|
17
|
+
const require_index_node = require('../index.node-BWZuZLgs.cjs');
|
|
18
18
|
const require_webhooks = require('../webhooks-L4DWHSOl.cjs');
|
|
19
19
|
const require_validate = require('../validate-C_eCKp21.cjs');
|
|
20
20
|
|
|
@@ -269,6 +269,16 @@ async function resolveCommerceAppConfig(cwd = process.cwd()) {
|
|
|
269
269
|
}
|
|
270
270
|
return null;
|
|
271
271
|
}
|
|
272
|
+
/** Import a commerce app config module. */
|
|
273
|
+
async function importCommerceAppConfig(configFilePath) {
|
|
274
|
+
try {
|
|
275
|
+
const { createJiti } = await import("jiti");
|
|
276
|
+
return await createJiti(require("url").pathToFileURL(__filename).href).import(configFilePath);
|
|
277
|
+
} catch (error) {
|
|
278
|
+
const message = require_error.stringifyError(error);
|
|
279
|
+
throw new Error(`Failed to read commerce app config file at ${configFilePath}: ${message}`, { cause: error });
|
|
280
|
+
}
|
|
281
|
+
}
|
|
272
282
|
/**
|
|
273
283
|
* Read the commerce app config file as-is, without validating it.
|
|
274
284
|
*
|
|
@@ -282,17 +292,17 @@ async function resolveCommerceAppConfig(cwd = process.cwd()) {
|
|
|
282
292
|
async function readCommerceAppConfig(cwd = process.cwd()) {
|
|
283
293
|
const configFilePath = await resolveCommerceAppConfig(cwd);
|
|
284
294
|
if (!configFilePath) throw new Error("Could not find a commerce app config file in the current working directory or its parents.");
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const { createJiti } = await import("jiti");
|
|
288
|
-
config = await createJiti(require("url").pathToFileURL(__filename).href).import(configFilePath);
|
|
289
|
-
} catch (error) {
|
|
290
|
-
const message = require_error.stringifyError(error);
|
|
291
|
-
throw new Error(`Failed to read commerce app config file at ${configFilePath}: ${message}`, { cause: error });
|
|
292
|
-
}
|
|
293
|
-
if (!(config && "default" in config) || config.default === void 0 || config.default === null || typeof config.default === "object" && Object.keys(config.default).length === 0) throw new Error("Commerce app config file does not export a default export or exports an empty object. Make sure you use `export default` or `module.exports = { /* your config */ }`");
|
|
295
|
+
const config = await importCommerceAppConfig(configFilePath);
|
|
296
|
+
if (!("default" in config) || config.default === void 0 || config.default === null || typeof config.default === "object" && Object.keys(config.default).length === 0) throw new Error("Commerce app config file does not export a default export or exports an empty object. Make sure you use `export default` or `module.exports = { /* your config */ }`");
|
|
294
297
|
return config.default;
|
|
295
298
|
}
|
|
299
|
+
/** Whether the app config module exports any named symbols alongside its default export. */
|
|
300
|
+
async function hasNamedCommerceAppConfigExports(cwd = process.cwd()) {
|
|
301
|
+
const configFilePath = await resolveCommerceAppConfig(cwd);
|
|
302
|
+
if (!configFilePath) return false;
|
|
303
|
+
const config = await importCommerceAppConfig(configFilePath);
|
|
304
|
+
return Object.keys(config).some((exportName) => exportName !== "default");
|
|
305
|
+
}
|
|
296
306
|
/**
|
|
297
307
|
* Read the commerce app config file and parse its contents into its schema.
|
|
298
308
|
*
|
|
@@ -344,6 +354,12 @@ Object.defineProperty(exports, 'getProjectRootDirectory', {
|
|
|
344
354
|
return getProjectRootDirectory;
|
|
345
355
|
}
|
|
346
356
|
});
|
|
357
|
+
Object.defineProperty(exports, 'hasNamedCommerceAppConfigExports', {
|
|
358
|
+
enumerable: true,
|
|
359
|
+
get: function () {
|
|
360
|
+
return hasNamedCommerceAppConfigExports;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
347
363
|
Object.defineProperty(exports, 'isESM', {
|
|
348
364
|
enumerable: true,
|
|
349
365
|
get: function () {
|
|
@@ -26,7 +26,7 @@ import { createHash } from "crypto";
|
|
|
26
26
|
* Loads the committed OpenAPI spec via dynamic import so it
|
|
27
27
|
* lands in its own chunk and is not parsed on every cold start.
|
|
28
28
|
*/
|
|
29
|
-
const importOpenApi = () => import("../../openapi-
|
|
29
|
+
const importOpenApi = () => import("../../openapi-BSc2NRd2.mjs");
|
|
30
30
|
/** Matches component schema `$ref` strings, capturing the schema name. */
|
|
31
31
|
const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(\w+)"/g;
|
|
32
32
|
/**
|
|
@@ -77,7 +77,7 @@ function pruneUnusedTags(spec) {
|
|
|
77
77
|
* @param domains - The active config domains.
|
|
78
78
|
*/
|
|
79
79
|
function getOpenApiCacheKey(domains) {
|
|
80
|
-
const input = `1.8.0
|
|
80
|
+
const input = `1.8.0:${[...domains].sort().join(",")}:2.0.0`;
|
|
81
81
|
return createHash("sha256").update(input).digest("hex").slice(0, 8);
|
|
82
82
|
}
|
|
83
83
|
/** Returns the server URL to be set in the OpenAPI spec, based on the current namespace. */
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { t as stringifyError } from "../error-_RMwtrUA.mjs";
|
|
17
|
-
import { a as
|
|
17
|
+
import { a as detectPackageManager, c as getPackageDependencyInstallPlan, d as isESM, f as loadPackageJson, h as readPackageJson, i as resolveCommerceAppConfig, l as getProjectInstallCommand, m as mergePackageJsonDependencies, n as parseCommerceAppConfig, o as getExecCommand, p as makeOutputDirFor, r as readCommerceAppConfig, s as getInstallCommand, t as hasNamedCommerceAppConfigExports, u as getProjectRootDirectory } from "../index.node-DuvW9Sha.mjs";
|
|
18
18
|
import { a as hasCustomInstallationSteps, d as hasAdminUi } from "../webhooks-D7DExIDM.mjs";
|
|
19
19
|
import { o as getConfigDomains, r as requiresInstallation, t as validateCommerceAppConfig, u as hasBusinessConfigSchema } from "../validate-t0T0F2MF.mjs";
|
|
20
20
|
import { t as inspect } from "../logging-DbJHXSKh.mjs";
|
|
21
21
|
import { hasDynamicSchema } from "@adobe/aio-commerce-lib-config";
|
|
22
22
|
import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
|
|
23
|
-
import consola$1, { consola } from "consola";
|
|
24
|
-
import { execSync, spawnSync } from "child_process";
|
|
25
23
|
import path, { basename, dirname, extname, join, relative, resolve, sep } from "path";
|
|
26
24
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
27
25
|
import { access, mkdir, readFile, readdir, rm, writeFile } from "fs/promises";
|
|
26
|
+
import consola$1, { consola } from "consola";
|
|
27
|
+
import { execSync, spawnSync } from "child_process";
|
|
28
28
|
import * as prettier from "prettier";
|
|
29
29
|
import { fileURLToPath } from "url";
|
|
30
30
|
import { Document, YAMLMap, YAMLSeq, isMap, isPair, isSeq, parseDocument } from "yaml";
|
|
@@ -140,6 +140,10 @@ function hasDynamicAppConfig(appConfig) {
|
|
|
140
140
|
const schema = appConfig.businessConfig?.schema;
|
|
141
141
|
return Array.isArray(schema) && hasDynamicSchema(schema);
|
|
142
142
|
}
|
|
143
|
+
/** Whether preserving the app config requires generating a JavaScript module. */
|
|
144
|
+
async function requiresJavaScriptAppConfig(appConfig) {
|
|
145
|
+
return hasDynamicAppConfig(appConfig) || await hasNamedCommerceAppConfigExports();
|
|
146
|
+
}
|
|
143
147
|
/**
|
|
144
148
|
* Path to an extension point's `.generated` directory, relative to the project root.
|
|
145
149
|
* @param extensionPointId - The extension point ID, e.g. "commerce/extensibility/1"
|
|
@@ -219,7 +223,7 @@ const WEB_SOURCE_IMPORT_ALIAS = "#web/*";
|
|
|
219
223
|
const WEB_SOURCE_DEPENDENCIES = [
|
|
220
224
|
{
|
|
221
225
|
name: "@adobe/aio-commerce-lib-admin-ui",
|
|
222
|
-
version: "^0.2.0
|
|
226
|
+
version: "^0.2.0"
|
|
223
227
|
},
|
|
224
228
|
{
|
|
225
229
|
name: "react",
|
|
@@ -747,7 +751,7 @@ async function generateRuntimeAppConfigModule() {
|
|
|
747
751
|
await makeOutputDirFor(dirname(runtimeConfigPath));
|
|
748
752
|
const outputPath = join(projectRoot, runtimeConfigPath);
|
|
749
753
|
const configFilePath = await resolveCommerceAppConfig(projectRoot);
|
|
750
|
-
if (!configFilePath) throw new Error("
|
|
754
|
+
if (!configFilePath) throw new Error("Generating a JavaScript app config module requires an app.commerce.config.* file.");
|
|
751
755
|
consola.info("Generating JS config module...");
|
|
752
756
|
if (TYPESCRIPT_CONFIG_EXTENSIONS.has(extname(configFilePath))) await bundleTypeScriptAppConfigModule(configFilePath, outputPath);
|
|
753
757
|
else await writeJavaScriptAppConfigModule(configFilePath, outputPath);
|
|
@@ -770,10 +774,11 @@ async function prepareStaticAppConfigImportAlias() {
|
|
|
770
774
|
* Prepare runtime-side config artifacts consumed by generated actions: the
|
|
771
775
|
* bundled ESM module and its `#app.commerce.config` package import alias.
|
|
772
776
|
*
|
|
773
|
-
*
|
|
777
|
+
* Configs that require JavaScript use the source config file, while serializable
|
|
778
|
+
* default-only configs use the generated JSON manifest.
|
|
774
779
|
*/
|
|
775
780
|
async function prepareRuntimeAppConfigModule(appManifest) {
|
|
776
|
-
if (
|
|
781
|
+
if (await requiresJavaScriptAppConfig(appManifest)) {
|
|
777
782
|
await generateRuntimeAppConfigModule();
|
|
778
783
|
return;
|
|
779
784
|
}
|
|
@@ -1036,7 +1041,7 @@ async function exec$5() {
|
|
|
1036
1041
|
//#endregion
|
|
1037
1042
|
//#region source/commands/generate/manifest/main.ts
|
|
1038
1043
|
async function run$4(appConfig) {
|
|
1039
|
-
if (
|
|
1044
|
+
if (await requiresJavaScriptAppConfig(appConfig)) {
|
|
1040
1045
|
const stalePath = join(await getProjectRootDirectory(), getManifestPath());
|
|
1041
1046
|
if (await access(stalePath).then(() => true, () => false)) {
|
|
1042
1047
|
await rm(stalePath, { force: true });
|
|
@@ -1611,7 +1616,7 @@ async function ensureAppConfig(domains, cwd = process.cwd()) {
|
|
|
1611
1616
|
*/
|
|
1612
1617
|
function installDependencies(packageManager, domains, cwd = process.cwd()) {
|
|
1613
1618
|
const packages = [];
|
|
1614
|
-
if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.6.0
|
|
1619
|
+
if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.6.0`);
|
|
1615
1620
|
if (packages.length === 0) {
|
|
1616
1621
|
consola.info("No additional domain dependencies to install.");
|
|
1617
1622
|
return;
|
|
@@ -1638,7 +1643,7 @@ async function ensureInstallYaml(domains, cwd = process.cwd()) {
|
|
|
1638
1643
|
|
|
1639
1644
|
//#endregion
|
|
1640
1645
|
//#region source/commands/init/main.ts
|
|
1641
|
-
const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@1.8.0
|
|
1646
|
+
const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@1.8.0`];
|
|
1642
1647
|
/** Initialize the project */
|
|
1643
1648
|
async function run(flags, extraOptions) {
|
|
1644
1649
|
consola.start("Initializing app...");
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as readCommerceAppConfig, r as resolveCommerceAppConfig, t as parseCommerceAppConfig } from "../index.node-BkSA7XIO.mjs";
|
|
16
15
|
import { t as defineConfig } from "../define-Z_Glf1-_.mjs";
|
|
16
|
+
import { i as resolveCommerceAppConfig, n as parseCommerceAppConfig, r as readCommerceAppConfig } from "../index.node-DuvW9Sha.mjs";
|
|
17
17
|
import { a as hasCustomInstallationSteps, c as hasEventing, d as hasAdminUi, i as hasCustomInstallation, l as hasExternalEvents, n as hasWebhooks, s as hasCommerceEvents } from "../webhooks-D7DExIDM.mjs";
|
|
18
18
|
import { a as CommerceAppConfigSchemas, c as hasMetadata, l as hasBusinessConfig, n as validateCommerceAppConfigDomain, o as getConfigDomains, s as hasConfigDomain, t as validateCommerceAppConfig, u as hasBusinessConfigSchema } from "../validate-t0T0F2MF.mjs";
|
|
19
19
|
|
|
@@ -267,6 +267,16 @@ async function resolveCommerceAppConfig(cwd = process.cwd()) {
|
|
|
267
267
|
}
|
|
268
268
|
return null;
|
|
269
269
|
}
|
|
270
|
+
/** Import a commerce app config module. */
|
|
271
|
+
async function importCommerceAppConfig(configFilePath) {
|
|
272
|
+
try {
|
|
273
|
+
const { createJiti } = await import("jiti");
|
|
274
|
+
return await createJiti(import.meta.url).import(configFilePath);
|
|
275
|
+
} catch (error) {
|
|
276
|
+
const message = stringifyError(error);
|
|
277
|
+
throw new Error(`Failed to read commerce app config file at ${configFilePath}: ${message}`, { cause: error });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
270
280
|
/**
|
|
271
281
|
* Read the commerce app config file as-is, without validating it.
|
|
272
282
|
*
|
|
@@ -280,17 +290,17 @@ async function resolveCommerceAppConfig(cwd = process.cwd()) {
|
|
|
280
290
|
async function readCommerceAppConfig(cwd = process.cwd()) {
|
|
281
291
|
const configFilePath = await resolveCommerceAppConfig(cwd);
|
|
282
292
|
if (!configFilePath) throw new Error("Could not find a commerce app config file in the current working directory or its parents.");
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const { createJiti } = await import("jiti");
|
|
286
|
-
config = await createJiti(import.meta.url).import(configFilePath);
|
|
287
|
-
} catch (error) {
|
|
288
|
-
const message = stringifyError(error);
|
|
289
|
-
throw new Error(`Failed to read commerce app config file at ${configFilePath}: ${message}`, { cause: error });
|
|
290
|
-
}
|
|
291
|
-
if (!(config && "default" in config) || config.default === void 0 || config.default === null || typeof config.default === "object" && Object.keys(config.default).length === 0) throw new Error("Commerce app config file does not export a default export or exports an empty object. Make sure you use `export default` or `module.exports = { /* your config */ }`");
|
|
293
|
+
const config = await importCommerceAppConfig(configFilePath);
|
|
294
|
+
if (!("default" in config) || config.default === void 0 || config.default === null || typeof config.default === "object" && Object.keys(config.default).length === 0) throw new Error("Commerce app config file does not export a default export or exports an empty object. Make sure you use `export default` or `module.exports = { /* your config */ }`");
|
|
292
295
|
return config.default;
|
|
293
296
|
}
|
|
297
|
+
/** Whether the app config module exports any named symbols alongside its default export. */
|
|
298
|
+
async function hasNamedCommerceAppConfigExports(cwd = process.cwd()) {
|
|
299
|
+
const configFilePath = await resolveCommerceAppConfig(cwd);
|
|
300
|
+
if (!configFilePath) return false;
|
|
301
|
+
const config = await importCommerceAppConfig(configFilePath);
|
|
302
|
+
return Object.keys(config).some((exportName) => exportName !== "default");
|
|
303
|
+
}
|
|
294
304
|
/**
|
|
295
305
|
* Read the commerce app config file and parse its contents into its schema.
|
|
296
306
|
*
|
|
@@ -306,4 +316,4 @@ async function parseCommerceAppConfig(cwd = process.cwd()) {
|
|
|
306
316
|
}
|
|
307
317
|
|
|
308
318
|
//#endregion
|
|
309
|
-
export {
|
|
319
|
+
export { detectPackageManager as a, getPackageDependencyInstallPlan as c, isESM as d, loadPackageJson as f, readPackageJson as h, resolveCommerceAppConfig as i, getProjectInstallCommand as l, mergePackageJsonDependencies as m, parseCommerceAppConfig as n, getExecCommand as o, makeOutputDirFor as p, readCommerceAppConfig as r, getInstallCommand as s, hasNamedCommerceAppConfigExports as t, getProjectRootDirectory as u };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@adobe/aio-commerce-lib-app",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Adobe Inc.",
|
|
5
|
-
"version": "1.8.0
|
|
5
|
+
"version": "1.8.0",
|
|
6
6
|
"private": false,
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=22 <=24"
|
|
@@ -121,13 +121,13 @@
|
|
|
121
121
|
"type-fest": "^5.0.0",
|
|
122
122
|
"valibot": "^1.1.0",
|
|
123
123
|
"yaml": "^2.8.1",
|
|
124
|
-
"@adobe/aio-commerce-lib-admin-ui": "0.2.0
|
|
125
|
-
"@adobe/aio-commerce-lib-api": "1.3.0
|
|
126
|
-
"@adobe/aio-commerce-lib-auth": "1.1.2
|
|
127
|
-
"@adobe/aio-commerce-lib-config": "1.6.0
|
|
128
|
-
"@adobe/aio-commerce-lib-core": "1.2.0
|
|
129
|
-
"@adobe/aio-commerce-lib-events": "1.3.0
|
|
130
|
-
"@adobe/aio-commerce-lib-webhooks": "1.2.0
|
|
124
|
+
"@adobe/aio-commerce-lib-admin-ui": "0.2.0",
|
|
125
|
+
"@adobe/aio-commerce-lib-api": "1.3.0",
|
|
126
|
+
"@adobe/aio-commerce-lib-auth": "1.1.2",
|
|
127
|
+
"@adobe/aio-commerce-lib-config": "1.6.0",
|
|
128
|
+
"@adobe/aio-commerce-lib-core": "1.2.0",
|
|
129
|
+
"@adobe/aio-commerce-lib-events": "1.3.0",
|
|
130
|
+
"@adobe/aio-commerce-lib-webhooks": "1.2.0"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": {
|
|
133
133
|
"@adobe/aio-lib-files": "^4.1.2",
|
|
@@ -138,12 +138,12 @@
|
|
|
138
138
|
"openapi-format": "1.33.5",
|
|
139
139
|
"react": "^19.2.7",
|
|
140
140
|
"typescript": "^6.0.0",
|
|
141
|
-
"@aio-commerce-sdk/common-utils": "0.2.6
|
|
141
|
+
"@aio-commerce-sdk/common-utils": "0.2.6",
|
|
142
142
|
"@aio-commerce-sdk/config-tsdown": "1.0.1",
|
|
143
143
|
"@aio-commerce-sdk/config-typedoc": "1.0.0",
|
|
144
144
|
"@aio-commerce-sdk/config-typescript": "1.0.0",
|
|
145
145
|
"@aio-commerce-sdk/config-vitest": "1.0.0",
|
|
146
|
-
"@aio-commerce-sdk/scripting-utils": "0.3.4
|
|
146
|
+
"@aio-commerce-sdk/scripting-utils": "0.3.4",
|
|
147
147
|
"@aio-commerce-sdk/scripts": "0.1.0"
|
|
148
148
|
},
|
|
149
149
|
"sideEffects": false,
|