@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.
Files changed (56) hide show
  1. package/README.md +27 -0
  2. package/defaults/README-branding.md +96 -0
  3. package/defaults/README-flows.md +21 -4
  4. package/defaults/README-schemas.md +2 -2
  5. package/defaults/branding/centered/login.liquid +164 -0
  6. package/defaults/branding/hero/login.liquid +224 -0
  7. package/defaults/branding/minimal/login.liquid +154 -0
  8. package/defaults/branding/split/login.liquid +183 -0
  9. package/defaults/branding/split-right/login.liquid +183 -0
  10. package/defaults/default-human-user.json +2 -19
  11. package/defaults/default-login.json +21 -4
  12. package/defaults/presets/passkey-first/human-user.json +2 -19
  13. package/defaults/presets/passkey-first/login.json +31 -4
  14. package/dist/branding-url.d.mts +14 -0
  15. package/dist/branding-url.d.mts.map +1 -0
  16. package/dist/branding-url.mjs +23 -0
  17. package/dist/branding-url.mjs.map +1 -0
  18. package/dist/defaults-Bh4_xVbh.d.mts +84 -0
  19. package/dist/defaults-Bh4_xVbh.d.mts.map +1 -0
  20. package/dist/defaults-eiGHyI5Y.mjs +569 -0
  21. package/dist/defaults-eiGHyI5Y.mjs.map +1 -0
  22. package/dist/defaults.d.mts +2 -2
  23. package/dist/defaults.mjs +2 -2
  24. package/dist/index.d.mts +6 -4
  25. package/dist/index.mjs +6 -4
  26. package/dist/{meta-schemas-8nlyVL7g.mjs → meta-schemas-CSc18JqO.mjs} +92 -31
  27. package/dist/meta-schemas-CSc18JqO.mjs.map +1 -0
  28. package/dist/meta-schemas.d.mts +6 -1
  29. package/dist/meta-schemas.d.mts.map +1 -1
  30. package/dist/meta-schemas.mjs +2 -2
  31. package/dist/normalize.d.mts +11 -9
  32. package/dist/normalize.d.mts.map +1 -1
  33. package/dist/normalize.mjs +24 -17
  34. package/dist/normalize.mjs.map +1 -1
  35. package/dist/schemas.d.mts +14 -1
  36. package/dist/schemas.d.mts.map +1 -1
  37. package/dist/schemas.mjs +62 -2
  38. package/dist/schemas.mjs.map +1 -1
  39. package/dist/template.d.mts +76 -0
  40. package/dist/template.d.mts.map +1 -0
  41. package/dist/template.mjs +145 -0
  42. package/dist/template.mjs.map +1 -0
  43. package/dist/validate.mjs +70 -11
  44. package/dist/validate.mjs.map +1 -1
  45. package/meta-schemas/auth-method.json +2 -7
  46. package/meta-schemas/branding.json +44 -0
  47. package/meta-schemas/flow-definition.json +20 -1
  48. package/meta-schemas/property-name.json +7 -0
  49. package/meta-schemas/user-property.json +8 -24
  50. package/meta-schemas/user-schema.json +4 -1
  51. package/package.json +17 -4
  52. package/dist/defaults-BQej3KIY.mjs +0 -388
  53. package/dist/defaults-BQej3KIY.mjs.map +0 -1
  54. package/dist/defaults-CSjBjBkQ.d.mts +0 -41
  55. package/dist/defaults-CSjBjBkQ.d.mts.map +0 -1
  56. package/dist/meta-schemas-8nlyVL7g.mjs.map +0 -1
@@ -14,17 +14,6 @@
14
14
  "const": "https://json-schema.org/draft/2020-12/schema",
15
15
  "description": "The JSON Schema version used for this schema."
16
16
  },
