@adobe/aio-commerce-lib-app 2.1.0-beta-20261028171115 → 2.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 (34) hide show
  1. package/CHANGELOG.md +15 -13
  2. package/dist/cjs/actions/app-config/index.cjs +4 -4
  3. package/dist/cjs/actions/association/index.cjs +1 -1
  4. package/dist/cjs/actions/config/index.cjs +2 -2
  5. package/dist/cjs/actions/installation/index.cjs +88 -100
  6. package/dist/cjs/actions/installation/index.d.cts +1 -1
  7. package/dist/cjs/actions/scope-tree/index.cjs +2 -2
  8. package/dist/cjs/commands/index.cjs +48 -35
  9. package/dist/cjs/config/index.node.cjs +2 -2
  10. package/dist/cjs/config/index.node.d.cts +1 -1
  11. package/dist/cjs/{index-CkejDFwj.d.cts → index-D-Qn-irL.d.cts} +5 -2
  12. package/dist/cjs/{index.node-BVp-SSw8.cjs → index.node-CxdwPrOg.cjs} +1 -1
  13. package/dist/cjs/management/index.cjs +1 -1
  14. package/dist/cjs/management/index.d.cts +1 -1
  15. package/dist/cjs/{management-Cwm3C9g0.cjs → management-C_JQpgVB.cjs} +2 -2
  16. package/dist/cjs/{openapi-XsGx1PMf.cjs → openapi-DFoMdZzI.cjs} +15 -175
  17. package/dist/cjs/{validate-ChXLh7rw.cjs → validate-B0rOILvG.cjs} +14 -1
  18. package/dist/es/actions/app-config/index.mjs +4 -4
  19. package/dist/es/actions/association/index.mjs +1 -1
  20. package/dist/es/actions/config/index.mjs +2 -2
  21. package/dist/es/actions/installation/index.d.mts +1 -1
  22. package/dist/es/actions/installation/index.mjs +88 -100
  23. package/dist/es/actions/scope-tree/index.mjs +2 -2
  24. package/dist/es/commands/index.mjs +49 -36
  25. package/dist/es/config/index.node.d.mts +1 -1
  26. package/dist/es/config/index.node.mjs +2 -2
  27. package/dist/es/{index-DgbSfJG7.d.mts → index-VgCNSlLP.d.mts} +5 -2
  28. package/dist/es/{index.node-ptUgKLMP.mjs → index.node-C8EXBW94.mjs} +1 -1
  29. package/dist/es/management/index.d.mts +1 -1
  30. package/dist/es/management/index.mjs +1 -1
  31. package/dist/es/{management-DEpo0JN4.mjs → management-DKDR7-fX.mjs} +2 -2
  32. package/dist/es/{openapi-DG5-kOUx.mjs → openapi-E_1RFhAr.mjs} +15 -175
  33. package/dist/es/{validate-Dk9U67PF.mjs → validate-CiJIjyOr.mjs} +9 -2
  34. package/package.json +9 -9
@@ -14,11 +14,11 @@
14
14
  */
15
15
 
16
16
  const require_rolldown_runtime = require("../rolldown-runtime-CoOt0iuZ.cjs");
17
- const require_schemas = require("../schemas-B6ITl1bG.cjs");
18
- const require_utils = require("../utils-DSS0XlXq.cjs");
19
- const require_index_node = require("../index.node-BVp-SSw8.cjs");
17
+ const require_index_node = require("../index.node-CxdwPrOg.cjs");
20
18
  const require_webhooks = require("../webhooks-TvDm57xt.cjs");
21
- const require_validate = require("../validate-ChXLh7rw.cjs");
19
+ const require_validate = require("../validate-B0rOILvG.cjs");
20
+ const require_utils = require("../utils-DSS0XlXq.cjs");
21
+ const require_schemas = require("../schemas-B6ITl1bG.cjs");
22
22
  const require_logging = require("../logging-Emi7P923.cjs");
23
23
  let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
24
24
  let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
