authhero 9.13.1 → 9.14.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 (45) hide show
  1. package/dist/authhero.cjs +141 -141
  2. package/dist/authhero.d.ts +294 -264
  3. package/dist/authhero.mjs +7686 -7642
  4. package/dist/tsconfig.types.tsbuildinfo +1 -1
  5. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  6. package/dist/types/emails/index.d.ts +8 -9
  7. package/dist/types/emails/render.d.ts +2 -6
  8. package/dist/types/helpers/connection.d.ts +2 -6
  9. package/dist/types/helpers/logging.d.ts +2 -5
  10. package/dist/types/helpers/reserved-claims.d.ts +4 -8
  11. package/dist/types/helpers/service-token.d.ts +2 -5
  12. package/dist/types/helpers/wait-until.d.ts +3 -1
  13. package/dist/types/index.d.ts +258 -258
  14. package/dist/types/routes/auth-api/index.d.ts +47 -47
  15. package/dist/types/routes/auth-api/passwordless.d.ts +10 -10
  16. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  17. package/dist/types/routes/auth-api/revoke.d.ts +8 -8
  18. package/dist/types/routes/auth-api/token.d.ts +22 -22
  19. package/dist/types/routes/auth-api/well-known.d.ts +1 -1
  20. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  21. package/dist/types/routes/management-api/actions.d.ts +1 -1
  22. package/dist/types/routes/management-api/clients.d.ts +8 -8
  23. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  24. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  25. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  26. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  27. package/dist/types/routes/management-api/index.d.ts +233 -233
  28. package/dist/types/routes/management-api/keys.d.ts +4 -4
  29. package/dist/types/routes/management-api/logs.d.ts +4 -4
  30. package/dist/types/routes/management-api/organizations.d.ts +2 -2
  31. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  32. package/dist/types/routes/management-api/roles.d.ts +1 -1
  33. package/dist/types/routes/management-api/tenants.d.ts +1 -1
  34. package/dist/types/routes/management-api/users.d.ts +11 -11
  35. package/dist/types/routes/proxy-control-plane/tenant-members.d.ts +9 -2
  36. package/dist/types/routes/proxy-control-plane/verify.d.ts +15 -0
  37. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  38. package/dist/types/routes/universal-login/index.d.ts +2 -2
  39. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  40. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  41. package/dist/types/tenant-members/local-backend.d.ts +11 -3
  42. package/dist/types/types/RequestContext.d.ts +16 -0
  43. package/dist/types/types/index.d.ts +1 -0
  44. package/dist/types/utils/jwks.d.ts +2 -2
  45. package/package.json +3 -3
@@ -475,7 +475,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
475
475
  custom_login_page_preview?: string | undefined;
476
476
  form_template?: string | undefined;
477
477
  addons?: Record<string, any> | undefined;
478
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
478
+ token_endpoint_auth_method?: "client_secret_post" | "client_secret_basic" | "none" | "client_secret_jwt" | "private_key_jwt" | undefined;
479
479
  client_metadata?: Record<string, string> | undefined;
480
480
  hide_sign_up_disabled_error?: boolean | undefined;
481
481
  mobile?: Record<string, any> | undefined;
@@ -558,8 +558,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
558
558
  } | undefined;
559
559
  authenticated_at?: string | undefined;
560
560
  };
561
- connectionType: "username" | "sms" | "email";
562
- authConnection: "username" | "sms" | "email";
561
+ connectionType: "email" | "username" | "sms";
562
+ authConnection: "email" | "username" | "sms";
563
563
  session_id: string | undefined;
