@zitadel/config 1.0.0-alpha.23 → 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.
Files changed (62) hide show
  1. package/defaults/README-branding.md +26 -34
  2. package/defaults/branding/centered/login.liquid +31 -11
  3. package/defaults/branding/minimal/login.liquid +30 -10
  4. package/dist/branding-contrast.d.mts +28 -21
  5. package/dist/branding-contrast.d.mts.map +1 -1
  6. package/dist/branding-contrast.mjs +1 -1
  7. package/dist/branding-contrast.mjs.map +1 -1
  8. package/dist/branding-url.d.mts +1 -2
  9. package/dist/branding-url.d.mts.map +1 -1
  10. package/dist/branding-url.mjs.map +1 -1
  11. package/dist/css-color.d.mts +5 -10
  12. package/dist/css-color.d.mts.map +1 -1
  13. package/dist/css-color.mjs +1 -1
  14. package/dist/css-color.mjs.map +1 -1
  15. package/dist/{defaults-BxGCGdqS.d.mts → defaults-BtKIcWxW.d.mts} +21 -14
  16. package/dist/defaults-BtKIcWxW.d.mts.map +1 -0
  17. package/dist/{defaults-DV6hY2KT.mjs → defaults-COLBFU3S.mjs} +17 -18
  18. package/dist/defaults-COLBFU3S.mjs.map +1 -0
  19. package/dist/defaults.d.mts +1 -1
  20. package/dist/defaults.mjs +1 -1
  21. package/dist/idp/index.d.mts +2 -0
  22. package/dist/idp/index.mjs +2 -0
  23. package/dist/idp-ByzXQN85.mjs +207 -0
  24. package/dist/idp-ByzXQN85.mjs.map +1 -0
  25. package/dist/idp-connection-CHxGm1Wr.mjs +324 -0
  26. package/dist/idp-connection-CHxGm1Wr.mjs.map +1 -0
  27. package/dist/index-Cuxu-zQD.d.mts +210 -0
  28. package/dist/index-Cuxu-zQD.d.mts.map +1 -0
  29. package/dist/index.d.mts +4 -3
  30. package/dist/index.mjs +5 -4
  31. package/dist/{meta-schemas-OowgSUfU.mjs → meta-schemas-C03zgFux.mjs} +36 -333
  32. package/dist/meta-schemas-C03zgFux.mjs.map +1 -0
  33. package/dist/meta-schemas.d.mts +5 -6
  34. package/dist/meta-schemas.d.mts.map +1 -1
  35. package/dist/meta-schemas.mjs +1 -1
  36. package/dist/normalize.d.mts +3 -4
  37. package/dist/normalize.d.mts.map +1 -1
  38. package/dist/normalize.mjs.map +1 -1
  39. package/dist/{schemas-7oNU25Qz.mjs → schemas-CUU4Rf8J.mjs} +11 -4
  40. package/dist/schemas-CUU4Rf8J.mjs.map +1 -0
  41. package/dist/schemas.d.mts +361 -9
  42. package/dist/schemas.d.mts.map +1 -1
  43. package/dist/schemas.mjs +2 -2
  44. package/dist/template.d.mts +9 -10
  45. package/dist/template.d.mts.map +1 -1
  46. package/dist/template.mjs +1 -1
  47. package/dist/template.mjs.map +1 -1
  48. package/dist/validate.d.mts +15 -13
  49. package/dist/validate.d.mts.map +1 -1
  50. package/dist/validate.mjs +28 -18
  51. package/dist/validate.mjs.map +1 -1
  52. package/meta-schemas/branding.json +5 -5
  53. package/meta-schemas/flow-definition.json +81 -6
  54. package/meta-schemas/idp-connection.json +6 -6
  55. package/package.json +18 -8
  56. package/defaults/branding/hero/login.liquid +0 -238
  57. package/defaults/branding/split/login.liquid +0 -197
  58. package/defaults/branding/split-right/login.liquid +0 -197
  59. package/dist/defaults-BxGCGdqS.d.mts.map +0 -1
  60. package/dist/defaults-DV6hY2KT.mjs.map +0 -1
  61. package/dist/meta-schemas-OowgSUfU.mjs.map +0 -1
  62. package/dist/schemas-7oNU25Qz.mjs.map +0 -1
package/dist/validate.mjs CHANGED
@@ -20,8 +20,8 @@ const FLOW_VALIDATION_RULES = {
20
20
  const RESERVED_OUTCOMES = [
21
21
  "user_not_found",
22
22
  "user_already_exists",
23
- "identity_unknown",
24
- "callback"
23
+ "sso_user_not_found",
24
+ "sso_authenticated"
25
25
  ];
26
26
  /** Mirrors the `FlowDefinitionPurpose` enum (snake transform) in flow_definition.go. */
27
27
  const FLOW_PURPOSES = [
@@ -34,7 +34,7 @@ const FLOW_PURPOSES = [
34
34
  ];
35
35
  /**
36
36
  * Mirrors `purposeFlipTargets` in flow_definition_validator.go: the
37
- * identifier outcomes only. `identity_unknown` comes only from SSO
37
+ * identifier outcomes only. `sso_user_not_found` comes only from SSO
38
38
  * resolution and is left out here; requiring it on every combined entry
39
39
  * step would reject the shipped default flow. A rule on steps carrying
40
40
  * sso_providers is future work (#1044).
@@ -49,14 +49,18 @@ const FLIP_OUTCOME_IMPACTS = {
49
49
  user_already_exists: "someone who already has an account gets stuck at registration instead of being routed to sign-in"
50
50
  };
51
51
  /** Action kinds a flow author may declare; `back` is engine-injected. */
52
- const DECLARABLE_ACTION_KINDS = new Set([
52
+ const DECLARABLE_ACTION_KINDS = /* @__PURE__ */ new Set([
53
53
  "submit",
54
54
  "passkey",
55
55
  "passkey_register",
56
56
  "navigate"
57
57
  ]);
58
- /** Mirrors `flowBackActionName` in flow_state_machine.go. */
59
- const BACK_ACTION_NAME = "back";
58
+ /**
59
+ * Action names the engine claims, with the reason the validator reports.
60
+ * Mirrors `flowBackActionName` and `FlowActionSSO` in flow_state_machine.go.
61
+ * A Map, not an object, so a name like `constructor` cannot match by accident.
62
+ */
63
+ const RESERVED_ACTION_NAMES = /* @__PURE__ */ new Map([["back", "engine-injected back navigation"], ["sso", "sso submissions"]]);
60
64
  /** Mirrors `authMethodPrefix` in flow_definition.go. */
61
65
  const AUTH_METHOD_PREFIX = "x-auth-methods#";
62
66
  /** Mirrors `ManifestForOnSuccess` in flow_on_success.go. */
@@ -188,14 +192,18 @@ function validateStep(step) {
188
192
  }
189
193
  if (action.kind === "" || action.kind !== "back" && !DECLARABLE_ACTION_KINDS.has(action.kind)) issues.push(error("steps", `step ${q(name)}: action ${q(action.name)} has no kind`, name));
190
194
  else if (action.kind === "back") issues.push(error("steps", `step ${q(name)}: action ${q(action.name)} has kind=back, which is engine-injected and cannot be declared`, name));
191
- if (action.name === BACK_ACTION_NAME) issues.push(error("steps", `step ${q(name)}: action name ${q(action.name)} is reserved for engine-injected back navigation`, name));
195
+ const reserved = RESERVED_ACTION_NAMES.get(action.name);
196
+ if (reserved !== void 0) issues.push(error("steps", `step ${q(name)}: action name ${q(action.name)} is reserved for ${reserved}`, name));
192
197
  actionNames.add(action.name);
193
198
  }
194
- const hasCallback = step.transitions.has("callback");
195
- if (step.fields.length === 0 && step.actions.length === 0 && step.ssoProviderCount === 0 && step.gateCount === 0 && !hasCallback) issues.push(error("steps", `step ${q(name)} is non-terminal but has no fields, actions, sso_providers, gates, or transitions.callback`, name));
196
- if (step.ssoProviderCount > 0 && !hasCallback) issues.push(error("steps", `step ${q(name)}: has sso_providers but is missing transitions.callback`, name));
199
+ const hasSsoAuthenticated = step.transitions.has("sso_authenticated");
200
+ if (step.fields.length === 0 && step.actions.length === 0 && step.ssoProviderCount === 0 && step.gateCount === 0 && !hasSsoAuthenticated) issues.push(error("steps", `step ${q(name)} is non-terminal but has no fields, actions, sso_providers, gates, or transitions.sso_authenticated`, name));
201
+ if (step.ssoProviderCount > 0 && !hasSsoAuthenticated) issues.push(error("steps", `step ${q(name)}: has sso_providers but is missing transitions.sso_authenticated`, name));
197
202
  for (const actionName of actionNames) if (!step.transitions.has(actionName)) issues.push(error("steps", `step ${q(name)}: action ${q(actionName)} has no matching transition`, name));
198
- for (const transitionKey of step.transitions.keys()) if (!actionNames.has(transitionKey) && !RESERVED_OUTCOMES.includes(transitionKey)) issues.push(error("steps", `step ${q(name)}: transition key ${q(transitionKey)} is not an action name or reserved outcome (user_not_found, user_already_exists, identity_unknown, callback)`, name));
203
+ for (const [transitionKey, t] of step.transitions) {
204
+ if (!actionNames.has(transitionKey) && !RESERVED_OUTCOMES.includes(transitionKey)) issues.push(error("steps", `step ${q(name)}: transition key ${q(transitionKey)} is not an action name or reserved outcome (user_not_found, user_already_exists, sso_user_not_found, sso_authenticated)`, name));
205
+ if ((transitionKey === "sso_authenticated" || transitionKey === "sso_user_not_found") && (t.purpose !== null || t.action !== null)) issues.push(error("steps", `step ${q(name)}: transition ${q(transitionKey)} is an sso outcome and cannot declare purpose or action`, name));
206
+ }
199
207
  return issues;
200
208
  }
201
209
  /** A transition with no cross-flow action targets a step in this flow. */
@@ -235,12 +243,14 @@ function bfs(start, adj, visited) {
235
243
  function validateGraph(def, stepNames) {
236
244
  const issues = [];
237
245
  for (const step of def.steps) for (const [key, t] of step.transitions) {
238
- if (t.purpose !== null) if (t.action !== null) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} declares both purpose and action; a transition either re-purposes locally or targets another flow`, step.name));
239
- else if (!FLOW_PURPOSES.includes(t.purpose)) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} has invalid purpose`, step.name));
240
- else {
241
- const entry = def.purposes.get(t.purpose);
242
- if (entry === void 0) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)}, which this definition does not serve`, step.name));
243
- else if (t.target !== entry) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)} but targets ${q(t.target)}; it must target that purpose's entry step ${q(entry)}`, step.name));
246
+ if (t.purpose !== null) {
247
+ if (t.action !== null) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} declares both purpose and action; a transition either re-purposes locally or targets another flow`, step.name));
248
+ else if (!FLOW_PURPOSES.includes(t.purpose)) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} has invalid purpose`, step.name));
249
+ else {
250
+ const entry = def.purposes.get(t.purpose);
251
+ if (entry === void 0) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)}, which this definition does not serve`, step.name));
252
+ else if (t.target !== entry) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)} but targets ${q(t.target)}; it must target that purpose's entry step ${q(entry)}`, step.name));
253
+ }
244
254
  }
