@zitadel/api 0.1.0-alpha.10 → 0.1.0-alpha.12

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 (89) hide show
  1. package/dist/generated/endpoints/zitadelNextGen.d.mts +2 -2
  2. package/dist/generated/endpoints/zitadelNextGen.mjs +56 -6
  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 -18
  7. package/dist/generated/endpoints/zitadelNextGen.msw.mjs.map +1 -1
  8. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts +165 -52
  9. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts.map +1 -1
  10. package/dist/generated/endpoints/zitadelNextGen.zod.mjs +135 -51
  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 +142 -7
  14. package/dist/generated/model/index.mjs.map +1 -1
  15. package/dist/{index-BGnjxx-b.d.mts → index-1TIHnDrM.d.mts} +915 -77
  16. package/dist/index-1TIHnDrM.d.mts.map +1 -0
  17. package/dist/runtime/api-factory.d.mts +1 -1
  18. package/dist/{zitadelNextGen-BS4VE7_Y.d.mts → zitadelNextGen-AAujo87_.d.mts} +30 -8
  19. package/dist/zitadelNextGen-AAujo87_.d.mts.map +1 -0
  20. package/package.json +1 -1
  21. package/src/generated/endpoints/zitadelNextGen.msw.ts +92 -7
  22. package/src/generated/endpoints/zitadelNextGen.ts +82 -5
  23. package/src/generated/endpoints/zitadelNextGen.zod.ts +479 -322
  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/createFlowBody.ts +5 -0
  32. package/src/generated/model/createFlowDefinition201.ts +11 -2
  33. package/src/generated/model/createFlowDefinition201FlowDefinition.ts +11 -0
  34. package/src/generated/model/createFlowDefinition201FlowDefinitionStatus.ts +26 -0
  35. package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemActionsItem.ts +15 -1
  36. package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemActionsItemKind.ts +31 -0
  37. package/src/generated/model/createFlowDefinition201Status.ts +26 -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 +11 -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/getFlowDefinition200Status.ts +26 -0
  58. package/src/generated/model/getFlowStep200StepActionsItem.ts +15 -1
  59. package/src/generated/model/getFlowStep200StepActionsItemKind.ts +31 -0
  60. package/src/generated/model/index.ts +43 -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/submitFlowStep400StepActionsItem.ts +15 -1
  66. package/src/generated/model/submitFlowStep400StepActionsItemKind.ts +31 -0
  67. package/src/generated/model/updateFlowDefinition200.ts +11 -2
  68. package/src/generated/model/updateFlowDefinition200FlowDefinition.ts +11 -0
  69. package/src/generated/model/updateFlowDefinition200FlowDefinitionStatus.ts +26 -0
  70. package/src/generated/model/updateFlowDefinition200FlowDefinitionStepsItemActionsItem.ts +15 -1
  71. package/src/generated/model/updateFlowDefinition200FlowDefinitionStepsItemActionsItemKind.ts +31 -0
  72. package/src/generated/model/updateFlowDefinition200Status.ts +26 -0
  73. package/src/generated/model/updateFlowDefinitionBody.ts +16 -30
  74. package/src/generated/model/updateFlowDefinitionBodyFlowDefinition.ts +69 -0
  75. package/src/generated/model/{updateFlowDefinitionBodyAudience.ts → updateFlowDefinitionBodyFlowDefinitionAudience.ts} +1 -1
  76. package/src/generated/model/updateFlowDefinitionBodyFlowDefinitionStatus.ts +26 -0
  77. package/src/generated/model/{updateFlowDefinitionBodyStepsItem.ts → updateFlowDefinitionBodyFlowDefinitionStepsItem.ts} +13 -13
  78. package/src/generated/model/updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItem.ts +42 -0
  79. package/src/generated/model/updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItemKind.ts +31 -0
  80. package/src/generated/model/{updateFlowDefinitionBodyStepsItemComplete.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemComplete.ts} +3 -3
  81. package/src/generated/model/{updateFlowDefinitionBodyStepsItemGates.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemGates.ts} +5 -5
  82. package/src/generated/model/{updateFlowDefinitionBodyStepsItemGatesConfig.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemGatesConfig.ts} +1 -1
  83. package/src/generated/model/{updateFlowDefinitionBodyStepsItemGatesKind.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemGatesKind.ts} +3 -3
  84. package/src/generated/model/{updateFlowDefinitionBodyStepsItemOnSuccess.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemOnSuccess.ts} +3 -3
  85. package/src/generated/model/{updateFlowDefinitionBodyStepsItemSsoProvidersItem.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersItem.ts} +1 -1
  86. package/src/generated/model/{updateFlowDefinitionBodyStepsItemTransitions.ts → updateFlowDefinitionBodyFlowDefinitionStepsItemTransitions.ts} +1 -1
  87. package/dist/index-BGnjxx-b.d.mts.map +0 -1
  88. package/dist/zitadelNextGen-BS4VE7_Y.d.mts.map +0 -1
  89. package/src/generated/model/updateFlowDefinitionBodyStepsItemActionsItem.ts +0 -28
