@adobe/aio-commerce-lib-app 1.5.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 (67) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/cjs/actions/app-config/index.cjs +202 -0
  3. package/dist/cjs/actions/{app-config.d.cts → app-config/index.d.cts} +11 -9
  4. package/dist/cjs/actions/{config.cjs → config/index.cjs} +79 -46
  5. package/dist/{es/actions/config.d.mts → cjs/actions/config/index.d.cts} +10 -8
  6. package/dist/cjs/actions/{installation.cjs → installation/index.cjs} +55 -36
  7. package/dist/{es/actions/installation.d.mts → cjs/actions/installation/index.d.cts} +11 -10
  8. package/dist/cjs/actions/{registration.cjs → registration/index.cjs} +16 -7
  9. package/dist/cjs/actions/{registration.d.cts → registration/index.d.cts} +8 -9
  10. package/dist/cjs/actions/{scope-tree.cjs → scope-tree/index.cjs} +52 -15
  11. package/dist/{es/actions/scope-tree.d.mts → cjs/actions/scope-tree/index.d.cts} +2 -5
  12. package/dist/cjs/{admin-ui-sdk-BiSopnKI.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 +241 -56
  15. package/dist/cjs/commands/templates/app-management/app-config.js.template +2 -2
  16. package/dist/cjs/config/index.cjs +3 -3
  17. package/dist/cjs/config/index.d.cts +181 -1158
  18. package/dist/cjs/{config-ct-qMOGj.cjs → config-D-s0GSep.cjs} +4 -6
  19. package/dist/cjs/{error-C5LNOZ4f.cjs → error-D-N0PKSl.cjs} +0 -1
  20. package/dist/cjs/{index-B5WKJ3hJ.d.cts → index-B5gJ-q4U.d.cts} +172 -3
  21. package/dist/cjs/index-BXm8UbK7.d.cts +16 -0
  22. package/dist/cjs/{logging-BTevALnL.cjs → logging-BVz3weoC.cjs} +1 -1
  23. package/dist/cjs/management/index.cjs +1 -1
  24. package/dist/cjs/management/index.d.cts +2 -3
  25. package/dist/cjs/{management-D1QXg4YU.cjs → management-Dehz9qSJ.cjs} +114 -51
  26. package/dist/cjs/openapi-Cux6K4ZD.cjs +3072 -0
  27. package/dist/cjs/{router-CFErodHU.cjs → router-BOR7T6qR.cjs} +1 -1
  28. package/dist/cjs/{schemas-CukVpc19.cjs → schemas-FngDuIeo.cjs} +1 -1
  29. package/dist/cjs/{validate-b_bI4mDb.cjs → validate-oAOpyFyb.cjs} +49 -17
  30. package/dist/cjs/{webhooks-DS1BtgED.cjs → webhooks-tbZy9G3p.cjs} +4 -4
  31. package/dist/es/actions/{app-config.d.mts → app-config/index.d.mts} +11 -9
  32. package/dist/es/actions/app-config/index.mjs +199 -0
  33. package/dist/{cjs/actions/config.d.cts → es/actions/config/index.d.mts} +10 -8
  34. package/dist/es/actions/{config.mjs → config/index.mjs} +78 -45
  35. package/dist/{cjs/actions/installation.d.cts → es/actions/installation/index.d.mts} +11 -10
  36. package/dist/es/actions/{installation.mjs → installation/index.mjs} +54 -36
  37. package/dist/es/actions/{registration.d.mts → registration/index.d.mts} +8 -9
  38. package/dist/es/actions/{registration.mjs → registration/index.mjs} +16 -6
  39. package/dist/{cjs/actions/scope-tree.d.cts → es/actions/scope-tree/index.d.mts} +2 -5
  40. package/dist/es/actions/{scope-tree.mjs → scope-tree/index.mjs} +51 -14
  41. package/dist/es/{admin-ui-sdk-CCo2SWiL.d.mts → admin-ui-sdk-BwnD0xjK.d.mts} +6 -9
  42. package/dist/es/app-DrYHK-z1.d.mts +1629 -0
  43. package/dist/es/commands/index.mjs +223 -38
  44. package/dist/es/commands/templates/app-management/app-config.js.template +2 -2
  45. package/dist/es/config/index.d.mts +181 -1157
  46. package/dist/es/config/index.mjs +3 -3
  47. package/dist/es/{config-DGPFTk6w.mjs → config-3I4eLyyR.mjs} +4 -5
  48. package/dist/es/index-B0XqHwY5.d.mts +16 -0
  49. package/dist/es/{index-CCov0odd.d.mts → index-DLMbTtKS.d.mts} +172 -3
  50. package/dist/es/management/index.d.mts +2 -3
  51. package/dist/es/management/index.mjs +1 -1
  52. package/dist/es/{management-CCsOfniv.mjs → management-BUX-w2Ji.mjs} +113 -51
  53. package/dist/es/openapi-B6uP0SRn.mjs +3024 -0
  54. package/dist/es/{validate-Dn3lLTGj.mjs → validate-Dfajrp99.mjs} +37 -17
  55. package/dist/es/{webhooks-Dhrkkip7.mjs → webhooks-B5oq9ULL.mjs} +3 -3
  56. package/package.json +29 -17
  57. package/dist/cjs/actions/app-config.cjs +0 -41
  58. package/dist/cjs/app-C6kImBl7.d.cts +0 -564
  59. package/dist/cjs/step-CWYnKbga.d.cts +0 -187
  60. package/dist/es/actions/app-config.mjs +0 -39
  61. package/dist/es/app-DcY6dJiQ.d.mts +0 -564
  62. package/dist/es/step-0eI2x4C9.d.mts +0 -187
  63. /package/dist/cjs/{chunk-DS2yp5vX.cjs → chunk-Cozy-1ZF.cjs} +0 -0
  64. /package/dist/es/{error-DHlYzkbb.mjs → error-_RMwtrUA.mjs} +0 -0
  65. /package/dist/es/{logging-XIUXDK5T.mjs → logging-DbJHXSKh.mjs} +0 -0
  66. /package/dist/es/{router-BxaxEEu3.mjs → router-D58JJHHA.mjs} +0 -0
  67. /package/dist/es/{schemas-DOcnD16x.mjs → schemas-hRovglBF.mjs} +0 -0
@@ -12,11 +12,11 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { t as alphaNumericOrHyphenSchema } from "./schemas-DOcnD16x.mjs";
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-Dhrkkip7.mjs";
15
+ import { t as alphaNumericOrHyphenSchema } from "./schemas-hRovglBF.mjs";
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
17
  import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
18
- import * as v from "valibot";
19
18
  import { SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
19
+ import * as v from "valibot";
20
20
 
21
21
  //#region source/config/schema/business-configuration.ts
22
22
  /**
@@ -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 };
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { a as stringValueSchema, i as positiveNumberValueSchema, n as booleanValueSchema, r as nonEmptyStringValueSchema, t as alphaNumericOrHyphenSchema } from "./schemas-DOcnD16x.mjs";
15
+ import { a as stringValueSchema, i as positiveNumberValueSchema, n as booleanValueSchema, r as nonEmptyStringValueSchema, t as alphaNumericOrHyphenSchema } from "./schemas-hRovglBF.mjs";
16
16
  import * as v from "valibot";
17
17
 
18
18
  //#region source/config/schema/admin-ui-sdk.ts
@@ -292,8 +292,8 @@ const ExternalEventSourceSchema = v.object({
292
292
  });
293
293
  /** Schema for eventing configuration with separate commerce and external arrays */
294
294
  const EventingSchema = v.object({
295
- commerce: v.optional(v.array(CommerceEventSourceSchema, "Expected an array of Commerce event sources")),
296
- external: v.optional(v.array(ExternalEventSourceSchema, "Expected an array of external event sources"))
295
+ commerce: v.optional(v.pipe(v.array(CommerceEventSourceSchema, "Expected an array of Commerce event sources"), v.check((sources) => new Set(sources.map((s) => s.provider.label)).size === sources.length, "Commerce provider labels must be unique"))),
296
+ external: v.optional(v.pipe(v.array(ExternalEventSourceSchema, "Expected an array of external event sources"), v.check((sources) => new Set(sources.map((s) => s.provider.label)).size === sources.length, "External provider labels must be unique")))
297
297
  });
298
298
  /**
299
299
  * Check if config has commerce event sources.
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.5.0",
5
+ "version": "1.7.0",
6
6
  "private": false,
7
7
  "engines": {
8
8
  "node": ">=22 <=24"
@@ -31,15 +31,19 @@
31
31
  "bin": {
32
32
  "aio-commerce-lib-app": "./bin/cli.mjs"
33
33
  },
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.org",
36
+ "access": "public"
37
+ },
34
38
  "exports": {
35
39
  "./actions/*": {
36
40
  "import": {
37
- "types": "./dist/es/actions/*.d.mts",
38
- "default": "./dist/es/actions/*.mjs"
41
+ "types": "./dist/es/actions/*/index.d.mts",
42
+ "default": "./dist/es/actions/*/index.mjs"
39
43
  },
40
44
  "require": {
41
- "types": "./dist/cjs/actions/*.d.cts",
42
- "default": "./dist/cjs/actions/*.cjs"
45
+ "types": "./dist/cjs/actions/*/index.d.cts",
46
+ "default": "./dist/cjs/actions/*/index.cjs"
43
47
  }
44
48
  },
