@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,13 +12,13 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
16
|
-
const require_schemas = require("./schemas-
|
|
15
|
+
const require_rolldown_runtime = require("./rolldown-runtime-BKfnhsn2.cjs");
|
|
16
|
+
const require_schemas = require("./schemas-B-jCi6Oz.cjs");
|
|
17
17
|
let _adobe_aio_commerce_lib_core_commerce = require("@adobe/aio-commerce-lib-core/commerce");
|
|
18
18
|
let valibot = require("valibot");
|
|
19
|
-
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
20
19
|
let _adobe_aio_commerce_lib_admin_ui_api = require("@adobe/aio-commerce-lib-admin-ui/api");
|
|
21
20
|
let _adobe_aio_commerce_lib_admin_ui_menu = require("@adobe/aio-commerce-lib-admin-ui/menu");
|
|
21
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
22
22
|
|
|
23
23
|
// source/config/schema/admin-ui.ts
|
|
24
24
|
/**
|
|
@@ -35,9 +35,23 @@ const SANDBOX_PERMISSION_VALUES = [
|
|
|
35
35
|
"allow-modals",
|
|
36
36
|
"allow-popups"
|
|
37
37
|
];
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const ALLOW_PERMISSION_VALUES = ["autoplay", "microphone"];
|
|
39
|
+
/**
|
|
40
|
+
* Builds a schema for a non-empty, duplicate-free list of iframe permissions.
|
|
41
|
+
* @param field - The config field name, used in error messages.
|
|
42
|
+
* @param kind - The permission kind, used in error messages (e.g. `sandbox`).
|
|
43
|
+
* @param values - The accepted permission values.
|
|
44
|
+
*/
|
|
45
|
+
function permissionListSchema(field, kind, values) {
|
|
46
|
+
return valibot.pipe(valibot.array(valibot.picklist(values, `Invalid ${kind} permission. Accepted values are: ${values.join(", ")}`)), valibot.minLength(1, `${field} must contain at least one permission when it's defined`), valibot.check((permissions) => new Set(permissions).size === permissions.length, `Duplicate permissions are not allowed in ${field}`));
|
|
47
|
+
}
|
|
48
|
+
const SandboxPermissionsSchema = permissionListSchema("sandboxPermissions", "sandbox", SANDBOX_PERMISSION_VALUES);
|
|
49
|
+
const AllowPermissionsSchema = permissionListSchema("allow", "iframe allow", ALLOW_PERMISSION_VALUES);
|
|
50
|
+
/** Optional iframe permission fields shared by every iframe-based entry. */
|
|
51
|
+
const iframePermissionEntries = {
|
|
52
|
+
allow: valibot.optional(AllowPermissionsSchema),
|
|
53
|
+
sandboxPermissions: valibot.optional(SandboxPermissionsSchema)
|
|
54
|
+
};
|
|
41
55
|
const NotificationsSchema = valibot.object({
|
|
42
56
|
error: valibot.optional(require_schemas.nonEmptyStringValueSchema("error notification")),
|
|
43
57
|
success: valibot.optional(require_schemas.nonEmptyStringValueSchema("success notification"))
|
|
@@ -72,6 +86,28 @@ const GridColumnsSchema = valibot.object({
|
|
|
72
86
|
label: require_schemas.nonEmptyStringValueSchema("grid columns label"),
|
|
73
87
|
runtimeAction: require_schemas.nonEmptyStringValueSchema("runtime action")
|
|
74
88
|
});
|
|
89
|
+
const INVALID_ATTRIBUTE_CODE_PATTERN = /[^A-Za-z0-9_]/u;
|
|
90
|
+
const CustomAttributeFilterSchema = valibot.variant("type", [valibot.strictObject({ type: valibot.literal("boolean") }), valibot.strictObject({
|
|
91
|
+
conditions: valibot.pipe(valibot.array(valibot.picklist([
|
|
92
|
+
"eq",
|
|
93
|
+
"neq",
|
|
94
|
+
"contains"
|
|
95
|
+
])), valibot.minLength(1, "Text filters require at least one condition")),
|
|
96
|
+
type: valibot.literal("text")
|
|
97
|
+
})]);
|
|
98
|
+
const CustomAttributeGridColumnSchema = valibot.strictObject({
|
|
99
|
+
aclProtected: valibot.optional(valibot.boolean()),
|
|
100
|
+
align: ColumnAlignSchema,
|
|
101
|
+
attribute_code: valibot.pipe(require_schemas.nonEmptyStringValueSchema("custom attribute code"), valibot.maxLength(255, "Custom attribute codes must not exceed 255 characters"), valibot.check((code) => !INVALID_ATTRIBUTE_CODE_PATTERN.test(code), "Custom attribute codes may contain only ASCII letters, digits, and \"_\"")),
|
|
102
|
+
filter: valibot.optional(CustomAttributeFilterSchema),
|
|
103
|
+
id: valibot.pipe(require_schemas.nonEmptyStringValueSchema("column ID"), valibot.check((id) => id.trim().length > 0, "Column IDs must not be blank")),
|
|
104
|
+
label: valibot.pipe(require_schemas.nonEmptyStringValueSchema("column label"), valibot.check((label) => label.trim().length > 0, "Column labels must not be blank"))
|
|
105
|
+
});
|
|
106
|
+
const CustomAttributeGridColumnsSchema = valibot.strictObject({
|
|
107
|
+
columns: valibot.pipe(valibot.array(CustomAttributeGridColumnSchema), valibot.minLength(1, "At least one custom-attribute grid column is required"), valibot.check((items) => hasUniqueSanitizedIds(items), "Grid column ids must be unique after Commerce id sanitization.")),
|
|
108
|
+
description: valibot.optional(require_schemas.nonEmptyStringValueSchema("custom-attribute grid columns description")),
|
|
109
|
+
label: valibot.optional(require_schemas.nonEmptyStringValueSchema("custom-attribute grid columns label"))
|
|
110
|
+
});
|
|
75
111
|
/** Fields shared by both mass-action variants. `description` is flat — no `installation` nesting. */
|
|
76
112
|
const massActionCommonEntries = {
|
|
77
113
|
aclProtected: valibot.optional(valibot.boolean()),
|
|
@@ -86,8 +122,8 @@ const massActionCommonEntries = {
|
|
|
86
122
|
/** `type: "view"` mass action — renders an iframe at `path`. */
|
|
87
123
|
const ViewMassActionSchema = valibot.strictObject({
|
|
88
124
|
...massActionCommonEntries,
|
|
125
|
+
...iframePermissionEntries,
|
|
89
126
|
path: require_schemas.nonEmptyStringValueSchema("mass action path"),
|
|
90
|
-
sandboxPermissions: valibot.optional(SandboxPermissionsSchema),
|
|
91
127
|
type: valibot.literal("view")
|
|
92
128
|
});
|
|
93
129
|
/** `type: "worker"` mass action — invokes a workerProcess runtime action. */
|
|
@@ -108,6 +144,7 @@ const ViewButtonLevelSchema = valibot.picklist([
|
|
|
108
144
|
1
|
|
109
145
|
]);
|
|
110
146
|
const ViewButtonViewSchema = valibot.strictObject({
|
|
147
|
+
...iframePermissionEntries,
|
|
111
148
|
aclProtected: valibot.optional(valibot.boolean()),
|
|
112
149
|
confirm: valibot.optional(ConfirmSchema),
|
|
113
150
|
description: valibot.optional(require_schemas.nonEmptyStringValueSchema("view button description")),
|
|
@@ -116,7 +153,6 @@ const ViewButtonViewSchema = valibot.strictObject({
|
|
|
116
153
|
level: valibot.optional(ViewButtonLevelSchema),
|
|
117
154
|
notifications: valibot.optional(NotificationsSchema),
|
|
118
155
|
path: require_schemas.nonEmptyStringValueSchema("view button path"),
|
|
119
|
-
sandboxPermissions: valibot.optional(SandboxPermissionsSchema),
|
|
120
156
|
sortOrder: valibot.optional(require_schemas.positiveNumberValueSchema("sortOrder")),
|
|
121
157
|
type: valibot.literal("view")
|
|
122
158
|
});
|
|
@@ -155,14 +191,16 @@ const AdminUiInvoiceSchema = valibot.object({
|
|
|
155
191
|
gridColumns: valibot.optional(GridColumnsSchema),
|
|
156
192
|
viewButtons: valibot.optional(valibot.pipe(valibot.array(InvoiceViewButtonSchema), valibot.check((items) => hasUniqueSanitizedIds(items), "Invoice view button ids must be unique after Commerce id sanitization.")))
|
|
157
193
|
});
|
|
158
|
-
const AdminUiCreditMemoSchema = valibot.object({
|
|
194
|
+
const AdminUiCreditMemoSchema = valibot.pipe(valibot.object({
|
|
195
|
+
customAttributeGridColumns: valibot.optional(CustomAttributeGridColumnsSchema),
|
|
159
196
|
gridColumns: valibot.optional(GridColumnsSchema),
|
|
160
197
|
viewButtons: valibot.optional(valibot.pipe(valibot.array(CreditMemoViewButtonSchema), valibot.check((items) => hasUniqueSanitizedIds(items), "Credit memo view button ids must be unique after Commerce id sanitization.")))
|
|
161
|
-
});
|
|
198
|
+
}), valibot.forward(valibot.check(({ customAttributeGridColumns, gridColumns }) => !customAttributeGridColumns || hasUniqueSanitizedIds([...gridColumns?.columns ?? [], ...customAttributeGridColumns.columns]), "Runtime and custom-attribute grid column ids must be unique after Commerce id sanitization."), ["customAttributeGridColumns", "columns"]));
|
|
162
199
|
const AdminUiRmaSchema = valibot.object({ viewButtons: valibot.optional(valibot.pipe(valibot.array(RmaViewButtonSchema), valibot.check((items) => hasUniqueSanitizedIds(items), "Return view button ids must be unique after Commerce id sanitization."))) });
|
|
163
200
|
const AdminUiGridOnlyEntitySchema = valibot.object({ gridColumns: valibot.optional(GridColumnsSchema) });
|
|
164
201
|
const MenuIdSchema = valibot.pipe(require_schemas.nonEmptyStringValueSchema("menu ID"), valibot.regex(/^[A-Za-z0-9_/:]+$/u, "Menu ID may contain only letters, digits, \"/\", \":\", and \"_\""));
|
|
165
202
|
const MenuSchema = valibot.object({
|
|
203
|
+
...iframePermissionEntries,
|
|
166
204
|
/**
|
|
167
205
|
* When `true`, Commerce auto-generates a per-app ACL resource id from `metadata.id`
|
|
168
206
|
* and injects it into the Adobe Commerce User Roles permission tree, allowing role-based
|
|
@@ -173,13 +211,12 @@ const MenuSchema = valibot.object({
|
|
|
173
211
|
id: MenuIdSchema,
|
|
174
212
|
label: require_schemas.nonEmptyStringValueSchema("menu label"),
|
|
175
213
|
pageTitle: valibot.optional(require_schemas.nonEmptyStringValueSchema("menu page title")),
|
|
176
|
-
parentMenu: valibot.optional(valibot.picklist(_adobe_aio_commerce_lib_admin_ui_menu.COMMERCE_MENUS, "parentMenu must be a known Commerce Admin menu ID"))
|
|
177
|
-
sandboxPermissions: valibot.optional(SandboxPermissionsSchema)
|
|
214
|
+
parentMenu: valibot.optional(valibot.picklist(_adobe_aio_commerce_lib_admin_ui_menu.COMMERCE_MENUS, "parentMenu must be a known Commerce Admin menu ID"))
|
|
178
215
|
});
|
|
179
216
|
const NATIVE_UI_REPLACED_PAGE_TARGETS = ["order.create", "return.create"];
|
|
180
217
|
const NativeUiReplacedPageSchema = valibot.strictObject({
|
|
218
|
+
...iframePermissionEntries,
|
|
181
219
|
path: require_schemas.nonEmptyStringValueSchema("replaced page path"),
|
|
182
|
-
sandboxPermissions: valibot.optional(SandboxPermissionsSchema),
|
|
183
220
|
target: valibot.picklist(NATIVE_UI_REPLACED_PAGE_TARGETS, `Invalid native UI replaced page target. Accepted values are: ${NATIVE_UI_REPLACED_PAGE_TARGETS.join(", ")}`),
|
|
184
221
|
title: require_schemas.nonEmptyStringValueSchema("replaced page title")
|
|
185
222
|
});
|
|
@@ -219,8 +256,8 @@ const AdminUiAclSchema = valibot.pipe(valibot.array(AclResourceEntrySchema), val
|
|
|
219
256
|
return new Set(ids).size === ids.length;
|
|
220
257
|
}, "Custom ACL resource ids must stay unique after Commerce derivation: a top-level resource id must not equal a group's \"<group>_<child>\" combination."));
|
|
221
258
|
/**
|
|
222
|
-
* Schema for
|
|
223
|
-
*
|
|
259
|
+
* Schema for Admin UI components, including Credit Memo custom-attribute columns.
|
|
260
|
+
* Custom-attribute columns and custom ACL resources require no backend-ui/2 workers or views.
|
|
224
261
|
*/
|
|
225
262
|
const AdminUiSchema = valibot.object({
|
|
226
263
|
acl: valibot.optional(AdminUiAclSchema),
|
|
@@ -266,8 +303,8 @@ const ADMIN_UI_VIEW_BUTTON_ENTITIES = [
|
|
|
266
303
|
* `commerce/backend-ui/2` extension point — a menu, grid columns, mass actions,
|
|
267
304
|
* view buttons, or native UI replaced pages. Custom ACL resources are
|
|
268
305
|
* deliberately excluded: they reach Commerce through the `extensibility/1`
|
|
269
|
-
* app-config payload, not backend-ui/2
|
|
270
|
-
* backend-ui/2 registration.
|
|
306
|
+
* app-config payload, not backend-ui/2. Custom-attribute grid columns also need
|
|
307
|
+
* no backend-ui/2 registration because Commerce reads their values locally.
|
|
271
308
|
*/
|
|
272
309
|
function hasBackendUiV2Components(config) {
|
|
273
310
|
const { adminUi } = config;
|
|
@@ -276,12 +313,22 @@ function hasBackendUiV2Components(config) {
|
|
|
276
313
|
}
|
|
277
314
|
/**
|
|
278
315
|
* Check whether the config declares at least one Admin UI component (menu, grid
|
|
279
|
-
* columns, mass actions, view buttons, native UI
|
|
280
|
-
* resources). A component-less `adminUi` block
|
|
281
|
-
* registers nothing.
|
|
316
|
+
* columns, custom-attribute columns, mass actions, view buttons, native UI
|
|
317
|
+
* replaced pages, or custom ACL resources). A component-less `adminUi` block
|
|
318
|
+
* is treated as absent — it registers nothing.
|
|
282
319
|
*/
|
|
283
320
|
function hasAdminUi(config) {
|
|
284
|
-
return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length);
|
|
321
|
+
return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length || config.adminUi?.creditMemo?.customAttributeGridColumns);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// source/config/schema/runtime-action.ts
|
|
325
|
+
const RUNTIME_ACTION_REFERENCE_REGEX = /^\w(?:[\w@ .-]*[\w@.-])?\/\w(?:[\w@ .-]*[\w@.-])?$/u;
|
|
326
|
+
/**
|
|
327
|
+
* Schema for a runtime action reference in the format `<package>/<action>`.
|
|
328
|
+
* @param name - The name of the field, used in error messages.
|
|
329
|
+
*/
|
|
330
|
+
function runtimeActionReferenceSchema(name) {
|
|
331
|
+
return valibot.pipe(require_schemas.nonEmptyStringValueSchema(name), valibot.regex(RUNTIME_ACTION_REFERENCE_REGEX, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")"));
|
|
285
332
|
}
|
|
286
333
|
|
|
287
334
|
// source/config/schema/eventing.ts
|
|
@@ -363,7 +410,7 @@ const BaseEventSchema = valibot.object({
|
|
|
363
410
|
description: valibot.pipe(require_schemas.nonEmptyStringValueSchema("event description"), ioEventsTextSchema("Event description"), valibot.maxLength(MAX_DESCRIPTION_LENGTH$1, `The event description must not be longer than ${MAX_DESCRIPTION_LENGTH$1} characters`)),
|
|
364
411
|
env: valibot.optional(_adobe_aio_commerce_lib_core_commerce.CommerceEnvArraySchema),
|
|
365
412
|
label: valibot.pipe(require_schemas.nonEmptyStringValueSchema("event label"), ioEventsTextSchema("Event label"), valibot.maxLength(MAX_LABEL_LENGTH, `The event label must not be longer than ${MAX_LABEL_LENGTH} characters`)),
|
|
366
|
-
runtimeActions: valibot.array(
|
|
413
|
+
runtimeActions: valibot.array(runtimeActionReferenceSchema("runtime action"), "Expected an array of runtime actions in the format <package>/<action>")
|
|
367
414
|
});
|
|
368
415
|
/**
|
|
369
416
|
* Schema for rule operator values.
|
|
@@ -562,7 +609,7 @@ const WebhookEntryBaseSchema = valibot.object({
|
|
|
562
609
|
const WebhookEntryWithRuntimeActionSchema = valibot.object({
|
|
563
610
|
...WebhookEntryBaseSchema.entries,
|
|
564
611
|
requireAdobeAuth: valibot.optional(require_schemas.booleanValueSchema("requireAdobeAuth")),
|
|
565
|
-
runtimeAction:
|
|
612
|
+
runtimeAction: runtimeActionReferenceSchema("runtimeAction"),
|
|
566
613
|
webhook: WebhookDefinitionBaseSchema
|
|
567
614
|
});
|
|
568
615
|
/** Schema for a webhook entry that provides an explicit URL. */
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "../../index-DUJtT78x.mjs";
|
|
16
|
-
import { n as CommerceAppConfig } from "../../app-B3bAEor-.mjs";
|
|
17
15
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
16
|
+
import "../../index-U7CXicoW.mjs";
|
|
17
|
+
import { n as CommerceAppConfig } from "../../app-CLDvfJXp.mjs";
|
|
18
18
|
/** The arguments required to create the runtime action for the app-config action. */
|
|
19
19
|
type RuntimeActionFactoryArgs = {
|
|
20
20
|
appConfig: CommerceAppConfig;
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-BWgrh_QM.mjs";
|
|
16
|
-
import { n as filterAppConfigByEnv } from "../../environment-DUhU0_9z.mjs";
|
|
17
|
-
import { i as requiresInstallationFromDomains, o as getConfigDomains, t as validateCommerceAppConfig, u as hasBusinessConfigSchema } from "../../validate-xS9Dc-4m.mjs";
|
|
18
15
|
import { resolveBusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
19
16
|
import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
|
|
20
|
-
import * as v from "valibot";
|
|
21
17
|
import { internalServerError, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
18
|
+
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-Cj7a9rey.mjs";
|
|
19
|
+
import * as v from "valibot";
|
|
20
|
+
import { n as filterAppConfigByEnv } from "../../environment-B1JJFHZw.mjs";
|
|
21
|
+
import { d as hasBusinessConfigSchema, i as requiresInstallationFromDomains, o as getConfigDomains, t as validateCommerceAppConfig } from "../../validate-DeAMC-HS.mjs";
|
|
22
22
|
import { createHash } from "crypto";
|
|
23
23
|
|
|
24
24
|
// source/actions/app-config/openapi.ts
|
|
@@ -26,7 +26,7 @@ import { createHash } from "crypto";
|
|
|
26
26
|
* Loads the committed OpenAPI spec via dynamic import so it
|
|
27
27
|
* lands in its own chunk and is not parsed on every cold start.
|
|
28
28
|
*/
|
|
29
|
-
const importOpenApi = () => import("../../openapi-
|
|
29
|
+
const importOpenApi = () => import("../../openapi-ChihLuvm.mjs");
|
|
30
30
|
/** Matches component schema `$ref` strings, capturing the schema name. */
|
|
31
31
|
const SCHEMA_REF_PATTERN = /"#\/components\/schemas\/(?<schema>\w+)"/gu;
|
|
32
32
|
/**
|
|
@@ -77,7 +77,7 @@ function pruneUnusedTags(spec) {
|
|
|
77
77
|
* @param domains - The active config domains.
|
|
78
78
|
*/
|
|
79
79
|
function getOpenApiCacheKey(domains) {
|
|
80
|
-
const input = `2.
|
|
80
|
+
const input = `2.3.0-beta-20261202103723:${[...domains].sort().join(",")}:4.3.0`;
|
|
81
81
|
return createHash("sha256").update(input).digest("hex").slice(0, 8);
|
|
82
82
|
}
|
|
83
83
|
/** Returns the server URL to be set in the OpenAPI spec, based on the current namespace. */
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-BWgrh_QM.mjs";
|
|
16
|
-
import { r as setAssociationData, t as clearAssociationData } from "../../repository-BVBp61y9.mjs";
|
|
17
15
|
import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
|
|
16
|
+
import { noContent, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
17
|
+
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-Cj7a9rey.mjs";
|
|
18
|
+
import { r as setAssociationData, t as clearAssociationData } from "../../repository-BVBp61y9.mjs";
|
|
18
19
|
import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
|
|
19
20
|
import * as v from "valibot";
|
|
20
|
-
import { noContent, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
21
21
|
|
|
22
22
|
// source/actions/association/schema.ts
|
|
23
23
|
/** Request body for POST / — store association data. */
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "../../index-DUJtT78x.mjs";
|
|
16
|
-
import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
17
15
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
16
|
+
import "../../index-U7CXicoW.mjs";
|
|
17
|
+
import { BusinessConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
18
18
|
/** The arguments required to create the runtime action for the config action. */
|
|
19
19
|
type ConfigActionFactoryArgs = {
|
|
20
20
|
configSchema: BusinessConfigSchema;
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
15
|
+
import { byScopeId, getConfiguration, initialize, isNonEmptyConfigurationValue, setConfiguration } from "@adobe/aio-commerce-lib-config";
|
|
16
|
+
import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
|
|
17
|
+
import { badRequest, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
18
|
+
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-Cj7a9rey.mjs";
|
|
19
|
+
import { r as filterSchemaByEnv } from "../../environment-B1JJFHZw.mjs";
|
|
19
20
|
import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
|
|
21
|
+
import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
|
|
20
22
|
import * as v from "valibot";
|
|
21
|
-
import { ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
22
23
|
|
|
23
24
|
// source/actions/config/schema.ts
|
|
24
25
|
const AcceptedConfigurationValuesSchema = v.union([
|
|
@@ -43,14 +44,15 @@ const PatchConfigBodySchema = v.object({
|
|
|
43
44
|
// source/actions/config/router.ts
|
|
44
45
|
const MASKED_PASSWORD_VALUE = "*****";
|
|
45
46
|
/**
|
|
46
|
-
*
|
|
47
|
+
* Masks non-empty password values. Empty values are returned as-is so clients can tell
|
|
48
|
+
* whether a password is set.
|
|
47
49
|
*
|
|
48
50
|
* @param schema - The schema to use to filter the values.
|
|
49
51
|
* @param values - The values to filter.
|
|
50
52
|
*/
|
|
51
53
|
function filterPasswordFields(schema, values) {
|
|
52
54
|
return values.map((item) => {
|
|
53
|
-
if (schema.find((field) => field.name === item.name)?.type === "password") return {
|
|
55
|
+
if (schema.find((field) => field.name === item.name)?.type === "password" && isNonEmptyConfigurationValue(item.value)) return {
|
|
54
56
|
...item,
|
|
55
57
|
value: MASKED_PASSWORD_VALUE
|
|
56
58
|
};
|
|
@@ -100,7 +102,16 @@ router.patch("/", {
|
|
|
100
102
|
params: rawParams,
|
|
101
103
|
schema: rawParams.configSchema
|
|
102
104
|
});
|
|
103
|
-
|
|
105
|
+
let result;
|
|
106
|
+
try {
|
|
107
|
+
result = await setConfiguration({ config }, byScopeId(scopeId), { encryptionKey: rawParams.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY });
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error instanceof CommerceSdkValidationError) return badRequest({ body: {
|
|
110
|
+
issues: error.issues,
|
|
111
|
+
message: error.message
|
|
112
|
+
} });
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
104
115
|
result.config = filterPasswordFields(configSchema, result.config);
|
|
105
116
|
return ok({
|
|
106
117
|
body: result,
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import "../../index-DUJtT78x.mjs";
|
|
16
|
-
import { G as LifecycleContext } from "../../index-DE2KVXfH.mjs";
|
|
17
|
-
import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-B3bAEor-.mjs";
|
|
18
|
-
import "../../types-DslZGym8.mjs";
|
|
19
15
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
16
|
+
import "../../index-U7CXicoW.mjs";
|
|
17
|
+
import { G as LifecycleContext } from "../../index-DYHaYwvJ.mjs";
|
|
18
|
+
import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-CLDvfJXp.mjs";
|
|
19
|
+
import "../../types-DslZGym8.mjs";
|
|
20
20
|
/** Loads generated custom installation script modules. */
|
|
21
21
|
type CustomScriptsLoader = (config: CommerceAppConfigOutputModel, logger: LifecycleContext["logger"]) => Record<string, unknown>;
|
|
22
22
|
/** Arguments for the runtime action factory. */
|
|
@@ -12,21 +12,23 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { accepted, badRequest, conflict, internalServerError, noContent, notFound, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
16
|
+
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-Cj7a9rey.mjs";
|
|
17
|
+
import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
|
|
16
18
|
import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { init } from "@adobe/aio-lib-state";
|
|
19
|
+
import * as v from "valibot";
|
|
20
|
+
import { init } from "@adobe/aio-lib-files";
|
|
21
|
+
import { init as init$1 } from "@adobe/aio-lib-state";
|
|
22
|
+
import { C as isLeafStep, S as isBranchStep, _ as getAtPath, b as pathsEqual, c as getCustomScriptStepName, d as isInProgressState, f as isSucceededState, g as createWorkflowError, h as createSucceededState, l as isCompletedState, m as createFailedState, o as createRootInstallationStep, p as toValidationResult, v as isStepConfigured, w as callHook, x as setAtPath, y as nowIsoString } from "../../management-CNMT6azj.mjs";
|
|
22
23
|
import { CommerceSdkErrorBase } from "@adobe/aio-commerce-lib-core/error";
|
|
23
24
|
import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import stringify from "safe-stable-stringify";
|
|
27
|
-
import { accepted, badRequest, conflict, internalServerError, noContent, notFound, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
28
|
-
import { init as init$1 } from "@adobe/aio-lib-files";
|
|
25
|
+
import { n as getAssociationData, r as setAssociationData } from "../../repository-BVBp61y9.mjs";
|
|
26
|
+
import { a as hasCustomInstallationSteps } from "../../webhooks-CyiUfRNG.mjs";
|
|
29
27
|
import openwhisk from "openwhisk";
|
|
28
|
+
import { c as DEFAULT_UPGRADE_MODE, r as requiresInstallation, t as validateCommerceAppConfig } from "../../validate-DeAMC-HS.mjs";
|
|
29
|
+
import stringify from "safe-stable-stringify";
|
|
30
|
+
import { filterConfigurationFields, initialize, isNonEmptyConfigurationValue } from "@adobe/aio-commerce-lib-config";
|
|
31
|
+
import { i as getInstallCommerceEnv, r as filterSchemaByEnv } from "../../environment-B1JJFHZw.mjs";
|
|
30
32
|
|
|
31
33
|
// source/management/common/workflow/execute.ts
|
|
32
34
|
/**
|
|
@@ -419,7 +421,7 @@ const DEFAULT_DIR_PREFIX = "store";
|
|
|
419
421
|
*/
|
|
420
422
|
async function createFilesStore(options = {}) {
|
|
421
423
|
const { dirPrefix = DEFAULT_DIR_PREFIX } = options;
|
|
422
|
-
const files = await init
|
|
424
|
+
const files = await init();
|
|
423
425
|
return new FilesStore(files, dirPrefix);
|
|
424
426
|
}
|
|
425
427
|
/**
|
|
@@ -498,7 +500,7 @@ const DEFAULT_KEY_PREFIX = "store";
|
|
|
498
500
|
*/
|
|
499
501
|
async function createStateStore(options = {}) {
|
|
500
502
|
const { keyPrefix = DEFAULT_KEY_PREFIX, ttlSeconds = DEFAULT_TTL_SECONDS } = options;
|
|
501
|
-
const state = await init();
|
|
503
|
+
const state = await init$1();
|
|
502
504
|
return new StateStore(state, keyPrefix, ttlSeconds);
|
|
503
505
|
}
|
|
504
506
|
/**
|
|
@@ -1627,7 +1629,8 @@ function toPlanPreview(plan) {
|
|
|
1627
1629
|
})),
|
|
1628
1630
|
operation: plan.operation,
|
|
1629
1631
|
sourceVersion: plan.source?.appVersion ?? null,
|
|
1630
|
-
targetVersion: plan.target?.appVersion ?? null
|
|
1632
|
+
targetVersion: plan.target?.appVersion ?? null,
|
|
1633
|
+
upgradeMode: plan.operation === "upgrade" ? plan.target?.config.metadata.upgradeMode ?? "manual" : null
|
|
1631
1634
|
};
|
|
1632
1635
|
}
|
|
1633
1636
|
|
|
@@ -2112,6 +2115,8 @@ async function startPlannedRequest(args) {
|
|
|
2112
2115
|
logger.warn(`Refused to start plan ${planId} because it is for an ${pendingPlan.operation}, but the app now needs an ${operation}.`);
|
|
2113
2116
|
return stalePlanConflict(`The plan is for an ${pendingPlan.operation}, but the app now needs an ${operation}. Call POST /plan again.`);
|
|
2114
2117
|
}
|
|
2118
|
+
const validation = await validateLifecycleConfiguration(request, operation);
|
|
2119
|
+
if (validation) return validation;
|
|
2115
2120
|
if (businessConfigOnlyVersion && !request.baseline && state) await writeBusinessConfigOnlyBaseline(request, state, businessConfigOnlyVersion);
|
|
2116
2121
|
const planned = await planOperation({
|
|
2117
2122
|
...getPlanInputs(operation, request.appConfig, businessConfigOnlyVersion),
|
|
@@ -2130,6 +2135,25 @@ async function startPlannedRequest(args) {
|
|
|
2130
2135
|
runtime: request.runtime
|
|
2131
2136
|
});
|
|
2132
2137
|
}
|
|
2138
|
+
/** Refuses a start when global configuration required by the operation is missing. */
|
|
2139
|
+
async function validateLifecycleConfiguration(request, operation) {
|
|
2140
|
+
if (operation === "uninstall" || !request.appConfig.businessConfig?.schema) return null;
|
|
2141
|
+
const lifecycleOperation = operation === "install" ? "installation" : "upgrade";
|
|
2142
|
+
if (!request.appConfig.businessConfig.schema.some((field) => field.requiredFor?.includes(lifecycleOperation))) return null;
|
|
2143
|
+
const schema = filterSchemaByEnv(request.appConfig.businessConfig.schema, getInstallCommerceEnv(request.params));
|
|
2144
|
+
if (!schema.some((field) => field.requiredFor?.includes(lifecycleOperation))) return null;
|
|
2145
|
+
await initialize({
|
|
2146
|
+
params: request.params,
|
|
2147
|
+
schema
|
|
2148
|
+
});
|
|
2149
|
+
const missing = (await filterConfigurationFields((field, value) => (field.requiredFor?.includes(lifecycleOperation) ?? false) && !isNonEmptyConfigurationValue(value))).map((field) => field.name);
|
|
2150
|
+
if (missing.length === 0) return null;
|
|
2151
|
+
return conflict({ body: {
|
|
2152
|
+
code: "missing-required-configuration",
|
|
2153
|
+
fields: missing,
|
|
2154
|
+
message: `Required global configuration is missing for ${lifecycleOperation}: ${missing.join(", ")}.`
|
|
2155
|
+
} });
|
|
2156
|
+
}
|
|
2133
2157
|
/**
|
|
2134
2158
|
* Stores the Commerce instance of the request as the association record, unless a record exists.
|
|
2135
2159
|
* Does nothing when the request did not supply the instance.
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-BWgrh_QM.mjs";
|
|
16
|
-
import { t as inspect } from "../../logging-B1xb568A.mjs";
|
|
17
|
-
import { t as LIFECYCLE_HTTP_CLIENT_TIMEOUT_MS } from "../../constants-C-4fesPr.mjs";
|
|
18
|
-
import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
|
|
19
15
|
import { resolveCommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
20
16
|
import { getScopeTree, setCustomScopeTree, syncCommerceScopes, unsyncCommerceScopes } from "@adobe/aio-commerce-lib-config";
|
|
17
|
+
import { badRequest, internalServerError, nonAuthoritativeInformation, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
18
|
+
import { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-Cj7a9rey.mjs";
|
|
19
|
+
import { t as inspect } from "../../logging-B1xb568A.mjs";
|
|
20
|
+
import { t as LIFECYCLE_HTTP_CLIENT_TIMEOUT_MS } from "../../constants-C-4fesPr.mjs";
|
|
21
21
|
import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
|
|
22
|
+
import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
|
|
22
23
|
import * as v from "valibot";
|
|
23
|
-
import { badRequest, internalServerError, nonAuthoritativeInformation, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
24
24
|
|
|
25
25
|
// source/actions/scope-tree/schema.ts
|
|
26
26
|
const CustomScopeInputSchema = v.object({
|