@zitadel/api 1.0.0-alpha.21 → 1.0.0-alpha.22

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 +75 -4
  3. package/dist/generated/endpoints/zitadelNextGen.mjs.map +1 -1
  4. package/dist/generated/endpoints/zitadelNextGen.msw.d.mts +6 -2
  5. package/dist/generated/endpoints/zitadelNextGen.msw.d.mts.map +1 -1
  6. package/dist/generated/endpoints/zitadelNextGen.msw.mjs +622 -1
  7. package/dist/generated/endpoints/zitadelNextGen.msw.mjs.map +1 -1
  8. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts +380 -24
  9. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts.map +1 -1
  10. package/dist/generated/endpoints/zitadelNextGen.zod.mjs +370 -39
  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 +54 -1
  14. package/dist/generated/model/index.mjs.map +1 -1
  15. package/dist/{index-BK4Q468Q.d.mts → index-DtExHu2p.d.mts} +1452 -140
  16. package/dist/index-DtExHu2p.d.mts.map +1 -0
  17. package/dist/runtime/api-factory.d.mts +1 -1
  18. package/dist/{zitadelNextGen-C8m49W5h.d.mts → zitadelNextGen-C79YSuEo.d.mts} +45 -7
  19. package/dist/zitadelNextGen-C79YSuEo.d.mts.map +1 -0
  20. package/package.json +1 -1
  21. package/src/generated/endpoints/zitadelNextGen.msw.ts +759 -55
  22. package/src/generated/endpoints/zitadelNextGen.ts +98 -3
  23. package/src/generated/endpoints/zitadelNextGen.zod.ts +1199 -422
  24. package/src/generated/model/completeClaim410.ts +21 -16
  25. package/src/generated/model/createFlowDefinition201FlowDefinition.ts +5 -3
  26. package/src/generated/model/createFlowDefinitionBodyFlowDefinition.ts +5 -3
  27. package/src/generated/model/createFlowDefinitionDefault.ts +0 -10
  28. package/src/generated/model/createGrant201.ts +32 -0
  29. package/src/generated/model/createGrant201Principal.ts +147 -0
  30. package/src/generated/model/createGrant201Team.ts +22 -0
  31. package/src/generated/model/createGrant201User.ts +38 -0
  32. package/src/generated/model/createSession201Session.ts +1 -0
  33. package/src/generated/model/createSession201SessionUser.ts +1 -0
  34. package/src/generated/model/exchangeHandoff200Session.ts +1 -0
  35. package/src/generated/model/exchangeHandoff200SessionUser.ts +1 -0
  36. package/src/generated/model/getClaimStatus410.ts +21 -16
  37. package/src/generated/model/getClaimWindow200.ts +23 -0
  38. package/src/generated/model/{createFlowDefinition409.ts → getClaimWindow404.ts} +3 -3
  39. package/src/generated/model/{createFlowDefinition409Details.ts → getClaimWindow404Details.ts} +1 -1
  40. package/src/generated/model/getClaimWindow429.ts +20 -0
  41. package/src/generated/model/getClaimWindow429Details.ts +12 -0
  42. package/src/generated/model/getClaimWindowDefault.ts +20 -0
  43. package/src/generated/model/getClaimWindowDefaultDetails.ts +12 -0
  44. package/src/generated/model/getClaimWindowParams.ts +15 -0
  45. package/src/generated/model/getEvent200.ts +75 -0
  46. package/src/generated/model/getFlowDefinition200FlowDefinition.ts +5 -3
  47. package/src/generated/model/getGrant200.ts +32 -0
  48. package/src/generated/model/getGrant200Principal.ts +147 -0
  49. package/src/generated/model/getGrant200Team.ts +22 -0
  50. package/src/generated/model/getGrant200User.ts +38 -0
  51. package/src/generated/model/getMySession200.ts +1 -0
  52. package/src/generated/model/getMySession200User.ts +1 -0
  53. package/src/generated/model/getSession200.ts +1 -0
  54. package/src/generated/model/getSession200User.ts +1 -0
  55. package/src/generated/model/index.ts +39 -2
  56. package/src/generated/model/initClaim410.ts +24 -0
  57. package/src/generated/model/listEvents200DataItem.ts +75 -0
  58. package/src/generated/model/listFlowDefinitions200.ts +3 -0
  59. package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinition.ts +5 -3
  60. package/src/generated/model/listFlowDefinitionsParams.ts +8 -0
  61. package/src/generated/model/queryGrants200.ts +20 -0
  62. package/src/generated/model/queryGrants200GrantsItem.ts +66 -0
  63. package/src/generated/model/queryGrants200GrantsItemObjectType.ts +17 -0
  64. package/src/generated/model/queryGrants200GrantsItemPrincipal.ts +147 -0
  65. package/src/generated/model/queryGrants200GrantsItemPrincipalType.ts +18 -0
  66. package/src/generated/model/queryGrants200GrantsItemRelation.ts +19 -0
  67. package/src/generated/model/queryGrants200GrantsItemTeam.ts +22 -0
  68. package/src/generated/model/queryGrants200GrantsItemUser.ts +38 -0
  69. package/src/generated/model/queryGrants400.ts +20 -0
  70. package/src/generated/model/queryGrants400Details.ts +12 -0
  71. package/src/generated/model/queryGrants401.ts +20 -0
  72. package/src/generated/model/queryGrants401Details.ts +12 -0
  73. package/src/generated/model/queryGrants403.ts +20 -0
  74. package/src/generated/model/queryGrants403Details.ts +12 -0
  75. package/src/generated/model/queryGrantsBody.ts +33 -0
  76. package/src/generated/model/queryGrantsBodyExpandItem.ts +30 -0
  77. package/src/generated/model/queryGrantsBodyFilterItem.ts +33 -0
  78. package/src/generated/model/queryGrantsBodyFilterItemField.ts +27 -0
  79. package/src/generated/model/queryGrantsBodyFilterItemOperation.ts +30 -0
  80. package/src/generated/model/queryGrantsBodySorting.ts +17 -0
  81. package/src/generated/model/queryGrantsBodySortingDirection.ts +15 -0
  82. package/src/generated/model/queryGrantsBodySortingField.ts +21 -0
  83. package/src/generated/model/queryGrantsDefault.ts +99 -0
  84. package/src/generated/model/queryGrantsParams.ts +15 -0
  85. package/src/generated/model/querySessions200SessionsItem.ts +1 -0
  86. package/src/generated/model/querySessions200SessionsItemUser.ts +1 -0
  87. package/src/generated/model/updateFlowDefinition200FlowDefinition.ts +5 -3
  88. package/src/generated/model/updateFlowDefinitionBodyFlowDefinition.ts +5 -3
  89. package/dist/index-BK4Q468Q.d.mts.map +0 -1
  90. package/dist/zitadelNextGen-C8m49W5h.d.mts.map +0 -1
@@ -2245,7 +2245,11 @@ export const InitClaimParams = zod.object({
2245
2245
  * Polled by the CLI while a browser completes the claim. Authorized by the
2246
2246
  project secret that initiated the challenge. Returns `pending`, or
2247
2247
  `completed` with the owning team, the claim timestamp, and the dashboard
2248
- URL once the browser leg has finished.
2248
+ URL once the project is claimed. The claim grant, not the polled
2249
+ challenge, is the source of truth: a project claimed through another
2250
+ concurrent challenge also reports `completed`, and a completed claim
2251
+ keeps reporting `completed` past this challenge's expiry and past the
2252
+ project's claim window.
2249
2253
 
2250
2254
  * @summary Get claim status
2251
2255
  */
@@ -2328,6 +2332,46 @@ export const CompleteClaimResponse = zod
2328
2332
  })
2329
2333
  .describe("The result of a completed project claim.");
2330
2334
 
2335
+ /**
2336
+ * Read by the claim page in the browser to show how long is left to claim the
2337
+ project. Unauthenticated by design: the claim page runs this before the
2338
+ developer has signed in, and holding the `challenge_id` from the claim URL
2339
+ is the authorization — the same capability `claim/complete` accepts. It
2340
+ reveals only the window, never the project itself, and unlike
2341
+ `claim/complete` it spends nothing, so a reload is free.
2342
+
2343
+ * @summary Get the claim window for a project
2344
+ */
2345
+ export const getClaimWindowPathProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
2346
+
2347
+ export const GetClaimWindowParams = zod.object({
2348
+ project_id: zod.string().regex(getClaimWindowPathProjectIdRegExp),
2349
+ });
2350
+
2351
+ export const getClaimWindowQueryChallengeIdRegExp = new RegExp("^ch_[a-zA-Z0-9_-]+$");
2352
+
2353
+ export const GetClaimWindowQueryParams = zod.strictObject({
2354
+ challenge_id: zod
2355
+ .string()
2356
+ .regex(getClaimWindowQueryChallengeIdRegExp)
2357
+ .describe("The challenge from the claim URL."),
2358
+ });
2359
+
2360
+ export const GetClaimWindowResponse = zod
2361
+ .object({
2362
+ expires_at: zod.iso
2363
+ .datetime({ offset: true })
2364
+ .describe("The time when the project's claim window closes."),
2365
+ expired: zod
2366
+ .boolean()
2367
+ .describe(
2368
+ "Whether the window has already closed. Reported alongside `expires_at`\nrather than left to the client so a skewed browser clock cannot show a\nclaimable project as expired, or the reverse.\n",
2369
+ ),
2370
+ })
2371
+ .describe(
2372
+ "How long the project can still be claimed. Derived from the project's\ncreation time and the fixed 14-day claim window (ADR 046); it does not\ndepend on the challenge, which has its own much shorter expiry.\n",
2373
+ );
2374
+
2331
2375
  /**
2332
2376
  * Creates an anonymous session shell with no user and no factors (`state: building`).
2333
2377
 
@@ -2505,7 +2549,7 @@ export const QuerySessionsResponse = zod
2505
2549
  })
2506
2550
  .optional()
2507
2551
  .describe(
2508
- "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\n",
2552
+ "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\nMissing or deleted users degrade to `user_id` only.\n",
2509
2553
  ),
2510
2554
  factors: zod
2511
2555
  .array(
@@ -2721,7 +2765,7 @@ export const ExchangeHandoffResponse = zod
2721
2765
  })
2722
2766
  .optional()
2723
2767
  .describe(
2724
- "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\n",
2768
+ "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\nMissing or deleted users degrade to `user_id` only.\n",
2725
2769
  ),
2726
2770
  factors: zod
2727
2771
  .array(
@@ -2891,7 +2935,7 @@ export const GetSessionResponse = zod
2891
2935
  })
2892
2936
  .optional()
2893
2937
  .describe(
2894
- "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\n",
2938
+ "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\nMissing or deleted users degrade to `user_id` only.\n",
2895
2939
  ),
2896
2940
  factors: zod
2897
2941
  .array(
@@ -3065,7 +3109,7 @@ export const GetMySessionResponse = zod
3065
3109
  })
3066
3110
  .optional()
3067
3111
  .describe(
3068
- "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\n",
3112
+ "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\nMissing or deleted users degrade to `user_id` only.\n",
3069
3113
  ),
3070
3114
  factors: zod
3071
3115
  .array(
@@ -3638,12 +3682,17 @@ export const GetSchemaByIdResponse = zod
3638
3682
  );
3639
3683
 
3640
3684
  /**
3641
- * Creates a new flow definition.
3685
+ * Publishes a new flow definition revision.
3642
3686
  Flow definitions are templates that define the sequence of steps (capabilities)
3643
3687
  for a particular user journey (e.g., registration, login, password reset).
3644
3688
 
3645
3689
  Flow definitions are created based on the flow definition schema, which includes the flow's purpose, audience, and the steps involved.
3646
3690
 
3691
+ Every call allocates a new opaque id. Revisions of one flow share its
3692
+ `name`; posting a definition under an existing `name` publishes a new
3693
+ revision of that flow, it is not a conflict. List with `name` to see a
3694
+ flow's revisions, newest by creation time first.
3695
+
3647
3696
  * @summary Create a new flow definition
3648
3697
  */
3649
3698
  export const createFlowDefinitionBodyProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
@@ -3669,7 +3718,7 @@ export const CreateFlowDefinitionBody = zod
3669
3718
  .string()
3670
3719
  .regex(createFlowDefinitionBodyFlowDefinitionNameRegExp)
3671
3720
  .describe(
3672
- "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",
3721
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Every revision of a flow shares its\n`name`; publishing a definition under an existing `name` adds a\nrevision to that flow. Renaming is not supported — the `name` is part\nof the public contract another definition may reference. Acts as the\nhuman display label as well; no separate slug.\n",
3673
3722
  ),