@@ -367,7 +367,7 @@ const LEADING_DOT_SLASH_PATTERN$1 = /^\.\//u;
367
367
  const WEB_SOURCE_DEPENDENCIES = [
368
368
  {
369
369
  name: "@adobe/aio-commerce-lib-admin-ui",
370
- version: "^1.2.0-beta-20261028171115"
370
+ version: "^1.2.0"
371
371
  },
372
372
  {
373
373
  name: "react",
@@ -1325,6 +1325,7 @@ async function run$8(appConfig, projectRoot) {
1325
1325
  }
1326
1326
  return;
1327
1327
  }
1328
+ consola.consola.log("");
1328
1329
  consola.consola.info("Generating app manifest...");
1329
1330
  const contents = (0, safe_stable_stringify.stringify)(appConfig, null, 2);
1330
1331
  const outputDir = await require_index_node.makeOutputDirFor(getGeneratedDir(EXTENSIBILITY_EXTENSION_POINT_ID), projectRoot);
@@ -1575,6 +1576,39 @@ function getAioCliEnv() {
1575
1576
  return _adobe_aio_lib_core_config.default.get("cli.env") === "stage" ? "stage" : "prod";
1576
1577
  }
1577
1578
 
1579
+ // source/commands/common/cams/config.ts
1580
+ /** Environment variable that overrides the CAMS base URL. */
1581
+ const CAMS_URL_ENV_VAR = "AIO_COMMERCE_APP_MANAGEMENT_SERVICE_URL";
1582
+ /** Environment variable that selects the AIO CLI environment. */
1583
+ const AIO_CLI_ENV_VAR = "AIO_CLI_ENV";
1584
+ /** The CAMS host for the stage environment. */
1585
+ const STAGE_CAMS_URL = "https://app-management-stage.api.commerce.adobe.com";
1586
+ /** The CAMS host for the production environment. */
1587
+ const PROD_CAMS_URL = "https://app-management.api.commerce.adobe.com";
1588
+ /**
1589
+ * The time in milliseconds a CAMS request may take before it fails with a timeout.
1590
+ *
1591
+ * CAMS calls the app on Adobe I/O Runtime for some requests, for example to plan an upgrade, and a
1592
+ * cold start after a deploy can take longer than ky's 10 second default.
1593
+ */
1594
+ const CAMS_REQUEST_TIMEOUT_MS = 6e4;
1595
+ const URL_SCHEME_PATTERN = /^[hH][tT][tT][pP][sS]?:\/\//u;
1596
+ /**
1597
+ * Resolves the base URL of the Commerce App Management Service (CAMS).
1598
+ *
1599
+ * The override variable wins. A value without a scheme is read as an https URL.
1600
+ * Otherwise `AIO_CLI_ENV` (`stage` or `prod`) selects the host, falling back to `env`.
1601
+ *
1602
+ * @param env - The configured AIO CLI environment, used when `AIO_CLI_ENV` is unset or unknown.
1603
+ * @param variables - The environment variables to read the override from.
1604
+ */
1605
+ function resolveCamsBaseUrl(env, variables = process.env) {
1606
+ const override = variables[CAMS_URL_ENV_VAR]?.trim();
1607
+ if (override) return URL_SCHEME_PATTERN.test(override) ? override : `https://${override}`;
1608
+ const cliEnv = variables[AIO_CLI_ENV_VAR]?.trim();
1609
+ return (cliEnv === "stage" || cliEnv === "prod" ? cliEnv : env) === "stage" ? STAGE_CAMS_URL : PROD_CAMS_URL;
1610
+ }
1611
+
1578
1612
  // source/commands/common/cams/errors.ts
1579
1613
  const HTTP_BAD_GATEWAY = 502;
1580
1614
  const HTTP_SERVICE_UNAVAILABLE = 503;
@@ -1838,32 +1872,6 @@ async function readLatestUpgrade(httpClient, params, fetchOptions) {
1838
1872
  return await readAndParseBody(AttemptStatusSchema, response);
1839
1873
  }
1840
1874
 
1841
- // source/commands/common/cams/config.ts
1842
- /** Environment variable that overrides the CAMS base URL. */
1843
- const CAMS_URL_ENV_VAR = "AIO_COMMERCE_APP_MANAGEMENT_SERVICE_URL";
1844
- /** Environment variable that selects the AIO CLI environment. */
1845
- const AIO_CLI_ENV_VAR = "AIO_CLI_ENV";
1846
- /** The CAMS host for the stage environment. */
1847
- const STAGE_CAMS_URL = "https://app-management-stage.api.commerce.adobe.com";
1848
- /** The CAMS host for the production environment. */
1849
- const PROD_CAMS_URL = "https://app-management.api.commerce.adobe.com";
1850
- const URL_SCHEME_PATTERN = /^[hH][tT][tT][pP][sS]?:\/\//u;
1851
- /**
1852
- * Resolves the base URL of the Commerce App Management Service (CAMS).
1853
- *
1854
- * The override variable wins. A value without a scheme is read as an https URL.
1855
- * Otherwise `AIO_CLI_ENV` (`stage` or `prod`) selects the host, falling back to `env`.
1856
- *
1857
- * @param env - The configured AIO CLI environment, used when `AIO_CLI_ENV` is unset or unknown.
1858
- * @param variables - The environment variables to read the override from.
1859
- */
1860
- function resolveCamsBaseUrl(env, variables = process.env) {
1861
- const override = variables[CAMS_URL_ENV_VAR]?.trim();
1862
- if (override) return URL_SCHEME_PATTERN.test(override) ? override : `https://${override}`;
1863
- const cliEnv = variables[AIO_CLI_ENV_VAR]?.trim();
1864
- return (cliEnv === "stage" || cliEnv === "prod" ? cliEnv : env) === "stage" ? STAGE_CAMS_URL : PROD_CAMS_URL;
1865
- }
1866
-
1867
1875
  // source/commands/common/cams/http-client.ts
1868
1876
  /** Header that carries the organization the request is made for. */
1869
1877
  const ORG_HEADER = "x-org-id";
@@ -1934,7 +1942,8 @@ var CamsHttpClient = class {
1934
1942
  prefixUrl: this.config.baseUrl,
1935
1943
  retry: { async shouldRetry({ error }) {
1936
1944
  return isRetryable(error);
1937
- } }
1945
+ } },
1946
+ timeout: CAMS_REQUEST_TIMEOUT_MS
1938
1947
  });
1939
1948
  this.httpClient = Object.freeze(fetchOptions ? httpClient.extend(fetchOptions) : httpClient);
1940
1949
  this.get = this.httpClient.get.bind(this.httpClient);