45
49
  "./config": {
@@ -66,6 +70,7 @@
66
70
  },
67
71
  "imports": {
68
72
  "#*": "./source/*.ts",
73
+ "#openapi.json": "./docs/openapi.json",
69
74
  "#test/*": "./test/*.ts",
70
75
  "#templates/*": "./source/commands/generate/actions/templates/*.template"
71
76
  },
@@ -82,10 +87,12 @@
82
87
  "@adobe/aio-lib-files": "^4.1.2",
83
88
  "@adobe/aio-lib-ims": "^8.1.1",
84
89
  "@adobe/aio-lib-state": "^5.3.1",
85
- "@npmcli/package-json": "^7.0.5",
90
+ "@npmcli/package-json": "^8.0.0",
91
+ "@standard-schema/spec": "^1.1.0",
86
92
  "camelcase": "^9.0.0",
87
93
  "consola": "^3.4.2",
88
94
  "dotenv": "^17.2.3",
95
+ "esbuild": "^0.28.0",
89
96
  "jiti": "^2.6.1",
90
97
  "ky": "^1.9.0",
91
98
  "openwhisk": "^3.21.8",
@@ -96,39 +103,44 @@
96
103
  "type-fest": "^5.0.0",
97
104
  "valibot": "^1.1.0",
98
105
  "yaml": "^2.8.1",
