@zitadel/api 0.1.0-alpha.11 → 0.1.0-alpha.13

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 (90) hide show
  1. package/dist/generated/endpoints/zitadelNextGen.d.mts +2 -2
  2. package/dist/generated/endpoints/zitadelNextGen.mjs +55 -5
  3. package/dist/generated/endpoints/zitadelNextGen.mjs.map +1 -1
  4. package/dist/generated/endpoints/zitadelNextGen.msw.d.mts +5 -3
  5. package/dist/generated/endpoints/zitadelNextGen.msw.d.mts.map +1 -1
  6. package/dist/generated/endpoints/zitadelNextGen.msw.mjs +65 -21
  7. package/dist/generated/endpoints/zitadelNextGen.msw.mjs.map +1 -1
  8. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts +151 -51
  9. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts.map +1 -1
  10. package/dist/generated/endpoints/zitadelNextGen.zod.mjs +127 -52
  11. package/dist/generated/endpoints/zitadelNextGen.zod.mjs.map +1 -1
  12. package/dist/generated/model/index.d.mts +2 -2
  13. package/dist/generated/model/index.mjs +140 -11
  14. package/dist/generated/model/index.mjs.map +1 -1
  15. package/dist/{index-BGnjxx-b.d.mts → index-DLJ0vloQ.d.mts} +819 -77
  16. package/dist/index-DLJ0vloQ.d.mts.map +1 -0
  17. package/dist/runtime/api-factory.d.mts +1 -1
  18. package/dist/{zitadelNextGen-D1t6bmpx.d.mts → zitadelNextGen-CVTkhQJe.d.mts} +29 -7
  19. package/dist/zitadelNextGen-CVTkhQJe.d.mts.map +1 -0
  20. package/package.json +1 -1
  21. package/src/generated/endpoints/zitadelNextGen.msw.ts +92 -10
  22. package/src/generated/endpoints/zitadelNextGen.ts +81 -4
  23. package/src/generated/endpoints/zitadelNextGen.zod.ts +456 -325
  24. package/src/generated/model/activateFlowDefinition400.ts +20 -0
  25. package/src/generated/model/activateFlowDefinition400Details.ts +12 -0
  26. package/src/generated/model/activateFlowDefinitionDefault.ts +20 -0
  27. package/src/generated/model/activateFlowDefinitionDefaultDetails.ts +12 -0
  28. package/src/generated/model/activateFlowDefinitionParams.ts +15 -0
  29. package/src/generated/model/createFlow201StepActionsItem.ts +15 -1
  30. package/src/generated/model/createFlow201StepActionsItemKind.ts +31 -0
  31. package/src/generated/model/createFlow201StepChallengeMethod.ts +1 -0
  32. package/src/generated/model/createFlowBody.ts +5 -0
  33. package/src/generated/model/createFlowDefinition201.ts +0 -2
  34. package/src/generated/model/createFlowDefinition201FlowDefinition.ts +11 -0
  35. package/src/generated/model/createFlowDefinition201FlowDefinitionStatus.ts +26 -0
  36. package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemActionsItem.ts +15 -1
  37. package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemActionsItemKind.ts +31 -0
  38. package/src/generated/model/createFlowDefinitionBody.ts +6 -0
  39. package/src/generated/model/createFlowDefinitionBodyFlowDefinition.ts +11 -0
  40. package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStatus.ts +26 -0
  41. package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemActionsItem.ts +15 -1
  42. package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemActionsItemKind.ts +31 -0
  43. package/src/generated/model/deactivateFlowDefinition400.ts +20 -0
  44. package/src/generated/model/deactivateFlowDefinition400Details.ts +12 -0
  45. package/src/generated/model/deactivateFlowDefinition409.ts +20 -0
  46. package/src/generated/model/deactivateFlowDefinition409Details.ts +12 -0
  47. package/src/generated/model/deactivateFlowDefinitionDefault.ts +20 -0
  48. package/src/generated/model/deactivateFlowDefinitionDefaultDetails.ts +12 -0
  49. package/src/generated/model/deactivateFlowDefinitionParams.ts +15 -0
  50. package/src/generated/model/deleteFlowDefinition409.ts +20 -0
  51. package/src/generated/model/deleteFlowDefinition409Details.ts +12 -0
  52. package/src/generated/model/getFlowDefinition200.ts +0 -2
  53. package/src/generated/model/getFlowDefinition200FlowDefinition.ts +11 -0
  54. package/src/generated/model/getFlowDefinition200FlowDefinitionStatus.ts +26 -0
  55. package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemActionsItem.ts +15 -1
  56. package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemActionsItemKind.ts +31 -0
  57. package/src/generated/model/getFlowStep200StepActionsItem.ts +15 -1
  58. package/src/generated/model/getFlowStep200StepActionsItemKind.ts +31 -0
  59. package/src/generated/model/getFlowStep200StepChallengeMethod.ts +1 -0
  60. package/src/generated/model/index.ts +40 -10
  61. package/src/generated/model/listFlowDefinitions200FlowDefinitionsItem.ts +11 -2
  62. package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemStatus.ts +26 -0
  63. package/src/generated/model/submitFlowStep200StepActionsItem.ts +15 -1
  64. package/src/generated/model/submitFlowStep200StepActionsItemKind.ts +31 -0
  65. package/src/generated/model/submitFlowStep200StepChallengeMethod.ts +1 -0
  66. package/src/generated/model/submitFlowStep400StepActionsItem.ts +15 -1
  67. package/src/generated/model/submitFlowStep400StepActionsItemKind.ts +31 -0
  68. package/src/generated/model/submitFlowStep400StepChallengeMethod.ts +1 -0
  69. package/src/generated/model/updateFlowDefinition200.ts +0 -2
  70. package/src/generated/model/updateFlowDefinition200FlowDefinition.ts +11 -0
  71. package/src/generated/model/updateFlowDefinition200FlowDefinitionStatus.ts +26 -0
  72. package/src/generated/model/updateFlowDefinition200FlowDefinitionStepsItemActionsItem.ts +15 -1
  73. package/src/generated/model/updateFlowDefinition200FlowDefinitionStepsItemActionsItemKind.ts +31 -0
  74. package/src/generated/model/updateFlowDefinitionBody.ts +15 -30
  75. package/src/generated/model/updateFlowDefinitionBodyFlowDefinition.ts +69 -0
  76. package/src/generated/model/{updateFlowDefinitionBodyAudience.ts → updateFlowDefinitionBodyFlowDefinitionAudience.ts} +1 -1
  77. package/src/generated/model/updateFlowDefinitionBodyFlowDefinitionStatus.ts +26 -0
  78. package/src/generated/model/{updateFlowDefinitionBodyStepsItem.ts → updateFlowDefinitionBodyFlowDefinitionStepsItem.ts} +13 -13
  79. package/src/generated/model/updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItem.ts +42 -0
  80. package/src/generated/model/updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItemKind.ts +31 -0
  81. package/src/generated/model/{updateFlowDefinitionBodyStepsItemComplete.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemComplete.ts} +3 -3
  82. package/src/generated/model/{updateFlowDefinitionBodyStepsItemGates.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemGates.ts} +5 -5
  83. package/src/generated/model/{updateFlowDefinitionBodyStepsItemGatesConfig.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemGatesConfig.ts} +1 -1
  84. package/src/generated/model/{updateFlowDefinitionBodyStepsItemGatesKind.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemGatesKind.ts} +3 -3
  85. package/src/generated/model/{updateFlowDefinitionBodyStepsItemOnSuccess.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemOnSuccess.ts} +3 -3
  86. package/src/generated/model/{updateFlowDefinitionBodyStepsItemSsoProvidersItem.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersItem.ts} +1 -1
  87. package/src/generated/model/{updateFlowDefinitionBodyStepsItemTransitions.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemTransitions.ts} +1 -1
  88. package/dist/index-BGnjxx-b.d.mts.map +0 -1
  89. package/dist/zitadelNextGen-D1t6bmpx.d.mts.map +0 -1
  90. package/src/generated/model/updateFlowDefinitionBodyStepsItemActionsItem.ts +0 -28
