authhero 5.17.1 → 5.19.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 (50) 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-35c8b265.entry.js +1 -0
  4. package/dist/authhero.cjs +139 -136
  5. package/dist/authhero.d.ts +425 -194
  6. package/dist/authhero.mjs +10490 -9833
  7. package/dist/stats.html +1 -1
  8. package/dist/tsconfig.types.tsbuildinfo +1 -1
  9. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  10. package/dist/types/emails/defaults/Layout.d.ts +3 -3
  11. package/dist/types/emails/defaults/PrimaryButton.d.ts +5 -2
  12. package/dist/types/helpers/consent.d.ts +31 -0
  13. package/dist/types/helpers/control-plane-sync-events.d.ts +67 -0
  14. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  15. package/dist/types/helpers/default-destinations.d.ts +11 -0
  16. package/dist/types/helpers/outbox-destinations/control-plane-sync.d.ts +35 -0
  17. package/dist/types/helpers/outbox-destinations/logs.d.ts +2 -0
  18. package/dist/types/index.d.ts +285 -191
  19. package/dist/types/middlewares/index.d.ts +3 -0
  20. package/dist/types/middlewares/prefer.d.ts +12 -0
  21. package/dist/types/routes/auth-api/index.d.ts +26 -26
  22. package/dist/types/routes/auth-api/passwordless.d.ts +14 -14
  23. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  24. package/dist/types/routes/auth-api/token.d.ts +10 -10
  25. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  26. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  27. package/dist/types/routes/management-api/clients.d.ts +7 -7
  28. package/dist/types/routes/management-api/connections.d.ts +1 -1
  29. package/dist/types/routes/management-api/email-templates.d.ts +31 -14
  30. package/dist/types/routes/management-api/forms.d.ts +119 -119
  31. package/dist/types/routes/management-api/grants.d.ts +80 -0
  32. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  33. package/dist/types/routes/management-api/index.d.ts +250 -159
  34. package/dist/types/routes/management-api/logs.d.ts +3 -3
  35. package/dist/types/routes/management-api/organizations.d.ts +2 -2
  36. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  37. package/dist/types/routes/management-api/proxy-routes.d.ts +1 -0
  38. package/dist/types/routes/management-api/users.d.ts +2 -2
  39. package/dist/types/routes/proxy-control-plane/index.d.ts +34 -1
  40. package/dist/types/routes/universal-login/common.d.ts +2 -2
  41. package/dist/types/routes/universal-login/flow-api.d.ts +12 -12
  42. package/dist/types/routes/universal-login/screens/consent.d.ts +9 -0
  43. package/dist/types/routes/universal-login/u2-index.d.ts +6 -6
  44. package/dist/types/routes/universal-login/u2-routes.d.ts +6 -6
  45. package/dist/types/state-machines/login-session.d.ts +12 -1
  46. package/dist/types/types/AuthHeroConfig.d.ts +26 -0
  47. package/dist/types/types/IdToken.d.ts +1 -1
  48. package/dist/types/types/Variables.d.ts +2 -0
  49. package/package.json +5 -5
  50. package/dist/assets/u/widget/p-f0f9eca3.entry.js +0 -1
@@ -448,7 +448,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
448
448
  custom_login_page_preview?: string | undefined;
449
449
  form_template?: string | undefined;
450
450
  addons?: Record<string, any> | undefined;
451
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
451
+ token_endpoint_auth_method?: "none" | "private_key_jwt" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | undefined;
452
452
  client_metadata?: Record<string, string> | undefined;
453
453
  hide_sign_up_disabled_error?: boolean | undefined;
454
454
  mobile?: Record<string, any> | undefined;
@@ -531,8 +531,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
531
531
  } | undefined;
532
532
  authenticated_at?: string | undefined;
533
533
  };
534
- connectionType: "username" | "email" | "sms";
535
- authConnection: "username" | "email" | "sms";
534
+ connectionType: "username" | "sms" | "email";
535
+ authConnection: "username" | "sms" | "email";
536
536
  session_id: string | undefined;
