@adobe/aio-commerce-lib-app 2.2.0 → 2.3.0-beta-20261202103723
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.
- package/CHANGELOG.md +32 -1
- package/dist/cjs/actions/app-config/index.cjs +8 -8
- package/dist/cjs/actions/app-config/index.d.cts +2 -2
- package/dist/cjs/actions/association/index.cjs +4 -4
- package/dist/cjs/actions/config/index.cjs +19 -8
- package/dist/cjs/actions/config/index.d.cts +1 -1
- package/dist/cjs/actions/installation/index.cjs +39 -15
- package/dist/cjs/actions/installation/index.d.cts +3 -3
- package/dist/cjs/actions/scope-tree/index.cjs +6 -6
- package/dist/cjs/{app-B3bAEor-.d.cts → app-CLDvfJXp.d.cts} +634 -44
- package/dist/cjs/commands/index.cjs +174 -33
- package/dist/cjs/config/index.browser.d.cts +1 -1
- package/dist/cjs/config/index.node.cjs +3 -3
- package/dist/cjs/config/index.node.d.cts +50 -14
- package/dist/cjs/{define-eBMdGAq6.d.cts → define-BGpnO45V.d.cts} +1 -1
- package/dist/cjs/{environment-CW6M76gS.cjs → environment-CaV1hi2-.cjs} +1 -1
- package/dist/cjs/{index-BEeludy0.d.cts → index-p0duTbHE.d.cts} +2 -2
- package/dist/cjs/index.cjs +3 -3
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/{index.node-9bfp79rs.cjs → index.node-ECg3DGc8.cjs} +7 -6
- package/dist/cjs/{logging-Emi7P923.cjs → logging-r-r2bUWO.cjs} +1 -1
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +1 -1
- package/dist/cjs/{management-5Et1mEUp.cjs → management-CFQ4hjs6.cjs} +123 -108
- package/dist/cjs/{openapi-DghfuM8S.cjs → openapi-BaKoO7GY.cjs} +177 -26
- package/dist/cjs/{rolldown-runtime-CoOt0iuZ.cjs → rolldown-runtime-BKfnhsn2.cjs} +4 -4
- package/dist/cjs/{schemas-B6ITl1bG.cjs → schemas-B-jCi6Oz.cjs} +1 -1
- package/dist/cjs/{utils-CoR_PBHz.cjs → utils-CuzJBLgo.cjs} +2 -2
- package/dist/cjs/{utils-DSS0XlXq.cjs → utils-bwFwJcPW.cjs} +1 -1
- package/dist/cjs/{validate-BC3rnRLc.cjs → validate-DKMq3KNV.cjs} +13 -5
- package/dist/cjs/{version-5MonNzl5.cjs → version-BYcHBNng.cjs} +3 -3
- package/dist/{es/webhooks-DgaLfP36.d.mts → cjs/webhooks-BCYX3JqY.d.cts} +382 -43
- package/dist/cjs/{webhooks-ZPh2gVb3.cjs → webhooks-Bp1Roq8a.cjs} +70 -23
- package/dist/es/actions/app-config/index.d.mts +2 -2
- package/dist/es/actions/app-config/index.mjs +6 -6
- package/dist/es/actions/association/index.mjs +3 -3
- package/dist/es/actions/config/index.d.mts +2 -2
- package/dist/es/actions/config/index.mjs +19 -8
- package/dist/es/actions/installation/index.d.mts +4 -4
- package/dist/es/actions/installation/index.mjs +38 -14
- package/dist/es/actions/scope-tree/index.mjs +5 -5
- package/dist/es/{app-B3bAEor-.d.mts → app-CLDvfJXp.d.mts} +634 -44
- package/dist/es/commands/index.mjs +170 -29
- package/dist/es/config/index.browser.d.mts +1 -1
- package/dist/es/config/index.node.d.mts +51 -15
- package/dist/es/config/index.node.mjs +3 -3
- package/dist/es/{define-BdXyLAwb.d.mts → define-C-0hOMO3.d.mts} +1 -1
- package/dist/es/{environment-DUhU0_9z.mjs → environment-B1JJFHZw.mjs} +1 -1
- package/dist/es/{index-DE2KVXfH.d.mts → index-DYHaYwvJ.d.mts} +4 -4
- package/dist/es/{index-DUJtT78x.d.mts → index-U7CXicoW.d.mts} +1 -1
- package/dist/es/index.d.mts +2 -2
- package/dist/es/index.mjs +3 -3
- package/dist/es/{index.node-CURztkP5.mjs → index.node-ChWOTWnF.mjs} +5 -4
- package/dist/es/management/index.d.mts +1 -1
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-BAQ64OyR.mjs → management-CNMT6azj.mjs} +128 -113
- package/dist/es/{openapi-BvPVTUMt.mjs → openapi-ChihLuvm.mjs} +177 -26
- package/dist/es/{utils-DB8HaSj0.mjs → utils-Bg_LIAGV.mjs} +2 -2
- package/dist/es/{validate-xS9Dc-4m.mjs → validate-DeAMC-HS.mjs} +7 -5
- package/dist/es/{version-BWgrh_QM.mjs → version-Cj7a9rey.mjs} +1 -1
- package/dist/es/{webhooks-HBe_DEKA.mjs → webhooks-CyiUfRNG.mjs} +67 -20
- package/dist/{cjs/webhooks-DNLuuv9_.d.cts → es/webhooks-DyMAQMnm.d.mts} +382 -43
- package/package.json +14 -15
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { r as CommerceAppConfigOutputModel } from "./app-
|
|
16
|
-
import { k as AdminUiComponentConfig, n as WebhookEntry, p as AppEvent, u as CustomInstallationStep } from "./webhooks-
|
|
17
|
-
import * as v from "valibot";
|
|
18
|
-
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
15
|
+
import { r as CommerceAppConfigOutputModel } from "./app-CLDvfJXp.mjs";
|
|
16
|
+
import { k as AdminUiComponentConfig, n as WebhookEntry, p as AppEvent, u as CustomInstallationStep } from "./webhooks-DyMAQMnm.mjs";
|
|
19
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
18
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
19
|
+
import * as v from "valibot";
|
|
20
20
|
/** Schema for validating the Adobe I/O app credentials used across lifecycle workflows. */
|
|
21
21
|
declare const AppDataSchema: v.ObjectSchema<{
|
|
22
22
|
readonly consumerOrgId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "@adobe/aio-commerce-lib-core/responses";
|
|
16
15
|
import "@adobe/aio-lib-core-logging";
|
|
17
16
|
import "@adobe/aio-commerce-lib-core/params";
|
|
17
|
+
import "@adobe/aio-commerce-lib-core/responses";
|
|
18
18
|
import "@standard-schema/spec";
|
|
19
19
|
import "type-fest";
|
package/dist/es/index.d.mts
CHANGED
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @packageDocumentation
|
|
21
21
|
*/
|
|
22
|
-
import { t as AssociatedCommerceData } from "./types-DslZGym8.mjs";
|
|
23
22
|
import { AdobeCommerceHttpClient, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
24
|
-
import { CommerceSdkErrorBase, CommerceSdkErrorBaseOptions } from "@adobe/aio-commerce-lib-core/error";
|
|
25
23
|
import { ImsAuthParams, ImsAuthProvider } from "@adobe/aio-commerce-lib-auth";
|
|
24
|
+
import { t as AssociatedCommerceData } from "./types-DslZGym8.mjs";
|
|
25
|
+
import { CommerceSdkErrorBase, CommerceSdkErrorBaseOptions } from "@adobe/aio-commerce-lib-core/error";
|
|
26
26
|
import { AdobeIoEventsApiClient } from "@adobe/aio-commerce-lib-events/io-events";
|
|
27
27
|
/**
|
|
28
28
|
* Returns the Commerce instance this app is currently associated with.
|
package/dist/es/index.mjs
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as getAssociationData } from "./repository-BVBp61y9.mjs";
|
|
16
|
-
import { f as getNamespacedEvent, l as getIoEventCode, n as EVENTS_STORAGE_KEY, r as EXTERNAL_PROVIDER_TYPE, t as COMMERCE_PROVIDER_TYPE } from "./utils-DB8HaSj0.mjs";
|
|
17
15
|
import { AdobeCommerceHttpClient } from "@adobe/aio-commerce-lib-api";
|
|
18
|
-
import {
|
|
16
|
+
import { n as getAssociationData } from "./repository-BVBp61y9.mjs";
|
|
19
17
|
import { CommerceSdkErrorBase } from "@adobe/aio-commerce-lib-core/error";
|
|
18
|
+
import { getSystemConfigByKey } from "@adobe/aio-commerce-lib-config";
|
|
19
|
+
import { f as getNamespacedEvent, l as getIoEventCode, n as EVENTS_STORAGE_KEY, r as EXTERNAL_PROVIDER_TYPE, t as COMMERCE_PROVIDER_TYPE } from "./utils-Bg_LIAGV.mjs";
|
|
20
20
|
|
|
21
21
|
// source/lib/errors.ts
|
|
22
22
|
/**
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { basename, dirname, join, parse } from "path";
|
|
16
16
|
import { stringifyError } from "@adobe/aio-commerce-lib-core/error";
|
|
17
17
|
import { existsSync } from "fs";
|
|
18
18
|
import { access, mkdir, readFile } from "fs/promises";
|
|
19
|
-
import { basename, dirname, join, parse } from "path";
|
|
20
19
|
import NpmPackageJson from "@npmcli/package-json";
|
|
21
20
|
import { getPackageInfo } from "local-pkg";
|
|
22
21
|
import { resolveCommand } from "package-manager-detector";
|
|
23
22
|
import { detect, getUserAgent } from "package-manager-detector/detect";
|
|
24
23
|
import { satisfies, validRange } from "semver";
|
|
24
|
+
import { t as validateCommerceAppConfig } from "./validate-DeAMC-HS.mjs";
|
|
25
25
|
|
|
26
26
|
// ../../packages-private/scripting-utils/source/project.ts
|
|
27
27
|
/**
|
|
@@ -40,7 +40,8 @@ async function findUp(name, options = {}) {
|
|
|
40
40
|
const { root } = parse(cwd);
|
|
41
41
|
const stopAt = options.stopAt || root;
|
|
42
42
|
let currentDir = cwd;
|
|
43
|
-
|
|
43
|
+
let reachedTop = false;
|
|
44
|
+
while (!reachedTop) {
|
|
44
45
|
for (const fileName of names) {
|
|
45
46
|
const filePath = join(currentDir, fileName);
|
|
46
47
|
try {
|
|
@@ -48,7 +49,7 @@ async function findUp(name, options = {}) {
|
|
|
48
49
|
return filePath;
|
|
49
50
|
} catch {}
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
reachedTop = currentDir === stopAt || currentDir === root;
|
|
52
53
|
currentDir = dirname(currentDir);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
* This module exports shared application management utilities for the AIO Commerce SDK.
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
|
-
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-
|
|
20
|
+
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-DYHaYwvJ.mjs";
|
|
21
21
|
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 };
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { a as runValidation, d as isInProgressState, f as isSucceededState, i as runUninstallation, l as isCompletedState, n as createInitialUninstallationState, r as runInstallation, s as defineCustomInstallationStep, t as createInitialInstallationState, u as isFailedState } from "../management-
|
|
15
|
+
import { a as runValidation, d as isInProgressState, f as isSucceededState, i as runUninstallation, l as isCompletedState, n as createInitialUninstallationState, r as runInstallation, s as defineCustomInstallationStep, t as createInitialInstallationState, u as isFailedState } from "../management-CNMT6azj.mjs";
|
|
16
16
|
|
|
17
17
|
export { createInitialInstallationState, createInitialUninstallationState, defineCustomInstallationStep, isCompletedState, isFailedState, isInProgressState, isSucceededState, runInstallation, runUninstallation, runValidation };
|
|
@@ -12,24 +12,24 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { HTTP_NOT_FOUND, unwrapHttpError } from "@adobe/aio-commerce-lib-api/utils";
|
|
16
|
+
import { a as hasCustomInstallationSteps, c as hasEventing, d as ADMIN_UI_MASS_ACTION_ENTITIES, f as ADMIN_UI_VIEW_BUTTON_ENTITIES, l as hasExternalEvents, m as hasAdminUi, n as hasWebhooks, s as hasCommerceEvents, u as ADMIN_UI_GRID_COLUMN_ENTITIES } from "./webhooks-CyiUfRNG.mjs";
|
|
17
|
+
import { HTTPError } from "ky";
|
|
18
|
+
import stringify, { stringify as stringify$1 } from "safe-stable-stringify";
|
|
19
|
+
import { createAdminUiApiClient } from "@adobe/aio-commerce-lib-admin-ui/api";
|
|
20
|
+
import { resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
16
21
|
import { t as LIFECYCLE_HTTP_CLIENT_TIMEOUT_MS } from "./constants-C-4fesPr.mjs";
|
|
17
22
|
import { t as parseOrThrow } from "./utils-G-EDWmew.mjs";
|
|
18
|
-
import { i as getInstallCommerceEnv, t as appliesToEnv } from "./environment-DUhU0_9z.mjs";
|
|
19
|
-
import { C as sanitizeEventingIdentifier, S as pruneStoredEventProviders, _ as getRegistrationName, a as generateInstanceId, b as isIoProviderProvenOwnedByApp, c as getCommerceEventingExistingData, d as getLegacyRegistrationName, f as getNamespacedEvent, g as getRegistrationDescription, h as getProviderSnapshots, i as eventCodeOf, l as getIoEventCode, m as getProviderKeyFromInstanceId, n as EVENTS_STORAGE_KEY, o as generateInstanceIdDeprecated, p as getNamespacedNameOfCode, r as EXTERNAL_PROVIDER_TYPE, s as getCommerceEventingConfigurationUpdateParams, t as COMMERCE_PROVIDER_TYPE, u as getIoEventsExistingData, v as getStoredEventProviderKeys, w as storeEventProviders, x as makeWorkspaceConfig, y as groupEventsByRuntimeActions } from "./utils-DB8HaSj0.mjs";
|
|
20
|
-
import { t as inspect } from "./logging-B1xb568A.mjs";
|
|
21
|
-
import { resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
22
|
-
import { getSystemConfigByKey, setSystemConfigByKey } from "@adobe/aio-commerce-lib-config";
|
|
23
|
-
import { stringifyError } from "@adobe/aio-commerce-lib-core/error";
|
|
24
|
-
import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
|
|
25
23
|
import * as v from "valibot";
|
|
26
|
-
import { createAdminUiApiClient } from "@adobe/aio-commerce-lib-admin-ui/api";
|
|
27
|
-
import stringify, { stringify as stringify$1 } from "safe-stable-stringify";
|
|
28
|
-
import { HTTPError } from "ky";
|
|
29
|
-
import { HTTP_NOT_FOUND, unwrapHttpError } from "@adobe/aio-commerce-lib-api/utils";
|
|
30
24
|
import * as camelcaseModule from "camelcase";
|
|
25
|
+
import { getSystemConfigByKey, setSystemConfigByKey } from "@adobe/aio-commerce-lib-config";
|
|
26
|
+
import { i as getInstallCommerceEnv, t as appliesToEnv } from "./environment-B1JJFHZw.mjs";
|
|
27
|
+
import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
|
|
28
|
+
import { C as sanitizeEventingIdentifier, S as pruneStoredEventProviders, _ as getRegistrationName, a as generateInstanceId, b as isIoProviderProvenOwnedByApp, c as getCommerceEventingExistingData, d as getLegacyRegistrationName, f as getNamespacedEvent, g as getRegistrationDescription, h as getProviderSnapshots, i as eventCodeOf, l as getIoEventCode, m as getProviderKeyFromInstanceId, n as EVENTS_STORAGE_KEY, o as generateInstanceIdDeprecated, p as getNamespacedNameOfCode, r as EXTERNAL_PROVIDER_TYPE, s as getCommerceEventingConfigurationUpdateParams, t as COMMERCE_PROVIDER_TYPE, u as getIoEventsExistingData, v as getStoredEventProviderKeys, w as storeEventProviders, x as makeWorkspaceConfig, y as groupEventsByRuntimeActions } from "./utils-Bg_LIAGV.mjs";
|
|
29
|
+
import { t as inspect } from "./logging-B1xb568A.mjs";
|
|
31
30
|
import { createCustomCommerceEventsApiClient, createEventProvider, createEventSubscription, deleteEventProvider, deleteEventSubscription, getAllEventProviders, getAllEventSubscriptions, updateEventProvider, updateEventSubscription, updateEventingConfiguration } from "@adobe/aio-commerce-lib-events/commerce";
|
|
32
|
-
import { createCustomAdobeIoEventsApiClient, createEventMetadataForProvider, createEventProvider as createEventProvider$1, createRegistration, deleteEventMetadataForProvider, deleteEventProvider as deleteEventProvider$1, deleteRegistration, getAllEventProviders as getAllEventProviders$1, getAllRegistrations, updateEventMetadataForProvider, updateEventProvider as updateEventProvider$1, updateRegistration } from "@adobe/aio-commerce-lib-events/io-events";
|
|
31
|
+
import { createCustomAdobeIoEventsApiClient, createEventMetadataForProvider, createEventProvider as createEventProvider$1, createRegistration as createRegistration$1, deleteEventMetadataForProvider, deleteEventProvider as deleteEventProvider$1, deleteRegistration as deleteRegistration$1, getAllEventProviders as getAllEventProviders$1, getAllRegistrations, updateEventMetadataForProvider, updateEventProvider as updateEventProvider$1, updateRegistration as updateRegistration$1 } from "@adobe/aio-commerce-lib-events/io-events";
|
|
32
|
+
import { stringifyError } from "@adobe/aio-commerce-lib-core/error";
|
|
33
33
|
import { createCustomCommerceWebhooksApiClient, getWebhookList, subscribeWebhook, unsubscribeWebhook } from "@adobe/aio-commerce-lib-webhooks/api";
|
|
34
34
|
|
|
35
35
|
// source/management/common/workflow/hooks.ts
|
|
@@ -753,6 +753,19 @@ function enumerateComponents(adminUi) {
|
|
|
753
753
|
});
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
|
+
const customAttributeGridColumns = adminUi.creditMemo?.customAttributeGridColumns;
|
|
757
|
+
if (customAttributeGridColumns) {
|
|
758
|
+
const key = "creditMemo.custom-attribute-grid-columns";
|
|
759
|
+
components.set(key, {
|
|
760
|
+
config: customAttributeGridColumns,
|
|
761
|
+
key,
|
|
762
|
+
label: "Credit Memo custom attribute grid columns",
|
|
763
|
+
ref: {
|
|
764
|
+
entity: "creditMemo",
|
|
765
|
+
kind: "customAttributeGridColumns"
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
756
769
|
for (const entity of ADMIN_UI_MASS_ACTION_ENTITIES) {
|
|
757
770
|
const entityConfig = adminUi[entity];
|
|
758
771
|
for (const massAction of entityConfig?.massActions ?? []) {
|
|
@@ -970,51 +983,7 @@ const adminUiStep = defineBranchStep({
|
|
|
970
983
|
name: "admin-ui"
|
|
971
984
|
});
|
|
972
985
|
|
|
973
|
-
// source/management/
|
|
974
|
-
/**
|
|
975
|
-
* Creates the legacy install/uninstall handlers of a custom installation script leaf.
|
|
976
|
-
* Deleted in the next major.
|
|
977
|
-
*
|
|
978
|
-
* @param scriptConfig - The custom installation step the handlers belong to.
|
|
979
|
-
*/
|
|
980
|
-
function createDeprecatedCustomScriptHandlers(scriptConfig) {
|
|
981
|
-
const { script, name } = scriptConfig;
|
|
982
|
-
return {
|
|
983
|
-
install: async (config, context) => {
|
|
984
|
-
const { logger } = context;
|
|
985
|
-
const customScripts = context.customScripts || {};
|
|
986
|
-
logger.info(`Executing custom installation script: ${name}`);
|
|
987
|
-
logger.debug(`Script path: ${script}`);
|
|
988
|
-
const scriptModule = getScriptModuleOrThrow(customScripts, script);
|
|
989
|
-
const scriptResult = await resolveCustomScriptHandler(scriptModule, "install")(config, context);
|
|
990
|
-
logger.info(`Successfully executed script: ${name}`);
|
|
991
|
-
return {
|
|
992
|
-
data: scriptResult,
|
|
993
|
-
script
|
|
994
|
-
};
|
|
995
|
-
},
|
|
996
|
-
uninstall: async (config, context) => {
|
|
997
|
-
const { logger } = context;
|
|
998
|
-
const customScripts = context.customScripts || {};
|
|
999
|
-
logger.debug(`Uninstalling custom script: ${name}`);
|
|
1000
|
-
const scriptModule = getScriptModule(customScripts, script);
|
|
1001
|
-
if (!scriptModule) {
|
|
1002
|
-
logger.warn(`Script ${script} not found in customScripts context, skipping uninstall. It may have been removed from the project after being configured.`);
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
const uninstall = resolveCustomScriptHandler(scriptModule, "uninstall");
|
|
1006
|
-
if (!uninstall) {
|
|
1007
|
-
logger.debug(`Script ${script} does not export an uninstall function, skipping uninstall.`);
|
|
1008
|
-
return;
|
|
1009
|
-
}
|
|
1010
|
-
await uninstall(config, context);
|
|
1011
|
-
logger.info(`Successfully uninstalled script: ${name}`);
|
|
1012
|
-
}
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
// source/management/domains/custom-installation/custom-scripts.ts
|
|
1017
|
-
const camelcase = camelcaseModule.default.default ?? camelcaseModule.default;
|
|
986
|
+
// source/management/domains/custom-installation/script-module.ts
|
|
1018
987
|
const ScriptModuleSchema = v.union([v.function(), v.object({
|
|
1019
988
|
install: v.function(),
|
|
1020
989
|
uninstall: v.optional(v.function())
|
|
@@ -1060,6 +1029,98 @@ function getScriptModuleOrThrow(customScripts, script) {
|
|
|
1060
1029
|
if (!scriptModule) throw new Error(`Script ${script} not found in customScripts context. Make sure the script is defined in the configuration and the action was generated with custom scripts support.`);
|
|
1061
1030
|
return scriptModule;
|
|
1062
1031
|
}
|
|
1032
|
+
|
|
1033
|
+
// source/management/domains/custom-installation/apply.ts
|
|
1034
|
+
/** Runs a newly-added step's `install` handler and returns its persisted identity. */
|
|
1035
|
+
async function runAddedStep(step, targetConfig, context) {
|
|
1036
|
+
const { logger } = context;
|
|
1037
|
+
const scriptModule = getScriptModuleOrThrow(context.customScripts ?? {}, step.script);
|
|
1038
|
+
logger.info(`Executing custom installation script: ${step.name}`);
|
|
1039
|
+
await resolveCustomScriptHandler(scriptModule, "install")(targetConfig, context);
|
|
1040
|
+
logger.info(`Successfully executed script: ${step.name}`);
|
|
1041
|
+
return {
|
|
1042
|
+
name: step.name,
|
|
1043
|
+
script: step.script
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Runs the `uninstall` of a step that ran before. Returns whether it ran: a step whose script is
|
|
1048
|
+
* not deployed, or that exports no `uninstall`, is skipped with a warning.
|
|
1049
|
+
*/
|
|
1050
|
+
async function runRemovedStep(step, baselineConfig, context) {
|
|
1051
|
+
const { logger } = context;
|
|
1052
|
+
const scriptModule = getScriptModule(context.customScripts ?? {}, step.script);
|
|
1053
|
+
if (!scriptModule) {
|
|
1054
|
+
logger.warn(`Skipping the uninstall of custom installation step "${step.name}": its script "${step.script}" is not deployed.`);
|
|
1055
|
+
return false;
|
|
1056
|
+
}
|
|
1057
|
+
const uninstall = resolveCustomScriptHandler(scriptModule, "uninstall");
|
|
1058
|
+
if (!uninstall) {
|
|
1059
|
+
logger.warn(`Skipping the uninstall of custom installation step "${step.name}": its script exports no uninstall function.`);
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
logger.info(`Executing custom uninstallation script: ${step.name}`);
|
|
1063
|
+
await uninstall(baselineConfig, context);
|
|
1064
|
+
logger.info(`Successfully executed script: ${step.name}`);
|
|
1065
|
+
return true;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Applies the plan of a single custom installation step. An `add` runs its `install` and records
|
|
1069
|
+
* the step. A `remove` runs its `uninstall` and records `null`, or keeps the step's record when its
|
|
1070
|
+
* `uninstall` could not run.
|
|
1071
|
+
*/
|
|
1072
|
+
async function applyCustomScript(plan, context) {
|
|
1073
|
+
const operation = plan.operations.at(0);
|
|
1074
|
+
if (operation?.kind === "add" && context.targetConfig) return { snapshotData: await runAddedStep(operation.after, context.targetConfig, context) };
|
|
1075
|
+
if (operation?.kind === "remove") return { snapshotData: plan.baselineConfig !== null && await runRemovedStep(operation.before, plan.baselineConfig, context) ? null : operation.before };
|
|
1076
|
+
throw new Error(`The plan of custom installation step "${plan.path.at(-1)}" has nothing to apply`);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// source/management/deprecated/domains/custom-installation.ts
|
|
1080
|
+
/**
|
|
1081
|
+
* Creates the legacy install/uninstall handlers of a custom installation script leaf.
|
|
1082
|
+
* Deleted in the next major.
|
|
1083
|
+
*
|
|
1084
|
+
* @param scriptConfig - The custom installation step the handlers belong to.
|
|
1085
|
+
*/
|
|
1086
|
+
function createDeprecatedCustomScriptHandlers(scriptConfig) {
|
|
1087
|
+
const { script, name } = scriptConfig;
|
|
1088
|
+
return {
|
|
1089
|
+
install: async (config, context) => {
|
|
1090
|
+
const { logger } = context;
|
|
1091
|
+
const customScripts = context.customScripts || {};
|
|
1092
|
+
logger.info(`Executing custom installation script: ${name}`);
|
|
1093
|
+
logger.debug(`Script path: ${script}`);
|
|
1094
|
+
const scriptModule = getScriptModuleOrThrow(customScripts, script);
|
|
1095
|
+
const scriptResult = await resolveCustomScriptHandler(scriptModule, "install")(config, context);
|
|
1096
|
+
logger.info(`Successfully executed script: ${name}`);
|
|
1097
|
+
return {
|
|
1098
|
+
data: scriptResult,
|
|
1099
|
+
script
|
|
1100
|
+
};
|
|
1101
|
+
},
|
|
1102
|
+
uninstall: async (config, context) => {
|
|
1103
|
+
const { logger } = context;
|
|
1104
|
+
const customScripts = context.customScripts || {};
|
|
1105
|
+
logger.debug(`Uninstalling custom script: ${name}`);
|
|
1106
|
+
const scriptModule = getScriptModule(customScripts, script);
|
|
1107
|
+
if (!scriptModule) {
|
|
1108
|
+
logger.warn(`Script ${script} not found in customScripts context, skipping uninstall. It may have been removed from the project after being configured.`);
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
const uninstall = resolveCustomScriptHandler(scriptModule, "uninstall");
|
|
1112
|
+
if (!uninstall) {
|
|
1113
|
+
logger.debug(`Script ${script} does not export an uninstall function, skipping uninstall.`);
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
await uninstall(config, context);
|
|
1117
|
+
logger.info(`Successfully uninstalled script: ${name}`);
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// source/management/domains/custom-installation/custom-scripts.ts
|
|
1123
|
+
const camelcase = camelcaseModule.default.default ?? camelcaseModule.default;
|
|
1063
1124
|
/** The custom installation step the config declares with the given name, if any. */
|
|
1064
1125
|
function findDeclaredStep(config, name) {
|
|
1065
1126
|
return hasCustomInstallationSteps(config) ? config.installation.customInstallationSteps.find((step) => step.name === name) : void 0;
|
|
@@ -1108,52 +1169,6 @@ function createCustomScriptSteps(config) {
|
|
|
1108
1169
|
return steps.map((scriptConfig) => createCustomScriptStep(scriptConfig));
|
|
1109
1170
|
}
|
|
1110
1171
|
|
|
1111
|
-
// source/management/domains/custom-installation/apply.ts
|
|
1112
|
-
/** Runs a newly-added step's `install` handler and returns its persisted identity. */
|
|
1113
|
-
async function runAddedStep(step, targetConfig, context) {
|
|
1114
|
-
const { logger } = context;
|
|
1115
|
-
const scriptModule = getScriptModuleOrThrow(context.customScripts ?? {}, step.script);
|
|
1116
|
-
logger.info(`Executing custom installation script: ${step.name}`);
|
|
1117
|
-
await resolveCustomScriptHandler(scriptModule, "install")(targetConfig, context);
|
|
1118
|
-
logger.info(`Successfully executed script: ${step.name}`);
|
|
1119
|
-
return {
|
|
1120
|
-
name: step.name,
|
|
1121
|
-
script: step.script
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
* Runs the `uninstall` of a step that ran before. Returns whether it ran: a step whose script is
|
|
1126
|
-
* not deployed, or that exports no `uninstall`, is skipped with a warning.
|
|
1127
|
-
*/
|
|
1128
|
-
async function runRemovedStep(step, baselineConfig, context) {
|
|
1129
|
-
const { logger } = context;
|
|
1130
|
-
const scriptModule = getScriptModule(context.customScripts ?? {}, step.script);
|
|
1131
|
-
if (!scriptModule) {
|
|
1132
|
-
logger.warn(`Skipping the uninstall of custom installation step "${step.name}": its script "${step.script}" is not deployed.`);
|
|
1133
|
-
return false;
|
|
1134
|
-
}
|
|
1135
|
-
const uninstall = resolveCustomScriptHandler(scriptModule, "uninstall");
|
|
1136
|
-
if (!uninstall) {
|
|
1137
|
-
logger.warn(`Skipping the uninstall of custom installation step "${step.name}": its script exports no uninstall function.`);
|
|
1138
|
-
return false;
|
|
1139
|
-
}
|
|
1140
|
-
logger.info(`Executing custom uninstallation script: ${step.name}`);
|
|
1141
|
-
await uninstall(baselineConfig, context);
|
|
1142
|
-
logger.info(`Successfully executed script: ${step.name}`);
|
|
1143
|
-
return true;
|
|
1144
|
-
}
|
|
1145
|
-
/**
|
|
1146
|
-
* Applies the plan of a single custom installation step. An `add` runs its `install` and records
|
|
1147
|
-
* the step. A `remove` runs its `uninstall` and records `null`, or keeps the step's record when its
|
|
1148
|
-
* `uninstall` could not run.
|
|
1149
|
-
*/
|
|
1150
|
-
async function applyCustomScript(plan, context) {
|
|
1151
|
-
const operation = plan.operations.at(0);
|
|
1152
|
-
if (operation?.kind === "add" && context.targetConfig) return { snapshotData: await runAddedStep(operation.after, context.targetConfig, context) };
|
|
1153
|
-
if (operation?.kind === "remove") return { snapshotData: plan.baselineConfig !== null && await runRemovedStep(operation.before, plan.baselineConfig, context) ? null : operation.before };
|
|
1154
|
-
throw new Error(`The plan of custom installation step "${plan.path.at(-1)}" has nothing to apply`);
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
1172
|
// source/management/domains/custom-installation/changes.ts
|
|
1158
1173
|
/**
|
|
1159
1174
|
* The change of one custom installation step between the baseline and the target config: `add` when
|
|
@@ -1425,7 +1440,7 @@ async function isSubscriptionMissing(error) {
|
|
|
1425
1440
|
return (await error.response.clone().text().catch(() => "")).includes("is not registered. You cannot unsubscribe from it.");
|
|
1426
1441
|
}
|
|
1427
1442
|
/** Deletes a registration. Throws on failure: it would keep delivering events to the app. */
|
|
1428
|
-
async function deleteRegistration
|
|
1443
|
+
async function deleteRegistration(value, context) {
|
|
1429
1444
|
const { ioEventsClient, logger } = context;
|
|
1430
1445
|
try {
|
|
1431
1446
|
await ioEventsClient.deleteRegistration({
|
|
@@ -1530,7 +1545,7 @@ async function updateMetadata(after, context) {
|
|
|
1530
1545
|
}
|
|
1531
1546
|
}
|
|
1532
1547
|
/** Replaces a registration with its desired name, description and events. */
|
|
1533
|
-
async function updateRegistration
|
|
1548
|
+
async function updateRegistration(before, after, context) {
|
|
1534
1549
|
const { ioEventsClient, logger, params } = context;
|
|
1535
1550
|
const providerId = after.providerId;
|
|
1536
1551
|
try {
|
|
@@ -1621,7 +1636,7 @@ async function createMetadata(value, providerId, context) {
|
|
|
1621
1636
|
}
|
|
1622
1637
|
}
|
|
1623
1638
|
/** Creates a registration that delivers the given events of a provider to a runtime action. */
|
|
1624
|
-
async function createRegistration
|
|
1639
|
+
async function createRegistration(value, providerId, context) {
|
|
1625
1640
|
const { ioEventsClient, logger, params } = context;
|
|
1626
1641
|
try {
|
|
1627
1642
|
await ioEventsClient.createRegistration({
|
|
@@ -2523,7 +2538,7 @@ async function addResource({ after }, target, context) {
|
|
|
2523
2538
|
case "commerceProvider": return await createCommerceProvider$1(after, providerIdOf(after.providerKey, target), context);
|
|
2524
2539
|
case "metadata": return await createMetadata(after, providerIdOf(after.providerKey, target), context);
|
|
2525
2540
|
case "subscription": return await createSubscription(after, targetEventOf(after.name, target), providerIdOf(after.providerKey, target), context);
|
|
2526
|
-
case "registration": return await createRegistration
|
|
2541
|
+
case "registration": return await createRegistration(after, providerIdOf(after.providerKey, target), context);
|
|
2527
2542
|
default: return;
|
|
2528
2543
|
}
|
|
2529
2544
|
}
|
|
@@ -2550,7 +2565,7 @@ function getRemovedProviderKeys(operations) {
|
|
|
2550
2565
|
async function removeResource(value, context) {
|
|
2551
2566
|
switch (value.resourceType) {
|
|
2552
2567
|
case "subscription": return await deleteSubscription(value.name, context);
|
|
2553
|
-
case "registration": return await deleteRegistration
|
|
2568
|
+
case "registration": return await deleteRegistration(value, context);
|
|
2554
2569
|
case "metadata": return await deleteMetadata(value, context);
|
|
2555
2570
|
case "commerceProvider": return await deleteCommerceProvider(value, context);
|
|
2556
2571
|
case "provider": return await deleteProvider(value, context);
|
|
@@ -2564,7 +2579,7 @@ async function updateResource(op, target, context) {
|
|
|
2564
2579
|
case "provider": return await updateProvider(before, after, context);
|
|
2565
2580
|
case "commerceProvider": return await updateCommerceProvider(before, after, context);
|
|
2566
2581
|
case "metadata": return await updateMetadata(after, context);
|
|
2567
|
-
case "registration": return await updateRegistration
|
|
2582
|
+
case "registration": return await updateRegistration(before, after, context);
|
|
2568
2583
|
case "subscription": return await updateSubscription(after, targetEventOf(after.name, target), context);
|
|
2569
2584
|
default: return;
|
|
2570
2585
|
}
|
|
@@ -3530,15 +3545,15 @@ function createIoEventsApiClient(params) {
|
|
|
3530
3545
|
return createCustomAdobeIoEventsApiClient(ioEventsClientParams, {
|
|
3531
3546
|
createEventMetadataForProvider,
|
|
3532
3547
|
createEventProvider: createEventProvider$1,
|
|
3533
|
-
createRegistration,
|
|
3548
|
+
createRegistration: createRegistration$1,
|
|
3534
3549
|
deleteEventMetadataForProvider,
|
|
3535
3550
|
deleteEventProvider: deleteEventProvider$1,
|
|
3536
|
-
deleteRegistration,
|
|
3551
|
+
deleteRegistration: deleteRegistration$1,
|
|
3537
3552
|
getAllEventProviders: getAllEventProviders$1,
|
|
3538
3553
|
getAllRegistrations,
|
|
3539
3554
|
updateEventMetadataForProvider,
|
|
3540
3555
|
updateEventProvider: updateEventProvider$1,
|
|
3541
|
-
updateRegistration
|
|
3556
|
+
updateRegistration: updateRegistration$1
|
|
3542
3557
|
});
|
|
3543
3558
|
}
|
|
3544
3559
|
/** Creates the events step context with lazy-initialized API clients. */
|