authhero 9.37.0 → 9.39.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 (86) hide show
  1. package/README.md +13 -3
  2. package/dist/assets/u/widget/authhero-widget.esm.js +1 -1
  3. package/dist/assets/u/widget/index.esm.js +1 -1
  4. package/dist/assets/u/widget/{p-ce8560f6.entry.js → p-32247347.entry.js} +1 -1
  5. package/dist/assets/u/widget/p-3f908508.entry.js +1 -0
  6. package/dist/assets/u/widget/p-Wx4M-olY.js +2 -0
  7. package/dist/authhero.cjs +116 -95
  8. package/dist/authhero.d.ts +469 -306
  9. package/dist/authhero.mjs +17889 -16773
  10. package/dist/mfa-DMThiuUR.mjs +406 -0
  11. package/dist/mfa-Dh6nNiRX.js +4 -0
  12. package/dist/mfa-attempts-BaKbuGvZ.js +321 -0
  13. package/dist/{mfa-attempts-DDgCBTDW.mjs → mfa-attempts-O0x4jJzl.mjs} +6234 -6126
  14. package/dist/{passkey-enrollment-D6ZZmelw.js → passkey-enrollment-CSeOQWv1.js} +1 -1
  15. package/dist/tsconfig.types.tsbuildinfo +1 -1
  16. package/dist/types/authentication-flows/mfa.d.ts +3 -1
  17. package/dist/types/emails/index.d.ts +33 -1
  18. package/dist/types/helpers/default-destinations.d.ts +14 -0
  19. package/dist/types/helpers/firehose-client.d.ts +29 -0
  20. package/dist/types/helpers/outbox-destinations/log-streams.d.ts +21 -1
  21. package/dist/types/helpers/prompt-partials.d.ts +1 -1
  22. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  23. package/dist/types/helpers/response-type-grants.d.ts +8 -0
  24. package/dist/types/helpers/run-outbox-relay.d.ts +9 -2
  25. package/dist/types/hooks/custom-notification-provider.d.ts +174 -0
  26. package/dist/types/hooks/lifecycle-codehooks.d.ts +2 -2
  27. package/dist/types/index.d.ts +431 -295
  28. package/dist/types/routes/auth-api/device.d.ts +8 -8
  29. package/dist/types/routes/auth-api/index.d.ts +30 -30
  30. package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
  31. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  32. package/dist/types/routes/management-api/action-executions.d.ts +2 -2
  33. package/dist/types/routes/management-api/action-triggers.d.ts +27 -27
  34. package/dist/types/routes/management-api/actions.d.ts +14 -14
  35. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  36. package/dist/types/routes/management-api/branding-preview.d.ts +9 -1
  37. package/dist/types/routes/management-api/branding-uploads.d.ts +4 -4
  38. package/dist/types/routes/management-api/branding.d.ts +125 -21
  39. package/dist/types/routes/management-api/client-registration-tokens.d.ts +3 -3
  40. package/dist/types/routes/management-api/clients.d.ts +18 -18
  41. package/dist/types/routes/management-api/connections.d.ts +8 -8
  42. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  43. package/dist/types/routes/management-api/emails.d.ts +6 -6
  44. package/dist/types/routes/management-api/failed-events.d.ts +2 -2
  45. package/dist/types/routes/management-api/guardian.d.ts +6 -6
  46. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  47. package/dist/types/routes/management-api/hooks.d.ts +56 -56
  48. package/dist/types/routes/management-api/index.d.ts +362 -258
  49. package/dist/types/routes/management-api/jobs.d.ts +2 -2
  50. package/dist/types/routes/management-api/keys.d.ts +12 -12
  51. package/dist/types/routes/management-api/log-streams.d.ts +12 -12
  52. package/dist/types/routes/management-api/logs.d.ts +4 -4
  53. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  54. package/dist/types/routes/management-api/organizations.d.ts +5 -5
  55. package/dist/types/routes/management-api/prompts.d.ts +8 -8
  56. package/dist/types/routes/management-api/resource-servers.d.ts +8 -8
  57. package/dist/types/routes/management-api/rollouts.d.ts +6 -6
  58. package/dist/types/routes/management-api/self-service-profiles.d.ts +9 -9
  59. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  60. package/dist/types/routes/management-api/tenant-members.d.ts +8 -8
  61. package/dist/types/routes/management-api/tenant-operations.d.ts +10 -10
  62. package/dist/types/routes/management-api/tenants.d.ts +13 -13
  63. package/dist/types/routes/management-api/themes.d.ts +78 -9
  64. package/dist/types/routes/management-api/users.d.ts +20 -20
  65. package/dist/types/routes/universal-login/common.d.ts +62 -10
  66. package/dist/types/routes/universal-login/continue.d.ts +35 -0
  67. package/dist/types/routes/universal-login/dark-theme.d.ts +25 -0
  68. package/dist/types/routes/universal-login/identifier.d.ts +2 -2
  69. package/dist/types/routes/universal-login/index.d.ts +2 -2
  70. package/dist/types/routes/universal-login/legal-links.d.ts +18 -0
  71. package/dist/types/routes/universal-login/screen-prompt-map.d.ts +31 -0
  72. package/dist/types/routes/universal-login/screens/connect-authz.d.ts +13 -1
  73. package/dist/types/routes/universal-login/screens/login-partials.d.ts +9 -1
  74. package/dist/types/routes/universal-login/u2-index.d.ts +36 -5
  75. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  76. package/dist/types/routes/universal-login/u2-widget-page.d.ts +6 -1
  77. package/dist/types/routes/universal-login/universal-login-template.d.ts +1 -0
  78. package/dist/types/routes/universal-login/widget-assets.d.ts +20 -0
  79. package/dist/types/state-machines/login-session.d.ts +1 -1
  80. package/dist/types/types/AuthHeroConfig.d.ts +9 -1
  81. package/package.json +7 -6
  82. package/dist/assets/u/widget/p-FUW5zvoZ.js +0 -2
  83. package/dist/assets/u/widget/p-c6ec4c36.entry.js +0 -1
  84. package/dist/mfa-BpHxTir1.mjs +0 -128
  85. package/dist/mfa-DuNbh_YF.js +0 -1
  86. package/dist/mfa-attempts-D5U1FCSY.js +0 -275
