authhero 9.1.0 → 9.2.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 (42) 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-e95c436f.entry.js +1 -0
  4. package/dist/authhero.cjs +211 -211
  5. package/dist/authhero.d.ts +168 -97
  6. package/dist/authhero.mjs +25619 -25625
  7. package/dist/tsconfig.types.tsbuildinfo +1 -1
  8. package/dist/types/authentication-flows/common.d.ts +6 -0
  9. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  10. package/dist/types/helpers/action-executions-cleanup.d.ts +34 -0
  11. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  12. package/dist/types/helpers/run-retention.d.ts +4 -1
  13. package/dist/types/helpers/service-token.d.ts +16 -5
  14. package/dist/types/hooks/post-user-login.d.ts +6 -0
  15. package/dist/types/index.d.ts +123 -93
  16. package/dist/types/routes/auth-api/index.d.ts +26 -26
  17. package/dist/types/routes/auth-api/oidc-logout.d.ts +2 -2
  18. package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
  19. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  20. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  21. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  22. package/dist/types/routes/management-api/actions.d.ts +1 -1
  23. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  24. package/dist/types/routes/management-api/branding.d.ts +1 -1
  25. package/dist/types/routes/management-api/client-grants.d.ts +9 -9
  26. package/dist/types/routes/management-api/clients.d.ts +8 -8
  27. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  28. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  29. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  30. package/dist/types/routes/management-api/forms.d.ts +28 -0
  31. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  32. package/dist/types/routes/management-api/index.d.ts +90 -62
  33. package/dist/types/routes/management-api/logs.d.ts +4 -4
  34. package/dist/types/routes/management-api/organizations.d.ts +1 -1
  35. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  36. package/dist/types/routes/management-api/tenants.d.ts +1 -1
  37. package/dist/types/routes/management-api/users.d.ts +2 -2
  38. package/dist/types/routes/universal-login/common.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/package.json +6 -6
  42. package/dist/assets/u/widget/p-eca60302.entry.js +0 -1
@@ -261,6 +261,12 @@ export declare function completeLogin(ctx: Context<{
261
261
  * stale-overwrite re-fetch.
262
262
  */
263
263
  loginSessionIsCurrent?: boolean;
264
+ /**
265
+ * True when the login completed by reusing an existing SSO session
266
+ * rather than fresh credentials. Page hooks (e.g. impersonate) are
267
+ * skipped for reused sessions.
268
+ */
269
+ sessionReused?: boolean;
264
270
  }): Promise<TokenResponse | {
265
271
  code: string;
266
272
  state?: string;
@@ -467,7 +467,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
467
467
  custom_login_page_preview?: string | undefined;
468
468
  form_template?: string | undefined;
469
469
  addons?: Record<string, any> | undefined;
470
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
470
+ token_endpoint_auth_method?: "client_secret_post" | "client_secret_basic" | "none" | "client_secret_jwt" | "private_key_jwt" | undefined;
471
471
  client_metadata?: Record<string, string> | undefined;
472
472
  hide_sign_up_disabled_error?: boolean | undefined;
473
473
  mobile?: Record<string, any> | undefined;
@@ -550,8 +550,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
550
550
  } | undefined;
551
551
  authenticated_at?: string | undefined;
552
552
  };
553
- connectionType: "username" | "email" | "sms";
554
- authConnection: "username" | "email" | "sms";
553
+ connectionType: "email" | "username" | "sms";
554
+ authConnection: "email" | "username" | "sms";
555
555
  session_id: string | undefined;