537
537
  authParams: {
538
538
  client_id: string;
@@ -4,9 +4,9 @@ interface LayoutProps {
4
4
  children: ReactNode;
5
5
  }
6
6
  /**
7
- * Shared frame for all built-in email defaults. Liquid placeholders
8
- * (`{{ branding.logo }}`, `{{ tenant.support_url }}`, etc.) are emitted as
9
- * raw strings; the runtime Liquid pass interpolates them per-send.
7
+ * Shared frame for all built-in email defaults. Every visual token
8
+ * (logo, colors, signature, address) is emitted as a raw Liquid placeholder
9
+ * and resolved at send time from the tenant's branding + per-send vars.
10
10
  */
11
11
  export declare function Layout({ preview, children }: LayoutProps): import("react").JSX.Element;
12
12
  export {};
@@ -4,8 +4,11 @@ interface PrimaryButtonProps {
4
4
  children: ReactNode;
5
5
  }
6
6
  /**
7
- * Liquid-friendly button. The background color is a Liquid placeholder so the
8
- * runtime pass can substitute the tenant's `branding.primary_color`.
7
+ * Liquid-friendly button. Background, text color, and border radius are
8
+ * emitted as raw Liquid placeholders; `sendTemplatedEmail` is responsible
9
+ * for resolving defaults before render. Inlining `| default: '...'` here
10
+ * would not survive React Email's HTML escaping — single quotes become
11
+ * `&#x27;`, which liquidjs cannot parse as a string literal.
9
12
  */
10
13
  export declare function PrimaryButton({ href, children }: PrimaryButtonProps): import("react").JSX.Element;
11
14
  export {};
@@ -0,0 +1,31 @@
1
+ import { Context } from "hono";
2
+ import { Bindings, Variables } from "../types";
3
+ /**
4
+ * OIDC basic scopes — these are exempt from the third-party consent gate
5
+ * because they only authorize the standard ID-token / userinfo claims that
6
+ * are implicit in any OIDC sign-in.
7
+ */
8
+ export declare const BASIC_OIDC_SCOPES: Set<string>;
9
+ /**
10
+ * Return the scopes in `requested` that are not in `consented` and are not
11
+ * basic OIDC scopes. An empty result means the existing consent record (if
12
+ * any) covers everything the client asked for.
13
+ */
14
+ export declare function computeMissingConsentScopes(requested: string[], consented: string[]): string[];
15
+ /**
16
+ * Load the user's stored consent for (tenant, user, client) and compute the
17
+ * scopes that still need explicit consent. Returns an empty array if the
18
+ * consent gate should pass.
19
+ *
20
+ * Fail-closed when the adapter isn't configured: the function treats every
21
+ * non-basic requested scope as missing so the caller blocks the auth flow.
22
+ */
23
+ export declare function getMissingConsentScopes(ctx: Context<{
24
+ Bindings: Bindings;
25
+ Variables: Variables;
26
+ }>, params: {
27
+ tenantId: string;
28
+ userId: string;
29
+ clientId: string;
30
+ requestedScopes: string[];
31
+ }): Promise<string[]>;
@@ -0,0 +1,67 @@
1
+ import { Context } from "hono";
2
+ import { CustomDomain, ProxyRoute } from "@authhero/adapter-interfaces";
3
+ import { Bindings, Variables } from "../types";
4
+ export declare const CONTROL_PLANE_SYNC_EVENT_PREFIX = "controlplane.sync.";
5
+ export type SyncEntity = "custom_domain" | "proxy_route";
6
+ export type SyncOp = "created" | "updated" | "deleted";
7
+ /**
8
+ * Wire shape posted from the tenant shard to the control plane. The destination
9
+ * serializes one event per HTTP request; the receiver accepts a batch
10
+ * (`{ events: [...] }`) for forward compatibility with a future
11
+ * batched-delivery destination.
12
+ */
13
+ export type SyncEvent = {
14
+ event_id: string;
15
+ tenant_id: string;
16
+ entity: "custom_domain";
17
+ op: "created" | "updated";
18
+ aggregate_id: string;
19
+ payload: CustomDomain;
20
+ occurred_at: string;
21
+ } | {
22
+ event_id: string;
23
+ tenant_id: string;
24
+ entity: "custom_domain";
25
+ op: "deleted";
26
+ aggregate_id: string;
27
+ payload: CustomDomain;
28
+ occurred_at: string;
29
+ } | {
30
+ event_id: string;
31
+ tenant_id: string;
32
+ entity: "proxy_route";
33
+ op: "created" | "updated";
34
+ aggregate_id: string;
35
+ payload: ProxyRoute;
36
+ occurred_at: string;
37
+ } | {
38
+ event_id: string;
39
+ tenant_id: string;
40
+ entity: "proxy_route";
41
+ op: "deleted";
42
+ aggregate_id: string;
43
+ payload: ProxyRoute;
44
+ occurred_at: string;
45
+ };
46
+ interface EnqueueArgs {
47
+ tenantId: string;
48
+ entity: SyncEntity;
49
+ op: SyncOp;
50
+ aggregateId: string;
51
+ payload: CustomDomain | ProxyRoute;
52
+ }
53
+ /**
54
+ * Enqueue a `controlplane.sync.*` event to the outbox so the
55
+ * `ControlPlaneSyncDestination` can replicate the mutation to the global
56
+ * control-plane data store.
57
+ *
58
+ * Mirrors the pattern used by `enqueuePostHookEvent`: pushes the
59
+ * `outbox.create` promise onto `ctx.var.outboxEventPromises` so the outbox
60
+ * middleware awaits it in its finally block. No-op when the outbox is not
61
+ * configured — single-DB deployments don't need sync.
62
+ */
63
+ export declare function enqueueControlPlaneSyncEvent(ctx: Context<{
64
+ Bindings: Bindings;
65
+ Variables: Variables;
66
+ }>, args: EnqueueArgs): void;
67
+ export {};
@@ -24,10 +24,10 @@ export declare const dcrRequestSchema: z.ZodObject<{
24
24
  response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
25
  token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
26
26
  none: "none";
27
+ private_key_jwt: "private_key_jwt";
27
28
  client_secret_post: "client_secret_post";
28
29
  client_secret_basic: "client_secret_basic";
29
30
  client_secret_jwt: "client_secret_jwt";
30
- private_key_jwt: "private_key_jwt";
31
31
  }>>;
32
32
  jwks_uri: z.ZodOptional<z.ZodString>;
33
33
  jwks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -18,6 +18,17 @@ export interface CreateDefaultDestinationsConfig {
18
18
  getServiceToken?: GetServiceToken;
19
19
  /** Webhook HTTP request timeout in ms (default: 10_000). */
20
20
  webhookTimeoutMs?: number;
21
+ /**
22
+ * When set, drains `controlplane.sync.*` events to the control-plane
23
+ * authhero instance at the given base URL. Mirrors the per-request
24
+ * `ControlPlaneSyncDestination` wired in the management API, so cron-drain
25
+ * deliveries don't lose events that missed per-request processing.
26
+ * Requires `getServiceToken`.
27
+ */
28
+ controlPlaneSync?: {
29
+ baseUrl: string;
30
+ timeoutMs?: number;
31
+ };
21
32
  /**
22
33
  * Custom webhook invoker — same shape as the `webhookInvoker` option on
23
34
  * `init()`. When provided, `hook.*` events are dispatched by calling this
@@ -0,0 +1,35 @@
1
+ import { AuditEvent } from "@authhero/adapter-interfaces";
2
+ import { EventDestination } from "../outbox-relay";
3
+ import { SyncEvent } from "../control-plane-sync-events";
4
+ import type { GetServiceToken } from "./webhooks";
5
+ export interface ControlPlaneSyncDestinationOptions {
6
+ /** Base URL of the control-plane authhero instance, e.g. `https://controlplane.example.com`. */
7
+ baseUrl: string;
8
+ /** Mints a bearer token to authenticate the sync POST. */
9
+ getServiceToken: GetServiceToken;
10
+ /** Per-request timeout (default: 10s). */
11
+ timeoutMs?: number;
12
+ /** Override for tests. */
13
+ fetchImpl?: typeof fetch;
14
+ }
15
+ /**
16
+ * Delivers `controlplane.sync.*` outbox events to the global control-plane
17
+ * `POST /api/v2/proxy/control-plane/sync` endpoint. Each POST carries one event
18
+ * with `Idempotency-Key: {event.id}` so the receiver can dedupe retries.
19
+ *
20
+ * The receiver MUST be idempotent: the outbox retries on network failure even
21
+ * after a successful write, so a `created` may arrive twice and a stale
22
+ * `updated` may arrive after a newer `deleted`. The default receiver in
23
+ * `proxy-control-plane/index.ts` handles both cases.
24
+ */
25
+ export declare class ControlPlaneSyncDestination implements EventDestination {
26
+ name: string;
27
+ private baseUrl;
28
+ private getServiceToken;
29
+ private timeoutMs;
30
+ private fetchImpl;
31
+ constructor(options: ControlPlaneSyncDestinationOptions);
32
+ accepts(event: AuditEvent): boolean;
33
+ transform(event: AuditEvent): SyncEvent;
34
+ deliver(events: SyncEvent[]): Promise<void>;
35
+ }
@@ -7,6 +7,8 @@ export declare class LogsDestination implements EventDestination {
7
7
  /**
8
8
  * Only accept log-shaped events. `hook.*` events are dispatch tasks for
9
9
  * webhook / code-hook destinations and are not audit log entries.
10
+ * `controlplane.sync.*` events are replication tasks for the
11
+ * ControlPlaneSyncDestination and likewise shouldn't appear in audit logs.
10
12
  */
11
13
  accepts(event: AuditEvent): boolean;
12
14
  transform(event: AuditEvent): {