@@ -481,7 +481,7 @@ export const GetKeysResponse = zod.object({
481
481
  });
482
482
 
483
483
  /**
484
- * @summary Get accesstoken
484
+ * @summary Get access token
485
485
  */
486
486
  export const GetTokenResponse = zod.object({
487
487
  access_token: zod
@@ -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)
@@ -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)
@@ -3010,199 +3027,215 @@ 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
  */
3017
3034
  export const createFlowDefinitionBodyProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
3018
3035
  export const createFlowDefinitionBodyFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
3036
+ export const createFlowDefinitionBodyFlowDefinitionStatusDefault = `active`;
3019
3037
  export const createFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault = [];
3020
3038
  export const createFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
3021
3039
  export const createFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault = [];
3022
3040
  export const createFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault = {} as const;
3023
3041
  export const createFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault = [];
3024
3042
 
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
3043
+ export const CreateFlowDefinitionBody = zod
3044
+ .object({
3045
+ project_id: zod.string().regex(createFlowDefinitionBodyProjectIdRegExp),
3046
+ schema_uri: zod
3047
+ .url()
3048
+ .optional()
3049
+ .describe(
3050
+ "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",
3051
+ ),
3052
+ flow_definition: zod
3053
+ .object({
3054
+ name: zod
3055
+ .string()
3056
+ .regex(createFlowDefinitionBodyFlowDefinitionNameRegExp)
3057
+ .describe(
3058
+ "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",
3059
+ ),
3060
+ status: zod
3061
+ .enum(["active", "draft"])
3062
+ .default(createFlowDefinitionBodyFlowDefinitionStatusDefault)
3063
+ .describe(
3064
+ "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",
3065
+ ),
3066
+ user_schema: zod
3067
+ .url()
3068
+ .describe(
3069
+ "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",
3070
+ ),
3071
+ purposes: zod
3072
+ .record(zod.string(), zod.string())
3073
+ .describe(
3074
+ "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",
3075
+ ),
3076
+ audience: zod
3077
+ .object({
3078
+ team_ids: zod
3079
+ .array(zod.string())
3080
+ .optional()
3081
+ .describe(
3082
+ "Restrict to specific teams (organizations). Empty means no team restriction.",
3083
+ ),
3084
+ app_ids: zod
3085
+ .array(zod.string())
3086
+ .optional()
3087
+ .describe("Restrict to specific applications. Empty means no app restriction."),
3088
+ })
3089
+ .optional()
3090
+ .describe(
3091
+ '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',
3092
+ ),
3093
+ steps: zod
3094
+ .array(
3095
+ zod
3096
+ .object({
3097
+ name: zod
3098
+ .string()
3099
+ .describe(
3100
+ "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3101
+ ),
3102
+ fields: zod
3103
+ .array(zod.string())
3104
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault)
3105
+ .describe(
3106
+ "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",
3107
+ ),
3108
+ actions: zod
3109
+ .array(
3110
+ zod
3111
+ .object({
3112
+ name: zod
3113
+ .string()
3114
+ .describe(
3115
+ "Action identifier. Sent back in the submit request as `action`.",
3116
+ ),
3117
+ kind: zod
3118
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3119
+ .describe(
3120
+ "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",
3121
+ ),
3122
+ primary: zod
3123
+ .boolean()
3124
+ .default(
3125
+ createFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault,
3126
+ )
3127
+ .describe(
3128
+ "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",
3129
+ ),
3130
+ text_key: zod
3131
+ .string()
3132
+ .optional()
3133
+ .describe(
3134
+ "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",
3135
+ ),
3136
+ })
3137
+ .describe(
3138
+ "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",
3139
+ ),
3140
+ )
3141
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault)
3142
+ .describe(
3143
+ "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",
3144
+ ),
3145
+ gates: zod
3146
+ .record(
3147
+ zod.string(),
3148
+ zod
3149
+ .object({
3150
+ kind: zod
3151
+ .enum(["captcha"])
3152
+ .describe(
3153
+ "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",
3154
+ ),
3155
+ provider: zod
3156
+ .string()
3157
+ .describe(
3158
+ "Provider identifier within the gate kind — e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
3159
+ ),
3160
+ config: zod
3161
+ .record(zod.string(), zod.unknown())
3162
+ .optional()
3163
+ .describe(
3164
+ "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3165
+ ),
3166
+ })
3167
+ .describe(
3168
+ "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",
3169
+ ),
3170
+ )
3171
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault)
3172
+ .describe(
3173
+ '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',
3174
+ ),
3175
+ sso_providers: zod
3176
+ .array(
3177
+ zod
3178
+ .object({
3179
+ id: zod.string().describe("Provider instance identifier."),
3180
+ name: zod.string().describe("Display name for the provider."),
3181
+ template: zod
3182
+ .string()
3183
+ .describe("Template hint for rendering (logo, colors)."),
3184
+ })
3185
+ .describe("An available SSO identity provider."),
3186
+ )
3187
+ .default(createFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault)
3188
+ .describe("Available SSO identity providers for this step."),
3189
+ on_success: zod
3190
+ .enum(["create_user"])
3191
+ .optional()
3192
+ .describe(
3193
+ "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",
3194
+ ),
3195
+ complete: zod
3196
+ .enum(["redirect", "show"])
3197
+ .optional()
3198
+ .describe(
3199
+ "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",
3200
+ ),
3201
+ transitions: zod
3202
+ .record(
3203
+ zod.string(),
3204
+ zod.object({
3205
+ target: zod
3126
3206
  .string()
3127
3207
  .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",
3208
+ "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
3129
3209
  ),
3130
- config: zod
3131
- .record(zod.string(), zod.unknown())
3210
+ action: zod
3211
+ .union([zod.enum(["switch", "pivot"]), zod.null()])
3132
3212
  .optional()
3133
3213
  .describe(
3134
- "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3214
+ "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
3215
  ),
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
- });
3216
+ }),
3217
+ )
3218
+ .optional()
3219
+ .describe(
3220
+ "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",
3221
+ ),
3222
+ })
3223
+ .describe(
3224
+ "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",
3225
+ ),
3226
+ )
3227
+ .min(1)
3228
+ .describe(
3229
+ "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
3230
+ ),
3231
+ })
3232
+ .describe(
3233
+ "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",
3234
+ ),
3235
+ })
3236
+ .describe(
3237
+ "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",
3238
+ );
3206
3239
 
