authhero 5.11.0 → 5.12.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 (32) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +126 -126
  3. package/dist/authhero.d.ts +81 -66
  4. package/dist/authhero.mjs +9177 -8949
  5. package/dist/stats.html +1 -1
  6. package/dist/tsconfig.types.tsbuildinfo +1 -1
  7. package/dist/types/authentication-flows/passwordless.d.ts +3 -3
  8. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  9. package/dist/types/helpers/users.d.ts +28 -0
  10. package/dist/types/index.d.ts +66 -66
  11. package/dist/types/routes/auth-api/index.d.ts +18 -18
  12. package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
  13. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  14. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  15. package/dist/types/routes/management-api/actions.d.ts +1 -1
  16. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  17. package/dist/types/routes/management-api/client-grants.d.ts +8 -8
  18. package/dist/types/routes/management-api/clients.d.ts +7 -7
  19. package/dist/types/routes/management-api/email-templates.d.ts +14 -14
  20. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  21. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  22. package/dist/types/routes/management-api/index.d.ts +48 -48
  23. package/dist/types/routes/management-api/logs.d.ts +3 -3
  24. package/dist/types/routes/management-api/organizations.d.ts +1 -1
  25. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  26. package/dist/types/routes/management-api/proxy-routes.d.ts +221 -0
  27. package/dist/types/routes/management-api/users.d.ts +2 -2
  28. package/dist/types/routes/proxy-control-plane/index.d.ts +22 -0
  29. package/dist/types/routes/universal-login/common.d.ts +2 -2
  30. package/dist/types/types/AuthHeroConfig.d.ts +14 -0
  31. package/dist/types/types/IdToken.d.ts +3 -3
  32. package/package.json +5 -4
@@ -446,7 +446,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
446
446
  custom_login_page_preview?: string | undefined;
447
447
  form_template?: string | undefined;
448
448
  addons?: Record<string, any> | undefined;
449
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
449
+ token_endpoint_auth_method?: "client_secret_post" | "client_secret_basic" | "none" | "client_secret_jwt" | "private_key_jwt" | undefined;
450
450
  client_metadata?: Record<string, string> | undefined;
451
451
  hide_sign_up_disabled_error?: boolean | undefined;
452
452
  mobile?: Record<string, any> | undefined;
@@ -529,8 +529,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
529
529
  } | undefined;
530
530
  authenticated_at?: string | undefined;
531
531
  };
532
- connectionType: "email" | "sms" | "username";
533
- authConnection: "email" | "sms" | "username";
532
+ connectionType: "email" | "username" | "sms";
533
+ authConnection: "email" | "username" | "sms";
534
534
  session_id: string | undefined;
535
535
  authParams: {
536
536
  client_id: string;
@@ -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
  }>>;
@@ -10,12 +10,40 @@ interface GetUserByProviderParams {
10
10
  provider: string;
11
11
  }
12
12
  export declare function getUserByProvider({ userAdapter, tenant_id, username, provider, }: GetUserByProviderParams): Promise<User | null>;
13
+ /**
14
+ * Order users by age (oldest first). When account-linking has to choose
15
+ * which of two matching users should remain primary, the older account
16
+ * wins — it has the longer history, accrued sessions, and is most likely
17
+ * the canonical identity the user expects to keep.
18
+ *
19
+ * Falls back to `user_id` so the ordering is fully deterministic when
20
+ * `created_at` is missing or identical (e.g. fixture rows seeded in the
21
+ * same millisecond).
22
+ */
23
+ export declare function compareUsersByAge(a: User, b: User): number;
13
24
  interface GetPrimaryUserByEmailParams {
14
25
  userAdapter: UserDataAdapter;
15
26
  tenant_id: string;
16
27
  email: string;
17
28
  }
18
29
  export declare function getPrimaryUserByEmail({ userAdapter, tenant_id, email, }: GetPrimaryUserByEmailParams): Promise<User | undefined>;
30
+ interface RepointPrimaryParams {
31
+ userAdapter: UserDataAdapter;
32
+ tenant_id: string;
33
+ formerPrimary: User;
34
+ newPrimaryId: string;
35
+ }
36
+ /**
37
+ * Demote `formerPrimary` to a secondary of `newPrimaryId`. Any users
38
+ * currently linked to `formerPrimary` are repointed first so the resulting
39
+ * graph remains a single hop deep — `getPrimaryUserByProvider` and similar
40
+ * resolvers only follow one `linked_to` step.
41
+ *
42
+ * Each write is a single-field `linked_to` update so the user-update
43
+ * decorator's fast-path bypasses the pre/post hooks and we don't re-enter
44
+ * the linking logic recursively.
45
+ */
46
+ export declare function repointPrimary({ userAdapter, tenant_id, formerPrimary, newPrimaryId, }: RepointPrimaryParams): Promise<void>;
19
47
  interface GetPrimaryUserByProviderParams {
20
48
  userAdapter: UserDataAdapter;
21
49
  tenant_id: string;