@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
@@ -1,10 +1,24 @@
1
1
  #!/usr/bin/env node
2
- const require_schemas = require('../schemas-CZ6c8Id9.cjs');
3
- const require_validate = require('../validate-Btzn9ilZ.cjs');
4
- const require_installation = require('../installation-CLbceU9F.cjs');
5
- const require_parser = require('../parser-BPpg_9QB.cjs');
6
- const require_error = require('../error-DJ2UAPH2.cjs');
7
- const require_logging = require('../logging-IDRQG0as.cjs');
2
+ /**
3
+ * @license
4
+ *
5
+ * Copyright 2026 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ const require_schemas = require('../schemas-nkIxa8sL.cjs');
17
+ const require_validate = require('../validate-CwwYD8aC.cjs');
18
+ const require_webhooks = require('../webhooks-CbZpv9y_.cjs');
19
+ const require_config = require('../config-YEeaEqzi.cjs');
20
+ const require_error = require('../error-Dn7ool6k.cjs');
21
+ const require_logging = require('../logging-4s36JTiN.cjs');
8
22
  let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
9
23
  let path = require("path");
10
24
  path = require_schemas.__toESM(path);
@@ -201,7 +215,7 @@ async function buildHooks(extConfig, hooks) {
201
215
  pair.key.spaceBefore = true;
202
216
  pair.key.commentBefore = ` The ${generatedHooks} hooks are auto-generated. Do not remove or manually edit.`;
203
217
  } });
204
- const execCommand = require_parser.getExecCommand(await require_parser.detectPackageManager());
218
+ const execCommand = require_config.getExecCommand(await require_config.detectPackageManager());
205
219
  for (const [name, command] of Object.entries(hooks)) {
206
220
  const fullCommand = `${command.replaceAll("$packageExec", execCommand)}`;
207
221
  const prevValue = (hooksMap.get(name) ?? "").trim();
@@ -258,7 +272,7 @@ function getExtensionPointFolderPath(extensionPointId) {
258
272
  //#region source/commands/utils.ts
259
273
  /** Load the app commerce config */
260
274
  async function loadAppManifest() {
261
- const appConfig = await require_parser.parseCommerceAppConfig();
275
+ const appConfig = await require_config.parseCommerceAppConfig();
262
276
  consola.default.debug("Loaded app commerce config");
263
277
  return appConfig;
264
278
  }