@@ -39,7 +39,9 @@ export declare function checkMfaRequired(ctx: Context<{
39
39
  export declare function sendMfaOtp(ctx: Context<{
40
40
  Bindings: Bindings;
41
41
  Variables: Variables;
42
- }>, client: EnrichedClient, loginSession: LoginSession, phoneNumber: string, userId?: string): Promise<void>;
42
+ }>, client: EnrichedClient, loginSession: LoginSession, phoneNumber: string, userId?: string,
43
+ /** Auth0 `message_type` for the `custom-phone-provider` trigger. */
44
+ messageType?: "otp_verify" | "otp_enroll"): Promise<void>;
43
45
  /**
44
46
  * Verify an MFA OTP code against the stored code.
45
47
  * Returns true if valid, false otherwise.
@@ -1,6 +1,11 @@
1
1
  import { Context } from "hono";
2
2
  import { Bindings, RequestContext, Variables } from "../types";
3
- import { AuthParams, EmailTemplateName, User } from "@authhero/adapter-interfaces";
3
+ import { AuthParams, CustomEmailProviderMessageType, CustomPhoneProviderMessageType, EmailTemplateName, User } from "@authhero/adapter-interfaces";
4
+ /**
5
+ * Email provider name Auth0 tooling sets to hand all email to the action bound
6
+ * to `custom-email-provider` (`{ "name": "custom", "credentials": {} }`).
7
+ */
8
+ export declare const CUSTOM_EMAIL_PROVIDER_NAME = "custom";
4
9
  export type SendEmailParams = {
5
10
  to: string;
6
11
  subject: string;
@@ -9,14 +14,41 @@ export type SendEmailParams = {
9
14
  template: string;
10
15
  data: Record<string, string>;
11
16
  from?: string;
17
+ /**
18
+ * Auth0 `message_type` for the `custom-email-provider` trigger. Without it
19
+ * the message goes straight to the provider (unless the provider is named
20
+ * `custom`, in which case `template` is reported as the type).
21
+ */
22
+ message_type?: CustomEmailProviderMessageType;
23
+ /** Values that must never be logged: the one-time code, tokenized links. */
24
+ secrets?: string[];
25
+ /** The recipient user, or a loader, exposed to the action as `event.user`. */
26
+ user?: User | (() => Promise<User | undefined>);
27
+ /** `event.notification.locale`. */
28
+ locale?: string;
12
29
  };
30
+ /**
31
+ * Send an email. When an action is bound to `custom-email-provider` for this
32
+ * message type the action delivers it; otherwise the tenant's provider does,
33
+ * as before.
34
+ */
13
35
  export declare function sendEmail(ctx: RequestContext, params: SendEmailParams, tenantIdOverride?: string): Promise<void>;
14
36
  export type SendSmsParams = {
15
37
  to: string;
16
38
  from?: string;
17
39
  text: string;
18
40
  code: string;
41
+ /** Auth0 `message_type` for the `custom-phone-provider` trigger. */
42
+ message_type?: CustomPhoneProviderMessageType;
43
+ /** Extra values that must never be logged, e.g. a magic link. */
44
+ secrets?: string[];
45
+ locale?: string;
19
46
  };
47
+ /**
48
+ * Send a text message. When an action is bound to `custom-phone-provider` for
49
+ * this message type the action delivers it; otherwise the SMS connection's
50
+ * provider does, as before.
51
+ */
20
52
  export declare function sendSms(ctx: Context<{
21
53
  Bindings: Bindings;
22
54
  Variables: Variables;
@@ -60,6 +60,20 @@ export interface CreateDefaultDestinationsConfig {
60
60
  */
61
61
  pipeline?: OutboxPipelineConfig;
62
62
  }
63
+ /**
64
+ * The archive destinations configured on `init({ outbox })`, in delivery
65
+ * order. Shared by the per-request route middleware and
66
+ * `createDefaultDestinations` so both paths archive to the same places.
67
+ *
68
+ * Append these after every other destination: the relay stops an event's
69
+ * destination loop on the first failure, so an archive outage must not be
70
+ * able to block real delivery. Nothing depends on the archives, so they are
71
+ * the destinations that can afford to be blocked — the cost is that an event
72
+ * which permanently fails an earlier destination never reaches them.
73
+ */
74
+ export declare function createArchiveDestinations(outbox: {
75
+ pipeline?: OutboxPipelineConfig;
76
+ } | undefined): EventDestination[];
63
77
  /**
64
78
  * Build the same array of outbox destinations that authhero's per-request
65
79
  * `outboxMiddleware` constructs internally. Intended for consumers that want
@@ -0,0 +1,29 @@
1
+ export declare const FIREHOSE_MAX_RECORD_BYTES: number;
2
+ export interface FirehoseTarget {
3
+ /** AWS region of the delivery stream, e.g. `eu-north-1`. */
4
+ region: string;
5
+ /** Name (not ARN) of the Direct PUT delivery stream. */
6
+ deliveryStreamName: string;
7
+ accessKeyId: string;
8
+ secretAccessKey: string;
9
+ }
10
+ export interface PutFirehoseRecordsOptions {
11
+ /** Per-request timeout (default: 10s). */
12
+ timeoutMs?: number;
13
+ /** Override for tests. */
14
+ fetchImpl?: typeof fetch;
15
+ }
16
+ /**
17
+ * Why a target cannot be used, or `undefined` when it can. The region is
18
+ * interpolated into the endpoint hostname, so anything but a plain region id
19
+ * is rejected — it could otherwise redirect a signed request elsewhere.
20
+ */
21
+ export declare function firehoseTargetError(target: FirehoseTarget): string | undefined;
22
+ export declare function firehoseEndpoint(region: string): string;
23
+ /**
24
+ * Sends already-encoded records to an Amazon Data Firehose Direct PUT stream
25
+ * with SigV4-signed `PutRecordBatch` calls, split at the per-call limits.
26
+ * Callers keep each record within `FIREHOSE_MAX_RECORD_BYTES`; this throws
27
+ * before sending if one is not, since Firehose would reject the whole call.
28
+ */
29
+ export declare function putFirehoseRecords(target: FirehoseTarget, records: Uint8Array[], options?: PutFirehoseRecordsOptions): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  import { AuditEvent, LogStreamsAdapter } from "@authhero/adapter-interfaces";
2
2
  import { EventDestination } from "../outbox-relay";
3
+ import { type FirehoseTarget } from "../firehose-client";
3
4
  interface LogStreamData {
4
5
  date: string;
5
6
  type: string;
@@ -46,8 +47,26 @@ interface StreamDelivery {
46
47
  logType: string;
47
48
  payload: LogStreamPayload;
48
49
  }
50
+ export interface FirehoseSinkConfig {
51
+ target: FirehoseTarget;
52
+ /**
53
+ * Terminate each record with `\n` so records Firehose concatenates into one
54
+ * S3 object are newline-delimited JSON (default: true).
55
+ */
56
+ newlineDelimited: boolean;
57
+ }
58
+ /**
59
+ * Reads a `firehose` log stream's sink. Shared by delivery and the management
60
+ * API, so a sink the API accepts is one delivery can use.
61
+ */
62
+ export declare function parseFirehoseSink(sink: Record<string, unknown>): {
63
+ config: FirehoseSinkConfig;
64
+ } | {
65
+ error: string;
66
+ };
49
67
  /**
50
- * Delivers audit events to tenant-configured HTTP log streams. Mirrors
68
+ * Delivers audit events to tenant-configured `http` and `firehose` log
69
+ * streams. Mirrors
51
70
  * Auth0's log_stream wire shape so Loki / Logstash / Datadog sinks
52
71
  * configured for an Auth0 tenant can be pointed at authhero unchanged.
53
72
  *
@@ -66,6 +85,7 @@ export declare class LogStreamDestination implements EventDestination {
66
85
  accepts(event: AuditEvent): boolean;
67
86
  transform(event: AuditEvent): StreamDelivery;
68
87
  deliver(events: StreamDelivery[]): Promise<void>;
88
+ private deliverToFirehose;
69
89
  private deliverToStream;
70
90
  }
71
91
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { PromptPartials } from "@authhero/adapter-interfaces";
2
- export declare const promptPartialPrompts: readonly ["signup", "signup-id", "signup-password", "login", "login-id", "login-password", "login-passwordless", "login-passwordless-sms-otp", "login-passwordless-email-code"];
2
+ export declare const promptPartialPrompts: readonly ["signup", "signup-id", "signup-password", "login", "login-id", "login-password", "login-passwordless", "login-passwordless-sms-otp", "login-passwordless-email-code", "reset-password", "mfa-otp", "mfa-phone", "mfa-login-options"];
3
3
  export declare const MAX_PROMPT_PARTIAL_LENGTH = 100000;
4
4
  export declare function isAllowedPromptPartialMappingTarget(target: string): boolean;
5
5
  export declare function sanitizePromptPartials(partials: PromptPartials): PromptPartials;
@@ -14,9 +14,9 @@ export declare const USERINFO_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "e
14
14
  * vendor/tenant for downstream APIs while `sub` stays `auth-service`.
15
15
  * Client-bound mints keep `azp` locked (see below).
16
16
  */
17
- export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "jti" | "sub" | "scope" | "gty" | "org_id" | "iat" | "sid" | "permissions" | "iss" | "exp" | "aud" | "auth_time" | "acr" | "amr" | "nbf" | "act" | "requested_userinfo_claims")[];
17
+ export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("sub" | "scope" | "tenant_id" | "client_id" | "org_name" | "jti" | "sid" | "org_id" | "iss" | "exp" | "iat" | "aud" | "auth_time" | "acr" | "amr" | "gty" | "nbf" | "act" | "permissions" | "requested_userinfo_claims")[];
18
18
  /** Client-bound mints: `azp` must stay the registered client id. */
19
- export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("tenant_id" | "client_id" | "org_name" | "jti" | "sub" | "scope" | "azp" | "gty" | "org_id" | "iat" | "sid" | "permissions" | "iss" | "exp" | "aud" | "auth_time" | "acr" | "amr" | "nbf" | "act" | "requested_userinfo_claims")[];
19
+ export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("sub" | "scope" | "tenant_id" | "client_id" | "org_name" | "jti" | "sid" | "org_id" | "iss" | "exp" | "iat" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "gty" | "nbf" | "act" | "permissions" | "requested_userinfo_claims")[];
20
20
  export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
21
21
  export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
22
22
  /**
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The grant type a response type needs that the client's `grant_types` lacks,
3
+ * or undefined. A `code` response needs `authorization_code`; a response that
4
+ * returns `token` or `id_token` from the authorization endpoint needs
5
+ * `implicit`, so hybrid responses need both. A client without `grant_types`
6
+ * is unrestricted, as at the token endpoint.
7
+ */
8
+ export declare function missingGrantTypeForResponseType(grantTypes: string[] | undefined, responseType: string | undefined): string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { CodeExecutor, DataAdapters } from "@authhero/adapter-interfaces";
2
- import type { ActionExecutionLogCapture, WebhookInvoker } from "../types/AuthHeroConfig";
2
+ import type { ActionExecutionLogCapture, OutboxPipelineConfig, WebhookInvoker } from "../types/AuthHeroConfig";
3
3
  import type { OutboxMetricsSink } from "../types/OutboxMetrics";
4
4
  export interface RunOutboxRelayConfig {
5
5
  /** Same `DataAdapters` passed to `init()`. Must include `outbox` to drain. */
@@ -45,6 +45,12 @@ export interface RunOutboxRelayConfig {
45
45
  * the events this cron drain handles, tagged `source: "cron"`.
46
46
  */
47
47
  metrics?: OutboxMetricsSink;
48
+ /**
49
+ * Same value as `init({ outbox: { pipeline } })`. Pass it so events retried
50
+ * by this drain still reach the archive — otherwise an event whose inline
51
+ * archive delivery failed is marked processed here without being archived.
52
+ */
53
+ pipeline?: OutboxPipelineConfig;
48
54
  }
49
55
  /**
50
56
  * One-call outbox relay for cron / scheduled handlers.
@@ -52,7 +58,8 @@ export interface RunOutboxRelayConfig {
52
58
  * Internally:
53
59
  * 1. Skips gracefully when `dataAdapter.outbox` is undefined.
54
60
  * 2. Builds the same destination array as the inline dispatcher
55
- * (`LogsDestination`, `WebhookDestination`, `RegistrationFinalizerDestination`).
61
+ * (`LogsDestination`, `WebhookDestination`, `RegistrationFinalizerDestination`,
62
+ * plus the Pipelines archive when `pipeline` is passed).
56
63
  * 3. Mints per-tenant service tokens via the same in-process path
57
64
  * (`createServiceTokenCore`) that the request-time webhookInvoker uses,
58
65
  * driven by the supplied dataAdapter.
@@ -0,0 +1,174 @@
1
+ import { HTTPException } from "hono/http-exception";
2
+ import { Hook, User } from "@authhero/adapter-interfaces";
3
+ import { RequestContext } from "../types";
4
+ import { CodeHookEventInput } from "./codehooks";
5
+ /**
6
+ * Auth0's custom provider triggers. A tenant binds an action to one of them to
7
+ * deliver outgoing emails / text messages from its own system. With nothing
8
+ * bound, messages go to the tenant's normal provider exactly as before.
9
+ *
10
+ * - https://auth0.com/docs/customize/email/smtp-email-providers/custom/configure-action
11
+ * - https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers/configure-a-custom-phone-provider
12
+ */
13
+ export declare const CUSTOM_EMAIL_PROVIDER_TRIGGER = "custom-email-provider";
14
+ export declare const CUSTOM_PHONE_PROVIDER_TRIGGER = "custom-phone-provider";
15
+ export type NotificationTrigger = typeof CUSTOM_EMAIL_PROVIDER_TRIGGER | typeof CUSTOM_PHONE_PROVIDER_TRIGGER;
16
+ /** Auth0 truncates `drop` / `retry` reasons to 1024 characters. */
17
+ export declare const NOTIFICATION_REASON_MAX_LENGTH = 1024;
18
+ /**
19
+ * Background retries after `api.notification.retry()`: Auth0 retries "up to 5
20
+ * times in the next minutes". AuthHero retries from the request's background
21
+ * window (`waitUntil`), which is about 30 seconds on Workers, so the delays are
22
+ * kept short. The message is held in memory only and never persisted.
23
+ */
24
+ export declare const NOTIFICATION_RETRY_DELAYS_MS: readonly number[];
25
+ /**
26
+ * Workers cancels `waitUntil` work 30 seconds after the response. Retries stop
27
+ * (and log `fn`) once another delay plus a full action timeout would no longer
28
+ * fit in this budget, so the terminal log is always written inside the window.
29
+ */
30
+ export declare const NOTIFICATION_RETRY_BUDGET_MS = 25000;
31
+ /** `event.notification` for `custom-email-provider`, Auth0's shape. */
32
+ export type EmailNotification = {
33
+ message_type: string;
34
+ to: string;
35
+ from: string;
36
+ subject: string;
37
+ html: string;
38
+ text: string;
39
+ locale: string;
40
+ };
41
+ /** `event.notification` for `custom-phone-provider`, Auth0's shape. */
42
+ export type PhoneNotification = {
43
+ message_type: string;
44
+ recipient: string;
45
+ from: string;
46
+ as_text: string;
47
+ as_voice: string;
48
+ code?: string;
49
+ delivery_method: "text" | "voice";
50
+ locale: string;
51
+ };
52
+ /**
53
+ * Thrown when a message could not be delivered by the custom provider action:
54
+ * it was dropped, threw, timed out, or no action could take it. The message is
55
+ * generic on purpose: the one-time code and message content must never end up
56
+ * in an error message.
57
+ */
58
+ export declare class NotificationDeliveryError extends HTTPException {
59
+ readonly trigger: NotificationTrigger;
60
+ constructor(trigger: NotificationTrigger);
61
+ }
62
+ type CodeHook = Extract<Hook, {
63
+ code_id: string;
64
+ }>;
65
+ /** The outcome of one run of the bound action. */
66
+ export type NotificationAttempt = {
67
+ type: "delivered";
68
+ } | {
69
+ type: "use_default_provider";
70
+ } | {
71
+ type: "dropped";
72
+ reason: string;
73
+ } | {
74
+ type: "retry";
75
+ reason: string;
76
+ } | {
77
+ type: "failed";
78
+ reason: string;
79
+ };
80
+ /**
81
+ * Replace every occurrence of a secret (the one-time code, a link carrying a
82
+ * token, the rendered message) with a marker. Longest first, so a rendered
83
+ * body is removed whole before the code inside it is looked for. Values
84
+ * shorter than 4 characters are skipped: they would match unrelated text.
85
+ */
86
+ export declare function redactNotificationSecrets(value: string, secrets: readonly string[]): string;
87
+ /**
88
+ * Build the scrubber applied to everything an action reports back (console
89
+ * lines, error messages, drop/retry reasons):
90
+ *
91
+ * 1. Exact secrets (and their JSON-escaped forms, as `JSON.stringify(event)`
92
+ * would print them) are replaced by `[REDACTED]`.
93
+ * 2. A value that still shares a run of 20 characters with a long secret (the
94
+ * rendered message, a link) is withheld entirely. Executors truncate console
95
+ * lines, so an echoed message often survives only as a fragment that exact
96
+ * matching can't catch.
97
+ */
98
+ export declare function createNotificationScrubber(secrets: readonly string[]): (value: string) => string;
99
+ /**
100
+ * The enabled action bound to `trigger` that handles `messageType`, highest
101
+ * priority first. A binding whose `metadata.message_types` (AuthHero
102
+ * extension) doesn't list the type is skipped, so that message stays with the
103
+ * tenant's normal provider. No list means every type, as in Auth0.
104
+ */
105
+ export declare function findNotificationHook(ctx: RequestContext, tenantId: string, trigger: NotificationTrigger, messageType: string): Promise<CodeHook | undefined>;
106
+ /**
107
+ * Run the bound action once and read what it decided. Everything the action
108
+ * reports back (error messages, console output, reasons) is redacted before it
109
+ * is persisted or returned.
110
+ */
111
+ export declare function runNotificationAction(ctx: RequestContext, params: {
112
+ trigger: NotificationTrigger;
113
+ tenantId: string;
114
+ hook: CodeHook;
115
+ event: CodeHookEventInput;
116
+ secrets: readonly string[];
117
+ }): Promise<NotificationAttempt>;
118
+ export type DeliverNotificationParams = {
119
+ trigger: NotificationTrigger;
120
+ tenantId: string;
121
+ messageType: string;
122
+ /**
123
+ * Builds `event.notification` (already rendered). Only called when an
124
+ * action is bound, so plain sends don't pay for it.
125
+ */
126
+ buildNotification: () => Promise<EmailNotification | PhoneNotification>;
127
+ /** The recipient's address or number, recorded in the tenant logs. */
128
+ recipient: string;
129
+ /**
130
+ * Values that must never reach logs, execution records or errors: the
131
+ * one-time code, links carrying a token, and the rendered content. The
132
+ * rendered content in `notification` is added automatically.
133
+ */
134
+ secrets?: string[];
135
+ /** The user the message is for, or a loader for it (runs only when an action is bound). */
136
+ user?: User | (() => Promise<User | undefined>);
137
+ /** Send with the tenant's normal provider, unchanged from before. */
138
+ sendDefault: () => Promise<void>;
139
+ /**
140
+ * There is no normal provider to fall back to (the email provider is named
141
+ * `custom`, as Auth0 tooling configures it): the message must go to an
142
+ * action, and `useDefaultProvider()` is an error.
143
+ */
144
+ requireAction?: boolean;
145
+ /** Override the background retry delays (tests). */
146
+ retryDelaysMs?: readonly number[];
147
+ /** Override the background retry budget (tests). */
148
+ retryBudgetMs?: number;
149
+ /**
150
+ * Whether this message is still worth delivering, checked before each
151
+ * background retry. A resend that replaced the one-time code makes an older
152
+ * pending delivery stale: delivering it later would show the user a code
153
+ * that no longer works.
154
+ */
155
+ isCurrent?: () => Promise<boolean>;
156
+ };
157
+ /**
158
+ * Deliver one outgoing message: through the action bound to the custom
159
+ * provider trigger when there is one for this message type, otherwise through
160
+ * the tenant's normal provider (`sendDefault`), unchanged.
161
+ *
162
+ * - Delivered: returns; the caller logs the send as it always has.
163
+ * - `useDefaultProvider()`: sends with the normal provider.
164
+ * - `drop()`, a throw, a timeout or a missing executor: logs `fn` and throws
165
+ * `NotificationDeliveryError`, so the user sees that sending failed rather
166
+ * than waiting for a message that never comes. It never falls back to the
167
+ * normal provider on its own.
168
+ * - `retry()`: logs `wn`, returns as accepted, and retries in the background
169
+ * up to 5 times; `fn` if every retry fails.
170
+ */
171
+ export declare function deliverNotification(ctx: RequestContext, params: DeliverNotificationParams): Promise<void>;
172
+ /** A rough plain-text rendering of an HTML email for `event.notification.text`. */
173
+ export declare function htmlToText(html: string): string;
174
+ export {};
@@ -10,7 +10,7 @@ export declare function listEnabledCodeHooks(ctx: Context<{
10
10
  Bindings: Bindings;
11
11
  Variables: Variables;
12
12
  }>, tenantId: string, triggerId: string): Promise<{
13
- trigger_id: "pre-user-registration" | "post-user-registration" | "post-user-login" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion" | "credentials-exchange" | "pre-user-update" | "pre-account-action";
13
+ trigger_id: "post-user-login" | "credentials-exchange" | "pre-user-registration" | "post-user-registration" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion" | "pre-user-update" | "pre-account-action" | "custom-email-provider" | "custom-phone-provider";
14
14
  enabled: boolean;
15
15
  synchronous: boolean;
16
16
  created_at: string;
@@ -18,7 +18,7 @@ export declare function listEnabledCodeHooks(ctx: Context<{
18
18
  hook_id: string;
19
19
  code_id: string;
20
20
  scope?: "local" | "shared" | "platform" | undefined;
21
- override?: "none" | "secrets" | "fields" | undefined;
21
+ override?: "secrets" | "none" | "fields" | undefined;
22
22
  enforce?: boolean | undefined;
23
23
  priority?: number | undefined;
24
24
  metadata?: Record<string, unknown> | undefined;