authhero 9.26.0 → 9.27.0

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 (70) hide show
  1. package/dist/assets/u/widget/authhero-widget.esm.js +1 -1
  2. package/dist/assets/u/widget/index.esm.js +1 -1
  3. package/dist/assets/u/widget/{p-210f06bf.entry.js → p-ce8560f6.entry.js} +1 -1
  4. package/dist/authhero.cjs +116 -116
  5. package/dist/authhero.d.ts +838 -338
  6. package/dist/authhero.mjs +23941 -22665
  7. package/dist/tsconfig.types.tsbuildinfo +1 -1
  8. package/dist/types/authentication-flows/device-code.d.ts +11 -0
  9. package/dist/types/authentication-flows/passwordless.d.ts +4 -3
  10. package/dist/types/generated/locale-types.d.ts +16 -0
  11. package/dist/types/helpers/client.d.ts +2 -0
  12. package/dist/types/helpers/codes-cleanup.d.ts +1 -1
  13. package/dist/types/helpers/device-flow.d.ts +25 -0
  14. package/dist/types/helpers/hook-events.d.ts +8 -4
  15. package/dist/types/helpers/hook-user-payload.d.ts +2 -0
  16. package/dist/types/helpers/logging.d.ts +2 -1
  17. package/dist/types/helpers/outbox-destinations/code-hooks.d.ts +8 -3
  18. package/dist/types/helpers/outbox-destinations/webhooks.d.ts +3 -0
  19. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  20. package/dist/types/helpers/scopes-permissions.d.ts +1 -1
  21. package/dist/types/hooks/lifecycle-codehooks.d.ts +16 -0
  22. package/dist/types/hooks/user-deletion.d.ts +9 -0
  23. package/dist/types/index.d.ts +559 -331
  24. package/dist/types/routes/auth-api/device.d.ts +139 -0
  25. package/dist/types/routes/auth-api/index.d.ts +225 -24
  26. package/dist/types/routes/auth-api/passwordless.d.ts +10 -10
  27. package/dist/types/routes/auth-api/revoke.d.ts +2 -2
  28. package/dist/types/routes/auth-api/token.d.ts +82 -12
  29. package/dist/types/routes/auth-api/well-known.d.ts +2 -0
  30. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  31. package/dist/types/routes/management-api/action-triggers.d.ts +27 -2
  32. package/dist/types/routes/management-api/actions.d.ts +11 -11
  33. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  34. package/dist/types/routes/management-api/branding.d.ts +5 -5
  35. package/dist/types/routes/management-api/clients.d.ts +2 -2
  36. package/dist/types/routes/management-api/connections.d.ts +9 -9
  37. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  38. package/dist/types/routes/management-api/emails.d.ts +6 -6
  39. package/dist/types/routes/management-api/forms.d.ts +144 -144
  40. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  41. package/dist/types/routes/management-api/hook-code.d.ts +2 -2
  42. package/dist/types/routes/management-api/hooks.d.ts +56 -56
  43. package/dist/types/routes/management-api/index.d.ts +326 -301
  44. package/dist/types/routes/management-api/log-streams.d.ts +6 -6
  45. package/dist/types/routes/management-api/logs.d.ts +4 -4
  46. package/dist/types/routes/management-api/organizations.d.ts +8 -8
  47. package/dist/types/routes/management-api/prompts.d.ts +8 -8
  48. package/dist/types/routes/management-api/resource-servers.d.ts +8 -8
  49. package/dist/types/routes/management-api/roles.d.ts +1 -1
  50. package/dist/types/routes/management-api/tenant-members-requests.test.d.ts +1 -0
  51. package/dist/types/routes/management-api/tenant-members.d.ts +155 -1
  52. package/dist/types/routes/management-api/tenant-operations.d.ts +12 -10
  53. package/dist/types/routes/management-api/tenants.d.ts +26 -12
  54. package/dist/types/routes/management-api/users.d.ts +15 -15
  55. package/dist/types/routes/proxy-control-plane/tenant-members.d.ts +11 -0
  56. package/dist/types/routes/scim/index.d.ts +1 -0
  57. package/dist/types/routes/universal-login/common.d.ts +16 -12
  58. package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
  59. package/dist/types/routes/universal-login/screens/device-flow.d.ts +4 -0
  60. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  61. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  62. package/dist/types/state-machines/login-session.d.ts +5 -0
  63. package/dist/types/tenant-members/request-notifier.d.ts +9 -0
  64. package/dist/types/tenant-members/request-notify.test.d.ts +1 -0
  65. package/dist/types/tenant-members/requests.d.ts +79 -0
  66. package/dist/types/tenant-members/requests.test.d.ts +1 -0
  67. package/dist/types/tenant-members/wire.d.ts +10 -0
  68. package/dist/types/types/AuthHeroConfig.d.ts +10 -0
  69. package/dist/types/types/Variables.d.ts +3 -1
  70. package/package.json +6 -6
