@adobe/aio-commerce-lib-app 1.6.0 → 1.7.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 +23 -0
- package/dist/cjs/actions/app-config/index.cjs +202 -0
- package/dist/cjs/actions/app-config/index.d.cts +31 -0
- package/dist/cjs/actions/{config.cjs → config/index.cjs} +61 -33
- package/dist/{es/actions/config.d.mts → cjs/actions/config/index.d.cts} +10 -7
- package/dist/cjs/actions/{installation.cjs → installation/index.cjs} +43 -30
- package/dist/{es/actions/installation.d.mts → cjs/actions/installation/index.d.cts} +10 -8
- package/dist/cjs/actions/{registration.cjs → registration/index.cjs} +16 -6
- package/dist/cjs/actions/{registration.d.cts → registration/index.d.cts} +8 -8
- package/dist/cjs/actions/{scope-tree.cjs → scope-tree/index.cjs} +51 -14
- package/dist/cjs/actions/{scope-tree.d.cts → scope-tree/index.d.cts} +1 -1
- package/dist/cjs/{admin-ui-sdk-DZZJCrdT.d.cts → admin-ui-sdk-EU915zlR.d.cts} +7 -8
- package/dist/cjs/app-DrYHK-z1.d.cts +1629 -0
- package/dist/cjs/commands/index.cjs +12 -18
- package/dist/cjs/config/index.cjs +2 -2
- package/dist/cjs/config/index.d.cts +36 -976
- package/dist/cjs/{config-FNMclIFO.cjs → config-D-s0GSep.cjs} +1 -1
- package/dist/cjs/{index-Dw2NvVOY.d.cts → index-B5gJ-q4U.d.cts} +172 -3
- package/dist/{es/actions/app-config.d.mts → cjs/index-BXm8UbK7.d.cts} +1 -13
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +1 -2
- package/dist/cjs/{management-Cvsz4VMf.cjs → management-Dehz9qSJ.cjs} +81 -43
- package/dist/cjs/openapi-Cux6K4ZD.cjs +3072 -0
- package/dist/cjs/{validate-DydOAZha.cjs → validate-oAOpyFyb.cjs} +46 -14
- package/dist/es/actions/app-config/index.d.mts +31 -0
- package/dist/es/actions/app-config/index.mjs +199 -0
- package/dist/{cjs/actions/config.d.cts → es/actions/config/index.d.mts} +10 -7
- package/dist/es/actions/{config.mjs → config/index.mjs} +60 -32
- package/dist/{cjs/actions/installation.d.cts → es/actions/installation/index.d.mts} +10 -8
- package/dist/es/actions/{installation.mjs → installation/index.mjs} +42 -30
- package/dist/es/actions/{registration.d.mts → registration/index.d.mts} +8 -8
- package/dist/es/actions/{registration.mjs → registration/index.mjs} +16 -6
- package/dist/es/actions/{scope-tree.d.mts → scope-tree/index.d.mts} +1 -1
- package/dist/es/actions/{scope-tree.mjs → scope-tree/index.mjs} +50 -13
- package/dist/es/{admin-ui-sdk-hu6iWr0A.d.mts → admin-ui-sdk-BwnD0xjK.d.mts} +6 -9
- package/dist/es/app-DrYHK-z1.d.mts +1629 -0
- package/dist/es/commands/index.mjs +12 -18
- package/dist/es/config/index.d.mts +36 -975
- package/dist/es/config/index.mjs +2 -2
- package/dist/es/{config-CcE0EBG7.mjs → config-3I4eLyyR.mjs} +1 -1
- package/dist/{cjs/actions/app-config.d.cts → es/index-B0XqHwY5.d.mts} +2 -14
- package/dist/es/{index-Bo0tQsVq.d.mts → index-DLMbTtKS.d.mts} +172 -3
- package/dist/es/management/index.d.mts +1 -2
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-BZ4Y6lVp.mjs → management-BUX-w2Ji.mjs} +81 -44
- package/dist/es/openapi-B6uP0SRn.mjs +3024 -0
- package/dist/es/{validate-Du3LhCre.mjs → validate-Dfajrp99.mjs} +35 -15
- package/package.json +17 -10
- package/dist/cjs/actions/app-config.cjs +0 -54
- package/dist/cjs/app-CakwxQvs.d.cts +0 -673
- package/dist/cjs/step-CKVE0aJi.d.cts +0 -187
- package/dist/es/actions/app-config.mjs +0 -53
- package/dist/es/app-CakwxQvs.d.mts +0 -673
- package/dist/es/step-D64mMPrt.d.mts +0 -187
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as AdminUiSdkRegistration } from "
|
|
15
|
+
import { n as AdminUiSdkRegistration } from "../../admin-ui-sdk-EU915zlR.cjs";
|
|
16
16
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
17
17
|
|
|
18
|
-
//#region source/actions/registration.d.ts
|
|
19
|
-
/**
|
|
20
|
-
type
|
|
18
|
+
//#region source/actions/registration/router.d.ts
|
|
19
|
+
/** The arguments required to create the runtime action for the registration action. */
|
|
20
|
+
type RuntimeActionFactoryArgs = {
|
|
21
21
|
registration: AdminUiSdkRegistration;
|
|
22
22
|
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region source/actions/registration/index.d.ts
|
|
23
25
|
/**
|
|
24
26
|
* Factory to create the route handler for the `registration` action.
|
|
25
|
-
* @param args - The
|
|
27
|
+
* @param args - The arguments required to create the runtime action.
|
|
26
28
|
* @experimental
|
|
27
29
|
*/
|
|
28
|
-
declare const registrationRuntimeAction: (
|
|
29
|
-
registration
|
|
30
|
-
}: RegistrationActionArgs) => (params: RuntimeActionParams) => Promise<import("@adobe/aio-commerce-lib-core/responses").ActionResponse>;
|
|
30
|
+
declare const registrationRuntimeAction: (args: RuntimeActionFactoryArgs) => (params: RuntimeActionParams) => Promise<import("@adobe/aio-commerce-lib-core/responses").ActionResponse>;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { registrationRuntimeAction };
|
|
@@ -13,18 +13,46 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_chunk = require('
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
16
|
+
const require_chunk = require('../../chunk-Cozy-1ZF.cjs');
|
|
17
|
+
const require_schemas = require('../../schemas-FngDuIeo.cjs');
|
|
18
|
+
const require_logging = require('../../logging-BVz3weoC.cjs');
|
|
19
|
+
const require_router = require('../../router-BOR7T6qR.cjs');
|
|
20
20
|
let _adobe_aio_commerce_lib_config = require("@adobe/aio-commerce-lib-config");
|
|
21
|
-
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
22
21
|
let valibot = require("valibot");
|
|
23
22
|
valibot = require_chunk.__toESM(valibot, 1);
|
|
24
23
|
let _adobe_aio_commerce_lib_api = require("@adobe/aio-commerce-lib-api");
|
|
24
|
+
let _adobe_aio_commerce_lib_core_responses = require("@adobe/aio-commerce-lib-core/responses");
|
|
25
|
+
|
|
26
|
+
//#region source/actions/scope-tree/schema.ts
|
|
27
|
+
const CustomScopeInputSchema = valibot.object({
|
|
28
|
+
id: valibot.optional(valibot.string()),
|
|
29
|
+
code: valibot.string(),
|
|
30
|
+
label: valibot.string(),
|
|
31
|
+
level: valibot.optional(valibot.string()),
|
|
32
|
+
is_editable: valibot.boolean(),
|
|
33
|
+
is_final: valibot.boolean(),
|
|
34
|
+
children: valibot.optional(valibot.array(valibot.lazy(() => CustomScopeInputSchema)))
|
|
35
|
+
});
|
|
36
|
+
/** Request body for PUT / */
|
|
37
|
+
const SetCustomScopeTreeBodySchema = valibot.object({ scopes: valibot.array(CustomScopeInputSchema) });
|
|
38
|
+
/** Request body for POST /commerce */
|
|
39
|
+
const SyncCommerceScopesBodySchema = valibot.object({
|
|
40
|
+
commerceBaseUrl: require_schemas.nonEmptyStringValueSchema("commerceBaseUrl"),
|
|
41
|
+
commerceEnv: valibot.optional(require_schemas.nonEmptyStringValueSchema("commerceEnv"))
|
|
42
|
+
});
|
|
25
43
|
|
|
26
|
-
//#
|
|
27
|
-
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region source/actions/scope-tree/router.ts
|
|
46
|
+
/**
|
|
47
|
+
* Scope Tree action router.
|
|
48
|
+
*
|
|
49
|
+
* Routes:
|
|
50
|
+
* - GET / Retrieve the scope tree.
|
|
51
|
+
* - PUT / Set custom scope tree.
|
|
52
|
+
* - POST /commerce Sync commerce scopes
|
|
53
|
+
* - DELETE /commerce Unsync commerce scopes
|
|
54
|
+
*/
|
|
55
|
+
const router = new require_router.HttpActionRouter().use(require_router.logger({ name: () => "scope-tree" }));
|
|
28
56
|
/** GET / - Get scope tree */
|
|
29
57
|
router.get("/", { handler: async (_req, ctx) => {
|
|
30
58
|
const { logger } = ctx;
|
|
@@ -36,15 +64,24 @@ router.get("/", { handler: async (_req, ctx) => {
|
|
|
36
64
|
});
|
|
37
65
|
return (0, _adobe_aio_commerce_lib_core_responses.ok)({ body: { scopes: result.scopeTree } });
|
|
38
66
|
} });
|
|
39
|
-
/**
|
|
67
|
+
/** PUT / - Set custom scope tree */
|
|
40
68
|
router.put("/", {
|
|
41
|
-
body:
|
|
69
|
+
body: SetCustomScopeTreeBodySchema,
|
|
42
70
|
handler: async (req, ctx) => {
|
|
43
71
|
const { logger } = ctx;
|
|
44
72
|
logger.debug(`Setting custom scope tree with ${req.body.scopes?.length || 0} scopes`);
|
|
45
73
|
const request = { scopes: req.body.scopes };
|
|
74
|
+
let result;
|
|
46
75
|
logger.debug(`Setting custom scope tree: ${require_logging.inspect(request)}`);
|
|
47
|
-
|
|
76
|
+
try {
|
|
77
|
+
result = await (0, _adobe_aio_commerce_lib_config.setCustomScopeTree)(request);
|
|
78
|
+
} catch (err) {
|
|
79
|
+
if (err instanceof Error && "isValidationError" in err) {
|
|
80
|
+
logger.debug(`Custom scope tree validation failed: ${err.message}`);
|
|
81
|
+
return (0, _adobe_aio_commerce_lib_core_responses.badRequest)({ body: { message: err.message } });
|
|
82
|
+
}
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
48
85
|
logger.debug(`Successfully set custom scope tree: ${require_logging.inspect(result)}`);
|
|
49
86
|
return (0, _adobe_aio_commerce_lib_core_responses.ok)({
|
|
50
87
|
body: { result },
|
|
@@ -54,10 +91,7 @@ router.put("/", {
|
|
|
54
91
|
});
|
|
55
92
|
/** POST /commerce - Sync commerce scopes */
|
|
56
93
|
router.post("/commerce", {
|
|
57
|
-
body:
|
|
58
|
-
commerceBaseUrl: require_schemas.nonEmptyStringValueSchema("commerceBaseUrl"),
|
|
59
|
-
commerceEnv: valibot.optional(require_schemas.nonEmptyStringValueSchema("commerceEnv"))
|
|
60
|
-
}),
|
|
94
|
+
body: SyncCommerceScopesBodySchema,
|
|
61
95
|
handler: async (req, ctx) => {
|
|
62
96
|
const { logger } = ctx;
|
|
63
97
|
logger.debug("Syncing commerce scopes...");
|
|
@@ -105,6 +139,9 @@ router.delete("/commerce", { handler: async (_req, ctx) => {
|
|
|
105
139
|
logger.debug(message);
|
|
106
140
|
return (0, _adobe_aio_commerce_lib_core_responses.ok)(message);
|
|
107
141
|
} });
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region source/actions/scope-tree/index.ts
|
|
108
145
|
/** The handler method for the `scope-tree` action. */
|
|
109
146
|
const scopeTreeRuntimeAction = router.handler();
|
|
110
147
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
//#region source/actions/scope-tree.d.ts
|
|
15
|
+
//#region source/actions/scope-tree/index.d.ts
|
|
16
16
|
/** The handler method for the `scope-tree` action. */
|
|
17
17
|
declare const scopeTreeRuntimeAction: (args: import("@adobe/aio-commerce-lib-core/params").RuntimeActionParams) => Promise<import("@adobe/aio-commerce-lib-core/responses").ActionResponse>;
|
|
18
18
|
//#endregion
|
|
@@ -12,14 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { r as CommerceAppConfigOutputModel, t as AnyCommerceAppConfig } from "./app-DrYHK-z1.cjs";
|
|
16
16
|
import * as v from "valibot";
|
|
17
|
-
|
|
18
|
-
/** Config type when Admin UI SDK registration is configured. */
|
|
19
|
-
type AdminUiSdkConfig = CommerceAppConfigOutputModel & {
|
|
20
|
-
adminUiSdk: NonNullable<CommerceAppConfigOutputModel["adminUiSdk"]>;
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
17
|
+
|
|
23
18
|
//#region source/config/schema/admin-ui-sdk.d.ts
|
|
24
19
|
declare const GridColumnsSchema: v.ObjectSchema<{
|
|
25
20
|
readonly data: v.ObjectSchema<{
|
|
@@ -656,10 +651,14 @@ type BannerNotification = v.InferInput<typeof BannerNotificationSchema>;
|
|
|
656
651
|
* @experimental
|
|
657
652
|
*/
|
|
658
653
|
type MenuItem = v.InferInput<typeof MenuItemSchema>;
|
|
654
|
+
/** Config type when Admin UI SDK registration is configured. */
|
|
655
|
+
type AppConfigWithAdminUiSdk<T extends AnyCommerceAppConfig = CommerceAppConfigOutputModel> = T & {
|
|
656
|
+
adminUiSdk: NonNullable<T["adminUiSdk"]>;
|
|
657
|
+
};
|
|
659
658
|
/**
|
|
660
659
|
* Check if config has Admin UI SDK registration configuration.
|
|
661
660
|
* @experimental
|
|
662
661
|
*/
|
|
663
|
-
declare function hasAdminUiSdk(config:
|
|
662
|
+
declare function hasAdminUiSdk<T extends AnyCommerceAppConfig>(config: T): config is T & AppConfigWithAdminUiSdk<T>;
|
|
664
663
|
//#endregion
|
|
665
664
|
export { CustomerMassAction as a, OrderMassAction as c, hasAdminUiSdk as d, CustomFee as i, OrderViewButton as l, AdminUiSdkRegistration as n, GridColumns as o, BannerNotification as r, MenuItem as s, AdminUiSdkConfiguration as t, ProductMassAction as u };
|