@@ -306,7 +320,7 @@ function createActionDefinition(actionName, config = {}, options = {}) {
306
320
  * @param extConfig - The ext.config.yaml configuration.
307
321
  */
308
322
  function getRuntimeActions(extConfig, dir) {
309
- return Object.entries(extConfig.runtimeManifest?.packages?.[PACKAGE_NAME]?.actions ?? {}).map(([name, _]) => ({
323
+ return Object.entries(extConfig.runtimeManifest?.packages?.["app-management"]?.actions ?? {}).map(([name, _]) => ({
310
324
  name,
311
325
  templateFile: (0, path.join)(dir, `${name}.js.template`)
312
326
  }));
@@ -391,7 +405,7 @@ async function exec$5() {
391
405
  /** Update the ext.config.yaml file */
392
406
  async function updateExtConfig(appConfig, extensionPointId) {
393
407
  consola.consola.info(`Updating ext.config.yaml for ${extensionPointId}...`);
394
- const extConfigPath = (0, path.join)(await require_parser.makeOutputDirFor(getExtensionPointFolderPath(extensionPointId)), "ext.config.yaml");
408
+ const extConfigPath = (0, path.join)(await require_config.makeOutputDirFor(getExtensionPointFolderPath(extensionPointId)), "ext.config.yaml");
395
409
  const extConfigDoc = await readYamlFile(extConfigPath);
396
410
  let extConfig;
397
411
  switch (extensionPointId) {
@@ -409,7 +423,7 @@ async function updateExtConfig(appConfig, extensionPointId) {
409
423
  /** Generate the action files */
410
424
  async function generateActionFiles(appManifest, actions, extensionPointId) {
411
425
  consola.consola.start("Generating runtime actions...");
412
- const outputDir = await require_parser.makeOutputDirFor((0, path.join)(getExtensionPointFolderPath(extensionPointId), GENERATED_ACTIONS_PATH));
426
+ const outputDir = await require_config.makeOutputDirFor((0, path.join)(getExtensionPointFolderPath(extensionPointId), GENERATED_ACTIONS_PATH));
413
427
  const outputFiles = [];
414
428
  const templatesDir = (0, path.join)(__dirname$1, "generate/actions/templates");
415
429
  for (const action of actions) {
@@ -439,8 +453,8 @@ function applyCustomScripts(installationTemplate, customScriptsTemplate) {
439
453
  * Generate the installation template with dynamic custom script imports
440
454
  */
441
455
  async function generateCustomScriptsTemplate(template, appManifest) {
442
- if (!require_installation.hasCustomInstallationSteps(appManifest)) return null;
443
- const projectRoot = await require_parser.getProjectRootDirectory();
456
+ if (!require_webhooks.hasCustomInstallationSteps(appManifest)) return null;
457
+ const projectRoot = await require_config.getProjectRootDirectory();
444
458
  const installationActionDir = (0, path.join)(projectRoot, getExtensionPointFolderPath(EXTENSIBILITY_EXTENSION_POINT_ID), GENERATED_ACTIONS_PATH);
445
459
  const customSteps = appManifest.installation.customInstallationSteps;
446
460
  const importStatements = customSteps.map((step, index) => {
@@ -461,7 +475,7 @@ async function generateCustomScriptsTemplate(template, appManifest) {
461
475
  async function run$3(appConfig) {
462
476
  consola.consola.info("Generating app manifest...");
463
477
  const contents = (0, safe_stable_stringify.stringify)(appConfig, null, 2);
464
- await (0, fs_promises.writeFile)((0, path.join)(await require_parser.makeOutputDirFor(`${getExtensionPointFolderPath(EXTENSIBILITY_EXTENSION_POINT_ID)}/.generated`), APP_MANIFEST_FILE), contents, "utf-8");
478
+ await (0, fs_promises.writeFile)((0, path.join)(await require_config.makeOutputDirFor(`${getExtensionPointFolderPath(EXTENSIBILITY_EXTENSION_POINT_ID)}/.generated`), APP_MANIFEST_FILE), contents, "utf-8");
465
479
  consola.consola.success(`Generated ${APP_MANIFEST_FILE}`);
466
480
  }
467
481
  /** Run the generate manifest command */
@@ -483,16 +497,16 @@ async function run$2(appConfig) {
483
497
  consola.consola.warn("Business configuration schema not found");
484
498
  return;
485
499
  }
486
- const projectDir = (0, path.dirname)(await require_parser.findNearestPackageJson() ?? process.cwd());
500
+ const projectDir = (0, path.dirname)(await require_config.findNearestPackageJson() ?? process.cwd());
487
501
  const envPath = (0, path.join)(projectDir, ".env");
488
502
  process.loadEnvFile(envPath);
489
503
  if (appConfig.businessConfig.schema.some((field) => field.type === "password")) {
490
- const packageExec = require_parser.getExecCommand(await require_parser.detectPackageManager(projectDir));
504
+ const packageExec = require_config.getExecCommand(await require_config.detectPackageManager(projectDir));
491
505
  if ("AIO_COMMERCE_CONFIG_ENCRYPTION_KEY" in process.env && String(process.env.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY).trim().length > 0) (0, child_process.execSync)(`${packageExec} aio-commerce-lib-config encryption validate`);
492
506
  else (0, child_process.execSync)(`${packageExec} aio-commerce-lib-config encryption setup`);
493
507
  }
494
508
  const contents = (0, safe_stable_stringify.stringify)(appConfig.businessConfig.schema, null, 2);
495
- await (0, fs_promises.writeFile)((0, path.join)(await require_parser.makeOutputDirFor(`${getExtensionPointFolderPath(CONFIGURATION_EXTENSION_POINT_ID)}/.generated`), CONFIG_SCHEMA_FILE_NAME), contents, "utf-8");
509
+ await (0, fs_promises.writeFile)((0, path.join)(await require_config.makeOutputDirFor(`${getExtensionPointFolderPath(CONFIGURATION_EXTENSION_POINT_ID)}/.generated`), CONFIG_SCHEMA_FILE_NAME), contents, "utf-8");
496
510
  consola.consola.success(`Generated ${CONFIG_SCHEMA_FILE_NAME}`);
497
511
  }
498
512
  /** Run the generate manifest command */
@@ -737,7 +751,7 @@ async function promptForCommerceAppConfig() {
737
751
  }
738
752
  /** Create the default commerce app config file content */
739
753
  async function getDefaultCommerceAppConfig(cwd, { appName, configFormat, domains }) {
740
- const needsESM = await require_parser.isESM(cwd) || configFormat === "ts";
754
+ const needsESM = await require_config.isESM(cwd) || configFormat === "ts";
741
755
  const exportKeyword = needsESM ? "export default" : "module.exports =";
742
756
  const importStatement = needsESM ? "import { defineConfig } from \"@adobe/aio-commerce-lib-app/config\";" : "const { defineConfig } = require(\"@adobe/aio-commerce-lib-app/config\");";
743
757
  const defaultConfig = { metadata: {
@@ -834,7 +848,7 @@ async function addExtensionPointToInstallYaml(extensionPointId, rootDirectory, c
834
848
  async function ensureCommerceAppConfig(cwd = process.cwd()) {
835
849
  let config = null;
836
850
  try {
837
- config = await require_parser.readCommerceAppConfig(cwd);
851
+ config = await require_config.readCommerceAppConfig(cwd);
838
852
  } catch (_) {}
839
853
  if (config) try {
840
854
  const validatedConfig = require_validate.validateCommerceAppConfig(config);
@@ -847,7 +861,7 @@ async function ensureCommerceAppConfig(cwd = process.cwd()) {
847
861
  throw new Error(`${COMMERCE_APP_CONFIG_FILE} is invalid`, { cause: error });
848
862
  }
849
863
  consola.consola.warn(`${COMMERCE_APP_CONFIG_FILE} not found.`);
850
- if (!await consola.consola.prompt(`Do you want to create a ${COMMERCE_APP_CONFIG_FILE} file? (y/n)`, {
864
+ if (!await consola.consola.prompt(`Do you want to create a ${"app.commerce.config"} file? (y/n)`, {
851
865
  type: "confirm",
852
866
  initial: true,
853
867
  default: false
@@ -856,7 +870,7 @@ async function ensureCommerceAppConfig(cwd = process.cwd()) {
856
870
  try {
857
871
  const configContent = await getDefaultCommerceAppConfig(cwd, answers);
858
872
  consola.consola.info(`Creating ${answers.configFile}...`);
859
- const path$2 = (0, path.join)(await require_parser.getProjectRootDirectory(cwd), answers.configFile);
873
+ const path$2 = (0, path.join)(await require_config.getProjectRootDirectory(cwd), answers.configFile);
860
874
  await (0, fs_promises.writeFile)(path$2, await prettier.format(configContent, {
861
875
  semi: true,
862
876
  quoteStyle: "double",
@@ -871,7 +885,7 @@ async function ensureCommerceAppConfig(cwd = process.cwd()) {
871
885
  }), "utf-8");
872
886
  consola.consola.success(`Created ${answers.configFile}`);
873
887
  return {
874
- config: await require_parser.parseCommerceAppConfig(cwd),
888
+ config: await require_config.parseCommerceAppConfig(cwd),
875
889
  domains: answers.domains
876
890
  };
877
891
  } catch (error) {
@@ -880,7 +894,7 @@ async function ensureCommerceAppConfig(cwd = process.cwd()) {
880
894
  }
881
895
  /** Ensure package.json has the postinstall script */
882
896
  async function ensurePackageJson(cwd = process.cwd()) {
883
- const packageJson = await require_parser.readPackageJson(cwd);
897
+ const packageJson = await require_config.readPackageJson(cwd);
884
898
  if (!packageJson) {
885
899
  consola.consola.warn("package.json not found. Creating one...");
886
900
  const packageJsonContent = {
@@ -897,8 +911,8 @@ async function ensurePackageJson(cwd = process.cwd()) {
897
911
  execCommand: "npx"
898
912
  };
899
913
  }
900
- const packageManager = await require_parser.detectPackageManager();
901
- const execCommand = require_parser.getExecCommand(packageManager);
914
+ const packageManager = await require_config.detectPackageManager();
915
+ const execCommand = require_config.getExecCommand(packageManager);
902
916
  const postinstallScript = `${execCommand} aio-commerce-lib-app hooks postinstall`;
903
917
  packageJson.scripts ??= {};
904
918
  if (packageJson.scripts.postinstall === postinstallScript || packageJson.scripts.postinstall?.includes(postinstallScript)) {
@@ -925,7 +939,7 @@ async function ensurePackageJson(cwd = process.cwd()) {
925
939
  }
926
940
  /** Ensure app.config.yaml has the extension reference */
927
941
  async function ensureAppConfig(domains, cwd = process.cwd()) {
928
- const rootDirectory = await require_parser.getProjectRootDirectory(cwd);
942
+ const rootDirectory = await require_config.getProjectRootDirectory(cwd);
929
943
  if (domains.has("businessConfig.schema")) await addExtensionPointToAppConfig(CONFIGURATION_EXTENSION_POINT_ID, rootDirectory, " This extension is required for business configuration. Do not remove.");
930
944
  await addExtensionPointToAppConfig(EXTENSIBILITY_EXTENSION_POINT_ID, rootDirectory, " This extension is required for app management. Do not remove.");
931
945
  }
@@ -967,7 +981,7 @@ async function runGeneration(appConfig, execCommand) {
967
981
  }
968
982
  /** Ensure install.yaml has the extension reference */
969
983
  async function ensureInstallYaml(domains, cwd = process.cwd()) {
970
- const rootDirectory = await require_parser.getProjectRootDirectory(cwd);
984
+ const rootDirectory = await require_config.getProjectRootDirectory(cwd);
971
985
  if (domains.has("businessConfig.schema")) await addExtensionPointToInstallYaml(CONFIGURATION_EXTENSION_POINT_ID, rootDirectory, " This extension is required for business configuration. Do not remove.");
972
986
  await addExtensionPointToInstallYaml(EXTENSIBILITY_EXTENSION_POINT_ID, rootDirectory, " This extension is required for app management. Do not remove.");
973
987
  }
@@ -1 +1,15 @@
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
  export { };
@@ -1,22 +1,37 @@
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_validate = require('../validate-Btzn9ilZ.cjs');
3
- const require_installation = require('../installation-CLbceU9F.cjs');
4
- const require_parser = require('../parser-BPpg_9QB.cjs');
16
+ const require_validate = require('../validate-CwwYD8aC.cjs');
17
+ const require_webhooks = require('../webhooks-CbZpv9y_.cjs');
18
+ const require_config = require('../config-YEeaEqzi.cjs');
5
19
 
6
20
  exports.CommerceAppConfigSchemas = require_validate.CommerceAppConfigSchemas;
7
- exports.defineConfig = require_parser.defineConfig;
21
+ exports.defineConfig = require_config.defineConfig;
8
22
  exports.getConfigDomains = require_validate.getConfigDomains;
9
23
  exports.hasBusinessConfig = require_validate.hasBusinessConfig;
10
24
  exports.hasBusinessConfigSchema = require_validate.hasBusinessConfigSchema;
11
- exports.hasCommerceEvents = require_installation.hasCommerceEvents;
25
+ exports.hasCommerceEvents = require_webhooks.hasCommerceEvents;
12
26
  exports.hasConfigDomain = require_validate.hasConfigDomain;
13
- exports.hasCustomInstallation = require_installation.hasCustomInstallation;
14
- exports.hasCustomInstallationSteps = require_installation.hasCustomInstallationSteps;
15
- exports.hasEventing = require_installation.hasEventing;
16
- exports.hasExternalEvents = require_installation.hasExternalEvents;
27
+ exports.hasCustomInstallation = require_webhooks.hasCustomInstallation;
28
+ exports.hasCustomInstallationSteps = require_webhooks.hasCustomInstallationSteps;
29
+ exports.hasEventing = require_webhooks.hasEventing;
30
+ exports.hasExternalEvents = require_webhooks.hasExternalEvents;
17
31
  exports.hasMetadata = require_validate.hasMetadata;
18
- exports.parseCommerceAppConfig = require_parser.parseCommerceAppConfig;
19
- exports.readCommerceAppConfig = require_parser.readCommerceAppConfig;
20
- exports.resolveCommerceAppConfig = require_parser.resolveCommerceAppConfig;
32
+ exports.hasWebhooks = require_webhooks.hasWebhooks;
33
+ exports.parseCommerceAppConfig = require_config.parseCommerceAppConfig;
34
+ exports.readCommerceAppConfig = require_config.readCommerceAppConfig;
35
+ exports.resolveCommerceAppConfig = require_config.resolveCommerceAppConfig;
21
36
  exports.validateCommerceAppConfig = require_validate.validateCommerceAppConfig;
22
37
  exports.validateCommerceAppConfigDomain = require_validate.validateCommerceAppConfigDomain;