17
- "x-verify": {
18
- "oneOf": [
19
- {
20
- "type": "string"
21
- },
22
- {
23
- "type": "null"
24
- }
25
- ],
26
- "description": "The verification method for this property, if applicable"
27
- },
28
17
  "x-unique": {
29
18
  "oneOf": [
30
19
  {
@@ -52,25 +41,20 @@
52
41
  ],
53
42
  "description": "The claim name for this property, if applicable"
54
43
  },
55
- "x-editable": {
56
- "type": "boolean",
57
- "default": true,
58
- "description": "Whether this property is editable by the user or not"
59
- },
60
- "x-sensitive": {
61
- "type": "boolean",
62
- "default": false,
63
- "description": "Whether this property contains sensitive information or not"
64
- },
65
- "x-mfa": {
44
+ "x-audit": {
66
45
  "type": "boolean",
67
46
  "default": false,
68
- "description": "Whether this property is used for multi-factor authentication or not"
47
+ "description": "Whether this property's value may appear in audit event payloads. Audit payloads are deny-by-default: a property without this annotation contributes its key but never its value."
69
48
  },
70
49
  "properties": {
71
50
  "type": "object",
72
51
  "description": "A map of additional properties for the user definition, where the key is the property name and the value is the property schema",
73
- "additionalProperties": true
52
+ "propertyNames": {
53
+ "$ref": "property-name.json"
54
+ },
55
+ "additionalProperties": {
56
+ "$ref": "user-property.json"
57
+ }
74
58
  }
75
59
  }
76
60
  }
@@ -42,9 +42,12 @@
42
42
  "properties": {
43
43
  "type": "object",
44
44
  "description": "A map of additional properties for the user definition, where the key is the property name and the value is the property schema",
45
+ "propertyNames": {
46
+ "$ref": "property-name.json"
47
+ },
45
48
  "additionalProperties": {
46
49
  "$ref": "user-property.json"
47
50
  }
48
51
  }
49
52
  }
50
- }
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zitadel/config",
3
- "version": "0.1.0-alpha.17",
3
+ "version": "0.1.0-alpha.19",
4
4
  "description": "Versioned Zitadel local config schemas and defaults",
5
5
  "homepage": "https://github.com/zitadel/nextgen/tree/main/packages/config#readme",
6
6
  "bugs": {
@@ -17,6 +17,7 @@
17
17
  "defaults/*.json",
18
18
  "defaults/*.md",
19
19
  "defaults/presets/*/*.json",
20
+ "defaults/branding/*/*.liquid",
20
21
  "meta-schemas/*.json",
21
22
  "LICENSE"
22
23
  ],
@@ -37,6 +38,11 @@
37
38
  "types": "./dist/schemas.d.mts",
38
39
  "import": "./dist/schemas.mjs"
39
40
  },
41
+ "./branding-url": {
42
+ "@zitadel/source": "./src/branding-url.ts",
43
+ "types": "./dist/branding-url.d.mts",
44
+ "import": "./dist/branding-url.mjs"
45
+ },
40
46
  "./normalize": {
41
47
  "@zitadel/source": "./src/normalize.ts",
42
48
  "types": "./dist/normalize.d.mts",
@@ -52,6 +58,11 @@
52
58
  "types": "./dist/meta-schemas.d.mts",
53
59
  "import": "./dist/meta-schemas.mjs"
54
60
  },
61
+ "./template": {
62
+ "@zitadel/source": "./src/template.ts",
63
+ "types": "./dist/template.d.mts",
64
+ "import": "./dist/template.mjs"
65
+ },
55
66
  "./defaults/default-human-user.json": "./defaults/default-human-user.json",
56
67
  "./defaults/default-login.json": "./defaults/default-login.json",
57
68
  "./package.json": "./package.json"
@@ -60,17 +71,19 @@
60
71
  "access": "public"
61
72
  },
62
73
  "dependencies": {
63
- "@zitadel/api": "0.1.0-alpha.17"
74
+ "liquidjs": "^10.27.2",
75
+ "zod": "^4.3.6",
76
+ "@zitadel/api": "0.1.0-alpha.19"
64
77
  },
65
78
  "devDependencies": {
66
79
  "ajv": "^8.20.0",
67
80
  "tsdown": "^0.21.10",
68
81
  "tslib": "^2.8.1",
69
- "vitest": "^4.1.7"
82
+ "vitest": "^4.1.9"
70
83
  },