3207
3240
  /**
3208
3241
  * Retrieves a list of all flow definitions.
@@ -3241,6 +3274,7 @@ export const ListFlowDefinitionsQueryParams = zod.strictObject({
3241
3274
  export const listFlowDefinitionsResponseFlowDefinitionsItemNameRegExp = new RegExp(
3242
3275
  "^[a-z][a-z0-9-]\*$",
3243
3276
  );
3277
+ export const listFlowDefinitionsResponseFlowDefinitionsItemStatusDefault = `active`;
3244
3278
 
3245
3279
  export const ListFlowDefinitionsResponse = zod.object({
3246
3280
  flow_definitions: zod.array(
@@ -3260,7 +3294,12 @@ export const ListFlowDefinitionsResponse = zod.object({
3260
3294
  .describe(
3261
3295
  "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
3296
  ),
3263
- status: zod.string().describe("Status of the flow definition."),
3297
+ status: zod
3298
+ .enum(["active", "draft"])
3299
+ .default(listFlowDefinitionsResponseFlowDefinitionsItemStatusDefault)
3300
+ .describe(
3301
+ "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",
3302
+ ),
3264
3303
  created_at: zod.iso
3265
3304
  .datetime({ offset: true })
3266
3305
  .describe("Timestamp when the flow definition was created."),
@@ -3295,7 +3334,9 @@ export const GetFlowDefinitionQueryParams = zod.strictObject({
3295
3334
  .describe("The project id to filter by."),
3296
3335
  });
3297
3336
 
3337
+ export const getFlowDefinitionResponseStatusDefault = `active`;
3298
3338
  export const getFlowDefinitionResponseFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
3339
+ export const getFlowDefinitionResponseFlowDefinitionStatusDefault = `active`;
3299
3340
  export const getFlowDefinitionResponseFlowDefinitionStepsItemFieldsDefault = [];
3300
3341
  export const getFlowDefinitionResponseFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
3301
3342
  export const getFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault = [];
@@ -3305,7 +3346,12 @@ export const getFlowDefinitionResponseFlowDefinitionStepsItemSsoProvidersDefault
3305
3346
  export const GetFlowDefinitionResponse = zod.object({
3306
3347
  id: zod.string().describe("Unique identifier for the flow definition."),
3307
3348
  project_id: zod.string().describe("Identifier of the project this flow definition belongs to."),
3308
- status: zod.string().describe("Status of the flow definition."),
3349
+ status: zod
3350
+ .enum(["active", "draft"])
3351
+ .default(getFlowDefinitionResponseStatusDefault)
3352
+ .describe(
3353
+ "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",
3354
+ ),
3309
3355
  flow_definition: zod
3310
3356
  .object({
3311
3357
  name: zod
@@ -3314,6 +3360,12 @@ export const GetFlowDefinitionResponse = zod.object({
3314
3360
  .describe(
3315
3361
  "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
3362
  ),
3363
+ status: zod
3364
+ .enum(["active", "draft"])
3365
+ .default(getFlowDefinitionResponseFlowDefinitionStatusDefault)
3366
+ .describe(
3367
+ "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",
3368
+ ),
3317
3369
  user_schema: zod
3318
3370
  .url()
3319
3371
  .describe(
@@ -3365,6 +3417,11 @@ export const GetFlowDefinitionResponse = zod.object({
3365
3417
  .describe(
3366
3418
  "Action identifier. Sent back in the submit request as `action`.",
3367
3419
  ),
3420
+ kind: zod
3421
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3422
+ .describe(
3423
+ "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",
3424
+ ),
3368
3425
  primary: zod
3369
3426
  .boolean()
3370
3427
  .default(
@@ -3381,7 +3438,7 @@ export const GetFlowDefinitionResponse = zod.object({
3381
3438
  ),
3382
3439
  })
3383
3440
  .describe(
3384
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3441
+ "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
3442
  ),
3386
3443
  )
3387
3444
  .default(getFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault)
@@ -3483,7 +3540,9 @@ export const GetFlowDefinitionResponse = zod.object({
3483
3540
  });
3484
3541
 
3485
3542
  /**
3486
- * Update a flow definition by id
3543
+ * Update a flow definition by id. This endpoint replaces the existing flow definition.
3544
+ If `flow_definition.status` is omitted, the current status is preserved
3545
+
3487
3546
  * @summary Update a flow definition by id
3488
3547
  */