245
255
  if (isCurrentFlow(t)) {
246
256
  if (!stepNames.has(t.target)) issues.push(error("graph", `step ${q(step.name)}: transition ${q(key)} targets unknown step ${q(t.target)}`, step.name));
@@ -344,7 +354,7 @@ function resolveFieldChallenge(field, properties, schema) {
344
354
  return { challenge: "password" };
345
355
  }
346
356
  const segments = field.split(".");
347
- let property = void 0;
357
+ let property;
348
358
  let level = properties;
349
359
  for (const [i, segment] of segments.entries()) {
350
360
  property = level !== void 0 && Object.hasOwn(level, segment) ? level[segment] : void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"validate.mjs","names":[],"sources":["../src/validate.ts"],"sourcesContent":["/**\n * Plan-time port of the server's flow-definition validator\n * (`internal/domain/flow_definition_validator.go`). The CLI runs it in\n * `buildSyncPlan` so every rule the server enforces on apply speaks up\n * at plan time — with the same words — before anything mutates.\n *\n * Contract with the Go source:\n *\n * - Every rule id in {@link FLOW_VALIDATION_RULES} names the Go function\n * it ports (`goRef`); a drift-audit test asserts those functions still\n * exist and that the shared literals below still match.\n * - Error messages mirror the Go detail strings verbatim, so a user who\n * bypasses plan sees identical text from the server.\n * - Unlike the Go validator (fail-fast), this port collects every issue.\n * Later phases are gated on earlier phases being clean so one defect\n * does not cascade into noise (a BFS over duplicate step names is\n * ill-defined).\n *\n * Scope cuts (server/service-side, not portable): pivot/switch targets\n * must name an active flow definition in the same project (needs the\n * DB); the user schema itself is assumed meta-schema-valid.\n *\n * Lifecycle: this port is a local-first interim, not a second source of\n * truth to grow. Its designed successor is the server-side validate-only\n * bundle endpoint (zitadel/nextgen#449); once plan can ask the server,\n * this file, its drift audit, and the keep-in-sync comment on the Go\n * validator all go away. New rules land in Go first and are ported here\n * only until then.\n */\n\nexport type FlowValidationSeverity = \"error\" | \"warning\";\n\nexport type FlowValidationIssue = {\n severity: FlowValidationSeverity;\n /** Stable rule id from {@link FLOW_VALIDATION_RULES}. */\n rule: FlowValidationRuleId;\n /** Mirrors the Go `ErrFlowDefinitionInvalid` detail string where a Go rule exists. */\n message: string;\n /** Step the issue is anchored to, when applicable. */\n step?: string;\n};\n\n/**\n * Rule registry: rule id → the Go function it ports. `goRef: null` marks\n * CLI-only guidance with no server counterpart.\n */\nexport const FLOW_VALIDATION_RULES = {\n \"step-names\": { goRef: \"stepNamesMap\" },\n definition: { goRef: \"validateDefinition\" },\n steps: { goRef: \"validateSteps\" },\n graph: { goRef: \"validateGraph\" },\n cycles: { goRef: \"validateCycles\" },\n \"flip-table\": { goRef: \"validateFlipTableCoverage\" },\n \"schema/required-fields\": { goRef: \"validateRequiredUserSchemaFields\" },\n \"schema/fields-resolve\": { goRef: \"resolveAllStepFields\" },\n \"schema/passkey-actions\": { goRef: \"validatePasskeyActionsEnabled\" },\n \"schema/on-success-manifest\": { goRef: \"validateOnSuccessManifests\" },\n \"warn/password-without-identifier\": { goRef: null },\n} as const;\n\nexport type FlowValidationRuleId = keyof typeof FLOW_VALIDATION_RULES;\n\n/** Mirrors `reservedOutcomes` in flow_definition_validator.go. */\nexport const RESERVED_OUTCOMES = [\n \"user_not_found\",\n \"user_already_exists\",\n \"identity_unknown\",\n \"callback\",\n] as const;\n\n/** Mirrors the `FlowDefinitionPurpose` enum (snake transform) in flow_definition.go. */\nexport const FLOW_PURPOSES = [\n \"login\",\n \"register\",\n \"recovery\",\n \"profiling\",\n \"reauth\",\n \"link_account\",\n] as const;\n\n/**\n * Mirrors `purposeFlipTargets` in flow_definition_validator.go: the\n * identifier outcomes only. `identity_unknown` comes only from SSO\n * resolution and is left out here; requiring it on every combined entry\n * step would reject the shipped default flow. A rule on steps carrying\n * sso_providers is future work (#1044).\n */\nexport const PURPOSE_FLIP_TARGETS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n login: { user_not_found: \"register\" },\n register: { user_already_exists: \"login\" },\n};\n\n/** Mirrors `flipOutcomeImpacts` in flow_definition_validator.go (verbatim). */\nconst FLIP_OUTCOME_IMPACTS: Readonly<Record<string, string>> = {\n user_not_found:\n \"someone without an account gets stuck at sign-in instead of being routed to registration\",\n user_already_exists:\n \"someone who already has an account gets stuck at registration instead of being routed to sign-in\",\n};\n\n/** Action kinds a flow author may declare; `back` is engine-injected. */\nconst DECLARABLE_ACTION_KINDS = new Set([\"submit\", \"passkey\", \"passkey_register\", \"navigate\"]);\n\n/** Mirrors `flowBackActionName` in flow_state_machine.go. */\nconst BACK_ACTION_NAME = \"back\";\n\n/** Mirrors `authMethodPrefix` in flow_definition.go. */\nconst AUTH_METHOD_PREFIX = \"x-auth-methods#\";\n\n/** Mirrors `ManifestForOnSuccess` in flow_on_success.go. */\nconst ON_SUCCESS_MANIFESTS: Readonly<Record<string, readonly FieldChallenge[]>> = {\n create_user: [\"identifier\", \"password\"],\n};\n\ntype FieldChallenge = \"identifier\" | \"password\";\n\n/**\n * Validate a flow-definition config body (the `.zitadel/flows/*.json`\n * content) against the rules the server enforces on apply. `schema` is\n * the content of the user schema the flow's `user_schema` pins; when\n * omitted, schema-dependent rules are skipped. Pure — collects all\n * issues, never throws.\n */\nexport function validateFlowDefinition(flow: object, schema?: object): FlowValidationIssue[] {\n const def = readFlow(flow);\n const issues: FlowValidationIssue[] = [];\n\n // Phase 1 — step names (everything else keys off them).\n const stepNames = new Set<string>();\n for (const step of def.steps) {\n if (stepNames.has(step.name)) {\n issues.push(error(\"step-names\", `duplicate step name ${q(step.name)}`, step.name));\n }\n stepNames.add(step.name);\n }\n\n // Phase 2 — purposes.\n if (def.purposes.size === 0) {\n issues.push(error(\"definition\", \"no purposes defined\"));\n }\n for (const [purpose, entryStep] of def.purposes) {\n if (!(FLOW_PURPOSES as readonly string[]).includes(purpose)) {\n issues.push(error(\"definition\", `'${purpose}' is not a valid purpose`));\n continue;\n }\n if (entryStep === \"\") {\n issues.push(error(\"definition\", `initial step for purpose '${purpose}' is empty`));\n continue;\n }\n if (!stepNames.has(entryStep)) {\n issues.push(\n error(\"definition\", `purpose ${q(purpose)} targets unknown entry-point step ${q(entryStep)}`),\n );\n }\n }\n\n // Phase 3 — per-step structure.\n for (const step of def.steps) {\n issues.push(...validateStep(step));\n }\n\n // Graph phases are ill-defined over broken structure — gate on 1–3.\n if (issues.length === 0) {\n issues.push(...validateGraph(def, stepNames));\n if (issues.length === 0) {\n issues.push(...validateCycles(def));\n }\n issues.push(...validateFlipTableCoverage(def));\n }\n\n // Schema-dependent phases: only meaningful over structurally sound\n // steps, and only when the paired schema content is available.\n if (schema !== undefined && issues.length === 0) {\n issues.push(...validateAgainstSchema(def, schema));\n }\n\n return issues;\n}\n\n// ── internal flow reading ────────────────────────────────────────────────────\n\ntype FlowStep = {\n name: string;\n fields: string[];\n actions: { name: string; kind: string }[];\n gateCount: number;\n ssoProviderCount: number;\n transitions: Map<string, { target: string; action: string | null; purpose: string | null }>;\n onSuccess: string | undefined;\n terminal: boolean;\n};\n\ntype FlowDef = {\n purposes: Map<string, string>;\n steps: FlowStep[];\n};\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction str(value: unknown): string {\n return typeof value === \"string\" ? value : \"\";\n}\n\n/**\n * Coerce raw parsed JSON into the internal shape. Callers usually run\n * the Zod config schema first; the defensive reads keep the standalone\n * API from crashing on malformed input (it reports rule violations on\n * whatever is readable instead).\n */\nfunction readFlow(flow: object): FlowDef {\n const raw = flow as Record<string, unknown>;\n\n const purposes = new Map<string, string>();\n if (isPlainObject(raw.purposes)) {\n for (const [purpose, entry] of Object.entries(raw.purposes)) {\n purposes.set(purpose, str(entry));\n }\n }\n\n const steps: FlowStep[] = [];\n if (Array.isArray(raw.steps)) {\n for (const value of raw.steps) {\n if (!isPlainObject(value)) continue;\n const transitions = new Map<\n string,\n { target: string; action: string | null; purpose: string | null }\n >();\n if (isPlainObject(value.transitions)) {\n for (const [key, t] of Object.entries(value.transitions)) {\n const entry = isPlainObject(t) ? t : {};\n transitions.set(key, {\n target: str(entry.target),\n action: typeof entry.action === \"string\" ? entry.action : null,\n purpose: typeof entry.purpose === \"string\" ? entry.purpose : null,\n });\n }\n }\n steps.push({\n name: str(value.name),\n fields: Array.isArray(value.fields) ? value.fields.map(str) : [],\n actions: Array.isArray(value.actions)\n ? value.actions\n .filter(isPlainObject)\n .map((a) => ({ name: str(a.name), kind: str(a.kind) }))\n : [],\n gateCount: isPlainObject(value.gates) ? Object.keys(value.gates).length : 0,\n ssoProviderCount: Array.isArray(value.sso_providers) ? value.sso_providers.length : 0,\n transitions,\n onSuccess: typeof value.on_success === \"string\" ? value.on_success : undefined,\n terminal: value.complete !== undefined && value.complete !== null,\n });\n }\n }\n\n return { purposes, steps };\n}\n\n/** Go `%q` — double-quoted string. */\nfunction q(value: string): string {\n return JSON.stringify(value);\n}\n\nfunction error(rule: FlowValidationRuleId, message: string, step?: string): FlowValidationIssue {\n return step === undefined\n ? { severity: \"error\", rule, message }\n : { severity: \"error\", rule, message, step };\n}\n\n// ── phase 3: per-step structure (validateSteps + uniqueNonEmptyFields) ──────\n\nfunction validateStep(step: FlowStep): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n const name = step.name;\n\n if (step.terminal) {\n if (\n step.fields.length > 0 ||\n step.actions.length > 0 ||\n step.transitions.size > 0 ||\n step.gateCount > 0 ||\n step.ssoProviderCount > 0\n ) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)} is terminal (complete is set) but has fields, actions, transitions, gates, or sso_providers`,\n name,\n ),\n );\n }\n return issues;\n }\n\n const seenFields = new Set<string>();\n for (const field of step.fields) {\n if (field === \"\") {\n issues.push(error(\"steps\", `step ${q(name)}: field entry is empty`, name));\n continue;\n }\n if (seenFields.has(field)) {\n issues.push(error(\"steps\", `step ${q(name)}: duplicate field ${q(field)}`, name));\n }\n seenFields.add(field);\n }\n\n const actionNames = new Set<string>();\n for (const action of step.actions) {\n if (action.name === \"\") {\n issues.push(error(\"steps\", `step ${q(name)}: action has empty name`, name));\n continue;\n }\n if (actionNames.has(action.name)) {\n issues.push(error(\"steps\", `step ${q(name)}: duplicate action ${q(action.name)}`, name));\n continue;\n }\n if (action.kind === \"\" || (action.kind !== \"back\" && !DECLARABLE_ACTION_KINDS.has(action.kind))) {\n issues.push(error(\"steps\", `step ${q(name)}: action ${q(action.name)} has no kind`, name));\n } else if (action.kind === \"back\") {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: action ${q(action.name)} has kind=back, which is engine-injected and cannot be declared`,\n name,\n ),\n );\n }\n if (action.name === BACK_ACTION_NAME) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: action name ${q(action.name)} is reserved for engine-injected back navigation`,\n name,\n ),\n );\n }\n actionNames.add(action.name);\n }\n\n const hasCallback = step.transitions.has(\"callback\");\n if (\n step.fields.length === 0 &&\n step.actions.length === 0 &&\n step.ssoProviderCount === 0 &&\n step.gateCount === 0 &&\n !hasCallback\n ) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)} is non-terminal but has no fields, actions, sso_providers, gates, or transitions.callback`,\n name,\n ),\n );\n }\n\n if (step.ssoProviderCount > 0 && !hasCallback) {\n issues.push(\n error(\"steps\", `step ${q(name)}: has sso_providers but is missing transitions.callback`, name),\n );\n }\n\n for (const actionName of actionNames) {\n if (!step.transitions.has(actionName)) {\n issues.push(\n error(\"steps\", `step ${q(name)}: action ${q(actionName)} has no matching transition`, name),\n );\n }\n }\n\n for (const transitionKey of step.transitions.keys()) {\n if (!actionNames.has(transitionKey) && !(RESERVED_OUTCOMES as readonly string[]).includes(transitionKey)) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: transition key ${q(transitionKey)} is not an action name or reserved outcome (user_not_found, user_already_exists, identity_unknown, callback)`,\n name,\n ),\n );\n }\n }\n\n return issues;\n}\n\n// ── phase 4: graph / cycles / flip table ─────────────────────────────────────\n\n/** A transition with no cross-flow action targets a step in this flow. */\nfunction isCurrentFlow(t: { action: string | null }): boolean {\n return t.action === null;\n}\n\n/** Adjacency over local (current-flow) transitions: step → target steps. */\nfunction localAdjacency(def: FlowDef): Map<string, string[]> {\n const adj = new Map<string, string[]>();\n for (const step of def.steps) {\n for (const t of step.transitions.values()) {\n if (isCurrentFlow(t)) {\n const targets = adj.get(step.name) ?? [];\n targets.push(t.target);\n adj.set(step.name, targets);\n }\n }\n }\n return adj;\n}\n\n/** Reverse adjacency over local transitions: target step → source steps. */\nfunction reverseAdjacency(def: FlowDef): Map<string, string[]> {\n const reverse = new Map<string, string[]>();\n for (const step of def.steps) {\n for (const t of step.transitions.values()) {\n if (isCurrentFlow(t)) {\n const sources = reverse.get(t.target) ?? [];\n sources.push(step.name);\n reverse.set(t.target, sources);\n }\n }\n }\n return reverse;\n}\n\n/** BFS from `start` over `adj`, accumulating into `visited`. */\nfunction bfs(start: string, adj: Map<string, string[]>, visited: Set<string>): void {\n const queue = [start];\n for (let head = 0; head < queue.length; head += 1) {\n const current = queue[head];\n if (current === undefined || visited.has(current)) continue;\n visited.add(current);\n queue.push(...(adj.get(current) ?? []));\n }\n}\n\nfunction validateGraph(def: FlowDef, stepNames: Set<string>): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n\n for (const step of def.steps) {\n for (const [key, t] of step.transitions) {\n if (t.purpose !== null) {\n // Local re-purposing: never combined with a cross-flow action,\n // only to a purpose this definition serves, and only to that\n // purpose's entry step. Mirrors the server-side validator.\n if (t.action !== null) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} declares both purpose and action; a transition either re-purposes locally or targets another flow`,\n step.name,\n ),\n );\n } else if (!(FLOW_PURPOSES as readonly string[]).includes(t.purpose)) {\n // Verbatim-identical to the Go validator's message (which cannot\n // print the raw value — its parse layer rejects it earlier).\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} has invalid purpose`,\n step.name,\n ),\n );\n } else {\n const entry = def.purposes.get(t.purpose);\n if (entry === undefined) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)}, which this definition does not serve`,\n step.name,\n ),\n );\n } else if (t.target !== entry) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)} but targets ${q(t.target)}; it must target that purpose's entry step ${q(entry)}`,\n step.name,\n ),\n );\n }\n }\n }\n if (isCurrentFlow(t)) {\n if (!stepNames.has(t.target)) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} targets unknown step ${q(t.target)}`,\n step.name,\n ),\n );\n }\n } else if (t.action !== \"switch\" && t.action !== \"pivot\") {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} has invalid action ${q(t.action ?? \"\")}`,\n step.name,\n ),\n );\n }\n }\n }\n\n for (const step of def.steps) {\n if (!step.terminal && step.transitions.size === 0) {\n issues.push(\n error(\"graph\", `step ${q(step.name)} is non-terminal but has no outgoing transitions`, step.name),\n );\n }\n }\n\n const reachable = new Set<string>();\n const adj = localAdjacency(def);\n for (const entryStep of def.purposes.values()) {\n bfs(entryStep, adj, reachable);\n }\n for (const step of def.steps) {\n if (!reachable.has(step.name)) {\n issues.push(error(\"graph\", `step ${q(step.name)} is unreachable from any entry point`, step.name));\n }\n }\n\n return issues;\n}\n\nfunction validateCycles(def: FlowDef): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n const reverse = reverseAdjacency(def);\n\n // Seed: escape nodes (terminal, or a switch/pivot out); BFS backwards.\n const safe = new Set<string>();\n const queue: string[] = [];\n for (const step of def.steps) {\n const escapes =\n step.terminal || [...step.transitions.values()].some((t) => !isCurrentFlow(t));\n if (escapes) {\n safe.add(step.name);\n queue.push(step.name);\n }\n }\n for (let head = 0; head < queue.length; head += 1) {\n const current = queue[head];\n if (current === undefined) continue;\n for (const pred of reverse.get(current) ?? []) {\n if (!safe.has(pred)) {\n safe.add(pred);\n queue.push(pred);\n }\n }\n }\n\n for (const step of def.steps) {\n if (!step.terminal && !safe.has(step.name)) {\n issues.push(\n error(\n \"cycles\",\n `step ${q(step.name)} is trapped: no path to a terminal step or another flow`,\n step.name,\n ),\n );\n }\n }\n return issues;\n}\n\nfunction validateFlipTableCoverage(def: FlowDef): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n for (const [purpose, entryStepName] of def.purposes) {\n const flipTargets = PURPOSE_FLIP_TARGETS[purpose];\n if (flipTargets === undefined) continue;\n const entry = def.steps.find((s) => s.name === entryStepName);\n if (entry === undefined) continue;\n for (const [outcome, targetPurpose] of Object.entries(flipTargets)) {\n if (!def.purposes.has(targetPurpose)) continue;\n if (!entry.transitions.has(outcome)) {\n issues.push(\n error(\n \"flip-table\",\n `step ${q(entry.name)}: entry step for purpose ${q(purpose)} must wire ${q(outcome)} transition because ${q(targetPurpose)} is also a purpose: without it, ${FLIP_OUTCOME_IMPACTS[outcome]}`,\n entry.name,\n ),\n );\n }\n }\n }\n return issues;\n}\n\n// ── phase 5: schema-dependent rules ──────────────────────────────────────────\n\nfunction schemaProperties(schema: Record<string, unknown>): Record<string, unknown> | undefined {\n return isPlainObject(schema.properties) ? schema.properties : undefined;\n}\n\nfunction schemaRequired(schema: Record<string, unknown>): string[] {\n return Array.isArray(schema.required) ? schema.required.map(str).filter((n) => n !== \"\") : [];\n}\n\n/**\n * Mirrors `schemaReader.RequiredPaths`: every name in `required`,\n * recursed through the nested `required` of each required object. A\n * required object declaring no `required` of its own ends the descent at\n * the object itself.\n *\n * An optional object contributes its own `required` too once it appears\n * in `materialized`. It only exists in the document because something\n * beneath it was collected, and from that point document validation\n * enforces the rest of its `required` list.\n */\nfunction requiredPaths(\n schema: Record<string, unknown>,\n materialized: ReadonlySet<string>,\n prefix = \"\",\n): string[] {\n const properties = schemaProperties(schema);\n const required = schemaRequired(schema);\n // A set, like the Go `map[string]struct{}`, so a name repeated in\n // `required` yields the path once.\n const out = new Set<string>();\n\n for (const name of required) {\n const path = prefix === \"\" ? name : `${prefix}.${name}`;\n const property =\n properties !== undefined && Object.hasOwn(properties, name) ? properties[name] : undefined;\n if (!isPlainObject(property) || schemaRequired(property).length === 0) {\n out.add(path);\n continue;\n }\n for (const nested of requiredPaths(property, materialized, path)) out.add(nested);\n }\n\n // An optional object is invisible to the loop above, so descend into\n // the ones a collected field materializes.\n for (const [name, property] of Object.entries(properties ?? {})) {\n if (required.includes(name) || !isPlainObject(property)) continue;\n const path = prefix === \"\" ? name : `${prefix}.${name}`;\n if (!materialized.has(path)) continue;\n for (const nested of requiredPaths(property, materialized, path)) out.add(nested);\n }\n\n return [...out];\n}\n\n/** Mirrors `xAuthMethodsReader.IsEnabled` in flow_field_resolver_schema.go. */\nfunction authMethodEnabled(schema: Record<string, unknown>, method: string): boolean {\n if (!isPlainObject(schema[\"x-auth-methods\"])) return false;\n const entry = schema[\"x-auth-methods\"][method];\n return isPlainObject(entry) && entry.enabled === true;\n}\n\n/**\n * Resolve one step field to its challenge, mirroring the subset of\n * `SchemaFieldResolver.Resolve` the validator needs. Returns either the\n * challenge (or null for none) or the Go-verbatim resolution error.\n */\nfunction resolveFieldChallenge(\n field: string,\n properties: Record<string, unknown>,\n schema: Record<string, unknown>,\n): { challenge: FieldChallenge | null } | { message: string } {\n if (field.startsWith(AUTH_METHOD_PREFIX)) {\n const method = field.slice(AUTH_METHOD_PREFIX.length);\n // Mirrors deriveAuthMethodType: only password is field-shaped today.\n if (method !== \"password\") {\n return { message: `unknown field type for ${q(field)}` };\n }\n if (!authMethodEnabled(schema, method)) {\n // Surfaced by resolveAllStepFields' enabled-method cross-check.\n return { message: `${q(method)} is not an enabled authentication method` };\n }\n return { challenge: \"password\" };\n }\n\n // Mirrors walkUserProperty: a nested property is addressed by its\n // dotted path, descending one `properties` level per segment.\n const segments = field.split(\".\");\n let property: unknown = undefined;\n let level: Record<string, unknown> | undefined = properties;\n for (const [i, segment] of segments.entries()) {\n // Own properties only: Go indexes a map, where an inherited name like\n // `toString` is simply absent.\n property = level !== undefined && Object.hasOwn(level, segment) ? level[segment] : undefined;\n if (property === undefined) {\n return { message: `flow field: not a property in the user schema: ${q(field)}` };\n }\n const nested = isPlainObject(property) ? schemaProperties(property) : undefined;\n if (i < segments.length - 1 && nested === undefined) {\n return { message: `flow field: not a property in the user schema: ${q(field)}` };\n }\n level = nested;\n }\n\n if (!isPlainObject(property)) {\n return { challenge: null };\n }\n\n // Mirrors schemaReader.JSONType: the nullable idiom `[\"null\", X]`\n // reduces to X; any other multi-entry union is unsupported. Go reduces\n // before it tests for a composite, so the union error wins and the\n // object/array test below reads the reduced type rather than the union.\n let jsonType = property.type;\n if (Array.isArray(jsonType)) {\n const nonNull = jsonType.filter((t) => t !== \"null\");\n if (nonNull.length > 1) {\n return { message: `flow field: unsupported JSON type: [${jsonType.map(str).join(\" \")}]` };\n }\n // Undefined when every entry was \"null\", matching Go's empty-string case.\n jsonType = nonNull[0];\n }\n\n // Mirrors deriveUserPropertyType: an object or array has no\n // field-shaped input. A property carrying `properties` is an object,\n // and one carrying `items` is an array, even when it omits the `type`\n // keyword.\n if (\n jsonType === \"object\" ||\n jsonType === \"array\" ||\n schemaProperties(property) !== undefined ||\n \"items\" in property\n ) {\n return {\n message: `flow field: not a scalar property, name a nested leaf instead: ${q(field)}`,\n };\n }\n\n // Mirrors deriveIdentifierChallenge: the field naming the schema-root\n // `x-identifier` designation is the identifier (ADR 057); other\n // properties — unique or not — carry no identifier challenge.\n const identifier = schema[\"x-identifier\"];\n if (typeof identifier === \"string\" && identifier !== \"\" && field === identifier) {\n return { challenge: \"identifier\" };\n }\n return { challenge: null };\n}\n\nfunction validateAgainstSchema(def: FlowDef, schema: object): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n const raw = schema as Record<string, unknown>;\n\n const properties = schemaProperties(raw);\n if (properties === undefined) {\n issues.push(error(\"schema/fields-resolve\", \"user schema has no properties\"));\n return issues;\n }\n\n // Required-fields coverage (validateRequiredUserSchemaFields).\n // Collecting `address.street` covers the leaf and every object above\n // it, since an object materializes once one of its children is\n // collected. The same prefixes are what the schema treats as\n // materialized, so an optional object's own `required` list comes into\n // force here too.\n const covered = new Set<string>();\n for (const step of def.steps) {\n for (const field of step.fields) {\n let path = \"\";\n for (const node of field.split(\".\")) {\n path = path === \"\" ? node : `${path}.${node}`;\n covered.add(path);\n }\n }\n }\n const missing = requiredPaths(raw, covered)\n .filter((field) => !covered.has(field))\n .sort();\n if (missing.length > 0) {\n issues.push(\n error(\n \"schema/required-fields\",\n `required fields [${missing.join(\" \")}] in user schema are missing in the flow definition steps`,\n ),\n );\n }\n\n // Field resolution (resolveAllStepFields), collecting challenges for\n // the manifest and warning rules below.\n const challengesByStep = new Map<string, Set<FieldChallenge>>();\n let resolutionFailed = false;\n for (const step of def.steps) {\n const challenges = new Set<FieldChallenge>();\n for (const field of step.fields) {\n const resolved = resolveFieldChallenge(field, properties, raw);\n if (\"message\" in resolved) {\n issues.push(\n error(\"schema/fields-resolve\", `step ${q(step.name)}: ${resolved.message}`, step.name),\n );\n resolutionFailed = true;\n continue;\n }\n if (resolved.challenge !== null) {\n challenges.add(resolved.challenge);\n }\n }\n challengesByStep.set(step.name, challenges);\n }\n\n // Passkey enablement (validatePasskeyActionsEnabled): passkey is\n // action-shaped, not field-shaped, so the per-field enabled-method\n // check above never sees it.\n if (!authMethodEnabled(raw, \"passkey\")) {\n for (const step of def.steps) {\n for (const action of step.actions) {\n if (action.kind === \"passkey\" || action.kind === \"passkey_register\") {\n issues.push(\n error(\n \"schema/passkey-actions\",\n `step ${q(step.name)}: action ${q(action.name)} offers passkey but \"passkey\" is not an enabled authentication method`,\n step.name,\n ),\n );\n }\n }\n }\n }\n\n if (resolutionFailed) {\n return issues;\n }\n\n // on_success manifests (validateOnSuccessManifests): every kind the\n // mutation needs must be collected on the step or upstream.\n const reverse = reverseAdjacency(def);\n for (const step of def.steps) {\n if (step.onSuccess === undefined) continue;\n const manifest = ON_SUCCESS_MANIFESTS[step.onSuccess];\n if (manifest === undefined) continue;\n const upstream = new Set<string>();\n bfs(step.name, reverse, upstream);\n for (const kind of manifest) {\n const established = [...upstream].some((name) => challengesByStep.get(name)?.has(kind));\n if (!established) {\n issues.push(\n error(\n \"schema/on-success-manifest\",\n `step ${q(step.name)}: on_success ${step.onSuccess} requires ${q(kind)} to be collected upstream`,\n step.name,\n ),\n );\n }\n }\n }\n\n // CLI-only guidance (no Go counterpart): a password collected on the\n // login path with no identifier upstream leaves the engine unable to\n // resolve which user to challenge. Path-sensitive: walk forward from\n // the login entry and stop at any step that collects an identifier\n // (every route through it is covered), so an identifier on a\n // *different* route — e.g. only on the register-purpose chain into a\n // shared step — cannot mask a login route that never collects one.\n const loginEntry = def.purposes.get(\"login\");\n if (loginEntry !== undefined) {\n const adj = localAdjacency(def);\n const identifierFree = new Set<string>();\n const queue = [loginEntry];\n for (let head = 0; head < queue.length; head += 1) {\n const name = queue[head];\n if (name === undefined || identifierFree.has(name)) continue;\n if (challengesByStep.get(name)?.has(\"identifier\")) continue;\n identifierFree.add(name);\n queue.push(...(adj.get(name) ?? []));\n }\n for (const step of def.steps) {\n if (!identifierFree.has(step.name)) continue;\n if (!challengesByStep.get(step.name)?.has(\"password\")) continue;\n issues.push({\n severity: \"warning\",\n rule: \"warn/password-without-identifier\",\n message: `step ${q(step.name)} collects ${AUTH_METHOD_PREFIX}password on the login path but no upstream step collects an identifier field — the engine cannot resolve which user to challenge`,\n step: step.name,\n });\n }\n }\n\n return issues;\n}\n"],"mappings":";;;;;AA8CA,MAAa,wBAAwB;CACnC,cAAc,EAAE,OAAO,gBAAgB;CACvC,YAAY,EAAE,OAAO,sBAAsB;CAC3C,OAAO,EAAE,OAAO,iBAAiB;CACjC,OAAO,EAAE,OAAO,iBAAiB;CACjC,QAAQ,EAAE,OAAO,kBAAkB;CACnC,cAAc,EAAE,OAAO,6BAA6B;CACpD,0BAA0B,EAAE,OAAO,oCAAoC;CACvE,yBAAyB,EAAE,OAAO,wBAAwB;CAC1D,0BAA0B,EAAE,OAAO,iCAAiC;CACpE,8BAA8B,EAAE,OAAO,8BAA8B;CACrE,oCAAoC,EAAE,OAAO,MAAM;CACpD;;AAKD,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACD;;AAGD,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;AASD,MAAa,uBAAmF;CAC9F,OAAO,EAA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AAS,CAAC,MAAM,SAAS,iBAAiB,IAAI,KAAK,EAAE,IAAI,KAAK,CACtE,CACd,QAAO,KACL,MACE,8BACA,QAAQ,EAAE,KAAK,KAAK,CAAC,eAAe,KAAK,UAAU,YAAY,EAAE,KAAK,CAAC,4BACvE,KAAK,KACN,CACF;;CAYP,MAAM,aAAa,IAAI,SAAS,IAAI,QAAQ;AAC5C,KAAI,eAAe,KAAA,GAAW;EAC5B,MAAM,MAAM,eAAe,IAAI;EAC/B,MAAM,iCAAiB,IAAI,KAAa;EACxC,MAAM,QAAQ,CAAC,WAAW;AAC1B,OAAK,IAAI,OAAO,GAAG,OAAO,MAAM,QAAQ,QAAQ,GAAG;GACjD,MAAM,OAAO,MAAM;AACnB,OAAI,SAAS,KAAA,KAAa,eAAe,IAAI,KAAK,CAAE;AACpD,OAAI,iBAAiB,IAAI,KAAK,EAAE,IAAI,aAAa,CAAE;AACnD,kBAAe,IAAI,KAAK;AACxB,SAAM,KAAK,GAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAE;;AAEtC,OAAK,MAAM,QAAQ,IAAI,OAAO;AAC5B,OAAI,CAAC,eAAe,IAAI,KAAK,KAAK,CAAE;AACpC,OAAI,CAAC,iBAAiB,IAAI,KAAK,KAAK,EAAE,IAAI,WAAW,CAAE;AACvD,UAAO,KAAK;IACV,UAAU;IACV,MAAM;IACN,SAAS,QAAQ,EAAE,KAAK,KAAK,CAAC,YAAY,mBAAmB;IAC7D,MAAM,KAAK;IACZ,CAAC;;;AAIN,QAAO"}
1
+ {"version":3,"file":"validate.mjs","names":[],"sources":["../src/validate.ts"],"sourcesContent":["/**\n * Plan-time port of the server's flow-definition validator\n * (`internal/domain/flow_definition_validator.go`). The CLI runs it in\n * `buildSyncPlan` so every rule the server enforces on apply speaks up\n * at plan time — with the same words — before anything mutates.\n *\n * Contract with the Go source:\n *\n * - Every rule id in {@link FLOW_VALIDATION_RULES} names the Go function\n * it ports (`goRef`); a drift-audit test asserts those functions still\n * exist and that the shared literals below still match.\n * - Error messages mirror the Go detail strings verbatim, so a user who\n * bypasses plan sees identical text from the server.\n * - Unlike the Go validator (fail-fast), this port collects every issue.\n * Later phases are gated on earlier phases being clean so one defect\n * does not cascade into noise (a BFS over duplicate step names is\n * ill-defined).\n *\n * Scope cuts (server/service-side, not portable): pivot/switch targets\n * must name an active flow definition in the same project (needs the\n * DB); the user schema itself is assumed meta-schema-valid.\n *\n * Lifecycle: this port is a local-first interim, not a second source of\n * truth to grow. Its designed successor is the server-side validate-only\n * bundle endpoint (zitadel/nextgen#449); once plan can ask the server,\n * this file, its drift audit, and the keep-in-sync comment on the Go\n * validator all go away. New rules land in Go first and are ported here\n * only until then.\n */\n\nexport type FlowValidationSeverity = \"error\" | \"warning\";\n\nexport type FlowValidationIssue = {\n severity: FlowValidationSeverity;\n /** Stable rule id from {@link FLOW_VALIDATION_RULES}. */\n rule: FlowValidationRuleId;\n /** Mirrors the Go `ErrFlowDefinitionInvalid` detail string where a Go rule exists. */\n message: string;\n /** Step the issue is anchored to, when applicable. */\n step?: string;\n};\n\n/**\n * Rule registry: rule id → the Go function it ports. `goRef: null` marks\n * CLI-only guidance with no server counterpart.\n */\nexport const FLOW_VALIDATION_RULES = {\n \"step-names\": { goRef: \"stepNamesMap\" },\n definition: { goRef: \"validateDefinition\" },\n steps: { goRef: \"validateSteps\" },\n graph: { goRef: \"validateGraph\" },\n cycles: { goRef: \"validateCycles\" },\n \"flip-table\": { goRef: \"validateFlipTableCoverage\" },\n \"schema/required-fields\": { goRef: \"validateRequiredUserSchemaFields\" },\n \"schema/fields-resolve\": { goRef: \"resolveAllStepFields\" },\n \"schema/passkey-actions\": { goRef: \"validatePasskeyActionsEnabled\" },\n \"schema/on-success-manifest\": { goRef: \"validateOnSuccessManifests\" },\n \"warn/password-without-identifier\": { goRef: null },\n} as const;\n\nexport type FlowValidationRuleId = keyof typeof FLOW_VALIDATION_RULES;\n\n/** Mirrors `reservedOutcomes` in flow_definition_validator.go. */\nexport const RESERVED_OUTCOMES = [\n \"user_not_found\",\n \"user_already_exists\",\n \"sso_user_not_found\",\n \"sso_authenticated\",\n] as const;\n\n/** Mirrors the `FlowDefinitionPurpose` enum (snake transform) in flow_definition.go. */\nexport const FLOW_PURPOSES = [\n \"login\",\n \"register\",\n \"recovery\",\n \"profiling\",\n \"reauth\",\n \"link_account\",\n] as const;\n\n/**\n * Mirrors `purposeFlipTargets` in flow_definition_validator.go: the\n * identifier outcomes only. `sso_user_not_found` comes only from SSO\n * resolution and is left out here; requiring it on every combined entry\n * step would reject the shipped default flow. A rule on steps carrying\n * sso_providers is future work (#1044).\n */\nexport const PURPOSE_FLIP_TARGETS: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n login: { user_not_found: \"register\" },\n register: { user_already_exists: \"login\" },\n};\n\n/** Mirrors `flipOutcomeImpacts` in flow_definition_validator.go (verbatim). */\nconst FLIP_OUTCOME_IMPACTS: Readonly<Record<string, string>> = {\n user_not_found:\n \"someone without an account gets stuck at sign-in instead of being routed to registration\",\n user_already_exists:\n \"someone who already has an account gets stuck at registration instead of being routed to sign-in\",\n};\n\n/** Action kinds a flow author may declare; `back` is engine-injected. */\nconst DECLARABLE_ACTION_KINDS = new Set([\"submit\", \"passkey\", \"passkey_register\", \"navigate\"]);\n\n/**\n * Action names the engine claims, with the reason the validator reports.\n * Mirrors `flowBackActionName` and `FlowActionSSO` in flow_state_machine.go.\n * A Map, not an object, so a name like `constructor` cannot match by accident.\n */\nconst RESERVED_ACTION_NAMES = new Map([\n [\"back\", \"engine-injected back navigation\"],\n [\"sso\", \"sso submissions\"],\n]);\n\n/** Mirrors `authMethodPrefix` in flow_definition.go. */\nconst AUTH_METHOD_PREFIX = \"x-auth-methods#\";\n\n/** Mirrors `ManifestForOnSuccess` in flow_on_success.go. */\nconst ON_SUCCESS_MANIFESTS: Readonly<Record<string, readonly FieldChallenge[]>> = {\n create_user: [\"identifier\", \"password\"],\n};\n\ntype FieldChallenge = \"identifier\" | \"password\";\n\n/**\n * Validate a flow-definition config body (the `.zitadel/flows/*.json`\n * content) against the rules the server enforces on apply. `schema` is\n * the content of the user schema the flow's `user_schema` pins; when\n * omitted, schema-dependent rules are skipped. Pure — collects all\n * issues, never throws.\n */\nexport function validateFlowDefinition(flow: object, schema?: object): FlowValidationIssue[] {\n const def = readFlow(flow);\n const issues: FlowValidationIssue[] = [];\n\n // Phase 1 — step names (everything else keys off them).\n const stepNames = new Set<string>();\n for (const step of def.steps) {\n if (stepNames.has(step.name)) {\n issues.push(error(\"step-names\", `duplicate step name ${q(step.name)}`, step.name));\n }\n stepNames.add(step.name);\n }\n\n // Phase 2 — purposes.\n if (def.purposes.size === 0) {\n issues.push(error(\"definition\", \"no purposes defined\"));\n }\n for (const [purpose, entryStep] of def.purposes) {\n if (!(FLOW_PURPOSES as readonly string[]).includes(purpose)) {\n issues.push(error(\"definition\", `'${purpose}' is not a valid purpose`));\n continue;\n }\n if (entryStep === \"\") {\n issues.push(error(\"definition\", `initial step for purpose '${purpose}' is empty`));\n continue;\n }\n if (!stepNames.has(entryStep)) {\n issues.push(\n error(\n \"definition\",\n `purpose ${q(purpose)} targets unknown entry-point step ${q(entryStep)}`,\n ),\n );\n }\n }\n\n // Phase 3 — per-step structure.\n for (const step of def.steps) {\n issues.push(...validateStep(step));\n }\n\n // Graph phases are ill-defined over broken structure — gate on 1–3.\n if (issues.length === 0) {\n issues.push(...validateGraph(def, stepNames));\n if (issues.length === 0) {\n issues.push(...validateCycles(def));\n }\n issues.push(...validateFlipTableCoverage(def));\n }\n\n // Schema-dependent phases: only meaningful over structurally sound\n // steps, and only when the paired schema content is available.\n if (schema !== undefined && issues.length === 0) {\n issues.push(...validateAgainstSchema(def, schema));\n }\n\n return issues;\n}\n\n// ── internal flow reading ────────────────────────────────────────────────────\n\ntype FlowStep = {\n name: string;\n fields: string[];\n actions: { name: string; kind: string }[];\n gateCount: number;\n ssoProviderCount: number;\n transitions: Map<string, { target: string; action: string | null; purpose: string | null }>;\n onSuccess: string | undefined;\n terminal: boolean;\n};\n\ntype FlowDef = {\n purposes: Map<string, string>;\n steps: FlowStep[];\n};\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction str(value: unknown): string {\n return typeof value === \"string\" ? value : \"\";\n}\n\n/**\n * Coerce raw parsed JSON into the internal shape. Callers usually run\n * the Zod config schema first; the defensive reads keep the standalone\n * API from crashing on malformed input (it reports rule violations on\n * whatever is readable instead).\n */\nfunction readFlow(flow: object): FlowDef {\n const raw = flow as Record<string, unknown>;\n\n const purposes = new Map<string, string>();\n if (isPlainObject(raw.purposes)) {\n for (const [purpose, entry] of Object.entries(raw.purposes)) {\n purposes.set(purpose, str(entry));\n }\n }\n\n const steps: FlowStep[] = [];\n if (Array.isArray(raw.steps)) {\n for (const value of raw.steps) {\n if (!isPlainObject(value)) continue;\n const transitions = new Map<\n string,\n { target: string; action: string | null; purpose: string | null }\n >();\n if (isPlainObject(value.transitions)) {\n for (const [key, t] of Object.entries(value.transitions)) {\n const entry = isPlainObject(t) ? t : {};\n transitions.set(key, {\n target: str(entry.target),\n action: typeof entry.action === \"string\" ? entry.action : null,\n purpose: typeof entry.purpose === \"string\" ? entry.purpose : null,\n });\n }\n }\n steps.push({\n name: str(value.name),\n fields: Array.isArray(value.fields) ? value.fields.map(str) : [],\n actions: Array.isArray(value.actions)\n ? value.actions\n .filter(isPlainObject)\n .map((a) => ({ name: str(a.name), kind: str(a.kind) }))\n : [],\n gateCount: isPlainObject(value.gates) ? Object.keys(value.gates).length : 0,\n ssoProviderCount: Array.isArray(value.sso_providers) ? value.sso_providers.length : 0,\n transitions,\n onSuccess: typeof value.on_success === \"string\" ? value.on_success : undefined,\n terminal: value.complete !== undefined && value.complete !== null,\n });\n }\n }\n\n return { purposes, steps };\n}\n\n/** Go `%q` — double-quoted string. */\nfunction q(value: string): string {\n return JSON.stringify(value);\n}\n\nfunction error(rule: FlowValidationRuleId, message: string, step?: string): FlowValidationIssue {\n return step === undefined\n ? { severity: \"error\", rule, message }\n : { severity: \"error\", rule, message, step };\n}\n\n// ── phase 3: per-step structure (validateSteps + uniqueNonEmptyFields) ──────\n\nfunction validateStep(step: FlowStep): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n const name = step.name;\n\n if (step.terminal) {\n if (\n step.fields.length > 0 ||\n step.actions.length > 0 ||\n step.transitions.size > 0 ||\n step.gateCount > 0 ||\n step.ssoProviderCount > 0\n ) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)} is terminal (complete is set) but has fields, actions, transitions, gates, or sso_providers`,\n name,\n ),\n );\n }\n return issues;\n }\n\n const seenFields = new Set<string>();\n for (const field of step.fields) {\n if (field === \"\") {\n issues.push(error(\"steps\", `step ${q(name)}: field entry is empty`, name));\n continue;\n }\n if (seenFields.has(field)) {\n issues.push(error(\"steps\", `step ${q(name)}: duplicate field ${q(field)}`, name));\n }\n seenFields.add(field);\n }\n\n const actionNames = new Set<string>();\n for (const action of step.actions) {\n if (action.name === \"\") {\n issues.push(error(\"steps\", `step ${q(name)}: action has empty name`, name));\n continue;\n }\n if (actionNames.has(action.name)) {\n issues.push(error(\"steps\", `step ${q(name)}: duplicate action ${q(action.name)}`, name));\n continue;\n }\n if (\n action.kind === \"\" ||\n (action.kind !== \"back\" && !DECLARABLE_ACTION_KINDS.has(action.kind))\n ) {\n issues.push(error(\"steps\", `step ${q(name)}: action ${q(action.name)} has no kind`, name));\n } else if (action.kind === \"back\") {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: action ${q(action.name)} has kind=back, which is engine-injected and cannot be declared`,\n name,\n ),\n );\n }\n const reserved = RESERVED_ACTION_NAMES.get(action.name);\n if (reserved !== undefined) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: action name ${q(action.name)} is reserved for ${reserved}`,\n name,\n ),\n );\n }\n actionNames.add(action.name);\n }\n\n const hasSsoAuthenticated = step.transitions.has(\"sso_authenticated\");\n if (\n step.fields.length === 0 &&\n step.actions.length === 0 &&\n step.ssoProviderCount === 0 &&\n step.gateCount === 0 &&\n !hasSsoAuthenticated\n ) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)} is non-terminal but has no fields, actions, sso_providers, gates, or transitions.sso_authenticated`,\n name,\n ),\n );\n }\n\n if (step.ssoProviderCount > 0 && !hasSsoAuthenticated) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: has sso_providers but is missing transitions.sso_authenticated`,\n name,\n ),\n );\n }\n\n for (const actionName of actionNames) {\n if (!step.transitions.has(actionName)) {\n issues.push(\n error(\"steps\", `step ${q(name)}: action ${q(actionName)} has no matching transition`, name),\n );\n }\n }\n\n for (const [transitionKey, t] of step.transitions) {\n if (\n !actionNames.has(transitionKey) &&\n !(RESERVED_OUTCOMES as readonly string[]).includes(transitionKey)\n ) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: transition key ${q(transitionKey)} is not an action name or reserved outcome (user_not_found, user_already_exists, sso_user_not_found, sso_authenticated)`,\n name,\n ),\n );\n }\n // The sso outcomes carry a bound user or parked claims, which a\n // re-purpose would drop and another flow cannot receive.\n const isSsoOutcome =\n transitionKey === \"sso_authenticated\" || transitionKey === \"sso_user_not_found\";\n if (isSsoOutcome && (t.purpose !== null || t.action !== null)) {\n issues.push(\n error(\n \"steps\",\n `step ${q(name)}: transition ${q(transitionKey)} is an sso outcome and cannot declare purpose or action`,\n name,\n ),\n );\n }\n }\n\n return issues;\n}\n\n// ── phase 4: graph / cycles / flip table ─────────────────────────────────────\n\n/** A transition with no cross-flow action targets a step in this flow. */\nfunction isCurrentFlow(t: { action: string | null }): boolean {\n return t.action === null;\n}\n\n/** Adjacency over local (current-flow) transitions: step → target steps. */\nfunction localAdjacency(def: FlowDef): Map<string, string[]> {\n const adj = new Map<string, string[]>();\n for (const step of def.steps) {\n for (const t of step.transitions.values()) {\n if (isCurrentFlow(t)) {\n const targets = adj.get(step.name) ?? [];\n targets.push(t.target);\n adj.set(step.name, targets);\n }\n }\n }\n return adj;\n}\n\n/** Reverse adjacency over local transitions: target step → source steps. */\nfunction reverseAdjacency(def: FlowDef): Map<string, string[]> {\n const reverse = new Map<string, string[]>();\n for (const step of def.steps) {\n for (const t of step.transitions.values()) {\n if (isCurrentFlow(t)) {\n const sources = reverse.get(t.target) ?? [];\n sources.push(step.name);\n reverse.set(t.target, sources);\n }\n }\n }\n return reverse;\n}\n\n/** BFS from `start` over `adj`, accumulating into `visited`. */\nfunction bfs(start: string, adj: Map<string, string[]>, visited: Set<string>): void {\n const queue = [start];\n for (let head = 0; head < queue.length; head += 1) {\n const current = queue[head];\n if (current === undefined || visited.has(current)) continue;\n visited.add(current);\n queue.push(...(adj.get(current) ?? []));\n }\n}\n\nfunction validateGraph(def: FlowDef, stepNames: Set<string>): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n\n for (const step of def.steps) {\n for (const [key, t] of step.transitions) {\n if (t.purpose !== null) {\n // Local re-purposing: never combined with a cross-flow action,\n // only to a purpose this definition serves, and only to that\n // purpose's entry step. Mirrors the server-side validator.\n if (t.action !== null) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} declares both purpose and action; a transition either re-purposes locally or targets another flow`,\n step.name,\n ),\n );\n } else if (!(FLOW_PURPOSES as readonly string[]).includes(t.purpose)) {\n // Verbatim-identical to the Go validator's message (which cannot\n // print the raw value — its parse layer rejects it earlier).\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} has invalid purpose`,\n step.name,\n ),\n );\n } else {\n const entry = def.purposes.get(t.purpose);\n if (entry === undefined) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)}, which this definition does not serve`,\n step.name,\n ),\n );\n } else if (t.target !== entry) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} re-purposes to ${q(t.purpose)} but targets ${q(t.target)}; it must target that purpose's entry step ${q(entry)}`,\n step.name,\n ),\n );\n }\n }\n }\n if (isCurrentFlow(t)) {\n if (!stepNames.has(t.target)) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} targets unknown step ${q(t.target)}`,\n step.name,\n ),\n );\n }\n } else if (t.action !== \"switch\" && t.action !== \"pivot\") {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)}: transition ${q(key)} has invalid action ${q(t.action ?? \"\")}`,\n step.name,\n ),\n );\n }\n }\n }\n\n for (const step of def.steps) {\n if (!step.terminal && step.transitions.size === 0) {\n issues.push(\n error(\n \"graph\",\n `step ${q(step.name)} is non-terminal but has no outgoing transitions`,\n step.name,\n ),\n );\n }\n }\n\n const reachable = new Set<string>();\n const adj = localAdjacency(def);\n for (const entryStep of def.purposes.values()) {\n bfs(entryStep, adj, reachable);\n }\n for (const step of def.steps) {\n if (!reachable.has(step.name)) {\n issues.push(\n error(\"graph\", `step ${q(step.name)} is unreachable from any entry point`, step.name),\n );\n }\n }\n\n return issues;\n}\n\nfunction validateCycles(def: FlowDef): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n const reverse = reverseAdjacency(def);\n\n // Seed: escape nodes (terminal, or a switch/pivot out); BFS backwards.\n const safe = new Set<string>();\n const queue: string[] = [];\n for (const step of def.steps) {\n const escapes = step.terminal || [...step.transitions.values()].some((t) => !isCurrentFlow(t));\n if (escapes) {\n safe.add(step.name);\n queue.push(step.name);\n }\n }\n for (let head = 0; head < queue.length; head += 1) {\n const current = queue[head];\n if (current === undefined) continue;\n for (const pred of reverse.get(current) ?? []) {\n if (!safe.has(pred)) {\n safe.add(pred);\n queue.push(pred);\n }\n }\n }\n\n for (const step of def.steps) {\n if (!step.terminal && !safe.has(step.name)) {\n issues.push(\n error(\n \"cycles\",\n `step ${q(step.name)} is trapped: no path to a terminal step or another flow`,\n step.name,\n ),\n );\n }\n }\n return issues;\n}\n\nfunction validateFlipTableCoverage(def: FlowDef): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n for (const [purpose, entryStepName] of def.purposes) {\n const flipTargets = PURPOSE_FLIP_TARGETS[purpose];\n if (flipTargets === undefined) continue;\n const entry = def.steps.find((s) => s.name === entryStepName);\n if (entry === undefined) continue;\n for (const [outcome, targetPurpose] of Object.entries(flipTargets)) {\n if (!def.purposes.has(targetPurpose)) continue;\n if (!entry.transitions.has(outcome)) {\n issues.push(\n error(\n \"flip-table\",\n `step ${q(entry.name)}: entry step for purpose ${q(purpose)} must wire ${q(outcome)} transition because ${q(targetPurpose)} is also a purpose: without it, ${FLIP_OUTCOME_IMPACTS[outcome]}`,\n entry.name,\n ),\n );\n }\n }\n }\n return issues;\n}\n\n// ── phase 5: schema-dependent rules ──────────────────────────────────────────\n\nfunction schemaProperties(schema: Record<string, unknown>): Record<string, unknown> | undefined {\n return isPlainObject(schema.properties) ? schema.properties : undefined;\n}\n\nfunction schemaRequired(schema: Record<string, unknown>): string[] {\n return Array.isArray(schema.required) ? schema.required.map(str).filter((n) => n !== \"\") : [];\n}\n\n/**\n * Mirrors `schemaReader.RequiredPaths`: every name in `required`,\n * recursed through the nested `required` of each required object. A\n * required object declaring no `required` of its own ends the descent at\n * the object itself.\n *\n * An optional object contributes its own `required` too once it appears\n * in `materialized`. It only exists in the document because something\n * beneath it was collected, and from that point document validation\n * enforces the rest of its `required` list.\n */\nfunction requiredPaths(\n schema: Record<string, unknown>,\n materialized: ReadonlySet<string>,\n prefix = \"\",\n): string[] {\n const properties = schemaProperties(schema);\n const required = schemaRequired(schema);\n // A set, like the Go `map[string]struct{}`, so a name repeated in\n // `required` yields the path once.\n const out = new Set<string>();\n\n for (const name of required) {\n const path = prefix === \"\" ? name : `${prefix}.${name}`;\n const property =\n properties !== undefined && Object.hasOwn(properties, name) ? properties[name] : undefined;\n if (!isPlainObject(property) || schemaRequired(property).length === 0) {\n out.add(path);\n continue;\n }\n for (const nested of requiredPaths(property, materialized, path)) out.add(nested);\n }\n\n // An optional object is invisible to the loop above, so descend into\n // the ones a collected field materializes.\n for (const [name, property] of Object.entries(properties ?? {})) {\n if (required.includes(name) || !isPlainObject(property)) continue;\n const path = prefix === \"\" ? name : `${prefix}.${name}`;\n if (!materialized.has(path)) continue;\n for (const nested of requiredPaths(property, materialized, path)) out.add(nested);\n }\n\n return [...out];\n}\n\n/** Mirrors `xAuthMethodsReader.IsEnabled` in flow_field_resolver_schema.go. */\nfunction authMethodEnabled(schema: Record<string, unknown>, method: string): boolean {\n if (!isPlainObject(schema[\"x-auth-methods\"])) return false;\n const entry = schema[\"x-auth-methods\"][method];\n return isPlainObject(entry) && entry.enabled === true;\n}\n\n/**\n * Resolve one step field to its challenge, mirroring the subset of\n * `SchemaFieldResolver.Resolve` the validator needs. Returns either the\n * challenge (or null for none) or the Go-verbatim resolution error.\n */\nfunction resolveFieldChallenge(\n field: string,\n properties: Record<string, unknown>,\n schema: Record<string, unknown>,\n): { challenge: FieldChallenge | null } | { message: string } {\n if (field.startsWith(AUTH_METHOD_PREFIX)) {\n const method = field.slice(AUTH_METHOD_PREFIX.length);\n // Mirrors deriveAuthMethodType: only password is field-shaped today.\n if (method !== \"password\") {\n return { message: `unknown field type for ${q(field)}` };\n }\n if (!authMethodEnabled(schema, method)) {\n // Surfaced by resolveAllStepFields' enabled-method cross-check.\n return { message: `${q(method)} is not an enabled authentication method` };\n }\n return { challenge: \"password\" };\n }\n\n // Mirrors walkUserProperty: a nested property is addressed by its\n // dotted path, descending one `properties` level per segment.\n const segments = field.split(\".\");\n let property: unknown;\n let level: Record<string, unknown> | undefined = properties;\n for (const [i, segment] of segments.entries()) {\n // Own properties only: Go indexes a map, where an inherited name like\n // `toString` is simply absent.\n property = level !== undefined && Object.hasOwn(level, segment) ? level[segment] : undefined;\n if (property === undefined) {\n return { message: `flow field: not a property in the user schema: ${q(field)}` };\n }\n const nested = isPlainObject(property) ? schemaProperties(property) : undefined;\n if (i < segments.length - 1 && nested === undefined) {\n return { message: `flow field: not a property in the user schema: ${q(field)}` };\n }\n level = nested;\n }\n\n if (!isPlainObject(property)) {\n return { challenge: null };\n }\n\n // Mirrors schemaReader.JSONType: the nullable idiom `[\"null\", X]`\n // reduces to X; any other multi-entry union is unsupported. Go reduces\n // before it tests for a composite, so the union error wins and the\n // object/array test below reads the reduced type rather than the union.\n let jsonType = property.type;\n if (Array.isArray(jsonType)) {\n const nonNull = jsonType.filter((t) => t !== \"null\");\n if (nonNull.length > 1) {\n return { message: `flow field: unsupported JSON type: [${jsonType.map(str).join(\" \")}]` };\n }\n // Undefined when every entry was \"null\", matching Go's empty-string case.\n jsonType = nonNull[0];\n }\n\n // Mirrors deriveUserPropertyType: an object or array has no\n // field-shaped input. A property carrying `properties` is an object,\n // and one carrying `items` is an array, even when it omits the `type`\n // keyword.\n if (\n jsonType === \"object\" ||\n jsonType === \"array\" ||\n schemaProperties(property) !== undefined ||\n \"items\" in property\n ) {\n return {\n message: `flow field: not a scalar property, name a nested leaf instead: ${q(field)}`,\n };\n }\n\n // Mirrors deriveIdentifierChallenge: the field naming the schema-root\n // `x-identifier` designation is the identifier (ADR 057); other\n // properties — unique or not — carry no identifier challenge.\n const identifier = schema[\"x-identifier\"];\n if (typeof identifier === \"string\" && identifier !== \"\" && field === identifier) {\n return { challenge: \"identifier\" };\n }\n return { challenge: null };\n}\n\nfunction validateAgainstSchema(def: FlowDef, schema: object): FlowValidationIssue[] {\n const issues: FlowValidationIssue[] = [];\n const raw = schema as Record<string, unknown>;\n\n const properties = schemaProperties(raw);\n if (properties === undefined) {\n issues.push(error(\"schema/fields-resolve\", \"user schema has no properties\"));\n return issues;\n }\n\n // Required-fields coverage (validateRequiredUserSchemaFields).\n // Collecting `address.street` covers the leaf and every object above\n // it, since an object materializes once one of its children is\n // collected. The same prefixes are what the schema treats as\n // materialized, so an optional object's own `required` list comes into\n // force here too.\n const covered = new Set<string>();\n for (const step of def.steps) {\n for (const field of step.fields) {\n let path = \"\";\n for (const node of field.split(\".\")) {\n path = path === \"\" ? node : `${path}.${node}`;\n covered.add(path);\n }\n }\n }\n const missing = requiredPaths(raw, covered)\n .filter((field) => !covered.has(field))\n .sort();\n if (missing.length > 0) {\n issues.push(\n error(\n \"schema/required-fields\",\n `required fields [${missing.join(\" \")}] in user schema are missing in the flow definition steps`,\n ),\n );\n }\n\n // Field resolution (resolveAllStepFields), collecting challenges for\n // the manifest and warning rules below.\n const challengesByStep = new Map<string, Set<FieldChallenge>>();\n let resolutionFailed = false;\n for (const step of def.steps) {\n const challenges = new Set<FieldChallenge>();\n for (const field of step.fields) {\n const resolved = resolveFieldChallenge(field, properties, raw);\n if (\"message\" in resolved) {\n issues.push(\n error(\"schema/fields-resolve\", `step ${q(step.name)}: ${resolved.message}`, step.name),\n );\n resolutionFailed = true;\n continue;\n }\n if (resolved.challenge !== null) {\n challenges.add(resolved.challenge);\n }\n }\n challengesByStep.set(step.name, challenges);\n }\n\n // Passkey enablement (validatePasskeyActionsEnabled): passkey is\n // action-shaped, not field-shaped, so the per-field enabled-method\n // check above never sees it.\n if (!authMethodEnabled(raw, \"passkey\")) {\n for (const step of def.steps) {\n for (const action of step.actions) {\n if (action.kind === \"passkey\" || action.kind === \"passkey_register\") {\n issues.push(\n error(\n \"schema/passkey-actions\",\n `step ${q(step.name)}: action ${q(action.name)} offers passkey but \"passkey\" is not an enabled authentication method`,\n step.name,\n ),\n );\n }\n }\n }\n }\n\n if (resolutionFailed) {\n return issues;\n }\n\n // on_success manifests (validateOnSuccessManifests): every kind the\n // mutation needs must be collected on the step or upstream.\n const reverse = reverseAdjacency(def);\n for (const step of def.steps) {\n if (step.onSuccess === undefined) continue;\n const manifest = ON_SUCCESS_MANIFESTS[step.onSuccess];\n if (manifest === undefined) continue;\n const upstream = new Set<string>();\n bfs(step.name, reverse, upstream);\n for (const kind of manifest) {\n const established = [...upstream].some((name) => challengesByStep.get(name)?.has(kind));\n if (!established) {\n issues.push(\n error(\n \"schema/on-success-manifest\",\n `step ${q(step.name)}: on_success ${step.onSuccess} requires ${q(kind)} to be collected upstream`,\n step.name,\n ),\n );\n }\n }\n }\n\n // CLI-only guidance (no Go counterpart): a password collected on the\n // login path with no identifier upstream leaves the engine unable to\n // resolve which user to challenge. Path-sensitive: walk forward from\n // the login entry and stop at any step that collects an identifier\n // (every route through it is covered), so an identifier on a\n // *different* route — e.g. only on the register-purpose chain into a\n // shared step — cannot mask a login route that never collects one.\n const loginEntry = def.purposes.get(\"login\");\n if (loginEntry !== undefined) {\n const adj = localAdjacency(def);\n const identifierFree = new Set<string>();\n const queue = [loginEntry];\n for (let head = 0; head < queue.length; head += 1) {\n const name = queue[head];\n if (name === undefined || identifierFree.has(name)) continue;\n if (challengesByStep.get(name)?.has(\"identifier\")) continue;\n identifierFree.add(name);\n queue.push(...(adj.get(name) ?? []));\n }\n for (const step of def.steps) {\n if (!identifierFree.has(step.name)) continue;\n if (!challengesByStep.get(step.name)?.has(\"password\")) continue;\n issues.push({\n severity: \"warning\",\n rule: \"warn/password-without-identifier\",\n message: `step ${q(step.name)} collects ${AUTH_METHOD_PREFIX}password on the login path but no upstream step collects an identifier field — the engine cannot resolve which user to challenge`,\n step: step.name,\n });\n }\n }\n\n return issues;\n}\n"],"mappings":";;;;;AA8CA,MAAa,wBAAwB;CACnC,cAAc,EAAE,OAAO,eAAe;CACtC,YAAY,EAAE,OAAO,qBAAqB;CAC1C,OAAO,EAAE,OAAO,gBAAgB;CAChC,OAAO,EAAE,OAAO,gBAAgB;CAChC,QAAQ,EAAE,OAAO,iBAAiB;CAClC,cAAc,EAAE,OAAO,4BAA4B;CACnD,0BAA0B,EAAE,OAAO,mCAAmC;CACtE,yBAAyB,EAAE,OAAO,uBAAuB;CACzD,0BAA0B,EAAE,OAAO,gCAAgC;CACnE,8BAA8B,EAAE,OAAO,6BAA6B;CACpE,oCAAoC,EAAE,OAAO,KAAK;AACpD;;AAKA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;AACF;;AAGA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;AASA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AAI;GACvB,MAAM,KAAK,GAAI,IAAI,IAAI,IAAI,KAAK,CAAC,CAAE;EACrC;EACA,KAAK,MAAM,QAAQ,IAAI,OAAO;GAC5B,IAAI,CAAC,eAAe,IAAI,KAAK,IAAI,GAAG;GACpC,IAAI,CAAC,iBAAiB,IAAI,KAAK,IAAI,CAAC,EAAE,IAAI,UAAU,GAAG;GACvD,OAAO,KAAK;IACV,UAAU;IACV,MAAM;IACN,SAAS,QAAQ,EAAE,KAAK,IAAI,EAAE,YAAY,mBAAmB;IAC7D,MAAM,KAAK;GACb,CAAC;EACH;CACF;CAEA,OAAO;AACT"}
@@ -16,7 +16,7 @@
16
16
  "centered",
17
17
  "split"
18
18
  ],
