@fleetless/contracts 5.3.0-next.1 → 6.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +108 -33
  2. package/artifacts/openapi.json +2053 -784
  3. package/artifacts/routes.json +1680 -323
  4. package/artifacts/schema/accept-team-invite-request.schema.json +13 -7
  5. package/artifacts/schema/app-auth-config.schema.json +108 -4
  6. package/artifacts/schema/app-hosted-pages.schema.json +33 -0
  7. package/artifacts/schema/app-invitation.schema.json +5 -12
  8. package/artifacts/schema/app-mail-template-list-response.schema.json +4 -3
  9. package/artifacts/schema/app-mail-template.schema.json +3 -2
  10. package/artifacts/schema/app-sign-in-methods.schema.json +19 -0
  11. package/artifacts/schema/app-user-list-response.schema.json +36 -0
  12. package/artifacts/schema/app-user.schema.json +36 -0
  13. package/artifacts/schema/audit-query.schema.json +0 -6
  14. package/artifacts/schema/auth-me-response.schema.json +27 -0
  15. package/artifacts/schema/auth-ok.schema.json +13 -1
  16. package/artifacts/schema/client-accept-invitation-request.schema.json +3 -4
  17. package/artifacts/schema/client-identity.schema.json +13 -1
  18. package/artifacts/schema/client-login-code-request.schema.json +24 -0
  19. package/artifacts/schema/client-login-code-verify-request.schema.json +30 -0
  20. package/artifacts/schema/client-provider-list-response.schema.json +22 -2
  21. package/artifacts/schema/client-register-request.schema.json +3 -4
  22. package/artifacts/schema/client-sign-in-result.schema.json +55 -0
  23. package/artifacts/schema/client-two-factor-disable-request.schema.json +15 -0
  24. package/artifacts/schema/client-two-factor-setup-confirm-request.schema.json +20 -0
  25. package/artifacts/schema/client-two-factor-setup-confirm-response.schema.json +49 -0
  26. package/artifacts/schema/client-two-factor-setup-request.schema.json +12 -0
  27. package/artifacts/schema/client-two-factor-verify-request.schema.json +25 -0
  28. package/artifacts/schema/create-app-invitation-request.schema.json +1 -1
  29. package/artifacts/schema/create-passkey-request.schema.json +25 -0
  30. package/artifacts/schema/create-passkey-response.schema.json +84 -0
  31. package/artifacts/schema/developer-passkey.schema.json +56 -0
  32. package/artifacts/schema/developer-two-factor.schema.json +105 -0
  33. package/artifacts/schema/fleetless-user-list-response.schema.json +22 -0
  34. package/artifacts/schema/fleetless-user.schema.json +22 -0
  35. package/artifacts/schema/invalid-code-details.schema.json +16 -0
  36. package/artifacts/schema/job-actor.schema.json +1 -15
  37. package/artifacts/schema/job-run-list-response.schema.json +1 -15
  38. package/artifacts/schema/job-run.schema.json +1 -15
  39. package/artifacts/schema/org.schema.json +5 -0
  40. package/artifacts/schema/patch-org-request.schema.json +5 -3
  41. package/artifacts/schema/patch-org-response.schema.json +5 -0
  42. package/artifacts/schema/put-app-auth-look-request.schema.json +22 -0
  43. package/artifacts/schema/put-app-auth-mcp-request.schema.json +1 -14
  44. package/artifacts/schema/put-app-auth-sign-in-request.schema.json +39 -0
  45. package/artifacts/schema/put-app-auth-urls-request.schema.json +31 -4
  46. package/artifacts/schema/recovery-codes-response.schema.json +20 -0
  47. package/artifacts/schema/{role-rename-request.schema.json → rename-passkey-request.schema.json} +2 -2
  48. package/artifacts/schema/role-list-response.schema.json +1 -1
  49. package/artifacts/schema/role.schema.json +1 -1
  50. package/artifacts/schema/totp-confirm-request.schema.json +15 -0
  51. package/artifacts/schema/totp-confirm-response.schema.json +27 -0
  52. package/artifacts/schema/two-factor-challenge.schema.json +24 -0
  53. package/artifacts/schema/two-factor-setup-response.schema.json +21 -0
  54. package/artifacts/schema/webauthn-options-response.schema.json +18 -0
  55. package/dist/app-users.d.ts +154 -35
  56. package/dist/app-users.js +177 -46
  57. package/dist/apps.d.ts +2 -38
  58. package/dist/apps.js +3 -46
  59. package/dist/audit.d.ts +0 -1
  60. package/dist/audit.js +0 -13
  61. package/dist/client-auth.d.ts +133 -24
  62. package/dist/client-auth.js +139 -28
  63. package/dist/config.d.ts +2 -2
  64. package/dist/errors.d.ts +10 -1
  65. package/dist/errors.js +37 -38
  66. package/dist/identity.d.ts +175 -128
  67. package/dist/identity.js +192 -106
  68. package/dist/index.d.ts +11 -13
  69. package/dist/index.js +12 -10
  70. package/dist/jobs.d.ts +0 -3
  71. package/dist/jobs.js +0 -16
  72. package/dist/protocol.d.ts +1 -1
  73. package/dist/realtime.d.ts +1 -0
  74. package/dist/rest.d.ts +2 -2
  75. package/dist/rest.js +17 -28
  76. package/dist/routes.d.ts +26 -0
  77. package/dist/routes.js +528 -234
  78. package/package.json +1 -1
  79. package/artifacts/schema/developer-login-request.schema.json +0 -19
  80. package/artifacts/schema/feedback-request.schema.json +0 -34
  81. package/artifacts/schema/feedback-response.schema.json +0 -27
  82. package/artifacts/schema/password-reset-confirm.schema.json +0 -19
  83. package/artifacts/schema/password-reset-request.schema.json +0 -14
  84. package/artifacts/schema/role-delete-query.schema.json +0 -13
  85. package/artifacts/schema/role-in-use-details.schema.json +0 -28
  86. package/artifacts/schema/sign-up-request.schema.json +0 -26
  87. package/artifacts/schema/sign-up-response.schema.json +0 -127
  88. package/dist/feedback.d.ts +0 -42
  89. package/dist/feedback.js +0 -35
