@adobe/aio-commerce-lib-app 1.6.0 → 1.7.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/actions/app-config/index.cjs +202 -0
  3. package/dist/cjs/actions/app-config/index.d.cts +31 -0
  4. package/dist/cjs/actions/{config.cjs → config/index.cjs} +61 -33
  5. package/dist/{es/actions/config.d.mts → cjs/actions/config/index.d.cts} +10 -7
  6. package/dist/cjs/actions/{installation.cjs → installation/index.cjs} +43 -30
  7. package/dist/{es/actions/installation.d.mts → cjs/actions/installation/index.d.cts} +10 -8
  8. package/dist/cjs/actions/{registration.cjs → registration/index.cjs} +16 -6
  9. package/dist/cjs/actions/{registration.d.cts → registration/index.d.cts} +8 -8
  10. package/dist/cjs/actions/{scope-tree.cjs → scope-tree/index.cjs} +51 -14
  11. package/dist/cjs/actions/{scope-tree.d.cts → scope-tree/index.d.cts} +1 -1
  12. package/dist/cjs/{admin-ui-sdk-DZZJCrdT.d.cts → admin-ui-sdk-EU915zlR.d.cts} +7 -8
  13. package/dist/cjs/app-DrYHK-z1.d.cts +1629 -0
  14. package/dist/cjs/commands/index.cjs +12 -18
  15. package/dist/cjs/config/index.cjs +2 -2
  16. package/dist/cjs/config/index.d.cts +36 -976
  17. package/dist/cjs/{config-FNMclIFO.cjs → config-D-s0GSep.cjs} +1 -1
  18. package/dist/cjs/{index-Dw2NvVOY.d.cts → index-B5gJ-q4U.d.cts} +172 -3
  19. package/dist/{es/actions/app-config.d.mts → cjs/index-BXm8UbK7.d.cts} +1 -13
  20. package/dist/cjs/management/index.cjs +1 -1
  21. package/dist/cjs/management/index.d.cts +1 -2
  22. package/dist/cjs/{management-Cvsz4VMf.cjs → management-Dehz9qSJ.cjs} +81 -43
  23. package/dist/cjs/openapi-Cux6K4ZD.cjs +3072 -0
  24. package/dist/cjs/{validate-DydOAZha.cjs → validate-oAOpyFyb.cjs} +46 -14
  25. package/dist/es/actions/app-config/index.d.mts +31 -0
  26. package/dist/es/actions/app-config/index.mjs +199 -0
  27. package/dist/{cjs/actions/config.d.cts → es/actions/config/index.d.mts} +10 -7
  28. package/dist/es/actions/{config.mjs → config/index.mjs} +60 -32
  29. package/dist/{cjs/actions/installation.d.cts → es/actions/installation/index.d.mts} +10 -8
  30. package/dist/es/actions/{installation.mjs → installation/index.mjs} +42 -30
  31. package/dist/es/actions/{registration.d.mts → registration/index.d.mts} +8 -8
  32. package/dist/es/actions/{registration.mjs → registration/index.mjs} +16 -6
  33. package/dist/es/actions/{scope-tree.d.mts → scope-tree/index.d.mts} +1 -1
  34. package/dist/es/actions/{scope-tree.mjs → scope-tree/index.mjs} +50 -13
  35. package/dist/es/{admin-ui-sdk-hu6iWr0A.d.mts → admin-ui-sdk-BwnD0xjK.d.mts} +6 -9
  36. package/dist/es/app-DrYHK-z1.d.mts +1629 -0
  37. package/dist/es/commands/index.mjs +12 -18
  38. package/dist/es/config/index.d.mts +36 -975
  39. package/dist/es/config/index.mjs +2 -2
  40. package/dist/es/{config-CcE0EBG7.mjs → config-3I4eLyyR.mjs} +1 -1
  41. package/dist/{cjs/actions/app-config.d.cts → es/index-B0XqHwY5.d.mts} +2 -14
  42. package/dist/es/{index-Bo0tQsVq.d.mts → index-DLMbTtKS.d.mts} +172 -3
  43. package/dist/es/management/index.d.mts +1 -2
  44. package/dist/es/management/index.mjs +1 -1
  45. package/dist/es/{management-BZ4Y6lVp.mjs → management-BUX-w2Ji.mjs} +81 -44
  46. package/dist/es/openapi-B6uP0SRn.mjs +3024 -0
  47. package/dist/es/{validate-Du3LhCre.mjs → validate-Dfajrp99.mjs} +35 -15
  48. package/package.json +17 -10
  49. package/dist/cjs/actions/app-config.cjs +0 -54
  50. package/dist/cjs/app-CakwxQvs.d.cts +0 -673
  51. package/dist/cjs/step-CKVE0aJi.d.cts +0 -187
  52. package/dist/es/actions/app-config.mjs +0 -53
  53. package/dist/es/app-CakwxQvs.d.mts +0 -673
  54. package/dist/es/step-D64mMPrt.d.mts +0 -187