556
556
  authParams: {
557
557
  client_id: string;
@@ -0,0 +1,34 @@
1
+ import { ActionExecutionsAdapter } from "@authhero/adapter-interfaces";
2
+ export interface ActionExecutionsCleanupParams {
3
+ /**
4
+ * Days of execution history to keep. Defaults to 30.
5
+ *
6
+ * Unlike `codes`, these rows have no expiry — they are diagnostic history,
7
+ * referenced from logs when debugging an action. The window is a genuine
8
+ * retention policy: long enough to investigate a report that arrives late,
9
+ * short enough that the table stops growing without bound.
10
+ */
11
+ retentionDays?: number;
12
+ }
13
+ /**
14
+ * Delete action executions created more than the retention window ago.
15
+ *
16
+ * Prefer `runRetention`, which calls this along with every other prunable
17
+ * table — scheduling one call means a future prunable table is covered
18
+ * without editing your handler. Use this directly only when you want to sweep
19
+ * `action_executions` on its own schedule.
20
+ *
21
+ * Returns `null` when the adapter does not support cleanup (backends like
22
+ * DynamoDB TTL or Analytics Engine expire rows themselves).
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * // Cloudflare Workers scheduled handler
27
+ * async scheduled(_event, env) {
28
+ * await cleanupActionExecutions(dataAdapter.actionExecutions, {
29
+ * retentionDays: 30,
30
+ * });
31
+ * }
32
+ * ```
33
+ */
34
+ export declare function cleanupActionExecutions(actionExecutions: ActionExecutionsAdapter, params?: ActionExecutionsCleanupParams): Promise<number | null>;
@@ -23,9 +23,9 @@ export declare const dcrRequestSchema: z.ZodObject<{
23
23
  grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
24
  response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
25
  token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
26
- none: "none";
27
26
  client_secret_post: "client_secret_post";
28
27
  client_secret_basic: "client_secret_basic";
28
+ none: "none";
29
29
  client_secret_jwt: "client_secret_jwt";
30
30
  private_key_jwt: "private_key_jwt";
31
31
  }>>;
@@ -6,6 +6,8 @@ export interface RunRetentionConfig {
6
6
  codesRetentionDays?: number;
7
7
  /** Days to keep processed/dead-lettered outbox events. Default 7. */
8
8
  outboxRetentionDays?: number;
9
+ /** Days of action execution history to keep. Default 30. */
10
+ actionExecutionsRetentionDays?: number;
9
11
  /**
10
12
  * Scope the session sweep to a single tenant. Codes and outbox events are
11
13
  * always swept globally — an expired row is dead regardless of who owns it.
@@ -59,7 +61,8 @@ export declare class RetentionSweepError extends Error {
59
61
  * without editing its handler.
60
62
  *
61
63
  * Covers `codes`, `outbox_events`, and (where the adapter supports it)
62
- * `sessions` / `refresh_tokens` / `login_sessions`. It does **not** drain the
64
+ * `action_executions` and `sessions` / `refresh_tokens` / `login_sessions`.
65
+ * It does **not** drain the
63
66
  * outbox: delivery is `runOutboxRelay`'s job, and the two are scheduled
64
67
  * independently. Running both is safe — the relay's own cleanup pass and this
65
68
  * one are idempotent.
@@ -14,6 +14,12 @@ export interface CreateServiceTokenCoreParams {
14
14
  tenantId: string;
15
15
  scope: string;
16
16
  issuer: string;
17
+ /**
18
+ * Explicit audience override. When unset the tenant's `audience` is
19
+ * required — callers that want a fallback chain (e.g. `default_audience`)
20
+ * resolve it themselves and pass the result here.
21
+ */
22
+ audience?: string;
17
23
  expiresInSeconds?: number;
18
24
  customClaims?: Record<string, unknown>;
19
25
  /**
@@ -31,14 +37,19 @@ export interface CreateServiceTokenCoreParams {
31
37
  * binding, and signing key.
32
38
  */
33
39
  export declare function createServiceTokenCore(params: CreateServiceTokenCoreParams): Promise<ServiceTokenResponse>;
40
+ /**
41
+ * Mint an internal `auth-service` token for calling our own (or a trusted
42
+ * downstream) API. Deliberately does NOT go through `createAuthTokens`: that
43
+ * path runs the tenant's credentials-exchange hooks, which must never fire for
44
+ * internal mints. A hook that calls `api.access.deny()` (e.g. a tenant gating
45
+ * logins on an external membership lookup) would otherwise reject the mint —
46
+ * and since post-user-update hooks commonly mint service tokens, a hook that
47
+ * updates a user could recurse straight back into itself.
48
+ */
34
49
  export declare function createServiceToken(ctx: Context<{
35
50
  Bindings: Bindings;
36
51
  Variables: Variables;
37
- }>, tenant_id: string, scope: string, expiresInSeconds?: number, customClaims?: Record<string, unknown>): Promise<{
38
- access_token: string;
39
- token_type: string;
40
- expires_in: number;
41
- }>;
52
+ }>, tenant_id: string, scope: string, expiresInSeconds?: number, customClaims?: Record<string, unknown>): Promise<ServiceTokenResponse>;
42
53
  /**
43
54
  * Bound ctx-free token factory for outbox destinations. Mirrors the shape
44
55
  * expected by `WebhookDestination` and `createDefaultDestinations` but uses
@@ -28,4 +28,10 @@ export declare function postUserLoginHook(ctx: Context<{
28
28
  };
29
29
  /** The connection name actually used to authenticate. */
30
30
  authConnection?: string;
31
+ /**
32
+ * True when the login completed by reusing an existing SSO session
33
+ * rather than fresh credentials. Page hooks (e.g. impersonate) only
34
+ * interrupt fresh logins.
35
+ */
36
+ sessionReused?: boolean;
31
37
  }): Promise<User | Response>;