@zitadel/config 1.0.0-alpha.24 → 1.0.0-alpha.25
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/defaults/branding/centered/login.liquid +31 -11
- package/defaults/branding/minimal/login.liquid +30 -10
- package/dist/branding-contrast.d.mts +28 -21
- package/dist/branding-contrast.d.mts.map +1 -1
- package/dist/branding-contrast.mjs +1 -1
- package/dist/branding-contrast.mjs.map +1 -1
- package/dist/branding-url.d.mts +1 -2
- package/dist/branding-url.d.mts.map +1 -1
- package/dist/branding-url.mjs.map +1 -1
- package/dist/css-color.d.mts +5 -10
- package/dist/css-color.d.mts.map +1 -1
- package/dist/css-color.mjs +1 -1
- package/dist/css-color.mjs.map +1 -1
- package/dist/{defaults-BnWXllBk.d.mts → defaults-BtKIcWxW.d.mts} +11 -7
- package/dist/defaults-BtKIcWxW.d.mts.map +1 -0
- package/dist/{defaults-BnRHT7RQ.mjs → defaults-COLBFU3S.mjs} +1 -1
- package/dist/defaults-COLBFU3S.mjs.map +1 -0
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/idp/index.d.mts +2 -0
- package/dist/idp/index.mjs +2 -0
- package/dist/idp-ByzXQN85.mjs +207 -0
- package/dist/idp-ByzXQN85.mjs.map +1 -0
- package/dist/idp-connection-CHxGm1Wr.mjs +324 -0
- package/dist/idp-connection-CHxGm1Wr.mjs.map +1 -0
- package/dist/index-Cuxu-zQD.d.mts +210 -0
- package/dist/index-Cuxu-zQD.d.mts.map +1 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +5 -4
- package/dist/{meta-schemas-K8f7YZYz.mjs → meta-schemas-C03zgFux.mjs} +31 -328
- package/dist/meta-schemas-C03zgFux.mjs.map +1 -0
- package/dist/meta-schemas.d.mts +5 -6
- package/dist/meta-schemas.d.mts.map +1 -1
- package/dist/meta-schemas.mjs +1 -1
- package/dist/normalize.d.mts +3 -4
- package/dist/normalize.d.mts.map +1 -1
- package/dist/normalize.mjs.map +1 -1
- package/dist/{schemas-7oNU25Qz.mjs → schemas-CUU4Rf8J.mjs} +11 -4
- package/dist/schemas-CUU4Rf8J.mjs.map +1 -0
- package/dist/schemas.d.mts +361 -9
- package/dist/schemas.d.mts.map +1 -1
- package/dist/schemas.mjs +2 -2
- package/dist/template.d.mts +9 -10
- package/dist/template.d.mts.map +1 -1
- package/dist/template.mjs.map +1 -1
- package/dist/validate.d.mts +15 -13
- package/dist/validate.d.mts.map +1 -1
- package/dist/validate.mjs +28 -18
- package/dist/validate.mjs.map +1 -1
- package/meta-schemas/flow-definition.json +81 -6
- package/package.json +12 -6
- package/dist/defaults-BnRHT7RQ.mjs.map +0 -1
- package/dist/defaults-BnWXllBk.d.mts.map +0 -1
- package/dist/meta-schemas-K8f7YZYz.mjs.map +0 -1
- package/dist/schemas-7oNU25Qz.mjs.map +0 -1
package/dist/schemas.d.mts
CHANGED
|
@@ -1,17 +1,300 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
2
|
//#region src/schemas.d.ts
|
|
4
|
-
declare const schemaConfigSchema:
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare const schemaConfigSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
objectType: z.ZodOptional<z.ZodString>;
|
|
5
|
+
kind: z.ZodLiteral<"user-schema">;
|
|
6
|
+
metaSchema: z.ZodURL;
|
|
7
|
+
"x-auth-methods": z.ZodObject<{
|
|
8
|
+
password: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
enabled: z.ZodBoolean;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
passkey: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
enabled: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
magic_link: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
enabled: z.ZodBoolean;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
sso: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
enabled: z.ZodBoolean;
|
|
19
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
otp: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
enabled: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
"x-identifier": z.ZodOptional<z.ZodString>;
|
|
26
|
+
"x-display": z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
28
|
+
"x-unique": z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
29
|
+
unspecified: "unspecified";
|
|
30
|
+
project: "project";
|
|
31
|
+
team: "team";
|
|
32
|
+
}>, z.ZodNull]>>;
|
|
33
|
+
"x-claim": z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
|
|
34
|
+
"x-audit": z.ZodDefault<z.ZodBoolean>;
|
|
35
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"schema-url">;
|
|
39
|
+
url: z.ZodURL;
|
|
40
|
+
}, z.core.$strip>]>;
|
|
41
|
+
export declare const flowConfigSchema: z.ZodObject<{
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
active: "active";
|
|
45
|
+
draft: "draft";
|
|
46
|
+
}>;
|
|
47
|
+
user_schema: z.ZodString;
|
|
48
|
+
purposes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
49
|
+
audience: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
team_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
app_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
56
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
kind: z.ZodEnum<{
|
|
59
|
+
passkey: "passkey";
|
|
60
|
+
submit: "submit";
|
|
61
|
+
passkey_register: "passkey_register";
|
|
62
|
+
navigate: "navigate";
|
|
63
|
+
}>;
|
|
64
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
text_key: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>>>;
|
|
67
|
+
gates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
68
|
+
kind: z.ZodEnum<{
|
|
69
|
+
captcha: "captcha";
|
|
70
|
+
}>;
|
|
71
|
+
provider: z.ZodString;
|
|
72
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
73
|
+
}, z.core.$strip>>>;
|
|
74
|
+
sso_providers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
75
|
+
on_success: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
create_user: "create_user";
|
|
77
|
+
create_user_with_sso: "create_user_with_sso";
|
|
78
|
+
}>>;
|
|
79
|
+
complete: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
redirect: "redirect";
|
|
81
|
+
show: "show";
|
|
82
|
+
}>>;
|
|
83
|
+
transitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
84
|
+
target: z.ZodString;
|
|
85
|
+
action: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
86
|
+
switch: "switch";
|
|
87
|
+
pivot: "pivot";
|
|
88
|
+
}>, z.ZodNull]>>;
|
|
89
|
+
purpose: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
90
|
+
login: "login";
|
|
91
|
+
register: "register";
|
|
92
|
+
recovery: "recovery";
|
|
93
|
+
profiling: "profiling";
|
|
94
|
+
reauth: "reauth";
|
|
95
|
+
link_account: "link_account";
|
|
96
|
+
}>, z.ZodNull]>>;
|
|
97
|
+
}, z.core.$strip>>>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export declare const createFlowDefinitionRequestSchema: z.ZodObject<{
|
|
101
|
+
project_id: z.ZodString;
|
|
102
|
+
schema_uri: z.ZodOptional<z.ZodURL>;
|
|
103
|
+
flow_definition: z.ZodObject<{
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
status: z.ZodEnum<{
|
|
106
|
+
active: "active";
|
|
107
|
+
draft: "draft";
|
|
108
|
+
}>;
|
|
109
|
+
user_schema: z.ZodString;
|
|
110
|
+
purposes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
111
|
+
audience: z.ZodOptional<z.ZodObject<{
|
|
112
|
+
team_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
+
app_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
118
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
kind: z.ZodEnum<{
|
|
121
|
+
passkey: "passkey";
|
|
122
|
+
submit: "submit";
|
|
123
|
+
passkey_register: "passkey_register";
|
|
124
|
+
navigate: "navigate";
|
|
125
|
+
}>;
|
|
126
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
127
|
+
text_key: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>>>;
|
|
129
|
+
gates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
130
|
+
kind: z.ZodEnum<{
|
|
131
|
+
captcha: "captcha";
|
|
132
|
+
}>;
|
|
133
|
+
provider: z.ZodString;
|
|
134
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
135
|
+
}, z.core.$strip>>>;
|
|
136
|
+
sso_providers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
137
|
+
on_success: z.ZodOptional<z.ZodEnum<{
|
|
138
|
+
create_user: "create_user";
|
|
139
|
+
create_user_with_sso: "create_user_with_sso";
|
|
140
|
+
}>>;
|
|
141
|
+
complete: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
redirect: "redirect";
|
|
143
|
+
show: "show";
|
|
144
|
+
}>>;
|
|
145
|
+
transitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
146
|
+
target: z.ZodString;
|
|
147
|
+
action: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
148
|
+
switch: "switch";
|
|
149
|
+
pivot: "pivot";
|
|
150
|
+
}>, z.ZodNull]>>;
|
|
151
|
+
purpose: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
152
|
+
login: "login";
|
|
153
|
+
register: "register";
|
|
154
|
+
recovery: "recovery";
|
|
155
|
+
profiling: "profiling";
|
|
156
|
+
reauth: "reauth";
|
|
157
|
+
link_account: "link_account";
|
|
158
|
+
}>, z.ZodNull]>>;
|
|
159
|
+
}, z.core.$strip>>>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
/**
|
|
164
|
+
* One `.zitadel/idps/<slug>.json` body: the connection document `POST /idps`
|
|
165
|
+
* carries under `idp`. The generated Zod enforces the contract the meta-schema
|
|
166
|
+
* states, including that `client_secret` is a `${{ NAME }}` reference and
|
|
167
|
+
* never a literal.
|
|
168
|
+
*/
|
|
169
|
+
export declare const idpConnectionConfigSchema: z.ZodObject<{
|
|
170
|
+
slug: z.ZodString;
|
|
171
|
+
protocol: z.ZodEnum<{
|
|
172
|
+
oidc: "oidc";
|
|
173
|
+
oauth2: "oauth2";
|
|
174
|
+
}>;
|
|
175
|
+
template: z.ZodOptional<z.ZodString>;
|
|
176
|
+
display_name: z.ZodString;
|
|
177
|
+
subject_claim: z.ZodOptional<z.ZodString>;
|
|
178
|
+
claim_mapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
179
|
+
verified_claims: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
180
|
+
provisioning: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
creation: z.ZodDefault<z.ZodEnum<{
|
|
182
|
+
disabled: "disabled";
|
|
183
|
+
auto: "auto";
|
|
184
|
+
}>>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
oidc: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
issuer: z.ZodString;
|
|
188
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
189
|
+
id_token_mapping: z.ZodDefault<z.ZodBoolean>;
|
|
190
|
+
authorization_endpoint: z.ZodOptional<z.ZodString>;
|
|
191
|
+
token_endpoint: z.ZodOptional<z.ZodString>;
|
|
192
|
+
userinfo_endpoint: z.ZodOptional<z.ZodString>;
|
|
193
|
+
client_id: z.ZodString;
|
|
194
|
+
client_secret: z.ZodString;
|
|
195
|
+
token_endpoint_auth_method: z.ZodDefault<z.ZodEnum<{
|
|
196
|
+
client_secret_basic: "client_secret_basic";
|
|
197
|
+
client_secret_post: "client_secret_post";
|
|
198
|
+
}>>;
|
|
199
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
200
|
+
pkce_enabled: z.ZodDefault<z.ZodBoolean>;
|
|
201
|
+
static_authorize_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
oauth2: z.ZodOptional<z.ZodObject<{
|
|
204
|
+
authorization_endpoint: z.ZodString;
|
|
205
|
+
token_endpoint: z.ZodString;
|
|
206
|
+
userinfo_endpoint: z.ZodString;
|
|
207
|
+
client_id: z.ZodString;
|
|
208
|
+
client_secret: z.ZodString;
|
|
209
|
+
token_endpoint_auth_method: z.ZodDefault<z.ZodEnum<{
|
|
210
|
+
client_secret_basic: "client_secret_basic";
|
|
211
|
+
client_secret_post: "client_secret_post";
|
|
212
|
+
}>>;
|
|
213
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
214
|
+
pkce_enabled: z.ZodDefault<z.ZodBoolean>;
|
|
215
|
+
static_authorize_parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
216
|
+
supplementary_fetch: z.ZodOptional<z.ZodEnum<{
|
|
217
|
+
github_primary_email: "github_primary_email";
|
|
218
|
+
}>>;
|
|
219
|
+
}, z.core.$strip>>;
|
|
220
|
+
}, z.core.$strip>;
|
|
7
221
|
/** The wire shape of a branding revision (`POST /branding` request body). */
|
|
8
|
-
declare const brandingWireSchema:
|
|
222
|
+
export declare const brandingWireSchema: z.ZodObject<{
|
|
223
|
+
layout: z.ZodDefault<z.ZodEnum<{
|
|
224
|
+
centered: "centered";
|
|
225
|
+
split: "split";
|
|
226
|
+
}>>;
|
|
227
|
+
liquid_template: z.ZodOptional<z.ZodString>;
|
|
228
|
+
logo_url: z.ZodOptional<z.ZodURL>;
|
|
229
|
+
hero_url: z.ZodOptional<z.ZodURL>;
|
|
230
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
232
|
+
auto: "auto";
|
|
233
|
+
light: "light";
|
|
234
|
+
dark: "dark";
|
|
235
|
+
}>>;
|
|
236
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
logo_url: z.ZodOptional<z.ZodURL>;
|
|
238
|
+
palette: z.ZodOptional<z.ZodObject<{
|
|
239
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
240
|
+
on_primary: z.ZodOptional<z.ZodString>;
|
|
241
|
+
background: z.ZodOptional<z.ZodString>;
|
|
242
|
+
surface: z.ZodOptional<z.ZodString>;
|
|
243
|
+
muted: z.ZodOptional<z.ZodString>;
|
|
244
|
+
border: z.ZodOptional<z.ZodString>;
|
|
245
|
+
text: z.ZodOptional<z.ZodString>;
|
|
246
|
+
text_muted: z.ZodOptional<z.ZodString>;
|
|
247
|
+
link: z.ZodOptional<z.ZodString>;
|
|
248
|
+
success: z.ZodOptional<z.ZodString>;
|
|
249
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
250
|
+
error: z.ZodOptional<z.ZodString>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
}, z.core.$strip>>;
|
|
253
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
logo_url: z.ZodOptional<z.ZodURL>;
|
|
255
|
+
palette: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
257
|
+
on_primary: z.ZodOptional<z.ZodString>;
|
|
258
|
+
background: z.ZodOptional<z.ZodString>;
|
|
259
|
+
surface: z.ZodOptional<z.ZodString>;
|
|
260
|
+
muted: z.ZodOptional<z.ZodString>;
|
|
261
|
+
border: z.ZodOptional<z.ZodString>;
|
|
262
|
+
text: z.ZodOptional<z.ZodString>;
|
|
263
|
+
text_muted: z.ZodOptional<z.ZodString>;
|
|
264
|
+
link: z.ZodOptional<z.ZodString>;
|
|
265
|
+
success: z.ZodOptional<z.ZodString>;
|
|
266
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
267
|
+
error: z.ZodOptional<z.ZodString>;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
}, z.core.$strip>>;
|
|
270
|
+
}, z.core.$strip>>;
|
|
271
|
+
typography: z.ZodOptional<z.ZodObject<{
|
|
272
|
+
font_family: z.ZodOptional<z.ZodString>;
|
|
273
|
+
font_url: z.ZodOptional<z.ZodURL>;
|
|
274
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
275
|
+
}, z.core.$strip>>;
|
|
276
|
+
shape: z.ZodOptional<z.ZodObject<{
|
|
277
|
+
radius: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
278
|
+
none: "none";
|
|
279
|
+
sm: "sm";
|
|
280
|
+
md: "md";
|
|
281
|
+
lg: "lg";
|
|
282
|
+
full: "full";
|
|
283
|
+
}>, z.ZodInt]>>;
|
|
284
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
285
|
+
compact: "compact";
|
|
286
|
+
regular: "regular";
|
|
287
|
+
comfortable: "comfortable";
|
|
288
|
+
}>>;
|
|
289
|
+
logo_scale: z.ZodOptional<z.ZodNumber>;
|
|
290
|
+
}, z.core.$strip>>;
|
|
291
|
+
}, z.core.$strip>;
|
|
9
292
|
/**
|
|
10
293
|
* `{ "$file": "<path>" }`, which a `.zitadel/` file may hold in place of a
|
|
11
294
|
* string field the OpenAPI YAML marks `x-local: file`. The path is relative to
|
|
12
295
|
* the file holding it; the CLI inlines the content before publishing.
|
|
13
296
|
*/
|
|
14
|
-
declare const localFileReferenceSchema: z.ZodObject<{
|
|
297
|
+
export declare const localFileReferenceSchema: z.ZodObject<{
|
|
15
298
|
$file: z.ZodString;
|
|
16
299
|
}, z.core.$strict>;
|
|
17
300
|
/**
|
|
@@ -19,9 +302,78 @@ declare const localFileReferenceSchema: z.ZodObject<{
|
|
|
19
302
|
* `liquid_template` may also be a `$file` reference to the sibling `.liquid`
|
|
20
303
|
* template (the meta-schema `branding.json` mirrors this).
|
|
21
304
|
*/
|
|
22
|
-
declare const brandingConfigSchema: z.ZodObject<{
|
|
23
|
-
|
|
305
|
+
export declare const brandingConfigSchema: z.ZodObject<{
|
|
306
|
+
logo_url: z.ZodOptional<z.ZodString>;
|
|
307
|
+
hero_url: z.ZodOptional<z.ZodString>;
|
|
308
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
309
|
+
liquid_template: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
310
|
+
$file: z.ZodString;
|
|
311
|
+
}, z.core.$strict>]>>;
|
|
312
|
+
layout: z.ZodDefault<z.ZodEnum<{
|
|
313
|
+
centered: "centered";
|
|
314
|
+
split: "split";
|
|
315
|
+
}>>;
|
|
316
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
317
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
318
|
+
auto: "auto";
|
|
319
|
+
light: "light";
|
|
320
|
+
dark: "dark";
|
|
321
|
+
}>>;
|
|
322
|
+
light: z.ZodOptional<z.ZodObject<{
|
|
323
|
+
logo_url: z.ZodOptional<z.ZodURL>;
|
|
324
|
+
palette: z.ZodOptional<z.ZodObject<{
|
|
325
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
326
|
+
on_primary: z.ZodOptional<z.ZodString>;
|
|
327
|
+
background: z.ZodOptional<z.ZodString>;
|
|
328
|
+
surface: z.ZodOptional<z.ZodString>;
|
|
329
|
+
muted: z.ZodOptional<z.ZodString>;
|
|
330
|
+
border: z.ZodOptional<z.ZodString>;
|
|
331
|
+
text: z.ZodOptional<z.ZodString>;
|
|
332
|
+
text_muted: z.ZodOptional<z.ZodString>;
|
|
333
|
+
link: z.ZodOptional<z.ZodString>;
|
|
334
|
+
success: z.ZodOptional<z.ZodString>;
|
|
335
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
336
|
+
error: z.ZodOptional<z.ZodString>;
|
|
337
|
+
}, z.core.$strip>>;
|
|
338
|
+
}, z.core.$strip>>;
|
|
339
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
340
|
+
logo_url: z.ZodOptional<z.ZodURL>;
|
|
341
|
+
palette: z.ZodOptional<z.ZodObject<{
|
|
342
|
+
primary: z.ZodOptional<z.ZodString>;
|
|
343
|
+
on_primary: z.ZodOptional<z.ZodString>;
|
|
344
|
+
background: z.ZodOptional<z.ZodString>;
|
|
345
|
+
surface: z.ZodOptional<z.ZodString>;
|
|
346
|
+
muted: z.ZodOptional<z.ZodString>;
|
|
347
|
+
border: z.ZodOptional<z.ZodString>;
|
|
348
|
+
text: z.ZodOptional<z.ZodString>;
|
|
349
|
+
text_muted: z.ZodOptional<z.ZodString>;
|
|
350
|
+
link: z.ZodOptional<z.ZodString>;
|
|
351
|
+
success: z.ZodOptional<z.ZodString>;
|
|
352
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
353
|
+
error: z.ZodOptional<z.ZodString>;
|
|
354
|
+
}, z.core.$strip>>;
|
|
355
|
+
}, z.core.$strip>>;
|
|
356
|
+
}, z.core.$strip>>;
|
|
357
|
+
typography: z.ZodOptional<z.ZodObject<{
|
|
358
|
+
font_family: z.ZodOptional<z.ZodString>;
|
|
359
|
+
font_url: z.ZodOptional<z.ZodURL>;
|
|
360
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
361
|
+
}, z.core.$strip>>;
|
|
362
|
+
shape: z.ZodOptional<z.ZodObject<{
|
|
363
|
+
radius: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
364
|
+
none: "none";
|
|
365
|
+
sm: "sm";
|
|
366
|
+
md: "md";
|
|
367
|
+
lg: "lg";
|
|
368
|
+
full: "full";
|
|
369
|
+
}>, z.ZodInt]>>;
|
|
370
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
371
|
+
compact: "compact";
|
|
372
|
+
regular: "regular";
|
|
373
|
+
comfortable: "comfortable";
|
|
374
|
+
}>>;
|
|
375
|
+
logo_scale: z.ZodOptional<z.ZodNumber>;
|
|
376
|
+
}, z.core.$strip>>;
|
|
24
377
|
}, z.core.$strict>;
|
|
25
378
|
//#endregion
|
|
26
|
-
export { brandingConfigSchema, brandingWireSchema, createFlowDefinitionRequestSchema, flowConfigSchema, localFileReferenceSchema, schemaConfigSchema };
|
|
27
379
|
//# sourceMappingURL=schemas.d.mts.map
|
package/dist/schemas.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.mts","names":[],"sources":["../src/schemas.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schemas.d.mts","names":[],"sources":["../src/schemas.ts"],"mappings":";;qBAWa,oBAAkB,EAAA,mBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmB,EAAA,KAAA;qBACrC,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiD,EAAA,KAAA;qBACjE,mCAAiC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA2B,EAAA,KAAA;;;;;;;qBAQ5D,2BAAyB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA0B,EAAA,KAAA;;qBAGnD,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqB,EAAA,KAAA;;;;;;qBAOvC,0BAAwB,EAAA;;GAA+C,EAAA,KAAA;;;;;;qBAOvE,sBAAoB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuD7B,EAAA,KAAA"}
|
package/dist/schemas.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./branding-url.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { brandingConfigSchema, brandingWireSchema, createFlowDefinitionRequestSchema, flowConfigSchema, localFileReferenceSchema, schemaConfigSchema };
|
|
2
|
+
import { a as idpConnectionConfigSchema, i as flowConfigSchema, n as brandingWireSchema, o as localFileReferenceSchema, r as createFlowDefinitionRequestSchema, s as schemaConfigSchema, t as brandingConfigSchema } from "./schemas-CUU4Rf8J.mjs";
|
|
3
|
+
export { brandingConfigSchema, brandingWireSchema, createFlowDefinitionRequestSchema, flowConfigSchema, idpConnectionConfigSchema, localFileReferenceSchema, schemaConfigSchema };
|
package/dist/template.d.mts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
//#region src/template.d.ts
|
|
2
2
|
/** The `{% mandatory_gates %}` runtime safety-net tag every template must emit. */
|
|
3
|
-
declare const MANDATORY_GATES_TAG = "mandatory_gates";
|
|
3
|
+
export declare const MANDATORY_GATES_TAG = "mandatory_gates";
|
|
4
4
|
/**
|
|
5
5
|
* Custom Liquid tags the login orchestrator registers beyond the standard
|
|
6
6
|
* set. Validators must register them (as no-ops) or parsing valid templates
|
|
7
7
|
* fails; `@zitadel/components` registers the real implementations.
|
|
8
8
|
*/
|
|
9
|
-
declare const TEMPLATE_TAGS: readonly ["mandatory_gates"];
|
|
9
|
+
export declare const TEMPLATE_TAGS: readonly ["mandatory_gates"];
|
|
10
10
|
/**
|
|
11
11
|
* Byte cap for stored templates. Mirrors `maxLength` on
|
|
12
12
|
* `branding.liquid_template` in the OpenAPI contract and
|
|
13
13
|
* `MaxBrandingTemplateBytes` in the Go gate.
|
|
14
14
|
*/
|
|
15
|
-
declare const MAX_TEMPLATE_BYTES = 131072;
|
|
16
|
-
type TemplateValidationSeverity = "error" | "warning";
|
|
15
|
+
export declare const MAX_TEMPLATE_BYTES = 131072;
|
|
16
|
+
export type TemplateValidationSeverity = "error" | "warning";
|
|
17
17
|
/**
|
|
18
18
|
* Rule catalog with pointers into the Go lexical gate
|
|
19
19
|
* (`internal/domain/branding_validator.go`) where a server-side mirror
|
|
@@ -21,7 +21,7 @@ type TemplateValidationSeverity = "error" | "warning";
|
|
|
21
21
|
* cannot check them (wrong dialect) and render-time behavior degrades
|
|
22
22
|
* safely without them.
|
|
23
23
|
*/
|
|
24
|
-
declare const TEMPLATE_VALIDATION_RULES: {
|
|
24
|
+
export declare const TEMPLATE_VALIDATION_RULES: {
|
|
25
25
|
readonly parse: {
|
|
26
26
|
readonly goRef: null;
|
|
27
27
|
};
|
|
@@ -47,8 +47,8 @@ declare const TEMPLATE_VALIDATION_RULES: {
|
|
|
47
47
|
readonly goRef: null;
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
type TemplateValidationRuleId = keyof typeof TEMPLATE_VALIDATION_RULES;
|
|
51
|
-
type TemplateValidationIssue = {
|
|
50
|
+
export type TemplateValidationRuleId = keyof typeof TEMPLATE_VALIDATION_RULES;
|
|
51
|
+
export type TemplateValidationIssue = {
|
|
52
52
|
severity: TemplateValidationSeverity;
|
|
53
53
|
rule: TemplateValidationRuleId;
|
|
54
54
|
message: string;
|
|
@@ -64,13 +64,12 @@ type BannedPattern = {
|
|
|
64
64
|
* doesn't false-positive; its separator class includes `/` because HTML
|
|
65
65
|
* treats a slash between attributes as whitespace (`<img/onerror=…>`).
|
|
66
66
|
*/
|
|
67
|
-
declare const BANNED_TEMPLATE_PATTERNS: readonly BannedPattern[];
|
|
67
|
+
export declare const BANNED_TEMPLATE_PATTERNS: readonly BannedPattern[];
|
|
68
68
|
/**
|
|
69
69
|
* Validates a login template. Pure and non-throwing, like
|
|
70
70
|
* `validateFlowDefinition`: returns an issue list, empty when the template
|
|
71
71
|
* is valid.
|
|
72
72
|
*/
|
|
73
|
-
declare function validateLoginTemplate(template: string): TemplateValidationIssue[];
|
|
73
|
+
export declare function validateLoginTemplate(template: string): TemplateValidationIssue[];
|
|
74
74
|
//#endregion
|
|
75
|
-
export { BANNED_TEMPLATE_PATTERNS, MANDATORY_GATES_TAG, MAX_TEMPLATE_BYTES, TEMPLATE_TAGS, TEMPLATE_VALIDATION_RULES, TemplateValidationIssue, TemplateValidationRuleId, TemplateValidationSeverity, validateLoginTemplate };
|
|
76
75
|
//# sourceMappingURL=template.d.mts.map
|
package/dist/template.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.mts","names":[],"sources":["../src/template.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"template.d.mts","names":[],"sources":["../src/template.ts"],"mappings":";;qBAkBa;;;;;;qBAOA;;;;;;qBAOA;YAED;;;;;;;;qBASC;;;;;;;;;;;;;;;;;;;;;;;;;;YAWD,wCAAwC;YAExC;EACV,UAAU;EACV,MAAM;EACN;;KAGG;EACH,MAAM;EACN,SAAS;EACT;;;;;;;;qBASW,mCAAmC;;;;;;wBAqEhC,sBAAsB,mBAAmB"}
|
package/dist/template.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.mjs","names":[],"sources":["../src/template.ts"],"sourcesContent":["/**\n * The authoritative login-template validator (ADR 040).\n *\n * Runs where authoring happens — `zitadel plan`/`apply`, and later editors —\n * against the same LiquidJS dialect `@zitadel/components` renders. The Go\n * server cannot parse this dialect faithfully, so it only mirrors the\n * lexical subset below (`internal/domain/branding_validator.go`, see the\n * `goRef` entries in {@link TEMPLATE_VALIDATION_RULES}); keep the two\n * pattern lists in sync.\n *\n * Render-time safety does not depend on this validator: the component\n * escapes all output, neuters `| raw`, sanitises via DOMPurify, and patches\n * missing required UI with `{% mandatory_gates %}`\n * (`docs/design/flowengine/template-security.md`).\n */\nimport { Liquid } from \"liquidjs\";\n\n/** The `{% mandatory_gates %}` runtime safety-net tag every template must emit. */\nexport const MANDATORY_GATES_TAG = \"mandatory_gates\";\n\n/**\n * Custom Liquid tags the login orchestrator registers beyond the standard\n * set. Validators must register them (as no-ops) or parsing valid templates\n * fails; `@zitadel/components` registers the real implementations.\n */\nexport const TEMPLATE_TAGS = [MANDATORY_GATES_TAG] as const;\n\n/**\n * Byte cap for stored templates. Mirrors `maxLength` on\n * `branding.liquid_template` in the OpenAPI contract and\n * `MaxBrandingTemplateBytes` in the Go gate.\n */\nexport const MAX_TEMPLATE_BYTES = 131072;\n\nexport type TemplateValidationSeverity = \"error\" | \"warning\";\n\n/**\n * Rule catalog with pointers into the Go lexical gate\n * (`internal/domain/branding_validator.go`) where a server-side mirror\n * exists. `parse` and `mandatory-gates` are authoring-only: the server\n * cannot check them (wrong dialect) and render-time behavior degrades\n * safely without them.\n */\nexport const TEMPLATE_VALIDATION_RULES = {\n parse: { goRef: null },\n size: { goRef: \"MaxBrandingTemplateBytes\" },\n \"no-script-tag\": { goRef: \"brandingScriptTag\" },\n \"no-style-tag\": { goRef: \"brandingStyleTag\" },\n \"no-inline-handlers\": { goRef: \"brandingInlineHandler\" },\n \"no-javascript-urls\": { goRef: \"brandingJavascriptURL\" },\n \"no-raw-filter\": { goRef: \"brandingRawFilter\" },\n \"mandatory-gates\": { goRef: null },\n} as const;\n\nexport type TemplateValidationRuleId = keyof typeof TEMPLATE_VALIDATION_RULES;\n\nexport type TemplateValidationIssue = {\n severity: TemplateValidationSeverity;\n rule: TemplateValidationRuleId;\n message: string;\n};\n\ntype BannedPattern = {\n rule: TemplateValidationRuleId;\n pattern: RegExp;\n message: string;\n};\n\n/**\n * Lexical bans, identical to the Go gate. The inline-handler pattern only\n * matches inside an open tag so Liquid like `{% assign online = true %}`\n * doesn't false-positive; its separator class includes `/` because HTML\n * treats a slash between attributes as whitespace (`<img/onerror=…>`).\n */\nexport const BANNED_TEMPLATE_PATTERNS: readonly BannedPattern[] = [\n {\n rule: \"no-script-tag\",\n pattern: /<\\s*script\\b/i,\n message: \"Templates must not contain <script> tags.\",\n },\n {\n rule: \"no-style-tag\",\n pattern: /<\\s*style\\b/i,\n message: \"Templates must not contain <style> tags — theming is orchestrator-owned via tokens.\",\n },\n {\n rule: \"no-inline-handlers\",\n pattern: /<[a-z][^>]*[\\s/]on[a-z]+\\s*=/i,\n message: \"Templates must not contain inline event handlers (on*= attributes).\",\n },\n {\n rule: \"no-javascript-urls\",\n pattern: /javascript\\s*:/i,\n message: \"Templates must not contain javascript: URLs.\",\n },\n {\n rule: \"no-raw-filter\",\n pattern: /\\|\\s*raw\\b/,\n message:\n \"Templates must not use the | raw filter. The renderer neuters it anyway; remove it from the template.\",\n },\n] as const;\n\n// Derived from the exported tag name so a rename cannot silently diverge\n// the validator from the renderer contract.\nconst MANDATORY_GATES_PATTERN = new RegExp(`\\\\{%-?\\\\s*${MANDATORY_GATES_TAG}\\\\s*-?%\\\\}`);\n\nlet parseEngine: Liquid | undefined;\n\n/**\n * A parse-only engine mirroring the orchestrator's dialect options\n * (`packages/components/src/orchestrator/liquid.ts`); custom tags are\n * registered as no-ops because only parseability matters here.\n */\nfunction getParseEngine(): Liquid {\n if (!parseEngine) {\n const engine = new Liquid({\n cache: false,\n jsTruthy: true,\n relativeReference: false,\n strictFilters: false,\n strictVariables: false,\n });\n for (const tag of TEMPLATE_TAGS) {\n engine.registerTag(tag, {\n parse() {\n // no-op: the tag takes no arguments and no body\n },\n render() {\n return \"\";\n },\n });\n }\n parseEngine = engine;\n }\n return parseEngine;\n}\n\n/**\n * Validates a login template. Pure and non-throwing, like\n * `validateFlowDefinition`: returns an issue list, empty when the template\n * is valid.\n */\nexport function validateLoginTemplate(template: string): TemplateValidationIssue[] {\n const issues: TemplateValidationIssue[] = [];\n\n const bytes = new TextEncoder().encode(template).length;\n if (bytes > MAX_TEMPLATE_BYTES) {\n issues.push({\n severity: \"error\",\n rule: \"size\",\n message: `Template is ${bytes} bytes; the platform caps liquid_template at ${MAX_TEMPLATE_BYTES} bytes.`,\n });\n }\n\n for (const banned of BANNED_TEMPLATE_PATTERNS) {\n if (banned.pattern.test(template)) {\n issues.push({ severity: \"error\", rule: banned.rule, message: banned.message });\n }\n }\n\n if (!MANDATORY_GATES_PATTERN.test(template)) {\n issues.push({\n severity: \"error\",\n rule: \"mandatory-gates\",\n message:\n \"Template must contain a trailing {% mandatory_gates %} tag — the runtime safety net that appends any required field and the primary action a template left out.\",\n });\n }\n\n try {\n getParseEngine().parse(template);\n } catch (error) {\n issues.push({\n severity: \"error\",\n rule: \"parse\",\n message: `Template is not valid LiquidJS: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n\n return issues;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAa,sBAAsB;;;;;;AAOnC,MAAa,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"template.mjs","names":[],"sources":["../src/template.ts"],"sourcesContent":["/**\n * The authoritative login-template validator (ADR 040).\n *\n * Runs where authoring happens — `zitadel plan`/`apply`, and later editors —\n * against the same LiquidJS dialect `@zitadel/components` renders. The Go\n * server cannot parse this dialect faithfully, so it only mirrors the\n * lexical subset below (`internal/domain/branding_validator.go`, see the\n * `goRef` entries in {@link TEMPLATE_VALIDATION_RULES}); keep the two\n * pattern lists in sync.\n *\n * Render-time safety does not depend on this validator: the component\n * escapes all output, neuters `| raw`, sanitises via DOMPurify, and patches\n * missing required UI with `{% mandatory_gates %}`\n * (`docs/design/flowengine/template-security.md`).\n */\nimport { Liquid } from \"liquidjs\";\n\n/** The `{% mandatory_gates %}` runtime safety-net tag every template must emit. */\nexport const MANDATORY_GATES_TAG = \"mandatory_gates\";\n\n/**\n * Custom Liquid tags the login orchestrator registers beyond the standard\n * set. Validators must register them (as no-ops) or parsing valid templates\n * fails; `@zitadel/components` registers the real implementations.\n */\nexport const TEMPLATE_TAGS = [MANDATORY_GATES_TAG] as const;\n\n/**\n * Byte cap for stored templates. Mirrors `maxLength` on\n * `branding.liquid_template` in the OpenAPI contract and\n * `MaxBrandingTemplateBytes` in the Go gate.\n */\nexport const MAX_TEMPLATE_BYTES = 131072;\n\nexport type TemplateValidationSeverity = \"error\" | \"warning\";\n\n/**\n * Rule catalog with pointers into the Go lexical gate\n * (`internal/domain/branding_validator.go`) where a server-side mirror\n * exists. `parse` and `mandatory-gates` are authoring-only: the server\n * cannot check them (wrong dialect) and render-time behavior degrades\n * safely without them.\n */\nexport const TEMPLATE_VALIDATION_RULES = {\n parse: { goRef: null },\n size: { goRef: \"MaxBrandingTemplateBytes\" },\n \"no-script-tag\": { goRef: \"brandingScriptTag\" },\n \"no-style-tag\": { goRef: \"brandingStyleTag\" },\n \"no-inline-handlers\": { goRef: \"brandingInlineHandler\" },\n \"no-javascript-urls\": { goRef: \"brandingJavascriptURL\" },\n \"no-raw-filter\": { goRef: \"brandingRawFilter\" },\n \"mandatory-gates\": { goRef: null },\n} as const;\n\nexport type TemplateValidationRuleId = keyof typeof TEMPLATE_VALIDATION_RULES;\n\nexport type TemplateValidationIssue = {\n severity: TemplateValidationSeverity;\n rule: TemplateValidationRuleId;\n message: string;\n};\n\ntype BannedPattern = {\n rule: TemplateValidationRuleId;\n pattern: RegExp;\n message: string;\n};\n\n/**\n * Lexical bans, identical to the Go gate. The inline-handler pattern only\n * matches inside an open tag so Liquid like `{% assign online = true %}`\n * doesn't false-positive; its separator class includes `/` because HTML\n * treats a slash between attributes as whitespace (`<img/onerror=…>`).\n */\nexport const BANNED_TEMPLATE_PATTERNS: readonly BannedPattern[] = [\n {\n rule: \"no-script-tag\",\n pattern: /<\\s*script\\b/i,\n message: \"Templates must not contain <script> tags.\",\n },\n {\n rule: \"no-style-tag\",\n pattern: /<\\s*style\\b/i,\n message: \"Templates must not contain <style> tags — theming is orchestrator-owned via tokens.\",\n },\n {\n rule: \"no-inline-handlers\",\n pattern: /<[a-z][^>]*[\\s/]on[a-z]+\\s*=/i,\n message: \"Templates must not contain inline event handlers (on*= attributes).\",\n },\n {\n rule: \"no-javascript-urls\",\n pattern: /javascript\\s*:/i,\n message: \"Templates must not contain javascript: URLs.\",\n },\n {\n rule: \"no-raw-filter\",\n pattern: /\\|\\s*raw\\b/,\n message:\n \"Templates must not use the | raw filter. The renderer neuters it anyway; remove it from the template.\",\n },\n] as const;\n\n// Derived from the exported tag name so a rename cannot silently diverge\n// the validator from the renderer contract.\nconst MANDATORY_GATES_PATTERN = new RegExp(`\\\\{%-?\\\\s*${MANDATORY_GATES_TAG}\\\\s*-?%\\\\}`);\n\nlet parseEngine: Liquid | undefined;\n\n/**\n * A parse-only engine mirroring the orchestrator's dialect options\n * (`packages/components/src/orchestrator/liquid.ts`); custom tags are\n * registered as no-ops because only parseability matters here.\n */\nfunction getParseEngine(): Liquid {\n if (!parseEngine) {\n const engine = new Liquid({\n cache: false,\n jsTruthy: true,\n relativeReference: false,\n strictFilters: false,\n strictVariables: false,\n });\n for (const tag of TEMPLATE_TAGS) {\n engine.registerTag(tag, {\n parse() {\n // no-op: the tag takes no arguments and no body\n },\n render() {\n return \"\";\n },\n });\n }\n parseEngine = engine;\n }\n return parseEngine;\n}\n\n/**\n * Validates a login template. Pure and non-throwing, like\n * `validateFlowDefinition`: returns an issue list, empty when the template\n * is valid.\n */\nexport function validateLoginTemplate(template: string): TemplateValidationIssue[] {\n const issues: TemplateValidationIssue[] = [];\n\n const bytes = new TextEncoder().encode(template).length;\n if (bytes > MAX_TEMPLATE_BYTES) {\n issues.push({\n severity: \"error\",\n rule: \"size\",\n message: `Template is ${bytes} bytes; the platform caps liquid_template at ${MAX_TEMPLATE_BYTES} bytes.`,\n });\n }\n\n for (const banned of BANNED_TEMPLATE_PATTERNS) {\n if (banned.pattern.test(template)) {\n issues.push({ severity: \"error\", rule: banned.rule, message: banned.message });\n }\n }\n\n if (!MANDATORY_GATES_PATTERN.test(template)) {\n issues.push({\n severity: \"error\",\n rule: \"mandatory-gates\",\n message:\n \"Template must contain a trailing {% mandatory_gates %} tag — the runtime safety net that appends any required field and the primary action a template left out.\",\n });\n }\n\n try {\n getParseEngine().parse(template);\n } catch (error) {\n issues.push({\n severity: \"error\",\n rule: \"parse\",\n message: `Template is not valid LiquidJS: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n\n return issues;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAa,sBAAsB;;;;;;AAOnC,MAAa,gBAAgB,CAAC,mBAAmB;;;;;;AAOjD,MAAa,qBAAqB;;;;;;;;AAWlC,MAAa,4BAA4B;CACvC,OAAO,EAAE,OAAO,KAAK;CACrB,MAAM,EAAE,OAAO,2BAA2B;CAC1C,iBAAiB,EAAE,OAAO,oBAAoB;CAC9C,gBAAgB,EAAE,OAAO,mBAAmB;CAC5C,sBAAsB,EAAE,OAAO,wBAAwB;CACvD,sBAAsB,EAAE,OAAO,wBAAwB;CACvD,iBAAiB,EAAE,OAAO,oBAAoB;CAC9C,mBAAmB,EAAE,OAAO,KAAK;AACnC;;;;;;;AAsBA,MAAa,2BAAqD;CAChE;EACE,MAAM;EACN,SAAS;EACT,SAAS;CACX;CACA;EACE,MAAM;EACN,SAAS;EACT,SAAS;CACX;CACA;EACE,MAAM;EACN,SAAS;EACT,SAAS;CACX;CACA;EACE,MAAM;EACN,SAAS;EACT,SAAS;CACX;CACA;EACE,MAAM;EACN,SAAS;EACT,SACE;CACJ;AACF;AAIA,MAAM,0BAA0B,IAAI,OAAO,aAAa,oBAAoB,WAAW;AAEvF,IAAI;;;;;;AAOJ,SAAS,iBAAyB;CAChC,IAAI,CAAC,aAAa;EAChB,MAAM,SAAS,IAAI,OAAO;GACxB,OAAO;GACP,UAAU;GACV,mBAAmB;GACnB,eAAe;GACf,iBAAiB;EACnB,CAAC;EACD,KAAK,MAAM,OAAO,eAChB,OAAO,YAAY,KAAK;GACtB,QAAQ,CAER;GACA,SAAS;IACP,OAAO;GACT;EACF,CAAC;EAEH,cAAc;CAChB;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,sBAAsB,UAA6C;CACjF,MAAM,SAAoC,CAAC;CAE3C,MAAM,QAAQ,IAAI,YAAY,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC;CACjD,IAAI,QAAA,QACF,OAAO,KAAK;EACV,UAAU;EACV,MAAM;EACN,SAAS,eAAe,MAAM,+CAA+C,mBAAmB;CAClG,CAAC;CAGH,KAAK,MAAM,UAAU,0BACnB,IAAI,OAAO,QAAQ,KAAK,QAAQ,GAC9B,OAAO,KAAK;EAAE,UAAU;EAAS,MAAM,OAAO;EAAM,SAAS,OAAO;CAAQ,CAAC;CAIjF,IAAI,CAAC,wBAAwB,KAAK,QAAQ,GACxC,OAAO,KAAK;EACV,UAAU;EACV,MAAM;EACN,SACE;CACJ,CAAC;CAGH,IAAI;EACF,eAAe,CAAC,CAAC,MAAM,QAAQ;CACjC,SAAS,OAAO;EACd,OAAO,KAAK;GACV,UAAU;GACV,MAAM;GACN,SAAS,mCAAmC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACnG,CAAC;CACH;CAEA,OAAO;AACT"}
|
package/dist/validate.d.mts
CHANGED
|
@@ -28,18 +28,21 @@
|
|
|
28
28
|
* validator all go away. New rules land in Go first and are ported here
|
|
29
29
|
* only until then.
|
|
30
30
|
*/
|
|
31
|
-
type FlowValidationSeverity = "error" | "warning";
|
|
32
|
-
type FlowValidationIssue = {
|
|
33
|
-
severity: FlowValidationSeverity;
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
export type FlowValidationSeverity = "error" | "warning";
|
|
32
|
+
export type FlowValidationIssue = {
|
|
33
|
+
severity: FlowValidationSeverity;
|
|
34
|
+
/** Stable rule id from {@link FLOW_VALIDATION_RULES}. */
|
|
35
|
+
rule: FlowValidationRuleId;
|
|
36
|
+
/** Mirrors the Go `ErrFlowDefinitionInvalid` detail string where a Go rule exists. */
|
|
37
|
+
message: string;
|
|
38
|
+
/** Step the issue is anchored to, when applicable. */
|
|
36
39
|
step?: string;
|
|
37
40
|
};
|
|
38
41
|
/**
|
|
39
42
|
* Rule registry: rule id → the Go function it ports. `goRef: null` marks
|
|
40
43
|
* CLI-only guidance with no server counterpart.
|
|
41
44
|
*/
|
|
42
|
-
declare const FLOW_VALIDATION_RULES: {
|
|
45
|
+
export declare const FLOW_VALIDATION_RULES: {
|
|
43
46
|
readonly "step-names": {
|
|
44
47
|
readonly goRef: "stepNamesMap";
|
|
45
48
|
};
|
|
@@ -74,19 +77,19 @@ declare const FLOW_VALIDATION_RULES: {
|
|
|
74
77
|
readonly goRef: null;
|
|
75
78
|
};
|
|
76
79
|
};
|
|
77
|
-
type FlowValidationRuleId = keyof typeof FLOW_VALIDATION_RULES;
|
|
80
|
+
export type FlowValidationRuleId = keyof typeof FLOW_VALIDATION_RULES;
|
|
78
81
|
/** Mirrors `reservedOutcomes` in flow_definition_validator.go. */
|
|
79
|
-
declare const RESERVED_OUTCOMES: readonly ["user_not_found", "user_already_exists", "
|
|
82
|
+
export declare const RESERVED_OUTCOMES: readonly ["user_not_found", "user_already_exists", "sso_user_not_found", "sso_authenticated"];
|
|
80
83
|
/** Mirrors the `FlowDefinitionPurpose` enum (snake transform) in flow_definition.go. */
|
|
81
|
-
declare const FLOW_PURPOSES: readonly ["login", "register", "recovery", "profiling", "reauth", "link_account"];
|
|
84
|
+
export declare const FLOW_PURPOSES: readonly ["login", "register", "recovery", "profiling", "reauth", "link_account"];
|
|
82
85
|
/**
|
|
83
86
|
* Mirrors `purposeFlipTargets` in flow_definition_validator.go: the
|
|
84
|
-
* identifier outcomes only. `
|
|
87
|
+
* identifier outcomes only. `sso_user_not_found` comes only from SSO
|
|
85
88
|
* resolution and is left out here; requiring it on every combined entry
|
|
86
89
|
* step would reject the shipped default flow. A rule on steps carrying
|
|
87
90
|
* sso_providers is future work (#1044).
|
|
88
91
|
*/
|
|
89
|
-
declare const PURPOSE_FLIP_TARGETS: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
92
|
+
export declare const PURPOSE_FLIP_TARGETS: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
90
93
|
/**
|
|
91
94
|
* Validate a flow-definition config body (the `.zitadel/flows/*.json`
|
|
92
95
|
* content) against the rules the server enforces on apply. `schema` is
|
|
@@ -94,7 +97,6 @@ declare const PURPOSE_FLIP_TARGETS: Readonly<Record<string, Readonly<Record<stri
|
|
|
94
97
|
* omitted, schema-dependent rules are skipped. Pure — collects all
|
|
95
98
|
* issues, never throws.
|
|
96
99
|
*/
|
|
97
|
-
declare function validateFlowDefinition(flow: object, schema?: object): FlowValidationIssue[];
|
|
100
|
+
export declare function validateFlowDefinition(flow: object, schema?: object): FlowValidationIssue[];
|
|
98
101
|
//#endregion
|
|
99
|
-
export { FLOW_PURPOSES, FLOW_VALIDATION_RULES, FlowValidationIssue, FlowValidationRuleId, FlowValidationSeverity, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, validateFlowDefinition };
|
|
100
102
|
//# sourceMappingURL=validate.d.mts.map
|
package/dist/validate.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.mts","names":[],"sources":["../src/validate.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.mts","names":[],"sources":["../src/validate.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA8BY;YAEA;EACV,UAAU;;EAEV,MAAM;;EAEN;;EAEA;;;;;;qBAOW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAcD,oCAAoC;;qBAGnC;;qBAQA;;;;;;;;qBAgBA,sBAAsB,SAAS,eAAe,SAAS;;;;;;;;wBA2CpD,uBAAuB,cAAc,kBAAkB"}
|