3489
3548
  export const UpdateFlowDefinitionParams = zod.object({
@@ -3499,175 +3558,215 @@ export const UpdateFlowDefinitionQueryParams = zod.strictObject({
3499
3558
  .describe("The project id to filter by."),
3500
3559
  });
3501
3560
 
3502
- export const updateFlowDefinitionBodyStepsItemFieldsDefault = [];
3503
- export const updateFlowDefinitionBodyStepsItemActionsItemPrimaryDefault = false;
3504
- export const updateFlowDefinitionBodyStepsItemActionsDefault = [];
3505
- export const updateFlowDefinitionBodyStepsItemGatesDefault = {} as const;
3506
- export const updateFlowDefinitionBodyStepsItemSsoProvidersDefault = [];
3561
+ export const updateFlowDefinitionBodyFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
3562
+ export const updateFlowDefinitionBodyFlowDefinitionStatusDefault = `active`;
3563
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault = [];
3564
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
3565
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault = [];
3566
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault = {} as const;
3567
+ export const updateFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault = [];
3507
3568
 
3508
3569
  export const UpdateFlowDefinitionBody = zod
3509
3570
  .object({
3510
- user_schema: zod
3571
+ schema_uri: zod
3511
3572
  .url()
3512
3573
  .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
3574
  .describe(
3518
- "Replaces the full purpose-to-entry-step map if provided. Keys are\npurpose names; values must match a `name` in `steps`.\n",
3575
+ "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
3576
  ),
3520
- audience: zod
3577
+ flow_definition: zod
3521
3578
  .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
3579
+ name: zod
3580
+ .string()
3581
+ .regex(updateFlowDefinitionBodyFlowDefinitionNameRegExp)
3582
+ .describe(
3583
+ "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",
3584
+ ),
3585
+ status: zod
3586
+ .enum(["active", "draft"])
3587
+ .default(updateFlowDefinitionBodyFlowDefinitionStatusDefault)
3588
+ .describe(
3589
+ "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",
3590
+ ),
3591
+ user_schema: zod
3592
+ .url()
3593
+ .describe(
3594
+ "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",
3595
+ ),
3596
+ purposes: zod
3597
+ .record(zod.string(), zod.string())
3598
+ .describe(
3599
+ "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",
3600
+ ),
3601
+ audience: zod
3538
3602
  .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
3603
+ team_ids: zod
3545
3604
  .array(zod.string())
3546
- .default(updateFlowDefinitionBodyStepsItemFieldsDefault)
3605
+ .optional()
3547
3606
  .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",
3607
+ "Restrict to specific teams (organizations). Empty means no team restriction.",
3549
3608
  ),
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
- })
3609
+ app_ids: zod
3610
+ .array(zod.string())
3611
+ .optional()
3612
+ .describe("Restrict to specific applications. Empty means no app restriction."),
3613
+ })
3614
+ .optional()
3615
+ .describe(
3616
+ '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',
3617
+ ),
3618
+ steps: zod
3619
+ .array(
3620
+ zod
3621
+ .object({
3622
+ name: zod
3623
+ .string()
3570
3624
  .describe(
3571
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3625
+ "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3572
3626
  ),
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()
3627
+ fields: zod
3628
+ .array(zod.string())
3629
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemFieldsDefault)
3630
+ .describe(
3631
+ "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",
3632
+ ),
3633
+ actions: zod
3634
+ .array(
3635
+ zod
3636
+ .object({
3637
+ name: zod
3638
+ .string()
3639
+ .describe(
3640
+ "Action identifier. Sent back in the submit request as `action`.",
3641
+ ),
3642
+ kind: zod
3643
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3644
+ .describe(
3645
+ "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",
3646
+ ),
3647
+ primary: zod
3648
+ .boolean()
3649
+ .default(
3650
+ updateFlowDefinitionBodyFlowDefinitionStepsItemActionsItemPrimaryDefault,
3651
+ )
3652
+ .describe(
3653
+ "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",
3654
+ ),
3655
+ text_key: zod
3656
+ .string()
3657
+ .optional()
3658
+ .describe(
3659
+ "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",
3660
+ ),
3661
+ })
3590
3662
  .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",
3663
+ "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
3664
  ),
3593
- config: zod
3594
- .record(zod.string(), zod.unknown())
3595
- .optional()
3665
+ )
3666
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemActionsDefault)
3667
+ .describe(
3668
+ "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",
3669
+ ),
3670
+ gates: zod
3671
+ .record(
3672
+ zod.string(),
3673
+ zod
3674
+ .object({
3675
+ kind: zod
3676
+ .enum(["captcha"])
3677
+ .describe(
3678
+ "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",
3679
+ ),
3680
+ provider: zod
3681
+ .string()
3682
+ .describe(
3683
+ "Provider identifier within the gate kind — e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
3684
+ ),
3685
+ config: zod
3686
+ .record(zod.string(), zod.unknown())
3687
+ .optional()
3688
+ .describe(
3689
+ "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3690
+ ),
3691
+ })
3596
3692
  .describe(
3597
- "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
3693
+ "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
3694
  ),
3599
- })
3695
+ )
3696
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemGatesDefault)
3600
3697
  .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",