19
- "description": "Degrade preset (`centered` or `split`) the bundled default template\nbranches on, and the fallback when a custom template fails validation.\nNot the complete design catalog: all named designs (`centered`, `split`,\n`split-right`, `hero`, `minimal`) ship as templates and map onto one of\nthese two values; switch designs with\n`zitadel branding eject --design <name>` instead of editing this field.\nEjected templates may ignore it. Selects a template rather than restyling\nthe widget, so it is not an appearance control.\n",
19
+ "description": "Layout preset the revision declares, `centered` or `split`. It is\nvalidated on publish and handed to the template as `branding.layout`.\nThe bundled default template does not read it, so changing it alone\nchanges nothing on screen, and it is not an appearance control.\nNot a design catalog: the ejectable designs (`centered`, `minimal`)\nship as templates and both carry `centered`; switch designs with\n`zitadel branding eject --design <name>` instead of editing this field.\n`split` is carried by revisions published from the earlier split\ndesigns.\n",
20
20
  "default": "centered"
21
21
  },
22
22
  "liquid_template": {
@@ -43,7 +43,7 @@
43
43
  "type": "string",
44
44
  "format": "uri",
45
45
  "maxLength": 2048,
46
- "description": "Hero/background image URL, used by the split layout.",
46
+ "description": "Hero image URL, for templates that reference `branding.hero_url`. The\nbundled default template does not use it.\n",
47
47
  "pattern": "^([hH][tT][tT][pP][sS]://(?:\\[[0-9A-Fa-f:.]+\\]|[^/:?#@]+)(?::0*(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?(?:[/?#]|$)|[hH][tT][tT][pP]://([lL][oO][cC][aA][lL][hH][oO][sS][tT]|127\\.(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.){2}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])|\\[::1\\])(?::0*(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?([/?#]|$))"
48
48
  },