@@ -14,8 +14,8 @@
14
14
 
15
15
  import { t as alphaNumericOrHyphenSchema } from "./schemas-hRovglBF.mjs";
16
16
  import { a as hasCustomInstallationSteps, d as hasAdminUiSdk, i as hasCustomInstallation, l as hasExternalEvents, n as hasWebhooks, o as EventingSchema, r as InstallationSchema, s as hasCommerceEvents, t as WebhooksSchema, u as AdminUiSdkSchema } from "./webhooks-B5oq9ULL.mjs";
17
- import { SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
18
17
  import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
18
+ import { SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
19
19
  import * as v from "valibot";
20
20
 
21
21
  //#region source/config/schema/business-configuration.ts
@@ -59,19 +59,6 @@ function hasMetadata(config) {
59
59
  return config.metadata !== void 0;
60
60
  }
61
61
 
62
- //#endregion
63
- //#region source/config/schema/app.ts
64
- /** biome-ignore-all lint/performance/noBarrelFile: We want to have all the schema exports in one file. */
65
- /** The schema used to validate the commerce app config file. */
66
- const CommerceAppConfigSchema = v.looseObject({
67
- metadata: MetadataSchema,
68
- businessConfig: v.optional(SchemaBusinessConfig),
69
- eventing: v.optional(EventingSchema),
70
- adminUiSdk: v.optional(AdminUiSdkSchema),
71
- installation: v.optional(InstallationSchema),
72
- webhooks: v.optional(WebhooksSchema)
73
- });
74
-
75
62
  //#endregion
76
63
  //#region source/config/schema/domains.ts
77
64
  /** The individual validatable domains of the app config. */
@@ -118,6 +105,39 @@ function hasConfigDomain(config, domain) {
118
105
  return getConfigDomains(config).has(domain);
119
106
  }
120
107
 
108
+ //#endregion
109
+ //#region source/config/schema/app.ts
110
+ /** biome-ignore-all lint/performance/noBarrelFile: We want to have all the schema exports in one file. */
111
+ /** The schema used to validate the commerce app config file. */
112
+ const CommerceAppConfigSchema = v.looseObject({
113
+ metadata: MetadataSchema,
114
+ businessConfig: v.optional(SchemaBusinessConfig),
115
+ eventing: v.optional(EventingSchema),
116
+ adminUiSdk: v.optional(AdminUiSdkSchema),
117
+ installation: v.optional(InstallationSchema),
118
+ webhooks: v.optional(WebhooksSchema)
119
+ });
120
+ /**
121
+ * Returns true if the given config domains require installation, false otherwise.
122
+ * @param domains - The config domains to check.
123
+ */
124
+ function requiresInstallationFromDomains(domains) {
125
+ return [
126
+ "installation.customInstallationSteps",
127
+ "eventing.commerce",
128
+ "eventing.external",
129
+ "webhooks",
130
+ "adminUiSdk"
131
+ ].some((feature) => domains.has(feature));
132
+ }
133
+ /**
134
+ * Returns true if the given config requires installation, false otherwise.
135
+ * @param config - The commerce app config to check.
136
+ */
137
+ function requiresInstallation(config) {
138
+ return requiresInstallationFromDomains(getConfigDomains(config));
139
+ }
140
+
121
141
  //#endregion
122
142
  //#region source/config/lib/validate.ts
123
143
  const commerceAppConfigDomainsSchema = v.picklist(Object.keys(CommerceAppConfigSchemas));
@@ -205,4 +225,4 @@ function validateCommerceAppConfigDomain(config, domain) {
205
225
  }
206
226
 
207
227
  //#endregion
208
- export { hasConfigDomain as a, hasBusinessConfigSchema as c, getConfigDomains as i, validateCommerceAppConfigDomain as n, hasMetadata as o, CommerceAppConfigSchemas as r, hasBusinessConfig as s, validateCommerceAppConfig as t };
228
+ export { CommerceAppConfigSchemas as a, hasMetadata as c, requiresInstallationFromDomains as i, hasBusinessConfig as l, validateCommerceAppConfigDomain as n, getConfigDomains as o, requiresInstallation as r, hasConfigDomain as s, validateCommerceAppConfig as t, hasBusinessConfigSchema 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.6.0",
5
+ "version": "1.7.0",
6
6
  "private": false,
7
7
  "engines": {
8
8
  "node": ">=22 <=24"
@@ -38,12 +38,12 @@
38
38
  "exports": {
39
39
  "./actions/*": {
40
40
  "import": {
41
- "types": "./dist/es/actions/*.d.mts",
42
- "default": "./dist/es/actions/*.mjs"
41
+ "types": "./dist/es/actions/*/index.d.mts",
42
+ "default": "./dist/es/actions/*/index.mjs"
43
43
  },
44
44
  "require": {
45
- "types": "./dist/cjs/actions/*.d.cts",
46
- "default": "./dist/cjs/actions/*.cjs"
45
+ "types": "./dist/cjs/actions/*/index.d.cts",
46
+ "default": "./dist/cjs/actions/*/index.cjs"
47
47
  }
48
48
  },
49
49
  "./config": {
@@ -70,6 +70,7 @@
70
70
  },
71
71
  "imports": {
72
72
  "#*": "./source/*.ts",
73
+ "#openapi.json": "./docs/openapi.json",
73
74
  "#test/*": "./test/*.ts",
74
75
  "#templates/*": "./source/commands/generate/actions/templates/*.template"
75
76
  },
@@ -87,6 +88,7 @@
87
88
  "@adobe/aio-lib-ims": "^8.1.1",
88
89
  "@adobe/aio-lib-state": "^5.3.1",
89
90
  "@npmcli/package-json": "^8.0.0",
91
+ "@standard-schema/spec": "^1.1.0",
90
92
  "camelcase": "^9.0.0",
91
93
  "consola": "^3.4.2",
92
94
  "dotenv": "^17.2.3",
@@ -101,16 +103,18 @@
101
103
  "type-fest": "^5.0.0",
102
104
  "valibot": "^1.1.0",
103
105
  "yaml": "^2.8.1",
106
+ "@adobe/aio-commerce-lib-admin-ui": "0.1.0",
104
107
  "@adobe/aio-commerce-lib-api": "1.2.1",
105
108
  "@adobe/aio-commerce-lib-auth": "1.1.1",
106
- "@adobe/aio-commerce-lib-config": "1.5.0",
109
+ "@adobe/aio-commerce-lib-config": "1.5.1",
107
110
  "@adobe/aio-commerce-lib-core": "1.1.1",
108
111
  "@adobe/aio-commerce-lib-events": "1.2.1",
109
- "@adobe/aio-commerce-lib-webhooks": "1.1.1"
112
+ "@adobe/aio-commerce-lib-webhooks": "1.1.2"
110
113
  },
111
114
  "devDependencies": {
112
115
  "@types/npmcli__package-json": "^4.0.4",
113
116
  "msw": "^2.11.1",
117
+ "openapi-format": "1.32.1",
114
118
  "typescript": "^6.0.0",
115
119
  "@aio-commerce-sdk/common-utils": "0.2.5",
116
120
  "@aio-commerce-sdk/config-tsdown": "1.0.1",
@@ -122,18 +126,21 @@
122
126
  },
123
127
  "sideEffects": false,
124
128
  "scripts": {
129
+ "version": "pnpx tsx scripts/sync-openapi-version.ts",
125
130
  "build": "tsdown",
126
131
  "pack": "pnpm pack",
127
132
  "publint": "publint",
128
133
  "docs": "typedoc && prettier --write '**/*.md'",
129
134
  "assist": "biome check --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
130
135
  "assist:apply": "biome check --write --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
131
- "check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched",
132
- "code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format && pnpm run format:markdown",
136
+ "check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched && pnpm run lint:openapi",
137
+ "code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format:openapi && pnpm run format && pnpm run format:markdown",
133
138
  "format": "biome format --write --no-errors-on-unmatched",
134
139
  "format:markdown": "prettier --no-error-on-unmatched-pattern --write '**/*.md' \"!**/{CODE_OF_CONDUCT.md,COPYRIGHT,LICENSE,SECURITY.md,CONTRIBUTING.md}\"",
140
+ "format:openapi": "openapi-format docs/openapi.json -o docs/openapi.json -c openapi-format.json && biome format --write --no-errors-on-unmatched docs/openapi.json",
135
141
  "format:check": "biome format --no-errors-on-unmatched",
136
- "lint": "biome lint --no-errors-on-unmatched",
142
+ "lint": "biome lint --no-errors-on-unmatched && pnpm run lint:openapi",
143
+ "lint:openapi": "redocly lint --config ../../redocly.yaml",
137
144
  "lint:fix": "biome lint --write --no-errors-on-unmatched",
138
145
  "typecheck": "tsc --noEmit && echo '✅ No type errors found.'",
139
146
  "test": "vitest run --coverage",
@@ -1,54 +0,0 @@
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_router = require('../router-BOR7T6qR.cjs');
17
- const require_validate = require('../validate-DydOAZha.cjs');
18
- let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
19
- let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
20
-
21
- //#region source/actions/app-config.ts
22
- /** Router for the app config actions. */
23
- const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "app-config" }));
24
- /** GET / - Get app config */
25
- router.get("/", { handler: async (_req, { logger, rawParams }) => {
26
- const rawAppConfig = rawParams.appConfig;
27
- if (!rawAppConfig) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)("Could not find or parse the app.commerce.manifest.json file, is it present and valid?");
28
- let appConfig = rawAppConfig;
29
- if (require_validate.hasBusinessConfigSchema(rawAppConfig)) {
30
- logger.debug("Resolving business config schema...");
31
- const schema = await (0, _adobe_aio_commerce_lib_config.resolveBusinessConfigSchema)(rawAppConfig.businessConfig.schema, rawParams);
32
- appConfig = {
33
- ...rawAppConfig,
34
- businessConfig: {
35
- ...rawAppConfig.businessConfig,
36
- schema
37
- }
38
- };
39
- }
40
- logger.debug("Validating app config...");
41
- const config = require_validate.validateCommerceAppConfig(appConfig);
42
- logger.debug("Successfully validated the app config");
43
- return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: config });
44
- } });
45
- /** Factory to create the route handler for the `app-config` action. */
46
- const appConfigRuntimeAction = ({ appConfig }) => async (params) => {
47
- return await router.handler()({
48
- ...params,
49
- appConfig
50
- });
51
- };
52
-
53
- //#endregion
54
- exports.appConfigRuntimeAction = appConfigRuntimeAction;