@adobe/aio-commerce-lib-app 2.2.0 → 2.3.0-alpha-20261203134759

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/bin/cli.mjs +22 -1
  3. package/dist/cjs/actions/app-config/index.cjs +8 -8
  4. package/dist/cjs/actions/app-config/index.d.cts +2 -2
  5. package/dist/cjs/actions/association/index.cjs +4 -4
  6. package/dist/cjs/actions/config/index.cjs +19 -8
  7. package/dist/cjs/actions/config/index.d.cts +1 -1
  8. package/dist/cjs/actions/installation/index.cjs +39 -15
  9. package/dist/cjs/actions/installation/index.d.cts +3 -3
  10. package/dist/cjs/actions/scope-tree/index.cjs +6 -6
  11. package/dist/cjs/{app-B3bAEor-.d.cts → app-Cb6-5mKk.d.cts} +637 -45
  12. package/dist/cjs/config/index.browser.d.cts +1 -1
  13. package/dist/cjs/config/index.node.cjs +11 -7
  14. package/dist/cjs/config/index.node.d.cts +150 -14
  15. package/dist/cjs/{define-eBMdGAq6.d.cts → define-Dk0uzfO9.d.cts} +1 -1
  16. package/dist/cjs/{commands → deprecated/commands}/index.cjs +1828 -864
  17. package/dist/cjs/{environment-CW6M76gS.cjs → environment-CaV1hi2-.cjs} +1 -1
  18. package/dist/cjs/{index-BEeludy0.d.cts → index-Cmxlkzpm.d.cts} +2 -2
  19. package/dist/cjs/index.cjs +3 -3
  20. package/dist/cjs/index.d.cts +1 -1
  21. package/dist/cjs/index.node-QXhLROom.cjs +117 -0
  22. package/dist/cjs/{logging-Emi7P923.cjs → logging-r-r2bUWO.cjs} +1 -1
  23. package/dist/cjs/management/index.cjs +1 -1
  24. package/dist/cjs/management/index.d.cts +1 -1
  25. package/dist/cjs/{management-5Et1mEUp.cjs → management-BX9sUQw-.cjs} +123 -108
  26. package/dist/cjs/{openapi-DghfuM8S.cjs → openapi-BaKoO7GY.cjs} +177 -26
  27. package/dist/cjs/{index.node-9bfp79rs.cjs → parser-XcHKOYKN.cjs} +46 -16
  28. package/dist/cjs/project/index.cjs +637 -0
  29. package/dist/cjs/project/index.d.cts +212 -0
  30. package/dist/cjs/{rolldown-runtime-CoOt0iuZ.cjs → rolldown-runtime-BKfnhsn2.cjs} +4 -4
  31. package/dist/cjs/{schemas-B6ITl1bG.cjs → schemas-B-jCi6Oz.cjs} +1 -1
  32. package/dist/cjs/{utils-CoR_PBHz.cjs → utils-CuzJBLgo.cjs} +2 -2
  33. package/dist/cjs/{utils-DSS0XlXq.cjs → utils-bwFwJcPW.cjs} +1 -1
  34. package/dist/cjs/{validate-BC3rnRLc.cjs → validate-BumkVjJy.cjs} +22 -6
  35. package/dist/cjs/{version-5MonNzl5.cjs → version-Bczstmvz.cjs} +3 -3
  36. package/dist/{es/webhooks-DgaLfP36.d.mts → cjs/webhooks-BBuoVWq_.d.cts} +382 -43
  37. package/dist/cjs/{webhooks-ZPh2gVb3.cjs → webhooks-VZTBeI8L.cjs} +84 -23
  38. package/dist/es/actions/app-config/index.d.mts +2 -2
  39. package/dist/es/actions/app-config/index.mjs +6 -6
  40. package/dist/es/actions/association/index.mjs +3 -3
  41. package/dist/es/actions/config/index.d.mts +2 -2
  42. package/dist/es/actions/config/index.mjs +19 -8
  43. package/dist/es/actions/installation/index.d.mts +4 -4
  44. package/dist/es/actions/installation/index.mjs +38 -14
  45. package/dist/es/actions/scope-tree/index.mjs +5 -5
  46. package/dist/es/{app-B3bAEor-.d.mts → app-Cb6-5mKk.d.mts} +637 -45
  47. package/dist/es/config/index.browser.d.mts +1 -1
  48. package/dist/es/config/index.node.d.mts +151 -15
  49. package/dist/es/config/index.node.mjs +5 -4
  50. package/dist/es/{define-BdXyLAwb.d.mts → define-D7EjSr-Z.d.mts} +1 -1
  51. package/dist/es/{commands → deprecated/commands}/index.mjs +1773 -807
  52. package/dist/es/{environment-DUhU0_9z.mjs → environment-B1JJFHZw.mjs} +1 -1
  53. package/dist/es/{index-DE2KVXfH.d.mts → index-BkqV8WU_.d.mts} +4 -4
  54. package/dist/es/{index-DUJtT78x.d.mts → index-U7CXicoW.d.mts} +1 -1
  55. package/dist/es/index.d.mts +2 -2
  56. package/dist/es/index.mjs +3 -3
  57. package/dist/es/index.node-DipCrOq_.mjs +112 -0
  58. package/dist/es/management/index.d.mts +1 -1
  59. package/dist/es/management/index.mjs +1 -1
  60. package/dist/es/{management-BAQ64OyR.mjs → management-DSu69_ub.mjs} +128 -113
  61. package/dist/es/{openapi-BvPVTUMt.mjs → openapi-ChihLuvm.mjs} +177 -26
  62. package/dist/es/{index.node-CURztkP5.mjs → parser-DdhiGXVf.mjs} +33 -15
  63. package/dist/es/project/index.d.mts +212 -0
  64. package/dist/es/project/index.mjs +636 -0
  65. package/dist/es/{utils-DB8HaSj0.mjs → utils-Bg_LIAGV.mjs} +2 -2
  66. package/dist/es/{validate-xS9Dc-4m.mjs → validate-CYWj7Nzp.mjs} +10 -6
  67. package/dist/es/{version-BWgrh_QM.mjs → version-CVSRkbJP.mjs} +1 -1
  68. package/dist/es/{webhooks-HBe_DEKA.mjs → webhooks-Ba-OdU8e.mjs} +76 -21
  69. package/dist/{cjs/webhooks-DNLuuv9_.d.cts → es/webhooks-Deujdgcm.d.mts} +382 -43
  70. package/package.json +29 -24
  71. /package/dist/cjs/{commands → deprecated/commands}/index.d.cts +0 -0
  72. /package/dist/cjs/{commands → deprecated/commands}/templates/typescript/webpack-config.cjs +0 -0
  73. /package/dist/cjs/{commands → project}/templates/admin-ui/tsconfig.json +0 -0
  74. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/.babelrc +0 -0
  75. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/index.css +0 -0
  76. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/index.html +0 -0
  77. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/app.jsx +0 -0
  78. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/components/welcome.jsx +0 -0
  79. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src/src/pages/main-page.jsx +0 -0
  80. /package/dist/cjs/{commands → project}/templates/admin-ui/web-src-template.d.ts +0 -0
  81. /package/dist/cjs/{commands → project}/templates/app-management/app-config.js.template +0 -0
  82. /package/dist/cjs/{commands → project}/templates/app-management/association.js.template +0 -0
  83. /package/dist/cjs/{commands → project}/templates/app-management/custom-scripts.js.template +0 -0
  84. /package/dist/cjs/{commands → project}/templates/app-management/installation.js.template +0 -0
  85. /package/dist/cjs/{commands → project}/templates/business-configuration/config.js.template +0 -0
  86. /package/dist/cjs/{commands → project}/templates/business-configuration/scope-tree.js.template +0 -0
  87. /package/dist/es/{commands → deprecated/commands}/index.d.mts +0 -0
  88. /package/dist/es/{commands → deprecated/commands}/templates/typescript/webpack-config.cjs +0 -0
  89. /package/dist/es/{commands → project}/templates/admin-ui/tsconfig.json +0 -0
  90. /package/dist/es/{commands → project}/templates/admin-ui/web-src/.babelrc +0 -0
  91. /package/dist/es/{commands → project}/templates/admin-ui/web-src/index.css +0 -0
  92. /package/dist/es/{commands → project}/templates/admin-ui/web-src/index.html +0 -0
  93. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/app.jsx +0 -0
  94. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/components/welcome.jsx +0 -0
  95. /package/dist/es/{commands → project}/templates/admin-ui/web-src/src/pages/main-page.jsx +0 -0
  96. /package/dist/es/{commands → project}/templates/admin-ui/web-src-template.d.ts +0 -0
  97. /package/dist/es/{commands → project}/templates/app-management/app-config.js.template +0 -0
  98. /package/dist/es/{commands → project}/templates/app-management/association.js.template +0 -0
  99. /package/dist/es/{commands → project}/templates/app-management/custom-scripts.js.template +0 -0
  100. /package/dist/es/{commands → project}/templates/app-management/installation.js.template +0 -0
  101. /package/dist/es/{commands → project}/templates/business-configuration/config.js.template +0 -0
  102. /package/dist/es/{commands → project}/templates/business-configuration/scope-tree.js.template +0 -0