564
564
  authParams: {
565
565
  audience?: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { Context } from "hono";
2
- import { Bindings, Variables } from "../types";
2
+ import { Bindings, RequestContext, Variables } from "../types";
3
3
  import { AuthParams, EmailTemplateName, User } from "@authhero/adapter-interfaces";
4
4
  export type SendEmailParams = {
5
5
  to: string;
@@ -10,10 +10,7 @@ export type SendEmailParams = {
10
10
  data: Record<string, string>;
11
11
  from?: string;
12
12
  };
13
- export declare function sendEmail(ctx: Context<{
14
- Bindings: Bindings;
15
- Variables: Variables;
16
- }>, params: SendEmailParams): Promise<void>;
13
+ export declare function sendEmail(ctx: RequestContext, params: SendEmailParams, tenantIdOverride?: string): Promise<void>;
17
14
  export type SendSmsParams = {
18
15
  to: string;
19
16
  from?: string;
@@ -63,11 +60,13 @@ export interface SendInvitationParams {
63
60
  organizationName: string;
64
61
  ttlSec: number;
65
62
  language?: string;
63
+ /**
64
+ * Tenant whose email provider, branding, templates and locales are used.
65
+ * Defaults to the request's tenant.
66
+ */
67
+ tenantId?: string;
66
68
  }
67
- export declare function sendInvitation(ctx: Context<{
68
- Bindings: Bindings;
69
- Variables: Variables;
70
- }>, { to, invitationUrl, inviterName, organizationName, ttlSec, language, }: SendInvitationParams): Promise<void>;
69
+ export declare function sendInvitation(ctx: RequestContext, { to, invitationUrl, inviterName, organizationName, ttlSec, language, tenantId: tenantIdOverride, }: SendInvitationParams): Promise<void>;
71
70
  export interface SendTestEmailParams {
72
71
  to: string;
73
72
  templateName: EmailTemplateName;
@@ -1,7 +1,6 @@
1
- import { Context } from "hono";
2
1
  import { Liquid } from "liquidjs";
3
2
  import { EmailTemplateName } from "@authhero/adapter-interfaces";
4
- import { Bindings, Variables } from "../types";
3
+ import { RequestContext } from "../types";
5
4
  export declare function getLiquid(): Liquid;
6
5
  export interface RenderedEmail {
7
6
  subject: string;
@@ -29,10 +28,7 @@ export type RenderResult = {
29
28
  * 2. Bundled default (compiled from MJML at build time).
30
29
  * 3. `{ kind: "none" }` if neither exists.
31
30
  */
32
- export declare function renderEmailTemplate(ctx: Context<{
33
- Bindings: Bindings;
34
- Variables: Variables;
35
- }>, templateName: EmailTemplateName, vars: Record<string, unknown>, fallbackFrom: string): Promise<RenderResult>;
31
+ export declare function renderEmailTemplate(ctx: RequestContext, templateName: EmailTemplateName, vars: Record<string, unknown>, fallbackFrom: string, tenantId: string): Promise<RenderResult>;
36
32
  /**
37
33
  * Render the bundled default template directly, without consulting the
38
34
  * adapter. Exposed for tests and tooling.
@@ -1,6 +1,5 @@
1
- import { Context } from "hono";
2
1
  import { LoginSession, User } from "@authhero/adapter-interfaces";
3
- import { Bindings, Variables } from "../types";
2
+ import { RequestContext } from "../types";
4
3
  import { HookEvent } from "../types/Hooks";
5
4
  export type ConnectionInfo = NonNullable<HookEvent["connection"]>;
6
5
  export interface ConnectionNameSources {
@@ -34,7 +33,4 @@ export declare function resolveConnectionName(sources: ConnectionNameSources): s
34
33
  * Returns `undefined` when the name is empty or doesn't resolve to a known
35
34
  * connection — callers decide whether to synthesize a fallback.
36
35
  */
37
- export declare function getConnectionInfo(ctx: Context<{
38
- Bindings: Bindings;
39
- Variables: Variables;
40
- }>, tenantId: string, connectionName: string | undefined, user?: Pick<User, "provider"> | null): Promise<ConnectionInfo | undefined>;
36
+ export declare function getConnectionInfo(ctx: RequestContext, tenantId: string, connectionName: string | undefined, user?: Pick<User, "provider"> | null): Promise<ConnectionInfo | undefined>;
@@ -1,6 +1,6 @@
1
1
  import { Context } from "hono";
2
2
  import { DataAdapters, LogType } from "@authhero/adapter-interfaces";
3
- import { Variables, Bindings } from "../types";
3
+ import { Variables, Bindings, RequestContext } from "../types";
4
4
  export type LogParams = {
5
5
  type: LogType;
6
6
  description?: string;
@@ -80,10 +80,7 @@ export type LogParams = {
80
80
  /** Entity ID being mutated */
81
81
  targetId?: string;
82
82
  };
83
- export declare function logMessage(ctx: Context<{
84
- Bindings: Bindings;
85
- Variables: Variables;
86
- }>, tenantId: string, params: LogParams): Promise<void>;
83
+ export declare function logMessage(ctx: RequestContext, tenantId: string, params: LogParams): Promise<void>;
87
84
  /**
88
85
  * Transactional variant of {@link logMessage}. Writes the audit event to the
89
86
  * outbox through the caller-provided `trxData` so the insert commits (or rolls
@@ -1,5 +1,4 @@
1
- import { Context } from "hono";
2
- import { Bindings, Variables } from "../types";
1
+ import { RequestContext } from "../types";
3
2
  /** RFC 9068 §2.2 + AuthHero-owned access-token claims. */
4
3
  export declare const ACCESS_TOKEN_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "exp", "nbf", "iat", "jti", "client_id", "azp", "scope", "auth_time", "acr", "amr", "act", "sid", "permissions", "tenant_id", "org_id", "org_name", "requested_userinfo_claims", "gty"];
5
4
  /** OIDC Core ID-token claims: the access-token set plus the ID-token-only ones. */
@@ -15,9 +14,9 @@ export declare const USERINFO_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "e
15
14
  * vendor/tenant for downstream APIs while `sub` stays `auth-service`.
16
15
  * Client-bound mints keep `azp` locked (see below).
17
16
  */
18
- export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "scope" | "sid" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "permissions" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
17
+ export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("iss" | "tenant_id" | "scope" | "client_id" | "org_name" | "org_id" | "sub" | "aud" | "exp" | "nbf" | "iat" | "jti" | "auth_time" | "acr" | "amr" | "act" | "sid" | "permissions" | "requested_userinfo_claims" | "gty")[];
19
18
  /** Client-bound mints: `azp` must stay the registered client id. */
20
- export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "scope" | "sid" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "permissions" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
19
+ export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("iss" | "tenant_id" | "scope" | "client_id" | "org_name" | "org_id" | "sub" | "aud" | "exp" | "nbf" | "iat" | "jti" | "azp" | "auth_time" | "acr" | "amr" | "act" | "sid" | "permissions" | "requested_userinfo_claims" | "gty")[];
21
20
  export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
22
21
  export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
23
22
  /**
@@ -58,10 +57,7 @@ export interface ApplyCustomClaimOptions {
58
57
  */
59
58
  source: string;
60
59
  /** Request context, when there is one — the warning goes to the tenant log. */
61
- ctx?: Context<{
62
- Bindings: Bindings;
63
- Variables: Variables;
64
- }>;
60
+ ctx?: RequestContext;
65
61
  /** Tenant to log against. Defaults to `ctx.var.tenant_id`. */
66
62
  tenantId?: string;
67
63
  }
@@ -1,6 +1,6 @@
1
1
  import { Context } from "hono";
2
2
  import { KeysAdapter, TenantsDataAdapter } from "@authhero/adapter-interfaces";
3
- import { Bindings, Variables } from "../types";
3
+ import { Bindings, RequestContext, Variables } from "../types";
4
4
  import { SigningKeyModeOption } from "../types/AuthHeroConfig";
5
5
  declare const AUTH_SERVICE_CLIENT_ID = "auth-service";
6
6
  export interface ServiceTokenResponse {
@@ -89,8 +89,5 @@ export interface CreateClientServiceTokenOptions {
89
89
  * Fails closed: rejects if the client has no grant for the (audience), or if
90
90
  * any requested scope is not in `grant.scope`.
91
91
  */
92
- export declare function createClientServiceToken(ctx: Context<{
93
- Bindings: Bindings;
94
- Variables: Variables;
95
- }>, tenantId: string, params: CreateClientServiceTokenParams, options?: CreateClientServiceTokenOptions): Promise<ServiceTokenResponse>;
92
+ export declare function createClientServiceToken(ctx: RequestContext, tenantId: string, params: CreateClientServiceTokenParams, options?: CreateClientServiceTokenOptions): Promise<ServiceTokenResponse>;
96
93
  export { AUTH_SERVICE_CLIENT_ID };
@@ -12,7 +12,9 @@ import { Context } from "hono";
12
12
  * webhook dispatches) completes, producing flaky test behavior and requests
13
13
  * that occasionally lose tail work if the process exits.
14
14
  */
15
- export declare function waitUntil(ctx: Context, promise: Promise<unknown>): void;
15
+ export declare function waitUntil(ctx: Pick<Context, "executionCtx" | "var"> & {
16
+ set(key: "backgroundPromises", value: Promise<void>[]): void;
17
+ }, promise: Promise<unknown>): void;
16
18
  /**
17
19
  * Await any `waitUntil` promises registered during the current request. Invoke
18
20
  * from a middleware's finally block (after `await next()`) so non-Workers