@@ -637,6 +637,7 @@ cookie. The browser sends it automatically on subsequent requests.
637
637
  */
638
638
  export const createFlowBodyProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
639
639
  export const createFlowBodyFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
640
+ export const createFlowBodyDryRunDefault = false;
640
641
  export const createFlowBodySchemaVersionRegExp = new RegExp("^\\d+\\.\\d+\\.\\d+$");
641
642
 
642
643
  export const CreateFlowBody = zod.object({
@@ -649,6 +650,12 @@ export const CreateFlowBody = zod.object({
649
650
  .describe(
650
651
  "Name of a specific flow definition to use.\nWhen omitted, the engine selects the best-matching definition\nbased on purpose + audience context.\n",
651
652
  ),
653
+ dry_run: zod
654
+ .boolean()
655
+ .default(createFlowBodyDryRunDefault)
656
+ .describe(
657
+ "Set to true to simulate the flow without actually creating any\nuser or session. Useful for testing and validation of flow definitions.\nThis requires setting the `flow_definition_name` property as well.\n",
658
+ ),
652
659
  schema_version: zod
653
660
  .string()
654
661
  .regex(createFlowBodySchemaVersionRegExp)
@@ -835,6 +842,11 @@ export const GetFlowStepResponse = zod.object({
835
842
  name: zod
836
843
  .string()
837
844
  .describe("Action identifier. Sent back in the submit request as `action`."),
845
+ kind: zod
846
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
847
+ .describe(
848
+ "Classifies how the engine handles this action:\n- `submit`: collect the step's fields and run validate\/dispatch\/on_success.\n- `passkey`: issue a WebAuthn assertion challenge; the matching transition\n fires once the returned assertion verifies.\n- `passkey_register`: issue a WebAuthn registration challenge; the matching\n transition fires once the returned attestation verifies.\n- `navigate`: route through the transition without running the input\n pipeline. Used for pure-routing actions declared in the flow definition.\n- `back`: return the user to the previous step. Surfaced by the engine\n when going back is available.\n",
849
+ ),
838
850
  primary: zod
839
851
  .boolean()
840
852
  .default(getFlowStepResponseStepActionsItemPrimaryDefault)
@@ -849,7 +861,7 @@ export const GetFlowStepResponse = zod.object({
849
861
  ),
850
862
  })
851
863
  .describe(
852
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
864
+ "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`; the engine resolves the action's\ndeclared `kind` to decide how to handle the submission.\n",
853
865
  ),
854
866
  )
855
867
  .default(getFlowStepResponseStepActionsDefault)
@@ -901,7 +913,7 @@ export const GetFlowStepResponse = zod.object({
901
913
  challenge: zod
902
914
  .object({
903
915
  method: zod
904
- .enum(["passkey"])
916
+ .enum(["passkey", "passkey_register"])
905
917
  .optional()
906
918
  .describe("Challenge method. Determines which component handles the ceremony."),
907
919
  challenge_id: zod
@@ -1196,6 +1208,11 @@ export const SubmitFlowStepResponse = zod.object({
1196
1208
  name: zod
1197
1209
  .string()
1198
1210
  .describe("Action identifier. Sent back in the submit request as `action`."),
1211
+ kind: zod
1212
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
1213
+ .describe(
1214
+ "Classifies how the engine handles this action:\n- `submit`: collect the step's fields and run validate\/dispatch\/on_success.\n- `passkey`: issue a WebAuthn assertion challenge; the matching transition\n fires once the returned assertion verifies.\n- `passkey_register`: issue a WebAuthn registration challenge; the matching\n transition fires once the returned attestation verifies.\n- `navigate`: route through the transition without running the input\n pipeline. Used for pure-routing actions declared in the flow definition.\n- `back`: return the user to the previous step. Surfaced by the engine\n when going back is available.\n",
1215
+ ),
1199
1216
  primary: zod
1200
1217
  .boolean()
1201
1218
  .default(submitFlowStepResponseStepActionsItemPrimaryDefault)
@@ -1210,7 +1227,7 @@ export const SubmitFlowStepResponse = zod.object({
1210
1227
  ),
1211
1228
  })
1212
1229
  .describe(
1213
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
1230
+ "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`; the engine resolves the action's\ndeclared `kind` to decide how to handle the submission.\n",
1214
1231
  ),
1215
1232
  )
1216
1233
  .default(submitFlowStepResponseStepActionsDefault)
@@ -1262,7 +1279,7 @@ export const SubmitFlowStepResponse = zod.object({
1262
1279
  challenge: zod
1263
1280
  .object({
1264
1281
  method: zod
1265
- .enum(["passkey"])
1282
+ .enum(["passkey", "passkey_register"])
1266
1283
  .optional()
1267
1284
  .describe("Challenge method. Determines which component handles the ceremony."),
1268
1285
  challenge_id: zod
@@ -3010,7 +3027,7 @@ export const GetSchemaByIdResponse = zod
3010
3027
  Flow definitions are templates that define the sequence of steps (capabilities)
3011
3028
  for a particular user journey (e.g., registration, login, password reset).
3012
3029
 
3013
- Flow definitions are created based on the flow meta schema, which includes the flow's purpose, audience, and the steps involved.
3030
+ Flow definitions are created based on the flow definition schema, which includes the flow's purpose, audience, and the steps involved.
3014
3031
 
3015
3032
  * @summary Create a new flow definition
3016
3033
  */
@@ -3022,187 +3039,201 @@ export const createFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault = [];
3022
3039
  export const createFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault = {} as const;
3023
3040
  export const createFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault = [];
3024
3041
 
3025
- export const CreateFlowDefinitionBody = zod.object({
3026
- project_id: zod.string().regex(createFlowDefinitionBodyProjectIdRegExp),
3027
- schema_uri: zod
3028
- .url()
3029
- .optional()
3030
- .describe(
3031
- "URI of the server-published flow definition schema this definition was\nauthored against. The server uses this to validate the definition.\nIf not provided, the engine will use the latest schema version for validation.\n",
3032
- ),
3033
- flow_definition: zod
3034
- .object({
3035
- name: zod
3036
- .string()
3037
- .regex(createFlowDefinitionBodyFlowDefinitionNameRegExp)
3038
- .describe(
3039
- "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Renaming is not supported — the\n`name` is part of the public contract another definition may\nreference. Acts as the human display label as well; no separate slug.\n",
3040
- ),
3041
- user_schema: zod
3042
- .url()
3043
- .describe(
3044
- "User schema this flow operates on. Step `fields` reference properties\ndefined in this schema. The engine resolves field types, validation,\nand implicit outcomes from schema annotations at runtime.\n",
3045
- ),
3046
- purposes: zod
3047
- .record(zod.string(), zod.string())
3048
- .describe(
3049
- "Maps each purpose this definition handles to its entry-point step.\nKeys are purpose names; values must match a `name` in `steps`. A\ndefinition can serve multiple purposes (e.g. a combined login\/register\nflow) by listing one entry per purpose.\n",
3050
- ),
3051
- audience: zod
3052
- .object({
3053
- team_ids: zod
3054
- .array(zod.string())
3055
- .optional()
3056
- .describe(
3057
- "Restrict to specific teams (organizations). Empty means no team restriction.",
3058
- ),
3059
- app_ids: zod
3060
- .array(zod.string())
3061
- .optional()
3062
- .describe("Restrict to specific applications. Empty means no app restriction."),
3063
- })
3064
- .optional()
3065
- .describe(
3066
- 'Scopes which teams or apps this flow definition applies to. Empty or\nomitted fields mean \"no restriction\"; when both are empty the definition\nmatches every request in the project. The engine picks the most specific\nmatching definition: app > team > project-wide.\n',
3067
- ),
3068
- steps: zod
3069
- .array(
3070
- zod
3071
- .object({
3072
- name: zod
3073
- .string()
3074
- .describe(
3075
- "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3076
- ),
3077
- fields: zod
3078
- .array(zod.string())
3079
- .default(createFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault)
3080
- .describe(
3081
- "Schema property names to collect from the user. Each entry references\na property in the flow's user schema. The engine resolves field type,\nvalidation rules, and implicit outcomes from schema annotations\n(e.g. a property with `x-unique` set implies a `user_not_found`\ntransition outcome).\n",
3082
- ),
3083
- actions: zod
3084
- .array(
3085
- zod
3086
- .object({
3087
- name: zod
3088
- .string()
3089
- .describe(
3090
- "Action identifier. Sent back in the submit request as `action`.",
3091
- ),
3092
- primary: zod
3093
- .boolean()
3094
- .default(
3095
- createFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault,
3096
- )
3097
- .describe(
3098
- "Marks this as the default\/primary action. The runtime template uses\nthis hint to choose visual emphasis. At most one action per step\nshould be primary; this is not enforced here.\n",
3099
- ),
3100
- text_key: zod
3101
- .string()
3102
- .optional()
3103
- .describe(
3104
- "Optional localization key override for the action's label. When\nomitted, the engine derives a key from the step and action names.\nDisplay text is resolved client-side from a locale dictionary, never\nby the engine.\n",
3105
- ),
3106
- })
3107
- .describe(
3108
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3109
- ),
3110
- )
3111
- .default(createFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault)
3112
- .describe(
3113
- "Ordered list of actions the user can take. The action name is what the\nfrontend sends back in the submit request. If omitted, the engine\nprovides a default `submit` action.\n",
3114
- ),
3115
- gates: zod
3116
- .record(
3117
- zod.string(),
3118
- zod
3119
- .object({
3120
- kind: zod
3121
- .enum(["captcha"])
3122
- .describe(
3123
- "The gate category. Only `captcha` is currently defined. Authenticator\nceremonies (e.g. passkey) are modelled as credential auth_attempts via\n`x-credential` on a field, not as gates.\n",
3124
- ),
3125
- provider: zod
3042
+ export const CreateFlowDefinitionBody = zod
3043
+ .object({
3044
+ project_id: zod.string().regex(createFlowDefinitionBodyProjectIdRegExp),
3045
+ schema_uri: zod
3046
+ .url()
3047
+ .optional()
3048
+ .describe(
3049
+ "URI of the server-published flow definition schema this definition was\nauthored against. The server uses this to validate the definition.\nIf not provided, the engine will use the latest schema version for validation.\n",
3050
+ ),
3051
+ flow_definition: zod
3052
+ .object({
3053
+ name: zod
3054
+ .string()
3055
+ .regex(createFlowDefinitionBodyFlowDefinitionNameRegExp)
3056
+ .describe(
3057
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Renaming is not supported — the\n`name` is part of the public contract another definition may\nreference. Acts as the human display label as well; no separate slug.\n",
3058
+ ),
3059
+ status: zod
3060
+ .enum(["active", "draft"])
3061
+ .describe(
3062
+ "The lifecycle state of this flow definition. \n\nactive: The flow definition is ready to be used. The flow engine can select it for new flows.\ndraft: The engine will not select it for new flows, and existing flows must handle it gracefully if they reference this definition.\n\nAllowed transitions:\n- draft -> active: To activate the flow definition.\n- active -> draft: To remove the flow definition from active use immediately.\n",
3063
+ ),
3064
+ user_schema: zod
3065
+ .url()
3066
+ .describe(
3067
+ "User schema this flow operates on. Step `fields` reference properties\ndefined in this schema. The engine resolves field types, validation,\nand implicit outcomes from schema annotations at runtime.\n",
3068
+ ),
3069
+ purposes: zod
3070
+ .record(zod.string(), zod.string())
3071
+ .describe(
3072
+ "Maps each purpose this definition handles to its entry-point step.\nKeys are purpose names; values must match a `name` in `steps`. A\ndefinition can serve multiple purposes (e.g. a combined login\/register\nflow) by listing one entry per purpose.\n",
3073
+ ),
3074
+ audience: zod
3075
+ .object({
3076
+ team_ids: zod
3077
+ .array(zod.string())
3078
+ .optional()
3079
+ .describe(
3080
+ "Restrict to specific teams (organizations). Empty means no team restriction.",
3081
+ ),
3082
+ app_ids: zod
3083
+ .array(zod.string())
3084
+ .optional()
3085
+ .describe("Restrict to specific applications. Empty means no app restriction."),
3086
+ })
3087
+ .optional()
3088
+ .describe(
3089
+ 'Scopes which teams or apps this flow definition applies to. Empty or\nomitted fields mean \"no restriction\"; when both are empty the definition\nmatches every request in the project. The engine picks the most specific\nmatching definition: app > team > project-wide.\n',
3090
+ ),
3091
+ steps: zod
3092
+ .array(
3093
+ zod
3094
+ .object({
3095
+ name: zod
3096
+ .string()
3097
+ .describe(
3098
+ "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3099
+ ),
3100
+ fields: zod
3101
+ .array(zod.string())
3102
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault)
3103
+ .describe(
3104
+ "Schema property names to collect from the user. Each entry references\na property in the flow's user schema. The engine resolves field type,\nvalidation rules, and implicit outcomes from schema annotations\n(e.g. a property with `x-unique` set implies a `user_not_found`\ntransition outcome).\n",
3105
+ ),
3106
+ actions: zod
3107
+ .array(
3108
+ zod
3109
+ .object({
3110
+ name: zod
3111
+ .string()
3112
+ .describe(
3113
+ "Action identifier. Sent back in the submit request as `action`.",
3114
+ ),
3115
+ kind: zod
3116
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3117
+ .describe(
3118
+ "Classifies how the engine handles this action:\n- `submit`: collect the step's fields and run validate\/dispatch\/on_success.\n- `passkey`: issue a WebAuthn assertion challenge; the matching transition\n fires once the returned assertion verifies.\n- `passkey_register`: issue a WebAuthn registration challenge; the matching\n transition fires once the returned attestation verifies.\n- `navigate`: route through the transition without running the input\n pipeline. Used for pure-routing actions declared in the flow definition.\n- `back`: return the user to the previous step. Surfaced by the engine\n when going back is available.\n",
3119
+ ),
3120
+ primary: zod
3121
+ .boolean()
3122
+ .default(
3123
+ createFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault,
3124
+ )
3125
+ .describe(
3126
+ "Marks this as the default\/primary action. The runtime template uses\nthis hint to choose visual emphasis. At most one action per step\nshould be primary; this is not enforced here.\n",
3127
+ ),
3128
+ text_key: zod
3129
+ .string()
3130
+ .optional()
3131
+ .describe(
3132
+ "Optional localization key override for the action's label. When\nomitted, the engine derives a key from the step and action names.\nDisplay text is resolved client-side from a locale dictionary, never\nby the engine.\n",
3133
+ ),
3134
+ })
3135
+ .describe(
3136
+ "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`; the engine resolves the action's\ndeclared `kind` to decide how to handle the submission.\n",
3137
+ ),
3138
+ )
3139
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault)
3140
+ .describe(
3141
+ "Ordered list of actions the user can take. The action name is what the\nfrontend sends back in the submit request. If omitted, the engine\nprovides a default `submit` action.\n",
3142
+ ),
3143
+ gates: zod
3144
+ .record(
3145
+ zod.string(),
3146
+ zod
3147
+ .object({
3148
+ kind: zod
3149
+ .enum(["captcha"])
3150
+ .describe(
3151
+ "The gate category. Only `captcha` is currently defined. Authenticator\nceremonies (e.g. passkey) are modelled as credential auth_attempts via\n`x-credential` on a field, not as gates.\n",
3152
+ ),
3153
+ provider: zod
3154
+ .string()
3155
+ .describe(
3156
+ "Provider identifier within the gate kind — e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
3157
+ ),
3158
+ config: zod
3159
+ .record(zod.string(), zod.unknown())
3160
+ .optional()
3161
+ .describe(
3162
+ "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3163
+ ),
3164
+ })
3165
+ .describe(
3166
+ "A security challenge that must be satisfied before this step's submission\nis accepted. The engine may also inject gates at runtime based on policy\nor risk evaluation.\n",
3167
+ ),
3168
+ )
3169
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault)
3170
+ .describe(
3171
+ 'Security gates that must be satisfied before submission. Keyed by gate\nname. Each gate selects a kind (e.g. \"captcha\") and provider-specific\nconfiguration. The engine may also inject gates dynamically based on\npolicy.\n',
3172
+ ),
3173
+ sso_providers: zod
3174
+ .array(
3175
+ zod
3176
+ .object({
3177
+ id: zod.string().describe("Provider instance identifier."),
3178
+ name: zod.string().describe("Display name for the provider."),
3179
+ template: zod
3180
+ .string()
3181
+ .describe("Template hint for rendering (logo, colors)."),
3182
+ })
3183
+ .describe("An available SSO identity provider."),
3184
+ )
3185
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault)
3186
+ .describe("Available SSO identity providers for this step."),
3187
+ on_success: zod
3188
+ .enum(["create_user"])
3189
+ .optional()
3190
+ .describe(
3191
+ "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",
3192
+ ),
3193
+ complete: zod
3194
+ .enum(["redirect", "show"])
3195
+ .optional()
3196
+ .describe(
3197
+ "Marks this as a terminal step. Tells the frontend what to do:\n- redirect: navigate to redirect_uri (OIDC\/SAML callback done)\n- show: render as a success\/info screen\n",
3198
+ ),
3199
+ transitions: zod
3200
+ .record(
3201
+ zod.string(),
3202
+ zod.object({
3203
+ target: zod
3126
3204
  .string()
3127
3205
  .describe(
3128
- "Provider identifier within the gate kind e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
3206
+ "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
3129
3207
  ),
3130
- config: zod
3131
- .record(zod.string(), zod.unknown())
3208
+ action: zod
3209
+ .union([zod.enum(["switch", "pivot"]), zod.null()])
3132
3210
  .optional()
3133
3211
  .describe(
3134
- "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3212
+ "How to interpret `target`:\n- null (omitted): transition to a step in the current flow.\n- switch: replace the current flow with the target flow.\n No return — the current flow is discarded.\n Example: login ↔ register.\n- pivot: push the target flow onto the stack. The current flow\n is paused and resumes when the target flow completes (auto-pop).\n Example: login → recovery → back to login.\n",
3135
3213
  ),
3136
- })
3137
- .describe(
3138
- "A security challenge that must be satisfied before this step's submission\nis accepted. The engine may also inject gates at runtime based on policy\nor risk evaluation.\n",
3139
- ),
3140
- )
3141
- .default(createFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault)
3142
- .describe(
3143
- 'Security gates that must be satisfied before submission. Keyed by gate\nname. Each gate selects a kind (e.g. \"captcha\") and provider-specific\nconfiguration. The engine may also inject gates dynamically based on\npolicy.\n',
3144
- ),
3145
- sso_providers: zod
3146
- .array(
3147
- zod
3148
- .object({
3149
- id: zod.string().describe("Provider instance identifier."),
3150
- name: zod.string().describe("Display name for the provider."),
3151
- template: zod
3152
- .string()
3153
- .describe("Template hint for rendering (logo, colors)."),
3154
- })
3155
- .describe("An available SSO identity provider."),
3156
- )
3157
- .default(createFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault)
3158
- .describe("Available SSO identity providers for this step."),
3159
- on_success: zod
3160
- .enum(["create_user"])
3161
- .optional()
3162
- .describe(
3163
- "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",
3164
- ),
3165
- complete: zod
3166
- .enum(["redirect", "show"])
3167
- .optional()
3168
- .describe(
3169
- "Marks this as a terminal step. Tells the frontend what to do:\n- redirect: navigate to redirect_uri (OIDC\/SAML callback done)\n- show: render as a success\/info screen\n",
3170
- ),
3171
- transitions: zod
3172
- .record(
3173
- zod.string(),
3174
- zod.object({
3175
- target: zod
3176
- .string()
3177
- .describe(
3178
- "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
3179
- ),
3180
- action: zod
3181
- .union([zod.enum(["switch", "pivot"]), zod.null()])
3182
- .optional()
3183
- .describe(
3184
- "How to interpret `target`:\n- null (omitted): transition to a step in the current flow.\n- switch: replace the current flow with the target flow.\n No return — the current flow is discarded.\n Example: login ↔ register.\n- pivot: push the target flow onto the stack. The current flow\n is paused and resumes when the target flow completes (auto-pop).\n Example: login → recovery → back to login.\n",
3185
- ),
3186
- }),
3187
- )
3188
- .optional()
3189
- .describe(
3190
- "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",
3191
- ),
3192
- })
3193
- .describe(
3194
- "A step in a flow definition. This is the admin-authored configuration,\nnot the runtime payload sent to the frontend.\n\nSteps are schema-driven: `fields` references properties from the flow's\nuser schema, and the engine resolves field metadata (type, validation,\nimplicit outcomes) from schema annotations at runtime.\n\nA step with only `complete` set is a terminal step. All other steps are\nrendered to the frontend as capability payloads.\n",
3195
- ),
3196
- )
3197
- .min(1)
3198
- .describe(
3199
- "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
3200
- ),
3201
- })
3202
- .describe(
3203
- "A flow definition is the server-side configuration that describes a complete\nauthentication or identity flow. It is NOT sent to the frontend — the flow\nengine evaluates it and produces FlowResponse payloads (steps with capability\ndictionaries) for the client.\n\nFlow definitions are created by administrators and stored in the project\/team\nconfiguration hierarchy. The engine selects the matching definition based on\nthe purpose + audience when a flow is created via POST \/flow.\n",
3204
- ),
3205
- });
3214
+ }),
3215
+ )
3216
+ .optional()
3217
+ .describe(
3218
+ "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",
3219
+ ),
3220
+ })
3221
+ .describe(
3222
+ "A step in a flow definition. This is the admin-authored configuration,\nnot the runtime payload sent to the frontend.\n\nSteps are schema-driven: `fields` references properties from the flow's\nuser schema, and the engine resolves field metadata (type, validation,\nimplicit outcomes) from schema annotations at runtime.\n\nA step with only `complete` set is a terminal step. All other steps are\nrendered to the frontend as capability payloads.\n",
3223
+ ),
3224
+ )
3225
+ .min(1)
3226
+ .describe(
3227
+ "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
3228
+ ),
3229
+ })
3230
+ .describe(
3231
+ "A flow definition is the server-side configuration that describes a complete\nauthentication or identity flow. It is NOT sent to the frontend — the flow\nengine evaluates it and produces FlowResponse payloads (steps with capability\ndictionaries) for the client.\n\nFlow definitions are created by administrators and stored in the project\/team\nconfiguration hierarchy. The engine selects the matching definition based on\nthe purpose + audience when a flow is created via POST \/flow.\n",
3232
+ ),
3233
+ })
3234
+ .describe(
3235
+ "Creates a flow definition.\nThe flow definition is created in an `active` state by default.\nThe status can also be set via the `status` attribute in the flow definition payload.\n",
3236
+ );
3206
3237
 
3207
3238
  /**
3208
3239
  * Retrieves a list of all flow definitions.
@@ -3260,7 +3291,11 @@ export const ListFlowDefinitionsResponse = zod.object({
3260
3291
  .describe(
3261
3292
  "URI of the flow definition schema this definition was authored against.\nIf the schema_uri was not provided in the request, the flow definition is validated against the latest version of the schema, and the response includes the schema_uri of the latest version.\n",
3262
3293
  ),
3263
- status: zod.string().describe("Status of the flow definition."),
3294
+ status: zod
3295
+ .enum(["active", "draft"])
3296
+ .describe(
3297
+ "The lifecycle state of this flow definition. \n\nactive: The flow definition is ready to be used. The flow engine can select it for new flows.\ndraft: The engine will not select it for new flows, and existing flows must handle it gracefully if they reference this definition.\n\nAllowed transitions:\n- draft -> active: To activate the flow definition.\n- active -> draft: To remove the flow definition from active use immediately.\n",
3298
+ ),
3264
3299
  created_at: zod.iso
3265
3300
  .datetime({ offset: true })
3266
3301
  .describe("Timestamp when the flow definition was created."),
@@ -3305,7 +3340,6 @@ export const getFlowDefinitionResponseFlowDefinitionStepsItemSsoProvidersDefault
3305
3340
  export const GetFlowDefinitionResponse = zod.object({
3306
3341
  id: zod.string().describe("Unique identifier for the flow definition."),
3307
3342
  project_id: zod.string().describe("Identifier of the project this flow definition belongs to."),
3308
- status: zod.string().describe("Status of the flow definition."),
3309
3343
  flow_definition: zod
3310
3344
  .object({
3311
3345
  name: zod
@@ -3314,6 +3348,11 @@ export const GetFlowDefinitionResponse = zod.object({
3314
3348
  .describe(
3315
3349
  "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Renaming is not supported — the\n`name` is part of the public contract another definition may\nreference. Acts as the human display label as well; no separate slug.\n",
3316
3350
  ),
3351
+ status: zod
3352
+ .enum(["active", "draft"])
3353
+ .describe(
3354
+ "The lifecycle state of this flow definition. \n\nactive: The flow definition is ready to be used. The flow engine can select it for new flows.\ndraft: The engine will not select it for new flows, and existing flows must handle it gracefully if they reference this definition.\n\nAllowed transitions:\n- draft -> active: To activate the flow definition.\n- active -> draft: To remove the flow definition from active use immediately.\n",
3355
+ ),
3317
3356
  user_schema: zod
3318
3357
  .url()
3319
3358
  .describe(
@@ -3365,6 +3404,11 @@ export const GetFlowDefinitionResponse = zod.object({
3365
3404
  .describe(
3366
3405
  "Action identifier. Sent back in the submit request as `action`.",
3367
3406
  ),
3407
+ kind: zod
3408
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3409
+ .describe(
3410
+ "Classifies how the engine handles this action:\n- `submit`: collect the step's fields and run validate\/dispatch\/on_success.\n- `passkey`: issue a WebAuthn assertion challenge; the matching transition\n fires once the returned assertion verifies.\n- `passkey_register`: issue a WebAuthn registration challenge; the matching\n transition fires once the returned attestation verifies.\n- `navigate`: route through the transition without running the input\n pipeline. Used for pure-routing actions declared in the flow definition.\n- `back`: return the user to the previous step. Surfaced by the engine\n when going back is available.\n",
3411
+ ),
3368
3412
  primary: zod
3369
3413
  .boolean()
3370
3414
  .default(
@@ -3381,7 +3425,7 @@ export const GetFlowDefinitionResponse = zod.object({
3381
3425
  ),
3382
3426
  })
3383
3427
  .describe(
3384
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3428
+ "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`; the engine resolves the action's\ndeclared `kind` to decide how to handle the submission.\n",
3385
3429
  ),
3386
3430
  )
3387
3431
  .default(getFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault)
@@ -3483,7 +3527,9 @@ export const GetFlowDefinitionResponse = zod.object({
3483
3527
  });
3484
3528
 
3485
3529
  /**
3486
- * Update a flow definition by id
3530
+ * Update a flow definition by id. This endpoint replaces the existing flow definition.
3531
+ If `flow_definition.status` is omitted, the current status is preserved
3532
+
3487
3533
  * @summary Update a flow definition by id
3488
3534
  */
3489
3535
  export const UpdateFlowDefinitionParams = zod.object({
@@ -3499,171 +3545,205 @@ export const UpdateFlowDefinitionQueryParams = zod.strictObject({
3499
3545
  .describe("The project id to filter by."),
3500
3546
  });
3501
3547
 
3502
- export const updateFlowDefinitionBodyStepsItemFieldsDefault = [];
3503
- export const updateFlowDefinitionBodyStepsItemActionsItemPrimaryDefault = false;
3504
- export const updateFlowDefinitionBodyStepsItemActionsDefault = [];
3505
- export const updateFlowDefinitionBodyStepsItemGatesDefault = {} as const;
3506
- export const updateFlowDefinitionBodyStepsItemSsoProvidersDefault = [];
3548
+ export const updateFlowDefinitionBodyFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
3549
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault = [];
3550
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
3551
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault = [];
3552
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault = {} as const;
3553
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault = [];
3507
3554
 
3508
3555
  export const UpdateFlowDefinitionBody = zod
3509
3556
  .object({
3510
- user_schema: zod
3557
+ schema_uri: zod
3511
3558
  .url()
3512
3559
  .optional()
3513
- .describe("User schema this flow operates on. Replaces the current value if provided.\n"),
3514
- purposes: zod
3515
- .record(zod.string(), zod.string())
3516
- .optional()
3517
3560
  .describe(
3518
- "Replaces the full purpose-to-entry-step map if provided. Keys are\npurpose names; values must match a `name` in `steps`.\n",
3561
+ "URI of the server-published flow definition schema this definition was\nauthored against. The server uses this to validate the definition.\nIf not provided, the engine will use the latest schema version for validation.\n",
3519
3562
  ),
3520
- audience: zod
3563
+ flow_definition: zod
3521
3564
  .object({
3522
- team_ids: zod
3523
- .array(zod.string())
3524
- .optional()
3525
- .describe("Restrict to specific teams (organizations). Empty means no team restriction."),
3526
- app_ids: zod
3527
- .array(zod.string())
3528
- .optional()
3529
- .describe("Restrict to specific applications. Empty means no app restriction."),
3530
- })
3531
- .optional()
3532
- .describe(
3533
- 'Scopes which teams or apps this flow definition applies to. Empty or\nomitted fields mean \"no restriction\"; when both are empty the definition\nmatches every request in the project. The engine picks the most specific\nmatching definition: app > team > project-wide.\n',
3534
- ),
3535
- steps: zod
3536
- .array(
3537
- zod
3565
+ name: zod
3566
+ .string()
3567
+ .regex(updateFlowDefinitionBodyFlowDefinitionNameRegExp)
3568
+ .describe(
3569
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Renaming is not supported — the\n`name` is part of the public contract another definition may\nreference. Acts as the human display label as well; no separate slug.\n",
3570
+ ),
3571
+ status: zod
3572
+ .enum(["active", "draft"])
3573
+ .describe(
3574
+ "The lifecycle state of this flow definition. \n\nactive: The flow definition is ready to be used. The flow engine can select it for new flows.\ndraft: The engine will not select it for new flows, and existing flows must handle it gracefully if they reference this definition.\n\nAllowed transitions:\n- draft -> active: To activate the flow definition.\n- active -> draft: To remove the flow definition from active use immediately.\n",
3575
+ ),
3576
+ user_schema: zod
3577
+ .url()
3578
+ .describe(
3579
+ "User schema this flow operates on. Step `fields` reference properties\ndefined in this schema. The engine resolves field types, validation,\nand implicit outcomes from schema annotations at runtime.\n",
3580
+ ),
3581
+ purposes: zod
3582
+ .record(zod.string(), zod.string())
3583
+ .describe(
3584
+ "Maps each purpose this definition handles to its entry-point step.\nKeys are purpose names; values must match a `name` in `steps`. A\ndefinition can serve multiple purposes (e.g. a combined login\/register\nflow) by listing one entry per purpose.\n",
3585
+ ),
3586
+ audience: zod
3538
3587
  .object({
3539
- name: zod
3540
- .string()
3541
- .describe(
3542
- "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3543
- ),
3544
- fields: zod
3588
+ team_ids: zod
3545
3589
  .array(zod.string())
3546
- .default(updateFlowDefinitionBodyStepsItemFieldsDefault)
3590
+ .optional()
3547
3591
  .describe(
3548
- "Schema property names to collect from the user. Each entry references\na property in the flow's user schema. The engine resolves field type,\nvalidation rules, and implicit outcomes from schema annotations\n(e.g. a property with `x-unique` set implies a `user_not_found`\ntransition outcome).\n",
3592
+ "Restrict to specific teams (organizations). Empty means no team restriction.",
3549
3593
  ),
3550
- actions: zod
3551
- .array(
3552
- zod
3553
- .object({
3554
- name: zod
3555
- .string()
3556
- .describe("Action identifier. Sent back in the submit request as `action`."),
3557
- primary: zod
3558
- .boolean()
3559
- .default(updateFlowDefinitionBodyStepsItemActionsItemPrimaryDefault)
3560
- .describe(
3561
- "Marks this as the default\/primary action. The runtime template uses\nthis hint to choose visual emphasis. At most one action per step\nshould be primary; this is not enforced here.\n",
3562
- ),
3563
- text_key: zod
3564
- .string()
3565
- .optional()
3566
- .describe(
3567
- "Optional localization key override for the action's label. When\nomitted, the engine derives a key from the step and action names.\nDisplay text is resolved client-side from a locale dictionary, never\nby the engine.\n",
3568
- ),
3569
- })
3594
+ app_ids: zod
3595
+ .array(zod.string())
3596
+ .optional()
3597
+ .describe("Restrict to specific applications. Empty means no app restriction."),
3598
+ })
3599
+ .optional()
3600
+ .describe(
3601
+ 'Scopes which teams or apps this flow definition applies to. Empty or\nomitted fields mean \"no restriction\"; when both are empty the definition\nmatches every request in the project. The engine picks the most specific\nmatching definition: app > team > project-wide.\n',
3602
+ ),
3603
+ steps: zod
3604
+ .array(
3605
+ zod
3606
+ .object({
3607
+ name: zod
3608
+ .string()
3570
3609
  .describe(
3571
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3610
+ "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3572
3611
  ),
3573
- )
3574
- .default(updateFlowDefinitionBodyStepsItemActionsDefault)
3575
- .describe(
3576
- "Ordered list of actions the user can take. The action name is what the\nfrontend sends back in the submit request. If omitted, the engine\nprovides a default `submit` action.\n",
3577
- ),
3578
- gates: zod
3579
- .record(
3580
- zod.string(),
3581
- zod
3582
- .object({
3583
- kind: zod
3584
- .enum(["captcha"])
3585
- .describe(
3586
- "The gate category. Only `captcha` is currently defined. Authenticator\nceremonies (e.g. passkey) are modelled as credential auth_attempts via\n`x-credential` on a field, not as gates.\n",
3587
- ),
3588
- provider: zod
3589
- .string()
3612
+ fields: zod
3613
+ .array(zod.string())
3614
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault)
3615
+ .describe(
3616
+ "Schema property names to collect from the user. Each entry references\na property in the flow's user schema. The engine resolves field type,\nvalidation rules, and implicit outcomes from schema annotations\n(e.g. a property with `x-unique` set implies a `user_not_found`\ntransition outcome).\n",
3617
+ ),
3618
+ actions: zod
3619
+ .array(
3620
+ zod
3621
+ .object({
3622
+ name: zod
3623
+ .string()
3624
+ .describe(
3625
+ "Action identifier. Sent back in the submit request as `action`.",
3626
+ ),
3627
+ kind: zod
3628
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3629
+ .describe(
3630
+ "Classifies how the engine handles this action:\n- `submit`: collect the step's fields and run validate\/dispatch\/on_success.\n- `passkey`: issue a WebAuthn assertion challenge; the matching transition\n fires once the returned assertion verifies.\n- `passkey_register`: issue a WebAuthn registration challenge; the matching\n transition fires once the returned attestation verifies.\n- `navigate`: route through the transition without running the input\n pipeline. Used for pure-routing actions declared in the flow definition.\n- `back`: return the user to the previous step. Surfaced by the engine\n when going back is available.\n",
3631
+ ),
3632
+ primary: zod
3633
+ .boolean()
3634
+ .default(
3635
+ updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault,
3636
+ )
3637
+ .describe(
3638
+ "Marks this as the default\/primary action. The runtime template uses\nthis hint to choose visual emphasis. At most one action per step\nshould be primary; this is not enforced here.\n",
3639
+ ),
3640
+ text_key: zod
3641
+ .string()
3642
+ .optional()
3643
+ .describe(
3644
+ "Optional localization key override for the action's label. When\nomitted, the engine derives a key from the step and action names.\nDisplay text is resolved client-side from a locale dictionary, never\nby the engine.\n",
3645
+ ),
3646
+ })
3590
3647
  .describe(
3591
- "Provider identifier within the gate kind e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
3648
+ "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`; the engine resolves the action's\ndeclared `kind` to decide how to handle the submission.\n",
3592
3649
  ),
3593
- config: zod
3594
- .record(zod.string(), zod.unknown())
3595
- .optional()
3650
+ )
3651
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault)
3652
+ .describe(
3653
+ "Ordered list of actions the user can take. The action name is what the\nfrontend sends back in the submit request. If omitted, the engine\nprovides a default `submit` action.\n",
3654
+ ),
3655
+ gates: zod
3656
+ .record(
3657
+ zod.string(),
3658
+ zod
3659
+ .object({
3660
+ kind: zod
3661
+ .enum(["captcha"])
3662
+ .describe(
3663
+ "The gate category. Only `captcha` is currently defined. Authenticator\nceremonies (e.g. passkey) are modelled as credential auth_attempts via\n`x-credential` on a field, not as gates.\n",
3664
+ ),
3665
+ provider: zod
3666
+ .string()
3667
+ .describe(
3668
+ "Provider identifier within the gate kind — e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
3669
+ ),
3670
+ config: zod
3671
+ .record(zod.string(), zod.unknown())
3672
+ .optional()
3673
+ .describe(
3674
+ "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3675
+ ),
3676
+ })
3596
3677
  .describe(
3597
- "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3678
+ "A security challenge that must be satisfied before this step's submission\nis accepted. The engine may also inject gates at runtime based on policy\nor risk evaluation.\n",
3598
3679
  ),
3599
- })
3680
+ )
3681
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault)
3600
3682
  .describe(
3601
- "A security challenge that must be satisfied before this step's submission\nis accepted. The engine may also inject gates at runtime based on policy\nor risk evaluation.\n",
3683
+ 'Security gates that must be satisfied before submission. Keyed by gate\nname. Each gate selects a kind (e.g. \"captcha\") and provider-specific\nconfiguration. The engine may also inject gates dynamically based on\npolicy.\n',
3602
3684
  ),
3603
- )
3604
- .default(updateFlowDefinitionBodyStepsItemGatesDefault)
3605
- .describe(
3606
- 'Security gates that must be satisfied before submission. Keyed by gate\nname. Each gate selects a kind (e.g. \"captcha\") and provider-specific\nconfiguration. The engine may also inject gates dynamically based on\npolicy.\n',
3607
- ),
3608
- sso_providers: zod
3609
- .array(
3610
- zod
3611
- .object({
3612
- id: zod.string().describe("Provider instance identifier."),
3613
- name: zod.string().describe("Display name for the provider."),
3614
- template: zod.string().describe("Template hint for rendering (logo, colors)."),
3615
- })
3616
- .describe("An available SSO identity provider."),
3617
- )
3618
- .default(updateFlowDefinitionBodyStepsItemSsoProvidersDefault)
3619
- .describe("Available SSO identity providers for this step."),
3620
- on_success: zod
3621
- .enum(["create_user"])
3622
- .optional()
3623
- .describe(
3624
- "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",
3625
- ),
3626
- complete: zod
3627
- .enum(["redirect", "show"])
3628
- .optional()
3629
- .describe(
3630
- "Marks this as a terminal step. Tells the frontend what to do:\n- redirect: navigate to redirect_uri (OIDC\/SAML callback done)\n- show: render as a success\/info screen\n",
3631
- ),
3632
- transitions: zod
3633
- .record(
3634
- zod.string(),
3635
- zod.object({
3636
- target: zod
3637
- .string()
3638
- .describe(
3639
- "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
3640
- ),
3641
- action: zod
3642
- .union([zod.enum(["switch", "pivot"]), zod.null()])
3643
- .optional()
3644
- .describe(
3645
- "How to interpret `target`:\n- null (omitted): transition to a step in the current flow.\n- switch: replace the current flow with the target flow.\n No return — the current flow is discarded.\n Example: login ↔ register.\n- pivot: push the target flow onto the stack. The current flow\n is paused and resumes when the target flow completes (auto-pop).\n Example: login → recovery → back to login.\n",
3646
- ),
3647
- }),
3648
- )
3649
- .optional()
3685
+ sso_providers: zod
3686
+ .array(
3687
+ zod
3688
+ .object({
3689
+ id: zod.string().describe("Provider instance identifier."),
3690
+ name: zod.string().describe("Display name for the provider."),
3691
+ template: zod
3692
+ .string()
3693
+ .describe("Template hint for rendering (logo, colors)."),
3694
+ })
3695
+ .describe("An available SSO identity provider."),
3696
+ )
3697
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault)
3698
+ .describe("Available SSO identity providers for this step."),
3699
+ on_success: zod
3700
+ .enum(["create_user"])
3701
+ .optional()
3702
+ .describe(
3703
+ "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",
3704
+ ),
3705
+ complete: zod
3706
+ .enum(["redirect", "show"])
3707
+ .optional()
3708
+ .describe(
3709
+ "Marks this as a terminal step. Tells the frontend what to do:\n- redirect: navigate to redirect_uri (OIDC\/SAML callback done)\n- show: render as a success\/info screen\n",
3710
+ ),
3711
+ transitions: zod
3712
+ .record(
3713
+ zod.string(),
3714
+ zod.object({
3715
+ target: zod
3716
+ .string()
3717
+ .describe(
3718
+ "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
3719
+ ),
3720
+ action: zod
3721
+ .union([zod.enum(["switch", "pivot"]), zod.null()])
3722
+ .optional()
3723
+ .describe(
3724
+ "How to interpret `target`:\n- null (omitted): transition to a step in the current flow.\n- switch: replace the current flow with the target flow.\n No return — the current flow is discarded.\n Example: login ↔ register.\n- pivot: push the target flow onto the stack. The current flow\n is paused and resumes when the target flow completes (auto-pop).\n Example: login → recovery → back to login.\n",
3725
+ ),
3726
+ }),
3727
+ )
3728
+ .optional()
3729
+ .describe(
3730
+ "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",
3731
+ ),
3732
+ })
3650
3733
  .describe(
3651
- "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",
3734
+ "A step in a flow definition. This is the admin-authored configuration,\nnot the runtime payload sent to the frontend.\n\nSteps are schema-driven: `fields` references properties from the flow's\nuser schema, and the engine resolves field metadata (type, validation,\nimplicit outcomes) from schema annotations at runtime.\n\nA step with only `complete` set is a terminal step. All other steps are\nrendered to the frontend as capability payloads.\n",
3652
3735
  ),
3653
- })
3736
+ )
3737
+ .min(1)
3654
3738
  .describe(
3655
- "A step in a flow definition. This is the admin-authored configuration,\nnot the runtime payload sent to the frontend.\n\nSteps are schema-driven: `fields` references properties from the flow's\nuser schema, and the engine resolves field metadata (type, validation,\nimplicit outcomes) from schema annotations at runtime.\n\nA step with only `complete` set is a terminal step. All other steps are\nrendered to the frontend as capability payloads.\n",
3739
+ "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
3656
3740
  ),
3657
- )
3658
- .min(1)
3659
- .optional()
3741
+ })
3660
3742
  .describe(
3661
- "Replaces the full steps array if provided. Partial step lists are not\nsupportedsupply all steps when updating this field.\n",
3743
+ "A flow definition is the server-side configuration that describes a complete\nauthentication or identity flow. It is NOT sent to the frontend the flow\nengine evaluates it and produces FlowResponse payloads (steps with capability\ndictionaries) for the client.\n\nFlow definitions are created by administrators and stored in the project\/team\nconfiguration hierarchy. The engine selects the matching definition based on\nthe purpose + audience when a flow is created via POST \/flow.\n",
3662
3744
  ),
3663
3745
  })
3664
- .describe(
3665
- "Partial update for a flow definition. Only provided fields are replaced;\nomitted fields retain their current server-side values.\n\nCollection fields (`steps`, `purposes`) are treated atomically: if\nprovided, the entire array\/object is replaced. If omitted, the current\nvalue is preserved unchanged.\n\n`name` is a stable identifier and cannot be changed after creation.\n",
3666
- );
3746
+ .describe("Replaces the existing flow definition.\n");
3667
3747
 
3668
3748
  export const updateFlowDefinitionResponseFlowDefinitionNameRegExp = new RegExp(
3669
3749
  "^[a-z][a-z0-9-]\*$",
@@ -3677,7 +3757,6 @@ export const updateFlowDefinitionResponseFlowDefinitionStepsItemSsoProvidersDefa
3677
3757
  export const UpdateFlowDefinitionResponse = zod.object({
3678
3758
  id: zod.string().describe("Unique identifier for the flow definition."),
3679
3759
  project_id: zod.string().describe("Identifier of the project this flow definition belongs to."),
3680
- status: zod.string().describe("Status of the flow definition."),
3681
3760
  flow_definition: zod
3682
3761
  .object({
3683
3762
  name: zod
@@ -3686,6 +3765,11 @@ export const UpdateFlowDefinitionResponse = zod.object({
3686
3765
  .describe(
3687
3766
  "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Renaming is not supported — the\n`name` is part of the public contract another definition may\nreference. Acts as the human display label as well; no separate slug.\n",
3688
3767
  ),
3768
+ status: zod
3769
+ .enum(["active", "draft"])
3770
+ .describe(
3771
+ "The lifecycle state of this flow definition. \n\nactive: The flow definition is ready to be used. The flow engine can select it for new flows.\ndraft: The engine will not select it for new flows, and existing flows must handle it gracefully if they reference this definition.\n\nAllowed transitions:\n- draft -> active: To activate the flow definition.\n- active -> draft: To remove the flow definition from active use immediately.\n",
3772
+ ),
3689
3773
  user_schema: zod
3690
3774
  .url()
3691
3775
  .describe(
@@ -3737,6 +3821,11 @@ export const UpdateFlowDefinitionResponse = zod.object({
3737
3821
  .describe(
3738
3822
  "Action identifier. Sent back in the submit request as `action`.",
3739
3823
  ),
3824
+ kind: zod
3825
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3826
+ .describe(
3827
+ "Classifies how the engine handles this action:\n- `submit`: collect the step's fields and run validate\/dispatch\/on_success.\n- `passkey`: issue a WebAuthn assertion challenge; the matching transition\n fires once the returned assertion verifies.\n- `passkey_register`: issue a WebAuthn registration challenge; the matching\n transition fires once the returned attestation verifies.\n- `navigate`: route through the transition without running the input\n pipeline. Used for pure-routing actions declared in the flow definition.\n- `back`: return the user to the previous step. Surfaced by the engine\n when going back is available.\n",
3828
+ ),
3740
3829
  primary: zod
3741
3830
  .boolean()
3742
3831
  .default(
@@ -3753,7 +3842,7 @@ export const UpdateFlowDefinitionResponse = zod.object({
3753
3842
  ),
3754
3843
  })
3755
3844
  .describe(
3756
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3845
+ "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`; the engine resolves the action's\ndeclared `kind` to decide how to handle the submission.\n",
3757
3846
  ),
3758
3847
  )
3759
3848
  .default(updateFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault)
@@ -3855,7 +3944,10 @@ export const UpdateFlowDefinitionResponse = zod.object({
3855
3944
  });
3856
3945
 
3857
3946
  /**
3858
- * Delete a flow definition by id
3947
+ * Delete a flow definition by id.
3948
+ If the flow definition is currently being used by a flow, the deletion will fail.
3949
+ If the flow definition is the last active flow definition for a given purpose, the deletion will fail to prevent disruption of new flows being started for that purpose.
3950
+
3859
3951
  * @summary Delete a flow definition by id
3860
3952
  */
3861
3953
  export const DeleteFlowDefinitionParams = zod.object({
@@ -3871,6 +3963,45 @@ export const DeleteFlowDefinitionQueryParams = zod.strictObject({
3871
3963
  .describe("The project id to filter by."),
3872
3964
  });
3873
3965
 
3966
+ /**
3967
+ * Activate a flow definition by transitioning it from a `draft` state to an `active` state.
3968
+ Alternatively, the status of a flow definition can also be set via the `POST /flow_definitions` and `PUT /flow_definitions/{id}` endpoints by setting the `status` attribute in the flow definition payload.
3969
+
3970
+ * @summary Activate a flow definition by ID.
3971
+ */
3972
+ export const ActivateFlowDefinitionParams = zod.object({
3973
+ id: zod.string().describe("The id returned by the POST \/flow_definitions endpoint.\n"),
3974
+ });
3975
+
3976
+ export const activateFlowDefinitionQueryProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
3977
+
3978
+ export const ActivateFlowDefinitionQueryParams = zod.strictObject({
3979
+ project_id: zod
3980
+ .string()
3981
+ .regex(activateFlowDefinitionQueryProjectIdRegExp)
3982
+ .describe("The unique identifier of the project"),
3983
+ });
3984
+
3985
+ /**
3986
+ * Deactivates a flow definition in the `active` state by transitioning it to the `draft` state.
3987
+ Flow definitions in `draft` state cannot be used to start new flows. Existing flows that use the deactivated flow definition must gracefully handle this.
3988
+ Alternatively, the status of a flow definition can also be set via the `POST /flow_definitions` and `PUT /flow_definitions/{id}` endpoints by setting the `status` attribute in the flow definition payload.
3989
+
3990
+ * @summary Deactivate a flow definition by ID.
3991
+ */
3992
+ export const DeactivateFlowDefinitionParams = zod.object({
3993
+ id: zod.string().describe("The id returned by the POST \/flow_definitions endpoint.\n"),
3994
+ });
3995
+
3996
+ export const deactivateFlowDefinitionQueryProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
3997
+
3998
+ export const DeactivateFlowDefinitionQueryParams = zod.strictObject({
3999
+ project_id: zod
4000
+ .string()
4001
+ .regex(deactivateFlowDefinitionQueryProjectIdRegExp)
4002
+ .describe("The unique identifier of the project"),
4003
+ });
4004
+
3874
4005
  /**
3875
4006
  * @summary Create team
3876
4007
  */