49
49
  "theme": {
@@ -74,7 +74,7 @@
74
74
  "BrandingTheme": {
75
75
  "type": "object",
76
76
  "additionalProperties": false,
77
- "description": "The theme sides this project publishes, and which of them may run.\n\nPublishing one side makes it the only theme that resolves, even under `auto`\nor an operating-system preference for the other. Publishing both lets `auto`\nfollow the operating system, each side using its own logo and palette.\n\nThe element-level `theme` property overrides `mode`, but cannot select a\nside the project never published.\n",
77
+ "description": "The theme sides this project publishes, and which of them may run.\n\nPublishing one side makes it the only theme that resolves, even under `auto`\nor an operating-system preference for the other. Publishing both lets `auto`\nfollow the operating system, each side using its own logo and palette.\n\nThe element-level `theme` property overrides `mode`. When one side is\npublished it cannot select the other. Publishing neither side leaves\n`mode`, the `theme` property and the operating system to pick one, painted\nwith the maintained defaults.\n",
78
78
  "properties": {
79
79
  "mode": {
80
80
  "type": "string",
@@ -99,7 +99,7 @@
99
99
  "BrandingThemeSide": {
100
100
  "type": "object",
101
101
  "additionalProperties": false,
102
- "description": "One complete theme side. Light and dark are independent surfaces — neither\ninherits from the other, and a side that is absent is never used, whatever\n`mode` or the operating system asks for.\n",
102
+ "description": "One complete theme side. Light and dark are independent surfaces — neither\ninherits from the other. When a revision publishes one side, the absent\nside is never used, whatever `mode` or the operating system asks for. When\nit publishes neither, either side can resolve and paints the maintained\ndefaults.\n",
103
103
  "properties": {
104
104
  "logo_url": {
105
105
  "type": "string",
@@ -214,7 +214,7 @@
214
214
  "type": "string",
215
215
  "format": "uri",
216
216
  "maxLength": 2048,
217
- "description": "Stylesheet that loads `font_family` — a Google Fonts CSS URL, for\nexample. Must be https; unlike the logo and hero assets there is no\nloopback carve-out. Rejected without `font_family`, which would name\nnothing to paint with.\n\nStored but not applied to an embedded widget: the embedding page loads\nthe face, and Zitadel does not inject a stylesheet into a document it\ndoes not own.\n",
217
+ "description": "Stylesheet that loads `font_family` — a Google Fonts CSS URL, for\nexample. Must be https; unlike the logo and hero assets there is no\nloopback carve-out. Rejected without `font_family`, which would name\nnothing to paint with.\n\nLoaded only when the login component runs as `variant=\"page\"`, the\nfull-page login. In the default `variant=\"widget\"` it is stored but not\nloaded: the component injects no stylesheet, and the embedding page\nloads the face.\n",
218
218
  "pattern": "^[hH][tT][tT][pP][sS]://(?:\\[[0-9A-Fa-f:.]+\\]|[^/:?#@]+)(?::0*(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?(?:[/?#]|$)",
219
219
  "examples": [
220
220
  "https://fonts.googleapis.com/css2?family=Inter&display=swap"
@@ -199,7 +199,7 @@
199
199
  "transitions": {
200
200
  "not": {
201
201
  "required": [
202
- "callback"
202
+ "sso_authenticated"
203
203
  ]
204
204
  }
205
205
  }
@@ -286,11 +286,84 @@
286
286
  "transitions": {
287
287
  "not": {
288
288
  "required": [
289
- "callback"
289
+ "sso_authenticated"
290
290
  ]
291
291
  }
292
292
  }
293
293
  }
294
+ },
295
+ {
296
+ "required": [
297
+ "transitions"
298
+ ],
299
+ "properties": {
300
+ "transitions": {
301
+ "anyOf": [
302
+ {
303
+ "required": [
304
+ "sso_authenticated"
305
+ ],
306
+ "properties": {
307
+ "sso_authenticated": {
308
+ "anyOf": [
309
+ {
310
+ "required": [
311
+ "purpose"
312
+ ],
313
+ "properties": {
314
+ "purpose": {
315
+ "type": "string"
316
+ }
317
+ }
318
+ },
319
+ {
320
+ "required": [
321
+ "action"
322
+ ],
323
+ "properties": {
324
+ "action": {
325
+ "type": "string"
326
+ }
327
+ }
328
+ }
329
+ ]
330
+ }
331
+ }
332
+ },
333
+ {
334
+ "required": [
335
+ "sso_user_not_found"
336
+ ],
337
+ "properties": {
338
+ "sso_user_not_found": {
339
+ "anyOf": [
340
+ {
341
+ "required": [
342
+ "purpose"
343
+ ],
344
+ "properties": {
345
+ "purpose": {
346
+ "type": "string"
347
+ }
348
+ }
349
+ },
350
+ {
351
+ "required": [
352
+ "action"
353
+ ],
354
+ "properties": {
355
+ "action": {
356
+ "type": "string"
357
+ }
358
+ }
359
+ }
360
+ ]
361
+ }
362
+ }
363
+ }
364
+ ]
365
+ }
366
+ }
294
367
  }
295
368
  ]
296
369
  },
@@ -358,8 +431,9 @@
358
431
  },
359
432
  "sso_providers": {
360
433
  "type": "array",
361
- "description": "Slugs of the identity provider connections this step offers, in display\norder. Each names the `slug` of a connection under `.zitadel/idps/`; the\nconnection carries the display name and template, so a rename there\nreaches every step without editing the flow. The rendered step the client\nreceives carries the resolved `{id, name, template}` objects instead.\n",
434
+ "description": "Slugs of the identity provider connections this step offers, in display\norder. Each names the `slug` of a connection under `.zitadel/idps/`; the\nconnection carries the display name and template, so a rename there\nreaches every step without editing the flow. The rendered step the client\nreceives carries the resolved `{id, name, template}` objects instead. A\nstep offers at most 20 providers.\n",
362
435
  "uniqueItems": true,
436
+ "maxItems": 20,
363
437
  "items": {
364
438
  "type": "string",
365
439
  "pattern": "^[a-z0-9][a-z0-9_-]*$",
@@ -375,9 +449,10 @@
375
449
  "on_success": {
376
450
  "type": "string",
377
451
  "enum": [
378
- "create_user"
452
+ "create_user",
453
+ "create_user_with_sso"
379
454
  ],
380
- "description": "Server-side mutation to execute when this step completes successfully.\nRuns after field validation passes, before the transition fires.\n\n- create_user: creates the user record (registration flows)\n",
455
+ "description": "Server-side mutation to execute when this step completes successfully.\nRuns after field validation passes, before the transition fires.\n\n- create_user: creates the user record (registration flows)\n- create_user_with_sso: creates the user record from the identity an\n external provider returned, linking it to that identity. Accepted by\n the API so an SSO flow can be authored and stored; the engine handler\n is not wired yet, and a step reaching it fails with a flow integrity\n error rather than creating anything.\n",
381
456
  "examples": [
382
457
  "create_user"
383
458
  ]
@@ -395,7 +470,7 @@
395
470
  },
396
471
  "transitions": {
397
472
  "type": "object",
398
- "description": "Maps action/outcome names to their transition descriptor.\n\nKeys match action names from the `actions` array. Additional keys\ncome from implicit outcomes based on schema annotations\n(e.g. `user_not_found` from `x-unique` fields) and engine\nevents (e.g. `sso`, `callback`).\n",
473
+ "description": "Maps action/outcome names to their transition descriptor.\n\nKeys match action names from the `actions` array. Additional keys\ncome from implicit outcomes based on schema annotations\n(e.g. `user_not_found` from `x-unique` fields) and engine\nevents (e.g. `sso_authenticated`, `sso_user_not_found`).\n",
399
474
  "additionalProperties": {
400
475
  "type": "object",
401
476
  "required": [
@@ -109,7 +109,7 @@
109
109
  "oidc": {
110
110
  "type": "object",
111
111
  "additionalProperties": false,
112
- "description": "OIDC connection details. Endpoints come from discovery, but any may be supplied to override it, or to serve a provider that exposes no .well-known document.",
112
+ "description": "OIDC connection details. Endpoints come from the issuer's discovery document. A provider that exposes no .well-known document names them all instead: authorization_endpoint, token_endpoint, jwks_uri, and userinfo_endpoint unless id_token_mapping is set. Setting some but not all is rejected.",
113
113
  "required": [
114
114
  "issuer",
115
115
  "client_id",
@@ -121,13 +121,13 @@
121
121
  "type": "string",
122
122
  "format": "uri",
123
123
  "pattern": "^(https://[^\\s/?#]+|http://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?)(/[^\\s?#]*)?$",
124
- "description": "Discovery base. Endpoints are resolved from its .well-known document unless overridden below."
124
+ "description": "Discovery base. Endpoints are resolved from its .well-known document unless the connection names them all."
125
125
  },
126
126
  "jwks_uri": {
127
127
  "type": "string",
128
128
  "format": "uri",
129
129
  "pattern": "^(https://[^\\s/?#]+|http://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?)([/?][^\\s#]*)?$",
130
- "description": "Overrides the JWKS endpoint from discovery. Required in practice when the provider exposes no .well-known document, since ID tokens cannot otherwise be validated."
130
+ "description": "JWKS endpoint, for a provider that exposes no .well-known document. Set together with the other endpoints."
131
131
  },
132
132
  "id_token_mapping": {
133
133
  "type": "boolean",
@@ -138,19 +138,19 @@
138
138
  "type": "string",
139
139
  "format": "uri",
140
140
  "pattern": "^(https://[^\\s/?#]+|http://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?)([/?][^\\s#]*)?$",
141
- "description": "Overrides discovery."
141
+ "description": "For a provider that exposes no .well-known document. Set together with the other endpoints."
142
142
  },
143
143
  "token_endpoint": {
144
144
  "type": "string",
145
145
  "format": "uri",
146
146
  "pattern": "^(https://[^\\s/?#]+|http://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?)([/?][^\\s#]*)?$",
147
- "description": "Overrides discovery."
147
+ "description": "For a provider that exposes no .well-known document. Set together with the other endpoints."
148
148
  },
149
149
  "userinfo_endpoint": {
150
150
  "type": "string",
151
151
  "format": "uri",
152
152
  "pattern": "^(https://[^\\s/?#]+|http://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?)([/?][^\\s#]*)?$",
153
- "description": "Overrides discovery."
153
+ "description": "For a provider that exposes no .well-known document. Set together with the other endpoints; not needed when id_token_mapping is set."
154
154
  },
155
155
  "client_id": {
156
156
  "type": "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zitadel/config",
3
- "version": "1.0.0-alpha.23",
3
+ "version": "1.0.0-alpha.25",
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": {
@@ -33,6 +33,11 @@
33
33
  "types": "./dist/defaults.d.mts",
34
34
  "import": "./dist/defaults.mjs"
35
35
  },
36
+ "./idp": {
37
+ "@zitadel/source": "./src/idp/index.ts",
38
+ "types": "./dist/idp/index.d.mts",
39
+ "import": "./dist/idp/index.mjs"
40
+ },
36
41
  "./schemas": {
37
42
  "@zitadel/source": "./src/schemas.ts",
38
43
  "types": "./dist/schemas.d.mts",
@@ -84,20 +89,25 @@
84
89
  "culori": "^4.0.2",
85
90
  "liquidjs": "^10.27.2",
86
91
  "zod": "^4.3.6",
87
- "@zitadel/api": "1.0.0-alpha.23"
92
+ "@zitadel/api": "1.0.0-alpha.25"
88
93
  },
89
94
  "devDependencies": {
90
95
  "@types/culori": "^4.0.1",
96
+ "@types/node": "^25.6.0",
91
97
  "ajv": "^8.20.0",
92
- "tsdown": "^0.21.10",
98
+ "tsdown": "^0.23.0",
93
99
  "tslib": "^2.8.1",
94
- "vitest": "^4.1.9"
100
+ "typescript": "^6.0.3",
101
+ "vitest": "^4.1.11"
95
102
  },
96
103
  "scripts": {
97
104
  "sync-schemas": "node scripts/sync-meta-schemas.mjs",
98
- "build": "node scripts/sync-meta-schemas.mjs && tsdown",
99
- "typecheck": "node scripts/sync-meta-schemas.mjs && tsc --build tsconfig.json",
100
- "test": "node scripts/sync-meta-schemas.mjs && vitest run --passWithNoTests",
101
- "lint": "oxlint ."
105
+ "prebuild": "pnpm run sync-schemas",
106
+ "build": "tsdown",
107
+ "pretypecheck": "pnpm run sync-schemas",
108
+ "typecheck": "tsc --noEmit -p tsconfig.lib.json && tsc --noEmit -p tsconfig.spec.json",
109
+ "pretest": "pnpm run sync-schemas",
110
+ "test": "vitest run",
111
+ "test:all": "pnpm run test"
102
112
  }
103
113
  }