3698
+ '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
3699
  ),
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()
3700
+ sso_providers: zod
3701
+ .array(
3702
+ zod
3703
+ .object({
3704
+ id: zod.string().describe("Provider instance identifier."),
3705
+ name: zod.string().describe("Display name for the provider."),
3706
+ template: zod
3707
+ .string()
3708
+ .describe("Template hint for rendering (logo, colors)."),
3709
+ })
3710
+ .describe("An available SSO identity provider."),
3711
+ )
3712
+ .default(updateFlowDefinitionBodyFlowDefinitionStepsItemSsoProvidersDefault)
3713
+ .describe("Available SSO identity providers for this step."),
3714
+ on_success: zod
3715
+ .enum(["create_user"])
3716
+ .optional()
3717
+ .describe(
3718
+ "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",
3719
+ ),
3720
+ complete: zod
3721
+ .enum(["redirect", "show"])
3722
+ .optional()
3723
+ .describe(
3724
+ "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",
3725
+ ),
3726
+ transitions: zod
3727
+ .record(
3728
+ zod.string(),
3729
+ zod.object({
3730
+ target: zod
3731
+ .string()
3732
+ .describe(
3733
+ "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
3734
+ ),
3735
+ action: zod
3736
+ .union([zod.enum(["switch", "pivot"]), zod.null()])
3737
+ .optional()
3738
+ .describe(
3739
+ "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",
3740
+ ),
3741
+ }),
3742
+ )
3743
+ .optional()
3744
+ .describe(
3745
+ "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",
3746
+ ),
3747
+ })
3650
3748
  .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",