71
84
  "scripts": {
72
85
  "build": "tsdown",
73
- "typecheck": "tsc --noEmit -p tsconfig.json",
86
+ "typecheck": "tsc --build tsconfig.json",
74
87
  "test": "vitest run --passWithNoTests",
75
88
  "lint": "oxlint ."
76
89
  }
@@ -1,388 +0,0 @@
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": {
15
- "enabled": true,
16
- "position": 1
17
- },
18
- "passkey": {
19
- "enabled": true,
20
- "position": 2
21
- }
22
- },
23
- required: ["email"],
24
- properties: {
25
- "email": {
26
- "type": "string",
27
- "format": "email",
28
- "x-unique": "project",
29
- "description": "The user's email address."
30
- },
31
- "givenName": {
32
- "type": "string",
33
- "maxLength": 50,
34
- "description": "The user's given (first) name."
35
- },
36
- "familyName": {
37
- "type": "string",
38
- "maxLength": 50,
39
- "description": "The user's family (last) name."
40
- },
41
- "dateOfBirth": {
42
- "type": "string",
43
- "format": "date",
44
- "description": "The user's date of birth (ISO 8601, YYYY-MM-DD)."
45
- }
46
- }
47
- };
48
- //#endregion
49
- //#region defaults/default-login.json
50
- var default_login_default = {
51
- $schema: "../meta/flow-definition.json",
52
- name: "default-login",
53
- status: "active",
54
- user_schema: "${USER_SCHEMA_URL}",
55
- purposes: {
56
- "login": "identifier",
57
- "register": "register"
58
- },
59
- steps: [
60
- {
61
- "name": "identifier",
62
- "fields": ["email"],
63
- "actions": [{
64
- "name": "submit",
65
- "kind": "submit",
66
- "primary": true,
67
- "text_key": "identifier.action.continue"
68
- }, {
69
- "name": "passkey",
70
- "kind": "passkey",
71
- "primary": false,
72
- "text_key": "identifier.action.passkey"
73
- }],
74
- "transitions": {
75
- "submit": { "target": "password" },
76
- "passkey": { "target": "done" },
77
- "user_not_found": { "target": "register" }
78
- }
79
- },
80
- {
81
- "name": "password",
82
- "fields": ["x-auth-methods#password"],
83
- "actions": [{
84
- "name": "submit",
85
- "kind": "submit",
86
- "primary": true,
87
- "text_key": "password.action.signin"
88
- }, {
89
- "name": "passkey",
90
- "kind": "passkey",
91
- "primary": false,
92
- "text_key": "password.action.passkey"
93
- }],
94
- "transitions": {
95
- "submit": { "target": "done" },
96
- "passkey": { "target": "done" }
97
- }
98
- },
99
- {
100
- "name": "register",
101
- "fields": [
102
- "email",
103
- "givenName",
104
- "familyName",
105
- "dateOfBirth"
106
- ],
107
- "actions": [{
108
- "name": "submit",
109
- "kind": "submit",
110
- "primary": true,
111
- "text_key": "register.action.password"
112
- }, {
113
- "name": "passkey_register",
114
- "kind": "passkey_register",
115
- "primary": false,
116
- "text_key": "register.action.passkey"
117
- }],
118
- "transitions": {
119
- "submit": { "target": "register-password" },
120
- "passkey_register": { "target": "done" },
121
- "user_already_exists": { "target": "password" }
122
- }
123
- },
124
- {
125
- "name": "register-password",
126
- "fields": ["x-auth-methods#password"],
127
- "actions": [{
128
- "name": "submit",
129
- "kind": "submit",
130
- "primary": true,
131
- "text_key": "register-password.action.submit"
132
- }],
133
- "on_success": "create_user",
134
- "transitions": {
135
- "submit": { "target": "done" },
136
- "user_already_exists": { "target": "password" }
137
- }
138
- },
139
- {
140
- "name": "done",
141
- "complete": "show"
142
- }
143
- ]
144
- };
145
- //#endregion
146
- //#region defaults/presets/passkey-first/human-user.json
147
- var human_user_default = {
148
- title: "DefaultHumanUserSchema",
149
- $schema: "https://json-schema.org/draft/2020-12/schema",
150
- metaSchema: "${SERVER_URL}/user-schema.json",
151
- $id: "${USER_SCHEMA_URL}",
152
- objectType: "human-user",
153
- kind: "user-schema",
154
- type: "object",
155
- description: "The default editable schema for human users (passkey-first sign-in).",
156
- "x-auth-methods": {
157
- "passkey": {
158
- "enabled": true,
159
- "position": 1
160
- },
161
- "password": {
162
- "enabled": true,
163
- "position": 2
164
- }
165
- },
166
- required: ["email"],
167
- properties: {
168
- "email": {
169
- "type": "string",
170
- "format": "email",
171
- "x-unique": "project",
172
- "description": "The user's email address."
173
- },
174
- "givenName": {
175
- "type": "string",
176
- "maxLength": 50,
177
- "description": "The user's given (first) name."
178
- },
179
- "familyName": {
180
- "type": "string",
181
- "maxLength": 50,
182
- "description": "The user's family (last) name."
183
- },
184
- "dateOfBirth": {
185
- "type": "string",
186
- "format": "date",
187
- "description": "The user's date of birth (ISO 8601, YYYY-MM-DD)."
188
- }
189
- }
190
- };
191
- //#endregion
192
- //#region defaults/presets/passkey-first/login.json
193
- var login_default = {
194
- $schema: "../meta/flow-definition.json",
195
- name: "default-login",
196
- status: "active",
197
- user_schema: "${USER_SCHEMA_URL}",
198
- purposes: {
199
- "login": "passkey-first",
200
- "register": "register"
201
- },
202
- steps: [
203
- {
204
- "name": "passkey-first",
205
- "fields": [],
206
- "actions": [{
207
- "name": "passkey",
208
- "kind": "passkey",
209
- "primary": true,
210
- "text_key": "passkey-first.action.passkey"
211
- }, {
212
- "name": "email_fallback",
213
- "kind": "navigate",
214
- "primary": false,
215
- "text_key": "passkey-first.action.email_fallback"
216
- }],
217
- "transitions": {
218
- "passkey": { "target": "done" },
219
- "email_fallback": { "target": "identifier" },
220
- "user_not_found": { "target": "register" }
221
- }
222
- },
223
- {
224
- "name": "identifier",
225
- "fields": ["email"],
226
- "actions": [{
227
- "name": "submit",
228
- "kind": "submit",
229
- "primary": true,
230
- "text_key": "identifier.action.continue"
231
- }, {
232
- "name": "passkey",
233
- "kind": "passkey",
234
- "primary": false,
235
- "text_key": "identifier.action.passkey"
236
- }],
237
- "transitions": {
238
- "submit": { "target": "password" },
239
- "passkey": { "target": "done" },
240
- "user_not_found": { "target": "register" }
241
- }
242
- },
243
- {
244
- "name": "password",
245
- "fields": ["x-auth-methods#password"],
246
- "actions": [{
247
- "name": "submit",
248
- "kind": "submit",
249
- "primary": true,
250
- "text_key": "password.action.signin"
251
- }, {
252
- "name": "passkey",
253
- "kind": "passkey",
254
- "primary": false,
255
- "text_key": "password.action.passkey"
256
- }],
257
- "transitions": {
258
- "submit": { "target": "done" },
259
- "passkey": { "target": "done" }
260
- }
261
- },
262
- {
263
- "name": "register",
264
- "fields": [
265
- "email",
266
- "givenName",
267
- "familyName",
268
- "dateOfBirth"
269
- ],
270
- "actions": [{
271
- "name": "passkey_register",
272
- "kind": "passkey_register",
273
- "primary": true,
274
- "text_key": "register.action.passkey"
275
- }, {
276
- "name": "submit",
277
- "kind": "submit",
278
- "primary": false,
279
- "text_key": "register.action.password"
280
- }],
281
- "transitions": {
282
- "passkey_register": { "target": "done" },
283
- "submit": { "target": "register-password" },
284
- "user_already_exists": { "target": "password" }
285
- }
286
- },
287
- {
288
- "name": "register-password",
289
- "fields": ["x-auth-methods#password"],
290
- "actions": [{
291
- "name": "submit",
292
- "kind": "submit",
293
- "primary": true,
294
- "text_key": "register-password.action.submit"
295
- }],
296
- "on_success": "create_user",
297
- "transitions": {
298
- "submit": { "target": "done" },
299
- "user_already_exists": { "target": "password" }
300
- }
301
- },
302
- {
303
- "name": "done",
304
- "complete": "show"
305
- }
306
- ]
307
- };
308
- //#endregion
309
- //#region src/readmes.ts
310
- /**
311
- * README content the CLI copies to `.zitadel/schemas/README.md` during setup.
312
- * Source of truth is `packages/config/defaults/README-schemas.md`; the Go
313
- * server-side embed reads the same file (see `defaults.go`).
314
- */
315
- function schemasReadmeContent() {
316
- return readFileSync(readmeUrl("README-schemas.md"), "utf8");
317
- }
318
- /**
319
- * README content the CLI copies to `.zitadel/flows/README.md` during setup.
320
- * Source of truth is `packages/config/defaults/README-flows.md`.
321
- */
322
- function flowsReadmeContent() {
323
- return readFileSync(readmeUrl("README-flows.md"), "utf8");
324
- }
325
- function readmeUrl(filename) {
326
- return fileURLToPath(new URL(`../defaults/${filename}`, import.meta.url));
327
- }
328
- //#endregion
329
- //#region src/defaults.ts
330
- const DEFAULT_BUILTIN_SCHEMA_BASE = "https://nextgen.com/api/schemas";
331
- const DEFAULT_FLOW_SCHEMA_URI = "https://nextgen.com/flow-definition.json";
332
- const DEFAULT_SCHEMA_CONFIG_PATH = ".zitadel/schemas/default-human-user.json";
333
- const DEFAULT_FLOW_CONFIG_PATH = ".zitadel/flows/default-login.json";
334
- /**
335
- * Named schema+flow bundles `zitadel setup` can scaffold (#448: the prompt
336
- * fires before any `.zitadel/` file is written; each preset maps to a
337
- * pre-defined bundle the CLI copies on first setup). `password-first` is
338
- * today's default; `passkey-first` puts a passkey ceremony on the login
339
- * entry step with an email→password fallback path.
340
- */
341
- const SETUP_PRESETS = ["password-first", "passkey-first"];
342
- const DEFAULT_SETUP_PRESET = "password-first";
343
- const PRESET_TEMPLATES = {
344
- "password-first": {
345
- schema: default_human_user_default,
346
- flow: default_login_default
347
- },
348
- "passkey-first": {
349
- schema: human_user_default,
350
- flow: login_default
351
- }
352
- };
353
- function presetTemplates(preset) {
354
- if (!Object.hasOwn(PRESET_TEMPLATES, preset)) throw new Error(`unknown setup preset ${JSON.stringify(preset)} (known presets: ${SETUP_PRESETS.join(", ")})`);
355
- return PRESET_TEMPLATES[preset];
356
- }
357
- function defaultHumanUserSchemaUrl(builtinSchemaBase = DEFAULT_BUILTIN_SCHEMA_BASE) {
358
- return `${trimTrailingSlash(builtinSchemaBase)}/default-human-user.json`;
359
- }
360
- function getDefaultHumanUserSchema(options = {}) {
361
- const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://nextgen.com/api/schemas");
362
- return renderTemplate(presetTemplates(options.preset ?? "password-first").schema, {
363
- SERVER_URL: builtinSchemaBase,
364
- USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase)
365
- });
366
- }
367
- function getDefaultLoginFlow(options = {}) {
368
- const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://nextgen.com/api/schemas");
369
- return renderTemplate(presetTemplates(options.preset ?? "password-first").flow, {
370
- SERVER_URL: builtinSchemaBase,
371
- USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase)
372
- });
373
- }
374
- function renderTemplate(value, replacements) {
375
- if (Array.isArray(value)) return value.map((item) => renderTemplate(item, replacements));
376
- if (value !== null && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, renderTemplate(item, replacements)]));
377
- if (typeof value === "string") return value.replaceAll(/\$\{([A-Z_]+)\}/g, (match, name) => {
378
- return replacements[name] ?? match;
379
- });
380
- return value;
381
- }
382
- function trimTrailingSlash(value) {
383
- return value.replace(/\/+$/u, "");
384
- }
385
- //#endregion
386
- export { DEFAULT_SETUP_PRESET as a, getDefaultHumanUserSchema as c, schemasReadmeContent as d, DEFAULT_SCHEMA_CONFIG_PATH as i, getDefaultLoginFlow as l, DEFAULT_FLOW_CONFIG_PATH as n, SETUP_PRESETS as o, DEFAULT_FLOW_SCHEMA_URI as r, defaultHumanUserSchemaUrl as s, DEFAULT_BUILTIN_SCHEMA_BASE as t, flowsReadmeContent as u };
387
-
388
- //# sourceMappingURL=defaults-BQej3KIY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults-BQej3KIY.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\nfunction readmeUrl(filename: string): string {\n return fileURLToPath(new URL(`../defaults/${filename}`, import.meta.url));\n}\n","import 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 { 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\";\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\nexport type DefaultConfigRenderOptions = {\n builtinSchemaBase?: string;\n userSchemaUrl?: string;\n /** Which bundle to render; defaults to {@link DEFAULT_SETUP_PRESET}. */\n preset?: 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 return renderTemplate(presetTemplates(options.preset ?? DEFAULT_SETUP_PRESET).schema, {\n SERVER_URL: builtinSchemaBase,\n USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase),\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 return renderTemplate(presetTemplates(options.preset ?? DEFAULT_SETUP_PRESET).flow, {\n SERVER_URL: builtinSchemaBase,\n USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase),\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 return value.replace(/\\/+$/u, \"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIQA,SAAgB,uBAA+B;AAC7C,QAAO,aAAa,UAAU,oBAAoB,EAAE,OAAO;;;;;;AAO7D,SAAgB,qBAA6B;AAC3C,QAAO,aAAa,UAAU,kBAAkB,EAAE,OAAO;;AAG3D,SAAS,UAAU,UAA0B;AAC3C,QAAO,cAAc,IAAI,IAAI,eAAe,YAAY,OAAO,KAAK,IAAI,CAAC;;;;ACD3E,MAAa,8BAA8B;AAC3C,MAAa,0BAA0B;AACvC,MAAa,6BAA6B;AAC1C,MAAa,2BAA2B;;;;;;;;AASxC,MAAa,gBAAgB,CAAC,kBAAkB,gBAAgB;AAIhE,MAAa,uBAAoC;AAEjD,MAAM,mBAA4E;CAChF,kBAAkB;EAChB,QAAQA;EACR,MAAMC;EACP;CACD,iBAAiB;EACf,QAAQC;EACR,MAAMC;EACP;CACF;AAED,SAAS,gBAAgB,QAAoD;AAI3E,KAAI,CAAC,OAAO,OAAO,kBAAkB,OAAO,CAC1C,OAAM,IAAI,MACR,wBAAwB,KAAK,UAAU,OAAO,CAAC,mBAAmB,cAAc,KAAK,KAAK,CAAC,GAC5F;AAEH,QAAO,iBAAiB;;AAU1B,SAAgB,0BACd,oBAAoB,6BACZ;AACR,QAAO,GAAG,kBAAkB,kBAAkB,CAAC;;AAGjD,SAAgB,0BACd,UAAsC,EAAE,EACtB;CAClB,MAAM,oBAAoB,kBACxB,QAAQ,qBAAA,kCACT;AACD,QAAO,eAAe,gBAAgB,QAAQ,UAAA,iBAA+B,CAAC,QAAQ;EACpF,YAAY;EACZ,iBAAiB,QAAQ,iBAAiB,0BAA0B,kBAAkB;EACvF,CAAC;;AAGJ,SAAgB,oBACd,UAAsC,EAAE,EACA;CACxC,MAAM,oBAAoB,kBACxB,QAAQ,qBAAA,kCACT;AACD,QAAO,eAAe,gBAAgB,QAAQ,UAAA,iBAA+B,CAAC,MAAM;EAClF,YAAY;EACZ,iBAAiB,QAAQ,iBAAiB,0BAA0B,kBAAkB;EACvF,CAAC;;AAGJ,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;AAChD,QAAO,MAAM,QAAQ,SAAS,GAAG"}
@@ -1,41 +0,0 @@
1
- import { CreateFlowDefinitionBodyFlowDefinition, CreateSchemaBody } from "@zitadel/api/generated/model";
2
-
3
- //#region src/readmes.d.ts
4
- /**
5
- * README content the CLI copies to `.zitadel/schemas/README.md` during setup.
6
- * Source of truth is `packages/config/defaults/README-schemas.md`; the Go
7
- * server-side embed reads the same file (see `defaults.go`).
8
- */
9
- declare function schemasReadmeContent(): string;
10
- /**
11
- * README content the CLI copies to `.zitadel/flows/README.md` during setup.
12
- * Source of truth is `packages/config/defaults/README-flows.md`.
13
- */
14
- declare function flowsReadmeContent(): string;
15
- //#endregion
16
- //#region src/defaults.d.ts
17
- declare const DEFAULT_BUILTIN_SCHEMA_BASE = "https://nextgen.com/api/schemas";
18
- declare const DEFAULT_FLOW_SCHEMA_URI = "https://nextgen.com/flow-definition.json";
19
- declare const DEFAULT_SCHEMA_CONFIG_PATH = ".zitadel/schemas/default-human-user.json";
20
- declare const DEFAULT_FLOW_CONFIG_PATH = ".zitadel/flows/default-login.json";
21
- /**
22
- * Named schema+flow bundles `zitadel setup` can scaffold (#448: the prompt
23
- * fires before any `.zitadel/` file is written; each preset maps to a
24
- * pre-defined bundle the CLI copies on first setup). `password-first` is
25
- * today's default; `passkey-first` puts a passkey ceremony on the login
26
- * entry step with an email→password fallback path.
27
- */
28
- declare const SETUP_PRESETS: readonly ["password-first", "passkey-first"];
29
- type SetupPreset = (typeof SETUP_PRESETS)[number];
30
- declare const DEFAULT_SETUP_PRESET: SetupPreset;
31
- type DefaultConfigRenderOptions = {
32
- builtinSchemaBase?: string;
33
- userSchemaUrl?: string; /** Which bundle to render; defaults to {@link DEFAULT_SETUP_PRESET}. */
34
- preset?: string;
35
- };
36
- declare function defaultHumanUserSchemaUrl(builtinSchemaBase?: string): string;
37
- declare function getDefaultHumanUserSchema(options?: DefaultConfigRenderOptions): CreateSchemaBody;
38
- declare function getDefaultLoginFlow(options?: DefaultConfigRenderOptions): CreateFlowDefinitionBodyFlowDefinition;
39
- //#endregion
40
- export { DEFAULT_SETUP_PRESET as a, SetupPreset as c, getDefaultLoginFlow as d, flowsReadmeContent as f, DEFAULT_SCHEMA_CONFIG_PATH as i, defaultHumanUserSchemaUrl as l, DEFAULT_FLOW_CONFIG_PATH as n, DefaultConfigRenderOptions as o, schemasReadmeContent as p, DEFAULT_FLOW_SCHEMA_URI as r, SETUP_PRESETS as s, DEFAULT_BUILTIN_SCHEMA_BASE as t, getDefaultHumanUserSchema as u };
41
- //# sourceMappingURL=defaults-CSjBjBkQ.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults-CSjBjBkQ.d.mts","names":[],"sources":["../src/readmes.ts","../src/defaults.ts"],"mappings":";;;;;;AAQA;;iBAAgB,oBAAA,CAAA;;;AAQhB;;iBAAgB,kBAAA,CAAA;;;cCIH,2BAAA;AAAA,cACA,uBAAA;AAAA,cACA,0BAAA;AAAA,cACA,wBAAA;;;ADPb;;;;;cCgBa,aAAA;AAAA,KAED,WAAA,WAAsB,aAAA;AAAA,cAErB,oBAAA,EAAsB,WAAA;AAAA,KAyBvB,0BAAA;EACV,iBAAA;EACA,aAAA,WA3CsC;EA6CtC,MAAA;AAAA;AAAA,iBAGc,yBAAA,CACd,iBAAA;AAAA,iBAKc,yBAAA,CACd,OAAA,GAAS,0BAAA,GACR,gBAAA;AAAA,iBAUa,mBAAA,CACd,OAAA,GAAS,0BAAA,GACR,sCAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta-schemas-8nlyVL7g.mjs","names":["flowDefinitionMetaSchema","userSchemaMetaSchema","userPropertyMetaSchema","authMethodsMetaSchema","authMethodMetaSchema"],"sources":["../meta-schemas/auth-method.json","../meta-schemas/auth-methods.json","../meta-schemas/flow-definition.json","../meta-schemas/user-property.json","../meta-schemas/user-schema.json","../src/meta-schemas.ts"],"sourcesContent":["","","","","","/**\n * The dialect meta-schemas `zitadel setup` copies into a project's\n * `.zitadel/meta/` so the flow/schema dialect is machine-readable offline:\n * editors validate flow files against `flow-definition.json` via a relative\n * `$schema` pointer, and agents read the dialect files before authoring\n * edits — no docs crawl, no hosted schema required.\n *\n * The files under `meta-schemas/` are committed copies of\n * `api/openapi/endpoints/schemas/*.json` (the source the server embeds);\n * a drift-audit test keeps them byte-identical in the monorepo.\n */\nimport authMethodMetaSchema from \"../meta-schemas/auth-method.json\" with {\n type: \"json\",\n};\nimport authMethodsMetaSchema from \"../meta-schemas/auth-methods.json\" with {\n type: \"json\",\n};\nimport flowDefinitionMetaSchema from \"../meta-schemas/flow-definition.json\" with {\n type: \"json\",\n};\nimport userPropertyMetaSchema from \"../meta-schemas/user-property.json\" with {\n type: \"json\",\n};\nimport userSchemaMetaSchema from \"../meta-schemas/user-schema.json\" with {\n type: \"json\",\n};\n\n/** Project-relative directory setup writes the meta-schemas to. */\nexport const META_SCHEMA_DIR = \".zitadel/meta\";\n\n/**\n * The `$schema` value scaffolded flow files carry, relative to\n * `.zitadel/flows/` — resolves to `{@link META_SCHEMA_DIR}/flow-definition.json`.\n */\nexport const FLOW_FILE_SCHEMA_REF = \"../meta/flow-definition.json\";\n\nexport type MetaSchemaFile = { name: string; body: object };\n\n/**\n * The dialect files to materialize, in write order. `auth-methods.json` and\n * `auth-method.json` are pulled in by `user-schema.json`'s relative `$ref`s —\n * without them the copied dialect cannot resolve offline.\n */\nexport function metaSchemaFiles(): ReadonlyArray<MetaSchemaFile> {\n return [\n { name: \"flow-definition.json\", body: flowDefinitionMetaSchema as object },\n { name: \"user-schema.json\", body: userSchemaMetaSchema as object },\n { name: \"user-property.json\", body: userPropertyMetaSchema as object },\n { name: \"auth-methods.json\", body: authMethodsMetaSchema as object },\n { name: \"auth-method.json\", body: authMethodMetaSchema as object },\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AK4BA,MAAa,kBAAkB;;;;;AAM/B,MAAa,uBAAuB;;;;;;AASpC,SAAgB,kBAAiD;AAC/D,QAAO;EACL;GAAE,MAAM;GAAwB,MAAMA;GAAoC;EAC1E;GAAE,MAAM;GAAoB,MAAMC;GAAgC;EAClE;GAAE,MAAM;GAAsB,MAAMC;GAAkC;EACtE;GAAE,MAAM;GAAqB,MAAMC;GAAiC;EACpE;GAAE,MAAM;GAAoB,MAAMC;GAAgC;EACnE"}