package/dist/rest.js CHANGED
@@ -567,23 +567,17 @@ export const jobResponse = z.object({
567
567
  * There are no compatibility aliases, because an alias here is how a deleted
568
568
  * model survives in production while the contract says otherwise.
569
569
  *
570
- * **`POST /api/auth/password/reset` answers `202` for every well-formed
571
- * address**, known or not. It is the one route where saying nothing about
572
- * whether an account exists is not a preference but the entire point: any
573
- * status, body or timing difference between the two cases is an
570
+ * **Every route that mails a code or a link answers the same for a known and
571
+ * an unknown address** — the portal's identify step, `POST
572
+ * /api/client/login/code`, `POST /api/client/password/reset`. Saying nothing
573
+ * about whether an account exists is not a preference there but the entire
574
+ * point: any status, body or timing difference between the two cases is an
574
575
  * account-enumeration oracle. Note *timing* — a route that only sends mail for
575
- * a real address must not become measurably faster for an unknown one. Email is
576
- * **globally unique**, so a bare address names at most one account and the
577
- * route mails the one match, if any. See `passwordResetRequest`.
578
- *
579
- * **Both surfaces get the password routes, mirrored.** An end user and a
580
- * console user each need a way to change and to reset a password.
581
- * `passwordChangeRequest` is shared because the operation is identical; the
582
- * **prefix** is what says
583
- * which session is being spent, exactly as it does for `login`. The two *reset*
584
- * requests are separate shapes rather than one, because the surfaces identify a
585
- * person differently: a Fleetless user by a globally unique address, an app
586
- * user by app **and** address.
576
+ * a real address must not become measurably faster for an unknown one.
577
+ *
578
+ * **Only app users hold a password.** Fleetless users sign in by emailed code
579
+ * or passkey, so the password change and reset routes are the app user's
580
+ * alone, under `/api/client`.
587
581
  *
588
582
  * **A password change answers with fresh `sessionTokens`, not `204`.** The
589
583
  * promise is that the session which made the change survives while every other
@@ -611,20 +605,15 @@ export const jobResponse = z.object({
611
605
  *
612
606
  * | purpose | URL |
613
607
  * |---|---|
614
- * | password reset, Fleetless user | `{portal}/reset-password/{token}` |
615
608
  * | team invitation | `{portal}/accept-invite/{token}` |
616
609
  *
617
- * **An app user's links are not in this table, and cannot be** (2026-09-05,
618
- * Fleetless renders an app user no page, so there is no `{portal}` path
619
- * to name: the link points into the **developer's own app**, at the template
620
- * they configured (`appAuthConfig.invite_url`, `verify_url`, `reset_url`), with
621
- * the token substituted for `{token}`. That is why those fields are validated
622
- * as templates rather than as URLs, and why an app with none configured is
623
- * refused a `send_mail` instead of being mailed a link to nowhere.
624
- *
625
- * The paragraph this replaces said an app-user reset *"is a feature to design,
626
- * not a row to restore"*. It was designed; the answer was that the row belongs
627
- * to the developer and not to this table.
610
+ * **An app user's links point into the developer's own app** where it has
611
+ * configured one — the template in `appAuthConfig.invite_url`, `verify_url` or
612
+ * `reset_url`, with the token substituted for `{token}`. That is why those
613
+ * fields are validated as templates rather than as URLs. Where the app has
614
+ * configured none, the link points at the Fleetless-hosted page the cloud
615
+ * reports in `appAuthConfig.hosted_pages` (`{portal}/app/<identifier>/…`), so
616
+ * no mail is refused for a missing URL.
628
617
  *
629
618
  * The strings themselves live server-side, read by the
630
619
  * route that serves each page AND by the builder that mails it — one constant,
package/dist/routes.d.ts CHANGED
@@ -92,4 +92,30 @@ export declare const ROUTE_SECTIONS: readonly {
92
92
  }[];
93
93
  /** The routes that verify a credential inside the handler; `auth: 'in_handler'` is refused elsewhere. */
94
94
  export declare const IN_HANDLER_ROUTES: readonly string[];
95
+ /**
96
+ * **The steps of a developer sign-in, written once for both portal flows.**
97
+ *
98
+ * The console's own OAuth flow (`/console/oauth`) and the central MCP
99
+ * endpoint's (`/mcp/oauth`) sign the same people in the same way: an emailed
100
+ * code or a passkey, then the second factor where the person has one or the
101
+ * organisation requires one. Two hand-written copies of thirteen rows would
102
+ * drift; this returns them for a prefix, and `ROUTES` spreads both.
103
+ *
104
+ * Every step is a page the auth portal serves to itself: `audience:
105
+ * 'internal'`, no request schema — the handlers read form fields by hand — and
106
+ * HTML for a browser form post, JSON for a JSON caller.
107
+ *
108
+ * **The browser-proof cookie binds the interaction to one browser**, and it
109
+ * is set by whichever of these comes first for the interaction: the email
110
+ * card (`GET <prefix>/interaction/:id`), `POST <prefix>/identify`, or `POST
111
+ * <prefix>/passkey/options`. The email card is what a browser normally opens
112
+ * first; the two steps set it for a caller that never loaded the page, so
113
+ * `Sign in with a passkey` works without an email step. Once the interaction
114
+ * is bound, every step — those three included — without the matching cookie
115
+ * renders the `wrong_browser` page. The interaction's ten
116
+ * minutes cover every step; only when the last one is done is anything
117
+ * minted. **For `/mcp/oauth`, "done" means the consent step**, as the
118
+ * password did before.
119
+ */
120
+ export declare function developerSignInRoutes(prefix: '/console/oauth' | '/mcp/oauth'): RouteEntry[];
95
121
  export declare const ROUTES: readonly RouteEntry[];