@@ -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-CoOt0iuZ.cjs");
16
- const require_schemas = require("./schemas-B6ITl1bG.cjs");
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 SandboxPermissionsSchema = valibot.pipe(valibot.array(valibot.picklist(SANDBOX_PERMISSION_VALUES, `Invalid sandbox permission. Accepted values are: ${SANDBOX_PERMISSION_VALUES.join(", ")}`)), valibot.minLength(1, "sandboxPermissions must contain at least one permission when it's defined"), valibot.check((permissions) => {
39
- return new Set(permissions).size === permissions.length;
40
- }, "Duplicate permissions are not allowed in sandboxPermissions"));
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 the `adminUi` config section.
223
- * Supports grid column extensions, mass actions, order, invoice, credit memo, and return view buttons, menu, native UI replaced pages, and custom ACL resources on `commerce/backend-ui/2`.
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, so an acl-only config needs no
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;
@@ -275,13 +312,31 @@ function hasBackendUiV2Components(config) {
275
312
  return Boolean(adminUi.menu || adminUi.order?.gridColumns || adminUi.order?.massActions?.length || adminUi.order?.viewButtons?.length || adminUi.product?.gridColumns || adminUi.product?.massActions?.length || adminUi.customer?.gridColumns || adminUi.customer?.massActions?.length || adminUi.invoice?.gridColumns || adminUi.invoice?.viewButtons?.length || adminUi.creditMemo?.gridColumns || adminUi.creditMemo?.viewButtons?.length || adminUi.rma?.viewButtons?.length || adminUi.shipment?.gridColumns || adminUi.nativeUi?.replacedPages?.length || adminUi.newsletter?.gridColumns);
276
313
  }
