authhero 8.26.1 → 8.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 (41) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +139 -139
  3. package/dist/authhero.d.ts +218 -133
  4. package/dist/authhero.mjs +6292 -6240
  5. package/dist/tsconfig.types.tsbuildinfo +1 -1
  6. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  7. package/dist/types/components/stories/IdentifierPage.stories.d.ts +2 -0
  8. package/dist/types/helpers/codes-cleanup.d.ts +4 -4
  9. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  10. package/dist/types/helpers/run-retention.d.ts +86 -0
  11. package/dist/types/index.d.ts +129 -127
  12. package/dist/types/routes/auth-api/index.d.ts +24 -24
  13. package/dist/types/routes/auth-api/passwordless.d.ts +6 -6
  14. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  15. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  16. package/dist/types/routes/auth-api/token.d.ts +10 -10
  17. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  18. package/dist/types/routes/management-api/action-triggers.d.ts +1 -1
  19. package/dist/types/routes/management-api/actions.d.ts +1 -1
  20. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  21. package/dist/types/routes/management-api/branding.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 +8 -8
  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/helpers.d.ts +1 -1
  28. package/dist/types/routes/management-api/index.d.ts +92 -92
  29. package/dist/types/routes/management-api/logs.d.ts +4 -4
  30. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  31. package/dist/types/routes/management-api/organizations.d.ts +6 -6
  32. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  33. package/dist/types/routes/management-api/roles.d.ts +1 -1
  34. package/dist/types/routes/management-api/tenant-operations.d.ts +4 -4
  35. package/dist/types/routes/management-api/users.d.ts +2 -2
  36. package/dist/types/routes/universal-login/common.d.ts +2 -2
  37. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  38. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  39. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  40. package/dist/types/types/IdToken.d.ts +1 -1
  41. package/package.json +5 -5
@@ -466,7 +466,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
466
466
  custom_login_page_preview?: string | undefined;
467
467
  form_template?: string | undefined;
468
468
  addons?: Record<string, any> | undefined;
469
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
469
+ token_endpoint_auth_method?: "none" | "private_key_jwt" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | undefined;
470
470
  client_metadata?: Record<string, string> | undefined;
471
471
  hide_sign_up_disabled_error?: boolean | undefined;
472
472
  mobile?: Record<string, any> | undefined;
@@ -549,8 +549,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
549
549
  } | undefined;
550
550
  authenticated_at?: string | undefined;
551
551
  };
552
- connectionType: "username" | "email" | "sms";
553
- authConnection: "username" | "email" | "sms";
552
+ connectionType: "username" | "sms" | "email";
553
+ authConnection: "username" | "sms" | "email";
554
554
  session_id: string | undefined;
