@adobe/aio-commerce-lib-app 1.0.2 → 1.1.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.cjs +18 -4
  3. package/dist/cjs/actions/app-config.d.cts +15 -1
  4. package/dist/cjs/actions/config.cjs +17 -3
  5. package/dist/cjs/actions/config.d.cts +14 -0
  6. package/dist/cjs/actions/installation.cjs +70 -16
  7. package/dist/cjs/actions/installation.d.cts +16 -2
  8. package/dist/cjs/actions/scope-tree.cjs +17 -3
  9. package/dist/cjs/actions/scope-tree.d.cts +14 -0
  10. package/dist/cjs/{app-DWX5-Hsf.d.cts → app-lymFcs59.d.cts} +146 -1
  11. package/dist/cjs/commands/index.cjs +41 -27
  12. package/dist/cjs/commands/index.d.cts +14 -0
  13. package/dist/cjs/config/index.cjs +27 -12
  14. package/dist/cjs/config/index.d.cts +576 -4
  15. package/dist/cjs/{parser-BPpg_9QB.cjs → config-YEeaEqzi.cjs} +17 -3
  16. package/dist/cjs/error-Dn7ool6k.cjs +38 -0
  17. package/dist/{es/runner-BD-lItnK.d.mts → cjs/index-DRhLtRrX.d.cts} +102 -4
  18. package/dist/cjs/logging-4s36JTiN.cjs +39 -0
  19. package/dist/cjs/management/index.cjs +23 -8
  20. package/dist/cjs/management/index.d.cts +16 -2
  21. package/dist/cjs/{runner-NHMvoMO2.cjs → management-PZtLe4Ji.cjs} +371 -30
  22. package/dist/cjs/{router-DCw7oEQ9.cjs → router-KeQRduO3.cjs} +15 -1
  23. package/dist/cjs/{schemas-CZ6c8Id9.cjs → schemas-nkIxa8sL.cjs} +34 -0
  24. package/dist/cjs/{validate-Btzn9ilZ.cjs → validate-CwwYD8aC.cjs} +31 -14
  25. package/dist/cjs/{installation-CLbceU9F.cjs → webhooks-CbZpv9y_.cjs} +105 -1
  26. package/dist/es/actions/app-config.d.mts +15 -1
  27. package/dist/es/actions/app-config.mjs +17 -3
  28. package/dist/es/actions/config.d.mts +14 -0
  29. package/dist/es/actions/config.mjs +17 -3
  30. package/dist/es/actions/installation.d.mts +16 -2
  31. package/dist/es/actions/installation.mjs +64 -10
  32. package/dist/es/actions/scope-tree.d.mts +14 -0
  33. package/dist/es/actions/scope-tree.mjs +17 -3
  34. package/dist/es/{app-BAiyvNo2.d.mts → app-Ct7Y0NP8.d.mts} +146 -1
  35. package/dist/es/commands/index.d.mts +14 -0
  36. package/dist/es/commands/index.mjs +21 -7
  37. package/dist/es/config/index.d.mts +576 -4
  38. package/dist/es/config/index.mjs +18 -4
  39. package/dist/es/{parser-CQZTVG6i.mjs → config-BbrkH0Xt.mjs} +16 -2
  40. package/dist/es/error-DHlYzkbb.mjs +32 -0
  41. package/dist/{cjs/runner-DemKouFJ.d.cts → es/index-D33OCH0D.d.mts} +102 -4
  42. package/dist/es/logging-XIUXDK5T.mjs +32 -0
  43. package/dist/es/management/index.d.mts +16 -2
  44. package/dist/es/management/index.mjs +16 -2
  45. package/dist/es/{runner-vwAhjD5r.mjs → management-CIoVWirU.mjs} +360 -25
  46. package/dist/es/{router-CJ4VWoCt.mjs → router-BxaxEEu3.mjs} +14 -0
  47. package/dist/es/{schemas-B8yIv0_b.mjs → schemas-BvPxQwgQ.mjs} +29 -1
  48. package/dist/es/{validate-DKnju9-R.mjs → validate-qRpfubPo.mjs} +21 -4
  49. package/dist/es/{installation-BTL9X7iv.mjs → webhooks-NgM6k3_r.mjs} +94 -2
  50. package/package.json +10 -7
  51. package/dist/cjs/error-DJ2UAPH2.cjs +0 -24
  52. package/dist/cjs/logging-IDRQG0as.cjs +0 -25
  53. package/dist/es/error-CMV3IjBz.mjs +0 -18
  54. package/dist/es/logging-CzmXDzxI.mjs +0 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @adobe/aio-commerce-lib-app
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#273](https://github.com/adobe/aio-commerce-sdk/pull/273) [`660cf05`](https://github.com/adobe/aio-commerce-sdk/commit/660cf058d2439de82b3e22376c3d494b2a83045f) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Added the functionality to define and install webhooks in the installation flow of the app.
8
+
9
+ - [#285](https://github.com/adobe/aio-commerce-sdk/pull/285) [`cda7712`](https://github.com/adobe/aio-commerce-sdk/commit/cda7712ac74b3bd9700aaa243a8b67d3a3d74d91) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Added a new endpoint /installation/validation to perform validation before the app is installed. Added webhook-specific validation for possible conflicts.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#349](https://github.com/adobe/aio-commerce-sdk/pull/349) [`3abfe95`](https://github.com/adobe/aio-commerce-sdk/commit/3abfe9503f491aad3a2105d617fc8aa1c7b4725e) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Normalize event names and application IDs to lowercase to prevent case-sensitivity issues and ensure consistent event delivery.
14
+
15
+ - [#343](https://github.com/adobe/aio-commerce-sdk/pull/343) [`4883afa`](https://github.com/adobe/aio-commerce-sdk/commit/4883afaec90451cd7daf280f0def83ea45a3c87c) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Fixed IMS client secret parsing logic for the webhook subscription
16
+
17
+ - [#310](https://github.com/adobe/aio-commerce-sdk/pull/310) [`8f6ad9d`](https://github.com/adobe/aio-commerce-sdk/commit/8f6ad9ddcaae0f0a5a116bcbbefaae49f97697eb) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Improved validation error messages across schema files.
18
+
19
+ - Updated dependencies [[`660cf05`](https://github.com/adobe/aio-commerce-sdk/commit/660cf058d2439de82b3e22376c3d494b2a83045f), [`cb9c11d`](https://github.com/adobe/aio-commerce-sdk/commit/cb9c11dfd243d3034763374fe5416645015b46a9), [`4883afa`](https://github.com/adobe/aio-commerce-sdk/commit/4883afaec90451cd7daf280f0def83ea45a3c87c)]:
20
+ - @adobe/aio-commerce-lib-webhooks@0.1.0
21
+ - @adobe/aio-commerce-lib-auth@1.0.1
22
+ - @adobe/aio-commerce-lib-api@1.0.1
23
+ - @adobe/aio-commerce-lib-events@1.0.1
24
+ - @adobe/aio-commerce-lib-config@1.0.3
25
+
3
26
  ## 1.0.2
4
27
 
5
28
  ### Patch Changes
@@ -1,12 +1,26 @@
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
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_schemas = require('../schemas-CZ6c8Id9.cjs');
3
- const require_router = require('../router-DCw7oEQ9.cjs');
4
- const require_validate = require('../validate-Btzn9ilZ.cjs');
16
+ const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
+ const require_router = require('../router-KeQRduO3.cjs');
18
+ const require_validate = require('../validate-CwwYD8aC.cjs');
5
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
6
20
 
7
21
  //#region source/actions/app-config.ts
8
22
  /** Router for the app config actions. */
9
- const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "get-app-config" }));
23
+ const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "app-config" }));
10
24
  /** GET / - Get app config */