277
314
  /**
315
+ * Whether the Admin UI config needs a web view: a menu, a replaced native page, or a view-type
316
+ * button or mass action.
317
+ */
318
+ function hasAdminUiView(adminUi) {
319
+ if (adminUi.menu !== void 0 || (adminUi.nativeUi?.replacedPages.length ?? 0) > 0) return true;
320
+ return [...ADMIN_UI_VIEW_BUTTON_ENTITIES.flatMap((key) => adminUi[key]?.viewButtons ?? []), ...ADMIN_UI_MASS_ACTION_ENTITIES.flatMap((key) => adminUi[key]?.massActions ?? [])].some((entry) => entry.type === "view");
321
+ }
322
+ /**
278
323
  * Check whether the config declares at least one Admin UI component (menu, grid
279
- * columns, mass actions, view buttons, native UI replaced pages, or custom ACL
280
- * resources). A component-less `adminUi` block is treated as absent — it
281
- * registers nothing.
324
+ * columns, custom-attribute columns, mass actions, view buttons, native UI
325
+ * replaced pages, or custom ACL resources). A component-less `adminUi` block
326
+ * is treated as absent — it registers nothing.
282
327
  */
283
328
  function hasAdminUi(config) {
284
- return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length);
329
+ return hasBackendUiV2Components(config) || Boolean(config.adminUi?.acl?.length || config.adminUi?.creditMemo?.customAttributeGridColumns);
330
+ }
331
+
332
+ // source/config/schema/runtime-action.ts
333
+ const RUNTIME_ACTION_REFERENCE_REGEX = /^\w(?:[\w@ .-]*[\w@.-])?\/\w(?:[\w@ .-]*[\w@.-])?$/u;
334
+ /**
335
+ * Schema for a runtime action reference in the format `<package>/<action>`.
336
+ * @param name - The name of the field, used in error messages.
337
+ */
338
+ function runtimeActionReferenceSchema(name) {
339
+ 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
340
  }
286
341
 
287
342
  // source/config/schema/eventing.ts
