@adobe/aio-commerce-lib-app 0.2.0 → 0.3.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 +14 -0
- package/dist/cjs/actions/index.cjs +815 -170
- package/dist/cjs/actions/index.d.cts +2 -2
- package/dist/cjs/app-Dx0ca6oL.d.cts +181 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/get-config-schema.js.template +63 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/get-configuration.js.template +104 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/get-scope-tree.js.template +69 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/set-configuration.js.template +125 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/set-custom-scope-tree.js.template +83 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/sync-commerce-scopes.js.template +113 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/unsync-commerce-scopes.js.template +56 -0
- package/dist/cjs/commands/index.cjs +1075 -119
- package/dist/cjs/config/index.cjs +20 -1
- package/dist/cjs/config/index.d.cts +532 -3
- package/dist/cjs/config-JQ_n-5Nk.cjs +565 -0
- package/dist/cjs/error-Byj1DVHZ.cjs +344 -0
- package/dist/cjs/{index-DS3IlISO.d.cts → index-C5SutkJQ.d.cts} +1 -1
- package/dist/cjs/logging-DYwr5WQk.cjs +25 -0
- package/dist/cjs/management/index.cjs +9 -1
- package/dist/cjs/management/index.d.cts +1 -1
- package/dist/cjs/management-Dm5h0E6l.cjs +1246 -0
- package/dist/es/actions/index.d.mts +2 -2
- package/dist/es/actions/index.mjs +813 -170
- package/dist/es/app-Cx1-6dn0.d.mts +181 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/get-config-schema.js.template +63 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/get-configuration.js.template +104 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/get-scope-tree.js.template +69 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/set-configuration.js.template +125 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/set-custom-scope-tree.js.template +83 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/sync-commerce-scopes.js.template +113 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/unsync-commerce-scopes.js.template +56 -0
- package/dist/es/commands/index.mjs +1070 -119
- package/dist/es/config/index.d.mts +532 -3
- package/dist/es/config/index.mjs +4 -1
- package/dist/es/config-BSGerqCG.mjs +457 -0
- package/dist/es/error-P7JgUTds.mjs +251 -0
- package/dist/es/{index-DQepSWYP.d.mts → index-Bxr3zvCT.d.mts} +2 -2
- package/dist/es/logging-VgerMhp6.mjs +18 -0
- package/dist/es/management/index.d.mts +2 -2
- package/dist/es/management/index.mjs +3 -1
- package/dist/es/management-Y7pwEbNI.mjs +1204 -0
- package/package.json +20 -8
- package/dist/cjs/app-C4HhkXbP.d.cts +0 -451
- package/dist/cjs/error-yAk1zzvx.cjs +0 -1
- package/dist/cjs/management-CE3_DJw4.cjs +0 -2
- package/dist/cjs/parser-Dovux8ce.cjs +0 -1
- package/dist/cjs/schemas-CdaP-Exw.cjs +0 -1
- package/dist/es/app-CMpx3D7Y.d.mts +0 -451
- package/dist/es/chunk-VmiN0kV1.mjs +0 -1
- package/dist/es/error-hBHRgZ9R.mjs +0 -1
- package/dist/es/management-BM2WcbV6.mjs +0 -2
- package/dist/es/parser-DOVfvr9l.mjs +0 -1
- package/dist/es/schemas-eemlD-xS.mjs +0 -1
- /package/dist/cjs/commands/generate/actions/templates/{custom-scripts.js.template → app-management/custom-scripts.js.template} +0 -0
- /package/dist/cjs/commands/generate/actions/templates/{get-app-config.js.template → app-management/get-app-config.js.template} +0 -0
- /package/dist/cjs/commands/generate/actions/templates/{installation.js.template → app-management/installation.js.template} +0 -0
- /package/dist/es/commands/generate/actions/templates/{custom-scripts.js.template → app-management/custom-scripts.js.template} +0 -0
- /package/dist/es/commands/generate/actions/templates/{get-app-config.js.template → app-management/get-app-config.js.template} +0 -0
- /package/dist/es/commands/generate/actions/templates/{installation.js.template → app-management/installation.js.template} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as InstallationContext } from "../index-
|
|
1
|
+
import { n as CommerceAppConfigOutputModel } from "../app-Dx0ca6oL.cjs";
|
|
2
|
+
import { P as InstallationContext } from "../index-C5SutkJQ.cjs";
|
|
3
3
|
import * as _adobe_aio_commerce_lib_core_responses0 from "@adobe/aio-commerce-lib-core/responses";
|
|
4
4
|
import { RuntimeActionParams } from "@adobe/aio-commerce-lib-core/params";
|
|
5
5
|
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
|
|
3
|
+
//#region source/config/schema/app.d.ts
|
|
4
|
+
/** The schema used to validate the commerce app config file. */
|
|
5
|
+
declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
|
|
6
|
+
readonly metadata: v.ObjectSchema<{
|
|
7
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
|
|
8
|
+
readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
|
|
9
|
+
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
|
|
10
|
+
readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format">]>;
|
|
11
|
+
}, undefined>;
|
|
12
|
+
readonly businessConfig: v.OptionalSchema<v.ObjectSchema<{
|
|
13
|
+
readonly schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.VariantSchema<"selectionMode", [v.ObjectSchema<{
|
|
14
|
+
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
15
|
+
readonly selectionMode: v.LiteralSchema<"single", "Expected the selectionMode to be 'single'">;
|
|
16
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
17
|
+
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
18
|
+
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
19
|
+
}, undefined>, "Expected an array of list options">;
|
|
20
|
+
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default value">, v.NonEmptyAction<string, "The default value must not be empty">]>;
|
|
21
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
22
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
23
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
24
|
+
}, undefined>, v.ObjectSchema<{
|
|
25
|
+
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
26
|
+
readonly selectionMode: v.LiteralSchema<"multiple", "Expected the selectionMode to be 'multiple'">;
|
|
27
|
+
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
28
|
+
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
29
|
+
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
30
|
+
}, undefined>, "Expected an array of list options">;
|
|
31
|
+
readonly default: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for each default value">, v.NonEmptyAction<string, "Each default value must not be empty">]>, "Expected an array of default values">, readonly []>;
|
|
32
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
33
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
34
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
35
|
+
}, undefined>], undefined>, v.ObjectSchema<{
|
|
36
|
+
readonly type: v.LiteralSchema<"text", "Expected the type to be 'text'">;
|
|
37
|
+
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
38
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
39
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
40
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
41
|
+
}, undefined>, v.ObjectSchema<{
|
|
42
|
+
readonly type: v.LiteralSchema<"password", "Expected the type to be 'password'">;
|
|
43
|
+
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
44
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
45
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
46
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
47
|
+
}, undefined>, v.ObjectSchema<{
|
|
48
|
+
readonly type: v.LiteralSchema<"email", "Expected the type to be 'email'">;
|
|
49
|
+
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default email value">, v.EmailAction<string, "The email must be a valid email address">]>, undefined>;
|
|
50
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
51
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
52
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
53
|
+
}, undefined>, v.ObjectSchema<{
|
|
54
|
+
readonly type: v.LiteralSchema<"url", "Expected the type to be 'url'">;
|
|
55
|
+
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default URL value">, v.UrlAction<string, "The URL must be a valid URL">]>, undefined>;
|
|
56
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
57
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
58
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
59
|
+
}, undefined>, v.ObjectSchema<{
|
|
60
|
+
readonly type: v.LiteralSchema<"tel", "Expected the type to be 'tel'">;
|
|
61
|
+
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default phone number value">, v.RegexAction<string, "The phone number must contain only numbers and/or country codes">]>, undefined>;
|
|
62
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
63
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
64
|
+
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
65
|
+
}, undefined>], undefined>, "Expected an array of configuration fields">, v.MinLengthAction<({
|
|
66
|
+
type: "list";
|
|
67
|
+
selectionMode: "single";
|
|
68
|
+
options: {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}[];
|
|
72
|
+
default: string;
|
|
73
|
+
name: string;
|
|
74
|
+
label?: string | undefined;
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
} | {
|
|
77
|
+
type: "list";
|
|
78
|
+
selectionMode: "multiple";
|
|
79
|
+
options: {
|
|
80
|
+
label: string;
|
|
81
|
+
value: string;
|
|
82
|
+
}[];
|
|
83
|
+
default: string[];
|
|
84
|
+
name: string;
|
|
85
|
+
label?: string | undefined;
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
} | {
|
|
88
|
+
type: "text";
|
|
89
|
+
default?: string | undefined;
|
|
90
|
+
name: string;
|
|
91
|
+
label?: string | undefined;
|
|
92
|
+
description?: string | undefined;
|
|
93
|
+
} | {
|
|
94
|
+
type: "password";
|
|
95
|
+
default?: string | undefined;
|
|
96
|
+
name: string;
|
|
97
|
+
label?: string | undefined;
|
|
98
|
+
description?: string | undefined;
|
|
99
|
+
} | {
|
|
100
|
+
type: "email";
|
|
101
|
+
default?: string | undefined;
|
|
102
|
+
name: string;
|
|
103
|
+
label?: string | undefined;
|
|
104
|
+
description?: string | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
type: "url";
|
|
107
|
+
default?: string | undefined;
|
|
108
|
+
name: string;
|
|
109
|
+
label?: string | undefined;
|
|
110
|
+
description?: string | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
type: "tel";
|
|
113
|
+
default?: string | undefined;
|
|
114
|
+
name: string;
|
|
115
|
+
label?: string | undefined;
|
|
116
|
+
description?: string | undefined;
|
|
117
|
+
})[], 1, "At least one configuration parameter is required">]>, readonly []>;
|
|
118
|
+
}, undefined>, undefined>;
|
|
119
|
+
readonly eventing: v.OptionalSchema<v.ObjectSchema<{
|
|
120
|
+
readonly commerce: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
121
|
+
readonly provider: v.ObjectSchema<{
|
|
122
|
+
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
123
|
+
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
124
|
+
readonly key: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 50, "The provider key must not be longer than 50 characters">]>, undefined>;
|
|
125
|
+
}, undefined>;
|
|
126
|
+
readonly events: v.ArraySchema<v.ObjectSchema<{
|
|
127
|
+
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Event name must start with \"plugin.\" or \"observer.\" followed by lowercase letters and underscores only (e.g., \"plugin.order_placed\")">]>;
|
|
128
|
+
readonly fields: v.ArraySchema<v.ObjectSchema<{
|
|
129
|
+
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Field name must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), dashes (-), dots (.), and square brackets ([, ]), or be exactly \"*\"">]>;
|
|
130
|
+
readonly source: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
|
|
131
|
+
}, undefined>, "Expected an array of event field objects with a 'name' property">;
|
|
132
|
+
readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
133
|
+
readonly field: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
134
|
+
readonly operator: v.UnionSchema<v.LiteralSchema<"regex" | "greaterThan" | "lessThan" | "equal" | "in" | "onChange", undefined>[], `Operator must be one of: ${string}`>;
|
|
135
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
136
|
+
}, undefined>, "Expected an array of event rules with field, operator, and value">, undefined>;
|
|
137
|
+
readonly destination: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, undefined>;
|
|
138
|
+
readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
139
|
+
readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
140
|
+
readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
141
|
+
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 100, "The event label must not be longer than 100 characters">]>;
|
|
142
|
+
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
143
|
+
readonly runtimeActions: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "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>">;
|
|
144
|
+
}, undefined>, "Expected an array of Commerce events">;
|
|
145
|
+
}, undefined>, "Expected an array of Commerce event sources">, undefined>;
|
|
146
|
+
readonly external: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
147
|
+
readonly provider: v.ObjectSchema<{
|
|
148
|
+
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
149
|
+
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
150
|
+
readonly key: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 50, "The provider key must not be longer than 50 characters">]>, undefined>;
|
|
151
|
+
}, undefined>;
|
|
152
|
+
readonly events: v.ArraySchema<v.ObjectSchema<{
|
|
153
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed in string value of "${string}"${string}`>]>;
|
|
154
|
+
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 100, "The event label must not be longer than 100 characters">]>;
|
|
155
|
+
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
156
|
+
readonly runtimeActions: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "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>">;
|
|
157
|
+
}, undefined>, "Expected an array of external events">;
|
|
158
|
+
}, undefined>, "Expected an array of external event sources">, undefined>;
|
|
159
|
+
}, undefined>, undefined>;
|
|
160
|
+
readonly installation: v.OptionalSchema<v.ObjectSchema<{
|
|
161
|
+
readonly messages: v.OptionalSchema<v.ObjectSchema<{
|
|
162
|
+
readonly preInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The preInstallation message must not be longer than 1000 characters">]>, undefined>;
|
|
163
|
+
readonly postInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The postInstallation message must not be longer than 1000 characters">]>, undefined>;
|
|
164
|
+
}, undefined>, undefined>;
|
|
165
|
+
readonly customInstallationSteps: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
166
|
+
readonly script: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Script path must end with .js (e.g., \"./setup.js\", \"./scripts/setup.js\", or \"../../scripts/setup.js\")">]>;
|
|
167
|
+
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step name must not be longer than 255 characters">]>;
|
|
168
|
+
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step description must not be longer than 255 characters">]>;
|
|
169
|
+
}, undefined>, "Expected an array of custom installation steps">, undefined>, v.CheckAction<{
|
|
170
|
+
script: string;
|
|
171
|
+
name: string;
|
|
172
|
+
description: string;
|
|
173
|
+
}[] | undefined, "Duplicate step names detected in custom installation steps. Each step must have a unique name.">]>;
|
|
174
|
+
}, undefined>, undefined>;
|
|
175
|
+
}, undefined>;
|
|
176
|
+
/** The input shape of the commerce app config schema. */
|
|
177
|
+
type CommerceAppConfig = v.InferInput<typeof CommerceAppConfigSchema>;
|
|
178
|
+
/** The output shape of the commerce app config schema. */
|
|
179
|
+
type CommerceAppConfigOutputModel = v.InferOutput<typeof CommerceAppConfigSchema>;
|
|
180
|
+
//#endregion
|
|
181
|
+
export { CommerceAppConfigOutputModel as n, CommerceAppConfig as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// This file has been auto-generated by `@adobe/aio-commerce-lib-config`
|
|
14
|
+
// Do not modify this file directly
|
|
15
|
+
|
|
16
|
+
import util from "node:util";
|
|
17
|
+
|
|
18
|
+
import { getConfigSchema } from "@adobe/aio-commerce-lib-config";
|
|
19
|
+
import {
|
|
20
|
+
internalServerError,
|
|
21
|
+
ok,
|
|
22
|
+
} from "@adobe/aio-commerce-sdk/core/responses";
|
|
23
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
24
|
+
|
|
25
|
+
// Shorthand to inspect an object.
|
|
26
|
+
const inspect = (obj) => util.inspect(obj, { depth: null });
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the configuration schema.
|
|
30
|
+
* @returns The response object containing the configuration schema.
|
|
31
|
+
*/
|
|
32
|
+
export async function main(params) {
|
|
33
|
+
const logger = AioLogger("get-config-schema", {
|
|
34
|
+
level: params.LOG_LEVEL || "info",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
logger.debug("Retrieving configuration schema...");
|
|
39
|
+
const configSchema = await getConfigSchema();
|
|
40
|
+
|
|
41
|
+
logger.debug(
|
|
42
|
+
`Successfully retrieved configSchema: ${inspect(configSchema)}`,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return ok({
|
|
46
|
+
body: {
|
|
47
|
+
configSchema,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
} catch (error) {
|
|
51
|
+
logger.error(
|
|
52
|
+
`Something wen't wrong while retrieving config schema: ${inspect(error)}`,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return internalServerError({
|
|
56
|
+
body: {
|
|
57
|
+
code: "INTERNAL_ERROR",
|
|
58
|
+
details: error instanceof Error ? error.message : "Unknown error",
|
|
59
|
+
message: "An internal server error occurred",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// This file has been auto-generated by `@adobe/aio-commerce-lib-config`
|
|
14
|
+
// Do not modify this file directly
|
|
15
|
+
|
|
16
|
+
import util from "node:util";
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
byCode,
|
|
20
|
+
byCodeAndLevel,
|
|
21
|
+
byScopeId,
|
|
22
|
+
getConfiguration,
|
|
23
|
+
setGlobalLibConfigOptions,
|
|
24
|
+
} from "@adobe/aio-commerce-lib-config";
|
|
25
|
+
import {
|
|
26
|
+
badRequest,
|
|
27
|
+
internalServerError,
|
|
28
|
+
ok,
|
|
29
|
+
} from "@adobe/aio-commerce-sdk/core/responses";
|
|
30
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
31
|
+
|
|
32
|
+
// Shorthand to inspect an object.
|
|
33
|
+
const inspect = (obj) => util.inspect(obj, { depth: null });
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the configuration.
|
|
37
|
+
* @param params - The input parameters.
|
|
38
|
+
* @returns The response object containing the configuration data.
|
|
39
|
+
*/
|
|
40
|
+
export async function main(params) {
|
|
41
|
+
const logger = AioLogger("get-configuration", {
|
|
42
|
+
level: params.LOG_LEVEL || "info",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
if (params.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY) {
|
|
47
|
+
setGlobalLibConfigOptions({
|
|
48
|
+
encryptionKey: params.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const id = params.id;
|
|
53
|
+
const code = params.code;
|
|
54
|
+
const level = params.level;
|
|
55
|
+
|
|
56
|
+
logger.debug(
|
|
57
|
+
`Retrieving configuration with params: ${inspect({ id, code, level })}`,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (!(id || code)) {
|
|
61
|
+
logger.warn("Invalid params: Either id or code query param is required");
|
|
62
|
+
return badRequest({
|
|
63
|
+
body: {
|
|
64
|
+
code: "INVALID_PARAMS",
|
|
65
|
+
message: "Either id or code query param is required",
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
let appConfiguration;
|
|
71
|
+
if (id) {
|
|
72
|
+
logger.debug(`Retrieving configuration by id: ${id}`);
|
|
73
|
+
appConfiguration = await getConfiguration(byScopeId(id));
|
|
74
|
+
} else if (level) {
|
|
75
|
+
logger.debug(
|
|
76
|
+
`Retrieving configuration by code: ${code}, level: ${level}`,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
appConfiguration = await getConfiguration(byCodeAndLevel(code, level));
|
|
80
|
+
} else {
|
|
81
|
+
logger.debug(`Retrieving configuration by code: ${code}`);
|
|
82
|
+
appConfiguration = await getConfiguration(byCode(code));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
logger.debug(
|
|
86
|
+
`Successfully retrieved configuration: ${inspect(appConfiguration)}`,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return ok({ body: appConfiguration });
|
|
90
|
+
} catch (error) {
|
|
91
|
+
logger.error(
|
|
92
|
+
`Something went wrong while retrieving configuration: ${inspect(error)}`,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
return internalServerError({
|
|
96
|
+
body: {
|
|
97
|
+
code: "INTERNAL_ERROR",
|
|
98
|
+
details: error instanceof Error ? error.message : "Unknown error",
|
|
99
|
+
|
|
100
|
+
message: "An internal server error occurred",
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// This file has been auto-generated by `@adobe/aio-commerce-lib-config`
|
|
14
|
+
// Do not modify this file directly
|
|
15
|
+
|
|
16
|
+
import util from "node:util";
|
|
17
|
+
|
|
18
|
+
import { getScopeTree } from "@adobe/aio-commerce-lib-config";
|
|
19
|
+
import {
|
|
20
|
+
internalServerError,
|
|
21
|
+
nonAuthoritativeInformation,
|
|
22
|
+
ok,
|
|
23
|
+
} from "@adobe/aio-commerce-sdk/core/responses";
|
|
24
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
25
|
+
|
|
26
|
+
// Shorthand to inspect an object.
|
|
27
|
+
const inspect = (obj) => util.inspect(obj, { depth: null });
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get scope tree.
|
|
31
|
+
* @returns The response object containing persisted scope tree configuration from cache/storage.
|
|
32
|
+
*/
|
|
33
|
+
export async function main(params) {
|
|
34
|
+
const logger = AioLogger("get-scope-tree", {
|
|
35
|
+
level: params.LOG_LEVEL || "info",
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
logger.debug("Retrieving scope tree...");
|
|
40
|
+
|
|
41
|
+
const result = await getScopeTree();
|
|
42
|
+
logger.debug(
|
|
43
|
+
`Successfully retrieved scope tree (cached: ${result.isCachedData}): ${inspect(result.scopeTree)}`,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (result.isCachedData) {
|
|
47
|
+
return nonAuthoritativeInformation({
|
|
48
|
+
headers: { "x-cache": "hit" },
|
|
49
|
+
body: { scopes: result.scopeTree },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return ok({
|
|
54
|
+
body: { scopes: result.scopeTree },
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
logger.error(
|
|
58
|
+
`Something went wrong while retrieving scope tree: ${inspect(error)}`,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return internalServerError({
|
|
62
|
+
body: {
|
|
63
|
+
code: "INTERNAL_ERROR",
|
|
64
|
+
message: "An internal server error occurred",
|
|
65
|
+
details: error instanceof Error ? error.message : "Unknown error",
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2025 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
|
+
// This file has been auto-generated by `@adobe/aio-commerce-lib-config`
|
|
16
|
+
// Do not modify this file directly
|
|
17
|
+
|
|
18
|
+
import util from "node:util";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
byCodeAndLevel,
|
|
22
|
+
byScopeId,
|
|
23
|
+
setConfiguration,
|
|
24
|
+
setGlobalLibConfigOptions,
|
|
25
|
+
} from "@adobe/aio-commerce-lib-config";
|
|
26
|
+
import {
|
|
27
|
+
badRequest,
|
|
28
|
+
internalServerError,
|
|
29
|
+
ok,
|
|
30
|
+
} from "@adobe/aio-commerce-sdk/core/responses";
|
|
31
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
32
|
+
|
|
33
|
+
// Shorthand to inspect an object.
|
|
34
|
+
const inspect = (obj) => util.inspect(obj, { depth: null });
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get the configuration.
|
|
38
|
+
* @param params - The input parameters.
|
|
39
|
+
* @returns The response object containing the updated configuration values.
|
|
40
|
+
*/
|
|
41
|
+
export async function main(params) {
|
|
42
|
+
const logger = AioLogger("set-configuration", {
|
|
43
|
+
level: params.LOG_LEVEL || "info",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
if (params.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY) {
|
|
48
|
+
setGlobalLibConfigOptions({
|
|
49
|
+
encryptionKey: params.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
let body;
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
params &&
|
|
56
|
+
typeof params === "object" &&
|
|
57
|
+
Object.keys(params).length === 0
|
|
58
|
+
) {
|
|
59
|
+
body = {};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const id = params.id;
|
|
63
|
+
const code = params.code;
|
|
64
|
+
const level = params.level;
|
|
65
|
+
|
|
66
|
+
logger.debug(
|
|
67
|
+
`Setting configuration with params: ${inspect({ id, code, level })}`,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
if (!(id || (code && level))) {
|
|
71
|
+
logger.warn(
|
|
72
|
+
"Invalid params: Either id or both code and level query params are required",
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return badRequest({
|
|
76
|
+
body: {
|
|
77
|
+
code: "INVALID_PARAMS",
|
|
78
|
+
message: "Either id or both code and level query params are required",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const candidateConfig = params.config ?? body?.config;
|
|
84
|
+
if (!(candidateConfig && Array.isArray(candidateConfig))) {
|
|
85
|
+
logger.warn(
|
|
86
|
+
"Invalid body: request must include a config array in params.config or body.config",
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return badRequest({
|
|
90
|
+
body: {
|
|
91
|
+
code: "INVALID_BODY",
|
|
92
|
+
message:
|
|
93
|
+
"request must include a config array in params.config or body.config",
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const payload = { config: candidateConfig };
|
|
99
|
+
logger.debug(`Setting configuration with payload: ${inspect(payload)}`);
|
|
100
|
+
|
|
101
|
+
const result = id
|
|
102
|
+
? await setConfiguration(payload, byScopeId(id))
|
|
103
|
+
: await setConfiguration(payload, byCodeAndLevel(code, level));
|
|
104
|
+
|
|
105
|
+
logger.debug(`Successfully set configuration: ${inspect(result)}`);
|
|
106
|
+
return ok({
|
|
107
|
+
body: { result },
|
|
108
|
+
headers: {
|
|
109
|
+
"Cache-Control": "no-store",
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
} catch (error) {
|
|
113
|
+
logger.error(
|
|
114
|
+
`Something went wrong while setting configuration: ${inspect(error)}`,
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
return internalServerError({
|
|
118
|
+
body: {
|
|
119
|
+
code: "INTERNAL_ERROR",
|
|
120
|
+
message: "An internal server error occurred",
|
|
121
|
+
details: error instanceof Error ? error.message : "Unknown error",
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// This file has been auto-generated by `@adobe/aio-commerce-lib-config`
|
|
14
|
+
// Do not modify this file directly
|
|
15
|
+
|
|
16
|
+
import util from "node:util";
|
|
17
|
+
|
|
18
|
+
import { setCustomScopeTree } from "@adobe/aio-commerce-lib-config";
|
|
19
|
+
import {
|
|
20
|
+
badRequest,
|
|
21
|
+
internalServerError,
|
|
22
|
+
ok,
|
|
23
|
+
} from "@adobe/aio-commerce-sdk/core/responses";
|
|
24
|
+
import AioLogger from "@adobe/aio-lib-core-logging";
|
|
25
|
+
|
|
26
|
+
// Shorthand to inspect an object.
|
|
27
|
+
const inspect = (obj) => util.inspect(obj, { depth: null });
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Set custom scope tree - replace all custom scopes with provided ones
|
|
31
|
+
* @param params - The input parameters containing scopes array
|
|
32
|
+
* @returns The response object containing updated custom scopes
|
|
33
|
+
*/
|
|
34
|
+
export async function main(params) {
|
|
35
|
+
const logger = AioLogger("set-custom-scope-tree", {
|
|
36
|
+
level: params.LOG_LEVEL || "info",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const scopes = params.scopes;
|
|
41
|
+
logger.debug(
|
|
42
|
+
`Setting custom scope tree with ${scopes?.length || 0} scopes`,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (!scopes) {
|
|
46
|
+
logger.warn("Invalid request: Request must include scopes parameter");
|
|
47
|
+
return badRequest({
|
|
48
|
+
body: {
|
|
49
|
+
code: "INVALID_REQUEST",
|
|
50
|
+
message: "Request must include scopes parameter",
|
|
51
|
+
details: "Expected: { scopes: [array of scope objects] }",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const request = { scopes };
|
|
57
|
+
logger.debug(`Setting custom scope tree: ${inspect(request)}`);
|
|
58
|
+
|
|
59
|
+
const result = await setCustomScopeTree(request);
|
|
60
|
+
logger.debug(`Successfully set custom scope tree: ${inspect(result)}`);
|
|
61
|
+
|
|
62
|
+
return ok({
|
|
63
|
+
body: { result },
|
|
64
|
+
headers: {
|
|
65
|
+
"Cache-Control": "no-store",
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
} catch (error) {
|
|
69
|
+
logger.error(
|
|
70
|
+
`Something went wrong while updating custom scope tree: ${inspect(error)}`,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return internalServerError({
|
|
74
|
+
body: {
|
|
75
|
+
code: "INTERNAL_ERROR",
|
|
76
|
+
details: error instanceof Error ? error.message : "Unknown error",
|
|
77
|
+
|
|
78
|
+
message:
|
|
79
|
+
"An internal server error occurred while updating custom scope tree",
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|