@adobe/aio-commerce-lib-app 1.7.0 → 1.8.0-alpha-20260717142750
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 +88 -0
- package/dist/cjs/actions/app-config/index.cjs +41 -38
- package/dist/cjs/actions/app-config/index.d.cts +1 -1
- package/dist/cjs/actions/association/index.cjs +85 -0
- package/dist/cjs/actions/{registration → association}/index.d.cts +9 -13
- package/dist/cjs/actions/config/index.cjs +21 -32
- package/dist/cjs/actions/installation/index.cjs +72 -51
- package/dist/cjs/actions/installation/index.d.cts +2 -2
- package/dist/cjs/actions/scope-tree/index.cjs +18 -17
- package/dist/{es/app-DrYHK-z1.d.mts → cjs/app-BwehWeu1.d.cts} +1237 -1031
- package/dist/cjs/commands/index.cjs +511 -297
- package/dist/cjs/commands/templates/admin-ui/tsconfig.json +14 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/index.css +5 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/index.html +17 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/src/app.jsx +13 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/src/components/welcome.jsx +12 -0
- package/dist/cjs/commands/templates/admin-ui/web-src/src/pages/main-page.jsx +10 -0
- package/dist/cjs/commands/templates/{admin-ui-sdk/registration.js.template → admin-ui/web-src-template.d.ts} +11 -6
- package/dist/cjs/commands/templates/app-management/app-config.js.template +1 -14
- package/dist/cjs/commands/templates/app-management/association.js.template +6 -0
- package/dist/cjs/commands/templates/app-management/installation.js.template +1 -13
- package/dist/cjs/commands/templates/business-configuration/config.js.template +2 -15
- package/dist/cjs/commands/templates/business-configuration/scope-tree.js.template +0 -12
- package/dist/cjs/config/index.browser.cjs +18 -0
- package/dist/cjs/config/index.browser.d.cts +16 -0
- package/dist/cjs/config/{index.cjs → index.node.cjs} +9 -8
- package/dist/{es/config/index.d.mts → cjs/config/index.node.d.cts} +1065 -394
- package/dist/cjs/define-DOqVyexT.d.cts +34 -0
- package/dist/cjs/define-hlcQw7Cv.cjs +41 -0
- package/dist/cjs/environment-B7EnozSg.cjs +135 -0
- package/dist/cjs/{index-B5gJ-q4U.d.cts → index-B3ISkC54.d.cts} +17 -12
- package/dist/cjs/index.cjs +273 -0
- package/dist/cjs/index.d.cts +235 -0
- package/dist/cjs/{config-D-s0GSep.cjs → index.node-gWAIhXSG.cjs} +119 -35
- package/dist/cjs/{logging-BVz3weoC.cjs → logging-udPuAJPt.cjs} +2 -2
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +1 -1
- package/dist/cjs/{management-Dehz9qSJ.cjs → management-DEsRVP2L.cjs} +385 -582
- package/dist/cjs/{openapi-Cux6K4ZD.cjs → openapi-CwytYdWl.cjs} +476 -600
- package/dist/cjs/repository-CbceYZqc.cjs +69 -0
- package/dist/cjs/{router-BOR7T6qR.cjs → router-hA_Y9gZ1.cjs} +42 -44
- package/dist/cjs/{schemas-FngDuIeo.cjs → schemas-mLxMh_ko.cjs} +2 -2
- package/dist/cjs/utils-DSCmZ_iJ.cjs +408 -0
- package/dist/cjs/{validate-oAOpyFyb.cjs → validate-C_eCKp21.cjs} +21 -21
- package/dist/cjs/{webhooks-tbZy9G3p.cjs → webhooks-L4DWHSOl.cjs} +159 -151
- package/dist/es/actions/app-config/index.d.mts +1 -1
- package/dist/es/actions/app-config/index.mjs +39 -36
- package/dist/es/actions/{registration → association}/index.d.mts +9 -13
- package/dist/es/actions/association/index.mjs +82 -0
- package/dist/es/actions/config/index.mjs +17 -28
- package/dist/es/actions/installation/index.d.mts +2 -2
- package/dist/es/actions/installation/index.mjs +69 -48
- package/dist/es/actions/scope-tree/index.mjs +14 -13
- package/dist/{cjs/app-DrYHK-z1.d.cts → es/app-BwehWeu1.d.mts} +1237 -1031
- package/dist/es/commands/index.mjs +544 -328
- package/dist/es/commands/templates/admin-ui/tsconfig.json +14 -0
- package/dist/es/commands/templates/admin-ui/web-src/index.css +5 -0
- package/dist/es/commands/templates/admin-ui/web-src/index.html +17 -0
- package/dist/es/commands/templates/admin-ui/web-src/src/app.jsx +13 -0
- package/dist/es/commands/templates/admin-ui/web-src/src/components/welcome.jsx +12 -0
- package/dist/es/commands/templates/admin-ui/web-src/src/pages/main-page.jsx +10 -0
- package/dist/es/commands/templates/{admin-ui-sdk/registration.js.template → admin-ui/web-src-template.d.ts} +11 -6
- package/dist/es/commands/templates/app-management/app-config.js.template +1 -14
- package/dist/es/commands/templates/app-management/association.js.template +6 -0
- package/dist/es/commands/templates/app-management/installation.js.template +1 -13
- package/dist/es/commands/templates/business-configuration/config.js.template +2 -15
- package/dist/es/commands/templates/business-configuration/scope-tree.js.template +0 -12
- package/dist/es/config/index.browser.d.mts +16 -0
- package/dist/es/config/index.browser.mjs +17 -0
- package/dist/{cjs/config/index.d.cts → es/config/index.node.d.mts} +1066 -393
- package/dist/es/config/{index.mjs → index.node.mjs} +5 -4
- package/dist/es/define-DxH1BFia.d.mts +34 -0
- package/dist/es/define-Z_Glf1-_.mjs +35 -0
- package/dist/es/environment-C84BPRJZ.mjs +104 -0
- package/dist/es/{index-DLMbTtKS.d.mts → index-DSk-RmwM.d.mts} +17 -12
- package/dist/es/index.d.mts +235 -0
- package/dist/es/index.mjs +264 -0
- package/dist/es/{config-3I4eLyyR.mjs → index.node-BkSA7XIO.mjs} +94 -30
- package/dist/es/management/index.d.mts +1 -1
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-BUX-w2Ji.mjs → management-D5pmBBec.mjs} +353 -550
- package/dist/es/{openapi-B6uP0SRn.mjs → openapi-CXonvevE.mjs} +476 -600
- package/dist/es/repository-BGmy0YeZ.mjs +52 -0
- package/dist/es/{router-D58JJHHA.mjs → router-B_h0cvjc.mjs} +40 -42
- package/dist/es/utils-_gj8L6eN.mjs +289 -0
- package/dist/es/{validate-Dfajrp99.mjs → validate-t0T0F2MF.mjs} +18 -18
- package/dist/es/{webhooks-B5oq9ULL.mjs → webhooks-D7DExIDM.mjs} +150 -142
- package/package.json +40 -17
- package/dist/cjs/actions/registration/index.cjs +0 -50
- package/dist/cjs/admin-ui-sdk-EU915zlR.d.cts +0 -664
- package/dist/es/actions/registration/index.mjs +0 -49
- package/dist/es/admin-ui-sdk-BwnD0xjK.d.mts +0 -664
- /package/dist/cjs/{chunk-Cozy-1ZF.cjs → rolldown-runtime-Cozy-1ZF.cjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-app
|
|
2
2
|
|
|
3
|
+
## 1.8.0-alpha-20260717142750
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#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
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- [#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
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
- [#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
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- [#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
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
- [#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
- [#577](https://github.com/adobe/aio-commerce-sdk/pull/577) [`b8368e9`](https://github.com/adobe/aio-commerce-sdk/commit/b8368e93137d84c914d1b3f10591a39038801a4f) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Added `resolveIoEventCode` to compute an event's I/O Events event code from its app ID, name, and provider type, without needing to read it back from stored installation data.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- [#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
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
- [#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
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
- [#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`.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- [#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`.
|
|
45
|
+
|
|
46
|
+
**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.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
- [#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.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
- [#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.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
- [#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
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
- [#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.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
- [#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`.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
- [#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.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- [#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.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
- [#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.
|
|
81
|
+
|
|
82
|
+
- 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)]:
|
|
83
|
+
- @adobe/aio-commerce-lib-admin-ui@0.2.0-alpha-20260717142750
|
|
84
|
+
- @adobe/aio-commerce-lib-core@1.2.0-alpha-20260717142750
|
|
85
|
+
- @adobe/aio-commerce-lib-events@1.3.0-alpha-20260717142750
|
|
86
|
+
- @adobe/aio-commerce-lib-api@1.3.0-alpha-20260717142750
|
|
87
|
+
- @adobe/aio-commerce-lib-auth@1.1.2-alpha-20260717142750
|
|
88
|
+
- @adobe/aio-commerce-lib-config@1.6.0-alpha-20260717142750
|
|
89
|
+
- @adobe/aio-commerce-lib-webhooks@1.2.0-alpha-20260717142750
|
|
90
|
+
|
|
3
91
|
## 1.7.0
|
|
4
92
|
|
|
5
93
|
### Minor Changes
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
16
|
+
const require_rolldown_runtime = require('../../rolldown-runtime-Cozy-1ZF.cjs');
|
|
17
|
+
const require_environment = require('../../environment-B7EnozSg.cjs');
|
|
18
|
+
const require_validate = require('../../validate-C_eCKp21.cjs');
|
|
19
|
+
const require_router = require('../../router-hA_Y9gZ1.cjs');
|
|
19
20
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
20
21
|
let valibot = require("valibot");
|
|
21
|
-
valibot =
|
|
22
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
23
|
+
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
22
24
|
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
23
25
|
let crypto = require("crypto");
|
|
24
26
|
|
|
@@ -27,7 +29,7 @@ let crypto = require("crypto");
|
|
|
27
29
|
* Loads the committed OpenAPI spec via dynamic import so it
|
|
28
30
|
* lands in its own chunk and is not parsed on every cold start.
|
|
29
31
|
*/
|
|
30
|
-
const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-
|
|
32
|
+
const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-CwytYdWl.cjs"));
|
|
31
33
|
/** Matches component schema `$ref` strings, capturing the schema name. */
|
|
32
34
|
const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(\w+)"/g;
|
|
33
35
|
/**
|
|
@@ -68,7 +70,7 @@ function pruneUnusedSchemas(spec) {
|
|
|
68
70
|
function pruneUnusedTags(spec) {
|
|
69
71
|
const usedTags = /* @__PURE__ */ new Set();
|
|
70
72
|
for (const pathItem of Object.values(spec.paths)) for (const operation of Object.values(pathItem)) for (const tag of operation.tags ?? []) usedTags.add(tag);
|
|
71
|
-
for (let i = spec.tags.length - 1; i >= 0; i
|
|
73
|
+
for (let i = spec.tags.length - 1; i >= 0; i -= 1) if (!usedTags.has(spec.tags[i].name)) spec.tags.splice(i, 1);
|
|
72
74
|
}
|
|
73
75
|
/**
|
|
74
76
|
* Computes a short hash identifying the spec served for the given config domains.
|
|
@@ -78,7 +80,7 @@ function pruneUnusedTags(spec) {
|
|
|
78
80
|
* @param domains - The active config domains.
|
|
79
81
|
*/
|
|
80
82
|
function getOpenApiCacheKey(domains) {
|
|
81
|
-
const input = `1.
|
|
83
|
+
const input = `1.8.0-alpha-20260717142750:${[...domains].sort().join(",")}:2.0.0`;
|
|
82
84
|
return (0, crypto.createHash)("sha256").update(input).digest("hex").slice(0, 8);
|
|
83
85
|
}
|
|
84
86
|
/** Returns the server URL to be set in the OpenAPI spec, based on the current namespace. */
|
|
@@ -111,10 +113,6 @@ async function buildOpenApiSpec(domains, logger) {
|
|
|
111
113
|
stripPath("/scope-tree");
|
|
112
114
|
stripPath("/scope-tree/commerce");
|
|
113
115
|
}
|
|
114
|
-
if (!domains.has("adminUiSdk")) {
|
|
115
|
-
logger.debug("Application doesn't define Admin UI SDK registration, stripping references...");
|
|
116
|
-
stripPath("/registration");
|
|
117
|
-
}
|
|
118
116
|
if (!require_validate.requiresInstallationFromDomains(domains)) {
|
|
119
117
|
logger.debug("Application doesn't require installation, stripping references...");
|
|
120
118
|
stripPath("/installation");
|
|
@@ -138,37 +136,41 @@ async function buildOpenApiSpec(domains, logger) {
|
|
|
138
136
|
*/
|
|
139
137
|
const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "app-config" }));
|
|
140
138
|
/** GET / - Get app config */
|
|
141
|
-
router.get("/", {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
openApiSpecUrl
|
|
164
|
-
|
|
165
|
-
|
|
139
|
+
router.get("/", {
|
|
140
|
+
handler: async (req, { logger, rawParams }) => {
|
|
141
|
+
const rawAppConfig = rawParams.appConfig;
|
|
142
|
+
if (!rawAppConfig) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)("The app config is missing. Does the action receive it as a parameter?");
|
|
143
|
+
let appConfig = rawAppConfig;
|
|
144
|
+
if (require_validate.hasBusinessConfigSchema(rawAppConfig)) {
|
|
145
|
+
logger.debug("Resolving business config schema...");
|
|
146
|
+
const schema = await (0, _adobe_aio_commerce_lib_config.resolveBusinessConfigSchema)(rawAppConfig.businessConfig.schema, rawParams);
|
|
147
|
+
appConfig = {
|
|
148
|
+
...rawAppConfig,
|
|
149
|
+
businessConfig: {
|
|
150
|
+
...rawAppConfig.businessConfig,
|
|
151
|
+
schema
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
logger.debug("Validating app config...");
|
|
156
|
+
const validatedConfig = require_validate.validateCommerceAppConfig(appConfig);
|
|
157
|
+
logger.debug("Successfully validated the app config");
|
|
158
|
+
const { commerceEnv } = req.query;
|
|
159
|
+
const config = commerceEnv ? require_environment.filterAppConfigByEnv(validatedConfig, commerceEnv) : validatedConfig;
|
|
160
|
+
const domains = require_validate.getConfigDomains(rawParams.appConfig);
|
|
161
|
+
const openApiSpecUrl = `${getServerUrl()}/app-config/openapi.json?ck=${getOpenApiCacheKey(domains)}`;
|
|
162
|
+
return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: {
|
|
163
|
+
...config,
|
|
164
|
+
openApiSpecUrl
|
|
165
|
+
} });
|
|
166
|
+
},
|
|
167
|
+
query: valibot.object({ commerceEnv: valibot.optional(_adobe_aio_commerce_lib_core_commerce.CommerceEnvSchema) })
|
|
168
|
+
});
|
|
166
169
|
/**
|
|
167
170
|
* GET /openapi.json - Returns the OpenAPI spec for all SDK actions
|
|
168
171
|
* @internal - Do not add to OpenAPI Spec.
|
|
169
172
|
*/
|
|
170
173
|
router.get("/openapi.json", {
|
|
171
|
-
query: valibot.object({ ck: valibot.optional(valibot.string()) }),
|
|
172
174
|
handler: async (req, { logger, rawParams }) => {
|
|
173
175
|
const { ck } = req.query;
|
|
174
176
|
const domains = require_validate.getConfigDomains(rawParams.appConfig);
|
|
@@ -180,7 +182,8 @@ router.get("/openapi.json", {
|
|
|
180
182
|
});
|
|
181
183
|
}
|
|
182
184
|
return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: await buildOpenApiSpec(domains, logger) });
|
|
183
|
-
}
|
|
185
|
+
},
|
|
186
|
+
query: valibot.object({ ck: valibot.optional(valibot.string()) })
|
|
184
187
|
});
|
|
185
188
|
|
|
186
189
|
//#endregion
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as CommerceAppConfig } from "../../app-
|
|
15
|
+
import { n as CommerceAppConfig } from "../../app-BwehWeu1.cjs";
|
|
16
16
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
17
17
|
|
|
18
18
|
//#region source/actions/app-config/router.d.ts
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
+
const require_rolldown_runtime = require('../../rolldown-runtime-Cozy-1ZF.cjs');
|
|
17
|
+
const require_repository = require('../../repository-CbceYZqc.cjs');
|
|
18
|
+
const require_router = require('../../router-hA_Y9gZ1.cjs');
|
|
19
|
+
let valibot = require("valibot");
|
|
20
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
21
|
+
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
22
|
+
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
23
|
+
|
|
24
|
+
//#region source/actions/association/schema.ts
|
|
25
|
+
/** Request body for POST / — store association data. */
|
|
26
|
+
const AssociationRequestBodySchema = valibot.object({
|
|
27
|
+
commerceBaseUrl: valibot.pipe(valibot.string(), valibot.url("The 'commerceBaseUrl' field must be a valid absolute URL (e.g., 'https://my-store.example.com')")),
|
|
28
|
+
commerceEnv: _adobe_aio_commerce_lib_core_commerce.CommerceEnvSchema
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region source/actions/association/router.ts
|
|
33
|
+
/**
|
|
34
|
+
* Association action router.
|
|
35
|
+
*
|
|
36
|
+
* Routes:
|
|
37
|
+
* - POST / Store Commerce instance details (`baseUrl`, `env`)
|
|
38
|
+
* - DELETE / Clear stored Commerce instance details
|
|
39
|
+
*/
|
|
40
|
+
const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "association" }));
|
|
41
|
+
/**
|
|
42
|
+
* POST / - Store association data.
|
|
43
|
+
*
|
|
44
|
+
* Persists the Commerce instance the app is associated with so runtime actions
|
|
45
|
+
* can later retrieve it via `getCommerceInstance` / `getCommerceClient`.
|
|
46
|
+
*/
|
|
47
|
+
router.post("/", {
|
|
48
|
+
body: AssociationRequestBodySchema,
|
|
49
|
+
handler: async (req, { logger }) => {
|
|
50
|
+
const { commerceBaseUrl, commerceEnv } = req.body;
|
|
51
|
+
logger.debug(`Storing association data (baseUrl: "${commerceBaseUrl}", env: "${commerceEnv}")`);
|
|
52
|
+
await require_repository.setAssociationData({ commerce: {
|
|
53
|
+
baseUrl: commerceBaseUrl,
|
|
54
|
+
env: commerceEnv
|
|
55
|
+
} });
|
|
56
|
+
return (0, _adobe_aio_commerce_lib_core_responses.noContent)();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* DELETE / - Clear association data.
|
|
61
|
+
*
|
|
62
|
+
* Called when the app is unassociated.
|
|
63
|
+
*/
|
|
64
|
+
router.delete("/", { handler: async (_req, { logger }) => {
|
|
65
|
+
logger.debug("Clearing association data");
|
|
66
|
+
await require_repository.clearAssociationData();
|
|
67
|
+
return (0, _adobe_aio_commerce_lib_core_responses.noContent)();
|
|
68
|
+
} });
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region source/actions/association/index.ts
|
|
72
|
+
/**
|
|
73
|
+
* Factory to create the route handler for the `association` action.
|
|
74
|
+
*
|
|
75
|
+
* The `association` action manages the lifecycle of the Commerce instance the
|
|
76
|
+
* app is associated with — `POST /` stores the data when the app is associated,
|
|
77
|
+
* and `DELETE /` clears it on unassociation. Runtime actions consume the data
|
|
78
|
+
* via `getCommerceInstance` / `getCommerceClient` from the root entrypoint.
|
|
79
|
+
*/
|
|
80
|
+
const associationRuntimeAction = () => async (params) => {
|
|
81
|
+
return await router.handler()({ ...params });
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
exports.associationRuntimeAction = associationRuntimeAction;
|
|
@@ -12,21 +12,17 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as AdminUiSdkRegistration } from "../../admin-ui-sdk-EU915zlR.cjs";
|
|
16
15
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
17
16
|
|
|
18
|
-
//#region source/actions/
|
|
19
|
-
/** The arguments required to create the runtime action for the registration action. */
|
|
20
|
-
type RuntimeActionFactoryArgs = {
|
|
21
|
-
registration: AdminUiSdkRegistration;
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region source/actions/registration/index.d.ts
|
|
17
|
+
//#region source/actions/association/index.d.ts
|
|
25
18
|
/**
|
|
26
|
-
* Factory to create the route handler for the `
|
|
27
|
-
*
|
|
28
|
-
*
|
|
19
|
+
* Factory to create the route handler for the `association` action.
|
|
20
|
+
*
|
|
21
|
+
* The `association` action manages the lifecycle of the Commerce instance the
|
|
22
|
+
* app is associated with — `POST /` stores the data when the app is associated,
|
|
23
|
+
* and `DELETE /` clears it on unassociation. Runtime actions consume the data
|
|
24
|
+
* via `getCommerceInstance` / `getCommerceClient` from the root entrypoint.
|
|
29
25
|
*/
|
|
30
|
-
declare const
|
|
26
|
+
declare const associationRuntimeAction: () => (params: RuntimeActionParams) => Promise<import("@adobe/aio-commerce-lib-core/responses").ActionResponse>;
|
|
31
27
|
//#endregion
|
|
32
|
-
export {
|
|
28
|
+
export { associationRuntimeAction };
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const
|
|
17
|
-
const require_schemas = require('../../schemas-
|
|
18
|
-
const
|
|
16
|
+
const require_rolldown_runtime = require('../../rolldown-runtime-Cozy-1ZF.cjs');
|
|
17
|
+
const require_schemas = require('../../schemas-mLxMh_ko.cjs');
|
|
18
|
+
const require_environment = require('../../environment-B7EnozSg.cjs');
|
|
19
|
+
const require_router = require('../../router-hA_Y9gZ1.cjs');
|
|
19
20
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
20
21
|
let valibot = require("valibot");
|
|
21
|
-
valibot =
|
|
22
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
23
|
+
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
22
24
|
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
23
25
|
|
|
24
26
|
//#region source/actions/config/schema.ts
|
|
@@ -27,45 +29,32 @@ const AcceptedConfigurationValuesSchema = valibot.union([
|
|
|
27
29
|
valibot.string(),
|
|
28
30
|
valibot.array(valibot.string())
|
|
29
31
|
]);
|
|
30
|
-
/** The set of valid Commerce environments a configuration field can be scoped to. */
|
|
31
|
-
const COMMERCE_ENVS = ["paas", "saas"];
|
|
32
32
|
/** Query parameters for GET / */
|
|
33
33
|
const GetConfigurationQuerySchema = valibot.object({
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
commerceEnv: valibot.optional(_adobe_aio_commerce_lib_core_commerce.CommerceEnvSchema),
|
|
35
|
+
scopeId: require_schemas.nonEmptyStringValueSchema("scopeId")
|
|
36
36
|
});
|
|
37
37
|
/** Request body for PUT / */
|
|
38
38
|
const PutConfigBodySchema = valibot.object({
|
|
39
|
-
scopeId: require_schemas.nonEmptyStringValueSchema("scopeId"),
|
|
40
39
|
config: valibot.array(valibot.object({
|
|
41
40
|
name: require_schemas.nonEmptyStringValueSchema("config[i].name"),
|
|
42
41
|
value: valibot.union([valibot.string(), valibot.array(valibot.string())])
|
|
43
|
-
}))
|
|
42
|
+
})),
|
|
43
|
+
scopeId: require_schemas.nonEmptyStringValueSchema("scopeId")
|
|
44
44
|
});
|
|
45
45
|
/** Request body for PATCH / */
|
|
46
46
|
const PatchConfigBodySchema = valibot.object({
|
|
47
|
-
scopeId: require_schemas.nonEmptyStringValueSchema("scopeId"),
|
|
48
47
|
config: valibot.array(valibot.object({
|
|
49
48
|
name: require_schemas.nonEmptyStringValueSchema("config[i].name"),
|
|
50
49
|
value: valibot.nullable(AcceptedConfigurationValuesSchema)
|
|
51
|
-
}))
|
|
50
|
+
})),
|
|
51
|
+
scopeId: require_schemas.nonEmptyStringValueSchema("scopeId")
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region source/actions/config/router.ts
|
|
56
56
|
const MASKED_PASSWORD_VALUE = "*****";
|
|
57
57
|
/**
|
|
58
|
-
* Filters a business configuration schema to the fields applicable to the
|
|
59
|
-
* given Commerce environment. Fields without an `env` property apply to all
|
|
60
|
-
* environments and are always included.
|
|
61
|
-
*
|
|
62
|
-
* @param schema - The business configuration schema to filter.
|
|
63
|
-
* @param env - The Commerce environment to filter by.
|
|
64
|
-
*/
|
|
65
|
-
function filterSchemaByEnv(schema, env) {
|
|
66
|
-
return schema.filter((field) => field.env === void 0 || field.env.includes(env));
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
58
|
* Filters password fields from the configuration values.
|
|
70
59
|
*
|
|
71
60
|
* @param schema - The schema to use to filter the values.
|
|
@@ -91,16 +80,15 @@ function filterPasswordFields(schema, values) {
|
|
|
91
80
|
const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "config" }));
|
|
92
81
|
/** GET / - Retrieve configuration */
|
|
93
82
|
router.get("/", {
|
|
94
|
-
query: GetConfigurationQuerySchema,
|
|
95
83
|
handler: async (req, ctx) => {
|
|
96
84
|
const { logger, rawParams } = ctx;
|
|
97
85
|
const { configSchema: rawConfigSchema } = rawParams;
|
|
98
86
|
const env = req.query.commerceEnv;
|
|
99
|
-
const envFilteredSchema = env ? filterSchemaByEnv(rawConfigSchema, env) : rawConfigSchema;
|
|
87
|
+
const envFilteredSchema = env ? require_environment.filterSchemaByEnv(rawConfigSchema, env) : rawConfigSchema;
|
|
100
88
|
logger.debug("Initializing configuration");
|
|
101
89
|
const { configSchema } = await (0, _adobe_aio_commerce_lib_config.initialize)({
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
params: rawParams,
|
|
91
|
+
schema: envFilteredSchema
|
|
104
92
|
});
|
|
105
93
|
const { scopeId } = req.query;
|
|
106
94
|
logger.debug(`Retrieving configuration with scope id: ${scopeId}`);
|
|
@@ -111,7 +99,8 @@ router.get("/", {
|
|
|
111
99
|
schema: configSchema,
|
|
112
100
|
values: appConfiguration
|
|
113
101
|
} });
|
|
114
|
-
}
|
|
102
|
+
},
|
|
103
|
+
query: GetConfigurationQuerySchema
|
|
115
104
|
});
|
|
116
105
|
/**
|
|
117
106
|
* PUT / - Set configuration (deprecated)
|
|
@@ -126,8 +115,8 @@ router.put("/", {
|
|
|
126
115
|
logger.debug(`Setting configuration with scope id: ${req.body.scopeId}`);
|
|
127
116
|
const { scopeId, config } = req.body;
|
|
128
117
|
const { configSchema } = await (0, _adobe_aio_commerce_lib_config.initialize)({
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
params: rawParams,
|
|
119
|
+
schema: rawParams.configSchema
|
|
131
120
|
});
|
|
132
121
|
const result = await (0, _adobe_aio_commerce_lib_config.setConfiguration)({ config: config.filter((item) => item.value !== MASKED_PASSWORD_VALUE) }, (0, _adobe_aio_commerce_lib_config.byScopeId)(scopeId), { encryptionKey: rawParams.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY });
|
|
133
122
|
result.config = filterPasswordFields(configSchema, result.config);
|
|
@@ -148,8 +137,8 @@ router.patch("/", {
|
|
|
148
137
|
logger.debug(`Patching configuration with scope id: ${req.body.scopeId}`);
|
|
149
138
|
const { scopeId, config } = req.body;
|
|
150
139
|
const { configSchema } = await (0, _adobe_aio_commerce_lib_config.initialize)({
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
params: rawParams,
|
|
141
|
+
schema: rawParams.configSchema
|
|
153
142
|
});
|
|
154
143
|
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 });
|
|
155
144
|
result.config = filterPasswordFields(configSchema, result.config);
|