3749
+ "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
3750
  ),
3653
- })
3751
+ )
3752
+ .min(1)
3654
3753
  .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",
3754
+ "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
3656
3755
  ),
3657
- )
3658
- .min(1)
3659
- .optional()
3756
+ })
3660
3757
  .describe(
3661
- "Replaces the full steps array if provided. Partial step lists are not\nsupportedsupply all steps when updating this field.\n",
3758
+ "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
3759
  ),
3663
3760
  })
3664
3761
  .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",
3762
+ "Replaces the existing flow definition.\nIf `flow_definition.status` is omitted, the current status is preserved\n",
3666
3763
  );
3667
3764
 
3765
+ export const updateFlowDefinitionResponseStatusDefault = `active`;
3668
3766
  export const updateFlowDefinitionResponseFlowDefinitionNameRegExp = new RegExp(
3669
3767
  "^[a-z][a-z0-9-]\*$",
3670
3768
  );
3769
+ export const updateFlowDefinitionResponseFlowDefinitionStatusDefault = `active`;
3671
3770
  export const updateFlowDefinitionResponseFlowDefinitionStepsItemFieldsDefault = [];
3672
3771
  export const updateFlowDefinitionResponseFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
3673
3772
  export const updateFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault = [];
@@ -3677,7 +3776,12 @@ export const updateFlowDefinitionResponseFlowDefinitionStepsItemSsoProvidersDefa
3677
3776
  export const UpdateFlowDefinitionResponse = zod.object({
3678
3777
  id: zod.string().describe("Unique identifier for the flow definition."),
3679
3778
  project_id: zod.string().describe("Identifier of the project this flow definition belongs to."),
3680
- status: zod.string().describe("Status of the flow definition."),
3779
+ status: zod
3780
+ .enum(["active", "draft"])
3781
+ .default(updateFlowDefinitionResponseStatusDefault)
3782
+ .describe(
3783
+ "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",
3784
+ ),
3681
3785
  flow_definition: zod
3682
3786
  .object({
3683
3787
  name: zod
@@ -3686,6 +3790,12 @@ export const UpdateFlowDefinitionResponse = zod.object({
3686
3790
  .describe(
3687
3791
  "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
3792
  ),
3793
+ status: zod
3794
+ .enum(["active", "draft"])
3795
+ .default(updateFlowDefinitionResponseFlowDefinitionStatusDefault)
3796
+ .describe(
3797
+ "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",
3798
+ ),
3689
3799
  user_schema: zod
3690
3800
  .url()
3691
3801
  .describe(
@@ -3737,6 +3847,11 @@ export const UpdateFlowDefinitionResponse = zod.object({
3737
3847
  .describe(
3738
3848
  "Action identifier. Sent back in the submit request as `action`.",
3739
3849
  ),
3850
+ kind: zod
3851
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
3852
+ .describe(
3853
+ "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",
3854
+ ),
3740
3855
  primary: zod
3741
3856
  .boolean()
3742
3857
  .default(
@@ -3753,7 +3868,7 @@ export const UpdateFlowDefinitionResponse = zod.object({
3753
3868
  ),
3754
3869
  })
3755
3870
  .describe(
3756
- "Configuration for a user-invokable action on a step. The `name` is sent\nback in the submit request as `action`.\n",
3871
+ "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
3872
  ),
3758
3873
  )
3759
3874
  .default(updateFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault)
@@ -3855,7 +3970,10 @@ export const UpdateFlowDefinitionResponse = zod.object({
3855
3970
  });
3856
3971
 
3857
3972
  /**
3858
- * Delete a flow definition by id
3973
+ * Delete a flow definition by id.
3974
+ If the flow definition is currently being used by a flow, the deletion will fail.
3975
+ 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.
3976
+
3859
3977
  * @summary Delete a flow definition by id
3860
3978
  */
3861
3979
  export const DeleteFlowDefinitionParams = zod.object({
@@ -3871,6 +3989,45 @@ export const DeleteFlowDefinitionQueryParams = zod.strictObject({
3871
3989
  .describe("The project id to filter by."),
3872
3990
  });
3873
3991
 
3992
+ /**
3993
+ * Activate a flow definition by transitioning it from a `draft` state to an `active` state.
3994
+ 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.
3995
+
3996
+ * @summary Activate a flow definition by ID.
3997
+ */
3998
+ export const ActivateFlowDefinitionParams = zod.object({
3999
+ id: zod.string().describe("The id returned by the POST \/flow_definitions endpoint.\n"),
4000
+ });
4001
+
4002
+ export const activateFlowDefinitionQueryProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
4003
+
4004
+ export const ActivateFlowDefinitionQueryParams = zod.strictObject({
4005
+ project_id: zod
4006
+ .string()
4007
+ .regex(activateFlowDefinitionQueryProjectIdRegExp)
4008
+ .describe("The unique identifier of the project"),
4009
+ });
4010
+
4011
+ /**
4012
+ * Deactivates a flow definition in the `active` state by transitioning it to the `draft` state.
4013
+ Flow definitions in `draft` state cannot be used to start new flows. Existing flows that use the deactivated flow definition must gracefully handle this.
4014
+ 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.
4015
+
4016
+ * @summary Deactivate a flow definition by ID.
4017
+ */
4018
+ export const DeactivateFlowDefinitionParams = zod.object({
4019
+ id: zod.string().describe("The id returned by the POST \/flow_definitions endpoint.\n"),
4020
+ });
4021
+
4022
+ export const deactivateFlowDefinitionQueryProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
4023
+
4024
+ export const DeactivateFlowDefinitionQueryParams = zod.strictObject({
4025
+ project_id: zod
4026
+ .string()
4027
+ .regex(deactivateFlowDefinitionQueryProjectIdRegExp)
4028
+ .describe("The unique identifier of the project"),
4029
+ });
4030
+
3874
4031
  /**
3875
4032
  * @summary Create team
3876
4033
  */