@zitadel/config 0.1.0-alpha.17 → 0.1.0-alpha.19
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/README.md +27 -0
- package/defaults/README-branding.md +96 -0
- package/defaults/README-flows.md +21 -4
- package/defaults/README-schemas.md +2 -2
- package/defaults/branding/centered/login.liquid +164 -0
- package/defaults/branding/hero/login.liquid +224 -0
- package/defaults/branding/minimal/login.liquid +154 -0
- package/defaults/branding/split/login.liquid +183 -0
- package/defaults/branding/split-right/login.liquid +183 -0
- package/defaults/default-human-user.json +2 -19
- package/defaults/default-login.json +21 -4
- package/defaults/presets/passkey-first/human-user.json +2 -19
- package/defaults/presets/passkey-first/login.json +31 -4
- package/dist/branding-url.d.mts +14 -0
- package/dist/branding-url.d.mts.map +1 -0
- package/dist/branding-url.mjs +23 -0
- package/dist/branding-url.mjs.map +1 -0
- package/dist/defaults-Bh4_xVbh.d.mts +84 -0
- package/dist/defaults-Bh4_xVbh.d.mts.map +1 -0
- package/dist/defaults-eiGHyI5Y.mjs +569 -0
- package/dist/defaults-eiGHyI5Y.mjs.map +1 -0
- package/dist/defaults.d.mts +2 -2
- package/dist/defaults.mjs +2 -2
- package/dist/index.d.mts +6 -4
- package/dist/index.mjs +6 -4
- package/dist/{meta-schemas-8nlyVL7g.mjs → meta-schemas-CSc18JqO.mjs} +92 -31
- package/dist/meta-schemas-CSc18JqO.mjs.map +1 -0
- package/dist/meta-schemas.d.mts +6 -1
- package/dist/meta-schemas.d.mts.map +1 -1
- package/dist/meta-schemas.mjs +2 -2
- package/dist/normalize.d.mts +11 -9
- package/dist/normalize.d.mts.map +1 -1
- package/dist/normalize.mjs +24 -17
- package/dist/normalize.mjs.map +1 -1
- package/dist/schemas.d.mts +14 -1
- package/dist/schemas.d.mts.map +1 -1
- package/dist/schemas.mjs +62 -2
- package/dist/schemas.mjs.map +1 -1
- package/dist/template.d.mts +76 -0
- package/dist/template.d.mts.map +1 -0
- package/dist/template.mjs +145 -0
- package/dist/template.mjs.map +1 -0
- package/dist/validate.mjs +70 -11
- package/dist/validate.mjs.map +1 -1
- package/meta-schemas/auth-method.json +2 -7
- package/meta-schemas/branding.json +44 -0
- package/meta-schemas/flow-definition.json +20 -1
- package/meta-schemas/property-name.json +7 -0
- package/meta-schemas/user-property.json +8 -24
- package/meta-schemas/user-schema.json +4 -1
- package/package.json +17 -4
- package/dist/defaults-BQej3KIY.mjs +0 -388
- package/dist/defaults-BQej3KIY.mjs.map +0 -1
- package/dist/defaults-CSjBjBkQ.d.mts +0 -41
- package/dist/defaults-CSjBjBkQ.d.mts.map +0 -1
- package/dist/meta-schemas-8nlyVL7g.mjs.map +0 -1
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
//#region defaults/default-human-user.json
|
|
4
|
+
var default_human_user_default = {
|
|
5
|
+
title: "DefaultHumanUserSchema",
|
|
6
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
7
|
+
metaSchema: "${SERVER_URL}/user-schema.json",
|
|
8
|
+
$id: "${USER_SCHEMA_URL}",
|
|
9
|
+
objectType: "human-user",
|
|
10
|
+
kind: "user-schema",
|
|
11
|
+
type: "object",
|
|
12
|
+
description: "The default editable schema for human users.",
|
|
13
|
+
"x-auth-methods": {
|
|
14
|
+
"password": { "enabled": true },
|
|
15
|
+
"passkey": { "enabled": true }
|
|
16
|
+
},
|
|
17
|
+
required: ["email"],
|
|
18
|
+
properties: { "email": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"format": "email",
|
|
21
|
+
"x-unique": "project",
|
|
22
|
+
"description": "The user's email address."
|
|
23
|
+
} }
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region defaults/default-login.json
|
|
27
|
+
var default_login_default = {
|
|
28
|
+
$schema: "../meta/flow-definition.json",
|
|
29
|
+
name: "default-login",
|
|
30
|
+
status: "active",
|
|
31
|
+
user_schema: "${USER_SCHEMA_URL}",
|
|
32
|
+
purposes: {
|
|
33
|
+
"login": "identifier",
|
|
34
|
+
"register": "register"
|
|
35
|
+
},
|
|
36
|
+
steps: [
|
|
37
|
+
{
|
|
38
|
+
"name": "identifier",
|
|
39
|
+
"fields": ["email"],
|
|
40
|
+
"actions": [
|
|
41
|
+
{
|
|
42
|
+
"name": "submit",
|
|
43
|
+
"kind": "submit",
|
|
44
|
+
"primary": true,
|
|
45
|
+
"text_key": "identifier.action.continue"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "passkey",
|
|
49
|
+
"kind": "passkey",
|
|
50
|
+
"primary": false,
|
|
51
|
+
"text_key": "identifier.action.passkey"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "register",
|
|
55
|
+
"kind": "navigate",
|
|
56
|
+
"primary": false,
|
|
57
|
+
"text_key": "identifier.action.register.link"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"transitions": {
|
|
61
|
+
"submit": { "target": "password" },
|
|
62
|
+
"passkey": { "target": "done" },
|
|
63
|
+
"user_not_found": { "target": "register" },
|
|
64
|
+
"register": {
|
|
65
|
+
"target": "register",
|
|
66
|
+
"purpose": "register"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "password",
|
|
72
|
+
"fields": ["x-auth-methods#password"],
|
|
73
|
+
"actions": [{
|
|
74
|
+
"name": "submit",
|
|
75
|
+
"kind": "submit",
|
|
76
|
+
"primary": true,
|
|
77
|
+
"text_key": "password.action.signin"
|
|
78
|
+
}, {
|
|
79
|
+
"name": "passkey",
|
|
80
|
+
"kind": "passkey",
|
|
81
|
+
"primary": false,
|
|
82
|
+
"text_key": "password.action.passkey"
|
|
83
|
+
}],
|
|
84
|
+
"transitions": {
|
|
85
|
+
"submit": { "target": "done" },
|
|
86
|
+
"passkey": { "target": "done" }
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "register",
|
|
91
|
+
"fields": ["email"],
|
|
92
|
+
"actions": [
|
|
93
|
+
{
|
|
94
|
+
"name": "submit",
|
|
95
|
+
"kind": "submit",
|
|
96
|
+
"primary": true,
|
|
97
|
+
"text_key": "register.action.password"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "passkey_register",
|
|
101
|
+
"kind": "passkey_register",
|
|
102
|
+
"primary": false,
|
|
103
|
+
"text_key": "register.action.passkey"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "sign_in",
|
|
107
|
+
"kind": "navigate",
|
|
108
|
+
"primary": false,
|
|
109
|
+
"text_key": "register.action.sign_in.link"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"transitions": {
|
|
113
|
+
"submit": { "target": "register-password" },
|
|
114
|
+
"passkey_register": { "target": "done" },
|
|
115
|
+
"user_already_exists": { "target": "password" },
|
|
116
|
+
"sign_in": {
|
|
117
|
+
"target": "identifier",
|
|
118
|
+
"purpose": "login"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "register-password",
|
|
124
|
+
"fields": ["x-auth-methods#password"],
|
|
125
|
+
"actions": [{
|
|
126
|
+
"name": "submit",
|
|
127
|
+
"kind": "submit",
|
|
128
|
+
"primary": true,
|
|
129
|
+
"text_key": "register-password.action.submit"
|
|
130
|
+
}],
|
|
131
|
+
"on_success": "create_user",
|
|
132
|
+
"transitions": {
|
|
133
|
+
"submit": { "target": "done" },
|
|
134
|
+
"user_already_exists": { "target": "password" }
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "done",
|
|
139
|
+
"complete": "show"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
};
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region defaults/presets/passkey-first/human-user.json
|
|
145
|
+
var human_user_default = {
|
|
146
|
+
title: "DefaultHumanUserSchema",
|
|
147
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
148
|
+
metaSchema: "${SERVER_URL}/user-schema.json",
|
|
149
|
+
$id: "${USER_SCHEMA_URL}",
|
|
150
|
+
objectType: "human-user",
|
|
151
|
+
kind: "user-schema",
|
|
152
|
+
type: "object",
|
|
153
|
+
description: "The default editable schema for human users (passkey-first sign-in).",
|
|
154
|
+
"x-auth-methods": {
|
|
155
|
+
"passkey": { "enabled": true },
|
|
156
|
+
"password": { "enabled": true }
|
|
157
|
+
},
|
|
158
|
+
required: ["email"],
|
|
159
|
+
properties: { "email": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"format": "email",
|
|
162
|
+
"x-unique": "project",
|
|
163
|
+
"description": "The user's email address."
|
|
164
|
+
} }
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region defaults/presets/passkey-first/login.json
|
|
168
|
+
var login_default = {
|
|
169
|
+
$schema: "../meta/flow-definition.json",
|
|
170
|
+
name: "default-login",
|
|
171
|
+
status: "active",
|
|
172
|
+
user_schema: "${USER_SCHEMA_URL}",
|
|
173
|
+
purposes: {
|
|
174
|
+
"login": "passkey-first",
|
|
175
|
+
"register": "register"
|
|
176
|
+
},
|
|
177
|
+
steps: [
|
|
178
|
+
{
|
|
179
|
+
"name": "passkey-first",
|
|
180
|
+
"fields": [],
|
|
181
|
+
"actions": [
|
|
182
|
+
{
|
|
183
|
+
"name": "passkey",
|
|
184
|
+
"kind": "passkey",
|
|
185
|
+
"primary": true,
|
|
186
|
+
"text_key": "passkey-first.action.passkey"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "email_fallback",
|
|
190
|
+
"kind": "navigate",
|
|
191
|
+
"primary": false,
|
|
192
|
+
"text_key": "passkey-first.action.email_fallback"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "register",
|
|
196
|
+
"kind": "navigate",
|
|
197
|
+
"primary": false,
|
|
198
|
+
"text_key": "identifier.action.register.link"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"transitions": {
|
|
202
|
+
"passkey": { "target": "done" },
|
|
203
|
+
"email_fallback": { "target": "identifier" },
|
|
204
|
+
"user_not_found": { "target": "register" },
|
|
205
|
+
"register": {
|
|
206
|
+
"target": "register",
|
|
207
|
+
"purpose": "register"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "identifier",
|
|
213
|
+
"fields": ["email"],
|
|
214
|
+
"actions": [
|
|
215
|
+
{
|
|
216
|
+
"name": "submit",
|
|
217
|
+
"kind": "submit",
|
|
218
|
+
"primary": true,
|
|
219
|
+
"text_key": "identifier.action.continue"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "passkey",
|
|
223
|
+
"kind": "passkey",
|
|
224
|
+
"primary": false,
|
|
225
|
+
"text_key": "identifier.action.passkey"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "register",
|
|
229
|
+
"kind": "navigate",
|
|
230
|
+
"primary": false,
|
|
231
|
+
"text_key": "identifier.action.register.link"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"transitions": {
|
|
235
|
+
"submit": { "target": "password" },
|
|
236
|
+
"passkey": { "target": "done" },
|
|
237
|
+
"user_not_found": { "target": "register" },
|
|
238
|
+
"register": {
|
|
239
|
+
"target": "register",
|
|
240
|
+
"purpose": "register"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "password",
|
|
246
|
+
"fields": ["x-auth-methods#password"],
|
|
247
|
+
"actions": [{
|
|
248
|
+
"name": "submit",
|
|
249
|
+
"kind": "submit",
|
|
250
|
+
"primary": true,
|
|
251
|
+
"text_key": "password.action.signin"
|
|
252
|
+
}, {
|
|
253
|
+
"name": "passkey",
|
|
254
|
+
"kind": "passkey",
|
|
255
|
+
"primary": false,
|
|
256
|
+
"text_key": "password.action.passkey"
|
|
257
|
+
}],
|
|
258
|
+
"transitions": {
|
|
259
|
+
"submit": { "target": "done" },
|
|
260
|
+
"passkey": { "target": "done" }
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "register",
|
|
265
|
+
"fields": ["email"],
|
|
266
|
+
"actions": [
|
|
267
|
+
{
|
|
268
|
+
"name": "passkey_register",
|
|
269
|
+
"kind": "passkey_register",
|
|
270
|
+
"primary": true,
|
|
271
|
+
"text_key": "register.action.passkey"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"name": "submit",
|
|
275
|
+
"kind": "submit",
|
|
276
|
+
"primary": false,
|
|
277
|
+
"text_key": "register.action.password"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "sign_in",
|
|
281
|
+
"kind": "navigate",
|
|
282
|
+
"primary": false,
|
|
283
|
+
"text_key": "register.action.sign_in.link"
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"transitions": {
|
|
287
|
+
"passkey_register": { "target": "done" },
|
|
288
|
+
"submit": { "target": "register-password" },
|
|
289
|
+
"user_already_exists": { "target": "password" },
|
|
290
|
+
"sign_in": {
|
|
291
|
+
"target": "passkey-first",
|
|
292
|
+
"purpose": "login"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "register-password",
|
|
298
|
+
"fields": ["x-auth-methods#password"],
|
|
299
|
+
"actions": [{
|
|
300
|
+
"name": "submit",
|
|
301
|
+
"kind": "submit",
|
|
302
|
+
"primary": true,
|
|
303
|
+
"text_key": "register-password.action.submit"
|
|
304
|
+
}],
|
|
305
|
+
"on_success": "create_user",
|
|
306
|
+
"transitions": {
|
|
307
|
+
"submit": { "target": "done" },
|
|
308
|
+
"user_already_exists": { "target": "password" }
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"name": "done",
|
|
313
|
+
"complete": "show"
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
};
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/readmes.ts
|
|
319
|
+
/**
|
|
320
|
+
* README content the CLI copies to `.zitadel/schemas/README.md` during setup.
|
|
321
|
+
* Source of truth is `packages/config/defaults/README-schemas.md`; the Go
|
|
322
|
+
* server-side embed reads the same file (see `defaults.go`).
|
|
323
|
+
*/
|
|
324
|
+
function schemasReadmeContent() {
|
|
325
|
+
return readFileSync(readmeUrl("README-schemas.md"), "utf8");
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* README content the CLI copies to `.zitadel/flows/README.md` during setup.
|
|
329
|
+
* Source of truth is `packages/config/defaults/README-flows.md`.
|
|
330
|
+
*/
|
|
331
|
+
function flowsReadmeContent() {
|
|
332
|
+
return readFileSync(readmeUrl("README-flows.md"), "utf8");
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* README content the CLI copies to `.zitadel/branding/README.md` when a
|
|
336
|
+
* branding design is ejected. Source of truth is
|
|
337
|
+
* `packages/config/defaults/README-branding.md`.
|
|
338
|
+
*/
|
|
339
|
+
function brandingReadmeContent() {
|
|
340
|
+
return readFileSync(readmeUrl("README-branding.md"), "utf8");
|
|
341
|
+
}
|
|
342
|
+
function readmeUrl(filename) {
|
|
343
|
+
return fileURLToPath(new URL(`../defaults/${filename}`, import.meta.url));
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/defaults.ts
|
|
347
|
+
const DEFAULT_BUILTIN_SCHEMA_BASE = "https://nextgen.com/api/schemas";
|
|
348
|
+
const DEFAULT_FLOW_SCHEMA_URI = "https://nextgen.com/flow-definition.json";
|
|
349
|
+
const DEFAULT_SCHEMA_CONFIG_PATH = ".zitadel/schemas/default-human-user.json";
|
|
350
|
+
const DEFAULT_FLOW_CONFIG_PATH = ".zitadel/flows/default-login.json";
|
|
351
|
+
const DEFAULT_BRANDING_CONFIG_PATH = ".zitadel/branding/branding.json";
|
|
352
|
+
const DEFAULT_BRANDING_TEMPLATE_PATH = ".zitadel/branding/login.liquid";
|
|
353
|
+
/**
|
|
354
|
+
* Named schema+flow bundles `zitadel setup` can scaffold (#448: the prompt
|
|
355
|
+
* fires before any `.zitadel/` file is written; each preset maps to a
|
|
356
|
+
* pre-defined bundle the CLI copies on first setup). `password-first` is
|
|
357
|
+
* today's default; `passkey-first` puts a passkey ceremony on the login
|
|
358
|
+
* entry step with an email→password fallback path.
|
|
359
|
+
*/
|
|
360
|
+
const SETUP_PRESETS = ["password-first", "passkey-first"];
|
|
361
|
+
const DEFAULT_SETUP_PRESET = "password-first";
|
|
362
|
+
const PRESET_TEMPLATES = {
|
|
363
|
+
"password-first": {
|
|
364
|
+
schema: default_human_user_default,
|
|
365
|
+
flow: default_login_default
|
|
366
|
+
},
|
|
367
|
+
"passkey-first": {
|
|
368
|
+
schema: human_user_default,
|
|
369
|
+
flow: login_default
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
function presetTemplates(preset) {
|
|
373
|
+
if (!Object.hasOwn(PRESET_TEMPLATES, preset)) throw new Error(`unknown setup preset ${JSON.stringify(preset)} (known presets: ${SETUP_PRESETS.join(", ")})`);
|
|
374
|
+
return PRESET_TEMPLATES[preset];
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Login-design starting points `zitadel branding eject --design <name>` (and
|
|
378
|
+
* `zitadel setup --design <name>`) scaffold into `.zitadel/branding/`. A
|
|
379
|
+
* design is a full Liquid template plus the descriptor `layout` it degrades
|
|
380
|
+
* to — the wire `layout` enum stays `centered | split`, richer designs are
|
|
381
|
+
* delivered as templates (ADR 040).
|
|
382
|
+
*/
|
|
383
|
+
const BRANDING_DESIGNS = [
|
|
384
|
+
"centered",
|
|
385
|
+
"split",
|
|
386
|
+
"split-right",
|
|
387
|
+
"hero",
|
|
388
|
+
"minimal"
|
|
389
|
+
];
|
|
390
|
+
const DEFAULT_BRANDING_DESIGN = "centered";
|
|
391
|
+
/** Descriptor `layout` each design degrades to when its template is rejected. */
|
|
392
|
+
const DESIGN_LAYOUTS = {
|
|
393
|
+
centered: "centered",
|
|
394
|
+
split: "split",
|
|
395
|
+
"split-right": "split",
|
|
396
|
+
hero: "split",
|
|
397
|
+
minimal: "centered"
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Renders the scaffold files for a branding design. The `centered` template
|
|
401
|
+
* is a drift-tested copy of the bundled default in `@zitadel/components`;
|
|
402
|
+
* the other designs are authored variants of it.
|
|
403
|
+
*/
|
|
404
|
+
function getDefaultBrandingConfig(design = DEFAULT_BRANDING_DESIGN) {
|
|
405
|
+
if (!Object.hasOwn(DESIGN_LAYOUTS, design)) throw new Error(`unknown branding design ${JSON.stringify(design)} (known designs: ${BRANDING_DESIGNS.join(", ")})`);
|
|
406
|
+
const known = design;
|
|
407
|
+
return {
|
|
408
|
+
branding: {
|
|
409
|
+
layout: DESIGN_LAYOUTS[known],
|
|
410
|
+
liquid_template_file: "./login.liquid"
|
|
411
|
+
},
|
|
412
|
+
template: readFileSync(packageFilePath(`../defaults/branding/${known}/login.liquid`), "utf8")
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Resolves a package-relative file to a real filesystem path. Vite-driven
|
|
417
|
+
* runtimes (vitest in dependent packages) rewrite `import.meta.url` to a
|
|
418
|
+
* `/@fs/...` URL, which `fileURLToPath` passes through verbatim — strip the
|
|
419
|
+
* prefix so `readFileSync` gets an actual path.
|
|
420
|
+
*/
|
|
421
|
+
function packageFilePath(relative) {
|
|
422
|
+
const path = fileURLToPath(new URL(relative, import.meta.url));
|
|
423
|
+
return path.startsWith("/@fs/") ? path.slice(4) : path;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* The second setup axis (#448): *who* signs in, orthogonal to the sign-in
|
|
427
|
+
* preset (*how* they sign in). The sign-in preset owns the flow shape and
|
|
428
|
+
* auth methods; the use case owns which profile fields the schema collects.
|
|
429
|
+
* Composing the two keeps us at one field catalog + one flow-per-preset
|
|
430
|
+
* instead of a bundle per (use case × preset) pair. `minimal` is the
|
|
431
|
+
* default and never blocks non-interactive runs.
|
|
432
|
+
*/
|
|
433
|
+
const SETUP_USE_CASES = [
|
|
434
|
+
"minimal",
|
|
435
|
+
"consumer",
|
|
436
|
+
"business"
|
|
437
|
+
];
|
|
438
|
+
const DEFAULT_SETUP_USE_CASE = "minimal";
|
|
439
|
+
/**
|
|
440
|
+
* Fields each use case collects, in register/display order. `email` is
|
|
441
|
+
* always first and stays the only required property; the rest are optional
|
|
442
|
+
* profile attributes gathered on the flow's register step. `givenName`/
|
|
443
|
+
* `familyName` are the attributes the backend reads for a user's identity
|
|
444
|
+
* (`internal/domain/user.go`); `companyName` is stored as a plain user
|
|
445
|
+
* attribute today — there is no org/team model behind it yet.
|
|
446
|
+
*/
|
|
447
|
+
const USE_CASE_FIELDS = {
|
|
448
|
+
minimal: ["email"],
|
|
449
|
+
consumer: [
|
|
450
|
+
"email",
|
|
451
|
+
"givenName",
|
|
452
|
+
"familyName"
|
|
453
|
+
],
|
|
454
|
+
business: [
|
|
455
|
+
"email",
|
|
456
|
+
"givenName",
|
|
457
|
+
"familyName",
|
|
458
|
+
"companyName"
|
|
459
|
+
]
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* JSON-Schema bodies for the optional profile fields the CLI composes in per
|
|
463
|
+
* use case. The shipped templates are an email-only baseline (shared verbatim
|
|
464
|
+
* with the Go server fallback), so this catalog owns every field beyond
|
|
465
|
+
* `email`. Authored in the templates' style — no `x-claim`, since the backend
|
|
466
|
+
* maps identity by attribute name and the user-property meta-schema defines no
|
|
467
|
+
* claim keyword. `givenName`/`familyName` are the attributes the backend reads
|
|
468
|
+
* for a user's identity (`internal/domain/user.go`).
|
|
469
|
+
*/
|
|
470
|
+
const EXTRA_FIELD_BODIES = {
|
|
471
|
+
givenName: {
|
|
472
|
+
type: "string",
|
|
473
|
+
maxLength: 50,
|
|
474
|
+
description: "The user's given (first) name."
|
|
475
|
+
},
|
|
476
|
+
familyName: {
|
|
477
|
+
type: "string",
|
|
478
|
+
maxLength: 50,
|
|
479
|
+
description: "The user's family (last) name."
|
|
480
|
+
},
|
|
481
|
+
companyName: {
|
|
482
|
+
type: "string",
|
|
483
|
+
maxLength: 200,
|
|
484
|
+
description: "The user's company name."
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
function useCaseFields(useCase) {
|
|
488
|
+
if (!Object.hasOwn(USE_CASE_FIELDS, useCase)) throw new Error(`unknown setup use case ${JSON.stringify(useCase)} (known use cases: ${SETUP_USE_CASES.join(", ")})`);
|
|
489
|
+
return USE_CASE_FIELDS[useCase];
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* The body for one use-case field: reuse the template's authored body when it
|
|
493
|
+
* has one (so composed schemas match the shipped defaults for shared fields),
|
|
494
|
+
* else the extra catalog, else a generic editable string so composition stays
|
|
495
|
+
* total for any field a future use case introduces.
|
|
496
|
+
*/
|
|
497
|
+
function fieldBody(field, templateProps) {
|
|
498
|
+
if (Object.hasOwn(templateProps, field)) return { ...templateProps[field] };
|
|
499
|
+
if (Object.hasOwn(EXTRA_FIELD_BODIES, field)) return { ...EXTRA_FIELD_BODIES[field] };
|
|
500
|
+
return {
|
|
501
|
+
type: "string",
|
|
502
|
+
description: `The user's ${field}.`
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Narrow a rendered schema to the chosen use case: keep the preset-owned
|
|
507
|
+
* header and `x-auth-methods`, but replace `properties`/`required` with the
|
|
508
|
+
* use case's field set. `email` is the sole required property.
|
|
509
|
+
*/
|
|
510
|
+
function applyUseCaseToSchema(schema, useCase) {
|
|
511
|
+
const templateProps = schema.properties ?? {};
|
|
512
|
+
const properties = {};
|
|
513
|
+
for (const field of useCaseFields(useCase)) properties[field] = fieldBody(field, templateProps);
|
|
514
|
+
return {
|
|
515
|
+
...schema,
|
|
516
|
+
required: ["email"],
|
|
517
|
+
properties
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Derive the flow's register-step fields from the use case rather than
|
|
522
|
+
* copying a hard-coded list into every bundle (#448): the register step
|
|
523
|
+
* collects exactly what the schema defines. Other steps are untouched.
|
|
524
|
+
*/
|
|
525
|
+
function applyUseCaseToFlow(flow, useCase) {
|
|
526
|
+
const fields = [...useCaseFields(useCase)];
|
|
527
|
+
const steps = flow.steps.map((step) => step.name === "register" ? {
|
|
528
|
+
...step,
|
|
529
|
+
fields
|
|
530
|
+
} : step);
|
|
531
|
+
return {
|
|
532
|
+
...flow,
|
|
533
|
+
steps
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function defaultHumanUserSchemaUrl(builtinSchemaBase = DEFAULT_BUILTIN_SCHEMA_BASE) {
|
|
537
|
+
return `${trimTrailingSlash(builtinSchemaBase)}/default-human-user.json`;
|
|
538
|
+
}
|
|
539
|
+
function getDefaultHumanUserSchema(options = {}) {
|
|
540
|
+
const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://nextgen.com/api/schemas");
|
|
541
|
+
return applyUseCaseToSchema(renderTemplate(presetTemplates(options.preset ?? "password-first").schema, {
|
|
542
|
+
SERVER_URL: builtinSchemaBase,
|
|
543
|
+
USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase)
|
|
544
|
+
}), options.useCase ?? "minimal");
|
|
545
|
+
}
|
|
546
|
+
function getDefaultLoginFlow(options = {}) {
|
|
547
|
+
const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://nextgen.com/api/schemas");
|
|
548
|
+
return applyUseCaseToFlow(renderTemplate(presetTemplates(options.preset ?? "password-first").flow, {
|
|
549
|
+
SERVER_URL: builtinSchemaBase,
|
|
550
|
+
USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase)
|
|
551
|
+
}), options.useCase ?? "minimal");
|
|
552
|
+
}
|
|
553
|
+
function renderTemplate(value, replacements) {
|
|
554
|
+
if (Array.isArray(value)) return value.map((item) => renderTemplate(item, replacements));
|
|
555
|
+
if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, renderTemplate(item, replacements)]));
|
|
556
|
+
if (typeof value === "string") return value.replaceAll(/\$\{([A-Z_]+)\}/g, (match, name) => {
|
|
557
|
+
return replacements[name] ?? match;
|
|
558
|
+
});
|
|
559
|
+
return value;
|
|
560
|
+
}
|
|
561
|
+
function trimTrailingSlash(value) {
|
|
562
|
+
let trimmed = value;
|
|
563
|
+
while (trimmed.endsWith("/")) trimmed = trimmed.slice(0, -1);
|
|
564
|
+
return trimmed;
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
567
|
+
export { brandingReadmeContent as _, DEFAULT_BUILTIN_SCHEMA_BASE as a, DEFAULT_SCHEMA_CONFIG_PATH as c, SETUP_PRESETS as d, SETUP_USE_CASES as f, getDefaultLoginFlow as g, getDefaultHumanUserSchema as h, DEFAULT_BRANDING_TEMPLATE_PATH as i, DEFAULT_SETUP_PRESET as l, getDefaultBrandingConfig as m, DEFAULT_BRANDING_CONFIG_PATH as n, DEFAULT_FLOW_CONFIG_PATH as o, defaultHumanUserSchemaUrl as p, DEFAULT_BRANDING_DESIGN as r, DEFAULT_FLOW_SCHEMA_URI as s, BRANDING_DESIGNS as t, DEFAULT_SETUP_USE_CASE as u, flowsReadmeContent as v, schemasReadmeContent as y };
|
|
568
|
+
|
|
569
|
+
//# sourceMappingURL=defaults-eiGHyI5Y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults-eiGHyI5Y.mjs","names":["defaultHumanUserSchemaTemplate","defaultLoginFlowTemplate","passkeyFirstHumanUserSchemaTemplate","passkeyFirstLoginFlowTemplate"],"sources":["../defaults/default-human-user.json","../defaults/default-login.json","../defaults/presets/passkey-first/human-user.json","../defaults/presets/passkey-first/login.json","../src/readmes.ts","../src/defaults.ts"],"sourcesContent":["","","","","import { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * README content the CLI copies to `.zitadel/schemas/README.md` during setup.\n * Source of truth is `packages/config/defaults/README-schemas.md`; the Go\n * server-side embed reads the same file (see `defaults.go`).\n */\nexport function schemasReadmeContent(): string {\n return readFileSync(readmeUrl(\"README-schemas.md\"), \"utf8\");\n}\n\n/**\n * README content the CLI copies to `.zitadel/flows/README.md` during setup.\n * Source of truth is `packages/config/defaults/README-flows.md`.\n */\nexport function flowsReadmeContent(): string {\n return readFileSync(readmeUrl(\"README-flows.md\"), \"utf8\");\n}\n\n/**\n * README content the CLI copies to `.zitadel/branding/README.md` when a\n * branding design is ejected. Source of truth is\n * `packages/config/defaults/README-branding.md`.\n */\nexport function brandingReadmeContent(): string {\n return readFileSync(readmeUrl(\"README-branding.md\"), \"utf8\");\n}\n\nfunction readmeUrl(filename: string): string {\n return fileURLToPath(new URL(`../defaults/${filename}`, import.meta.url));\n}\n","import { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\nimport type {\n CreateFlowDefinitionBodyFlowDefinition,\n CreateSchemaBody,\n} from \"@zitadel/api/generated/model\";\n\nimport defaultHumanUserSchemaTemplate from \"../defaults/default-human-user.json\" with {\n type: \"json\",\n};\nimport defaultLoginFlowTemplate from \"../defaults/default-login.json\" with {\n type: \"json\",\n};\nimport passkeyFirstHumanUserSchemaTemplate from \"../defaults/presets/passkey-first/human-user.json\" with {\n type: \"json\",\n};\nimport passkeyFirstLoginFlowTemplate from \"../defaults/presets/passkey-first/login.json\" with {\n type: \"json\",\n};\n\nexport { brandingReadmeContent, flowsReadmeContent, schemasReadmeContent } from \"./readmes.js\";\n\nexport const DEFAULT_BUILTIN_SCHEMA_BASE = \"https://nextgen.com/api/schemas\";\nexport const DEFAULT_FLOW_SCHEMA_URI = \"https://nextgen.com/flow-definition.json\";\nexport const DEFAULT_SCHEMA_CONFIG_PATH = \".zitadel/schemas/default-human-user.json\";\nexport const DEFAULT_FLOW_CONFIG_PATH = \".zitadel/flows/default-login.json\";\nexport const DEFAULT_BRANDING_CONFIG_PATH = \".zitadel/branding/branding.json\";\nexport const DEFAULT_BRANDING_TEMPLATE_PATH = \".zitadel/branding/login.liquid\";\n\n/**\n * Named schema+flow bundles `zitadel setup` can scaffold (#448: the prompt\n * fires before any `.zitadel/` file is written; each preset maps to a\n * pre-defined bundle the CLI copies on first setup). `password-first` is\n * today's default; `passkey-first` puts a passkey ceremony on the login\n * entry step with an email→password fallback path.\n */\nexport const SETUP_PRESETS = [\"password-first\", \"passkey-first\"] as const;\n\nexport type SetupPreset = (typeof SETUP_PRESETS)[number];\n\nexport const DEFAULT_SETUP_PRESET: SetupPreset = \"password-first\";\n\nconst PRESET_TEMPLATES: Record<SetupPreset, { schema: unknown; flow: unknown }> = {\n \"password-first\": {\n schema: defaultHumanUserSchemaTemplate,\n flow: defaultLoginFlowTemplate,\n },\n \"passkey-first\": {\n schema: passkeyFirstHumanUserSchemaTemplate,\n flow: passkeyFirstLoginFlowTemplate,\n },\n};\n\nfunction presetTemplates(preset: string): { schema: unknown; flow: unknown } {\n // Own-property check: indexing a plain object with an arbitrary string\n // would let \"__proto__\"/\"constructor\" resolve via the prototype chain\n // and bypass the unknown-preset error.\n if (!Object.hasOwn(PRESET_TEMPLATES, preset)) {\n throw new Error(\n `unknown setup preset ${JSON.stringify(preset)} (known presets: ${SETUP_PRESETS.join(\", \")})`,\n );\n }\n return PRESET_TEMPLATES[preset as SetupPreset];\n}\n\n/**\n * Login-design starting points `zitadel branding eject --design <name>` (and\n * `zitadel setup --design <name>`) scaffold into `.zitadel/branding/`. A\n * design is a full Liquid template plus the descriptor `layout` it degrades\n * to — the wire `layout` enum stays `centered | split`, richer designs are\n * delivered as templates (ADR 040).\n */\nexport const BRANDING_DESIGNS = [\"centered\", \"split\", \"split-right\", \"hero\", \"minimal\"] as const;\n\nexport type BrandingDesign = (typeof BRANDING_DESIGNS)[number];\n\nexport const DEFAULT_BRANDING_DESIGN: BrandingDesign = \"centered\";\n\n/** Descriptor `layout` each design degrades to when its template is rejected. */\nconst DESIGN_LAYOUTS: Record<BrandingDesign, \"centered\" | \"split\"> = {\n centered: \"centered\",\n split: \"split\",\n \"split-right\": \"split\",\n hero: \"split\",\n minimal: \"centered\",\n};\n\nexport type DefaultBrandingConfig = {\n /** The `.zitadel/branding/branding.json` descriptor body (sans `$schema`). */\n branding: {\n layout: \"centered\" | \"split\";\n liquid_template_file: string;\n };\n /** The `.zitadel/branding/login.liquid` template content. */\n template: string;\n};\n\n/**\n * Renders the scaffold files for a branding design. The `centered` template\n * is a drift-tested copy of the bundled default in `@zitadel/components`;\n * the other designs are authored variants of it.\n */\nexport function getDefaultBrandingConfig(\n design: string = DEFAULT_BRANDING_DESIGN,\n): DefaultBrandingConfig {\n if (!Object.hasOwn(DESIGN_LAYOUTS, design)) {\n throw new Error(\n `unknown branding design ${JSON.stringify(design)} (known designs: ${BRANDING_DESIGNS.join(\", \")})`,\n );\n }\n const known = design as BrandingDesign;\n return {\n branding: {\n layout: DESIGN_LAYOUTS[known],\n liquid_template_file: \"./login.liquid\",\n },\n template: readFileSync(packageFilePath(`../defaults/branding/${known}/login.liquid`), \"utf8\"),\n };\n}\n\n/**\n * Resolves a package-relative file to a real filesystem path. Vite-driven\n * runtimes (vitest in dependent packages) rewrite `import.meta.url` to a\n * `/@fs/...` URL, which `fileURLToPath` passes through verbatim — strip the\n * prefix so `readFileSync` gets an actual path.\n */\nfunction packageFilePath(relative: string): string {\n const path = fileURLToPath(new URL(relative, import.meta.url));\n return path.startsWith(\"/@fs/\") ? path.slice(\"/@fs\".length) : path;\n}\n\n/**\n * The second setup axis (#448): *who* signs in, orthogonal to the sign-in\n * preset (*how* they sign in). The sign-in preset owns the flow shape and\n * auth methods; the use case owns which profile fields the schema collects.\n * Composing the two keeps us at one field catalog + one flow-per-preset\n * instead of a bundle per (use case × preset) pair. `minimal` is the\n * default and never blocks non-interactive runs.\n */\nexport const SETUP_USE_CASES = [\"minimal\", \"consumer\", \"business\"] as const;\n\nexport type SetupUseCase = (typeof SETUP_USE_CASES)[number];\n\nexport const DEFAULT_SETUP_USE_CASE: SetupUseCase = \"minimal\";\n\n/**\n * Fields each use case collects, in register/display order. `email` is\n * always first and stays the only required property; the rest are optional\n * profile attributes gathered on the flow's register step. `givenName`/\n * `familyName` are the attributes the backend reads for a user's identity\n * (`internal/domain/user.go`); `companyName` is stored as a plain user\n * attribute today — there is no org/team model behind it yet.\n */\nconst USE_CASE_FIELDS: Record<SetupUseCase, readonly string[]> = {\n minimal: [\"email\"],\n consumer: [\"email\", \"givenName\", \"familyName\"],\n business: [\"email\", \"givenName\", \"familyName\", \"companyName\"],\n};\n\n/**\n * JSON-Schema bodies for the optional profile fields the CLI composes in per\n * use case. The shipped templates are an email-only baseline (shared verbatim\n * with the Go server fallback), so this catalog owns every field beyond\n * `email`. Authored in the templates' style — no `x-claim`, since the backend\n * maps identity by attribute name and the user-property meta-schema defines no\n * claim keyword. `givenName`/`familyName` are the attributes the backend reads\n * for a user's identity (`internal/domain/user.go`).\n */\nconst EXTRA_FIELD_BODIES: Record<string, Record<string, unknown>> = {\n givenName: {\n type: \"string\",\n maxLength: 50,\n description: \"The user's given (first) name.\",\n },\n familyName: {\n type: \"string\",\n maxLength: 50,\n description: \"The user's family (last) name.\",\n },\n companyName: {\n type: \"string\",\n maxLength: 200,\n description: \"The user's company name.\",\n },\n};\n\nfunction useCaseFields(useCase: string): readonly string[] {\n // Own-property check, same rationale as presetTemplates: keep prototype\n // keys (\"__proto__\" etc.) from resolving to a real field list.\n if (!Object.hasOwn(USE_CASE_FIELDS, useCase)) {\n throw new Error(\n `unknown setup use case ${JSON.stringify(useCase)} (known use cases: ${SETUP_USE_CASES.join(\", \")})`,\n );\n }\n return USE_CASE_FIELDS[useCase as SetupUseCase];\n}\n\n/**\n * The body for one use-case field: reuse the template's authored body when it\n * has one (so composed schemas match the shipped defaults for shared fields),\n * else the extra catalog, else a generic editable string so composition stays\n * total for any field a future use case introduces.\n */\nfunction fieldBody(\n field: string,\n templateProps: Record<string, Record<string, unknown>>,\n): Record<string, unknown> {\n if (Object.hasOwn(templateProps, field)) {\n return { ...templateProps[field] };\n }\n if (Object.hasOwn(EXTRA_FIELD_BODIES, field)) {\n return { ...EXTRA_FIELD_BODIES[field] };\n }\n return { type: \"string\", description: `The user's ${field}.` };\n}\n\n/**\n * Narrow a rendered schema to the chosen use case: keep the preset-owned\n * header and `x-auth-methods`, but replace `properties`/`required` with the\n * use case's field set. `email` is the sole required property.\n */\nfunction applyUseCaseToSchema(\n schema: Record<string, unknown>,\n useCase: string,\n): Record<string, unknown> {\n const templateProps = (schema.properties ?? {}) as Record<string, Record<string, unknown>>;\n const properties: Record<string, unknown> = {};\n for (const field of useCaseFields(useCase)) {\n properties[field] = fieldBody(field, templateProps);\n }\n return { ...schema, required: [\"email\"], properties };\n}\n\n/**\n * Derive the flow's register-step fields from the use case rather than\n * copying a hard-coded list into every bundle (#448): the register step\n * collects exactly what the schema defines. Other steps are untouched.\n */\nfunction applyUseCaseToFlow(\n flow: Record<string, unknown>,\n useCase: string,\n): Record<string, unknown> {\n const fields = [...useCaseFields(useCase)];\n const steps = (flow.steps as Array<Record<string, unknown>>).map((step) =>\n step.name === \"register\" ? { ...step, fields } : step,\n );\n return { ...flow, steps };\n}\n\nexport type DefaultConfigRenderOptions = {\n builtinSchemaBase?: string;\n userSchemaUrl?: string;\n /** Which flow/auth bundle to render; defaults to {@link DEFAULT_SETUP_PRESET}. */\n preset?: string;\n /** Which field set to collect; defaults to {@link DEFAULT_SETUP_USE_CASE}. */\n useCase?: string;\n};\n\nexport function defaultHumanUserSchemaUrl(\n builtinSchemaBase = DEFAULT_BUILTIN_SCHEMA_BASE,\n): string {\n return `${trimTrailingSlash(builtinSchemaBase)}/default-human-user.json`;\n}\n\nexport function getDefaultHumanUserSchema(\n options: DefaultConfigRenderOptions = {},\n): CreateSchemaBody {\n const builtinSchemaBase = trimTrailingSlash(\n options.builtinSchemaBase ?? DEFAULT_BUILTIN_SCHEMA_BASE,\n );\n const rendered = renderTemplate(presetTemplates(options.preset ?? DEFAULT_SETUP_PRESET).schema, {\n SERVER_URL: builtinSchemaBase,\n USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase),\n }) as Record<string, unknown>;\n return applyUseCaseToSchema(\n rendered,\n options.useCase ?? DEFAULT_SETUP_USE_CASE,\n ) as CreateSchemaBody;\n}\n\nexport function getDefaultLoginFlow(\n options: DefaultConfigRenderOptions = {},\n): CreateFlowDefinitionBodyFlowDefinition {\n const builtinSchemaBase = trimTrailingSlash(\n options.builtinSchemaBase ?? DEFAULT_BUILTIN_SCHEMA_BASE,\n );\n const rendered = renderTemplate(presetTemplates(options.preset ?? DEFAULT_SETUP_PRESET).flow, {\n SERVER_URL: builtinSchemaBase,\n USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase),\n }) as Record<string, unknown>;\n return applyUseCaseToFlow(\n rendered,\n options.useCase ?? DEFAULT_SETUP_USE_CASE,\n ) as CreateFlowDefinitionBodyFlowDefinition;\n}\n\nfunction renderTemplate(value: unknown, replacements: Record<string, string>): unknown {\n if (Array.isArray(value)) {\n return value.map((item) => renderTemplate(item, replacements));\n }\n if (value !== null && typeof value === \"object\") {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [key, renderTemplate(item, replacements)]),\n );\n }\n if (typeof value === \"string\") {\n return value.replaceAll(/\\$\\{([A-Z_]+)\\}/g, (match, name: string) => {\n return replacements[name] ?? match;\n });\n }\n return value;\n}\n\nfunction trimTrailingSlash(value: string): string {\n let trimmed = value;\n while (trimmed.endsWith(\"/\")) {\n trimmed = trimmed.slice(0, -1);\n }\n return trimmed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,WAAA,UACT;;AAGH,SAAS,eAAe,OAAgB,cAA+C;AACrF,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,KAAK,SAAS,eAAe,MAAM,aAAa,CAAC;AAEhE,KAAI,UAAU,QAAQ,OAAO,UAAU,SACrC,QAAO,OAAO,YACZ,OAAO,QAAQ,MAAM,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,KAAK,eAAe,MAAM,aAAa,CAAC,CAAC,CACtF;AAEH,KAAI,OAAO,UAAU,SACnB,QAAO,MAAM,WAAW,qBAAqB,OAAO,SAAiB;AACnE,SAAO,aAAa,SAAS;GAC7B;AAEJ,QAAO;;AAGT,SAAS,kBAAkB,OAAuB;CAChD,IAAI,UAAU;AACd,QAAO,QAAQ,SAAS,IAAI,CAC1B,WAAU,QAAQ,MAAM,GAAG,GAAG;AAEhC,QAAO"}
|
package/dist/defaults.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, DefaultConfigRenderOptions, SETUP_PRESETS, SetupPreset, defaultHumanUserSchemaUrl, flowsReadmeContent, getDefaultHumanUserSchema, getDefaultLoginFlow, schemasReadmeContent };
|
|
1
|
+
import { C as flowsReadmeContent, S as brandingReadmeContent, _ as SetupUseCase, a as DEFAULT_BRANDING_TEMPLATE_PATH, b as getDefaultHumanUserSchema, c as DEFAULT_FLOW_SCHEMA_URI, d as DEFAULT_SETUP_USE_CASE, f as DefaultBrandingConfig, g as SetupPreset, h as SETUP_USE_CASES, i as DEFAULT_BRANDING_DESIGN, l as DEFAULT_SCHEMA_CONFIG_PATH, m as SETUP_PRESETS, n as BrandingDesign, o as DEFAULT_BUILTIN_SCHEMA_BASE, p as DefaultConfigRenderOptions, r as DEFAULT_BRANDING_CONFIG_PATH, s as DEFAULT_FLOW_CONFIG_PATH, t as BRANDING_DESIGNS, u as DEFAULT_SETUP_PRESET, v as defaultHumanUserSchemaUrl, w as schemasReadmeContent, x as getDefaultLoginFlow, y as getDefaultBrandingConfig } from "./defaults-Bh4_xVbh.mjs";
|
|
2
|
+
export { BRANDING_DESIGNS, BrandingDesign, DEFAULT_BRANDING_CONFIG_PATH, DEFAULT_BRANDING_DESIGN, DEFAULT_BRANDING_TEMPLATE_PATH, DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, DEFAULT_SETUP_USE_CASE, DefaultBrandingConfig, DefaultConfigRenderOptions, SETUP_PRESETS, SETUP_USE_CASES, SetupPreset, SetupUseCase, brandingReadmeContent, defaultHumanUserSchemaUrl, flowsReadmeContent, getDefaultBrandingConfig, getDefaultHumanUserSchema, getDefaultLoginFlow, schemasReadmeContent };
|
package/dist/defaults.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, SETUP_PRESETS, defaultHumanUserSchemaUrl, flowsReadmeContent, getDefaultHumanUserSchema, getDefaultLoginFlow, schemasReadmeContent };
|
|
1
|
+
import { _ as brandingReadmeContent, a as DEFAULT_BUILTIN_SCHEMA_BASE, c as DEFAULT_SCHEMA_CONFIG_PATH, d as SETUP_PRESETS, f as SETUP_USE_CASES, g as getDefaultLoginFlow, h as getDefaultHumanUserSchema, i as DEFAULT_BRANDING_TEMPLATE_PATH, l as DEFAULT_SETUP_PRESET, m as getDefaultBrandingConfig, n as DEFAULT_BRANDING_CONFIG_PATH, o as DEFAULT_FLOW_CONFIG_PATH, p as defaultHumanUserSchemaUrl, r as DEFAULT_BRANDING_DESIGN, s as DEFAULT_FLOW_SCHEMA_URI, t as BRANDING_DESIGNS, u as DEFAULT_SETUP_USE_CASE, v as flowsReadmeContent, y as schemasReadmeContent } from "./defaults-eiGHyI5Y.mjs";
|
|
2
|
+
export { BRANDING_DESIGNS, DEFAULT_BRANDING_CONFIG_PATH, DEFAULT_BRANDING_DESIGN, DEFAULT_BRANDING_TEMPLATE_PATH, DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, DEFAULT_SETUP_USE_CASE, SETUP_PRESETS, SETUP_USE_CASES, brandingReadmeContent, defaultHumanUserSchemaUrl, flowsReadmeContent, getDefaultBrandingConfig, getDefaultHumanUserSchema, getDefaultLoginFlow, schemasReadmeContent };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isCanonicalLoopbackHttpUrl } from "./branding-url.mjs";
|
|
2
|
+
import { C as flowsReadmeContent, S as brandingReadmeContent, _ as SetupUseCase, a as DEFAULT_BRANDING_TEMPLATE_PATH, b as getDefaultHumanUserSchema, c as DEFAULT_FLOW_SCHEMA_URI, d as DEFAULT_SETUP_USE_CASE, f as DefaultBrandingConfig, g as SetupPreset, h as SETUP_USE_CASES, i as DEFAULT_BRANDING_DESIGN, l as DEFAULT_SCHEMA_CONFIG_PATH, m as SETUP_PRESETS, n as BrandingDesign, o as DEFAULT_BUILTIN_SCHEMA_BASE, p as DefaultConfigRenderOptions, r as DEFAULT_BRANDING_CONFIG_PATH, s as DEFAULT_FLOW_CONFIG_PATH, t as BRANDING_DESIGNS, u as DEFAULT_SETUP_PRESET, v as defaultHumanUserSchemaUrl, w as schemasReadmeContent, x as getDefaultLoginFlow, y as getDefaultBrandingConfig } from "./defaults-Bh4_xVbh.mjs";
|
|
3
|
+
import { BRANDING_FILE_SCHEMA_REF, FLOW_FILE_SCHEMA_REF, META_SCHEMA_DIR, MetaSchemaFile, metaSchemaFiles } from "./meta-schemas.mjs";
|
|
3
4
|
import { USER_PROPERTY_DEFAULTS, normalizeFlowBody, normalizeSchemaBody } from "./normalize.mjs";
|
|
4
|
-
import { createFlowDefinitionRequestSchema, flowConfigSchema, schemaConfigSchema } from "./schemas.mjs";
|
|
5
|
+
import { brandingConfigSchema, brandingWireSchema, createFlowDefinitionRequestSchema, flowConfigSchema, schemaConfigSchema } from "./schemas.mjs";
|
|
6
|
+
import { BANNED_TEMPLATE_PATTERNS, MANDATORY_GATES_TAG, MAX_TEMPLATE_BYTES, TEMPLATE_TAGS, TEMPLATE_VALIDATION_RULES, TemplateValidationIssue, TemplateValidationRuleId, TemplateValidationSeverity, validateLoginTemplate } from "./template.mjs";
|
|
5
7
|
import { FLOW_PURPOSES, FLOW_VALIDATION_RULES, FlowValidationIssue, FlowValidationRuleId, FlowValidationSeverity, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, validateFlowDefinition } from "./validate.mjs";
|
|
6
|
-
export { DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, DefaultConfigRenderOptions, FLOW_FILE_SCHEMA_REF, FLOW_PURPOSES, FLOW_VALIDATION_RULES, FlowValidationIssue, FlowValidationRuleId, FlowValidationSeverity, META_SCHEMA_DIR, MetaSchemaFile, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, SETUP_PRESETS, SetupPreset, USER_PROPERTY_DEFAULTS, createFlowDefinitionRequestSchema, defaultHumanUserSchemaUrl, flowConfigSchema, flowsReadmeContent, getDefaultHumanUserSchema, getDefaultLoginFlow, metaSchemaFiles, normalizeFlowBody, normalizeSchemaBody, schemaConfigSchema, schemasReadmeContent, validateFlowDefinition };
|
|
8
|
+
export { BANNED_TEMPLATE_PATTERNS, BRANDING_DESIGNS, BRANDING_FILE_SCHEMA_REF, BrandingDesign, DEFAULT_BRANDING_CONFIG_PATH, DEFAULT_BRANDING_DESIGN, DEFAULT_BRANDING_TEMPLATE_PATH, DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, DEFAULT_SETUP_USE_CASE, DefaultBrandingConfig, DefaultConfigRenderOptions, FLOW_FILE_SCHEMA_REF, FLOW_PURPOSES, FLOW_VALIDATION_RULES, FlowValidationIssue, FlowValidationRuleId, FlowValidationSeverity, MANDATORY_GATES_TAG, MAX_TEMPLATE_BYTES, META_SCHEMA_DIR, MetaSchemaFile, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, SETUP_PRESETS, SETUP_USE_CASES, SetupPreset, SetupUseCase, TEMPLATE_TAGS, TEMPLATE_VALIDATION_RULES, TemplateValidationIssue, TemplateValidationRuleId, TemplateValidationSeverity, USER_PROPERTY_DEFAULTS, brandingConfigSchema, brandingReadmeContent, brandingWireSchema, createFlowDefinitionRequestSchema, defaultHumanUserSchemaUrl, flowConfigSchema, flowsReadmeContent, getDefaultBrandingConfig, getDefaultHumanUserSchema, getDefaultLoginFlow, isCanonicalLoopbackHttpUrl, metaSchemaFiles, normalizeFlowBody, normalizeSchemaBody, schemaConfigSchema, schemasReadmeContent, validateFlowDefinition, validateLoginTemplate };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
1
|
+
import { isCanonicalLoopbackHttpUrl } from "./branding-url.mjs";
|
|
2
|
+
import { _ as brandingReadmeContent, a as DEFAULT_BUILTIN_SCHEMA_BASE, c as DEFAULT_SCHEMA_CONFIG_PATH, d as SETUP_PRESETS, f as SETUP_USE_CASES, g as getDefaultLoginFlow, h as getDefaultHumanUserSchema, i as DEFAULT_BRANDING_TEMPLATE_PATH, l as DEFAULT_SETUP_PRESET, m as getDefaultBrandingConfig, n as DEFAULT_BRANDING_CONFIG_PATH, o as DEFAULT_FLOW_CONFIG_PATH, p as defaultHumanUserSchemaUrl, r as DEFAULT_BRANDING_DESIGN, s as DEFAULT_FLOW_SCHEMA_URI, t as BRANDING_DESIGNS, u as DEFAULT_SETUP_USE_CASE, v as flowsReadmeContent, y as schemasReadmeContent } from "./defaults-eiGHyI5Y.mjs";
|
|
3
|
+
import { i as metaSchemaFiles, n as FLOW_FILE_SCHEMA_REF, r as META_SCHEMA_DIR, t as BRANDING_FILE_SCHEMA_REF } from "./meta-schemas-CSc18JqO.mjs";
|
|
3
4
|
import { USER_PROPERTY_DEFAULTS, normalizeFlowBody, normalizeSchemaBody } from "./normalize.mjs";
|
|
4
|
-
import { createFlowDefinitionRequestSchema, flowConfigSchema, schemaConfigSchema } from "./schemas.mjs";
|
|
5
|
+
import { brandingConfigSchema, brandingWireSchema, createFlowDefinitionRequestSchema, flowConfigSchema, schemaConfigSchema } from "./schemas.mjs";
|
|
6
|
+
import { BANNED_TEMPLATE_PATTERNS, MANDATORY_GATES_TAG, MAX_TEMPLATE_BYTES, TEMPLATE_TAGS, TEMPLATE_VALIDATION_RULES, validateLoginTemplate } from "./template.mjs";
|
|
5
7
|
import { FLOW_PURPOSES, FLOW_VALIDATION_RULES, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, validateFlowDefinition } from "./validate.mjs";
|
|
6
|
-
export { DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, FLOW_FILE_SCHEMA_REF, FLOW_PURPOSES, FLOW_VALIDATION_RULES, META_SCHEMA_DIR, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, SETUP_PRESETS, USER_PROPERTY_DEFAULTS, createFlowDefinitionRequestSchema, defaultHumanUserSchemaUrl, flowConfigSchema, flowsReadmeContent, getDefaultHumanUserSchema, getDefaultLoginFlow, metaSchemaFiles, normalizeFlowBody, normalizeSchemaBody, schemaConfigSchema, schemasReadmeContent, validateFlowDefinition };
|
|
8
|
+
export { BANNED_TEMPLATE_PATTERNS, BRANDING_DESIGNS, BRANDING_FILE_SCHEMA_REF, DEFAULT_BRANDING_CONFIG_PATH, DEFAULT_BRANDING_DESIGN, DEFAULT_BRANDING_TEMPLATE_PATH, DEFAULT_BUILTIN_SCHEMA_BASE, DEFAULT_FLOW_CONFIG_PATH, DEFAULT_FLOW_SCHEMA_URI, DEFAULT_SCHEMA_CONFIG_PATH, DEFAULT_SETUP_PRESET, DEFAULT_SETUP_USE_CASE, FLOW_FILE_SCHEMA_REF, FLOW_PURPOSES, FLOW_VALIDATION_RULES, MANDATORY_GATES_TAG, MAX_TEMPLATE_BYTES, META_SCHEMA_DIR, PURPOSE_FLIP_TARGETS, RESERVED_OUTCOMES, SETUP_PRESETS, SETUP_USE_CASES, TEMPLATE_TAGS, TEMPLATE_VALIDATION_RULES, USER_PROPERTY_DEFAULTS, brandingConfigSchema, brandingReadmeContent, brandingWireSchema, createFlowDefinitionRequestSchema, defaultHumanUserSchemaUrl, flowConfigSchema, flowsReadmeContent, getDefaultBrandingConfig, getDefaultHumanUserSchema, getDefaultLoginFlow, isCanonicalLoopbackHttpUrl, metaSchemaFiles, normalizeFlowBody, normalizeSchemaBody, schemaConfigSchema, schemasReadmeContent, validateFlowDefinition, validateLoginTemplate };
|