11
25
  router.get("/", { handler: async (_req, { logger, rawParams }) => {
12
26
  logger.debug("Validating app config...");
@@ -1,4 +1,18 @@
1
- import { n as CommerceAppConfigOutputModel } from "../app-DWX5-Hsf.cjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { n as CommerceAppConfigOutputModel } from "../app-lymFcs59.cjs";
2
16
  import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
3
17
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
4
18
 
@@ -1,7 +1,21 @@
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
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_schemas = require('../schemas-CZ6c8Id9.cjs');
3
- const require_router = require('../router-DCw7oEQ9.cjs');
4
- const require_validate = require('../validate-Btzn9ilZ.cjs');
16
+ const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
+ const require_router = require('../router-KeQRduO3.cjs');
18
+ const require_validate = require('../validate-CwwYD8aC.cjs');
5
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
6
20
  let valibot = require("valibot");
7
21
  valibot = require_schemas.__toESM(valibot);
@@ -1,3 +1,17 @@
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
+
1
15
  import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
2
16
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
3
17
  import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
@@ -1,7 +1,21 @@
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
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_schemas = require('../schemas-CZ6c8Id9.cjs');
3
- const require_router = require('../router-DCw7oEQ9.cjs');
4
- const require_runner = require('../runner-NHMvoMO2.cjs');
16
+ const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
+ const require_router = require('../router-KeQRduO3.cjs');
18
+ const require_management = require('../management-PZtLe4Ji.cjs');
5
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
6
20
  let valibot = require("valibot");
7
21
  valibot = require_schemas.__toESM(valibot);
@@ -246,13 +260,21 @@ const AppDataSchema = valibot.object({
246
260
  //#endregion
247
261
  //#region source/actions/installation.ts
248
262
  const DEFAULT_ACTION_NAME = "app-management/installation";
263
+ /** Request body schema shared by POST / and POST /validation. */
264
+ const InstallationRequestBodySchema = (0, valibot.object)({
265
+ appData: AppDataSchema,
266
+ commerceBaseUrl: (0, valibot.string)(),
267
+ commerceEnv: (0, valibot.string)(),
268
+ ioEventsUrl: (0, valibot.string)(),
269
+ ioEventsEnv: (0, valibot.string)()
270
+ });
249
271
  /** Creates an installation state store using lib-core combined storage. */
250
272
  function createInstallationStore() {
251
273
  return createCombinedStore({
252
274
  cache: { keyPrefix: "installation" },
253
275
  persistent: {
254
276
  dirPrefix: "installation",
255
- shouldPersist: require_runner.isCompletedState
277
+ shouldPersist: require_management.isCompletedState
256
278
  }
257
279
  });
258
280
  }
@@ -313,23 +335,17 @@ router.get("/", { handler: async (_req, { logger }) => {
313
335
  * 3. If not found or failed: create plan, invoke execution async, return 202 Accepted
314
336
  */
315
337
  router.post("/", {
316
- body: (0, valibot.object)({
317
- appData: AppDataSchema,
318
- commerceBaseUrl: (0, valibot.string)(),
319
- commerceEnv: (0, valibot.string)(),
320
- ioEventsUrl: (0, valibot.string)(),
321
- ioEventsEnv: (0, valibot.string)()
322
- }),
338
+ body: InstallationRequestBodySchema,
323
339
  handler: async (req, { logger, rawParams }) => {
324
340
  logger.debug("Starting installation...");
325
341
  const store = await createInstallationStore();
326
342
  const existingState = await store.get(getStorageKey());
327
343
  if (existingState) {
328
- if (require_runner.isInProgressState(existingState)) {
344
+ if (require_management.isInProgressState(existingState)) {
329
345
  logger.debug(`Installation already in progress: ${existingState.status}`);
330
346
  return (0, _adobe_aio_commerce_lib_core_responses.conflict)(`Installation is already ${existingState.status}. Wait for it to complete.`);
331
347
  }
332
- if (require_runner.isSucceededState(existingState)) {
348
+ if (require_management.isSucceededState(existingState)) {
333
349
  logger.debug("Installation already succeeded");
334
350
  return (0, _adobe_aio_commerce_lib_core_responses.conflict)("Installation has already completed successfully.");
335
351
  }
@@ -337,7 +353,7 @@ router.post("/", {
337
353
  }
338
354
  const appConfig = rawParams.appConfig;
339
355
  if (!appConfig) 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?");
340
- const initialState = require_runner.createInitialInstallationState({ config: appConfig });
356
+ const initialState = require_management.createInitialInstallationState({ config: appConfig });
341
357
  logger.debug(`Created initial state: ${initialState.id}`);
342
358
  await store.put(getStorageKey(), initialState);
343
359
  const activation = await (0, openwhisk.default)().actions.invoke({
@@ -385,7 +401,7 @@ router.post("/execution", { handler: async (_req, { logger, rawParams }) => {
385
401
  customScripts: params.customScriptsLoader?.(appConfig, logger) || {}
386
402
  };
387
403
  logger.debug(`Executing installation: ${initialState.id}`);
388
- const result = await require_runner.runInstallation({
404
+ const result = await require_management.runInstallation({
389
405
  installationContext,
390
406
  config: appConfig,
391
407
  initialState,
@@ -393,7 +409,7 @@ router.post("/execution", { handler: async (_req, { logger, rawParams }) => {
393
409
  });
394
410
  await store.put(getStorageKey(), result);
395
411
  logger.debug(`Installation completed: ${result.status}`);
396
- if (require_runner.isFailedState(result)) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)({ body: {
412
+ if (require_management.isFailedState(result)) return (0, _adobe_aio_commerce_lib_core_responses.internalServerError)({ body: {
397
413
  message: "Installation failed",
398
414
  error: result.error,
399
415
  state: result
@@ -401,6 +417,44 @@ router.post("/execution", { handler: async (_req, { logger, rawParams }) => {
401
417
  return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: result });
402
418
  } });
403
419
  /**
420
+ * POST /installation/validation - Pre-installation validation
421
+ *
422
+ * Synchronously validates the step tree before installation begins.
423
+ * Accepts the same request body as POST / (installation start) so the
424
+ * frontend can reuse the same parameters without any extra mapping.
425
+ *
426
+ * Flow:
427
+ * 1. Build a ValidationContext from the request parameters
428
+ * 2. Call runValidation() — traverses the step tree and collects issues
429
+ * 3. Return the structured ValidationResult immediately (no async invoke)
430
+ */
431
+ router.post("/validation", {
432
+ body: InstallationRequestBodySchema,
433
+ handler: async (req, { logger, rawParams }) => {
434
+ logger.debug("Running pre-installation validation...");
435
+ const appConfig = rawParams.appConfig;
436
+ if (!appConfig) 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?");
437
+ const { appData, ...params } = {
438
+ ...rawParams,
439
+ appData: req.body.appData,
440
+ AIO_EVENTS_API_BASE_URL: req.body.ioEventsUrl,
441
+ AIO_COMMERCE_AUTH_IMS_ENVIRONMENT: req.body.ioEventsEnv,
442
+ AIO_COMMERCE_API_BASE_URL: req.body.commerceBaseUrl,
443
+ AIO_COMMERCE_API_FLAVOR: req.body.commerceEnv
444
+ };
445
+ const result = await require_management.runValidation({
446
+ validationContext: {
447
+ appData,
448
+ params,
449
+ logger
450
+ },
451
+ config: appConfig
452
+ });
453
+ logger.debug(`Validation complete — valid: ${result.valid}, errors: ${result.summary.errors}, warnings: ${result.summary.warnings}`);
454
+ return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: result });
455
+ }
456
+ });
457
+ /**
404
458
  * DELETE / - Clear installation state
405
459
  *
406
460
  * This endpoint allows clearing the installation state.
@@ -1,5 +1,19 @@
1
- import { n as CommerceAppConfigOutputModel } from "../app-DWX5-Hsf.cjs";
2
- import { P as InstallationContext } from "../runner-DemKouFJ.cjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { n as CommerceAppConfigOutputModel } from "../app-lymFcs59.cjs";
16
+ import { V as InstallationContext } from "../index-DRhLtRrX.cjs";
3
17
  import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
4
18
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
5
19
 
@@ -1,7 +1,21 @@
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
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_schemas = require('../schemas-CZ6c8Id9.cjs');
3
- const require_router = require('../router-DCw7oEQ9.cjs');
4
- const require_logging = require('../logging-IDRQG0as.cjs');
16
+ const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
+ const require_router = require('../router-KeQRduO3.cjs');
18
+ const require_logging = require('../logging-4s36JTiN.cjs');
5
19
  let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
6
20
  let valibot = require("valibot");
7
21
  valibot = require_schemas.__toESM(valibot);
@@ -1,3 +1,17 @@
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
+
1
15
  import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
2
16
  import * as _adobe_aio_commerce_lib_core_params0 from "@adobe/aio-commerce-lib-core/params";
3
17
 
@@ -1,3 +1,17 @@
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
+
1
15
  import * as v from "valibot";
2
16
 
3
17
  //#region source/config/schema/app.d.ts
@@ -7,7 +21,7 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
7
21
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
8
22
  readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
9
23
  readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
10
- readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format">]>;
24
+ readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')">]>;
11
25
  }, undefined>;
12
26
  readonly businessConfig: v.OptionalSchema<v.ObjectSchema<{
13
27
  readonly schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.VariantSchema<"selectionMode", [v.ObjectSchema<{
@@ -172,6 +186,137 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
172
186
  description: string;
173
187
  }[] | undefined, "Duplicate step names detected in custom installation steps. Each step must have a unique name.">]>;
174
188
  }, undefined>, undefined>;
189
+ readonly webhooks: v.OptionalSchema<v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.UnionSchema<[v.ObjectSchema<{
190
+ readonly label: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
191
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
192
+ readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["validation", "append", "modification"], `Webhook category must be one of: ${string}`>, undefined>;
193
+ readonly runtimeAction: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
194
+ readonly requireAdobeAuth: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
195
+ readonly webhook: v.ObjectSchema<{
196
+ readonly webhook_method: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
197
+ readonly webhook_type: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
198
+ readonly batch_name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "batch_name must contain only letters, numbers, and underscores">]>;
199
+ readonly batch_order: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
200
+ readonly hook_name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "hook_name must contain only letters, numbers, and underscores">]>;
201
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
202
+ readonly required: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
203
+ readonly soft_timeout: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
204
+ readonly timeout: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
205
+ readonly method: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
206
+ readonly fallback_error_message: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
207
+ readonly ttl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
208
+ readonly fields: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
209
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
210
+ readonly source: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
211
+ }, undefined>, "Expected an array of webhook field objects">, undefined>;
212
+ readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
213
+ readonly field: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
214
+ readonly operator: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
215
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
216
+ }, undefined>, "Expected an array of webhook rule objects">, undefined>;
217
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
218
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
219
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
220
+ }, undefined>, "Expected an array of webhook header objects">, undefined>;
221
+ }, undefined>;
222
+ }, undefined>, v.ObjectSchema<{
223
+ readonly label: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
224
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
225
+ readonly category: v.OptionalSchema<v.PicklistSchema<readonly ["validation", "append", "modification"], `Webhook category must be one of: ${string}`>, undefined>;
226
+ readonly webhook: v.ObjectSchema<{
227
+ readonly url: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.UrlAction<string, "The 'url' field must be a valid absolute URL (e.g., 'https://example.com/webhook')">]>;
228
+ readonly webhook_method: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
229
+ readonly webhook_type: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
230
+ readonly batch_name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "batch_name must contain only letters, numbers, and underscores">]>;
231
+ readonly batch_order: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
232
+ readonly hook_name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "hook_name must contain only letters, numbers, and underscores">]>;
233
+ readonly priority: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
234
+ readonly required: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
235
+ readonly soft_timeout: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
236
+ readonly timeout: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
237
+ readonly method: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
238
+ readonly fallback_error_message: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
239
+ readonly ttl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<`Expected a number value for '${string}'`>, v.MinValueAction<number, 0, `The value of ${string} must be a non-negative number`>]>, undefined>;
240
+ readonly fields: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
241
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
242
+ readonly source: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
243
+ }, undefined>, "Expected an array of webhook field objects">, undefined>;
244
+ readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
245
+ readonly field: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
246
+ readonly operator: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
247
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
248
+ }, undefined>, "Expected an array of webhook rule objects">, undefined>;
249
+ readonly headers: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
250
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
251
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
252
+ }, undefined>, "Expected an array of webhook header objects">, undefined>;
253
+ }, undefined>;
254
+ }, undefined>], "Each webhook entry must define either a 'runtimeAction' (to resolve the URL from a runtime action) or an explicit 'url' inside the 'webhook' object, but not both">, "Expected an array of webhook entries">, v.MinLengthAction<({
255
+ label: string;
256
+ description: string;
257
+ category?: "validation" | "append" | "modification" | undefined;
258
+ runtimeAction: string;
259
+ requireAdobeAuth?: boolean | undefined;
260
+ webhook: {
261
+ webhook_method: string;
262
+ webhook_type: string;
263
+ batch_name: string;
264
+ batch_order?: number | undefined;
265
+ hook_name: string;
266
+ priority?: number | undefined;
267
+ required?: boolean | undefined;
268
+ soft_timeout?: number | undefined;
269
+ timeout?: number | undefined;
270
+ method: string;
271
+ fallback_error_message?: string | undefined;
272
+ ttl?: number | undefined;
273
+ fields?: {
274
+ name: string;
275
+ source?: string | undefined;
276
+ }[] | undefined;
277
+ rules?: {
278
+ field: string;
279
+ operator: string;
280
+ value: string;
281
+ }[] | undefined;
282
+ headers?: {
283
+ name: string;
284
+ value: string;
285
+ }[] | undefined;
286
+ };
287
+ } | {
288
+ label: string;
289
+ description: string;
290
+ category?: "validation" | "append" | "modification" | undefined;
291
+ webhook: {
292
+ url: string;
293
+ webhook_method: string;
294
+ webhook_type: string;
295
+ batch_name: string;
296
+ batch_order?: number | undefined;
297
+ hook_name: string;
298
+ priority?: number | undefined;
299
+ required?: boolean | undefined;
300
+ soft_timeout?: number | undefined;
301
+ timeout?: number | undefined;
302
+ method: string;
303
+ fallback_error_message?: string | undefined;
304
+ ttl?: number | undefined;
305
+ fields?: {
306
+ name: string;
307
+ source?: string | undefined;
308
+ }[] | undefined;
309
+ rules?: {
310
+ field: string;
311
+ operator: string;
312
+ value: string;
313
+ }[] | undefined;
314
+ headers?: {
315
+ name: string;
316
+ value: string;
317
+ }[] | undefined;
318
+ };
319
+ })[], 1, "webhooks array must contain at least one webhook when present">]>, undefined>, undefined>;
175
320
  }, undefined>;
176
321
  /** The input shape of the commerce app config schema. */
177
322
  type CommerceAppConfig = v.InferInput<typeof CommerceAppConfigSchema>;