@@ -1953,6 +1962,10 @@ var CamsHttpClient = class {
1953
1962
  async function toCamsError(error) {
1954
1963
  if (error instanceof CamsClientError || error instanceof _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError) return error;
1955
1964
  if (error instanceof ky.HTTPError) return await toCamsResponseError(error);
1965
+ if (error instanceof ky.TimeoutError) return new CamsClientError(`The Commerce App Management Service did not answer within ${CAMS_REQUEST_TIMEOUT_MS / 1e3} seconds`, {
1966
+ cause: error,
1967
+ retryable: true
1968
+ });
1956
1969
  return new CamsClientError("The Commerce App Management Service could not be reached", {
1957
1970
  cause: error,
1958
1971
  retryable: true
@@ -2571,10 +2584,10 @@ async function syncImsCredentials(projectRoot) {
2571
2584
  async function run$4(extension, projectRoot, templatesDir = TEMPLATES_DIR) {
2572
2585
  if (await ensureExtensionPointsOrder(projectRoot)) consola.default.warn(`The extension points in ${APP_CONFIG_FILE} were reordered (${EXTENSION_POINT_ORDER.join(", ")}) to ensure an upgrade works reliably. This is a one-off change.`);
2573
2586
  const appManifest = await loadAppManifest(projectRoot);
2587
+ await run$8(appManifest, projectRoot);
2574
2588
  await prepareRuntimeAppConfigModule(appManifest, projectRoot);
2575
2589
  if (extension === "extensibility/1") {
2576
2590
  const { doc: extensibilityExtConfig } = await readExtConfig(EXTENSIBILITY_EXTENSION_POINT_ID, projectRoot);
2577
- await run$8(appManifest, projectRoot);
2578
2591
  await generateActionFiles(appManifest, getRuntimeActions(extensibilityExtConfig.toJS(), "app-management"), EXTENSIBILITY_EXTENSION_POINT_ID, templatesDir, projectRoot);
2579
2592
  consola.default.info("Syncing IMS credentials...");
2580
2593
  consola.default.warn("Deprecated: if your actions use AIO_COMMERCE_AUTH_IMS_* inputs for OAuth Server-to-Server credentials, replace them with the `include-ims-credentials: true` action annotation. This hook still syncs legacy credentials for compatibility; that sync will be removed in a future major release.");
@@ -3016,7 +3029,7 @@ async function ensureAppConfig(domains, config, projectRoot) {
3016
3029
  */
3017
3030
  function installDependencies(packageManager, domains, projectRoot) {
3018
3031
  const packages = [];
3019
- if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.8.1-beta-20261028171115`);
3032
+ if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.8.1`);
3020
3033
  if (packages.length === 0) {
3021
3034
  consola.consola.info("No additional domain dependencies to install.");
3022
3035
  return;
@@ -3051,7 +3064,7 @@ async function ensureInstallYaml(domains, config, projectRoot) {
3051
3064
  }
3052
3065
 
3053
3066
  // source/commands/init/main.ts
3054
- const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@2.1.0-beta-20261028171115`];
3067
+ const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@2.1.0`];
3055
3068
  /**
3056
3069
  * Initializes a Commerce App project.
3057
3070
  * @param flags - Non-interactive initialization answers.
@@ -13,10 +13,10 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_index_node = require("../index.node-BVp-SSw8.cjs");
16
+ const require_index_node = require("../index.node-CxdwPrOg.cjs");
17
17
  const require_define = require("../define-BKJjE97w.cjs");
18
18
  const require_webhooks = require("../webhooks-TvDm57xt.cjs");
19
- const require_validate = require("../validate-ChXLh7rw.cjs");
19
+ const require_validate = require("../validate-B0rOILvG.cjs");
20
20
 
21
21
  exports.CommerceAppConfigSchemas = require_validate.CommerceAppConfigSchemas;
22
22
  exports.defineConfig = require_define.defineConfig;
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
+ import { t as defineConfig } from "../define-C12IwNNN.cjs";
15
16
  import { a as CommerceAppConfigSchemas, i as CommerceAppConfigDomain, n as CommerceAppConfig, o as getConfigDomains, r as CommerceAppConfigOutputModel, s as hasConfigDomain, t as AnyCommerceAppConfig } from "../app-Ch19CR6g.cjs";
16
17
  import { A as AdminUiConfig, B as hasAdminUi, C as ExternalEventSource, D as hasEventing, E as hasCommerceEvents, F as Menu, I as Notifications, L as OrderViewButton, M as GridColumn, N as GridColumns, O as hasExternalEvents, P as MassAction, R as ViewMassAction, S as ExternalEvent, T as ExternalEventsConfig, V as hasBackendUiV2Components, _ as CommerceEventsConfig, a as WebhookRule, b as EventingSchema, c as WebhooksSchema, d as hasCustomInstallation, f as hasCustomInstallationSteps, g as CommerceEventSourceSchema, h as CommerceEventSource, i as WebhookHeader, j as AdminUiConfiguration, l as hasWebhooks, m as CommerceEvent, n as WebhookEntry, o as WebhooksConfig, p as AppEvent, r as WebhookField, s as WebhooksConfiguration, t as WebhookDefinition, v as EventProvider, w as ExternalEventSourceSchema, x as EventsConfig, y as EventingConfiguration, z as WorkerMassAction } from "../webhooks-Buu1d7AB.cjs";
17
- import { t as defineConfig } from "../define-C12IwNNN.cjs";
18
18
  import { Get } from "type-fest";
19
19
  import * as v from "valibot";
20
20
  import "@adobe/aio-commerce-lib-config";
@@ -538,8 +538,11 @@ type LifecyclePlan = {
538
538
  actionVersion: string;
539
539
  /** The state the plan transitions from, or `null` when nothing is installed. */
540
540
  source: {
541
- /** Identifier of the baseline snapshot. */
542
- snapshotId: string;
541
+ /**
542
+ * Identifier of the baseline snapshot, or `null` when the app was installed with only business
543
+ * configuration and has no baseline yet. Starting the plan writes one.
544
+ */
545
+ snapshotId: string | null;
543
546
  /** App version of the baseline. */
544
547
  appVersion: string;
545
548
  } | null;
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  const require_rolldown_runtime = require("./rolldown-runtime-CoOt0iuZ.cjs");
16
- const require_validate = require("./validate-ChXLh7rw.cjs");
16
+ const require_validate = require("./validate-B0rOILvG.cjs");
17
17
  let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
18
18
  let fs = require("fs");
19
19
  let fs_promises = require("fs/promises");
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_management = require("../management-Cwm3C9g0.cjs");
16
+ const require_management = require("../management-C_JQpgVB.cjs");
17
17
 
18
18
  exports.createInitialInstallationState = require_management.createInitialInstallationState;
19
19
  exports.createInitialUninstallationState = require_management.createInitialUninstallationState;
@@ -12,5 +12,5 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { $ as defineLeafStep, A as createInitialState, B as BranchStepOptions, C as defineCustomInstallationStep, D as executePlannedWorkflow, E as createInitialPlanExecutionState, F as StepStartedEvent, G as LifecycleContext, H as InferStepOutput, I as StepSucceededEvent, J as StepMeta, K as Step, L as WorkflowHooks, M as executeWorkflow, N as StepEvent, O as ValidateStepTreeOptions, P as StepFailedEvent, Q as defineBranchStep, R as AnyStep, S as CustomInstallationStepHandler, T as planWorkflow, U as LeafStep, V as ExecutionContext, W as LeafStepOptions, X as ValidationContext, Y as StepMetaInfo, Z as ValidationExecutionContext, _ as createInitialUninstallationState, _t as isFailedState, a as InstallationError, at as ValidationResult, b as runValidation, c as InstallationStatus, ct as FailedWorkflowState, d as CreateInitialUninstallationStateOptions, dt as SucceededWorkflowState, et as isBranchStep, f as InstallationHooks, ft as WorkflowData, g as createInitialInstallationState, gt as isCompletedState, h as RunValidationOptions, ht as WorkflowStateMetadata, i as InstallationData, it as ValidationIssueSeverity, j as executeUninstallWorkflow, k as validateStepTree, l as SucceededInstallationState, lt as InProgressWorkflowState, m as RunUninstallationOptions, mt as WorkflowRunState, n as InProgressInstallationState, nt as StepValidationResult, o as InstallationRetryMetadata, ot as ValidationSummary, p as RunInstallationOptions, pt as WorkflowError, q as StepContextFactory, r as InstallationContext, rt as ValidationIssue, s as InstallationState, st as ExecutionStatus, t as FailedInstallationState, tt as isLeafStep, u as CreateInitialInstallationStateOptions, ut as StepStatus, v as runInstallation, vt as isInProgressState, w as createRetryState, x as CustomInstallationStepDefinition, y as runUninstallation, yt as isSucceededState, z as BranchStep } from "../index-CkejDFwj.cjs";
15
+ import { $ as defineLeafStep, A as createInitialState, B as BranchStepOptions, C as defineCustomInstallationStep, D as executePlannedWorkflow, E as createInitialPlanExecutionState, F as StepStartedEvent, G as LifecycleContext, H as InferStepOutput, I as StepSucceededEvent, J as StepMeta, K as Step, L as WorkflowHooks, M as executeWorkflow, N as StepEvent, O as ValidateStepTreeOptions, P as StepFailedEvent, Q as defineBranchStep, R as AnyStep, S as CustomInstallationStepHandler, T as planWorkflow, U as LeafStep, V as ExecutionContext, W as LeafStepOptions, X as ValidationContext, Y as StepMetaInfo, Z as ValidationExecutionContext, _ as createInitialUninstallationState, _t as isFailedState, a as InstallationError, at as ValidationResult, b as runValidation, c as InstallationStatus, ct as FailedWorkflowState, d as CreateInitialUninstallationStateOptions, dt as SucceededWorkflowState, et as isBranchStep, f as InstallationHooks, ft as WorkflowData, g as createInitialInstallationState, gt as isCompletedState, h as RunValidationOptions, ht as WorkflowStateMetadata, i as InstallationData, it as ValidationIssueSeverity, j as executeUninstallWorkflow, k as validateStepTree, l as SucceededInstallationState, lt as InProgressWorkflowState, m as RunUninstallationOptions, mt as WorkflowRunState, n as InProgressInstallationState, nt as StepValidationResult, o as InstallationRetryMetadata, ot as ValidationSummary, p as RunInstallationOptions, pt as WorkflowError, q as StepContextFactory, r as InstallationContext, rt as ValidationIssue, s as InstallationState, st as ExecutionStatus, t as FailedInstallationState, tt as isLeafStep, u as CreateInitialInstallationStateOptions, ut as StepStatus, v as runInstallation, vt as isInProgressState, w as createRetryState, x as CustomInstallationStepDefinition, y as runUninstallation, yt as isSucceededState, z as BranchStep } from "../index-D-Qn-irL.cjs";
16
16
  export { type AnyStep, type BranchStep, type BranchStepOptions, type CreateInitialInstallationStateOptions, type CreateInitialUninstallationStateOptions, type CustomInstallationStepDefinition, type CustomInstallationStepHandler, type ExecutionContext, type ExecutionStatus, type FailedInstallationState, type FailedWorkflowState, type InProgressInstallationState, type InProgressWorkflowState, type InferStepOutput, type InstallationContext, type InstallationData, type InstallationError, type InstallationHooks, type InstallationRetryMetadata, type InstallationState, type InstallationStatus, type LeafStep, type LeafStepOptions, type LifecycleContext, type RunInstallationOptions, type RunUninstallationOptions, type RunValidationOptions, type Step, type StepContextFactory, type StepEvent, type StepFailedEvent, type StepMeta, type StepMetaInfo, type StepStartedEvent, type StepStatus, type StepSucceededEvent, type StepValidationResult, type SucceededInstallationState, type SucceededWorkflowState, type ValidateStepTreeOptions, type ValidationContext, type ValidationExecutionContext, type ValidationIssue, type ValidationIssueSeverity, type ValidationResult, type ValidationSummary, type WorkflowData, type WorkflowError, type WorkflowHooks, type WorkflowRunState, type WorkflowStateMetadata, createInitialInstallationState, type createInitialPlanExecutionState, type createInitialState, createInitialUninstallationState, type createRetryState, type defineBranchStep, defineCustomInstallationStep, type defineLeafStep, type executePlannedWorkflow, type executeUninstallWorkflow, type executeWorkflow, type isBranchStep, isCompletedState, isFailedState, isInProgressState, type isLeafStep, isSucceededState, type planWorkflow, runInstallation, runUninstallation, runValidation, type validateStepTree };
@@ -13,12 +13,12 @@
13
13
  */
14
14
 
15
15
  const require_rolldown_runtime = require("./rolldown-runtime-CoOt0iuZ.cjs");
16
+ const require_webhooks = require("./webhooks-TvDm57xt.cjs");
17
+ const require_constants = require("./constants-CgeVvu6f.cjs");
16
18
  const require_utils = require("./utils-DSS0XlXq.cjs");
17
19
  const require_environment = require("./environment-CW6M76gS.cjs");
18
20
  const require_utils$1 = require("./utils-B_Ypb2xF.cjs");
19
- const require_webhooks = require("./webhooks-TvDm57xt.cjs");
20
21
  const require_logging = require("./logging-Emi7P923.cjs");
21
- const require_constants = require("./constants-CgeVvu6f.cjs");
22
22
  let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
23
23
  let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
24
24
  let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
@@ -23,7 +23,7 @@ var info = {
23
23
  "identifier": "Apache-2.0",
24
24
  "name": "Apache-2.0"
25
25
  },
26
- "x-meta": { "packageVersion": "2.0.0" }
26
+ "x-meta": { "packageVersion": "2.1.0" }
27
27
  };
28
28
  var servers = [{ "url": "/" }];
29
29
  var paths = {
@@ -974,12 +974,12 @@ var paths = {
974
974
  "get": {
975
975
  "operationId": "getInstallationState",
976
976
  "summary": "Get Installation State",
977
- "description": "Returns the status of the latest lifecycle attempt, whatever its operation. With `attemptId`, returns the status of that attempt instead, whether it is the latest or an earlier one. With `attemptId` and `operation`, returns that attempt only when it ran that operation. With `operation` alone, returns the latest attempt that ran that operation instead, and `history` lists only the earlier attempts and pending plans of that operation. With `history=true`, also returns the plans of that attempt, the earlier attempts with their plans, and the plans made since the latest attempt. Without a lifecycle attempt, returns the installation record of an older library version, if any, and ignores `history` and `limit`. With `operation` alone, it answers `204` instead when no attempt ran the operation.",
977
+ "description": "Returns the status of the latest lifecycle attempt, whatever its operation. With `attemptId`, returns the status of that attempt instead, whether it is the latest or an earlier one. With `attemptId` and `operation`, returns that attempt only when it ran that operation. With `operation` alone, returns the latest attempt that ran that operation instead. Without a lifecycle attempt, returns the installation record of an older library version, if any. With `operation` alone, it answers `204` instead when no attempt ran the operation.",
978
978
  "parameters": [
979
979
  {
980
980
  "name": "attemptId",
981
981
  "in": "query",
982
- "description": "The attempt to read. With `operation`, the attempt must have run that operation, or the answer is `404`. Cannot be combined with `history` or `limit`.",
982
+ "description": "The attempt to read. With `operation`, the attempt must have run that operation, or the answer is `404`.",
983
983
  "required": false,
984
984
  "schema": {
985
985
  "type": "string",
@@ -989,7 +989,7 @@ var paths = {
989
989
  {
990
990
  "name": "operation",
991
991
  "in": "query",
992
- "description": "Reads the latest attempt that ran this operation, which can be an earlier attempt than the latest one. With `history=true`, `history` and `pendingPlans` list only this operation. With `attemptId`, it only checks that the attempt ran this operation.",
992
+ "description": "Reads the latest attempt that ran this operation, which can be an earlier attempt than the latest one. With `attemptId`, it only checks that the attempt ran this operation.",
993
993
  "required": false,
994
994
  "schema": {
995
995
  "type": "string",
@@ -1000,51 +1000,19 @@ var paths = {
1000
1000
  ]
1001
1001
  }
1002
1002
  },
1003
- {
1004
- "name": "history",
1005
- "in": "query",
1006
- "description": "When `true`, the body also carries `plans`, `history` and `pendingPlans`. Plans carry the full target configuration.",
1007
- "required": false,
1008
- "schema": {
1009
- "type": "string",
1010
- "default": "false",
1011
- "enum": ["true", "false"]
1012
- }
1013
- },
1014
- {
1015
- "name": "limit",
1016
- "in": "query",
1017
- "description": "How many earlier attempts `history` lists at most. Applies only with `history=true`. When omitted, `history` lists every earlier attempt.",
1018
- "required": false,
1019
- "schema": {
1020
- "type": "integer",
1021
- "minimum": 1
1022
- }
1023
- },
1024
1003
  {
1025
1004
  "name": "x-gw-ims-org-id",
1026
1005
  "in": "header",
1027
1006
  "description": "Adobe IMS organization ID that identifies the organization for the request.",
1028
1007
  "required": true,
1029
1008
  "schema": { "type": "string" }
1030
- },
1031
- {
1032
- "name": "x-aio-commerce-installation-invocation-source",
1033
- "in": "header",
1034
- "description": "Identifies the source of the request. When set to `post-app-deploy` and no lifecycle attempt exists, returns `204` instead of an older library version's installation record.",
1035
- "required": false,
1036
- "schema": {
1037
- "type": "string",
1038
- "enum": ["post-app-deploy"]
1039
- }
1040
1009
  }
1041
1010
  ],
1042
1011
  "responses": {
1043
1012
  "200": {
1044
- "description": "The latest lifecycle attempt, the latest one that ran `operation`, or the one named by `attemptId`, with its history on `history=true`, or the installation record of an older library version.",
1013
+ "description": "The latest lifecycle attempt, the latest one that ran `operation`, or the one named by `attemptId`, or the installation record of an older library version.",
1045
1014
  "content": { "application/json": { "schema": { "oneOf": [
1046
1015
  { "$ref": "#/components/schemas/LifecycleAttemptStatus" },
1047
- { "$ref": "#/components/schemas/LifecycleAttemptHistory" },
1048
1016
  { "$ref": "#/components/schemas/InProgressWorkflowState" },
1049
1017
  { "$ref": "#/components/schemas/SucceededWorkflowState" },
1050
1018
  { "$ref": "#/components/schemas/FailedWorkflowState" }
@@ -1052,7 +1020,7 @@ var paths = {
1052
1020
  },
1053
1021
  "204": { "description": "No installation workflow state or lifecycle attempt has been stored yet, or no attempt ran the requested `operation`." },
1054
1022
  "400": {
1055
- "description": "The `attemptId`, `history`, `limit` or `operation` query parameter is invalid, or `attemptId` is combined with `history` or `limit`.",
1023
+ "description": "The `attemptId` or `operation` query parameter is invalid.",
1056
1024
  "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } }
1057
1025
  },
1058
1026
  "401": { "description": "You are not authorized to access this resource. Ensure the IMS token and the x-gw-ims-org-id header are correctly set and valid." },
@@ -1078,15 +1046,6 @@ var paths = {
1078
1046
  "description": "Adobe IMS organization ID that identifies the organization for the request.",
1079
1047
  "required": true,
1080
1048
  "schema": { "type": "string" }
1081
- }, {
1082
- "name": "x-aio-commerce-installation-invocation-source",
1083
- "in": "header",
1084
- "description": "Identifies the source of the request. The generated post-deploy hook sends `post-app-deploy`; when that source is present and the app is not installed, reconciliation returns `409 not-installed` instead of starting a first-time installation.",
1085
- "required": false,
1086
- "schema": {
1087
- "type": "string",
1088
- "enum": ["post-app-deploy"]
1089
- }
1090
1049
  }],
1091
1050
  "requestBody": {
1092
1051
  "required": true,
@@ -1140,7 +1099,7 @@ var paths = {
1140
1099
  "/installation/plan": { "post": {
1141
1100
  "operationId": "planLifecycleOperation",
1142
1101
  "summary": "Plan a Lifecycle Operation",
1143
- "description": "Plans the install or upgrade the installed state calls for, or an uninstallation when `operation` is `uninstall`. Stores it as the pending plan and returns it for review, together with its issues as a validation result. Start it with `POST /installation` and its `id` as `planId`.",
1102
+ "description": "Plans the install or upgrade the installed state calls for, or an uninstallation when `operation` is `uninstall`. An app installed with only business configuration has no baseline, so it plans an upgrade when `installedState` and `installedVersion` are set. Stores it as the pending plan and returns it for review, together with its issues as a validation result. Start it with `POST /installation` and its `id` as `planId`.",
1144
1103
  "parameters": [{
1145
1104
  "name": "x-gw-ims-org-id",
1146
1105
  "in": "header",
@@ -2613,6 +2572,14 @@ var components = {
2613
2572
  "description": "Set to `uninstall` to plan an uninstallation. Without it, `POST /installation/plan` plans the install or upgrade the installed state calls for.",
2614
2573
  "const": "uninstall"
2615
2574
  },
2575
+ "installedState": {
2576
+ "description": "Set to `business-config-only` with `installedVersion` when the app is installed with only business configuration, so it has no lifecycle baseline. `POST /installation/plan` then plans an upgrade instead of an install, and `sourceVersion` is `installedVersion`. Ignored when the app has a baseline.",
2577
+ "const": "business-config-only"
2578
+ },
2579
+ "installedVersion": {
2580
+ "description": "The version stored for the installed app. Used with `installedState`. The plan answers `409` with code `already-current` when it equals `metadata.version`.",
2581
+ "type": "string"
2582
+ },
2616
2583
  "planId": {
2617
2584
  "description": "The id of the pending plan to start. Required by `POST /installation`.",
2618
2585
  "type": "string"
@@ -2740,133 +2707,6 @@ var components = {
2740
2707
  "data"
2741
2708
  ]
2742
2709
  },
2743
- "LifecycleAttemptHistory": {
2744
- "description": "The status of the latest lifecycle attempt with the trail that led to it.",
2745
- "allOf": [{ "$ref": "#/components/schemas/LifecycleAttemptStatus" }, {
2746
- "type": "object",
2747
- "properties": {
2748
- "plans": {
2749
- "description": "The plan the attempt executed, followed by the stored plans it replaced, newest first.",
2750
- "type": "array",
2751
- "items": { "$ref": "#/components/schemas/LifecyclePlan" }
2752
- },
2753
- "history": {
2754
- "description": "Earlier attempts, newest first, each with its own plans. Stops at `limit` attempts or at the first attempt that is no longer stored.",
2755
- "type": "array",
2756
- "items": { "allOf": [{ "$ref": "#/components/schemas/LifecycleAttemptStatus" }, {
2757
- "type": "object",
2758
- "properties": { "plans": {
2759
- "description": "The plan the attempt executed, followed by the stored plans it replaced, newest first.",
2760
- "type": "array",
2761
- "items": { "$ref": "#/components/schemas/LifecyclePlan" }
2762
- } },
2763
- "required": ["plans"]
2764
- }] }
2765
- },
2766
- "pendingPlans": {
2767
- "description": "The pending plan followed by the plans it replaced, newest first. Empty when no plan is pending.",
2768
- "type": "array",
2769
- "items": { "$ref": "#/components/schemas/LifecyclePlan" }
2770
- }
2771
- },
2772
- "required": [
2773
- "plans",
2774
- "history",
2775
- "pendingPlans"
2776
- ]
2777
- }]
2778
- },
2779
- "LifecyclePlan": {
2780
- "description": "A lifecycle plan as stored, with the full target configuration.",
2781
- "type": "object",
2782
- "properties": {
2783
- "id": { "type": "string" },
2784
- "previousPlanId": {
2785
- "description": "The pending plan this plan replaced, or `null` when none was pending.",
2786
- "anyOf": [{ "type": "string" }, { "type": "null" }]
2787
- },
2788
- "operation": {
2789
- "type": "string",
2790
- "enum": [
2791
- "install",
2792
- "upgrade",
2793
- "uninstall"
2794
- ]
2795
- },
2796
- "actionVersion": {
2797
- "description": "Version of the action that made the plan.",
2798
- "type": "string"
2799
- },
2800
- "source": {
2801
- "description": "The state the plan starts from, or `null` when nothing is installed.",
2802
- "anyOf": [{
2803
- "type": "object",
2804
- "properties": {
2805
- "snapshotId": { "type": "string" },
2806
- "appVersion": { "type": "string" }
2807
- },
2808
- "required": ["snapshotId", "appVersion"]
2809
- }, { "type": "null" }]
2810
- },
2811
- "target": {
2812
- "description": "The state the plan leads to, or `null` when the app ends up with nothing installed.",
2813
- "anyOf": [{
2814
- "type": "object",
2815
- "properties": {
2816
- "appVersion": { "type": "string" },
2817
- "config": {
2818
- "type": "object",
2819
- "additionalProperties": true
2820
- }
2821
- },
2822
- "required": ["appVersion", "config"]
2823
- }, { "type": "null" }]
2824
- },
2825
- "domains": {
2826
- "type": "array",
2827
- "items": {
2828
- "type": "object",
2829
- "properties": {
2830
- "path": {
2831
- "type": "array",
2832
- "items": { "type": "string" }
2833
- },
2834
- "operations": {
2835
- "type": "array",
2836
- "items": {
2837
- "type": "object",
2838
- "additionalProperties": true
2839
- }
2840
- },
2841
- "changes": {
2842
- "description": "The items the target config adds, updates or removes compared with the installed config, whatever the live state is. Empty for a plan stored by an older version.",
2843
- "type": "array",
2844
- "items": { "$ref": "#/components/schemas/ResourceChange" }
2845
- }
2846
- },
2847
- "required": [
2848
- "path",
2849
- "operations",
2850
- "changes"
2851
- ]
2852
- }
2853
- },
2854
- "issues": {
2855
- "type": "array",
2856
- "items": { "$ref": "#/components/schemas/PlanningIssue" }
2857
- }
2858
- },
2859
- "required": [
2860
- "id",
2861
- "previousPlanId",
2862
- "operation",
2863
- "actionVersion",
2864
- "source",
2865
- "target",
2866
- "domains",
2867
- "issues"
2868
- ]
2869
- },
2870
2710
  "PlanningIssue": {
2871
2711
  "type": "object",
2872
2712
  "properties": {
@@ -13,8 +13,8 @@
13
13
  */
14
14
 
15
15
  const require_rolldown_runtime = require("./rolldown-runtime-CoOt0iuZ.cjs");
16
- const require_schemas = require("./schemas-B6ITl1bG.cjs");
17
16
  const require_webhooks = require("./webhooks-TvDm57xt.cjs");
17
+ const require_schemas = require("./schemas-B6ITl1bG.cjs");
18
18
  let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
19
19
  let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
20
20
  let valibot = require("valibot");
@@ -140,6 +140,13 @@ function requiresInstallationFromDomains(domains) {
140
140
  "adminUi"
141
141
  ].some((feature) => domains.has(feature));
142
142
  }
143
+ /**
144
+ * Returns true if the given config requires installation, false otherwise.
145
+ * @param config - The commerce app config to check.
146
+ */
147
+ function requiresInstallation(config) {
148
+ return requiresInstallationFromDomains(getConfigDomains(config));
149
+ }
143
150
 
144
151
  // source/config/lib/validate.ts
145
152
  const commerceAppConfigDomainsSchema = valibot.picklist(Object.keys(CommerceAppConfigSchemas));
@@ -262,6 +269,12 @@ Object.defineProperty(exports, "hasMetadata", {
262
269
  return hasMetadata;
263
270
  }
264
271
  });
272
+ Object.defineProperty(exports, "requiresInstallation", {
273
+ enumerable: true,
274
+ get: function () {
275
+ return requiresInstallation;
276
+ }
277
+ });
265
278
  Object.defineProperty(exports, "requiresInstallationFromDomains", {
266
279
  enumerable: true,
267
280
  get: function () {
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { n as filterAppConfigByEnv } from "../../environment-DUhU0_9z.mjs";
16
- import { a as getConfigDomains, l as hasBusinessConfigSchema, r as requiresInstallationFromDomains, t as validateCommerceAppConfig } from "../../validate-Dk9U67PF.mjs";
17
15
  import { n as logger, t as HttpActionRouter } from "../../router-C23GIyGQ.mjs";
16
+ import { n as filterAppConfigByEnv } from "../../environment-DUhU0_9z.mjs";
17
+ import { i as requiresInstallationFromDomains, o as getConfigDomains, t as validateCommerceAppConfig, u as hasBusinessConfigSchema } from "../../validate-CiJIjyOr.mjs";
18
18
  import { resolveBusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
19
19
  import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
20
20
  import * as v from "valibot";
@@ -26,7 +26,7 @@ import { createHash } from "crypto";
26
26
  * Loads the committed OpenAPI spec via dynamic import so it
27
27
  * lands in its own chunk and is not parsed on every cold start.
28
28
  */
29
- const importOpenApi = () => import("../../openapi-DG5-kOUx.mjs");
29
+ const importOpenApi = () => import("../../openapi-E_1RFhAr.mjs");
30
30
  /** Matches component schema `$ref` strings, capturing the schema name. */
31
31
  const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(?<schema>\w+)"/gu;
32
32
  /**
@@ -77,7 +77,7 @@ function pruneUnusedTags(spec) {
77
77
  * @param domains - The active config domains.
78
78
  */
79
79
  function getOpenApiCacheKey(domains) {
80
- const input = `2.1.0-beta-20261028171115:${[...domains].sort().join(",")}:4.0.0`;
80
+ const input = `2.1.0:${[...domains].sort().join(",")}:4.0.0`;
81
81
  return createHash("sha256").update(input).digest("hex").slice(0, 8);
82
82
  }
83
83
  /** Returns the server URL to be set in the OpenAPI spec, based on the current namespace. */
@@ -12,8 +12,8 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { r as setAssociationData, t as clearAssociationData } from "../../repository-BVBp61y9.mjs";
16
15
  import { n as logger, t as HttpActionRouter } from "../../router-C23GIyGQ.mjs";
16
+ import { r as setAssociationData, t as clearAssociationData } from "../../repository-BVBp61y9.mjs";
17
17
  import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
18
18
  import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
19
19
  import * as v from "valibot";
@@ -12,9 +12,9 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
16
- import { r as filterSchemaByEnv } from "../../environment-DUhU0_9z.mjs";
17
15
  import { n as logger, t as HttpActionRouter } from "../../router-C23GIyGQ.mjs";
16
+ import { r as filterSchemaByEnv } from "../../environment-DUhU0_9z.mjs";
17
+ import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
18
18
  import { byScopeId, getConfiguration, initialize, setConfiguration } from "@adobe/aio-commerce-lib-config";
19
19
  import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
20
20
  import * as v from "valibot";
@@ -13,8 +13,8 @@
13
13
  */
14
14
 
15
15
  import "../../index-CgsSXApi.mjs";
16
+ import { G as LifecycleContext } from "../../index-VgCNSlLP.mjs";
16
17
  import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-Ch19CR6g.mjs";
17
- import { G as LifecycleContext } from "../../index-DgbSfJG7.mjs";
18
18
  import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
19
19
  /** Loads generated custom installation script modules. */
20
20
  type CustomScriptsLoader = (config: CommerceAppConfigOutputModel, logger: LifecycleContext["logger"]) => Record<string, unknown>;