3674
3723
  status: zod
3675
3724
  .enum(["active", "draft"])
@@ -3867,8 +3916,9 @@ export const CreateFlowDefinitionBody = zod
3867
3916
  );
3868
3917
 
3869
3918
  /**
3870
- * Retrieves a list of all flow definitions.
3919
+ * Retrieves a list of all flow definitions, newest by creation time first.
3871
3920
  This endpoint can be used to view existing flow definitions and their configurations.
3921
+ Filter by `name` to list the revisions of one flow.
3872
3922
 
3873
3923
  * @summary List flow definitions
3874
3924
  */
@@ -3876,6 +3926,7 @@ export const listFlowDefinitionsQueryLimitDefault = 20;
3876
3926
  export const listFlowDefinitionsQueryLimitMax = 100;
3877
3927
 
3878
3928
  export const listFlowDefinitionsQueryProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
3929
+ export const listFlowDefinitionsQueryNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
3879
3930
 
3880
3931
  export const ListFlowDefinitionsQueryParams = zod.strictObject({
3881
3932
  limit: zod
@@ -3898,6 +3949,13 @@ export const ListFlowDefinitionsQueryParams = zod.strictObject({
3898
3949
  .enum(["login", "register", "recovery", "profiling", "reauth", "link_account"])
3899
3950
  .optional()
3900
3951
  .describe("Filter flow definitions by purpose (e.g., registration, login)."),
3952
+ name: zod
3953
+ .string()
3954
+ .regex(listFlowDefinitionsQueryNameRegExp)
3955
+ .optional()
3956
+ .describe(
3957
+ "The flow name to filter by. Every revision of a flow shares its\n`name`, so the result is that flow's revisions, newest by creation\ntime first.\n",
3958
+ ),
3901
3959
  expand: zod
3902
3960
  .array(
3903
3961
  zod
@@ -3926,397 +3984,401 @@ export const listFlowDefinitionsResponseFlowDefinitionsItemUserSchemaOneSchemaOn
3926
3984
 
3927
3985
  export const listFlowDefinitionsResponseFlowDefinitionsItemUserSchemaOneSchemaOnePropertiesXAuditDefault = false;
3928
3986
 
3929
- export const ListFlowDefinitionsResponse = zod.object({
3930
- flow_definitions: zod.array(
3931
- zod.object({
3932
- id: zod.string().describe("Unique identifier for the flow definition."),
3933
- project_id: zod
3934
- .string()
3935
- .describe("Identifier of the project this flow definition belongs to."),
3936
- flow_definition: zod
3937
- .object({
3938
- name: zod
3939
- .string()
3940
- .regex(listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionNameRegExp)
3941
- .describe(
3942
- "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",
3943
- ),
3944
- status: zod
3945
- .enum(["active", "draft"])
3946
- .describe(
3947
- "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",
3948
- ),
3949
- user_schema: zod
3950
- .string()
3951
- .describe(
3952
- "Server-assigned identifier of the user schema this flow operates on,\nas returned by `POST \/schemas`. Opaque to the client — the shape is a\nserver implementation detail. Step `fields` reference properties\ndefined in the resolved schema; the engine resolves field types, validation, and\nimplicit outcomes from schema annotations at runtime.\n",
3953
- ),
3954
- purposes: zod
3955
- .record(zod.string(), zod.string())
3956
- .describe(
3957
- "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",
3958
- ),
3959
- audience: zod
3960
- .object({
3961
- team_ids: zod
3962
- .array(zod.string())
3963
- .optional()
3964
- .describe(
3965
- "Restrict to specific teams (organizations). Empty means no team restriction.",
3966
- ),
3967
- app_ids: zod
3968
- .array(zod.string())
3969
- .optional()
3970
- .describe("Restrict to specific applications. Empty means no app restriction."),
3971
- })
3972
- .optional()
3973
- .describe(
3974
- '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',
3975
- ),
3976
- steps: zod
3977
- .array(
3978
- zod
3979
- .object({
3980
- name: zod
3981
- .string()
3982
- .describe(
3983
- "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
3984
- ),
3985
- fields: zod
3986
- .array(zod.string())
3987
- .default(
3988
- listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemFieldsDefault,
3989
- )
3990
- .describe(
3991
- "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",
3992
- ),
3993
- actions: zod
3994
- .array(
3995
- zod
3996
- .object({
3997
- name: zod
3987
+ export const ListFlowDefinitionsResponse = zod
3988
+ .object({
3989
+ flow_definitions: zod.array(
3990
+ zod.object({
3991
+ id: zod.string().describe("Unique identifier for the flow definition."),
3992
+ project_id: zod
3993
+ .string()
3994
+ .describe("Identifier of the project this flow definition belongs to."),
3995
+ flow_definition: zod
3996
+ .object({
3997
+ name: zod
3998
+ .string()
3999
+ .regex(listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionNameRegExp)
4000
+ .describe(
4001
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Every revision of a flow shares its\n`name`; publishing a definition under an existing `name` adds a\nrevision to that flow. Renaming is not supported — the `name` is part\nof the public contract another definition may reference. Acts as the\nhuman display label as well; no separate slug.\n",
4002
+ ),
4003
+ status: zod
4004
+ .enum(["active", "draft"])
4005
+ .describe(
4006
+ "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",
4007
+ ),
4008
+ user_schema: zod
4009
+ .string()
4010
+ .describe(
4011
+ "Server-assigned identifier of the user schema this flow operates on,\nas returned by `POST \/schemas`. Opaque to the client — the shape is a\nserver implementation detail. Step `fields` reference properties\ndefined in the resolved schema; the engine resolves field types, validation, and\nimplicit outcomes from schema annotations at runtime.\n",
4012
+ ),
4013
+ purposes: zod
4014
+ .record(zod.string(), zod.string())
4015
+ .describe(
4016
+ "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",
4017
+ ),
4018
+ audience: zod
4019
+ .object({
4020
+ team_ids: zod
4021
+ .array(zod.string())
4022
+ .optional()
4023
+ .describe(
4024
+ "Restrict to specific teams (organizations). Empty means no team restriction.",
4025
+ ),
4026
+ app_ids: zod
4027
+ .array(zod.string())
4028
+ .optional()
4029
+ .describe("Restrict to specific applications. Empty means no app restriction."),
4030
+ })
4031
+ .optional()
4032
+ .describe(
4033
+ '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',
4034
+ ),
4035
+ steps: zod
4036
+ .array(
4037
+ zod
4038
+ .object({
4039
+ name: zod
4040
+ .string()
4041
+ .describe(
4042
+ "Unique step identifier within this flow. Used as transition targets\nand returned in the API response as `step.name`.\n",
4043
+ ),
4044
+ fields: zod
4045
+ .array(zod.string())
4046
+ .default(
4047
+ listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemFieldsDefault,
4048
+ )
4049
+ .describe(
4050
+ "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",
4051
+ ),
4052
+ actions: zod
4053
+ .array(
4054
+ zod
4055
+ .object({
4056
+ name: zod
4057
+ .string()
4058
+ .describe(
4059
+ "Action identifier. Sent back in the submit request as `action`.",
4060
+ ),
4061
+ kind: zod
4062
+ .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
4063
+ .describe(
4064
+ "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",
4065
+ ),
4066
+ primary: zod
4067
+ .boolean()
4068
+ .default(
4069
+ listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemActionsItemPrimaryDefault,
4070
+ )
4071
+ .describe(
4072
+ "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",
4073
+ ),
4074
+ text_key: zod
4075
+ .string()
4076
+ .optional()
4077
+ .describe(
4078
+ "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",
4079
+ ),
4080
+ })
4081
+ .describe(
4082
+ "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",
4083
+ ),
4084
+ )
4085
+ .default(
4086
+ listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemActionsDefault,
4087
+ )
4088
+ .describe(
4089
+ "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",
4090
+ ),
4091
+ gates: zod
4092
+ .record(
4093
+ zod.string(),
4094
+ zod
4095
+ .object({
4096
+ kind: zod
4097
+ .enum(["captcha"])
4098
+ .describe(
4099
+ "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",
4100
+ ),
4101
+ provider: zod
4102
+ .string()
4103
+ .describe(
4104
+ "Provider identifier within the gate kind — e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
4105
+ ),
4106
+ config: zod
4107
+ .record(zod.string(), zod.unknown())
4108
+ .optional()
4109
+ .describe(
4110
+ "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
4111
+ ),
4112
+ })
4113
+ .describe(
4114
+ "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",
4115
+ ),
4116
+ )
4117
+ .default(
4118
+ listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemGatesDefault,
4119
+ )
4120
+ .describe(
4121
+ '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',
4122
+ ),
4123
+ sso_providers: zod
4124
+ .array(
4125
+ zod
4126
+ .object({
4127
+ id: zod.string().describe("Provider instance identifier."),
4128
+ name: zod.string().describe("Display name for the provider."),
4129
+ template: zod
4130
+ .string()
4131
+ .describe("Template hint for rendering (logo, colors)."),
4132
+ })
4133
+ .describe("An available SSO identity provider."),
4134
+ )
4135
+ .default(
4136
+ listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemSsoProvidersDefault,
4137
+ )
4138
+ .describe("Available SSO identity providers for this step."),
4139
+ on_success: zod
4140
+ .enum(["create_user"])
4141
+ .optional()
4142
+ .describe(
4143
+ "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",
4144
+ ),
4145
+ complete: zod
4146
+ .enum(["redirect", "show"])
4147
+ .optional()
4148
+ .describe(
4149
+ "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",
4150
+ ),
4151
+ transitions: zod
4152
+ .record(
4153
+ zod.string(),
4154
+ zod.object({
4155
+ target: zod
3998
4156
  .string()
3999
4157
  .describe(
4000
- "Action identifier. Sent back in the submit request as `action`.",
4001
- ),
4002
- kind: zod
4003
- .enum(["submit", "passkey", "passkey_register", "navigate", "back"])
4004
- .describe(
4005
- "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",
4006
- ),
4007
- primary: zod
4008
- .boolean()
4009
- .default(
4010
- listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemActionsItemPrimaryDefault,
4011
- )
4012
- .describe(
4013
- "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",
4158
+ "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
4014
4159
  ),
4015
- text_key: zod
4016
- .string()
4160
+ action: zod
4161
+ .union([zod.enum(["switch", "pivot"]), zod.null()])
4017
4162
  .optional()
4018
4163
  .describe(
4019
- "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",
4020
- ),
4021
- })
4022
- .describe(
4023
- "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",
4024
- ),
4025
- )
4026
- .default(
4027
- listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemActionsDefault,
4028
- )
4029
- .describe(
4030
- "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",
4031
- ),
4032
- gates: zod
4033
- .record(
4034
- zod.string(),
4035
- zod
4036
- .object({
4037
- kind: zod
4038
- .enum(["captcha"])
4039
- .describe(
4040
- "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",
4041
- ),
4042
- provider: zod
4043
- .string()
4044
- .describe(
4045
- "Provider identifier within the gate kind — e.g. `altcha`, `turnstile`,\n`hcaptcha`. The engine looks up an implementation in its provider\nregistry.\n",
4164
+ "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",
4046
4165
  ),
4047
- config: zod
4048
- .record(zod.string(), zod.unknown())
4166
+ purpose: zod
4167
+ .union([
4168
+ zod.enum([
4169
+ "login",
4170
+ "register",
4171
+ "recovery",
4172
+ "profiling",
4173
+ "reauth",
4174
+ "link_account",
4175
+ ]),
4176
+ zod.null(),
4177
+ ])
4049
4178
  .optional()
4050
4179
  .describe(
4051
- "Provider-specific configuration consumed by the implementation when\nissuing the per-render challenge. Opaque to the engine.\n",
4180
+ "Local re-purposing. When set, taking this transition changes the\nflow's current purpose to this value — the dispatch mode a step's\nchallenges run under — while the flow's original purpose stays\npinned. Must be a purpose this definition serves, and `target`\nmust be that purpose's entry step. Mutually exclusive with\n`action`: a transition either re-purposes within this flow or\ntargets another flow, never both.\nExample: a \"Sign up\" navigation on the login identifier step\n(`{ target: register, purpose: register }`).\n",
4052
4181
  ),
4053
- })
4054
- .describe(
4055
- "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",
4056
- ),
4057
- )
4058
- .default(
4059
- listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemGatesDefault,
4060
- )
4061
- .describe(
4062
- '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',
4063
- ),
4064
- sso_providers: zod
4065
- .array(
4066
- zod
4067
- .object({
4068
- id: zod.string().describe("Provider instance identifier."),
4069
- name: zod.string().describe("Display name for the provider."),
4070
- template: zod
4071
- .string()
4072
- .describe("Template hint for rendering (logo, colors)."),
4073
- })
4074
- .describe("An available SSO identity provider."),
4075
- )
4076
- .default(
4077
- listFlowDefinitionsResponseFlowDefinitionsItemFlowDefinitionStepsItemSsoProvidersDefault,
4078
- )
4079
- .describe("Available SSO identity providers for this step."),
4080
- on_success: zod
4081
- .enum(["create_user"])
4082
- .optional()
4083
- .describe(
4084
- "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",
4085
- ),
4086
- complete: zod
4087
- .enum(["redirect", "show"])
4088
- .optional()
4089
- .describe(
4090
- "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",
4091
- ),
4092
- transitions: zod
4093
- .record(
4094
- zod.string(),
4095
- zod.object({
4096
- target: zod
4097
- .string()
4098
- .describe(
4099
- "Step name within this flow (when `action` is null), or the name\nof another flow (when `action` is `switch` or `pivot`).\n",
4100
- ),
4101
- action: zod
4102
- .union([zod.enum(["switch", "pivot"]), zod.null()])
4103
- .optional()
4104
- .describe(
4105
- "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",
4106
- ),
4107
- purpose: zod
4108
- .union([
4109
- zod.enum([
4110
- "login",
4111
- "register",
4112
- "recovery",
4113
- "profiling",
4114
- "reauth",
4115
- "link_account",
4116
- ]),
4117
- zod.null(),
4118
- ])
4119
- .optional()
4182
+ }),
4183
+ )
4184
+ .optional()
4185
+ .describe(
4186
+ "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",
4187
+ ),
4188
+ })
4189
+ .describe(
4190
+ "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",
4191
+ ),
4192
+ )
4193
+ .min(1)
4194
+ .describe(
4195
+ "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
4196
+ ),
4197
+ })
4198
+ .describe(
4199
+ "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",
4200
+ ),
4201
+ user_schema: zod
4202
+ .union([
4203
+ zod
4204
+ .object({
4205
+ id: zod
4206
+ .string()
4207
+ .describe(
4208
+ "The resource id: the server-minted `sch_\*` identifier, or the\ncustomer-supplied `$id` URI when the document declared one at creation.\n",
4209
+ ),
4210
+ schema: zod
4211
+ .object({
4212
+ objectType: zod
4213
+ .string()
4214
+ .max(
4215
+ listFlowDefinitionsResponseFlowDefinitionsItemUserSchemaOneSchemaOneObjectTypeMax,
4216
+ )
4217
+ .optional()
4218
+ .describe(
4219
+ "The type of user this schema describes. This is a customer chosen name.\n",
4220
+ ),
4221
+ kind: zod
4222
+ .literal("user-schema")
4223
+ .describe("Discriminator value for a user schema create request."),
4224
+ metaSchema: zod.url().describe("The user Schema version used for this schema."),
4225
+ "x-auth-methods": zod
4226
+ .object({
4227
+ password: zod
4228
+ .object({
4229
+ enabled: zod
4230
+ .boolean()
4231
+ .describe("Whether the authentication method is enabled or not"),
4232
+ })
4233
+ .optional(),
4234
+ passkey: zod
4235
+ .object({
4236
+ enabled: zod
4237
+ .boolean()
4238
+ .describe("Whether the authentication method is enabled or not"),
4239
+ })
4240
+ .optional(),
4241
+ magic_link: zod
4242
+ .object({
4243
+ enabled: zod
4244
+ .boolean()
4245
+ .describe("Whether the authentication method is enabled or not"),
4246
+ })
4247
+ .optional(),
4248
+ sso: zod
4249
+ .object({
4250
+ enabled: zod
4251
+ .boolean()
4252
+ .describe("Whether the authentication method is enabled or not"),
4253
+ })
4254
+ .optional(),
4255
+ otp: zod
4256
+ .object({
4257
+ enabled: zod
4258
+ .boolean()
4259
+ .describe("Whether the authentication method is enabled or not"),
4260
+ })
4261
+ .optional(),
4262
+ })
4263
+ .describe(
4264
+ "A list of authentication methods supported by the user definition.",
4265
+ ),
4266
+ "x-identifier": zod
4267
+ .string()
4268
+ .min(1)
4269
+ .optional()
4270
+ .describe(
4271
+ 'Path of the leaf property whose value identifies a user (nested leaves\nare addressed by their dot-joined attribute path). The property must\ncarry `x-unique` \"project\". Required when an auth method needing\nidentifier-first dispatch (password) is enabled. Passkey is exempt:\ndiscoverable credentials identify the user through the assertion\nitself, so passkey-only and API-managed schemas may designate nothing;\nflows using identifier-first passkey are validated at the flow level\ninstead.\n',
4272
+ ),
4273
+ "x-display": zod
4274
+ .array(zod.string().min(1))
4275
+ .min(1)
4276
+ .optional()
4277
+ .describe(
4278
+ "Ordered leaf property paths whose values, joined with a space, render\nthe user's display name.\n",
4279
+ ),
4280
+ properties: zod
4281
+ .record(
4282
+ zod.string(),
4283
+ zod
4284
+ .object({
4285
+ "x-unique": zod
4286
+ .union([zod.enum(["unspecified", "project", "team"]), zod.null()])
4287
+ .optional()
4288
+ .describe("The level of uniqueness for this property, if applicable"),
4289
+ "x-claim": zod
4290
+ .union([zod.string(), zod.null()])
4291
+ .optional()
4292
+ .describe("The claim name for this property, if applicable"),
4293
+ "x-audit": zod
4294
+ .boolean()
4295
+ .default(
4296
+ listFlowDefinitionsResponseFlowDefinitionsItemUserSchemaOneSchemaOnePropertiesXAuditDefault,
4297
+ )
4298
+ .describe(
4299
+ "Whether this property's value may appear in audit event payloads. Audit\npayloads are deny-by-default: a property without this annotation\ncontributes its key but never its value.\n",
4300
+ ),
4301
+ properties: zod
4302
+ .record(zod.string(), zod.unknown())
4303
+ .optional()
4304
+ .describe(
4305
+ "A map of additional properties for the user definition, where the key is\nthe property name and the value is the property schema.\n",
4306
+ ),
4307
+ })
4120
4308
  .describe(
4121
- "Local re-purposing. When set, taking this transition changes the\nflow's current purpose to this value the dispatch mode a step's\nchallenges run under while the flow's original purpose stays\npinned. Must be a purpose this definition serves, and `target`\nmust be that purpose's entry step. Mutually exclusive with\n`action`: a transition either re-purposes within this flow or\ntargets another flow, never both.\nExample: a \"Sign up\" navigation on the login identifier step\n(`{ target: register, purpose: register }`).\n",
4309
+ 'This schema is missing `\"allOf\": [{\"$ref\": \"https:\/\/json-schema.org\/draft\/2020-12\/schema\"}],`.\nThis is done because a lot of code generators cannot handle that.\n\nNative JSON Schema keywords such as `type`, `format`, `title` and `writeOnly`\nare accepted without being listed below. `writeOnly: true` is reserved for a\nvalue that may be written but is never returned by the read API; nothing\nenforces it today, so responses still include write-only properties.\n',
4122
4310
  ),
4123
- }),
4124
- )
4125
- .optional()
4126
- .describe(
4127
- "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",
4128
- ),
4129
- })
4130
- .describe(
4131
- "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",
4132
- ),
4133
- )
4134
- .min(1)
4135
- .describe(
4136
- "Ordered list of steps in this flow. The order is for human readability —\nactual step sequencing is determined by transitions.\n",
4137
- ),
4138
- })
4311
+ )
4312
+ .optional()
4313
+ .describe(
4314
+ "A map of additional properties for the user definition, where the\nkey is the property name and the value is the property schema\n",
4315
+ ),
4316
+ })
4317
+ .describe(
4318
+ 'This schema is missing `\"allOf\": [{\"$ref\": \"https:\/\/json-schema.org\/draft\/2020-12\/schema\"}],`. \nThis is done because a lot of code generators cannot handle that.\n',
4319
+ )
4320
+ .describe("The customer-authored JSON Schema document, served verbatim."),
4321
+ metadata: zod.object({
4322
+ created_at: zod.iso
4323
+ .datetime({ offset: true })
4324
+ .describe("The time when the schema was created."),
4325
+ }),
4326
+ })
4327
+ .describe(
4328
+ "A schema resource: the server-owned envelope around a customer-authored\nJSON Schema document.\n\n`schema` is the customer-authored document, served verbatim: its keys and\ncontents are defined entirely by its author. The rest of the object — `id`,\n`metadata` — is the server-owned envelope. Keeping the two apart means the\ndocument may declare any property (including `id` or `metadata`) without\ncolliding with the envelope, and the resource `id` stays distinguishable\nfrom the document's own `$id`.\n",
4329
+ ),
4330
+ zod.null(),
4331
+ ])
4332
+ .optional()
4333
+ .describe(
4334
+ "The user schema this flow operates on: the same object\n`GET \/schemas\/{id}` returns. Present only when the request asked for it\nwith `expand=user_schema`; `null` when it was requested but the\nreferenced schema no longer resolves or the caller may not read it.\n",
4335
+ ),
4336
+ created_at: zod.iso.datetime({ offset: true }),
4337
+ updated_at: zod.iso.datetime({ offset: true }),
4338
+ }),
4339
+ ),
4340
+ next_page_token: zod
4341
+ .union([zod.string(), zod.null()])
4342
+ .optional()
4343
+ .describe(
4344
+ "The token to retrieve the next page of results. Absent if there are no more results.",
4345
+ ),
4346
+ })
4347
+ .describe("List of flow definitions, newest by creation time first.");
4348
+
4349
+ /**
4350
+ * Get a flow definition by id
4351
+ * @summary Get a flow definition by id
4352
+ */
4353
+ export const GetFlowDefinitionParams = zod.object({
4354
+ id: zod.string().describe("The id returned by the POST \/flow_definitions endpoint.\n"),
4355
+ });
4356
+
4357
+ export const getFlowDefinitionResponseFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
4358
+ export const getFlowDefinitionResponseFlowDefinitionStepsItemFieldsDefault = [];
4359
+ export const getFlowDefinitionResponseFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
4360
+ export const getFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault = [];
4361
+ export const getFlowDefinitionResponseFlowDefinitionStepsItemGatesDefault = {} as const;
4362
+ export const getFlowDefinitionResponseFlowDefinitionStepsItemSsoProvidersDefault = [];
4363
+ export const getFlowDefinitionResponseUserSchemaOneSchemaOneObjectTypeMax = 256;
4364
+
4365
+ export const getFlowDefinitionResponseUserSchemaOneSchemaOnePropertiesXAuditDefault = false;
4366
+
4367
+ export const GetFlowDefinitionResponse = zod.object({
4368
+ id: zod.string().describe("Unique identifier for the flow definition."),
4369
+ project_id: zod.string().describe("Identifier of the project this flow definition belongs to."),
4370
+ flow_definition: zod
4371
+ .object({
4372
+ name: zod
4373
+ .string()
4374
+ .regex(getFlowDefinitionResponseFlowDefinitionNameRegExp)
4375
+ .describe(
4376
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Every revision of a flow shares its\n`name`; publishing a definition under an existing `name` adds a\nrevision to that flow. Renaming is not supported — the `name` is part\nof the public contract another definition may reference. Acts as the\nhuman display label as well; no separate slug.\n",
4377
+ ),
4378
+ status: zod
4379
+ .enum(["active", "draft"])
4139
4380
  .describe(
4140
- "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",
4141
- ),
4142
- user_schema: zod
4143
- .union([
4144
- zod
4145
- .object({
4146
- id: zod
4147
- .string()
4148
- .describe(
4149
- "The resource id: the server-minted `sch_\*` identifier, or the\ncustomer-supplied `$id` URI when the document declared one at creation.\n",
4150
- ),
4151
- schema: zod
4152
- .object({
4153
- objectType: zod
4154
- .string()
4155
- .max(
4156
- listFlowDefinitionsResponseFlowDefinitionsItemUserSchemaOneSchemaOneObjectTypeMax,
4157
- )
4158
- .optional()
4159
- .describe(
4160
- "The type of user this schema describes. This is a customer chosen name.\n",
4161
- ),
4162
- kind: zod
4163
- .literal("user-schema")
4164
- .describe("Discriminator value for a user schema create request."),
4165
- metaSchema: zod.url().describe("The user Schema version used for this schema."),
4166
- "x-auth-methods": zod
4167
- .object({
4168
- password: zod
4169
- .object({
4170
- enabled: zod
4171
- .boolean()
4172
- .describe("Whether the authentication method is enabled or not"),
4173
- })
4174
- .optional(),
4175
- passkey: zod
4176
- .object({
4177
- enabled: zod
4178
- .boolean()
4179
- .describe("Whether the authentication method is enabled or not"),
4180
- })
4181
- .optional(),
4182
- magic_link: zod
4183
- .object({
4184
- enabled: zod
4185
- .boolean()
4186
- .describe("Whether the authentication method is enabled or not"),
4187
- })
4188
- .optional(),
4189
- sso: zod
4190
- .object({
4191
- enabled: zod
4192
- .boolean()
4193
- .describe("Whether the authentication method is enabled or not"),
4194
- })
4195
- .optional(),
4196
- otp: zod
4197
- .object({
4198
- enabled: zod
4199
- .boolean()
4200
- .describe("Whether the authentication method is enabled or not"),
4201
- })
4202
- .optional(),
4203
- })
4204
- .describe("A list of authentication methods supported by the user definition."),
4205
- "x-identifier": zod
4206
- .string()
4207
- .min(1)
4208
- .optional()
4209
- .describe(
4210
- 'Path of the leaf property whose value identifies a user (nested leaves\nare addressed by their dot-joined attribute path). The property must\ncarry `x-unique` \"project\". Required when an auth method needing\nidentifier-first dispatch (password) is enabled. Passkey is exempt:\ndiscoverable credentials identify the user through the assertion\nitself, so passkey-only and API-managed schemas may designate nothing;\nflows using identifier-first passkey are validated at the flow level\ninstead.\n',
4211
- ),
4212
- "x-display": zod
4213
- .array(zod.string().min(1))
4214
- .min(1)
4215
- .optional()
4216
- .describe(
4217
- "Ordered leaf property paths whose values, joined with a space, render\nthe user's display name.\n",
4218
- ),
4219
- properties: zod
4220
- .record(
4221
- zod.string(),
4222
- zod
4223
- .object({
4224
- "x-unique": zod
4225
- .union([zod.enum(["unspecified", "project", "team"]), zod.null()])
4226
- .optional()
4227
- .describe("The level of uniqueness for this property, if applicable"),
4228
- "x-claim": zod
4229
- .union([zod.string(), zod.null()])
4230
- .optional()
4231
- .describe("The claim name for this property, if applicable"),
4232
- "x-audit": zod
4233
- .boolean()
4234
- .default(
4235
- listFlowDefinitionsResponseFlowDefinitionsItemUserSchemaOneSchemaOnePropertiesXAuditDefault,
4236
- )
4237
- .describe(
4238
- "Whether this property's value may appear in audit event payloads. Audit\npayloads are deny-by-default: a property without this annotation\ncontributes its key but never its value.\n",
4239
- ),
4240
- properties: zod
4241
- .record(zod.string(), zod.unknown())
4242
- .optional()
4243
- .describe(
4244
- "A map of additional properties for the user definition, where the key is\nthe property name and the value is the property schema.\n",
4245
- ),
4246
- })
4247
- .describe(
4248
- 'This schema is missing `\"allOf\": [{\"$ref\": \"https:\/\/json-schema.org\/draft\/2020-12\/schema\"}],`.\nThis is done because a lot of code generators cannot handle that.\n\nNative JSON Schema keywords such as `type`, `format`, `title` and `writeOnly`\nare accepted without being listed below. `writeOnly: true` is reserved for a\nvalue that may be written but is never returned by the read API; nothing\nenforces it today, so responses still include write-only properties.\n',
4249
- ),
4250
- )
4251
- .optional()
4252
- .describe(
4253
- "A map of additional properties for the user definition, where the\nkey is the property name and the value is the property schema\n",
4254
- ),
4255
- })
4256
- .describe(
4257
- 'This schema is missing `\"allOf\": [{\"$ref\": \"https:\/\/json-schema.org\/draft\/2020-12\/schema\"}],`. \nThis is done because a lot of code generators cannot handle that.\n',
4258
- )
4259
- .describe("The customer-authored JSON Schema document, served verbatim."),
4260
- metadata: zod.object({
4261
- created_at: zod.iso
4262
- .datetime({ offset: true })
4263
- .describe("The time when the schema was created."),
4264
- }),
4265
- })
4266
- .describe(
4267
- "A schema resource: the server-owned envelope around a customer-authored\nJSON Schema document.\n\n`schema` is the customer-authored document, served verbatim: its keys and\ncontents are defined entirely by its author. The rest of the object — `id`,\n`metadata` — is the server-owned envelope. Keeping the two apart means the\ndocument may declare any property (including `id` or `metadata`) without\ncolliding with the envelope, and the resource `id` stays distinguishable\nfrom the document's own `$id`.\n",
4268
- ),
4269
- zod.null(),
4270
- ])
4271
- .optional()
4272
- .describe(
4273
- "The user schema this flow operates on: the same object\n`GET \/schemas\/{id}` returns. Present only when the request asked for it\nwith `expand=user_schema`; `null` when it was requested but the\nreferenced schema no longer resolves or the caller may not read it.\n",
4274
- ),
4275
- created_at: zod.iso.datetime({ offset: true }),
4276
- updated_at: zod.iso.datetime({ offset: true }),
4277
- }),
4278
- ),
4279
- next_page_token: zod
4280
- .union([zod.string(), zod.null()])
4281
- .optional()
4282
- .describe(
4283
- "The token to retrieve the next page of results. Absent if there are no more results.",
4284
- ),
4285
- });
4286
-
4287
- /**
4288
- * Get a flow definition by id
4289
- * @summary Get a flow definition by id
4290
- */
4291
- export const GetFlowDefinitionParams = zod.object({
4292
- id: zod.string().describe("The id returned by the POST \/flow_definitions endpoint.\n"),
4293
- });
4294
-
4295
- export const getFlowDefinitionResponseFlowDefinitionNameRegExp = new RegExp("^[a-z][a-z0-9-]\*$");
4296
- export const getFlowDefinitionResponseFlowDefinitionStepsItemFieldsDefault = [];
4297
- export const getFlowDefinitionResponseFlowDefinitionStepsItemActionsItemPrimaryDefault = false;
4298
- export const getFlowDefinitionResponseFlowDefinitionStepsItemActionsDefault = [];
4299
- export const getFlowDefinitionResponseFlowDefinitionStepsItemGatesDefault = {} as const;
4300
- export const getFlowDefinitionResponseFlowDefinitionStepsItemSsoProvidersDefault = [];
4301
- export const getFlowDefinitionResponseUserSchemaOneSchemaOneObjectTypeMax = 256;
4302
-
4303
- export const getFlowDefinitionResponseUserSchemaOneSchemaOnePropertiesXAuditDefault = false;
4304
-
4305
- export const GetFlowDefinitionResponse = zod.object({
4306
- id: zod.string().describe("Unique identifier for the flow definition."),
4307
- project_id: zod.string().describe("Identifier of the project this flow definition belongs to."),
4308
- flow_definition: zod
4309
- .object({
4310
- name: zod
4311
- .string()
4312
- .regex(getFlowDefinitionResponseFlowDefinitionNameRegExp)
4313
- .describe(
4314
- "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",
4315
- ),
4316
- status: zod
4317
- .enum(["active", "draft"])
4318
- .describe(
4319
- "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",
4381
+ "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",
4320
4382
  ),
4321
4383
  user_schema: zod
4322
4384
  .string()
@@ -4669,7 +4731,7 @@ export const UpdateFlowDefinitionBody = zod
4669
4731
  .string()
4670
4732
  .regex(updateFlowDefinitionBodyFlowDefinitionNameRegExp)
4671
4733
  .describe(
4672
- "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",
4734
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Every revision of a flow shares its\n`name`; publishing a definition under an existing `name` adds a\nrevision to that flow. Renaming is not supported — the `name` is part\nof the public contract another definition may reference. Acts as the\nhuman display label as well; no separate slug.\n",
4673
4735
  ),
4674
4736
  status: zod
4675
4737
  .enum(["active", "draft"])
@@ -4885,7 +4947,7 @@ export const UpdateFlowDefinitionResponse = zod.object({
4885
4947
  .string()
4886
4948
  .regex(updateFlowDefinitionResponseFlowDefinitionNameRegExp)
4887
4949
  .describe(
4888
- "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",
4950
+ "Stable identifier for this flow, used as the target of cross-flow\n`switch` and `pivot` transitions. Every revision of a flow shares its\n`name`; publishing a definition under an existing `name` adds a\nrevision to that flow. Renaming is not supported — the `name` is part\nof the public contract another definition may reference. Acts as the\nhuman display label as well; no separate slug.\n",
4889
4951
  ),
4890
4952
  status: zod
4891
4953
  .enum(["active", "draft"])
@@ -6121,6 +6183,321 @@ export const CreateGrantBody = zod.object({
6121
6183
  ),
6122
6184
  });
6123
6185
 
6186
+ /**
6187
+ * Returns the collaboration grants of a project, paginated with a cursor.
6188
+ Only unrevoked grants this API manages are listed (user or team bound to
6189
+ viewer, editor, or admin), including expired grants so a client can
6190
+ DELETE before re-granting. Project-secret setup (`sk_proj`) and
6191
+ owning-team (`relation=team`) rows are not returned. Grants are not in
6192
+ `resource_scope_index`; project scope is required on the query (same as
6193
+ get). Requires `project.read`. `expand: ["principal"]` additionally
6194
+ requires `user.read` and `team.read` (documented on the expand enum;
6195
+ those scopes cannot be ANDed onto this security block because they are
6196
+ body-conditional).
6197
+
6198
+ * @summary Query grants
6199
+ */
6200
+ export const queryGrantsQueryProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6201
+
6202
+ export const QueryGrantsQueryParams = zod.strictObject({
6203
+ project_id: zod
6204
+ .string()
6205
+ .regex(queryGrantsQueryProjectIdRegExp)
6206
+ .describe("The unique identifier of the project"),
6207
+ });
6208
+
6209
+ export const queryGrantsBodyLimitDefault = 20;
6210
+ export const queryGrantsBodyLimitMax = 100;
6211
+
6212
+ export const QueryGrantsBody = zod
6213
+ .object({
6214
+ limit: zod.number().min(1).max(queryGrantsBodyLimitMax).default(queryGrantsBodyLimitDefault),
6215
+ page_token: zod
6216
+ .union([zod.string(), zod.null()])
6217
+ .optional()
6218
+ .describe(
6219
+ "Token to retrieve the next page of results. Must be sent with the same\n`sorting` as the request that issued the token. Omitting `sorting` reuses\nthe default sort and only succeeds when that default matches the token.\n",
6220
+ ),
6221
+ expand: zod
6222
+ .array(
6223
+ zod
6224
+ .enum(["principal"])
6225
+ .describe(
6226
+ "A related object to embed on each returned grant (ADR 059).\n\n- `principal`: the principal named by `principal_id`, as `principal` on\n each grant. The property is omitted entirely when not requested. When\n requested, it is the same body `GET \/users\/{id}` serves for\n `principal_type=user`, or `GET \/teams\/{id}` for `principal_type=team`,\n and `null` when that principal cannot be loaded. Discriminate with the\n grant's existing `principal_type`.\n\n Requires `user.read` and `team.read` in addition to `project.read`.\n Both are checked on the whole request before the list, because a mixed\n page is the common case. A caller who may not read either resource\n receives 403 rather than a silently missing `principal`.\n",
6227
+ ),
6228
+ )
6229
+ .optional()
6230
+ .describe(
6231
+ "Related objects to embed on each grant (ADR 059). Omit it and no\nembedded object is returned. An unrecognised value is rejected.\n",
6232
+ ),
6233
+ sorting: zod
6234
+ .object({
6235
+ field: zod
6236
+ .enum(["created_at", "expires_at", "id"])
6237
+ .describe(
6238
+ "Field to sort grants by. Default is `created_at` ascending with `id` as\nthe tiebreaker.\n",
6239
+ ),
6240
+ direction: zod.enum(["asc", "desc"]),
6241
+ })
6242
+ .optional(),
6243
+ filter: zod
6244
+ .array(
6245
+ zod.object({
6246
+ field: zod
6247
+ .enum(["created_at", "principal_type", "principal_id", "relation", "expires_at"])
6248
+ .describe(
6249
+ "Field to filter grants by:\n- `created_at`: RFC3339 timestamp\n- `principal_type`: `user` or `team`\n- `principal_id`: principal id (`user_<opaque>` or `team_<opaque>`)\n- `relation`: `viewer`, `editor`, or `admin`\n- `expires_at`: RFC3339 timestamp (null when the grant does not expire)\n",
6250
+ ),
6251
+ value: zod
6252
+ .union([zod.string(), zod.number(), zod.boolean(), zod.null()])
6253
+ .optional()
6254
+ .describe(
6255
+ "Filter-value specifies which values can be filtered by a query endpoint. This\nis a union of types. When a value is specified which is not assignable to the\nfield which is being filtered, a 400 error will be returned.\n",
6256
+ ),
6257
+ operation: zod
6258
+ .enum([
6259
+ "equals",
6260
+ "not_equals",
6261
+ "contains",
6262
+ "not_contains",
6263
+ "less_than",
6264
+ "less_than_or_equal",
6265
+ "greater_than",
6266
+ "greater_than_or_equal",
6267
+ ])
6268
+ .describe(
6269
+ "Filter operation defines the operations which can be used when filtering on a\nquery endpoint.\n\nOn text fields, `contains` is a case-insensitive substring match. `equals`\ncompares the whole value and is case-sensitive unless the field documents\notherwise.\n",
6270
+ ),
6271
+ }),
6272
+ )
6273
+ .optional()
6274
+ .describe("Filter criteria for querying grants. Combined with AND."),
6275
+ })
6276
+ .describe("Request to query the grants of a project.");
6277
+
6278
+ export const queryGrantsResponseGrantsItemUserUserIdRegExp = new RegExp("^user_[a-zA-Z0-9_-]+$");
6279
+ export const queryGrantsResponseGrantsItemPrincipalOneOneOneIdRegExp = new RegExp(
6280
+ "^user_[a-zA-Z0-9_-]+$",
6281
+ );
6282
+
6283
+ export const QueryGrantsResponse = zod
6284
+ .object({
6285
+ grants: zod.array(
6286
+ zod
6287
+ .object({
6288
+ id: zod.string().describe("Managed assignment id (`asgn_<opaque>`)."),
6289
+ project_id: zod.string().describe("Project this grant is scoped to."),
6290
+ principal_type: zod
6291
+ .enum(["user", "team"])
6292
+ .describe("Kind of principal bound by this grant."),
6293
+ principal_id: zod.string().describe("Principal id (`user_<opaque>` or `team_<opaque>`)."),
6294
+ object_type: zod
6295
+ .enum(["project"])
6296
+ .describe("Catalog object type. Always `project` for this API."),
6297
+ relation: zod
6298
+ .enum(["viewer", "editor", "admin"])
6299
+ .describe("Catalog relation on the project."),
6300
+ created_at: zod.iso.datetime({ offset: true }).describe("When the grant was created."),
6301
+ expires_at: zod
6302
+ .union([zod.iso.datetime({ offset: true }), zod.null()])
6303
+ .optional()
6304
+ .describe(
6305
+ "When the grant expires. Null when it does not expire. GET still\nreturns expired unrevoked grants; authorization ignores them.\n",
6306
+ ),
6307
+ user: zod
6308
+ .object({
6309
+ user_id: zod.string().regex(queryGrantsResponseGrantsItemUserUserIdRegExp),
6310
+ identifier: zod
6311
+ .string()
6312
+ .optional()
6313
+ .describe(
6314
+ "The current value of the schema's designated identifier\n(`x-identifier`). Absent when the schema designates no identifier or\nthe user carries no value for it.\n",
6315
+ ),
6316
+ identifier_property: zod
6317
+ .string()
6318
+ .optional()
6319
+ .describe(
6320
+ "The schema property `identifier` came from, so clients can reach the\nproperty's schema for semantics (a mailto link, a field label)\ninstead of guessing from the value. Present exactly when\n`identifier` is.\n",
6321
+ ),
6322
+ display: zod
6323
+ .string()
6324
+ .optional()
6325
+ .describe(
6326
+ "The `x-display` rendering — the designated properties' values joined\nin list order. Purely presentational, with no source attribution.\nAbsent when the schema designates no display properties or the user\ncarries no values for them.\n",
6327
+ ),
6328
+ })
6329
+ .optional()
6330
+ .describe(
6331
+ "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\nMissing or deleted users degrade to `user_id` only.\n",
6332
+ ),
6333
+ team: zod
6334
+ .object({
6335
+ team_id: zod
6336
+ .string()
6337
+ .describe("The referenced team's id (`team_<opaque>`). Always present."),
6338
+ name: zod
6339
+ .string()
6340
+ .optional()
6341
+ .describe("The team's name. Absent when the team can no longer be loaded."),
6342
+ })
6343
+ .optional()
6344
+ .describe(
6345
+ "A resolved reference to a team. Carries the team's id and name so a grant\nlist is readable without embedding the full Team body. Id and display ride\n`project.read` (ADR 059 rule 8): a reference field carrying only the\ntarget's id and display strings needs no gate of its own. Missing or\ndeleted teams degrade to `team_id` only.\n",
6346
+ ),
6347
+ principal: zod
6348
+ .union([
6349
+ zod
6350
+ .union([
6351
+ zod
6352
+ .object({
6353
+ id: zod
6354
+ .string()
6355
+ .regex(queryGrantsResponseGrantsItemPrincipalOneOneOneIdRegExp),
6356
+ schema: zod
6357
+ .string()
6358
+ .describe(
6359
+ "The schema that defines the content of `attributes`. These schemas can be\ncreated using the `\/schemas` endpoint. A default schema is provided.\nThis schema can be retrieved using the same endpoint.\n",
6360
+ ),
6361
+ attributes: zod
6362
+ .record(zod.string(), zod.unknown())
6363
+ .describe(
6364
+ "The user's content, satisfying the schema named by `schema`. Property\nnames and types are determined entirely by that schema.\n",
6365
+ ),
6366
+ metadata: zod.object({
6367
+ created_at: zod.iso
6368
+ .datetime({ offset: true })
6369
+ .describe("The time when the user was created."),
6370
+ updated_at: zod.iso
6371
+ .datetime({ offset: true })
6372
+ .describe("The time when the user was last updated."),
6373
+ status: zod
6374
+ .enum(["active", "suspended", "deactivated", "pending_purge"])
6375
+ .describe("The status of the user."),
6376
+ lifecycle_owner_team_id: zod
6377
+ .union([zod.string(), zod.null()])
6378
+ .optional()
6379
+ .describe(
6380
+ "The team that owns this user's identity lifecycle, or `null` when the\nuser is self-owned. This is a single team and a different concept from\nthe user's team memberships: it decides who may deprovision the user, not\nwhich teams the user collaborates in. Memberships are their own paginated\nresource — `GET \/users\/{user_id}\/teams`.\n",
6381
+ ),
6382
+ lifecycle_owner_team: zod
6383
+ .union([
6384
+ zod
6385
+ .object({
6386
+ id: zod.string().describe("The unique identifier of the team."),
6387
+ name: zod.string().describe("The name of the team."),
6388
+ status: zod
6389
+ .enum(["active", "deactivated"])
6390
+ .describe(
6391
+ "The lifecycle state of a team.\n\nactive: The team is available for use.\ndeactivated: The team is no longer active but is retained for historical and audit purposes.\n",
6392
+ ),
6393
+ created_at: zod.iso
6394
+ .datetime({ offset: true })
6395
+ .describe("The time when the team was created."),
6396
+ updated_at: zod.iso
6397
+ .datetime({ offset: true })
6398
+ .describe("The time when the team was last updated."),
6399
+ })
6400
+ .describe("Details of a team."),
6401
+ zod.null(),
6402
+ ])
6403
+ .optional()
6404
+ .describe(
6405
+ 'The team named by `lifecycle_owner_team_id`, present only when the\nrequest asked for it with `expand: [\"lifecycle_owner_team\"]` (ADR 059).\nAbsent means it was not requested; `null` means the user is self-owned\nand there is no owner to resolve.\n\nRequesting it does not guarantee it is present on every user. Today\n`team.read` is checked once for the whole request, so it is; once that\ncheck is per team, a page may contain a user whose owner the caller may\nnot read, and such a row answers with neither the team nor `null` —\n`null` already means self-owned. What it answers with instead is decided\nwith the granular scopes (#420); do not read the two cases above as the\ncomplete set.\n\nThis is the same representation `GET \/teams\/{team_id}` serves. It is a\nsingle team, not a collection, so it carries no cap and no truncation\nflag.\n',
6406
+ ),
6407
+ }),
6408
+ identifier: zod
6409
+ .string()
6410
+ .optional()
6411
+ .describe(
6412
+ "The current value of the user schema's designated identifier\n(`x-identifier`), resolved live at read time. Absent when the schema\ndesignates no identifier or the user carries no value for it.\n",
6413
+ ),
6414
+ identifier_property: zod
6415
+ .string()
6416
+ .optional()
6417
+ .describe(
6418
+ "The schema property `identifier` came from, so clients can reach the\nproperty's schema for semantics (a mailto link, a field label)\ninstead of guessing from the value. Present exactly when\n`identifier` is.\n",
6419
+ ),
6420
+ display: zod
6421
+ .string()
6422
+ .optional()
6423
+ .describe(
6424
+ "The `x-display` rendering — the designated properties' values joined\nin list order, resolved live at read time. Purely presentational.\nAbsent when the schema designates no display properties or the user\ncarries no values for them. Clients render `display`, falling back\nto `identifier`, then `id`.\n",
6425
+ ),
6426
+ teams: zod
6427
+ .array(
6428
+ zod
6429
+ .object({
6430
+ id: zod.string().describe("The unique identifier of the team."),
6431
+ name: zod.string().describe("The name of the team."),
6432
+ membership_status: zod
6433
+ .enum(["pending", "active", "inactive"])
6434
+ .describe(
6435
+ "The user's participation state on this team. Memberships the user was\nremoved from are not returned.\n",
6436
+ ),
6437
+ created_at: zod.iso
6438
+ .datetime({ offset: true })
6439
+ .describe("The time when the user joined this team."),
6440
+ updated_at: zod.iso
6441
+ .datetime({ offset: true })
6442
+ .describe("The time when this membership was last changed."),
6443
+ })
6444
+ .describe(
6445
+ "One entry of a user's team roster: a team the user belongs to, with the\nmembership's participation state. The team's `name` travels with the entry, so\na page renders without a follow-up `POST \/teams\/query` per row.\n\nRoster membership is not lifecycle ownership. A user can belong to many teams\nwhile still owning their own lifecycle — that single owning team is reported\nas `metadata.lifecycle_owner_team_id` on the user itself.\n",
6446
+ ),
6447
+ )
6448
+ .optional()
6449
+ .describe(
6450
+ 'The user\'s team memberships, present only when the request asked for them with\n`expand: [\"teams\"]` (ADR 059). Absent means it was not requested; `[]`\nmeans the user has none.\n\nDeliberately outside `metadata`: memberships are a related collection, not\npart of the server-owned envelope, and it is a different concept from\n`metadata.lifecycle_owner_team_id` (ADR 024).\n',
6451
+ ),
6452
+ teams_truncated: zod
6453
+ .boolean()
6454
+ .optional()
6455
+ .describe(
6456
+ "True when the user is on more teams than the embedded list carries. The\nembedded list is capped and cannot be paged; read them all at\n`GET \/users\/{user_id}\/teams`. Present only alongside `teams`.\n",
6457
+ ),
6458
+ })
6459
+ .describe(
6460
+ "A user represents an individual identity in the system. It can be used to\nrepresent a human user, but also a service account or any other type of\nidentity.\n\n`attributes` is the document that satisfies the user schema named by\n`schema`: its property names and types are defined entirely by that schema,\nand it is what the schema validates. The rest of the object — `id`,\n`schema`, `metadata` — is the server-owned envelope. Keeping the two apart\nmeans a schema may name a property `id` or `metadata` without colliding with\nthe envelope, and closed-world keywords (`additionalProperties: false`,\n`propertyNames`, `unevaluatedProperties`) behave as their author expects.\n",
6461
+ ),
6462
+ zod
6463
+ .object({
6464
+ id: zod.string().describe("The unique identifier of the team."),
6465
+ name: zod.string().describe("The name of the team."),
6466
+ status: zod
6467
+ .enum(["active", "deactivated"])
6468
+ .describe(
6469
+ "The lifecycle state of a team.\n\nactive: The team is available for use.\ndeactivated: The team is no longer active but is retained for historical and audit purposes.\n",
6470
+ ),
6471
+ created_at: zod.iso
6472
+ .datetime({ offset: true })
6473
+ .describe("The time when the team was created."),
6474
+ updated_at: zod.iso
6475
+ .datetime({ offset: true })
6476
+ .describe("The time when the team was last updated."),
6477
+ })
6478
+ .describe("Details of a team."),
6479
+ ])
6480
+ .describe(
6481
+ "The principal bound by a grant: the User body when `principal_type` is\n`user`, or the Team body when `principal_type` is `team`. Same\nrepresentation as `GET \/users\/{id}` and `GET \/teams\/{id}` respectively.\nClients discriminate with the grant's existing `principal_type`.\n",
6482
+ ),
6483
+ zod.null(),
6484
+ ])
6485
+ .optional()
6486
+ .describe(
6487
+ 'The principal named by `principal_id`, present only when the request\nasked for it with `expand: [\"principal\"]` (ADR 059). Absent means it\nwas not requested; `null` means the principal cannot be loaded\n(deleted or missing). GET and create never set this field.\n\nWhen present, the body is the same representation `GET \/users\/{id}`\nserves for `principal_type=user`, or `GET \/teams\/{id}` for\n`principal_type=team`. Discriminate with the grant\'s existing\n`principal_type`.\n\nRequires `user.read` and `team.read` in addition to `project.read`.\nBoth are checked on the whole request before the list.\n',
6488
+ ),
6489
+ })
6490
+ .describe("A collaboration grant binding a principal to a project relation."),
6491
+ ),
6492
+ next_page_token: zod
6493
+ .union([zod.string(), zod.null()])
6494
+ .optional()
6495
+ .describe(
6496
+ "Token to pass as `page_token` in the next request to fetch the following page.\nAbsent when there are no more results. The follow-up request must repeat the\nsame `sorting` that produced this token (omit only when both pages use the default).\n",
6497
+ ),
6498
+ })
6499
+ .describe("Paginated list of grants.");
6500
+
6124
6501
  /**
6125
6502
  * Loads a grant by `(project_id, id)` that this API manages (user or team
6126
6503
  bound to viewer, editor, or admin) and that has not been revoked.
@@ -6146,6 +6523,9 @@ export const GetGrantQueryParams = zod.strictObject({
6146
6523
  .describe("The unique identifier of the project"),
6147
6524
  });
6148
6525
 
6526
+ export const getGrantResponseUserUserIdRegExp = new RegExp("^user_[a-zA-Z0-9_-]+$");
6527
+ export const getGrantResponsePrincipalOneOneOneIdRegExp = new RegExp("^user_[a-zA-Z0-9_-]+$");
6528
+
6149
6529
  export const GetGrantResponse = zod
6150
6530
  .object({
6151
6531
  id: zod.string().describe("Managed assignment id (`asgn_<opaque>`)."),
@@ -6161,7 +6541,187 @@ export const GetGrantResponse = zod
6161
6541
  .union([zod.iso.datetime({ offset: true }), zod.null()])
6162
6542
  .optional()
6163
6543
  .describe(
6164
- "When the grant expires. Null when it does not expire. GET still\nreturns expired unrevoked grants; authorization ignores them.\n",
6544
+ "When the grant expires. Null when it does not expire. GET still\nreturns expired unrevoked grants; authorization ignores them.\n",
6545
+ ),
6546
+ user: zod
6547
+ .object({
6548
+ user_id: zod.string().regex(getGrantResponseUserUserIdRegExp),
6549
+ identifier: zod
6550
+ .string()
6551
+ .optional()
6552
+ .describe(
6553
+ "The current value of the schema's designated identifier\n(`x-identifier`). Absent when the schema designates no identifier or\nthe user carries no value for it.\n",
6554
+ ),
6555
+ identifier_property: zod
6556
+ .string()
6557
+ .optional()
6558
+ .describe(
6559
+ "The schema property `identifier` came from, so clients can reach the\nproperty's schema for semantics (a mailto link, a field label)\ninstead of guessing from the value. Present exactly when\n`identifier` is.\n",
6560
+ ),
6561
+ display: zod
6562
+ .string()
6563
+ .optional()
6564
+ .describe(
6565
+ "The `x-display` rendering — the designated properties' values joined\nin list order. Purely presentational, with no source attribution.\nAbsent when the schema designates no display properties or the user\ncarries no values for them.\n",
6566
+ ),
6567
+ })
6568
+ .optional()
6569
+ .describe(
6570
+ "A resolved reference to a user (ADR 058 §3). Fields are role-named, not\nproperty-named, so responses can mix users from different schemas.\n`identifier` and `display` are resolved independently from the user\nschema's `x-identifier` and `x-display` designations, live at read time.\nClients render `display`, falling back to `identifier`, then `user_id`.\nMissing or deleted users degrade to `user_id` only.\n",
6571
+ ),
6572
+ team: zod
6573
+ .object({
6574
+ team_id: zod
6575
+ .string()
6576
+ .describe("The referenced team's id (`team_<opaque>`). Always present."),
6577
+ name: zod
6578
+ .string()
6579
+ .optional()
6580
+ .describe("The team's name. Absent when the team can no longer be loaded."),
6581
+ })
6582
+ .optional()
6583
+ .describe(
6584
+ "A resolved reference to a team. Carries the team's id and name so a grant\nlist is readable without embedding the full Team body. Id and display ride\n`project.read` (ADR 059 rule 8): a reference field carrying only the\ntarget's id and display strings needs no gate of its own. Missing or\ndeleted teams degrade to `team_id` only.\n",
6585
+ ),
6586
+ principal: zod
6587
+ .union([
6588
+ zod
6589
+ .union([
6590
+ zod
6591
+ .object({
6592
+ id: zod.string().regex(getGrantResponsePrincipalOneOneOneIdRegExp),
6593
+ schema: zod
6594
+ .string()
6595
+ .describe(
6596
+ "The schema that defines the content of `attributes`. These schemas can be\ncreated using the `\/schemas` endpoint. A default schema is provided.\nThis schema can be retrieved using the same endpoint.\n",
6597
+ ),
6598
+ attributes: zod
6599
+ .record(zod.string(), zod.unknown())
6600
+ .describe(
6601
+ "The user's content, satisfying the schema named by `schema`. Property\nnames and types are determined entirely by that schema.\n",
6602
+ ),
6603
+ metadata: zod.object({
6604
+ created_at: zod.iso
6605
+ .datetime({ offset: true })
6606
+ .describe("The time when the user was created."),
6607
+ updated_at: zod.iso
6608
+ .datetime({ offset: true })
6609
+ .describe("The time when the user was last updated."),
6610
+ status: zod
6611
+ .enum(["active", "suspended", "deactivated", "pending_purge"])
6612
+ .describe("The status of the user."),
6613
+ lifecycle_owner_team_id: zod
6614
+ .union([zod.string(), zod.null()])
6615
+ .optional()
6616
+ .describe(
6617
+ "The team that owns this user's identity lifecycle, or `null` when the\nuser is self-owned. This is a single team and a different concept from\nthe user's team memberships: it decides who may deprovision the user, not\nwhich teams the user collaborates in. Memberships are their own paginated\nresource — `GET \/users\/{user_id}\/teams`.\n",
6618
+ ),
6619
+ lifecycle_owner_team: zod
6620
+ .union([
6621
+ zod
6622
+ .object({
6623
+ id: zod.string().describe("The unique identifier of the team."),
6624
+ name: zod.string().describe("The name of the team."),
6625
+ status: zod
6626
+ .enum(["active", "deactivated"])
6627
+ .describe(
6628
+ "The lifecycle state of a team.\n\nactive: The team is available for use.\ndeactivated: The team is no longer active but is retained for historical and audit purposes.\n",
6629
+ ),
6630
+ created_at: zod.iso
6631
+ .datetime({ offset: true })
6632
+ .describe("The time when the team was created."),
6633
+ updated_at: zod.iso
6634
+ .datetime({ offset: true })
6635
+ .describe("The time when the team was last updated."),
6636
+ })
6637
+ .describe("Details of a team."),
6638
+ zod.null(),
6639
+ ])
6640
+ .optional()
6641
+ .describe(
6642
+ 'The team named by `lifecycle_owner_team_id`, present only when the\nrequest asked for it with `expand: [\"lifecycle_owner_team\"]` (ADR 059).\nAbsent means it was not requested; `null` means the user is self-owned\nand there is no owner to resolve.\n\nRequesting it does not guarantee it is present on every user. Today\n`team.read` is checked once for the whole request, so it is; once that\ncheck is per team, a page may contain a user whose owner the caller may\nnot read, and such a row answers with neither the team nor `null` —\n`null` already means self-owned. What it answers with instead is decided\nwith the granular scopes (#420); do not read the two cases above as the\ncomplete set.\n\nThis is the same representation `GET \/teams\/{team_id}` serves. It is a\nsingle team, not a collection, so it carries no cap and no truncation\nflag.\n',
6643
+ ),
6644
+ }),
6645
+ identifier: zod
6646
+ .string()
6647
+ .optional()
6648
+ .describe(
6649
+ "The current value of the user schema's designated identifier\n(`x-identifier`), resolved live at read time. Absent when the schema\ndesignates no identifier or the user carries no value for it.\n",
6650
+ ),
6651
+ identifier_property: zod
6652
+ .string()
6653
+ .optional()
6654
+ .describe(
6655
+ "The schema property `identifier` came from, so clients can reach the\nproperty's schema for semantics (a mailto link, a field label)\ninstead of guessing from the value. Present exactly when\n`identifier` is.\n",
6656
+ ),
6657
+ display: zod
6658
+ .string()
6659
+ .optional()
6660
+ .describe(
6661
+ "The `x-display` rendering — the designated properties' values joined\nin list order, resolved live at read time. Purely presentational.\nAbsent when the schema designates no display properties or the user\ncarries no values for them. Clients render `display`, falling back\nto `identifier`, then `id`.\n",
6662
+ ),
6663
+ teams: zod
6664
+ .array(
6665
+ zod
6666
+ .object({
6667
+ id: zod.string().describe("The unique identifier of the team."),
6668
+ name: zod.string().describe("The name of the team."),
6669
+ membership_status: zod
6670
+ .enum(["pending", "active", "inactive"])
6671
+ .describe(
6672
+ "The user's participation state on this team. Memberships the user was\nremoved from are not returned.\n",
6673
+ ),
6674
+ created_at: zod.iso
6675
+ .datetime({ offset: true })
6676
+ .describe("The time when the user joined this team."),
6677
+ updated_at: zod.iso
6678
+ .datetime({ offset: true })
6679
+ .describe("The time when this membership was last changed."),
6680
+ })
6681
+ .describe(
6682
+ "One entry of a user's team roster: a team the user belongs to, with the\nmembership's participation state. The team's `name` travels with the entry, so\na page renders without a follow-up `POST \/teams\/query` per row.\n\nRoster membership is not lifecycle ownership. A user can belong to many teams\nwhile still owning their own lifecycle — that single owning team is reported\nas `metadata.lifecycle_owner_team_id` on the user itself.\n",
6683
+ ),
6684
+ )
6685
+ .optional()
6686
+ .describe(
6687
+ 'The user\'s team memberships, present only when the request asked for them with\n`expand: [\"teams\"]` (ADR 059). Absent means it was not requested; `[]`\nmeans the user has none.\n\nDeliberately outside `metadata`: memberships are a related collection, not\npart of the server-owned envelope, and it is a different concept from\n`metadata.lifecycle_owner_team_id` (ADR 024).\n',
6688
+ ),
6689
+ teams_truncated: zod
6690
+ .boolean()
6691
+ .optional()
6692
+ .describe(
6693
+ "True when the user is on more teams than the embedded list carries. The\nembedded list is capped and cannot be paged; read them all at\n`GET \/users\/{user_id}\/teams`. Present only alongside `teams`.\n",
6694
+ ),
6695
+ })
6696
+ .describe(
6697
+ "A user represents an individual identity in the system. It can be used to\nrepresent a human user, but also a service account or any other type of\nidentity.\n\n`attributes` is the document that satisfies the user schema named by\n`schema`: its property names and types are defined entirely by that schema,\nand it is what the schema validates. The rest of the object — `id`,\n`schema`, `metadata` — is the server-owned envelope. Keeping the two apart\nmeans a schema may name a property `id` or `metadata` without colliding with\nthe envelope, and closed-world keywords (`additionalProperties: false`,\n`propertyNames`, `unevaluatedProperties`) behave as their author expects.\n",
6698
+ ),
6699
+ zod
6700
+ .object({
6701
+ id: zod.string().describe("The unique identifier of the team."),
6702
+ name: zod.string().describe("The name of the team."),
6703
+ status: zod
6704
+ .enum(["active", "deactivated"])
6705
+ .describe(
6706
+ "The lifecycle state of a team.\n\nactive: The team is available for use.\ndeactivated: The team is no longer active but is retained for historical and audit purposes.\n",
6707
+ ),
6708
+ created_at: zod.iso
6709
+ .datetime({ offset: true })
6710
+ .describe("The time when the team was created."),
6711
+ updated_at: zod.iso
6712
+ .datetime({ offset: true })
6713
+ .describe("The time when the team was last updated."),
6714
+ })
6715
+ .describe("Details of a team."),
6716
+ ])
6717
+ .describe(
6718
+ "The principal bound by a grant: the User body when `principal_type` is\n`user`, or the Team body when `principal_type` is `team`. Same\nrepresentation as `GET \/users\/{id}` and `GET \/teams\/{id}` respectively.\nClients discriminate with the grant's existing `principal_type`.\n",
6719
+ ),
6720
+ zod.null(),
6721
+ ])
6722
+ .optional()
6723
+ .describe(
6724
+ 'The principal named by `principal_id`, present only when the request\nasked for it with `expand: [\"principal\"]` (ADR 059). Absent means it\nwas not requested; `null` means the principal cannot be loaded\n(deleted or missing). GET and create never set this field.\n\nWhen present, the body is the same representation `GET \/users\/{id}`\nserves for `principal_type=user`, or `GET \/teams\/{id}` for\n`principal_type=team`. Discriminate with the grant\'s existing\n`principal_type`.\n\nRequires `user.read` and `team.read` in addition to `project.read`.\nBoth are checked on the whole request before the list.\n',
6165
6725
  ),
6166
6726
  })
6167
6727
  .describe("A collaboration grant binding a principal to a project relation.");
@@ -6276,12 +6836,12 @@ export const listEventsResponseDataItemOnesixOneProjectIdRegExp = new RegExp("^[
6276
6836
  export const listEventsResponseDataItemOnesevenOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6277
6837
  export const listEventsResponseDataItemOneeightOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6278
6838
  export const listEventsResponseDataItemOnenineOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6279
- export const listEventsResponseDataItemOnenineTwoPayloadStatusMin = 100;
6280
- export const listEventsResponseDataItemOnenineTwoPayloadStatusMax = 599;
6839
+ export const listEventsResponseDataItemTwozeroOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6840
+ export const listEventsResponseDataItemTwozeroTwoPayloadStatusMin = 100;
6841
+ export const listEventsResponseDataItemTwozeroTwoPayloadStatusMax = 599;
6281
6842
 
6282
- export const listEventsResponseDataItemOnenineTwoPayloadDurationMsMin = 0;
6843
+ export const listEventsResponseDataItemTwozeroTwoPayloadDurationMsMin = 0;
6283
6844
 
6284
- export const listEventsResponseDataItemTwozeroOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6285
6845
  export const listEventsResponseDataItemTwooneOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6286
6846
  export const listEventsResponseDataItemTwotwoOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6287
6847
  export const listEventsResponseDataItemTwothreeOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
@@ -6290,6 +6850,7 @@ export const listEventsResponseDataItemTwofiveOneProjectIdRegExp = new RegExp("^
6290
6850
  export const listEventsResponseDataItemTwosixOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6291
6851
  export const listEventsResponseDataItemTwosevenOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6292
6852
  export const listEventsResponseDataItemTwoeightOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6853
+ export const listEventsResponseDataItemTwonineOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
6293
6854
 
6294
6855
  export const ListEventsResponse = zod
6295
6856
  .object({
@@ -8139,6 +8700,115 @@ export const ListEventsResponse = zod
8139
8700
  .describe(
8140
8701
  "Shared wide-event envelope (ADR 048 \/ ADR 049). Concrete events are\n`allOf` this schema plus a `const` `event_type` and a typed `payload`.\n",
8141
8702
  )
8703
+ .and(
8704
+ zod.object({
8705
+ event_type: zod.literal("release.created"),
8706
+ payload: zod
8707
+ .object({
8708
+ content_hash: zod.string().optional(),
8709
+ message: zod.string().optional(),
8710
+ git_sha: zod.string().optional(),
8711
+ git_dirty: zod.boolean().optional(),
8712
+ pointers: zod
8713
+ .array(
8714
+ zod.object({
8715
+ kind: zod.string().optional(),
8716
+ handle: zod.string().optional(),
8717
+ revision_id: zod.string().optional(),
8718
+ }),
8719
+ )
8720
+ .optional(),
8721
+ })
8722
+ .describe(
8723
+ "Allowlisted fields for `release.created`. The release id is already the\nevent's `entity_id`; the pinned set is repeated here so the audit stream\nanswers what a release contained without reading the release itself.\n",
8724
+ ),
8725
+ }),
8726
+ )
8727
+ .describe("Wide event with event_type=release.created.\n"),
8728
+ zod
8729
+ .object({
8730
+ id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8731
+ project_id: zod.string().regex(listEventsResponseDataItemTwozeroOneProjectIdRegExp),
8732
+ team_id: zod
8733
+ .union([zod.string(), zod.null()])
8734
+ .optional()
8735
+ .describe("Emit-time team scope, when the actor operated under a team."),
8736
+ event_type: zod
8737
+ .string()
8738
+ .describe(
8739
+ "Semantic event name (dot-separated). Discriminator for the Event union —\nsee docs\/design\/api\/events-catalog.md.\n",
8740
+ ),
8741
+ category: zod
8742
+ .enum(["request", "auth", "session", "admin", "entity", "signal"])
8743
+ .describe("Wide-event category."),
8744
+ occurred_at: zod.iso
8745
+ .datetime({ offset: true })
8746
+ .describe("When the action happened (server\/storage clock, dialect-owned)."),
8747
+ created_at: zod.iso
8748
+ .datetime({ offset: true })
8749
+ .describe("When the row was inserted (server\/storage clock, dialect-owned)."),
8750
+ actor_id: zod
8751
+ .union([zod.string(), zod.null()])
8752
+ .optional()
8753
+ .describe("Who triggered the event."),
8754
+ actor_type: zod
8755
+ .union([zod.enum(["human", "service", "system", "agent"]), zod.null()])
8756
+ .optional()
8757
+ .describe("Actor kind."),
8758
+ entity_type: zod
8759
+ .union([zod.string(), zod.null()])
8760
+ .optional()
8761
+ .describe("Resource type affected."),
8762
+ entity_id: zod
8763
+ .union([zod.string(), zod.null()])
8764
+ .optional()
8765
+ .describe("Resource id affected."),
8766
+ client_id: zod.string().describe("Application or agent that produced the event."),
8767
+ token_id: zod
8768
+ .string()
8769
+ .optional()
8770
+ .describe("Token id present at emit time, when any."),
8771
+ delegation_type: zod
8772
+ .enum(["direct", "delegated", "pat_shared", "exchanged"])
8773
+ .optional()
8774
+ .describe("Delegation kind (omit when unset)."),
8775
+ delegation_id: zod.string().optional(),
8776
+ grantor: zod.string().optional(),
8777
+ fingerprint: zod.string().optional().describe("Device fingerprint correlation id."),
8778
+ request_id: zod
8779
+ .union([zod.string(), zod.null()])
8780
+ .optional()
8781
+ .describe("HTTP request correlation id."),
8782
+ session_id: zod
8783
+ .union([zod.string(), zod.null()])
8784
+ .optional()
8785
+ .describe("Session correlation id."),
8786
+ flow_id: zod
8787
+ .union([zod.string(), zod.null()])
8788
+ .optional()
8789
+ .describe("Login flow correlation id."),
8790
+ metadata: zod
8791
+ .object({
8792
+ client: zod
8793
+ .object({
8794
+ ip: zod
8795
+ .string()
8796
+ .optional()
8797
+ .describe("Client IP from the first X-Forwarded-For hop or RemoteAddr."),
8798
+ user_agent: zod.string().optional().describe("Observed User-Agent header."),
8799
+ origin: zod.string().optional().describe("Origin header when present."),
8800
+ })
8801
+ .optional()
8802
+ .describe("Observed HTTP requestor context on Path A request.api only."),
8803
+ })
8804
+ .optional()
8805
+ .describe(
8806
+ "Emit-time metadata, already redacted at write. Path A request.api may\nset client (ip, user_agent, origin) for SIEM join on request_id. Not a\nlive risk-evaluator input.\n",
8807
+ ),
8808
+ })
8809
+ .describe(
8810
+ "Shared wide-event envelope (ADR 048 \/ ADR 049). Concrete events are\n`allOf` this schema plus a `const` `event_type` and a typed `payload`.\n",
8811
+ )
8142
8812
  .and(
8143
8813
  zod.object({
8144
8814
  event_type: zod.literal("request.api"),
@@ -8151,11 +8821,11 @@ export const ListEventsResponse = zod
8151
8821
  route_template: zod.string(),
8152
8822
  status: zod
8153
8823
  .number()
8154
- .min(listEventsResponseDataItemOnenineTwoPayloadStatusMin)
8155
- .max(listEventsResponseDataItemOnenineTwoPayloadStatusMax),
8824
+ .min(listEventsResponseDataItemTwozeroTwoPayloadStatusMin)
8825
+ .max(listEventsResponseDataItemTwozeroTwoPayloadStatusMax),
8156
8826
  duration_ms: zod
8157
8827
  .number()
8158
- .min(listEventsResponseDataItemOnenineTwoPayloadDurationMsMin),
8828
+ .min(listEventsResponseDataItemTwozeroTwoPayloadDurationMsMin),
8159
8829
  })
8160
8830
  .describe("Payload for `request.api` events."),
8161
8831
  }),
@@ -8164,7 +8834,7 @@ export const ListEventsResponse = zod
8164
8834
  zod
8165
8835
  .object({
8166
8836
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8167
- project_id: zod.string().regex(listEventsResponseDataItemTwozeroOneProjectIdRegExp),
8837
+ project_id: zod.string().regex(listEventsResponseDataItemTwooneOneProjectIdRegExp),
8168
8838
  team_id: zod
8169
8839
  .union([zod.string(), zod.null()])
8170
8840
  .optional()
@@ -8272,7 +8942,7 @@ export const ListEventsResponse = zod
8272
8942
  zod
8273
8943
  .object({
8274
8944
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8275
- project_id: zod.string().regex(listEventsResponseDataItemTwooneOneProjectIdRegExp),
8945
+ project_id: zod.string().regex(listEventsResponseDataItemTwotwoOneProjectIdRegExp),
8276
8946
  team_id: zod
8277
8947
  .union([zod.string(), zod.null()])
8278
8948
  .optional()
@@ -8367,7 +9037,7 @@ export const ListEventsResponse = zod
8367
9037
  zod
8368
9038
  .object({
8369
9039
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8370
- project_id: zod.string().regex(listEventsResponseDataItemTwotwoOneProjectIdRegExp),
9040
+ project_id: zod.string().regex(listEventsResponseDataItemTwothreeOneProjectIdRegExp),
8371
9041
  team_id: zod
8372
9042
  .union([zod.string(), zod.null()])
8373
9043
  .optional()
@@ -8462,7 +9132,7 @@ export const ListEventsResponse = zod
8462
9132
  zod
8463
9133
  .object({
8464
9134
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8465
- project_id: zod.string().regex(listEventsResponseDataItemTwothreeOneProjectIdRegExp),
9135
+ project_id: zod.string().regex(listEventsResponseDataItemTwofourOneProjectIdRegExp),
8466
9136
  team_id: zod
8467
9137
  .union([zod.string(), zod.null()])
8468
9138
  .optional()
@@ -8559,7 +9229,7 @@ export const ListEventsResponse = zod
8559
9229
  zod
8560
9230
  .object({
8561
9231
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8562
- project_id: zod.string().regex(listEventsResponseDataItemTwofourOneProjectIdRegExp),
9232
+ project_id: zod.string().regex(listEventsResponseDataItemTwofiveOneProjectIdRegExp),
8563
9233
  team_id: zod
8564
9234
  .union([zod.string(), zod.null()])
8565
9235
  .optional()
@@ -8654,7 +9324,7 @@ export const ListEventsResponse = zod
8654
9324
  zod
8655
9325
  .object({
8656
9326
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8657
- project_id: zod.string().regex(listEventsResponseDataItemTwofiveOneProjectIdRegExp),
9327
+ project_id: zod.string().regex(listEventsResponseDataItemTwosixOneProjectIdRegExp),
8658
9328
  team_id: zod
8659
9329
  .union([zod.string(), zod.null()])
8660
9330
  .optional()
@@ -8751,7 +9421,7 @@ export const ListEventsResponse = zod
8751
9421
  zod
8752
9422
  .object({
8753
9423
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8754
- project_id: zod.string().regex(listEventsResponseDataItemTwosixOneProjectIdRegExp),
9424
+ project_id: zod.string().regex(listEventsResponseDataItemTwosevenOneProjectIdRegExp),
8755
9425
  team_id: zod
8756
9426
  .union([zod.string(), zod.null()])
8757
9427
  .optional()
@@ -8846,7 +9516,7 @@ export const ListEventsResponse = zod
8846
9516
  zod
8847
9517
  .object({
8848
9518
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8849
- project_id: zod.string().regex(listEventsResponseDataItemTwosevenOneProjectIdRegExp),
9519
+ project_id: zod.string().regex(listEventsResponseDataItemTwoeightOneProjectIdRegExp),
8850
9520
  team_id: zod
8851
9521
  .union([zod.string(), zod.null()])
8852
9522
  .optional()
@@ -8945,7 +9615,7 @@ export const ListEventsResponse = zod
8945
9615
  zod
8946
9616
  .object({
8947
9617
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
8948
- project_id: zod.string().regex(listEventsResponseDataItemTwoeightOneProjectIdRegExp),
9618
+ project_id: zod.string().regex(listEventsResponseDataItemTwonineOneProjectIdRegExp),
8949
9619
  team_id: zod
8950
9620
  .union([zod.string(), zod.null()])
8951
9621
  .optional()
@@ -9092,12 +9762,12 @@ export const getEventResponseOnesixOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_
9092
9762
  export const getEventResponseOnesevenOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9093
9763
  export const getEventResponseOneeightOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9094
9764
  export const getEventResponseOnenineOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9095
- export const getEventResponseOnenineTwoPayloadStatusMin = 100;
9096
- export const getEventResponseOnenineTwoPayloadStatusMax = 599;
9765
+ export const getEventResponseTwozeroOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9766
+ export const getEventResponseTwozeroTwoPayloadStatusMin = 100;
9767
+ export const getEventResponseTwozeroTwoPayloadStatusMax = 599;
9097
9768
 
9098
- export const getEventResponseOnenineTwoPayloadDurationMsMin = 0;
9769
+ export const getEventResponseTwozeroTwoPayloadDurationMsMin = 0;
9099
9770
 
9100
- export const getEventResponseTwozeroOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9101
9771
  export const getEventResponseTwooneOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9102
9772
  export const getEventResponseTwotwoOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9103
9773
  export const getEventResponseTwothreeOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
@@ -9106,6 +9776,7 @@ export const getEventResponseTwofiveOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9
9106
9776
  export const getEventResponseTwosixOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9107
9777
  export const getEventResponseTwosevenOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9108
9778
  export const getEventResponseTwoeightOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9779
+ export const getEventResponseTwonineOneProjectIdRegExp = new RegExp("^[a-zA-Z0-9_-]+$");
9109
9780
 
9110
9781
  export const GetEventResponse = zod
9111
9782
  .union([
@@ -10893,6 +11564,112 @@ export const GetEventResponse = zod
10893
11564
  .describe(
10894
11565
  "Shared wide-event envelope (ADR 048 \/ ADR 049). Concrete events are\n`allOf` this schema plus a `const` `event_type` and a typed `payload`.\n",
10895
11566
  )
11567
+ .and(
11568
+ zod.object({
11569
+ event_type: zod.literal("release.created"),
11570
+ payload: zod
11571
+ .object({
11572
+ content_hash: zod.string().optional(),
11573
+ message: zod.string().optional(),
11574
+ git_sha: zod.string().optional(),
11575
+ git_dirty: zod.boolean().optional(),
11576
+ pointers: zod
11577
+ .array(
11578
+ zod.object({
11579
+ kind: zod.string().optional(),
11580
+ handle: zod.string().optional(),
11581
+ revision_id: zod.string().optional(),
11582
+ }),
11583
+ )
11584
+ .optional(),
11585
+ })
11586
+ .describe(
11587
+ "Allowlisted fields for `release.created`. The release id is already the\nevent's `entity_id`; the pinned set is repeated here so the audit stream\nanswers what a release contained without reading the release itself.\n",
11588
+ ),
11589
+ }),
11590
+ )
11591
+ .describe("Wide event with event_type=release.created.\n"),
11592
+ zod
11593
+ .object({
11594
+ id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11595
+ project_id: zod.string().regex(getEventResponseTwozeroOneProjectIdRegExp),
11596
+ team_id: zod
11597
+ .union([zod.string(), zod.null()])
11598
+ .optional()
11599
+ .describe("Emit-time team scope, when the actor operated under a team."),
11600
+ event_type: zod
11601
+ .string()
11602
+ .describe(
11603
+ "Semantic event name (dot-separated). Discriminator for the Event union —\nsee docs\/design\/api\/events-catalog.md.\n",
11604
+ ),
11605
+ category: zod
11606
+ .enum(["request", "auth", "session", "admin", "entity", "signal"])
11607
+ .describe("Wide-event category."),
11608
+ occurred_at: zod.iso
11609
+ .datetime({ offset: true })
11610
+ .describe("When the action happened (server\/storage clock, dialect-owned)."),
11611
+ created_at: zod.iso
11612
+ .datetime({ offset: true })
11613
+ .describe("When the row was inserted (server\/storage clock, dialect-owned)."),
11614
+ actor_id: zod
11615
+ .union([zod.string(), zod.null()])
11616
+ .optional()
11617
+ .describe("Who triggered the event."),
11618
+ actor_type: zod
11619
+ .union([zod.enum(["human", "service", "system", "agent"]), zod.null()])
11620
+ .optional()
11621
+ .describe("Actor kind."),
11622
+ entity_type: zod
11623
+ .union([zod.string(), zod.null()])
11624
+ .optional()
11625
+ .describe("Resource type affected."),
11626
+ entity_id: zod
11627
+ .union([zod.string(), zod.null()])
11628
+ .optional()
11629
+ .describe("Resource id affected."),
11630
+ client_id: zod.string().describe("Application or agent that produced the event."),
11631
+ token_id: zod.string().optional().describe("Token id present at emit time, when any."),
11632
+ delegation_type: zod
11633
+ .enum(["direct", "delegated", "pat_shared", "exchanged"])
11634
+ .optional()
11635
+ .describe("Delegation kind (omit when unset)."),
11636
+ delegation_id: zod.string().optional(),
11637
+ grantor: zod.string().optional(),
11638
+ fingerprint: zod.string().optional().describe("Device fingerprint correlation id."),
11639
+ request_id: zod
11640
+ .union([zod.string(), zod.null()])
11641
+ .optional()
11642
+ .describe("HTTP request correlation id."),
11643
+ session_id: zod
11644
+ .union([zod.string(), zod.null()])
11645
+ .optional()
11646
+ .describe("Session correlation id."),
11647
+ flow_id: zod
11648
+ .union([zod.string(), zod.null()])
11649
+ .optional()
11650
+ .describe("Login flow correlation id."),
11651
+ metadata: zod
11652
+ .object({
11653
+ client: zod
11654
+ .object({
11655
+ ip: zod
11656
+ .string()
11657
+ .optional()
11658
+ .describe("Client IP from the first X-Forwarded-For hop or RemoteAddr."),
11659
+ user_agent: zod.string().optional().describe("Observed User-Agent header."),
11660
+ origin: zod.string().optional().describe("Origin header when present."),
11661
+ })
11662
+ .optional()
11663
+ .describe("Observed HTTP requestor context on Path A request.api only."),
11664
+ })
11665
+ .optional()
11666
+ .describe(
11667
+ "Emit-time metadata, already redacted at write. Path A request.api may\nset client (ip, user_agent, origin) for SIEM join on request_id. Not a\nlive risk-evaluator input.\n",
11668
+ ),
11669
+ })
11670
+ .describe(
11671
+ "Shared wide-event envelope (ADR 048 \/ ADR 049). Concrete events are\n`allOf` this schema plus a `const` `event_type` and a typed `payload`.\n",
11672
+ )
10896
11673
  .and(
10897
11674
  zod.object({
10898
11675
  event_type: zod.literal("request.api"),
@@ -10905,9 +11682,9 @@ export const GetEventResponse = zod
10905
11682
  route_template: zod.string(),
10906
11683
  status: zod
10907
11684
  .number()
10908
- .min(getEventResponseOnenineTwoPayloadStatusMin)
10909
- .max(getEventResponseOnenineTwoPayloadStatusMax),
10910
- duration_ms: zod.number().min(getEventResponseOnenineTwoPayloadDurationMsMin),
11685
+ .min(getEventResponseTwozeroTwoPayloadStatusMin)
11686
+ .max(getEventResponseTwozeroTwoPayloadStatusMax),
11687
+ duration_ms: zod.number().min(getEventResponseTwozeroTwoPayloadDurationMsMin),
10911
11688
  })
10912
11689
  .describe("Payload for `request.api` events."),
10913
11690
  }),
@@ -10916,7 +11693,7 @@ export const GetEventResponse = zod
10916
11693
  zod
10917
11694
  .object({
10918
11695
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
10919
- project_id: zod.string().regex(getEventResponseTwozeroOneProjectIdRegExp),
11696
+ project_id: zod.string().regex(getEventResponseTwooneOneProjectIdRegExp),
10920
11697
  team_id: zod
10921
11698
  .union([zod.string(), zod.null()])
10922
11699
  .optional()
@@ -11021,7 +11798,7 @@ export const GetEventResponse = zod
11021
11798
  zod
11022
11799
  .object({
11023
11800
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11024
- project_id: zod.string().regex(getEventResponseTwooneOneProjectIdRegExp),
11801
+ project_id: zod.string().regex(getEventResponseTwotwoOneProjectIdRegExp),
11025
11802
  team_id: zod
11026
11803
  .union([zod.string(), zod.null()])
11027
11804
  .optional()
@@ -11113,7 +11890,7 @@ export const GetEventResponse = zod
11113
11890
  zod
11114
11891
  .object({
11115
11892
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11116
- project_id: zod.string().regex(getEventResponseTwotwoOneProjectIdRegExp),
11893
+ project_id: zod.string().regex(getEventResponseTwothreeOneProjectIdRegExp),
11117
11894
  team_id: zod
11118
11895
  .union([zod.string(), zod.null()])
11119
11896
  .optional()
@@ -11205,7 +11982,7 @@ export const GetEventResponse = zod
11205
11982
  zod
11206
11983
  .object({
11207
11984
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11208
- project_id: zod.string().regex(getEventResponseTwothreeOneProjectIdRegExp),
11985
+ project_id: zod.string().regex(getEventResponseTwofourOneProjectIdRegExp),
11209
11986
  team_id: zod
11210
11987
  .union([zod.string(), zod.null()])
11211
11988
  .optional()
@@ -11299,7 +12076,7 @@ export const GetEventResponse = zod
11299
12076
  zod
11300
12077
  .object({
11301
12078
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11302
- project_id: zod.string().regex(getEventResponseTwofourOneProjectIdRegExp),
12079
+ project_id: zod.string().regex(getEventResponseTwofiveOneProjectIdRegExp),
11303
12080
  team_id: zod
11304
12081
  .union([zod.string(), zod.null()])
11305
12082
  .optional()
@@ -11391,7 +12168,7 @@ export const GetEventResponse = zod
11391
12168
  zod
11392
12169
  .object({
11393
12170
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11394
- project_id: zod.string().regex(getEventResponseTwofiveOneProjectIdRegExp),
12171
+ project_id: zod.string().regex(getEventResponseTwosixOneProjectIdRegExp),
11395
12172
  team_id: zod
11396
12173
  .union([zod.string(), zod.null()])
11397
12174
  .optional()
@@ -11485,7 +12262,7 @@ export const GetEventResponse = zod
11485
12262
  zod
11486
12263
  .object({
11487
12264
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11488
- project_id: zod.string().regex(getEventResponseTwosixOneProjectIdRegExp),
12265
+ project_id: zod.string().regex(getEventResponseTwosevenOneProjectIdRegExp),
11489
12266
  team_id: zod
11490
12267
  .union([zod.string(), zod.null()])
11491
12268
  .optional()
@@ -11577,7 +12354,7 @@ export const GetEventResponse = zod
11577
12354
  zod
11578
12355
  .object({
11579
12356
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11580
- project_id: zod.string().regex(getEventResponseTwosevenOneProjectIdRegExp),
12357
+ project_id: zod.string().regex(getEventResponseTwoeightOneProjectIdRegExp),
11581
12358
  team_id: zod
11582
12359
  .union([zod.string(), zod.null()])
11583
12360
  .optional()
@@ -11673,7 +12450,7 @@ export const GetEventResponse = zod
11673
12450
  zod
11674
12451
  .object({
11675
12452
  id: zod.string().describe("Managed event id (`evt_<opaque>`)."),
11676
- project_id: zod.string().regex(getEventResponseTwoeightOneProjectIdRegExp),
12453
+ project_id: zod.string().regex(getEventResponseTwonineOneProjectIdRegExp),
11677
12454
  team_id: zod
11678
12455
  .union([zod.string(), zod.null()])
11679
12456
  .optional()