@adobe/aio-commerce-lib-app 1.3.0 → 1.4.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 +43 -0
- package/dist/cjs/actions/app-config.cjs +3 -3
- package/dist/cjs/actions/app-config.d.cts +1 -1
- package/dist/cjs/actions/config.cjs +31 -9
- package/dist/cjs/actions/installation.cjs +16 -13
- package/dist/cjs/actions/installation.d.cts +2 -2
- package/dist/cjs/actions/registration.cjs +41 -0
- package/dist/cjs/actions/registration.d.cts +33 -0
- package/dist/cjs/actions/scope-tree.cjs +5 -4
- package/dist/cjs/admin-ui-sdk-BiSopnKI.d.cts +665 -0
- package/dist/cjs/{app-DcQMhW2N.d.cts → app-C6kImBl7.d.cts} +242 -16
- package/dist/cjs/chunk-DS2yp5vX.cjs +48 -0
- package/dist/cjs/commands/index.cjs +582 -319
- package/dist/cjs/commands/templates/admin-ui-sdk/registration.js.template +20 -0
- package/dist/cjs/config/index.cjs +4 -3
- package/dist/cjs/config/index.d.cts +558 -62
- package/dist/cjs/{config-BppBKCFj.cjs → config-ct-qMOGj.cjs} +56 -25
- package/dist/cjs/{error-Dn7ool6k.cjs → error-C5LNOZ4f.cjs} +1 -1
- package/dist/cjs/{index-BVwQk9bx.d.cts → index-B5WKJ3hJ.d.cts} +20 -174
- package/dist/cjs/{logging-4s36JTiN.cjs → logging-BTevALnL.cjs} +2 -2
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +3 -2
- package/dist/cjs/{management-C6xG5bfl.cjs → management-D1QXg4YU.cjs} +128 -75
- package/dist/cjs/{router-KeQRduO3.cjs → router-CFErodHU.cjs} +2 -2
- package/dist/cjs/{schemas-nkIxa8sL.cjs → schemas-CukVpc19.cjs} +2 -34
- package/dist/cjs/step-CWYnKbga.d.cts +187 -0
- package/dist/cjs/{validate-CeUCT_7k.cjs → validate-b_bI4mDb.cjs} +4 -3
- package/dist/cjs/{webhooks-CLtDxwMa.cjs → webhooks-DS1BtgED.cjs} +157 -17
- package/dist/es/actions/app-config.d.mts +1 -1
- package/dist/es/actions/app-config.mjs +1 -1
- package/dist/es/actions/config.mjs +28 -7
- package/dist/es/actions/installation.d.mts +2 -2
- package/dist/es/actions/installation.mjs +12 -10
- package/dist/es/actions/registration.d.mts +33 -0
- package/dist/es/actions/registration.mjs +39 -0
- package/dist/es/actions/scope-tree.mjs +1 -1
- package/dist/es/admin-ui-sdk-CCo2SWiL.d.mts +667 -0
- package/dist/es/{app-DJr-mN9d.d.mts → app-DcY6dJiQ.d.mts} +242 -16
- package/dist/es/commands/index.mjs +575 -314
- package/dist/es/commands/templates/admin-ui-sdk/registration.js.template +20 -0
- package/dist/es/config/index.d.mts +558 -62
- package/dist/es/config/index.mjs +4 -4
- package/dist/es/{config-BohwKkQS.mjs → config-DGPFTk6w.mjs} +51 -20
- package/dist/es/{index-BENO5T7n.d.mts → index-CCov0odd.d.mts} +20 -174
- package/dist/es/management/index.d.mts +3 -2
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-ByHvVJ12.mjs → management-CCsOfniv.mjs} +124 -71
- package/dist/es/step-0eI2x4C9.d.mts +187 -0
- package/dist/es/{validate-CqJdGzyZ.mjs → validate-Dn3lLTGj.mjs} +2 -2
- package/dist/es/{webhooks-CYo-pqbR.mjs → webhooks-Dhrkkip7.mjs} +155 -16
- package/package.json +12 -9
- /package/dist/cjs/commands/{generate/actions/templates → templates}/app-management/app-config.js.template +0 -0
- /package/dist/cjs/commands/{generate/actions/templates → templates}/app-management/custom-scripts.js.template +0 -0
- /package/dist/cjs/commands/{generate/actions/templates → templates}/app-management/installation.js.template +0 -0
- /package/dist/cjs/commands/{generate/actions/templates → templates}/business-configuration/config.js.template +0 -0
- /package/dist/cjs/commands/{generate/actions/templates → templates}/business-configuration/scope-tree.js.template +0 -0
- /package/dist/es/commands/{generate/actions/templates → templates}/app-management/app-config.js.template +0 -0
- /package/dist/es/commands/{generate/actions/templates → templates}/app-management/custom-scripts.js.template +0 -0
- /package/dist/es/commands/{generate/actions/templates → templates}/app-management/installation.js.template +0 -0
- /package/dist/es/commands/{generate/actions/templates → templates}/business-configuration/config.js.template +0 -0
- /package/dist/es/commands/{generate/actions/templates → templates}/business-configuration/scope-tree.js.template +0 -0
- /package/dist/es/{schemas-CVXHgUhv.mjs → schemas-DOcnD16x.mjs} +0 -0
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const require_chunk = require('./chunk-DS2yp5vX.cjs');
|
|
16
|
+
const require_schemas = require('./schemas-CukVpc19.cjs');
|
|
17
|
+
const require_webhooks = require('./webhooks-DS1BtgED.cjs');
|
|
17
18
|
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
18
19
|
let valibot = require("valibot");
|
|
19
|
-
valibot =
|
|
20
|
+
valibot = require_chunk.__toESM(valibot, 1);
|
|
20
21
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
21
22
|
|
|
22
23
|
//#region source/config/schema/business-configuration.ts
|
|
@@ -12,26 +12,156 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const require_chunk = require('./chunk-DS2yp5vX.cjs');
|
|
16
|
+
const require_schemas = require('./schemas-CukVpc19.cjs');
|
|
16
17
|
let valibot = require("valibot");
|
|
17
|
-
valibot =
|
|
18
|
+
valibot = require_chunk.__toESM(valibot, 1);
|
|
18
19
|
|
|
19
20
|
//#region source/config/schema/admin-ui-sdk.ts
|
|
21
|
+
const SANDBOX_VALUES = [
|
|
22
|
+
"allow-downloads",
|
|
23
|
+
"allow-modals",
|
|
24
|
+
"allow-popups"
|
|
25
|
+
];
|
|
26
|
+
function isSandboxValue(value) {
|
|
27
|
+
return SANDBOX_VALUES.includes(value);
|
|
28
|
+
}
|
|
29
|
+
const SandboxSchema = valibot.pipe(valibot.string("Expected a string value for \"sandbox\""), valibot.check((val) => val.split(" ").every(isSandboxValue), `sandbox must contain only single-space-separated values from: ${SANDBOX_VALUES.map((t) => `"${t}"`).join(", ")}`));
|
|
30
|
+
const ColumnTypeSchema = valibot.picklist([
|
|
31
|
+
"boolean",
|
|
32
|
+
"date",
|
|
33
|
+
"float",
|
|
34
|
+
"integer",
|
|
35
|
+
"string"
|
|
36
|
+
]);
|
|
37
|
+
const ColumnAlignSchema = valibot.picklist([
|
|
38
|
+
"left",
|
|
39
|
+
"right",
|
|
40
|
+
"center"
|
|
41
|
+
]);
|
|
42
|
+
const ViewButtonLevelSchema = valibot.picklist([
|
|
43
|
+
-1,
|
|
44
|
+
0,
|
|
45
|
+
1
|
|
46
|
+
]);
|
|
47
|
+
const MassActionConfirmSchema = valibot.object({
|
|
48
|
+
title: valibot.optional(require_schemas.nonEmptyStringValueSchema("confirm title")),
|
|
49
|
+
message: valibot.optional(require_schemas.nonEmptyStringValueSchema("confirm message"))
|
|
50
|
+
});
|
|
51
|
+
const ViewButtonConfirmSchema = valibot.object({ message: valibot.optional(require_schemas.nonEmptyStringValueSchema("confirm message")) });
|
|
52
|
+
const iframeActionEntries = {
|
|
53
|
+
displayIframe: valibot.optional(require_schemas.booleanValueSchema("displayIframe")),
|
|
54
|
+
timeout: valibot.optional(require_schemas.positiveNumberValueSchema("timeout")),
|
|
55
|
+
sandbox: valibot.optional(SandboxSchema)
|
|
56
|
+
};
|
|
57
|
+
const GridColumnPropertySchema = valibot.object({
|
|
58
|
+
label: require_schemas.nonEmptyStringValueSchema("column label"),
|
|
59
|
+
columnId: require_schemas.nonEmptyStringValueSchema("column ID"),
|
|
60
|
+
type: ColumnTypeSchema,
|
|
61
|
+
align: ColumnAlignSchema
|
|
62
|
+
});
|
|
63
|
+
const GridColumnsSchema = valibot.object({
|
|
64
|
+
data: valibot.object({ meshId: require_schemas.nonEmptyStringValueSchema("mesh ID") }),
|
|
65
|
+
properties: valibot.pipe(valibot.array(GridColumnPropertySchema), valibot.minLength(1, "At least one grid column property is required"))
|
|
66
|
+
});
|
|
67
|
+
const massActionBaseEntries = {
|
|
68
|
+
actionId: require_schemas.nonEmptyStringValueSchema("mass action ID"),
|
|
69
|
+
label: require_schemas.nonEmptyStringValueSchema("mass action label"),
|
|
70
|
+
title: valibot.optional(require_schemas.nonEmptyStringValueSchema("mass action page title")),
|
|
71
|
+
confirm: valibot.optional(MassActionConfirmSchema),
|
|
72
|
+
path: require_schemas.nonEmptyStringValueSchema("mass action path"),
|
|
73
|
+
...iframeActionEntries
|
|
74
|
+
};
|
|
75
|
+
const sandboxDisplayIframeCheck = valibot.forward(valibot.partialCheck([["sandbox"], ["displayIframe"]], (input) => input.sandbox === void 0 || input.displayIframe === true, "sandbox is only relevant when displayIframe is set to true"), ["sandbox"]);
|
|
76
|
+
function withSandboxDisplayIframeCheck(schema) {
|
|
77
|
+
return valibot.pipe(schema, sandboxDisplayIframeCheck);
|
|
78
|
+
}
|
|
79
|
+
function createMassActionSchema(variantEntries) {
|
|
80
|
+
return withSandboxDisplayIframeCheck(valibot.strictObject({
|
|
81
|
+
...massActionBaseEntries,
|
|
82
|
+
...variantEntries
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
const OrderMassActionSchema = createMassActionSchema({ selectionLimit: valibot.optional(require_schemas.positiveNumberValueSchema("selectionLimit")) });
|
|
86
|
+
const ProductMassActionSchema = createMassActionSchema({ productSelectLimit: valibot.optional(require_schemas.positiveNumberValueSchema("productSelectLimit")) });
|
|
87
|
+
const CustomerMassActionSchema = createMassActionSchema({ customerSelectLimit: valibot.optional(require_schemas.positiveNumberValueSchema("customerSelectLimit")) });
|
|
88
|
+
const OrderViewButtonSchema = withSandboxDisplayIframeCheck(valibot.object({
|
|
89
|
+
buttonId: require_schemas.nonEmptyStringValueSchema("view button ID"),
|
|
90
|
+
label: require_schemas.nonEmptyStringValueSchema("view button label"),
|
|
91
|
+
confirm: valibot.optional(ViewButtonConfirmSchema),
|
|
92
|
+
path: require_schemas.nonEmptyStringValueSchema("view button path"),
|
|
93
|
+
level: valibot.optional(ViewButtonLevelSchema),
|
|
94
|
+
sortOrder: valibot.optional(require_schemas.positiveNumberValueSchema("sortOrder")),
|
|
95
|
+
...iframeActionEntries
|
|
96
|
+
}));
|
|
97
|
+
const CustomFeeSchema = valibot.object({
|
|
98
|
+
id: require_schemas.nonEmptyStringValueSchema("custom fee ID"),
|
|
99
|
+
label: require_schemas.nonEmptyStringValueSchema("custom fee label"),
|
|
100
|
+
value: valibot.number("Custom fee value must be a number"),
|
|
101
|
+
orderMinimumAmount: valibot.optional(valibot.number("orderMinimumAmount must be a number")),
|
|
102
|
+
applyFeeOnLastInvoice: valibot.optional(require_schemas.booleanValueSchema("applyFeeOnLastInvoice")),
|
|
103
|
+
applyFeeOnLastCreditMemo: valibot.optional(require_schemas.booleanValueSchema("applyFeeOnLastCreditMemo"))
|
|
104
|
+
});
|
|
105
|
+
const OrderExtensionPointsSchema = valibot.object({
|
|
106
|
+
massActions: valibot.optional(valibot.array(OrderMassActionSchema)),
|
|
107
|
+
gridColumns: valibot.optional(GridColumnsSchema),
|
|
108
|
+
viewButtons: valibot.optional(valibot.array(OrderViewButtonSchema)),
|
|
109
|
+
customFees: valibot.optional(valibot.array(CustomFeeSchema))
|
|
110
|
+
});
|
|
111
|
+
const ProductExtensionPointsSchema = valibot.object({
|
|
112
|
+
massActions: valibot.optional(valibot.array(ProductMassActionSchema)),
|
|
113
|
+
gridColumns: valibot.optional(GridColumnsSchema)
|
|
114
|
+
});
|
|
115
|
+
const CustomerExtensionPointsSchema = valibot.object({
|
|
116
|
+
massActions: valibot.optional(valibot.array(CustomerMassActionSchema)),
|
|
117
|
+
gridColumns: valibot.optional(GridColumnsSchema)
|
|
118
|
+
});
|
|
119
|
+
const MassActionBannerSchema = valibot.object({
|
|
120
|
+
actionId: require_schemas.nonEmptyStringValueSchema("mass action ID"),
|
|
121
|
+
successMessage: valibot.optional(require_schemas.nonEmptyStringValueSchema("success message")),
|
|
122
|
+
errorMessage: valibot.optional(require_schemas.nonEmptyStringValueSchema("error message"))
|
|
123
|
+
});
|
|
124
|
+
const OrderViewButtonBannerSchema = valibot.object({
|
|
125
|
+
buttonId: require_schemas.nonEmptyStringValueSchema("view button ID"),
|
|
126
|
+
successMessage: valibot.optional(require_schemas.nonEmptyStringValueSchema("success message")),
|
|
127
|
+
errorMessage: valibot.optional(require_schemas.nonEmptyStringValueSchema("error message"))
|
|
128
|
+
});
|
|
129
|
+
const BannerNotificationSchema = valibot.object({
|
|
130
|
+
massActions: valibot.optional(valibot.object({
|
|
131
|
+
order: valibot.optional(valibot.array(MassActionBannerSchema)),
|
|
132
|
+
product: valibot.optional(valibot.array(MassActionBannerSchema)),
|
|
133
|
+
customer: valibot.optional(valibot.array(MassActionBannerSchema))
|
|
134
|
+
})),
|
|
135
|
+
orderViewButtons: valibot.optional(valibot.array(OrderViewButtonBannerSchema))
|
|
136
|
+
});
|
|
137
|
+
const MenuItemSchema = valibot.object({
|
|
138
|
+
id: require_schemas.nonEmptyStringValueSchema("menu item ID"),
|
|
139
|
+
title: valibot.optional(require_schemas.nonEmptyStringValueSchema("menu item title")),
|
|
140
|
+
parent: valibot.optional(require_schemas.nonEmptyStringValueSchema("menu item parent")),
|
|
141
|
+
sortOrder: valibot.optional(valibot.number()),
|
|
142
|
+
isSection: valibot.optional(require_schemas.booleanValueSchema("isSection")),
|
|
143
|
+
sandbox: valibot.optional(SandboxSchema)
|
|
144
|
+
});
|
|
20
145
|
/**
|
|
21
146
|
* Schema for the Admin UI SDK registration parameters (for the `adminUiSdk.registration` config section).
|
|
22
147
|
* @see https://developer.adobe.com/commerce/extensibility/admin-ui-sdk/extension-points/ for more details.
|
|
23
148
|
*/
|
|
24
|
-
const AdminUiSdkRegistrationSchema = valibot.object({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
149
|
+
const AdminUiSdkRegistrationSchema = valibot.object({
|
|
150
|
+
menuItems: valibot.optional(valibot.array(MenuItemSchema)),
|
|
151
|
+
order: valibot.optional(OrderExtensionPointsSchema),
|
|
152
|
+
product: valibot.optional(ProductExtensionPointsSchema),
|
|
153
|
+
customer: valibot.optional(CustomerExtensionPointsSchema),
|
|
154
|
+
bannerNotification: valibot.optional(BannerNotificationSchema)
|
|
155
|
+
});
|
|
156
|
+
/**
|
|
157
|
+
* Schema for Admin UI SDK configuration.
|
|
158
|
+
* @experimental
|
|
159
|
+
*/
|
|
33
160
|
const AdminUiSdkSchema = valibot.object({ registration: AdminUiSdkRegistrationSchema });
|
|
34
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* Check if config has Admin UI SDK registration configuration.
|
|
163
|
+
* @experimental
|
|
164
|
+
*/
|
|
35
165
|
function hasAdminUiSdk(config) {
|
|
36
166
|
return config.adminUiSdk !== void 0 && config.adminUiSdk.registration !== void 0;
|
|
37
167
|
}
|
|
@@ -61,6 +191,12 @@ const EXTERNAL_EVENT_NAME_REGEX = /^[\w\-_.]+$/;
|
|
|
61
191
|
*/
|
|
62
192
|
const FIELD_NAME_REGEX = /^([a-zA-Z0-9_\-.[\]]+|\*)$/;
|
|
63
193
|
/**
|
|
194
|
+
* Regex for Adobe I/O Events API text fields (label, description).
|
|
195
|
+
* Valid characters per API: letters, numbers, spaces, underscores, hyphens,
|
|
196
|
+
* dots, colons, parentheses, commas, @, and /.
|
|
197
|
+
*/
|
|
198
|
+
const IO_EVENTS_TEXT_REGEX = /^[a-zA-Z0-9 _.:()\-,@/]+$/;
|
|
199
|
+
/**
|
|
64
200
|
* Schema for Commerce event names.
|
|
65
201
|
* Validates that the event name starts with "plugin." or "observer."
|
|
66
202
|
* followed by one or more dot-separated lowercase segments containing letters
|
|
@@ -85,6 +221,10 @@ function externalEventNameSchema() {
|
|
|
85
221
|
function fieldNameSchema() {
|
|
86
222
|
return valibot.pipe(require_schemas.nonEmptyStringValueSchema("field name"), valibot.regex(FIELD_NAME_REGEX, "Field name must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), dashes (-), dots (.), and square brackets ([, ]), or be exactly \"*\""));
|
|
87
223
|
}
|
|
224
|
+
/** Validates that a text field contains only characters accepted by the Adobe I/O Events API. */
|
|
225
|
+
function ioEventsTextSchema(name) {
|
|
226
|
+
return valibot.regex(IO_EVENTS_TEXT_REGEX, `${name} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`);
|
|
227
|
+
}
|
|
88
228
|
/**
|
|
89
229
|
* Schema for field objects in Commerce events.
|
|
90
230
|
* Each field has a required name and an optional source.
|
|
@@ -97,14 +237,14 @@ function commerceEventFieldSchema() {
|
|
|
97
237
|
}
|
|
98
238
|
/** Schema for event provider configuration */
|
|
99
239
|
const ProviderSchema = valibot.object({
|
|
100
|
-
label: valibot.pipe(require_schemas.nonEmptyStringValueSchema("provider label"), valibot.maxLength(MAX_LABEL_LENGTH, `The provider label must not be longer than ${MAX_LABEL_LENGTH} characters`)),
|
|
101
|
-
description: valibot.pipe(require_schemas.nonEmptyStringValueSchema("provider description"), valibot.maxLength(MAX_DESCRIPTION_LENGTH$1, `The provider description must not be longer than ${MAX_DESCRIPTION_LENGTH$1} characters`)),
|
|
240
|
+
label: valibot.pipe(require_schemas.nonEmptyStringValueSchema("provider label"), ioEventsTextSchema("Provider label"), valibot.maxLength(MAX_LABEL_LENGTH, `The provider label must not be longer than ${MAX_LABEL_LENGTH} characters`)),
|
|
241
|
+
description: valibot.pipe(require_schemas.nonEmptyStringValueSchema("provider description"), ioEventsTextSchema("Provider description"), valibot.maxLength(MAX_DESCRIPTION_LENGTH$1, `The provider description must not be longer than ${MAX_DESCRIPTION_LENGTH$1} characters`)),
|
|
102
242
|
key: valibot.optional(valibot.pipe(require_schemas.alphaNumericOrHyphenSchema("provider key"), valibot.maxLength(MAX_KEY_LENGTH, `The provider key must not be longer than ${MAX_KEY_LENGTH} characters`)))
|
|
103
243
|
});
|
|
104
244
|
/** Schema for base shared properties between event types. */
|
|
105
245
|
const BaseEventSchema = valibot.object({
|
|
106
|
-
label: valibot.pipe(require_schemas.nonEmptyStringValueSchema("event label"), valibot.maxLength(MAX_LABEL_LENGTH, `The event label must not be longer than ${MAX_LABEL_LENGTH} characters`)),
|
|
107
|
-
description: valibot.pipe(require_schemas.nonEmptyStringValueSchema("event description"), valibot.maxLength(MAX_DESCRIPTION_LENGTH$1, `The event description must not be longer than ${MAX_DESCRIPTION_LENGTH$1} characters`)),
|
|
246
|
+
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`)),
|
|
247
|
+
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`)),
|
|
108
248
|
runtimeActions: valibot.array(valibot.pipe(require_schemas.nonEmptyStringValueSchema("runtime action"), valibot.regex(/^[a-z0-9-]+\/[a-z0-9-]+$/i, "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>")
|
|
109
249
|
});
|
|
110
250
|
/**
|
|
@@ -130,7 +270,7 @@ const CommerceEventRuleSchema = valibot.object({
|
|
|
130
270
|
const CommerceEventSchema = valibot.object({
|
|
131
271
|
...BaseEventSchema.entries,
|
|
132
272
|
name: commerceEventNameSchema(),
|
|
133
|
-
fields: valibot.array(commerceEventFieldSchema(), "Expected an array of event field objects with a 'name' property"),
|
|
273
|
+
fields: valibot.pipe(valibot.array(commerceEventFieldSchema(), "Expected an array of event field objects with a 'name' property"), valibot.minLength(1, "The Commerce event configuration must define at least one field")),
|
|
134
274
|
rules: valibot.optional(valibot.array(CommerceEventRuleSchema, "Expected an array of event rules with field, operator, and value")),
|
|
135
275
|
destination: valibot.optional(require_schemas.nonEmptyStringValueSchema("destination")),
|
|
136
276
|
hipaa_audit_required: valibot.optional(require_schemas.booleanValueSchema("hipaa_audit_required")),
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as CommerceAppConfigOutputModel } from "../app-
|
|
15
|
+
import { n as CommerceAppConfigOutputModel } from "../app-DcY6dJiQ.mjs";
|
|
16
16
|
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
17
17
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
18
18
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
-
import { t as validateCommerceAppConfig } from "../validate-
|
|
16
|
+
import { t as validateCommerceAppConfig } from "../validate-Dn3lLTGj.mjs";
|
|
17
17
|
import { ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
18
18
|
|
|
19
19
|
//#region source/actions/app-config.ts
|
|
@@ -13,14 +13,26 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { r as nonEmptyStringValueSchema } from "../schemas-DOcnD16x.mjs";
|
|
17
|
+
import { n as validateCommerceAppConfigDomain } from "../validate-Dn3lLTGj.mjs";
|
|
18
18
|
import { ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
19
19
|
import * as v from "valibot";
|
|
20
20
|
import { byScopeId, getConfiguration, initialize, setConfiguration } from "@adobe/aio-commerce-lib-config";
|
|
21
21
|
|
|
22
22
|
//#region source/actions/config.ts
|
|
23
23
|
const MASKED_PASSWORD_VALUE = "*****";
|
|
24
|
+
/** The set of valid Commerce environments a configuration field can be scoped to. */
|
|
25
|
+
const COMMERCE_ENVS = ["paas", "saas"];
|
|
26
|
+
/**
|
|
27
|
+
* Filters a business configuration schema to the fields applicable to the
|
|
28
|
+
* given Commerce environment. Fields without an `env` property apply to all
|
|
29
|
+
* environments and are always included.
|
|
30
|
+
* @param schema - The business configuration schema to filter.
|
|
31
|
+
* @param env - The Commerce environment to filter by.
|
|
32
|
+
*/
|
|
33
|
+
function filterSchemaByEnv(schema, env) {
|
|
34
|
+
return schema.filter((field) => field.env === void 0 || field.env.includes(env));
|
|
35
|
+
}
|
|
24
36
|
/**
|
|
25
37
|
* Filters password fields from the configuration values.
|
|
26
38
|
* @param schema - The schema to use to filter the values.
|
|
@@ -39,20 +51,25 @@ function filterPasswordFields(schema, values) {
|
|
|
39
51
|
const router = new HttpActionRouter().use(logger());
|
|
40
52
|
/** GET / - Retrieve configuration */
|
|
41
53
|
router.get("/", {
|
|
42
|
-
query: v.object({
|
|
54
|
+
query: v.object({
|
|
55
|
+
scopeId: nonEmptyStringValueSchema("scopeId"),
|
|
56
|
+
commerceEnv: v.optional(v.picklist(COMMERCE_ENVS))
|
|
57
|
+
}),
|
|
43
58
|
handler: async (req, ctx) => {
|
|
44
59
|
const { logger, rawParams } = ctx;
|
|
45
60
|
const configSchema = rawParams.configSchema;
|
|
46
61
|
logger.debug("Validating configuration schema...");
|
|
47
62
|
const validatedSchema = validateCommerceAppConfigDomain(configSchema, "businessConfig.schema");
|
|
48
|
-
|
|
63
|
+
const env = req.query.commerceEnv;
|
|
64
|
+
const filteredSchema = env ? filterSchemaByEnv(validatedSchema, env) : validatedSchema;
|
|
65
|
+
initialize({ schema: filteredSchema });
|
|
49
66
|
const { scopeId } = req.query;
|
|
50
67
|
logger.debug(`Retrieving configuration with scope id: ${scopeId}`);
|
|
51
68
|
const appConfiguration = await getConfiguration(byScopeId(scopeId), { encryptionKey: rawParams.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY });
|
|
52
69
|
logger.debug("Masking password values...");
|
|
53
|
-
appConfiguration.config = filterPasswordFields(
|
|
70
|
+
appConfiguration.config = filterPasswordFields(filteredSchema, appConfiguration.config);
|
|
54
71
|
return ok({ body: {
|
|
55
|
-
schema:
|
|
72
|
+
schema: filteredSchema,
|
|
56
73
|
values: appConfiguration
|
|
57
74
|
} });
|
|
58
75
|
}
|
|
@@ -93,7 +110,11 @@ router.patch("/", {
|
|
|
93
110
|
scopeId: nonEmptyStringValueSchema("scopeId"),
|
|
94
111
|
config: v.array(v.object({
|
|
95
112
|
name: nonEmptyStringValueSchema("config.name"),
|
|
96
|
-
value: v.nullable(v.union([
|
|
113
|
+
value: v.nullable(v.union([
|
|
114
|
+
v.boolean(),
|
|
115
|
+
v.string(),
|
|
116
|
+
v.array(v.string())
|
|
117
|
+
]))
|
|
97
118
|
}))
|
|
98
119
|
}),
|
|
99
120
|
handler: async (req, ctx) => {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as CommerceAppConfigOutputModel } from "../app-
|
|
16
|
-
import {
|
|
15
|
+
import { n as CommerceAppConfigOutputModel } from "../app-DcY6dJiQ.mjs";
|
|
16
|
+
import { o as InstallationContext } from "../step-0eI2x4C9.mjs";
|
|
17
17
|
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
18
18
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
19
19
|
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
-
import { r as nonEmptyStringValueSchema } from "../schemas-
|
|
17
|
-
import { a as runValidation, c as isFailedState, i as runUninstallation, l as isInProgressState, n as createInitialUninstallationState, r as runInstallation, s as isCompletedState, t as createInitialInstallationState, u as isSucceededState } from "../management-
|
|
16
|
+
import { r as nonEmptyStringValueSchema } from "../schemas-DOcnD16x.mjs";
|
|
17
|
+
import { a as runValidation, c as isFailedState, i as runUninstallation, l as isInProgressState, n as createInitialUninstallationState, r as runInstallation, s as isCompletedState, t as createInitialInstallationState, u as isSucceededState } from "../management-CCsOfniv.mjs";
|
|
18
18
|
import { accepted, badRequest, conflict, internalServerError, noContent, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
19
19
|
import * as v from "valibot";
|
|
20
20
|
import { object, string } from "valibot";
|
|
@@ -338,10 +338,10 @@ function createInstallationHooks(store, logFn) {
|
|
|
338
338
|
return {
|
|
339
339
|
onInstallationStart: (state) => logAndSave("Installation started", state),
|
|
340
340
|
onInstallationFailure: (state) => logAndSave("Installation failed", state),
|
|
341
|
-
onInstallationSuccess: (state) => logAndSave("Installation succeeded", state),
|
|
341
|
+
onInstallationSuccess: (state) => logAndSave(state.status === "succeeded" && state.metadata?.isRetry ? "Installation succeeded on retry" : "Installation succeeded", state),
|
|
342
342
|
onStepStart: (event, state) => logAndSave(`Step started: ${event.stepName}`, state),
|
|
343
343
|
onStepSuccess: (event, state) => logAndSave(`Step succeeded: ${event.stepName}`, state),
|
|
344
|
-
onStepFailure: (event, state) => logAndSave(`Step failed: ${event.stepName}`, state)
|
|
344
|
+
onStepFailure: (event, state) => logAndSave(`Step failed: ${event.stepName} — ${event.error.message ?? `(key: ${event.error.key})`}`, state)
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
@@ -381,7 +381,8 @@ router.get("/", { handler: async (_req, { logger }) => {
|
|
|
381
381
|
router.post("/", {
|
|
382
382
|
body: InstallationRequestBodySchema,
|
|
383
383
|
handler: async (req, { logger, rawParams }) => {
|
|
384
|
-
|
|
384
|
+
const { appData, commerceBaseUrl } = req.body;
|
|
385
|
+
logger.debug(`Starting installation for app "${appData.projectName}" (workspace: "${appData.workspaceName}", commerce: "${commerceBaseUrl}")`);
|
|
385
386
|
const store = await createInstallationStore();
|
|
386
387
|
const existingState = await store.get(getStorageKey());
|
|
387
388
|
if (existingState) {
|
|
@@ -430,13 +431,13 @@ router.post("/", {
|
|
|
430
431
|
*/
|
|
431
432
|
router.post("/execution", { handler: async (_req, { logger, rawParams }) => {
|
|
432
433
|
const params = rawParams;
|
|
433
|
-
const { initialState, appConfig } = params;
|
|
434
|
+
const { initialState, appConfig, appData, AIO_COMMERCE_API_BASE_URL } = params;
|
|
434
435
|
if (!initialState) return badRequest("initialState is required for execution");
|
|
435
436
|
if (!appConfig) return badRequest("appConfig is required for execution");
|
|
436
437
|
const store = await createInstallationStore();
|
|
437
438
|
const hooks = createInstallationHooks(store, (msg) => logger.debug(msg));
|
|
438
439
|
const installationContext = buildInstallationContext(params, appConfig, logger);
|
|
439
|
-
logger.debug(`Executing installation
|
|
440
|
+
logger.debug(`Executing installation ${initialState.id} for app "${appData.projectName}" (workspace: "${appData.workspaceName}", commerce: "${AIO_COMMERCE_API_BASE_URL}")`);
|
|
440
441
|
const result = await runInstallation({
|
|
441
442
|
installationContext,
|
|
442
443
|
config: appConfig,
|
|
@@ -505,7 +506,8 @@ router.get("/uninstallation", { handler: async (_req, { logger }) => {
|
|
|
505
506
|
router.post("/uninstallation", {
|
|
506
507
|
body: InstallationRequestBodySchema,
|
|
507
508
|
handler: async (req, { logger, rawParams }) => {
|
|
508
|
-
|
|
509
|
+
const { appData, commerceBaseUrl } = req.body;
|
|
510
|
+
logger.debug(`Starting uninstallation for app "${appData.projectName}" (workspace: "${appData.workspaceName}", commerce: "${commerceBaseUrl}")`);
|
|
509
511
|
const appConfig = rawParams.appConfig;
|
|
510
512
|
if (!appConfig) return internalServerError("Could not find or parse the app.commerce.manifest.json file, is it present and valid?");
|
|
511
513
|
const store = await createUninstallationStore();
|
|
@@ -550,13 +552,13 @@ router.post("/uninstallation", {
|
|
|
550
552
|
*/
|
|
551
553
|
router.post("/uninstallation/execution", { handler: async (_req, { logger, rawParams }) => {
|
|
552
554
|
const params = rawParams;
|
|
553
|
-
const { initialState, appConfig } = params;
|
|
555
|
+
const { initialState, appConfig, appData, AIO_COMMERCE_API_BASE_URL } = params;
|
|
554
556
|
if (!initialState) return badRequest("initialState is required for execution");
|
|
555
557
|
if (!appConfig) return badRequest("appConfig is required for execution");
|
|
556
558
|
const store = await createUninstallationStore();
|
|
557
559
|
const hooks = createInstallationHooks(store, (msg) => logger.debug(msg));
|
|
558
560
|
const installationContext = buildInstallationContext(params, appConfig, logger);
|
|
559
|
-
logger.debug(`Executing uninstallation
|
|
561
|
+
logger.debug(`Executing uninstallation ${initialState.id} for app "${appData.projectName}" (workspace: "${appData.workspaceName}", commerce: "${AIO_COMMERCE_API_BASE_URL}")`);
|
|
560
562
|
const result = await runUninstallation({
|
|
561
563
|
installationContext,
|
|
562
564
|
config: appConfig,
|
|
@@ -0,0 +1,33 @@
|
|
|
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 AdminUiSdkRegistration } from "../admin-ui-sdk-CCo2SWiL.mjs";
|
|
16
|
+
import * as _$_adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
17
|
+
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
18
|
+
|
|
19
|
+
//#region source/actions/registration.d.ts
|
|
20
|
+
/** Arguments for the registration runtime action factory. */
|
|
21
|
+
type RegistrationActionArgs = {
|
|
22
|
+
registration: AdminUiSdkRegistration;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Factory to create the route handler for the `registration` action.
|
|
26
|
+
* @param args - The registration configuration to inline in the action.
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
|
+
declare const registrationRuntimeAction: ({
|
|
30
|
+
registration
|
|
31
|
+
}: RegistrationActionArgs) => (params: RuntimeActionParams) => Promise<_$_adobe_aio_commerce_lib_core_responses0.ActionResponse>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { registrationRuntimeAction };
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
17
|
+
|
|
18
|
+
//#region source/actions/registration.ts
|
|
19
|
+
/** Router for the registration action. */
|
|
20
|
+
const router = new HttpActionRouter().use(logger({ name: () => "registration" }));
|
|
21
|
+
/** GET / - Return Admin UI SDK registration object */
|
|
22
|
+
router.get("/", { handler: async (_req, { logger, rawParams }) => {
|
|
23
|
+
logger.debug("Returning Admin UI SDK registration...");
|
|
24
|
+
return ok({ body: { registration: rawParams.registration } });
|
|
25
|
+
} });
|
|
26
|
+
/**
|
|
27
|
+
* Factory to create the route handler for the `registration` action.
|
|
28
|
+
* @param args - The registration configuration to inline in the action.
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
31
|
+
const registrationRuntimeAction = ({ registration }) => async (params) => {
|
|
32
|
+
return await router.handler()({
|
|
33
|
+
...params,
|
|
34
|
+
registration
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { registrationRuntimeAction };
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { n as logger, t as HttpActionRouter } from "../router-BxaxEEu3.mjs";
|
|
16
|
-
import { r as nonEmptyStringValueSchema } from "../schemas-
|
|
16
|
+
import { r as nonEmptyStringValueSchema } from "../schemas-DOcnD16x.mjs";
|
|
17
17
|
import { t as inspect } from "../logging-XIUXDK5T.mjs";
|
|
18
18
|
import { internalServerError, nonAuthoritativeInformation, ok } from "@adobe/aio-commerce-lib-core/responses";
|
|
19
19
|
import * as v from "valibot";
|