@@ -363,7 +418,7 @@ const BaseEventSchema = valibot.object({
363
418
  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
419
  env: valibot.optional(_adobe_aio_commerce_lib_core_commerce.CommerceEnvArraySchema),
365
420
  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(valibot.pipe(require_schemas.nonEmptyStringValueSchema("runtime action"), valibot.regex(/^[a-zA-Z0-9-]+\/[a-zA-Z0-9-]+$/u, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")")), "Expected an array of runtime actions in the format <package>/<action>")
421
+ runtimeActions: valibot.array(runtimeActionReferenceSchema("runtime action"), "Expected an array of runtime actions in the format <package>/<action>")
367
422
  });
368
423
  /**
369
424
  * Schema for rule operator values.
@@ -562,7 +617,7 @@ const WebhookEntryBaseSchema = valibot.object({
562
617
  const WebhookEntryWithRuntimeActionSchema = valibot.object({
563
618
  ...WebhookEntryBaseSchema.entries,
564
619
  requireAdobeAuth: valibot.optional(require_schemas.booleanValueSchema("requireAdobeAuth")),
565
- runtimeAction: require_schemas.nonEmptyStringValueSchema("runtimeAction"),
620
+ runtimeAction: runtimeActionReferenceSchema("runtimeAction"),
566
621
  webhook: WebhookDefinitionBaseSchema
567
622
  });
568
623
  /** Schema for a webhook entry that provides an explicit URL. */
@@ -630,6 +685,12 @@ Object.defineProperty(exports, "hasAdminUi", {
630
685
  return hasAdminUi;
631
686
  }
632
687
  });
688
+ Object.defineProperty(exports, "hasAdminUiView", {
689
+ enumerable: true,
690
+ get: function () {
691
+ return hasAdminUiView;
692
+ }
693
+ });
633
694
  Object.defineProperty(exports, "hasBackendUiV2Components", {
634
695
  enumerable: true,
635
696
  get: function () {
@@ -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-Cb6-5mKk.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-CVSRkbJP.mjs";
19
+ import * as v from "valibot";
20
+ import { n as filterAppConfigByEnv } from "../../environment-B1JJFHZw.mjs";
21
+ import { f as hasBusinessConfigSchema, i as requiresInstallationFromDomains, s as getConfigDomains, t as validateCommerceAppConfig } from "../../validate-CYWj7Nzp.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-BvPVTUMt.mjs");
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.2.0:${[...domains].sort().join(",")}:4.2.0`;
80
+ const input = `2.3.0-alpha-20261203134759:${[...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-CVSRkbJP.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 { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-BWgrh_QM.mjs";
16
- import { r as filterSchemaByEnv } from "../../environment-DUhU0_9z.mjs";
17
- import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
18
- import { byScopeId, getConfiguration, initialize, setConfiguration } from "@adobe/aio-commerce-lib-config";
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-CVSRkbJP.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
- * Filters password fields from the configuration values.
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
- const result = await setConfiguration({ config }, byScopeId(scopeId), { encryptionKey: rawParams.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY });
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-BkqV8WU_.mjs";
18
+ import { n as CommerceAppConfig, r as CommerceAppConfigOutputModel } from "../../app-Cb6-5mKk.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 { n as HttpActionRouter, r as logger, t as SDK_LIB_VERSIONS_HEADERS } from "../../version-BWgrh_QM.mjs";
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-CVSRkbJP.mjs";
17
+ import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
16
18
  import { r as nonEmptyStringValueSchema } from "../../schemas-DYMNbFdX.mjs";
17
- 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-BAQ64OyR.mjs";
18
- import { n as getAssociationData, r as setAssociationData } from "../../repository-BVBp61y9.mjs";
19
- import { a as hasCustomInstallationSteps } from "../../webhooks-HBe_DEKA.mjs";
20
- import { r as requiresInstallation, t as validateCommerceAppConfig } from "../../validate-xS9Dc-4m.mjs";
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-DSu69_ub.mjs";
22
23
  import { CommerceSdkErrorBase } from "@adobe/aio-commerce-lib-core/error";
23
24
  import { resolveImsAuthParams } from "@adobe/aio-commerce-lib-auth";
24
- import { CommerceEnvSchema } from "@adobe/aio-commerce-lib-core/commerce";
25
- import * as v from "valibot";
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-Ba-OdU8e.mjs";
29
27
  import openwhisk from "openwhisk";
28
+ import { l as DEFAULT_UPGRADE_MODE, r as requiresInstallation, t as validateCommerceAppConfig } from "../../validate-CYWj7Nzp.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$1();
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-CVSRkbJP.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({