@@ -170,7 +170,7 @@ export declare const u2Routes: OpenAPIHono<{
170
170
  $get: {
171
171
  input: {
172
172
  param: {
173
- screen: "impersonate" | "login" | "signup" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
173
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "device/code" | "device/confirmation" | "device/complete";
174
174
  };
175
175
  } & {
176
176
  query: {
@@ -186,7 +186,7 @@ export declare const u2Routes: OpenAPIHono<{
186
186
  } | {
187
187
  input: {
188
188
  param: {
189
- screen: "impersonate" | "login" | "signup" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
189
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "device/code" | "device/confirmation" | "device/complete";
190
190
  };
191
191
  } & {
192
192
  query: {
@@ -202,7 +202,7 @@ export declare const u2Routes: OpenAPIHono<{
202
202
  } | {
203
203
  input: {
204
204
  param: {
205
- screen: "impersonate" | "login" | "signup" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
205
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "device/code" | "device/confirmation" | "device/complete";
206
206
  };
207
207
  } & {
208
208
  query: {
@@ -222,7 +222,7 @@ export declare const u2Routes: OpenAPIHono<{
222
222
  $post: {
223
223
  input: {
224
224
  param: {
225
- screen: "impersonate" | "login" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
225
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "device/code" | "device/confirmation";
226
226
  };
227
227
  } & {
228
228
  query: {
@@ -240,7 +240,7 @@ export declare const u2Routes: OpenAPIHono<{
240
240
  } | {
241
241
  input: {
242
242
  param: {
243
- screen: "impersonate" | "login" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
243
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "device/code" | "device/confirmation";
244
244
  };
245
245
  } & {
246
246
  query: {
@@ -22,6 +22,11 @@ export interface LoginSessionData {
22
22
  inviter_name?: string;
23
23
  roles?: string[];
24
24
  connect?: Record<string, unknown>;
25
+ deviceFlow?: {
26
+ deviceCodeHash?: string;
27
+ userCode?: string;
28
+ ready?: boolean;
29
+ };
25
30
  try_connection_result?: unknown;
26
31
  }
27
32
  /** The on-disk JSON shape stays flat for compatibility with existing sessions. */
@@ -0,0 +1,9 @@
1
+ import type { ControlPlaneClient } from "../helpers/control-plane-client";
2
+ import type { AfterTenantMemberRequestRegistered } from "./requests";
3
+ /**
4
+ * Tells the control plane, over the shared control-plane client, that a
5
+ * request is waiting, and records that it was told. If the control plane is
6
+ * down the request simply stays unnotified and a control-plane sweep finds it
7
+ * later, so this never throws.
8
+ */
9
+ export declare function createControlPlaneRequestNotifier(client: ControlPlaneClient): AfterTenantMemberRequestRegistered;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,79 @@
1
+ import { z } from "@hono/zod-openapi";
2
+ import type { Context } from "hono";
3
+ import type { TenantMemberRequest } from "@authhero/adapter-interfaces";
4
+ import type { Bindings, Variables } from "../types";
5
+ import { TenantMembersBackend } from "./types";
6
+ /** What each kind of request carries in `payload`. */
7
+ export declare const tenantMemberRequestPayloadSchemas: {
8
+ invite: z.ZodObject<{
9
+ invitee: z.ZodObject<{
10
+ email: z.ZodString;
11
+ }, z.core.$strip>;
12
+ inviter: z.ZodDefault<z.ZodObject<{
13
+ name: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>>;
15
+ roles: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
16
+ send_invitation_email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
17
+ ttl_sec: z.ZodOptional<z.ZodNumber>;
18
+ }, z.core.$strip>;
19
+ add_members: z.ZodObject<{
20
+ user_ids: z.ZodArray<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ remove_members: z.ZodObject<{
23
+ user_ids: z.ZodArray<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ assign_roles: z.ZodObject<{
26
+ user_id: z.ZodString;
27
+ roles: z.ZodArray<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ remove_roles: z.ZodObject<{
30
+ user_id: z.ZodString;
31
+ roles: z.ZodArray<z.ZodString>;
32
+ }, z.core.$strip>;
33
+ revoke_invitation: z.ZodObject<{
34
+ invitation_id: z.ZodString;
35
+ }, z.core.$strip>;
36
+ };
37
+ type Ctx = Context<{
38
+ Bindings: Bindings;
39
+ Variables: Variables;
40
+ }>;
41
+ /**
42
+ * What a deployment does once a request is stored, given the stored row. A
43
+ * shard tells the control plane (`createControlPlaneRequestNotifier`), a
44
+ * single-instance deployment runs it right away. A failure here never fails
45
+ * the registration: the request stays `pending` and is picked up later.
46
+ */
47
+ export type AfterTenantMemberRequestRegistered = (ctx: Ctx, request: TenantMemberRequest) => Promise<void>;
48
+ export interface TenantMemberRequestsConfig {
49
+ afterRegister?: AfterTenantMemberRequestRegistered;
50
+ }
51
+ /**
52
+ * The request cannot be carried out, for a reason an admin may read: it is not
53
+ * a failure of the system, so it is not retried.
54
+ */
55
+ export declare class TenantMemberRequestRejected extends Error {
56
+ constructor(reason: string);
57
+ }
58
+ export interface ExecuteTenantMemberRequestOptions {
59
+ /**
60
+ * Whether the requester may still change this tenant's team. Defaults to
61
+ * holding at least one role in the tenant's organization.
62
+ */
63
+ isRequesterAllowed?: (backend: TenantMembersBackend, tenantId: string, userId: string) => Promise<boolean>;
64
+ }
65
+ /**
66
+ * Carries out one request against the control-plane team of its tenant.
67
+ *
68
+ * `tenantId` is the tenant the caller proved it speaks for (the verified
69
+ * service token's `tenant_id`); a request that names another tenant is
70
+ * refused. The requester is checked again here because the request may have
71
+ * waited a while. Running it twice is safe: membership and role changes are
72
+ * idempotent, and an invitation that was already created for the same address
73
+ * is reused instead of created again.
74
+ *
75
+ * Returns what the request produced, to store on the row. Throws
76
+ * {@link TenantMemberRequestRejected} when it must not or cannot run.
77
+ */
78
+ export declare function executeTenantMemberRequest(backend: TenantMembersBackend, tenantId: string, request: Pick<TenantMemberRequest, "tenant_id" | "kind" | "requested_by" | "payload" | "result">, options?: ExecuteTenantMemberRequestOptions): Promise<Record<string, unknown> | null>;
79
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -26,3 +26,13 @@ export declare const createInvitationBodySchema: z.ZodObject<{
26
26
  ttl_sec: z.ZodOptional<z.ZodNumber>;
27
27
  tenant_id: z.ZodOptional<z.ZodString>;
28
28
  }, z.core.$strip>;
29
+ /**
30
+ * A shard tells the control plane that a team-change request is waiting
31
+ * (issue #1550). Only the id travels: the control plane reads the request from
32
+ * the shard, so what was asked never rests on what the notification claims.
33
+ */
34
+ export declare const CONTROL_PLANE_TENANT_MEMBER_REQUESTS_NOTIFY_PATH = "/api/v2/proxy/control-plane/tenant-members/requests/notify";
35
+ export declare const notifyMemberRequestBodySchema: z.ZodObject<{
36
+ request_id: z.ZodString;
37
+ tenant_id: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
@@ -482,6 +482,16 @@ export interface AuthHeroConfig {
482
482
  */
483
483
  tenantMembers?: {
484
484
  getBackend: import("../routes/management-api/tenant-members").GetTenantMembersBackend;
485
+ /**
486
+ * Register team changes as requests instead of making them in the request
487
+ * (issue #1550). Needs `tenantMemberRequests` on the data adapter. A write
488
+ * then answers `202` with the request id, `GET /tenant-members/requests`
489
+ * lists them, and `afterRegister` decides what happens next: a shard tells
490
+ * the control plane (`createControlPlaneRequestNotifier`), a
491
+ * single-instance deployment runs the request right away. Unset keeps the
492
+ * synchronous writes.
493
+ */
494
+ requests?: import("../tenant-members/requests").TenantMemberRequestsConfig;
485
495
  };
486
496
  /**
487
497
  * Optional outbox-driven replication of `proxy_routes` mutations to a global
@@ -1,4 +1,4 @@
1
- import { DataAdapters, LoginSession } from "@authhero/adapter-interfaces";
1
+ import { DataAdapters, LoginSession, RequestAuth } from "@authhero/adapter-interfaces";
2
2
  import { CountryCode } from "libphonenumber-js";
3
3
  import { Auth0Client } from "./Auth0Client";
4
4
  import type { PreferState } from "../middlewares/prefer";
@@ -39,6 +39,8 @@ export type Variables = {
39
39
  client_id?: string;
40
40
  user_id?: string;
41
41
  username?: string;
42
+ /** Verified account-session caller, captured before account mutations. */
43
+ sessionAuth?: RequestAuth;
42
44
  connection?: string;
43
45
  body?: any;
44
46
  /**
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/sesamyab/authhero"
13
13
  },
14
- "version": "9.26.0",
14
+ "version": "9.27.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -63,8 +63,8 @@
63
63
  "vite": "^8.0.14",
64
64
  "vite-plugin-dts": "^4.5.4",
65
65
  "vitest": "^4.1.7",
66
- "@authhero/kysely-adapter": "12.17.0",
67
- "@authhero/widget": "0.41.5"
66
+ "@authhero/kysely-adapter": "12.18.0",
67
+ "@authhero/widget": "0.41.7"
68
68
  },
69
69
  "dependencies": {
70
70
  "@peculiar/x509": "^1.14.3",
@@ -80,9 +80,9 @@
80
80
  "qrcode": "^1.5.4",
81
81
  "sanitize-html": "^2.17.4",
82
82
  "xstate": "^5.31.1",
83
- "@authhero/adapter-interfaces": "4.23.0",
84
- "@authhero/proxy": "0.11.9",
85
- "@authhero/saml": "0.6.2"
83
+ "@authhero/adapter-interfaces": "4.24.0",
84
+ "@authhero/proxy": "0.11.10",
85
+ "@authhero/saml": "0.6.3"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@authhero/widget": "^0.1.0",