555
555
  authParams: {
556
556
  client_id: string;
@@ -31,3 +31,5 @@ export declare const SocialOnly: Story;
31
31
  export declare const UsernamePassword: Story;
32
32
  export declare const NoTheming: Story;
33
33
  export declare const CustomColors: Story;
34
+ export declare const MultipleSocialConnections: Story;
35
+ export declare const DeveloperSocialLogins: Story;
@@ -11,11 +11,11 @@ export interface CodesCleanupParams {
11
11
  }
12
12
  /**
13
13
  * Delete codes that expired more than the retention window ago.
14
- * Intended for use in a scheduled handler / cron job.
15
14
  *
16
- * Codes are short-lived by design but nothing else prunes them, so without a
17
- * scheduled call to this the table grows without bound. See the Data Retention
18
- * deployment guide for the full set of tables that need sweeping.
15
+ * Prefer `runRetention`, which calls this along with every other prunable
16
+ * table scheduling one call means a future prunable table is covered without
17
+ * editing your handler. Use this directly only when you want to sweep `codes`
18
+ * on its own schedule.
19
19
  *
20
20
  * @example
21
21
  * ```ts
@@ -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>>;
@@ -0,0 +1,86 @@
1
+ import { DataAdapters } from "@authhero/adapter-interfaces";
2
+ export interface RunRetentionConfig {
3
+ /** Same `DataAdapters` passed to `init()`. */
4
+ dataAdapter: DataAdapters;
5
+ /** Grace period past expiry for `codes`. Default 1. */
6
+ codesRetentionDays?: number;
7
+ /** Days to keep processed/dead-lettered outbox events. Default 7. */
8
+ outboxRetentionDays?: number;
9
+ /**
10
+ * Scope the session sweep to a single tenant. Codes and outbox events are
11
+ * always swept globally — an expired row is dead regardless of who owns it.
12
+ */
13
+ tenantId?: string;
14
+ }
15
+ export type RetentionSweepStatus = "swept" | "skipped" | "failed";
16
+ interface RetentionSweepBase {
17
+ /** Table(s) this sweep covers, for logging. */
18
+ table: string;
19
+ }
20
+ export interface RetentionSweepSwept extends RetentionSweepBase {
21
+ status: "swept";
22
+ /**
23
+ * Rows deleted. Absent when the underlying adapter reports no count —
24
+ * `sessionCleanup` returns void, so a session sweep succeeds without one.
25
+ */
26
+ deleted?: number;
27
+ }
28
+ export interface RetentionSweepSkipped extends RetentionSweepBase {
29
+ status: "skipped";
30
+ /** Why the sweep was skipped — an adapter that does not support it. */
31
+ reason: string;
32
+ }
33
+ export interface RetentionSweepFailed extends RetentionSweepBase {
34
+ status: "failed";
35
+ error: unknown;
36
+ }
37
+ /**
38
+ * Discriminated on `status`, so a sweep cannot carry fields that contradict
39
+ * it — no `error` on a successful sweep, no `deleted` on a failed one.
40
+ */
41
+ export type RetentionSweep = RetentionSweepSwept | RetentionSweepSkipped | RetentionSweepFailed;
42
+ export interface RunRetentionResult {
43
+ sweeps: RetentionSweep[];
44
+ }
45
+ /**
46
+ * Thrown when one or more sweeps failed. The other sweeps still ran — check
47
+ * `result` for what succeeded.
48
+ */
49
+ export declare class RetentionSweepError extends Error {
50
+ readonly result: RunRetentionResult;
51
+ readonly errors: unknown[];
52
+ constructor(result: RunRetentionResult, errors: unknown[]);
53
+ }
54
+ /**
55
+ * Sweep every prunable AuthHero table in one call.
56
+ *
57
+ * This is the entry point for retention — a deployment that schedules this
58
+ * daily needs nothing else, and gains coverage of future prunable tables
59
+ * without editing its handler.
60
+ *
61
+ * Covers `codes`, `outbox_events`, and (where the adapter supports it)
62
+ * `sessions` / `refresh_tokens` / `login_sessions`. It does **not** drain the
63
+ * outbox: delivery is `runOutboxRelay`'s job, and the two are scheduled
64
+ * independently. Running both is safe — the relay's own cleanup pass and this
65
+ * one are idempotent.
66
+ *
67
+ * `logs` is deliberately excluded. Audit-retention obligations differ per
68
+ * deployment, so AuthHero will not silently delete audit rows on your behalf;
69
+ * prune `logs` on `date` yourself.
70
+ *
71
+ * Every sweep runs even if an earlier one throws, so one broken adapter method
72
+ * cannot stop the rest of the tables being pruned. If any sweep failed, a
73
+ * `RetentionSweepError` carrying the partial result is thrown once at the end.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * export default {
78
+ * async scheduled(_event, env) {
79
+ * const { sweeps } = await runRetention({ dataAdapter });
80
+ * console.log(sweeps);
81
+ * },
82
+ * };
83
+ * ```
84
+ */
85
+ export declare function runRetention(config: RunRetentionConfig): Promise<RunRetentionResult>;
86
+ export {};