@adobe/aio-commerce-lib-app 2.1.0 → 2.2.0-alpha-20261110171457
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 +21 -0
- package/dist/cjs/actions/app-config/index.cjs +5 -5
- package/dist/cjs/actions/app-config/index.d.cts +2 -2
- package/dist/cjs/actions/association/index.cjs +2 -2
- package/dist/cjs/actions/config/index.cjs +2 -2
- package/dist/cjs/actions/config/index.d.cts +2 -2
- package/dist/cjs/actions/installation/index.cjs +61 -21
- package/dist/cjs/actions/installation/index.d.cts +4 -3
- package/dist/cjs/actions/scope-tree/index.cjs +2 -2
- package/dist/cjs/{app-Ch19CR6g.d.cts → app-DREvtzyX.d.cts} +330 -4
- package/dist/cjs/commands/index.cjs +27 -12
- package/dist/cjs/config/index.browser.d.cts +2 -1
- package/dist/cjs/config/index.node.cjs +3 -3
- package/dist/cjs/config/index.node.d.cts +96 -8
- package/dist/{es/define-C95h_wa0.d.mts → cjs/define-DW6Vzfku.d.cts} +1 -1
- package/dist/cjs/{index-D-Qn-irL.d.cts → index-B9MUZY-U.d.cts} +316 -316
- package/dist/cjs/{index-DWEigxhy.d.cts → index-vAue-u_y.d.cts} +1 -4
- package/dist/cjs/index.d.cts +8 -8
- package/dist/cjs/{index.node-CxdwPrOg.cjs → index.node-CcH8PCzC.cjs} +1 -1
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +6 -1
- package/dist/cjs/{management-C_JQpgVB.cjs → management-DeRZYcjS.cjs} +17 -5
- package/dist/cjs/{openapi-DFoMdZzI.cjs → openapi-CFqaMxUV.cjs} +426 -45
- package/dist/cjs/types-DslZGym8.d.cts +23 -0
- package/dist/cjs/{validate-B0rOILvG.cjs → validate-DAw7Pxp3.cjs} +1 -1
- package/dist/cjs/{router-DpB8wpR2.cjs → version-BACmFGD2.cjs} +77 -19
- package/dist/{es/webhooks-C9vMZZDZ.d.mts → cjs/webhooks-BMSr1l7c.d.cts} +268 -12
- package/dist/cjs/{webhooks-TvDm57xt.cjs → webhooks-EVlO8rxi.cjs} +53 -12
- package/dist/es/actions/app-config/index.d.mts +2 -2
- package/dist/es/actions/app-config/index.mjs +5 -5
- package/dist/es/actions/association/index.mjs +2 -2
- package/dist/es/actions/config/index.d.mts +1 -1
- package/dist/es/actions/config/index.mjs +2 -2
- package/dist/es/actions/installation/index.d.mts +4 -3
- package/dist/es/actions/installation/index.mjs +62 -22
- package/dist/es/actions/scope-tree/index.mjs +2 -2
- package/dist/es/{app-Ch19CR6g.d.mts → app-DREvtzyX.d.mts} +330 -4
- package/dist/es/commands/index.mjs +27 -12
- package/dist/es/config/index.browser.d.mts +2 -1
- package/dist/es/config/index.node.d.mts +95 -6
- package/dist/es/config/index.node.mjs +3 -3
- package/dist/{cjs/define-C12IwNNN.d.cts → es/define-B6cjhz1J.d.mts} +1 -1
- package/dist/es/{index-CgsSXApi.d.mts → index-DUJtT78x.d.mts} +2 -2
- package/dist/es/{index-VgCNSlLP.d.mts → index-zgc3l2nj.d.mts} +2 -2
- package/dist/es/index.d.mts +8 -8
- package/dist/es/{index.node-C8EXBW94.mjs → index.node-ClvSfs5w.mjs} +1 -1
- package/dist/es/management/index.d.mts +6 -1
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-DKDR7-fX.mjs → management-CG_4z2Ck.mjs} +17 -5
- package/dist/es/{openapi-E_1RFhAr.mjs → openapi-BUIws500.mjs} +426 -45
- package/dist/es/types-DslZGym8.d.mts +23 -0
- package/dist/es/{validate-CiJIjyOr.mjs → validate-BszbuhiE.mjs} +1 -1
- package/dist/es/{router-C23GIyGQ.mjs → version-CabzC7R9.mjs} +71 -20
- package/dist/{cjs/webhooks-Buu1d7AB.d.cts → es/webhooks-BLgKadnn.d.mts} +268 -12
- package/dist/es/{webhooks-CfrYeMy_.mjs → webhooks-DRPXVMMo.mjs} +48 -13
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-app
|
|
2
2
|
|
|
3
|
+
## 2.2.0-alpha-20261110171457
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#776](https://github.com/adobe/aio-commerce-sdk/pull/776) [`32988bb`](https://github.com/adobe/aio-commerce-sdk/commit/32988bbda397d9a34f788aee721f4dca9abc362a) Thanks [@aminakhyat](https://github.com/aminakhyat)! - Add `adminUi.creditMemo.viewButtons` to the app config schema, with generated `view` and `workerProcess` operations and installation and upgrade support.
|
|
8
|
+
|
|
9
|
+
- [#746](https://github.com/adobe/aio-commerce-sdk/pull/746) [`ca065be`](https://github.com/adobe/aio-commerce-sdk/commit/ca065bec387cf90ce21309420851bef408ca194e) Thanks [@asalloum5](https://github.com/asalloum5)! - Add `adminUi.nativeUi.replacedPages` configuration to replace the native order creation form with an app page, including validation, web generation, and installation planning.
|
|
10
|
+
|
|
11
|
+
- [#801](https://github.com/adobe/aio-commerce-sdk/pull/801) [`26287d7`](https://github.com/adobe/aio-commerce-sdk/commit/26287d7a0cc3dbd154e52acb94e2ad123c74ef4b) Thanks [@pablomoreno61](https://github.com/pablomoreno61)! - Allow `adminUi.nativeUi.replacedPages` to use the `return.create` target.
|
|
12
|
+
|
|
13
|
+
- [#732](https://github.com/adobe/aio-commerce-sdk/pull/732) [`f124cf4`](https://github.com/adobe/aio-commerce-sdk/commit/f124cf49208d930ca0f151e948a7597317365697) Thanks [@asalloum5](https://github.com/asalloum5)! - Add invoice detail-page view and worker button configuration, validation, generated operations, and installation and upgrade support.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#806](https://github.com/adobe/aio-commerce-sdk/pull/806) [`f6a1712`](https://github.com/adobe/aio-commerce-sdk/commit/f6a17127b0ed94811ad2fa71e4601f7706ad4924) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Fix the uninstall of an app that was installed before the `association` action existed. It stopped working in 2.1.0 and answered `409 not-associated`. The uninstall now plans with the Commerce instance sent with the request and, when it starts, stores that instance as the app's association record.
|
|
18
|
+
|
|
19
|
+
- [#792](https://github.com/adobe/aio-commerce-sdk/pull/792) [`6dbdf71`](https://github.com/adobe/aio-commerce-sdk/commit/6dbdf711a6fdf6f38794dc74a0a9e16146c5d771) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Add an `x-ac-sdk-lib-versions` response header to every app-management endpoint response. It lists the lib-app version and the installed lib-config version it loads (not the app's version), for example `lib-app="2.2.0", lib-config="1.4.1"`.
|
|
20
|
+
- Updated dependencies [[`32988bb`](https://github.com/adobe/aio-commerce-sdk/commit/32988bbda397d9a34f788aee721f4dca9abc362a), [`f124cf4`](https://github.com/adobe/aio-commerce-sdk/commit/f124cf49208d930ca0f151e948a7597317365697), [`ca065be`](https://github.com/adobe/aio-commerce-sdk/commit/ca065bec387cf90ce21309420851bef408ca194e), [`32988bb`](https://github.com/adobe/aio-commerce-sdk/commit/32988bbda397d9a34f788aee721f4dca9abc362a), [`a066916`](https://github.com/adobe/aio-commerce-sdk/commit/a066916918f9d3ff66affc7783c743c34a02f263), [`6dbdf71`](https://github.com/adobe/aio-commerce-sdk/commit/6dbdf711a6fdf6f38794dc74a0a9e16146c5d771)]:
|
|
21
|
+
- @adobe/aio-commerce-lib-admin-ui@1.3.0-alpha-20261110171457
|
|
22
|
+
- @adobe/aio-commerce-lib-config@1.8.2-alpha-20261110171457
|
|
23
|
+
|
|
3
24
|
## 2.1.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
|
|
17
|
-
const
|
|
17
|
+
const require_version = require("../../version-BACmFGD2.cjs");
|
|
18
18
|
const require_environment = require("../../environment-CW6M76gS.cjs");
|
|
19
|
-
const require_validate = require("../../validate-
|
|
19
|
+
const require_validate = require("../../validate-DAw7Pxp3.cjs");
|
|
20
20
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
21
21
|
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
22
22
|
let valibot = require("valibot");
|
|
@@ -29,7 +29,7 @@ let crypto = require("crypto");
|
|
|
29
29
|
* Loads the committed OpenAPI spec via dynamic import so it
|
|
30
30
|
* lands in its own chunk and is not parsed on every cold start.
|
|
31
31
|
*/
|
|
32
|
-
const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-
|
|
32
|
+
const importOpenApi = () => Promise.resolve().then(() => require("../../openapi-CFqaMxUV.cjs"));
|
|
33
33
|
/** Matches component schema `$ref` strings, capturing the schema name. */
|
|
34
34
|
const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(?<schema>\w+)"/gu;
|
|
35
35
|
/**
|
|
@@ -80,7 +80,7 @@ function pruneUnusedTags(spec) {
|
|
|
80
80
|
* @param domains - The active config domains.
|
|
81
81
|
*/
|
|
82
82
|
function getOpenApiCacheKey(domains) {
|
|
83
|
-
const input = `2.
|
|
83
|
+
const input = `2.2.0-alpha-20261110171457:${[...domains].sort().join(",")}:4.2.0`;
|
|
84
84
|
return (0, crypto.createHash)("sha256").update(input).digest("hex").slice(0, 8);
|
|
85
85
|
}
|
|
86
86
|
/** Returns the server URL to be set in the OpenAPI spec, based on the current namespace. */
|
|
@@ -132,7 +132,7 @@ async function buildOpenApiSpec(domains, logger) {
|
|
|
132
132
|
* - GET / Retrieve the Commerce App configuration.
|
|
133
133
|
* - GET /openapi.json Returns the OpenAPI spec for all SDK actions
|
|
134
134
|
*/
|
|
135
|
-
const router = new
|
|
135
|
+
const router = new require_version.HttpActionRouter({ headers: require_version.SDK_LIB_VERSIONS_HEADERS }).use(require_version.logger({ name: () => "app-config" }));
|
|
136
136
|
/** GET / - Get app config */
|
|
137
137
|
router.get("/", {
|
|
138
138
|
handler: async (req, { logger, rawParams }) => {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "../../index-
|
|
16
|
-
import { n as CommerceAppConfig } from "../../app-
|
|
15
|
+
import "../../index-vAue-u_y.cjs";
|
|
16
|
+
import { n as CommerceAppConfig } from "../../app-DREvtzyX.cjs";
|
|
17
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
18
18
|
/** The arguments required to create the runtime action for the app-config action. */
|
|
19
19
|
type RuntimeActionFactoryArgs = {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
|
|
17
|
-
const
|
|
17
|
+
const require_version = require("../../version-BACmFGD2.cjs");
|
|
18
18
|
const require_repository = require("../../repository-C3nn0Mon.cjs");
|
|
19
19
|
let _adobe_aio_commerce_lib_auth = require("@adobe/aio-commerce-lib-auth");
|
|
20
20
|
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
@@ -37,7 +37,7 @@ const AssociationRequestBodySchema = valibot.object({
|
|
|
37
37
|
* - POST / Store Commerce instance details (`baseUrl`, `env`)
|
|
38
38
|
* - DELETE / Clear stored Commerce instance details
|
|
39
39
|
*/
|
|
40
|
-
const router = new
|
|
40
|
+
const router = new require_version.HttpActionRouter({ headers: require_version.SDK_LIB_VERSIONS_HEADERS }).use(require_version.logger({ name: () => "association" }));
|
|
41
41
|
/** POST / - Store association data and return the app's own `client_id`. */
|
|
42
42
|
router.post("/", {
|
|
43
43
|
body: AssociationRequestBodySchema,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
|
|
17
|
-
const
|
|
17
|
+
const require_version = require("../../version-BACmFGD2.cjs");
|
|
18
18
|
const require_environment = require("../../environment-CW6M76gS.cjs");
|
|
19
19
|
const require_schemas = require("../../schemas-B6ITl1bG.cjs");
|
|
20
20
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
@@ -67,7 +67,7 @@ function filterPasswordFields(schema, values) {
|
|
|
67
67
|
* - GET / Get current configuration values for a given scope
|
|
68
68
|
* - PATCH / Partially update configuration (only updates provided fields, allows unsetting)
|
|
69
69
|
*/
|
|
70
|
-
const router = new
|
|
70
|
+
const router = new require_version.HttpActionRouter({ headers: require_version.SDK_LIB_VERSIONS_HEADERS }).use(require_version.logger({ name: () => "config" }));
|
|
71
71
|
/** GET / - Retrieve configuration */
|
|
72
72
|
router.get("/", {
|
|
73
73
|
handler: async (req, ctx) => {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "../../index-
|
|
16
|
-
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
15
|
+
import "../../index-vAue-u_y.cjs";
|
|
17
16
|
import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
17
|
+
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
18
18
|
/** The arguments required to create the runtime action for the config action. */
|
|
19
19
|
type ConfigActionFactoryArgs = {
|
|
20
20
|
configSchema: BusinessConfigSchema;
|
|
@@ -14,15 +14,16 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
|
|
17
|
-
const
|
|
17
|
+
const require_version = require("../../version-BACmFGD2.cjs");
|
|
18
18
|
const require_schemas = require("../../schemas-B6ITl1bG.cjs");
|
|
19
|
-
const require_management = require("../../management-
|
|
19
|
+
const require_management = require("../../management-DeRZYcjS.cjs");
|
|
20
20
|
const require_repository = require("../../repository-C3nn0Mon.cjs");
|
|
21
|
-
const require_webhooks = require("../../webhooks-
|
|
22
|
-
const require_validate = require("../../validate-
|
|
21
|
+
const require_webhooks = require("../../webhooks-EVlO8rxi.cjs");
|
|
22
|
+
const require_validate = require("../../validate-DAw7Pxp3.cjs");
|
|
23
23
|
let _adobe_aio_lib_state = require("@adobe/aio-lib-state");
|
|
24
24
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
25
25
|
let _adobe_aio_commerce_lib_auth = require("@adobe/aio-commerce-lib-auth");
|
|
26
|
+
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
26
27
|
let valibot = require("valibot");
|
|
27
28
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
28
29
|
let safe_stable_stringify = require("safe-stable-stringify");
|
|
@@ -384,6 +385,8 @@ const AppDataSchema = valibot.object({
|
|
|
384
385
|
*/
|
|
385
386
|
const LifecycleRequestContextSchema = valibot.object({
|
|
386
387
|
appData: AppDataSchema,
|
|
388
|
+
commerceBaseUrl: valibot.nullish(valibot.pipe(valibot.string(), valibot.url("The 'commerceBaseUrl' field must be a valid absolute URL (e.g., 'https://my-store.example.com')"))),
|
|
389
|
+
commerceEnv: valibot.nullish(_adobe_aio_commerce_lib_core_commerce.CommerceEnvSchema),
|
|
387
390
|
installedState: valibot.optional(valibot.literal("business-config-only")),
|
|
388
391
|
installedVersion: valibot.optional(valibot.string()),
|
|
389
392
|
ioEventsEnv: valibot.string(),
|
|
@@ -1028,20 +1031,36 @@ const DEFAULT_ACTION_NAME = "app-management/installation";
|
|
|
1028
1031
|
const CUSTOM_INSTALLATION_STEPS_PATH = ["installation", "customInstallationSteps"];
|
|
1029
1032
|
/**
|
|
1030
1033
|
* Merges the runtime params with the request body and the Commerce instance the app is
|
|
1031
|
-
* associated with. Returns `null` when the app
|
|
1034
|
+
* associated with. Returns `null` when the app has no Commerce instance to use.
|
|
1035
|
+
*
|
|
1036
|
+
* An uninstall without an association record uses the Commerce instance of the request body and
|
|
1037
|
+
* returns it as `commerceFromBody`. Any other operation needs the record.
|
|
1032
1038
|
*/
|
|
1033
|
-
async function resolveWorkflowParams(body, rawParams) {
|
|
1039
|
+
async function resolveWorkflowParams(body, rawParams, operation) {
|
|
1034
1040
|
const association = await require_repository.getAssociationData();
|
|
1035
|
-
|
|
1041
|
+
const commerceFromBody = !association && operation === "uninstall" ? getBodyCommerce(body) : null;
|
|
1042
|
+
const commerce = association?.commerce ?? commerceFromBody;
|
|
1043
|
+
if (!commerce) return null;
|
|
1036
1044
|
return {
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1045
|
+
commerceFromBody,
|
|
1046
|
+
params: {
|
|
1047
|
+
...rawParams,
|
|
1048
|
+
AIO_COMMERCE_API_BASE_URL: commerce.baseUrl,
|
|
1049
|
+
AIO_COMMERCE_API_FLAVOR: commerce.env,
|
|
1050
|
+
AIO_COMMERCE_AUTH_IMS_ENVIRONMENT: body.ioEventsEnv,
|
|
1051
|
+
AIO_EVENTS_API_BASE_URL: body.ioEventsUrl,
|
|
1052
|
+
appData: body.appData
|
|
1053
|
+
}
|
|
1043
1054
|
};
|
|
1044
1055
|
}
|
|
1056
|
+
/** The Commerce instance the request body names, or `null` when it lacks the URL or the env. */
|
|
1057
|
+
function getBodyCommerce(body) {
|
|
1058
|
+
const { commerceBaseUrl, commerceEnv } = body;
|
|
1059
|
+
return commerceBaseUrl && commerceEnv ? {
|
|
1060
|
+
baseUrl: commerceBaseUrl,
|
|
1061
|
+
env: commerceEnv
|
|
1062
|
+
} : null;
|
|
1063
|
+
}
|
|
1045
1064
|
/** The response for a request on an app that is not associated with a Commerce instance. */
|
|
1046
1065
|
function notAssociatedConflict() {
|
|
1047
1066
|
return (0, _adobe_aio_commerce_lib_core_responses.conflict)({ body: {
|
|
@@ -1858,16 +1877,18 @@ async function persistDispatchFailure(stateStore, attempt, error, logger) {
|
|
|
1858
1877
|
|
|
1859
1878
|
// source/actions/installation/plan.ts
|
|
1860
1879
|
/**
|
|
1861
|
-
* Checks what every planning request needs (the action version, the app config and
|
|
1862
|
-
*
|
|
1880
|
+
* Checks what every planning request needs (the action version, the app config and a Commerce
|
|
1881
|
+
* instance) and creates the lifecycle runtime. `operation` is the operation the request is for,
|
|
1882
|
+
* when it is known before the state is read.
|
|
1863
1883
|
*/
|
|
1864
|
-
async function prepareRequest({ body, logger, rawParams }) {
|
|
1884
|
+
async function prepareRequest({ body, logger, rawParams }, operation) {
|
|
1865
1885
|
const actionVersion = process.env.__OW_ACTION_VERSION;
|
|
1866
1886
|
if (!actionVersion) return rejected((0, _adobe_aio_commerce_lib_core_responses.internalServerError)("The OpenWhisk action version is required to plan a lifecycle operation"));
|
|
1867
1887
|
const rawAppConfig = rawParams.appConfig;
|
|
1868
1888
|
if (!rawAppConfig) return rejected((0, _adobe_aio_commerce_lib_core_responses.internalServerError)("The app config is missing. Does the action receive it as a parameter?"));
|
|
1869
|
-
const
|
|
1870
|
-
if (!
|
|
1889
|
+
const resolved = await resolveWorkflowParams(body, rawParams, operation);
|
|
1890
|
+
if (!resolved) return rejected(notAssociatedConflict());
|
|
1891
|
+
const { commerceFromBody, params } = resolved;
|
|
1871
1892
|
logger.debug(`Lifecycle request for app "${body.appData.projectName}" (workspace: "${body.appData.workspaceName}", commerce: "${params.AIO_COMMERCE_API_BASE_URL}")`);
|
|
1872
1893
|
const appConfig = require_validate.validateCommerceAppConfig(rawAppConfig);
|
|
1873
1894
|
const runtime = await createLifecycleRuntime(params, appConfig, logger);
|
|
@@ -1891,6 +1912,7 @@ async function prepareRequest({ body, logger, rawParams }) {
|
|
|
1891
1912
|
appConfig,
|
|
1892
1913
|
baseline,
|
|
1893
1914
|
businessConfigOnlyVersion: body.installedState === "business-config-only" && body.installedVersion ? body.installedVersion : null,
|
|
1915
|
+
commerceFromBody,
|
|
1894
1916
|
isBaselineMissing,
|
|
1895
1917
|
latestAttempt: state?.latestAttempt ?? null,
|
|
1896
1918
|
params,
|
|
@@ -1903,7 +1925,7 @@ async function prepareRequest({ body, logger, rawParams }) {
|
|
|
1903
1925
|
* the plan's issues as a validation result, and the plan, whose `id` starts it.
|
|
1904
1926
|
*/
|
|
1905
1927
|
async function planRequestedOperation(args) {
|
|
1906
|
-
const prepared = await prepareRequest(args);
|
|
1928
|
+
const prepared = await prepareRequest(args, args.body.operation);
|
|
1907
1929
|
if (prepared.kind === "rejected") return prepared.response;
|
|
1908
1930
|
const { request } = prepared;
|
|
1909
1931
|
const resolved = await resolveOperation(request, args.body.operation);
|
|
@@ -2067,8 +2089,8 @@ const StatusQuerySchema = valibot.object({
|
|
|
2067
2089
|
async function startPlannedRequest(args) {
|
|
2068
2090
|
const { planId } = args.body;
|
|
2069
2091
|
if (!planId) return (0, _adobe_aio_commerce_lib_core_responses.badRequest)("A lifecycle operation starts from a plan. Call POST /plan and pass the planId it returns.");
|
|
2070
|
-
const prepared = await prepareRequest(args);
|
|
2071
2092
|
const { logger } = args;
|
|
2093
|
+
const prepared = await prepareRequest(args, await getPendingPlanOperation(planId));
|
|
2072
2094
|
if (prepared.kind === "rejected") return prepared.response;
|
|
2073
2095
|
const { request } = prepared;
|
|
2074
2096
|
const { stateStore } = request.runtime;
|
|
@@ -2104,6 +2126,7 @@ async function startPlannedRequest(args) {
|
|
|
2104
2126
|
runtime: request.runtime
|
|
2105
2127
|
});
|
|
2106
2128
|
if (planned.kind === "rejected") return planned.response;
|
|
2129
|
+
await backfillAssociation(request.commerceFromBody, logger);
|
|
2107
2130
|
return startPlannedOperation({
|
|
2108
2131
|
actionVersion: request.actionVersion,
|
|
2109
2132
|
logger,
|
|
@@ -2113,6 +2136,23 @@ async function startPlannedRequest(args) {
|
|
|
2113
2136
|
});
|
|
2114
2137
|
}
|
|
2115
2138
|
/**
|
|
2139
|
+
* Stores the Commerce instance of the request as the association record, unless a record exists.
|
|
2140
|
+
* Does nothing when the request did not supply the instance.
|
|
2141
|
+
*/
|
|
2142
|
+
async function backfillAssociation(commerce, logger) {
|
|
2143
|
+
if (!commerce) return;
|
|
2144
|
+
if (await require_repository.getAssociationData()) return;
|
|
2145
|
+
await require_repository.setAssociationData({ commerce });
|
|
2146
|
+
logger.info(`Stored the Commerce instance "${commerce.baseUrl}" of the request as the association record.`);
|
|
2147
|
+
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Reads the operation of the pending plan, or `undefined` when `planId` is not the pending plan.
|
|
2150
|
+
*/
|
|
2151
|
+
async function getPendingPlanOperation(planId) {
|
|
2152
|
+
const pendingPlan = (await (await createOrchestrationStateStore()).get(CURRENT_STATE_KEY))?.pendingPlan;
|
|
2153
|
+
return pendingPlan?.id === planId ? pendingPlan.operation : void 0;
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2116
2156
|
* Stores the baseline of an app installed with only business configuration: the target config
|
|
2117
2157
|
* without what needs installation, at the installed version, with no installed data.
|
|
2118
2158
|
*/
|
|
@@ -2141,7 +2181,7 @@ async function writeBusinessConfigOnlyBaseline({ appConfig, runtime }, state, in
|
|
|
2141
2181
|
* - POST /plan Plan an install, upgrade or uninstall for review
|
|
2142
2182
|
* - POST /execution Execute a started lifecycle attempt (internal, called async)
|
|
2143
2183
|
*/
|
|
2144
|
-
const router = new
|
|
2184
|
+
const router = new require_version.HttpActionRouter({ headers: require_version.SDK_LIB_VERSIONS_HEADERS }).use(require_version.logger({ name: () => "installation" }));
|
|
2145
2185
|
/**
|
|
2146
2186
|
* GET / - Get the status of the latest lifecycle operation. Falls back to the record of an
|
|
2147
2187
|
* installation made by an older library version.
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "../../index-
|
|
16
|
-
import {
|
|
17
|
-
import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-
|
|
15
|
+
import "../../index-vAue-u_y.cjs";
|
|
16
|
+
import { it as LifecycleContext } from "../../index-B9MUZY-U.cjs";
|
|
17
|
+
import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-DREvtzyX.cjs";
|
|
18
|
+
import "../../types-DslZGym8.cjs";
|
|
18
19
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
19
20
|
/** Loads generated custom installation script modules. */
|
|
20
21
|
type CustomScriptsLoader = (config: CommerceAppConfigOutputModel, logger: LifecycleContext["logger"]) => Record<string, unknown>;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
const require_rolldown_runtime = require("../../rolldown-runtime-CoOt0iuZ.cjs");
|
|
17
|
-
const
|
|
17
|
+
const require_version = require("../../version-BACmFGD2.cjs");
|
|
18
18
|
const require_logging = require("../../logging-Emi7P923.cjs");
|
|
19
19
|
const require_constants = require("../../constants-CgeVvu6f.cjs");
|
|
20
20
|
const require_schemas = require("../../schemas-B6ITl1bG.cjs");
|
|
@@ -53,7 +53,7 @@ const SyncCommerceScopesBodySchema = valibot.object({
|
|
|
53
53
|
* - POST /commerce Sync commerce scopes
|
|
54
54
|
* - DELETE /commerce Unsync commerce scopes
|
|
55
55
|
*/
|
|
56
|
-
const router = new
|
|
56
|
+
const router = new require_version.HttpActionRouter({ headers: require_version.SDK_LIB_VERSIONS_HEADERS }).use(require_version.logger({ name: () => "scope-tree" }));
|
|
57
57
|
/** GET / - Get scope tree */
|
|
58
58
|
router.get("/", { handler: async (_req, ctx) => {
|
|
59
59
|
const { logger } = ctx;
|