@adobe/aio-commerce-lib-app 1.0.2 → 1.2.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.
- package/CHANGELOG.md +38 -0
- package/dist/cjs/actions/app-config.cjs +18 -4
- package/dist/cjs/actions/app-config.d.cts +17 -3
- package/dist/cjs/actions/config.cjs +17 -3
- package/dist/cjs/actions/config.d.cts +16 -2
- package/dist/cjs/actions/installation.cjs +70 -16
- package/dist/cjs/actions/installation.d.cts +18 -4
- package/dist/cjs/actions/scope-tree.cjs +17 -3
- package/dist/cjs/actions/scope-tree.d.cts +17 -3
- package/dist/cjs/{app-DWX5-Hsf.d.cts → app-DcQMhW2N.d.cts} +159 -2
- package/dist/cjs/commands/index.cjs +41 -27
- package/dist/cjs/commands/index.d.cts +14 -0
- package/dist/cjs/config/index.cjs +27 -12
- package/dist/cjs/config/index.d.cts +614 -6
- package/dist/cjs/{parser-BPpg_9QB.cjs → config-BppBKCFj.cjs} +17 -3
- package/dist/cjs/error-Dn7ool6k.cjs +38 -0
- package/dist/{es/runner-BD-lItnK.d.mts → cjs/index-DZxladgt.d.cts} +122 -9
- package/dist/cjs/logging-4s36JTiN.cjs +39 -0
- package/dist/cjs/management/index.cjs +23 -8
- package/dist/cjs/management/index.d.cts +16 -2
- package/dist/cjs/{runner-NHMvoMO2.cjs → management-iLQubQ7K.cjs} +462 -48
- package/dist/cjs/{router-DCw7oEQ9.cjs → router-KeQRduO3.cjs} +15 -1
- package/dist/cjs/{schemas-CZ6c8Id9.cjs → schemas-nkIxa8sL.cjs} +34 -0
- package/dist/cjs/{validate-Btzn9ilZ.cjs → validate-CeUCT_7k.cjs} +36 -15
- package/dist/cjs/{installation-CLbceU9F.cjs → webhooks-CLtDxwMa.cjs} +138 -1
- package/dist/es/actions/app-config.d.mts +17 -3
- package/dist/es/actions/app-config.mjs +17 -3
- package/dist/es/actions/config.d.mts +16 -2
- package/dist/es/actions/config.mjs +17 -3
- package/dist/es/actions/installation.d.mts +18 -4
- package/dist/es/actions/installation.mjs +64 -10
- package/dist/es/actions/scope-tree.d.mts +17 -3
- package/dist/es/actions/scope-tree.mjs +17 -3
- package/dist/es/{app-BAiyvNo2.d.mts → app-DJr-mN9d.d.mts} +159 -2
- package/dist/es/commands/index.d.mts +14 -0
- package/dist/es/commands/index.mjs +21 -7
- package/dist/es/config/index.d.mts +614 -6
- package/dist/es/config/index.mjs +18 -4
- package/dist/es/{parser-CQZTVG6i.mjs → config-BohwKkQS.mjs} +16 -2
- package/dist/es/error-DHlYzkbb.mjs +32 -0
- package/dist/{cjs/runner-DemKouFJ.d.cts → es/index-BmYXe7kp.d.mts} +122 -9
- package/dist/es/logging-XIUXDK5T.mjs +32 -0
- package/dist/es/management/index.d.mts +16 -2
- package/dist/es/management/index.mjs +16 -2
- package/dist/es/{runner-vwAhjD5r.mjs → management-DSexEPTW.mjs} +451 -43
- package/dist/es/{router-CJ4VWoCt.mjs → router-BxaxEEu3.mjs} +14 -0
- package/dist/es/{schemas-B8yIv0_b.mjs → schemas-CVXHgUhv.mjs} +29 -1
- package/dist/es/{validate-DKnju9-R.mjs → validate-CqJdGzyZ.mjs} +27 -6
- package/dist/es/{installation-BTL9X7iv.mjs → webhooks-CYo-pqbR.mjs} +115 -2
- package/package.json +12 -8
- package/dist/cjs/error-DJ2UAPH2.cjs +0 -24
- package/dist/cjs/logging-IDRQG0as.cjs +0 -25
- package/dist/es/error-CMV3IjBz.mjs +0 -18
- package/dist/es/logging-CzmXDzxI.mjs +0 -18
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const require_schemas = require('./schemas-nkIxa8sL.cjs');
|
|
2
16
|
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
3
17
|
let _adobe_aio_lib_core_logging = require("@adobe/aio-lib-core-logging");
|
|
4
18
|
_adobe_aio_lib_core_logging = require_schemas.__toESM(_adobe_aio_lib_core_logging);
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
1
15
|
//#region \0rolldown/runtime.js
|
|
2
16
|
var __create = Object.create;
|
|
3
17
|
var __defProp = Object.defineProperty;
|
|
@@ -35,6 +49,20 @@ const ALPHANUMERIC_OR_HYPHEN_REGEX = {
|
|
|
35
49
|
uppercase: /^[A-Z0-9-]+$/
|
|
36
50
|
};
|
|
37
51
|
/**
|
|
52
|
+
* A schema for a number value.
|
|
53
|
+
* @param name The name of the field this schema refers to.
|
|
54
|
+
*/
|
|
55
|
+
function numberValueSchema(name) {
|
|
56
|
+
return valibot.number(`Expected a number value for '${name}'`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A schema for a positive number value (including zero).
|
|
60
|
+
* @param name The name of the field this schema refers to.
|
|
61
|
+
*/
|
|
62
|
+
function positiveNumberValueSchema(name) {
|
|
63
|
+
return valibot.pipe(numberValueSchema(name), valibot.minValue(0, `The value of ${name} must be a non-negative number`));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
38
66
|
* A schema for a string value.
|
|
39
67
|
* @param name The name of the field this schema refers to.
|
|
40
68
|
*/
|
|
@@ -90,6 +118,12 @@ Object.defineProperty(exports, 'nonEmptyStringValueSchema', {
|
|
|
90
118
|
return nonEmptyStringValueSchema;
|
|
91
119
|
}
|
|
92
120
|
});
|
|
121
|
+
Object.defineProperty(exports, 'positiveNumberValueSchema', {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return positiveNumberValueSchema;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
93
127
|
Object.defineProperty(exports, 'stringValueSchema', {
|
|
94
128
|
enumerable: true,
|
|
95
129
|
get: function () {
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const require_schemas = require('./schemas-nkIxa8sL.cjs');
|
|
16
|
+
const require_webhooks = require('./webhooks-CLtDxwMa.cjs');
|
|
3
17
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
4
18
|
let valibot = require("valibot");
|
|
5
19
|
valibot = require_schemas.__toESM(valibot);
|
|
@@ -23,6 +37,7 @@ function hasBusinessConfigSchema(config) {
|
|
|
23
37
|
|
|
24
38
|
//#endregion
|
|
25
39
|
//#region source/config/schema/metadata.ts
|
|
40
|
+
const MAX_ID_LENGTH = 100;
|
|
26
41
|
const MAX_DESCRIPTION_LENGTH = 255;
|
|
27
42
|
const MAX_DISPLAY_NAME_LENGTH = 50;
|
|
28
43
|
const NUMERIC_IDENTIFIER = "(0|[1-9]\\d*)";
|
|
@@ -32,10 +47,10 @@ function nonEmptyString(fieldName) {
|
|
|
32
47
|
}
|
|
33
48
|
/** The schema for the metadata of the application. */
|
|
34
49
|
const MetadataSchema = valibot.object({
|
|
35
|
-
id: require_schemas.alphaNumericOrHyphenSchema("application id (metadata.id)"),
|
|
50
|
+
id: valibot.pipe(require_schemas.alphaNumericOrHyphenSchema("application id (metadata.id)"), valibot.maxLength(MAX_ID_LENGTH, `The application id must not be longer than ${MAX_ID_LENGTH} characters`)),
|
|
36
51
|
displayName: valibot.pipe(nonEmptyString("application display name"), valibot.maxLength(MAX_DISPLAY_NAME_LENGTH, `The application display name must not be longer than ${MAX_DISPLAY_NAME_LENGTH} characters`)),
|
|
37
52
|
description: valibot.pipe(nonEmptyString("metadata description"), valibot.maxLength(MAX_DESCRIPTION_LENGTH, `The metadata description must not be longer than ${MAX_DESCRIPTION_LENGTH} characters`)),
|
|
38
|
-
version: valibot.pipe(nonEmptyString("version"), valibot.regex(SEMVER_REGEX, "The version must follow semantic versioning (semver) format"))
|
|
53
|
+
version: valibot.pipe(nonEmptyString("version"), valibot.regex(SEMVER_REGEX, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')"))
|
|
39
54
|
});
|
|
40
55
|
/**
|
|
41
56
|
* Check if config has metadata.
|
|
@@ -52,8 +67,10 @@ function hasMetadata(config) {
|
|
|
52
67
|
const CommerceAppConfigSchema = valibot.looseObject({
|
|
53
68
|
metadata: MetadataSchema,
|
|
54
69
|
businessConfig: valibot.optional(_adobe_aio_commerce_lib_config.SchemaBusinessConfig),
|
|
55
|
-
eventing: valibot.optional(
|
|
56
|
-
|
|
70
|
+
eventing: valibot.optional(require_webhooks.EventingSchema),
|
|
71
|
+
adminUiSdk: valibot.optional(require_webhooks.AdminUiSdkSchema),
|
|
72
|
+
installation: valibot.optional(require_webhooks.InstallationSchema),
|
|
73
|
+
webhooks: valibot.optional(require_webhooks.WebhooksSchema)
|
|
57
74
|
});
|
|
58
75
|
|
|
59
76
|
//#endregion
|
|
@@ -62,29 +79,33 @@ const CommerceAppConfigSchema = valibot.looseObject({
|
|
|
62
79
|
const CommerceAppConfigSchemas = {
|
|
63
80
|
metadata: MetadataSchema,
|
|
64
81
|
businessConfig: _adobe_aio_commerce_lib_config.SchemaBusinessConfig,
|
|
65
|
-
eventing:
|
|
66
|
-
installation:
|
|
82
|
+
eventing: require_webhooks.EventingSchema,
|
|
83
|
+
installation: require_webhooks.InstallationSchema,
|
|
84
|
+
webhooks: require_webhooks.WebhooksSchema,
|
|
67
85
|
"businessConfig.schema": valibot.unwrap(_adobe_aio_commerce_lib_config.SchemaBusinessConfig.entries.schema),
|
|
68
|
-
"eventing.commerce": valibot.unwrap(
|
|
69
|
-
"eventing.external": valibot.unwrap(
|
|
70
|
-
"installation.customInstallationSteps": valibot.unwrap(
|
|
86
|
+
"eventing.commerce": valibot.unwrap(require_webhooks.EventingSchema.entries.commerce),
|
|
87
|
+
"eventing.external": valibot.unwrap(require_webhooks.EventingSchema.entries.external),
|
|
88
|
+
"installation.customInstallationSteps": valibot.unwrap(require_webhooks.InstallationSchema.entries.customInstallationSteps),
|
|
89
|
+
adminUiSdk: require_webhooks.AdminUiSdkSchema
|
|
71
90
|
};
|
|
72
91
|
/**
|
|
73
92
|
* Get the config domains that are present in the config.
|
|
74
93
|
* @param config - The configuration to check.
|
|
75
94
|
*/
|
|
76
95
|
function getConfigDomains(config) {
|
|
77
|
-
const withCommerceEvents =
|
|
78
|
-
const withExternalEvents =
|
|
96
|
+
const withCommerceEvents = require_webhooks.hasCommerceEvents(config);
|
|
97
|
+
const withExternalEvents = require_webhooks.hasExternalEvents(config);
|
|
79
98
|
const domains = {
|
|
80
99
|
metadata: hasMetadata(config),
|
|
81
100
|
businessConfig: hasBusinessConfig(config),
|
|
82
101
|
eventing: withCommerceEvents || withExternalEvents,
|
|
83
|
-
installation:
|
|
102
|
+
installation: require_webhooks.hasCustomInstallation(config),
|
|
103
|
+
webhooks: require_webhooks.hasWebhooks(config),
|
|
104
|
+
adminUiSdk: require_webhooks.hasAdminUiSdk(config),
|
|
84
105
|
"businessConfig.schema": hasBusinessConfigSchema(config),
|
|
85
106
|
"eventing.commerce": withCommerceEvents,
|
|
86
107
|
"eventing.external": withExternalEvents,
|
|
87
|
-
"installation.customInstallationSteps":
|
|
108
|
+
"installation.customInstallationSteps": require_webhooks.hasCustomInstallationSteps(config)
|
|
88
109
|
};
|
|
89
110
|
const domainsList = Object.entries(domains).filter(([_, value]) => value).map(([key]) => key);
|
|
90
111
|
return new Set(domainsList);
|
|
@@ -1,7 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const require_schemas = require('./schemas-nkIxa8sL.cjs');
|
|
2
16
|
let valibot = require("valibot");
|
|
3
17
|
valibot = require_schemas.__toESM(valibot);
|
|
4
18
|
|
|
19
|
+
//#region source/config/schema/admin-ui-sdk.ts
|
|
20
|
+
/**
|
|
21
|
+
* Schema for the Admin UI SDK registration parameters (for the `adminUiSdk.registration` config section).
|
|
22
|
+
* @see https://developer.adobe.com/commerce/extensibility/admin-ui-sdk/extension-points/ for more details.
|
|
23
|
+
*/
|
|
24
|
+
const AdminUiSdkRegistrationSchema = valibot.object({ menuItems: valibot.array(valibot.object({
|
|
25
|
+
id: valibot.string(),
|
|
26
|
+
title: valibot.optional(valibot.string()),
|
|
27
|
+
parent: valibot.optional(valibot.string()),
|
|
28
|
+
sortOrder: valibot.optional(valibot.number()),
|
|
29
|
+
sandbox: valibot.optional(valibot.string()),
|
|
30
|
+
isSection: valibot.optional(valibot.boolean())
|
|
31
|
+
})) });
|
|
32
|
+
/** Schema for Admin UI SDK configuration. */
|
|
33
|
+
const AdminUiSdkSchema = valibot.object({ registration: AdminUiSdkRegistrationSchema });
|
|
34
|
+
/** Check if config has Admin UI SDK registration configuration. */
|
|
35
|
+
function hasAdminUiSdk(config) {
|
|
36
|
+
return config.adminUiSdk !== void 0 && config.adminUiSdk.registration !== void 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
5
40
|
//#region source/config/schema/eventing.ts
|
|
6
41
|
const MAX_DESCRIPTION_LENGTH$1 = 255;
|
|
7
42
|
const MAX_LABEL_LENGTH = 100;
|
|
@@ -199,6 +234,90 @@ function hasCustomInstallationSteps(config) {
|
|
|
199
234
|
}
|
|
200
235
|
|
|
201
236
|
//#endregion
|
|
237
|
+
//#region source/config/schema/webhooks.ts
|
|
238
|
+
/** Schema for webhook field configuration (name and optional source). */
|
|
239
|
+
const WebhookFieldSchema = valibot.object({
|
|
240
|
+
name: require_schemas.nonEmptyStringValueSchema("field name"),
|
|
241
|
+
source: valibot.optional(require_schemas.stringValueSchema("field source"))
|
|
242
|
+
});
|
|
243
|
+
/** Schema for webhook rule configuration (field, operator, value). */
|
|
244
|
+
const WebhookRuleSchema = valibot.object({
|
|
245
|
+
field: require_schemas.nonEmptyStringValueSchema("rule field"),
|
|
246
|
+
operator: require_schemas.nonEmptyStringValueSchema("rule operator"),
|
|
247
|
+
value: require_schemas.nonEmptyStringValueSchema("rule value")
|
|
248
|
+
});
|
|
249
|
+
/** Schema for webhook header configuration (name, value). */
|
|
250
|
+
const WebhookHeaderSchema = valibot.object({
|
|
251
|
+
name: require_schemas.nonEmptyStringValueSchema("header name"),
|
|
252
|
+
value: require_schemas.nonEmptyStringValueSchema("header value")
|
|
253
|
+
});
|
|
254
|
+
/** batch_name and hook_name must contain only letters, numbers, and underscores. */
|
|
255
|
+
const WEBHOOK_IDENTIFIER_REGEX = /^[a-zA-Z0-9_]+$/;
|
|
256
|
+
/** Category for conflict detection: validation, append, or modification. */
|
|
257
|
+
const CATEGORIES = [
|
|
258
|
+
"validation",
|
|
259
|
+
"append",
|
|
260
|
+
"modification"
|
|
261
|
+
];
|
|
262
|
+
const CategorySchema = valibot.picklist(CATEGORIES, `Webhook category must be one of: ${CATEGORIES.join(", ")}`);
|
|
263
|
+
/** Schema for the nested webhook payload without url — used when runtimeAction resolves the URL at runtime. */
|
|
264
|
+
const WebhookDefinitionBaseSchema = valibot.object({
|
|
265
|
+
webhook_method: require_schemas.nonEmptyStringValueSchema("webhook_method"),
|
|
266
|
+
webhook_type: require_schemas.nonEmptyStringValueSchema("webhook_type"),
|
|
267
|
+
batch_name: valibot.pipe(require_schemas.nonEmptyStringValueSchema("batch_name"), valibot.regex(WEBHOOK_IDENTIFIER_REGEX, "batch_name must contain only letters, numbers, and underscores")),
|
|
268
|
+
batch_order: valibot.optional(require_schemas.positiveNumberValueSchema("batch_order")),
|
|
269
|
+
hook_name: valibot.pipe(require_schemas.nonEmptyStringValueSchema("hook_name"), valibot.regex(WEBHOOK_IDENTIFIER_REGEX, "hook_name must contain only letters, numbers, and underscores")),
|
|
270
|
+
priority: valibot.optional(require_schemas.positiveNumberValueSchema("priority")),
|
|
271
|
+
required: valibot.optional(require_schemas.booleanValueSchema("required")),
|
|
272
|
+
soft_timeout: valibot.optional(require_schemas.positiveNumberValueSchema("soft_timeout")),
|
|
273
|
+
timeout: valibot.optional(require_schemas.positiveNumberValueSchema("timeout")),
|
|
274
|
+
method: require_schemas.nonEmptyStringValueSchema("HTTP method"),
|
|
275
|
+
fallback_error_message: valibot.optional(require_schemas.stringValueSchema("fallback_error_message")),
|
|
276
|
+
ttl: valibot.optional(require_schemas.positiveNumberValueSchema("ttl")),
|
|
277
|
+
fields: valibot.optional(valibot.array(WebhookFieldSchema, "Expected an array of webhook field objects")),
|
|
278
|
+
rules: valibot.optional(valibot.array(WebhookRuleSchema, "Expected an array of webhook rule objects")),
|
|
279
|
+
headers: valibot.optional(valibot.array(WebhookHeaderSchema, "Expected an array of webhook header objects"))
|
|
280
|
+
});
|
|
281
|
+
/** Schema for the nested webhook payload with a required url. */
|
|
282
|
+
const WebhookDefinitionWithUrlSchema = valibot.object({
|
|
283
|
+
...WebhookDefinitionBaseSchema.entries,
|
|
284
|
+
url: valibot.pipe(require_schemas.stringValueSchema("webhook URL"), valibot.url("The 'url' field must be a valid absolute URL (e.g., 'https://example.com/webhook')"))
|
|
285
|
+
});
|
|
286
|
+
/** Schema for a webhook entry that resolves its URL from a runtime action. */
|
|
287
|
+
const WebhookEntryWithRuntimeActionSchema = valibot.object({
|
|
288
|
+
label: require_schemas.nonEmptyStringValueSchema("webhook label"),
|
|
289
|
+
description: require_schemas.nonEmptyStringValueSchema("webhook description"),
|
|
290
|
+
category: valibot.optional(CategorySchema),
|
|
291
|
+
runtimeAction: require_schemas.nonEmptyStringValueSchema("runtimeAction"),
|
|
292
|
+
requireAdobeAuth: valibot.optional(require_schemas.booleanValueSchema("requireAdobeAuth")),
|
|
293
|
+
webhook: WebhookDefinitionBaseSchema
|
|
294
|
+
});
|
|
295
|
+
/** Schema for a webhook entry that provides an explicit URL. */
|
|
296
|
+
const WebhookEntryWithUrlSchema = valibot.object({
|
|
297
|
+
label: require_schemas.nonEmptyStringValueSchema("webhook label"),
|
|
298
|
+
description: require_schemas.nonEmptyStringValueSchema("webhook description"),
|
|
299
|
+
category: valibot.optional(CategorySchema),
|
|
300
|
+
webhook: WebhookDefinitionWithUrlSchema
|
|
301
|
+
});
|
|
302
|
+
/** Schema for a single webhook entry — either runtimeAction (no url) or explicit url (no runtimeAction). */
|
|
303
|
+
const WebhookEntrySchema = valibot.union([WebhookEntryWithRuntimeActionSchema, WebhookEntryWithUrlSchema], "Each webhook entry must define either a 'runtimeAction' (to resolve the URL from a runtime action) or an explicit 'url' inside the 'webhook' object, but not both");
|
|
304
|
+
/** Schema for the optional webhooks array (when present, must have at least one item). */
|
|
305
|
+
const WebhooksSchema = valibot.optional(valibot.pipe(valibot.array(WebhookEntrySchema, "Expected an array of webhook entries"), valibot.minLength(1, "webhooks array must contain at least one webhook when present")));
|
|
306
|
+
/**
|
|
307
|
+
* Check if config has webhooks (non-empty array).
|
|
308
|
+
* @param config - The configuration to check.
|
|
309
|
+
*/
|
|
310
|
+
function hasWebhooks(config) {
|
|
311
|
+
return Array.isArray(config?.webhooks) && config.webhooks.length > 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
//#endregion
|
|
315
|
+
Object.defineProperty(exports, 'AdminUiSdkSchema', {
|
|
316
|
+
enumerable: true,
|
|
317
|
+
get: function () {
|
|
318
|
+
return AdminUiSdkSchema;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
202
321
|
Object.defineProperty(exports, 'EventingSchema', {
|
|
203
322
|
enumerable: true,
|
|
204
323
|
get: function () {
|
|
@@ -211,6 +330,18 @@ Object.defineProperty(exports, 'InstallationSchema', {
|
|
|
211
330
|
return InstallationSchema;
|
|
212
331
|
}
|
|
213
332
|
});
|
|
333
|
+
Object.defineProperty(exports, 'WebhooksSchema', {
|
|
334
|
+
enumerable: true,
|
|
335
|
+
get: function () {
|
|
336
|
+
return WebhooksSchema;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
Object.defineProperty(exports, 'hasAdminUiSdk', {
|
|
340
|
+
enumerable: true,
|
|
341
|
+
get: function () {
|
|
342
|
+
return hasAdminUiSdk;
|
|
343
|
+
}
|
|
344
|
+
});
|
|
214
345
|
Object.defineProperty(exports, 'hasCommerceEvents', {
|
|
215
346
|
enumerable: true,
|
|
216
347
|
get: function () {
|
|
@@ -240,4 +371,10 @@ Object.defineProperty(exports, 'hasExternalEvents', {
|
|
|
240
371
|
get: function () {
|
|
241
372
|
return hasExternalEvents;
|
|
242
373
|
}
|
|
374
|
+
});
|
|
375
|
+
Object.defineProperty(exports, 'hasWebhooks', {
|
|
376
|
+
enumerable: true,
|
|
377
|
+
get: function () {
|
|
378
|
+
return hasWebhooks;
|
|
379
|
+
}
|
|
243
380
|
});
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { n as CommerceAppConfigOutputModel } from "../app-DJr-mN9d.mjs";
|
|
16
|
+
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
3
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
4
18
|
|
|
5
19
|
//#region source/actions/app-config.d.ts
|
|
@@ -10,6 +24,6 @@ type RuntimeActionFactoryArgs = {
|
|
|
10
24
|
/** Factory to create the route handler for the `app-config` action. */
|
|
11
25
|
declare const appConfigRuntimeAction: ({
|
|
12
26
|
appConfig
|
|
13
|
-
}: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
27
|
+
}: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
14
28
|
//#endregion
|
|
15
29
|
export { appConfigRuntimeAction };
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
+
import { t as validateCommerceAppConfig } from "../validate-CqJdGzyZ.mjs";
|
|
3
17
|
import { ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
4
18
|
|
|
5
19
|
//#region source/actions/app-config.ts
|
|
6
20
|
/** Router for the app config actions. */
|
|
7
|
-
const router = new HttpActionRouter().use(logger({ name: () => "
|
|
21
|
+
const router = new HttpActionRouter().use(logger({ name: () => "app-config" }));
|
|
8
22
|
/** GET / - Get app config */
|
|
9
23
|
router.get("/", { handler: async (_req, { logger, rawParams }) => {
|
|
10
24
|
logger.debug("Validating app config...");
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
2
16
|
import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
3
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
4
18
|
|
|
@@ -10,6 +24,6 @@ type ConfigActionFactoryArgs = {
|
|
|
10
24
|
/** Factory to create the route handler for the `config` action. */
|
|
11
25
|
declare const configRuntimeAction: ({
|
|
12
26
|
configSchema
|
|
13
|
-
}: ConfigActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
27
|
+
}: ConfigActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
14
28
|
//#endregion
|
|
15
29
|
export { configRuntimeAction };
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
+
import { n as validateCommerceAppConfigDomain } from "../validate-CqJdGzyZ.mjs";
|
|
17
|
+
import { r as nonEmptyStringValueSchema } from "../schemas-CVXHgUhv.mjs";
|
|
4
18
|
import { ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
5
19
|
import * as v from "valibot";
|
|
6
20
|
import { byScopeId, getConfiguration, initialize, setConfiguration } from "@adobe/aio-commerce-lib-config";
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { n as CommerceAppConfigOutputModel } from "../app-DJr-mN9d.mjs";
|
|
16
|
+
import { V as InstallationContext } from "../index-BmYXe7kp.mjs";
|
|
17
|
+
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
4
18
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
5
19
|
|
|
6
20
|
//#region source/actions/installation.d.ts
|
|
@@ -14,6 +28,6 @@ type RuntimeActionFactoryArgs = {
|
|
|
14
28
|
declare const installationRuntimeAction: ({
|
|
15
29
|
appConfig,
|
|
16
30
|
customScriptsLoader
|
|
17
|
-
}: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
31
|
+
}: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
18
32
|
//#endregion
|
|
19
33
|
export { installationRuntimeAction };
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
+
import { r as nonEmptyStringValueSchema } from "../schemas-CVXHgUhv.mjs";
|
|
17
|
+
import { a as isCompletedState, c as isSucceededState, n as runInstallation, o as isFailedState, r as runValidation, s as isInProgressState, t as createInitialInstallationState } from "../management-DSexEPTW.mjs";
|
|
4
18
|
import { accepted, badRequest, conflict, internalServerError, noContent, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
5
19
|
import * as v from "valibot";
|
|
6
20
|
import { object, string } from "valibot";
|
|
@@ -244,6 +258,14 @@ const AppDataSchema = v.object({
|
|
|
244
258
|
//#endregion
|
|
245
259
|
//#region source/actions/installation.ts
|
|
246
260
|
const DEFAULT_ACTION_NAME = "app-management/installation";
|
|
261
|
+
/** Request body schema shared by POST / and POST /validation. */
|
|
262
|
+
const InstallationRequestBodySchema = object({
|
|
263
|
+
appData: AppDataSchema,
|
|
264
|
+
commerceBaseUrl: string(),
|
|
265
|
+
commerceEnv: string(),
|
|
266
|
+
ioEventsUrl: string(),
|
|
267
|
+
ioEventsEnv: string()
|
|
268
|
+
});
|
|
247
269
|
/** Creates an installation state store using lib-core combined storage. */
|
|
248
270
|
function createInstallationStore() {
|
|
249
271
|
return createCombinedStore({
|
|
@@ -311,13 +333,7 @@ router.get("/", { handler: async (_req, { logger }) => {
|
|
|
311
333
|
* 3. If not found or failed: create plan, invoke execution async, return 202 Accepted
|
|
312
334
|
*/
|
|
313
335
|
router.post("/", {
|
|
314
|
-
body:
|
|
315
|
-
appData: AppDataSchema,
|
|
316
|
-
commerceBaseUrl: string(),
|
|
317
|
-
commerceEnv: string(),
|
|
318
|
-
ioEventsUrl: string(),
|
|
319
|
-
ioEventsEnv: string()
|
|
320
|
-
}),
|
|
336
|
+
body: InstallationRequestBodySchema,
|
|
321
337
|
handler: async (req, { logger, rawParams }) => {
|
|
322
338
|
logger.debug("Starting installation...");
|
|
323
339
|
const store = await createInstallationStore();
|
|
@@ -399,6 +415,44 @@ router.post("/execution", { handler: async (_req, { logger, rawParams }) => {
|
|
|
399
415
|
return ok({ body: result });
|
|
400
416
|
} });
|
|
401
417
|
/**
|
|
418
|
+
* POST /installation/validation - Pre-installation validation
|
|
419
|
+
*
|
|
420
|
+
* Synchronously validates the step tree before installation begins.
|
|
421
|
+
* Accepts the same request body as POST / (installation start) so the
|
|
422
|
+
* frontend can reuse the same parameters without any extra mapping.
|
|
423
|
+
*
|
|
424
|
+
* Flow:
|
|
425
|
+
* 1. Build a ValidationContext from the request parameters
|
|
426
|
+
* 2. Call runValidation() — traverses the step tree and collects issues
|
|
427
|
+
* 3. Return the structured ValidationResult immediately (no async invoke)
|
|
428
|
+
*/
|
|
429
|
+
router.post("/validation", {
|
|
430
|
+
body: InstallationRequestBodySchema,
|
|
431
|
+
handler: async (req, { logger, rawParams }) => {
|
|
432
|
+
logger.debug("Running pre-installation validation...");
|
|
433
|
+
const appConfig = rawParams.appConfig;
|
|
434
|
+
if (!appConfig) return internalServerError("Could not find or parse the app.commerce.manifest.json file, is it present and valid?");
|
|
435
|
+
const { appData, ...params } = {
|
|
436
|
+
...rawParams,
|
|
437
|
+
appData: req.body.appData,
|
|
438
|
+
AIO_EVENTS_API_BASE_URL: req.body.ioEventsUrl,
|
|
439
|
+
AIO_COMMERCE_AUTH_IMS_ENVIRONMENT: req.body.ioEventsEnv,
|
|
440
|
+
AIO_COMMERCE_API_BASE_URL: req.body.commerceBaseUrl,
|
|
441
|
+
AIO_COMMERCE_API_FLAVOR: req.body.commerceEnv
|
|
442
|
+
};
|
|
443
|
+
const result = await runValidation({
|
|
444
|
+
validationContext: {
|
|
445
|
+
appData,
|
|
446
|
+
params,
|
|
447
|
+
logger
|
|
448
|
+
},
|
|
449
|
+
config: appConfig
|
|
450
|
+
});
|
|
451
|
+
logger.debug(`Validation complete — valid: ${result.valid}, errors: ${result.summary.errors}, warnings: ${result.summary.warnings}`);
|
|
452
|
+
return ok({ body: result });
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
/**
|
|
402
456
|
* DELETE / - Clear installation state
|
|
403
457
|
*
|
|
404
458
|
* This endpoint allows clearing the installation state.
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
16
|
+
import * as _$_adobe_aio_commerce_lib_core_params0 from "@adobe/aio-commerce-lib-core/params";
|
|
3
17
|
|
|
4
18
|
//#region source/actions/scope-tree.d.ts
|
|
5
19
|
/** The handler method for the `scope-tree` action. */
|
|
6
|
-
declare const scopeTreeRuntimeAction: (args: _adobe_aio_commerce_lib_core_params0.RuntimeActionParams) => Promise<_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
20
|
+
declare const scopeTreeRuntimeAction: (args: _$_adobe_aio_commerce_lib_core_params0.RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
7
21
|
//#endregion
|
|
8
22
|
export { scopeTreeRuntimeAction };
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
+
import { r as nonEmptyStringValueSchema } from "../schemas-CVXHgUhv.mjs";
|
|
17
|
+
import { t as inspect } from "../logging-XIUXDK5T.mjs";
|
|
4
18
|
import { internalServerError, nonAuthoritativeInformation, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
5
19
|
import * as v from "valibot";
|
|
6
20
|
import { getScopeTree, setCustomScopeTree, syncCommerceScopes, unsyncCommerceScopes } from "@adobe/aio-commerce-lib-config";
|