99
- "@adobe/aio-commerce-lib-api": "1.2.0",
100
- "@adobe/aio-commerce-lib-auth": "1.1.0",
101
- "@adobe/aio-commerce-lib-config": "1.4.0",
102
- "@adobe/aio-commerce-lib-core": "1.1.0",
103
- "@adobe/aio-commerce-lib-events": "1.2.0",
104
- "@adobe/aio-commerce-lib-webhooks": "1.1.0"
106
+ "@adobe/aio-commerce-lib-admin-ui": "0.1.0",
107
+ "@adobe/aio-commerce-lib-api": "1.2.1",
108
+ "@adobe/aio-commerce-lib-auth": "1.1.1",
109
+ "@adobe/aio-commerce-lib-config": "1.5.1",
110
+ "@adobe/aio-commerce-lib-core": "1.1.1",
111
+ "@adobe/aio-commerce-lib-events": "1.2.1",
112
+ "@adobe/aio-commerce-lib-webhooks": "1.1.2"
105
113
  },
106
114
  "devDependencies": {
107
115
  "@types/npmcli__package-json": "^4.0.4",
108
116
  "msw": "^2.11.1",
117
+ "openapi-format": "1.32.1",
109
118
  "typescript": "^6.0.0",
110
- "@aio-commerce-sdk/common-utils": "0.2.4",
119
+ "@aio-commerce-sdk/common-utils": "0.2.5",
111
120
  "@aio-commerce-sdk/config-tsdown": "1.0.1",
112
121
  "@aio-commerce-sdk/config-typedoc": "1.0.0",
113
122
  "@aio-commerce-sdk/config-typescript": "1.0.0",
114
123
  "@aio-commerce-sdk/config-vitest": "1.0.0",
115
- "@aio-commerce-sdk/scripting-utils": "0.3.2",
124
+ "@aio-commerce-sdk/scripting-utils": "0.3.3",
116
125
  "@aio-commerce-sdk/scripts": "0.1.0"
117
126
  },
118
127
  "sideEffects": false,
119
128
  "scripts": {
129
+ "version": "pnpx tsx scripts/sync-openapi-version.ts",
120
130
  "build": "tsdown",
121
131
  "pack": "pnpm pack",
122
132
  "publint": "publint",
123
133
  "docs": "typedoc && prettier --write '**/*.md'",
124
134
  "assist": "biome check --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
125
135
  "assist:apply": "biome check --write --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
126
- "check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched",
127
- "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",
128
138
  "format": "biome format --write --no-errors-on-unmatched",
129
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",
130
141
  "format:check": "biome format --no-errors-on-unmatched",
131
- "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",
132
144
  "lint:fix": "biome lint --write --no-errors-on-unmatched",
133
145
  "typecheck": "tsc --noEmit && echo '✅ No type errors found.'",
134
146
  "test": "vitest run --coverage",
@@ -1,41 +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_chunk = require('../chunk-DS2yp5vX.cjs');
17
- const require_router = require('../router-CFErodHU.cjs');
18
- const require_validate = require('../validate-b_bI4mDb.cjs');
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
- logger.debug("Validating app config...");
27
- const { appConfig } = rawParams;
28
- const config = require_validate.validateCommerceAppConfig(appConfig);
29
- logger.debug("Successfully validated the app config");
30
- return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: config });
31
- } });
32
- /** Factory to create the route handler for the `app-config` action. */
33
- const appConfigRuntimeAction = ({ appConfig }) => async (params) => {
34
- return await router.handler()({
35
- ...params,
36
- appConfig
37
- });
38
- };
39
-
40
- //#endregion
41
- exports.appConfigRuntimeAction = appConfigRuntimeAction;