@adobe/aio-commerce-lib-app 1.4.0 → 1.6.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 +42 -0
- package/dist/cjs/actions/app-config.cjs +17 -4
- package/dist/cjs/actions/app-config.d.cts +3 -4
- package/dist/cjs/actions/config.cjs +21 -16
- package/dist/cjs/actions/config.d.cts +1 -2
- package/dist/cjs/actions/installation.cjs +20 -14
- package/dist/cjs/actions/installation.d.cts +4 -5
- package/dist/cjs/actions/registration.cjs +1 -2
- package/dist/cjs/actions/registration.d.cts +2 -3
- package/dist/cjs/actions/scope-tree.cjs +5 -5
- package/dist/cjs/actions/scope-tree.d.cts +1 -4
- package/dist/cjs/{admin-ui-sdk-BiSopnKI.d.cts → admin-ui-sdk-DZZJCrdT.d.cts} +1 -1
- package/dist/cjs/{app-C6kImBl7.d.cts → app-CakwxQvs.d.cts} +129 -20
- package/dist/cjs/commands/index.cjs +236 -45
- package/dist/cjs/commands/templates/app-management/app-config.js.template +2 -2
- package/dist/cjs/config/index.cjs +3 -3
- package/dist/cjs/config/index.d.cts +354 -391
- package/dist/cjs/{config-ct-qMOGj.cjs → config-FNMclIFO.cjs} +4 -6
- package/dist/cjs/{error-C5LNOZ4f.cjs → error-D-N0PKSl.cjs} +0 -1
- package/dist/cjs/{index-B5WKJ3hJ.d.cts → index-Dw2NvVOY.d.cts} +2 -2
- package/dist/cjs/{logging-BTevALnL.cjs → logging-BVz3weoC.cjs} +1 -1
- package/dist/cjs/management/index.cjs +1 -1
- package/dist/cjs/management/index.d.cts +3 -3
- package/dist/cjs/{management-D1QXg4YU.cjs → management-Cvsz4VMf.cjs} +34 -9
- package/dist/cjs/{router-CFErodHU.cjs → router-BOR7T6qR.cjs} +1 -1
- package/dist/cjs/{schemas-CukVpc19.cjs → schemas-FngDuIeo.cjs} +1 -1
- package/dist/{es/step-0eI2x4C9.d.mts → cjs/step-CKVE0aJi.d.cts} +3 -3
- package/dist/cjs/{validate-b_bI4mDb.cjs → validate-DydOAZha.cjs} +4 -4
- package/dist/cjs/{webhooks-DS1BtgED.cjs → webhooks-tbZy9G3p.cjs} +4 -4
- package/dist/es/actions/app-config.d.mts +3 -4
- package/dist/es/actions/app-config.mjs +18 -4
- package/dist/es/actions/config.d.mts +1 -2
- package/dist/es/actions/config.mjs +20 -15
- package/dist/es/actions/installation.d.mts +4 -5
- package/dist/es/actions/installation.mjs +19 -13
- package/dist/es/actions/registration.d.mts +2 -3
- package/dist/es/actions/registration.mjs +1 -1
- package/dist/es/actions/scope-tree.d.mts +1 -4
- package/dist/es/actions/scope-tree.mjs +4 -4
- package/dist/es/{admin-ui-sdk-CCo2SWiL.d.mts → admin-ui-sdk-hu6iWr0A.d.mts} +1 -1
- package/dist/es/{app-DcY6dJiQ.d.mts → app-CakwxQvs.d.mts} +129 -20
- package/dist/es/commands/index.mjs +218 -27
- package/dist/es/commands/templates/app-management/app-config.js.template +2 -2
- package/dist/es/config/index.d.mts +354 -391
- package/dist/es/config/index.mjs +3 -3
- package/dist/es/{config-DGPFTk6w.mjs → config-CcE0EBG7.mjs} +4 -5
- package/dist/es/{index-CCov0odd.d.mts → index-Bo0tQsVq.d.mts} +2 -2
- package/dist/es/management/index.d.mts +3 -3
- package/dist/es/management/index.mjs +1 -1
- package/dist/es/{management-CCsOfniv.mjs → management-BZ4Y6lVp.mjs} +33 -8
- package/dist/{cjs/step-CWYnKbga.d.cts → es/step-D64mMPrt.d.mts} +3 -3
- package/dist/es/{validate-Dn3lLTGj.mjs → validate-Du3LhCre.mjs} +3 -3
- package/dist/es/{webhooks-Dhrkkip7.mjs → webhooks-B5oq9ULL.mjs} +3 -3
- package/package.json +16 -11
- /package/dist/cjs/{chunk-DS2yp5vX.cjs → chunk-Cozy-1ZF.cjs} +0 -0
- /package/dist/es/{error-DHlYzkbb.mjs → error-_RMwtrUA.mjs} +0 -0
- /package/dist/es/{logging-XIUXDK5T.mjs → logging-DbJHXSKh.mjs} +0 -0
- /package/dist/es/{router-BxaxEEu3.mjs → router-D58JJHHA.mjs} +0 -0
- /package/dist/es/{schemas-DOcnD16x.mjs → schemas-hRovglBF.mjs} +0 -0
|
@@ -25,91 +25,163 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
|
|
|
25
25
|
}, undefined>;
|
|
26
26
|
readonly businessConfig: v.OptionalSchema<v.ObjectSchema<{
|
|
27
27
|
readonly schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.VariantSchema<"selectionMode", [v.ObjectSchema<{
|
|
28
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
29
28
|
readonly selectionMode: v.LiteralSchema<"single", "Expected the selectionMode to be 'single'">;
|
|
29
|
+
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default value">, v.NonEmptyAction<string, "The default value must not be empty">]>;
|
|
30
|
+
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
30
31
|
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
31
32
|
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
32
33
|
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
33
34
|
}, undefined>, "Expected an array of list options">;
|
|
34
|
-
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default value">, v.NonEmptyAction<string, "The default value must not be empty">]>;
|
|
35
35
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
36
36
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
37
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
37
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
38
38
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
39
39
|
}, undefined>, v.ObjectSchema<{
|
|
40
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
41
40
|
readonly selectionMode: v.LiteralSchema<"multiple", "Expected the selectionMode to be 'multiple'">;
|
|
41
|
+
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 []>;
|
|
42
|
+
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
42
43
|
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
43
44
|
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
44
45
|
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
45
46
|
}, undefined>, "Expected an array of list options">;
|
|
46
|
-
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 []>;
|
|
47
47
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
48
48
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
49
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
49
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
50
|
+
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
51
|
+
}, undefined>], undefined>, v.VariantSchema<"selectionMode", [v.ObjectSchema<{
|
|
52
|
+
readonly selectionMode: v.LiteralSchema<"single", "Expected the selectionMode to be 'single'">;
|
|
53
|
+
readonly default: v.CustomSchema<(resolvedOptions: {
|
|
54
|
+
label: string;
|
|
55
|
+
value: string;
|
|
56
|
+
}[]) => string, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
57
|
+
readonly type: v.LiteralSchema<"dynamicList", "Expected the type to be 'dynamicList'">;
|
|
58
|
+
readonly options: v.CustomSchema<(params: import("@adobe/aio-commerce-lib-core/params").RuntimeActionParams) => {
|
|
59
|
+
label: string;
|
|
60
|
+
value: string;
|
|
61
|
+
}[] | Promise<{
|
|
62
|
+
label: string;
|
|
63
|
+
value: string;
|
|
64
|
+
}[]>, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
65
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
66
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
67
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
68
|
+
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
69
|
+
}, undefined>, v.ObjectSchema<{
|
|
70
|
+
readonly selectionMode: v.LiteralSchema<"multiple", "Expected the selectionMode to be 'multiple'">;
|
|
71
|
+
readonly default: v.OptionalSchema<v.CustomSchema<(resolvedOptions: {
|
|
72
|
+
label: string;
|
|
73
|
+
value: string;
|
|
74
|
+
}[]) => string[], v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
75
|
+
readonly type: v.LiteralSchema<"dynamicList", "Expected the type to be 'dynamicList'">;
|
|
76
|
+
readonly options: v.CustomSchema<(params: import("@adobe/aio-commerce-lib-core/params").RuntimeActionParams) => {
|
|
77
|
+
label: string;
|
|
78
|
+
value: string;
|
|
79
|
+
}[] | Promise<{
|
|
80
|
+
label: string;
|
|
81
|
+
value: string;
|
|
82
|
+
}[]>, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
83
|
+
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
84
|
+
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
85
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
50
86
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
51
87
|
}, undefined>], undefined>, v.ObjectSchema<{
|
|
52
88
|
readonly type: v.LiteralSchema<"text", "Expected the type to be 'text'">;
|
|
53
89
|
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, "">;
|
|
54
90
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
55
91
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
56
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
92
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
57
93
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
58
94
|
}, undefined>, v.ObjectSchema<{
|
|
59
95
|
readonly type: v.LiteralSchema<"password", "Expected the type to be 'password'">;
|
|
60
96
|
readonly default: v.OptionalSchema<v.LiteralSchema<"", "Password fields do not have a default value">, "">;
|
|
61
97
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
62
98
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
63
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
99
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
64
100
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
65
101
|
}, undefined>, v.ObjectSchema<{
|
|
66
102
|
readonly type: v.LiteralSchema<"email", "Expected the type to be 'email'">;
|
|
67
103
|
readonly default: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"", undefined>, 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>, "">;
|
|
68
104
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
69
105
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
70
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
106
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
71
107
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
72
108
|
}, undefined>, v.ObjectSchema<{
|
|
73
109
|
readonly type: v.LiteralSchema<"url", "Expected the type to be 'url'">;
|
|
74
110
|
readonly default: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"", undefined>, v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default URL value">, v.UrlAction<string, "The URL must be a valid URL">]>], undefined>, "">;
|
|
75
111
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
76
112
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
77
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
113
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
78
114
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
79
115
|
}, undefined>, v.ObjectSchema<{
|
|
80
116
|
readonly type: v.LiteralSchema<"tel", "Expected the type to be 'tel'">;
|
|
81
117
|
readonly default: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"", undefined>, 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>, "">;
|
|
82
118
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
83
119
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
84
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
120
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
85
121
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
86
122
|
}, undefined>, v.ObjectSchema<{
|
|
87
123
|
readonly type: v.LiteralSchema<"boolean", "Expected the type to be 'boolean'">;
|
|
88
124
|
readonly default: v.OptionalSchema<v.BooleanSchema<"Expected a boolean for the default value">, false>;
|
|
89
125
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
90
126
|
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
91
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
127
|
+
readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field description">, v.CheckAction<string, "Field description contains an invalid markdown URL.">]>, undefined>;
|
|
92
128
|
readonly env: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>, undefined>;
|
|
93
129
|
}, undefined>], undefined>, "Expected an array of configuration fields">, v.MinLengthAction<({
|
|
94
|
-
type: "list";
|
|
95
130
|
selectionMode: "single";
|
|
131
|
+
default: string;
|
|
132
|
+
type: "list";
|
|
96
133
|
options: {
|
|
97
134
|
label: string;
|
|
98
135
|
value: string;
|
|
99
136
|
}[];
|
|
100
|
-
default: string;
|
|
101
137
|
name: string;
|
|
102
138
|
label?: string | undefined;
|
|
103
139
|
description?: string | undefined;
|
|
104
140
|
env?: ("paas" | "saas")[] | undefined;
|
|
105
141
|
} | {
|
|
106
|
-
type: "list";
|
|
107
142
|
selectionMode: "multiple";
|
|
143
|
+
default: string[];
|
|
144
|
+
type: "list";
|
|
108
145
|
options: {
|
|
109
146
|
label: string;
|
|
110
147
|
value: string;
|
|
111
148
|
}[];
|
|
112
|
-
|
|
149
|
+
name: string;
|
|
150
|
+
label?: string | undefined;
|
|
151
|
+
description?: string | undefined;
|
|
152
|
+
env?: ("paas" | "saas")[] | undefined;
|
|
153
|
+
} | {
|
|
154
|
+
selectionMode: "single";
|
|
155
|
+
default: (resolvedOptions: {
|
|
156
|
+
label: string;
|
|
157
|
+
value: string;
|
|
158
|
+
}[]) => string;
|
|
159
|
+
type: "dynamicList";
|
|
160
|
+
options: (params: import("@adobe/aio-commerce-lib-core/params").RuntimeActionParams) => {
|
|
161
|
+
label: string;
|
|
162
|
+
value: string;
|
|
163
|
+
}[] | Promise<{
|
|
164
|
+
label: string;
|
|
165
|
+
value: string;
|
|
166
|
+
}[]>;
|
|
167
|
+
name: string;
|
|
168
|
+
label?: string | undefined;
|
|
169
|
+
description?: string | undefined;
|
|
170
|
+
env?: ("paas" | "saas")[] | undefined;
|
|
171
|
+
} | {
|
|
172
|
+
selectionMode: "multiple";
|
|
173
|
+
default?: ((resolvedOptions: {
|
|
174
|
+
label: string;
|
|
175
|
+
value: string;
|
|
176
|
+
}[]) => string[]) | undefined;
|
|
177
|
+
type: "dynamicList";
|
|
178
|
+
options: (params: import("@adobe/aio-commerce-lib-core/params").RuntimeActionParams) => {
|
|
179
|
+
label: string;
|
|
180
|
+
value: string;
|
|
181
|
+
}[] | Promise<{
|
|
182
|
+
label: string;
|
|
183
|
+
value: string;
|
|
184
|
+
}[]>;
|
|
113
185
|
name: string;
|
|
114
186
|
label?: string | undefined;
|
|
115
187
|
description?: string | undefined;
|
|
@@ -159,7 +231,7 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
|
|
|
159
231
|
})[], 1, "At least one configuration parameter is required">]>, readonly []>;
|
|
160
232
|
}, undefined>, undefined>;
|
|
161
233
|
readonly eventing: v.OptionalSchema<v.ObjectSchema<{
|
|
162
|
-
readonly commerce: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
234
|
+
readonly commerce: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
163
235
|
readonly provider: v.ObjectSchema<{
|
|
164
236
|
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.RegexAction<string, `${string} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
165
237
|
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.RegexAction<string, `${string} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
@@ -187,8 +259,33 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
|
|
|
187
259
|
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.RegexAction<string, `${string} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
188
260
|
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>">;
|
|
189
261
|
}, undefined>, "Expected an array of Commerce events">;
|
|
190
|
-
}, undefined>, "Expected an array of Commerce event sources">,
|
|
191
|
-
|
|
262
|
+
}, undefined>, "Expected an array of Commerce event sources">, v.CheckAction<{
|
|
263
|
+
provider: {
|
|
264
|
+
label: string;
|
|
265
|
+
description: string;
|
|
266
|
+
key?: string | undefined;
|
|
267
|
+
};
|
|
268
|
+
events: {
|
|
269
|
+
name: string;
|
|
270
|
+
fields: {
|
|
271
|
+
name: string;
|
|
272
|
+
source?: string | undefined;
|
|
273
|
+
}[];
|
|
274
|
+
rules?: {
|
|
275
|
+
field: string;
|
|
276
|
+
operator: "regex" | "greaterThan" | "lessThan" | "equal" | "in" | "onChange";
|
|
277
|
+
value: string;
|
|
278
|
+
}[] | undefined;
|
|
279
|
+
destination?: string | undefined;
|
|
280
|
+
hipaa_audit_required?: boolean | undefined;
|
|
281
|
+
priority?: boolean | undefined;
|
|
282
|
+
force?: boolean | undefined;
|
|
283
|
+
label: string;
|
|
284
|
+
description: string;
|
|
285
|
+
runtimeActions: string[];
|
|
286
|
+
}[];
|
|
287
|
+
}[], "Commerce provider labels must be unique">]>, undefined>;
|
|
288
|
+
readonly external: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
|
|
192
289
|
readonly provider: v.ObjectSchema<{
|
|
193
290
|
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.RegexAction<string, `${string} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
194
291
|
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.RegexAction<string, `${string} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
@@ -200,7 +297,19 @@ declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
|
|
|
200
297
|
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.RegexAction<string, `${string} can only contain letters, numbers, spaces, underscores, hyphens, dots, colons, parentheses, commas, @, and /`>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
201
298
|
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>">;
|
|
202
299
|
}, undefined>, "Expected an array of external events">;
|
|
203
|
-
}, undefined>, "Expected an array of external event sources">,
|
|
300
|
+
}, undefined>, "Expected an array of external event sources">, v.CheckAction<{
|
|
301
|
+
provider: {
|
|
302
|
+
label: string;
|
|
303
|
+
description: string;
|
|
304
|
+
key?: string | undefined;
|
|
305
|
+
};
|
|
306
|
+
events: {
|
|
307
|
+
name: string;
|
|
308
|
+
label: string;
|
|
309
|
+
description: string;
|
|
310
|
+
runtimeActions: string[];
|
|
311
|
+
}[];
|
|
312
|
+
}[], "External provider labels must be unique">]>, undefined>;
|
|
204
313
|
}, undefined>, undefined>;
|
|
205
314
|
readonly adminUiSdk: v.OptionalSchema<v.ObjectSchema<{
|
|
206
315
|
readonly registration: v.ObjectSchema<{
|
|
@@ -13,26 +13,28 @@
|
|
|
13
13
|
* governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { a as hasCustomInstallationSteps, d as hasAdminUiSdk } from "../webhooks-
|
|
17
|
-
import { c as hasBusinessConfigSchema, i as getConfigDomains, t as validateCommerceAppConfig } from "../validate-
|
|
18
|
-
import {
|
|
19
|
-
import { t as stringifyError } from "../error-
|
|
20
|
-
import { t as
|
|
16
|
+
import { a as hasCustomInstallationSteps, d as hasAdminUiSdk } from "../webhooks-B5oq9ULL.mjs";
|
|
17
|
+
import { c as hasBusinessConfigSchema, i as getConfigDomains, t as validateCommerceAppConfig } from "../validate-Du3LhCre.mjs";
|
|
18
|
+
import { t as inspect } from "../logging-DbJHXSKh.mjs";
|
|
19
|
+
import { t as stringifyError } from "../error-_RMwtrUA.mjs";
|
|
20
|
+
import { a as getExecCommand, c as isESM, i as detectPackageManager, l as makeOutputDirFor, n as readCommerceAppConfig, o as getInstallCommand, r as resolveCommerceAppConfig, s as getProjectRootDirectory, t as parseCommerceAppConfig, u as readPackageJson } from "../config-CcE0EBG7.mjs";
|
|
21
|
+
import { hasDynamicSchema } from "@adobe/aio-commerce-lib-config";
|
|
21
22
|
import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
|
|
22
|
-
import path, { basename, dirname, join, relative, resolve } from "path";
|
|
23
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
24
|
-
import { readFile, writeFile } from "fs/promises";
|
|
25
23
|
import consola, { consola as consola$1 } from "consola";
|
|
24
|
+
import path, { basename, dirname, extname, join, relative, resolve, sep } from "path";
|
|
26
25
|
import * as prettier from "prettier";
|
|
26
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
27
|
+
import { access, readFile, rm, writeFile } from "fs/promises";
|
|
27
28
|
import { fileURLToPath } from "url";
|
|
28
|
-
import { Document, YAMLMap, YAMLSeq, isMap, isSeq, parseDocument } from "yaml";
|
|
29
|
+
import { Document, YAMLMap, YAMLSeq, isMap, isPair, isSeq, parseDocument } from "yaml";
|
|
30
|
+
import NpmPackageJson from "@npmcli/package-json";
|
|
29
31
|
import { colorize, formatTree } from "consola/utils";
|
|
32
|
+
import { build } from "esbuild";
|
|
30
33
|
import stringify, { stringify as stringify$1 } from "safe-stable-stringify";
|
|
31
34
|
import { execSync, spawnSync } from "child_process";
|
|
32
35
|
import config from "@adobe/aio-lib-core-config";
|
|
33
36
|
import aioIms from "@adobe/aio-lib-ims";
|
|
34
37
|
import dotenv from "dotenv";
|
|
35
|
-
import NpmPackageJson from "@npmcli/package-json";
|
|
36
38
|
|
|
37
39
|
//#region source/commands/constants.ts
|
|
38
40
|
/** The name of the package containing all the generated runtime actions */
|
|
@@ -55,6 +57,10 @@ const ADMIN_UI_SDK_PACKAGE_NAME = "admin-ui-sdk";
|
|
|
55
57
|
const ADMIN_UI_SDK_ACTIONS_PATH = `${GENERATED_PATH}/actions/registration`;
|
|
56
58
|
/** The name of the configuration schema file */
|
|
57
59
|
const APP_MANIFEST_FILE = "app.commerce.manifest.json";
|
|
60
|
+
/** The name of the generated runtime-safe app config module (dynamic schemas only). */
|
|
61
|
+
const RUNTIME_APP_CONFIG_FILE = "app.commerce.config.js";
|
|
62
|
+
/** Package import alias for the generated runtime-safe app config module. */
|
|
63
|
+
const APP_CONFIG_IMPORT_ALIAS = "#app.commerce.config";
|
|
58
64
|
/** The name of the commerce app configuration file */
|
|
59
65
|
const COMMERCE_APP_CONFIG_FILE = "app.commerce.config";
|
|
60
66
|
/** The name of the configuration schema file */
|
|
@@ -94,6 +100,14 @@ async function loadAppManifest() {
|
|
|
94
100
|
return appConfig;
|
|
95
101
|
}
|
|
96
102
|
/**
|
|
103
|
+
* Whether the app config contains anything that can't be JSON-serialized as-is
|
|
104
|
+
* and therefore requires generating a runtime-safe ESM config module.
|
|
105
|
+
*/
|
|
106
|
+
function hasDynamicAppConfig(appConfig) {
|
|
107
|
+
const schema = appConfig.businessConfig?.schema;
|
|
108
|
+
return Array.isArray(schema) && hasDynamicSchema(schema);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
97
111
|
* Path to an extension point's `.generated` directory, relative to the project root.
|
|
98
112
|
* @param extensionPointId - The extension point ID, e.g. "commerce/extensibility/1"
|
|
99
113
|
*/
|
|
@@ -136,6 +150,21 @@ function getAdminUiSdkActionsDir(extensionPointId) {
|
|
|
136
150
|
function getAdminUiSdkRegistrationActionPath(extensionPointId) {
|
|
137
151
|
return join(getAdminUiSdkActionsDir(extensionPointId), "index.js");
|
|
138
152
|
}
|
|
153
|
+
/** Path to the generated app manifest JSON file, relative to the project root. */
|
|
154
|
+
function getManifestPath() {
|
|
155
|
+
return join(getGeneratedDir(EXTENSIBILITY_EXTENSION_POINT_ID), APP_MANIFEST_FILE);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Path to the generated runtime-safe app config ESM module, relative to the
|
|
159
|
+
* project root. Used when the business config schema contains dynamic options.
|
|
160
|
+
*/
|
|
161
|
+
function getRuntimeAppConfigPath() {
|
|
162
|
+
return join(getGeneratedDir(EXTENSIBILITY_EXTENSION_POINT_ID), RUNTIME_APP_CONFIG_FILE);
|
|
163
|
+
}
|
|
164
|
+
/** Path to the generated configuration schema file, relative to the project root. */
|
|
165
|
+
function getSchemaPath() {
|
|
166
|
+
return join(getGeneratedDir(CONFIGURATION_EXTENSION_POINT_ID), CONFIG_SCHEMA_FILE_NAME);
|
|
167
|
+
}
|
|
139
168
|
|
|
140
169
|
//#endregion
|
|
141
170
|
//#region source/commands/generate/actions/config.ts
|
|
@@ -337,6 +366,33 @@ function getOrCreateMap(doc, path, options) {
|
|
|
337
366
|
typeName: "map"
|
|
338
367
|
});
|
|
339
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Read the `inputs` map from an existing YAML action definition into a plain
|
|
371
|
+
* object. Used by codegen to merge developer-added inputs with the ones the
|
|
372
|
+
* generator manages, so regeneration does not strip user-added entries.
|
|
373
|
+
*
|
|
374
|
+
* @param existingAction - The YAML map representing the existing action.
|
|
375
|
+
*/
|
|
376
|
+
function getExistingInputs(existingAction) {
|
|
377
|
+
const inputs = existingAction?.get("inputs");
|
|
378
|
+
if (!isMap(inputs)) return {};
|
|
379
|
+
return Object.fromEntries(inputs.items.map((item) => {
|
|
380
|
+
if (!isPair(item)) return [];
|
|
381
|
+
return [String(item.key), item.value];
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Read a string field from an existing YAML action definition. Used by codegen
|
|
386
|
+
* to preserve developer-set values (e.g. `runtime`) across regeneration
|
|
387
|
+
* instead of overwriting them.
|
|
388
|
+
*
|
|
389
|
+
* @param key - The field to read.
|
|
390
|
+
* @param existingAction - The YAML map representing the existing action.
|
|
391
|
+
*/
|
|
392
|
+
function getExistingString(key, existingAction) {
|
|
393
|
+
const value = existingAction?.get(key);
|
|
394
|
+
return typeof value === "string" ? value : void 0;
|
|
395
|
+
}
|
|
340
396
|
|
|
341
397
|
//#endregion
|
|
342
398
|
//#region ../../packages-private/scripting-utils/source/yaml/codegen.ts
|
|
@@ -365,19 +421,30 @@ function buildWeb(extConfig, web) {
|
|
|
365
421
|
if (!extConfig.hasIn(["web"])) extConfig.add(extConfig.createPair("web", web));
|
|
366
422
|
}
|
|
367
423
|
/**
|
|
368
|
-
* Build the definition for a runtime action
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
424
|
+
* Build the definition for a runtime action.
|
|
425
|
+
*
|
|
426
|
+
* Developer-added `inputs` keys (anything not in the generator-managed set) on
|
|
427
|
+
* `existingAction` are preserved so that hand-written entries — for example
|
|
428
|
+
* factory credentials for `dynamicList` fields — survive regeneration.
|
|
429
|
+
*
|
|
430
|
+
* A `runtime` already set on `existingAction` is likewise preserved, so a
|
|
431
|
+
* developer can pin a different Node runtime (e.g. `nodejs:24`) in
|
|
432
|
+
* `ext.config.yaml` once without codegen reverting it on the next run.
|
|
433
|
+
*
|
|
434
|
+
* @param action - The action definition to build.
|
|
435
|
+
* @param existingAction - The action's previous YAML definition, if any.
|
|
372
436
|
*/
|
|
373
|
-
function buildActionDefinition(action) {
|
|
437
|
+
function buildActionDefinition(action, existingAction) {
|
|
374
438
|
const actionDef = new YAMLMap();
|
|
375
|
-
const
|
|
439
|
+
const existingInputs = getExistingInputs(existingAction);
|
|
440
|
+
const existingRuntime = getExistingString("runtime", existingAction);
|
|
441
|
+
const managedInputs = { LOG_LEVEL: "$LOG_LEVEL" };
|
|
376
442
|
actionDef.set("function", action.function);
|
|
377
443
|
actionDef.set("web", action.web ?? "yes");
|
|
378
|
-
actionDef.set("runtime", action.runtime ?? "nodejs:22");
|
|
444
|
+
actionDef.set("runtime", existingRuntime ?? action.runtime ?? "nodejs:22");
|
|
379
445
|
actionDef.set("inputs", {
|
|
380
|
-
...
|
|
446
|
+
...existingInputs,
|
|
447
|
+
...managedInputs,
|
|
381
448
|
...action.inputs ?? {}
|
|
382
449
|
});
|
|
383
450
|
actionDef.set("annotations", { ...action.annotations ?? {
|
|
@@ -452,11 +519,13 @@ function buildRuntimeManifest(extConfig, manifest) {
|
|
|
452
519
|
], { onBeforeCreate: (pair) => {
|
|
453
520
|
pair.key.commentBefore = " This package definition is auto-generated. Do not remove or manually edit.";
|
|
454
521
|
} });
|
|
522
|
+
const existingActions = packageDef.get("actions");
|
|
455
523
|
const actions = new YAMLMap();
|
|
456
524
|
packageDef.set("license", pkg.license ?? "Apache-2.0");
|
|
457
525
|
packageDef.set("actions", actions);
|
|
458
526
|
for (const [actionName, action] of Object.entries(pkg.actions ?? {})) {
|
|
459
|
-
const
|
|
527
|
+
const existingAction = isMap(existingActions) ? existingActions.get(actionName) : void 0;
|
|
528
|
+
const actionDef = buildActionDefinition(action, isMap(existingAction) ? existingAction : void 0);
|
|
460
529
|
actions.set(actionName, actionDef);
|
|
461
530
|
}
|
|
462
531
|
}
|
|
@@ -499,6 +568,109 @@ async function writeExtConfig(configPath, doc) {
|
|
|
499
568
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
500
569
|
/** The path to the action templates directory, sibling to this file. */
|
|
501
570
|
const TEMPLATES_DIR = join(__dirname, "templates");
|
|
571
|
+
const TYPESCRIPT_CONFIG_EXTENSIONS = new Set([
|
|
572
|
+
".ts",
|
|
573
|
+
".mts",
|
|
574
|
+
".cts"
|
|
575
|
+
]);
|
|
576
|
+
const LEADING_DOT_SLASH_PATTERN = /^\.\//u;
|
|
577
|
+
const DYNAMIC_APP_CONFIG_IMPORT = `import appConfig from "${APP_CONFIG_IMPORT_ALIAS}";`;
|
|
578
|
+
const STATIC_APP_MANIFEST_IMPORT = "import appConfig from \"../../app.commerce.manifest.json\" with { type: \"json\" };";
|
|
579
|
+
const STATIC_CONFIG_SCHEMA_IMPORT = "import configSchema from \"../../configuration-schema.json\" with { type: \"json\" };";
|
|
580
|
+
/** Normalize a path for use as an ESM import specifier. */
|
|
581
|
+
function normalizeImportPath(path) {
|
|
582
|
+
const normalizedPath = path.split(sep).join("/");
|
|
583
|
+
return normalizedPath.startsWith(".") ? normalizedPath : `./${normalizedPath}`;
|
|
584
|
+
}
|
|
585
|
+
/** Normalize a generated file path for package.json imports. */
|
|
586
|
+
function normalizePackageJsonPath(path) {
|
|
587
|
+
return normalizeImportPath(path).replace(LEADING_DOT_SLASH_PATTERN, "./");
|
|
588
|
+
}
|
|
589
|
+
/** Add or update the package import alias used by dynamic generated actions. */
|
|
590
|
+
async function updateAppConfigImportAlias(projectRoot, runtimeConfigPath) {
|
|
591
|
+
const pkg = await NpmPackageJson.load(projectRoot);
|
|
592
|
+
const existingImports = typeof pkg.content.imports === "object" && pkg.content.imports !== null ? pkg.content.imports : {};
|
|
593
|
+
pkg.update({ imports: {
|
|
594
|
+
...existingImports,
|
|
595
|
+
[APP_CONFIG_IMPORT_ALIAS]: normalizePackageJsonPath(runtimeConfigPath)
|
|
596
|
+
} });
|
|
597
|
+
await pkg.save();
|
|
598
|
+
}
|
|
599
|
+
/** Remove the package import alias used only by dynamic generated actions. */
|
|
600
|
+
async function deleteAppConfigImportAlias(projectRoot) {
|
|
601
|
+
const pkg = await NpmPackageJson.load(projectRoot);
|
|
602
|
+
const existingImports = typeof pkg.content.imports === "object" && pkg.content.imports !== null ? pkg.content.imports : {};
|
|
603
|
+
if (!("#app.commerce.config" in existingImports)) return;
|
|
604
|
+
const imports = { ...existingImports };
|
|
605
|
+
delete imports[APP_CONFIG_IMPORT_ALIAS];
|
|
606
|
+
if (Object.keys(imports).length > 0) pkg.update({ imports });
|
|
607
|
+
else pkg.content.imports = void 0;
|
|
608
|
+
await pkg.save();
|
|
609
|
+
}
|
|
610
|
+
/** Write an ESM passthrough module for JavaScript app config files. */
|
|
611
|
+
async function writeJavaScriptAppConfigModule(configFilePath, outputPath) {
|
|
612
|
+
await writeFile(outputPath, [
|
|
613
|
+
"// This file has been auto-generated by `@adobe/aio-commerce-lib-app`",
|
|
614
|
+
"// Do not modify this file directly",
|
|
615
|
+
"",
|
|
616
|
+
`import appConfig from "${normalizeImportPath(relative(dirname(outputPath), configFilePath))}";`,
|
|
617
|
+
"",
|
|
618
|
+
"export default appConfig;",
|
|
619
|
+
""
|
|
620
|
+
].join("\n"), "utf-8");
|
|
621
|
+
}
|
|
622
|
+
/** Bundle a TypeScript app config file into runtime-safe ESM. */
|
|
623
|
+
async function bundleTypeScriptAppConfigModule(configFilePath, outputPath) {
|
|
624
|
+
await build({
|
|
625
|
+
entryPoints: [configFilePath],
|
|
626
|
+
outfile: outputPath,
|
|
627
|
+
bundle: true,
|
|
628
|
+
format: "esm",
|
|
629
|
+
platform: "node",
|
|
630
|
+
target: "node22",
|
|
631
|
+
packages: "external",
|
|
632
|
+
logLevel: "silent"
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
/** Generate the runtime-safe app config module used by generated runtime actions. */
|
|
636
|
+
async function generateRuntimeAppConfigModule() {
|
|
637
|
+
const projectRoot = await getProjectRootDirectory();
|
|
638
|
+
const runtimeConfigPath = getRuntimeAppConfigPath();
|
|
639
|
+
await makeOutputDirFor(dirname(runtimeConfigPath));
|
|
640
|
+
const outputPath = join(projectRoot, runtimeConfigPath);
|
|
641
|
+
const configFilePath = await resolveCommerceAppConfig(projectRoot);
|
|
642
|
+
if (!configFilePath) throw new Error("Dynamic list options require an app.commerce.config.* file so generated actions can import the option factories at runtime.");
|
|
643
|
+
consola$1.info("Generating JS config module...");
|
|
644
|
+
if (TYPESCRIPT_CONFIG_EXTENSIONS.has(extname(configFilePath))) await bundleTypeScriptAppConfigModule(configFilePath, outputPath);
|
|
645
|
+
else await writeJavaScriptAppConfigModule(configFilePath, outputPath);
|
|
646
|
+
await updateAppConfigImportAlias(projectRoot, runtimeConfigPath);
|
|
647
|
+
consola$1.success(`Generated JS config module: ${relative(process.cwd(), outputPath)}`);
|
|
648
|
+
}
|
|
649
|
+
/** Remove the generated app config module when generated actions use static JSON. */
|
|
650
|
+
async function cleanupRuntimeAppConfigModule() {
|
|
651
|
+
const projectRoot = await getProjectRootDirectory();
|
|
652
|
+
await rm(join(projectRoot, getRuntimeAppConfigPath()), { force: true });
|
|
653
|
+
await deleteAppConfigImportAlias(projectRoot);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Prepare runtime-side config artifacts consumed by generated actions: the
|
|
657
|
+
* bundled ESM module and its `#app.commerce.config` package import alias.
|
|
658
|
+
*
|
|
659
|
+
* Generates them for dynamic schemas, cleans them up for static ones.
|
|
660
|
+
*/
|
|
661
|
+
async function prepareRuntimeAppConfigModule(appManifest) {
|
|
662
|
+
if (hasDynamicAppConfig(appManifest)) {
|
|
663
|
+
await generateRuntimeAppConfigModule();
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
await cleanupRuntimeAppConfigModule();
|
|
667
|
+
}
|
|
668
|
+
/** Switch static JSON imports to the generated runtime config module for dynamic schemas. */
|
|
669
|
+
function applyRuntimeAppConfigImport(template, actionName) {
|
|
670
|
+
if (actionName === "app-config" || actionName === "installation") return template.replace(STATIC_APP_MANIFEST_IMPORT, DYNAMIC_APP_CONFIG_IMPORT);
|
|
671
|
+
if (actionName === "config") return template.replace(STATIC_CONFIG_SCHEMA_IMPORT, DYNAMIC_APP_CONFIG_IMPORT).replace("const args = { configSchema };", "const args = { configSchema: appConfig.businessConfig.schema };");
|
|
672
|
+
return template;
|
|
673
|
+
}
|
|
502
674
|
/**
|
|
503
675
|
* Read an extension point's ext.config.yaml file and return it as a JS object.
|
|
504
676
|
* @param extensionPointId - The extension point ID to read the config for.
|
|
@@ -545,8 +717,10 @@ async function generateActionFiles(appManifest, actions, extensionPointId, templ
|
|
|
545
717
|
await makeOutputDirFor(getActionsDir(extensionPointId));
|
|
546
718
|
const projectRoot = await getProjectRootDirectory();
|
|
547
719
|
const outputFiles = [];
|
|
720
|
+
const useDynamicImports = hasDynamicAppConfig(appManifest);
|
|
548
721
|
for (const action of actions) {
|
|
549
722
|
let template = await readFile(join(templatesDir, action.templateFile), "utf-8");
|
|
723
|
+
if (useDynamicImports) template = applyRuntimeAppConfigImport(template, action.name);
|
|
550
724
|
if (action.name === "installation") {
|
|
551
725
|
const scriptsTemplate = await generateCustomScriptsTemplate(await readFile(join(templatesDir, "app-management", "custom-scripts.js.template"), "utf-8"), appManifest);
|
|
552
726
|
template = applyCustomScripts(template, scriptsTemplate);
|
|
@@ -614,6 +788,7 @@ async function generateRegistrationActionFile(appManifest, extensionPointId, tem
|
|
|
614
788
|
* @param templatesDir - The directory to load templates from, for testing purposes. Defaults to the generated actions template root.
|
|
615
789
|
*/
|
|
616
790
|
async function run$5(appManifest, templatesDir = TEMPLATES_DIR) {
|
|
791
|
+
await prepareRuntimeAppConfigModule(appManifest);
|
|
617
792
|
await generateActionFiles(appManifest, getRuntimeActions(await updateExtConfig(appManifest, EXTENSIBILITY_EXTENSION_POINT_ID), "app-management"), EXTENSIBILITY_EXTENSION_POINT_ID, templatesDir);
|
|
618
793
|
if (hasBusinessConfigSchema(appManifest)) await generateActionFiles(appManifest, getRuntimeActions(await updateExtConfig(appManifest, CONFIGURATION_EXTENSION_POINT_ID), "business-configuration"), CONFIGURATION_EXTENSION_POINT_ID, templatesDir);
|
|
619
794
|
if (hasAdminUiSdk(appManifest)) {
|
|
@@ -635,10 +810,18 @@ async function exec$5() {
|
|
|
635
810
|
//#endregion
|
|
636
811
|
//#region source/commands/generate/manifest/main.ts
|
|
637
812
|
async function run$4(appConfig) {
|
|
813
|
+
if (hasDynamicAppConfig(appConfig)) {
|
|
814
|
+
const stalePath = join(await getProjectRootDirectory(), getManifestPath());
|
|
815
|
+
if (await access(stalePath).then(() => true, () => false)) {
|
|
816
|
+
await rm(stalePath, { force: true });
|
|
817
|
+
consola$1.success(`Removed stale ${APP_MANIFEST_FILE}`);
|
|
818
|
+
}
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
638
821
|
consola$1.info("Generating app manifest...");
|
|
639
822
|
const contents = stringify$1(appConfig, null, 2);
|
|
640
823
|
await writeFile(join(await makeOutputDirFor(getGeneratedDir(EXTENSIBILITY_EXTENSION_POINT_ID)), APP_MANIFEST_FILE), contents, "utf-8");
|
|
641
|
-
consola$1.success(`Generated ${APP_MANIFEST_FILE}`);
|
|
824
|
+
consola$1.success(`Generated ${APP_MANIFEST_FILE}\n`);
|
|
642
825
|
}
|
|
643
826
|
/** Run the generate manifest command */
|
|
644
827
|
async function exec$4() {
|
|
@@ -670,7 +853,6 @@ async function run$3(appConfig) {
|
|
|
670
853
|
consola$1.debug("Business configuration schema not found in application configuration. Nothing to do.");
|
|
671
854
|
return;
|
|
672
855
|
}
|
|
673
|
-
consola$1.info("Generating configuration schema...");
|
|
674
856
|
const projectDir = await getProjectRootDirectory();
|
|
675
857
|
const envPath = join(projectDir, ".env");
|
|
676
858
|
await touch(envPath);
|
|
@@ -680,9 +862,19 @@ async function run$3(appConfig) {
|
|
|
680
862
|
if ("AIO_COMMERCE_CONFIG_ENCRYPTION_KEY" in process.env && String(process.env.AIO_COMMERCE_CONFIG_ENCRYPTION_KEY).trim().length > 0) execSync(`${packageExec} aio-commerce-lib-config encryption validate`);
|
|
681
863
|
else execSync(`${packageExec} aio-commerce-lib-config encryption setup`);
|
|
682
864
|
}
|
|
865
|
+
if (hasDynamicAppConfig(appConfig)) {
|
|
866
|
+
const stalePath = join(projectDir, getSchemaPath());
|
|
867
|
+
if (await access(stalePath).then(() => true, () => false)) {
|
|
868
|
+
await rm(stalePath, { force: true });
|
|
869
|
+
consola$1.success(`Removed stale ${CONFIG_SCHEMA_FILE_NAME}`);
|
|
870
|
+
}
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
consola$1.info("Generating configuration schema...");
|
|
874
|
+
const outputDir = await makeOutputDirFor(getGeneratedDir(CONFIGURATION_EXTENSION_POINT_ID));
|
|
683
875
|
const contents = stringify$1(appConfig.businessConfig.schema, null, 2);
|
|
684
|
-
await writeFile(join(
|
|
685
|
-
consola$1.success(`Generated ${CONFIG_SCHEMA_FILE_NAME}`);
|
|
876
|
+
await writeFile(join(outputDir, CONFIG_SCHEMA_FILE_NAME), contents, "utf-8");
|
|
877
|
+
consola$1.success(`Generated ${CONFIG_SCHEMA_FILE_NAME}\n`);
|
|
686
878
|
}
|
|
687
879
|
/** Run the generate schema command */
|
|
688
880
|
async function exec$3() {
|
|
@@ -797,6 +989,7 @@ async function syncImsCredentials() {
|
|
|
797
989
|
*/
|
|
798
990
|
async function run$1(extension, templatesDir = TEMPLATES_DIR) {
|
|
799
991
|
const appManifest = await loadAppManifest();
|
|
992
|
+
await prepareRuntimeAppConfigModule(appManifest);
|
|
800
993
|
if (extension === "extensibility/1") {
|
|
801
994
|
const { doc: extensibilityExtConfig } = await readExtConfig(EXTENSIBILITY_EXTENSION_POINT_ID);
|
|
802
995
|
await run$4(appManifest);
|
|
@@ -1206,7 +1399,7 @@ function runInstall(packageManager, dependencies, cwd = process.cwd()) {
|
|
|
1206
1399
|
*/
|
|
1207
1400
|
function installDependencies(packageManager, domains, cwd = process.cwd()) {
|
|
1208
1401
|
const packages = [];
|
|
1209
|
-
if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.
|
|
1402
|
+
if (domains.has("businessConfig.schema")) packages.push(`@adobe/aio-commerce-lib-config@^1.5.0`);
|
|
1210
1403
|
if (packages.length === 0) {
|
|
1211
1404
|
consola$1.info("No additional domain dependencies to install.");
|
|
1212
1405
|
return;
|
|
@@ -1233,7 +1426,7 @@ async function ensureInstallYaml(domains, cwd = process.cwd()) {
|
|
|
1233
1426
|
|
|
1234
1427
|
//#endregion
|
|
1235
1428
|
//#region source/commands/init/main.ts
|
|
1236
|
-
const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@1.
|
|
1429
|
+
const REQUIRED_DEPENDENCIES = ["@adobe/aio-commerce-sdk", `@adobe/aio-commerce-lib-app@1.6.0`];
|
|
1237
1430
|
/** Initialize the project */
|
|
1238
1431
|
async function run(flags, extraOptions) {
|
|
1239
1432
|
consola$1.start("Initializing app...");
|
|
@@ -1298,9 +1491,7 @@ Examples:
|
|
|
1298
1491
|
/** Run all generate targets in sequence */
|
|
1299
1492
|
async function generateAll() {
|
|
1300
1493
|
await exec$5();
|
|
1301
|
-
consola.log.raw("");
|
|
1302
1494
|
await exec$4();
|
|
1303
|
-
consola.log.raw("");
|
|
1304
1495
|
await exec$3();
|
|
1305
1496
|
}
|
|
1306
1497
|
/** Command handlers registry mapping command names to their subcommand handlers */
|