authhero 9.35.0 → 9.37.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 (77) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +144 -141
  3. package/dist/authhero.d.ts +562 -369
  4. package/dist/authhero.mjs +13530 -11568
  5. package/dist/{mfa-fD5vp7ql.mjs → mfa-BpHxTir1.mjs} +25 -25
  6. package/dist/{mfa-XAWdFO9R.js → mfa-DuNbh_YF.js} +1 -1
  7. package/dist/mfa-attempts-D5U1FCSY.js +275 -0
  8. package/dist/{mfa-attempts-CpIqAsQd.mjs → mfa-attempts-DDgCBTDW.mjs} +6022 -5686
  9. package/dist/{passkey-enrollment-BB99mHdQ.js → passkey-enrollment-D6ZZmelw.js} +1 -1
  10. package/dist/tsconfig.types.tsbuildinfo +1 -1
  11. package/dist/types/authentication-flows/email-verification.d.ts +1 -1
  12. package/dist/types/authentication-flows/passwordless.d.ts +5 -2
  13. package/dist/types/errors/management-api-error.d.ts +3 -0
  14. package/dist/types/generated/locale-types.d.ts +87 -0
  15. package/dist/types/helpers/anchor-client.d.ts +16 -0
  16. package/dist/types/helpers/database-connection-scope.d.ts +97 -0
  17. package/dist/types/helpers/dcr/audience-policy.d.ts +13 -0
  18. package/dist/types/helpers/dcr/client-registration.d.ts +81 -0
  19. package/dist/types/helpers/dcr/constraint-enforcement.d.ts +1 -0
  20. package/dist/types/helpers/dcr/metadata-mapping.d.ts +17 -0
  21. package/dist/types/helpers/dcr/mint-iat.d.ts +4 -1
  22. package/dist/types/helpers/dcr/mint-token.d.ts +4 -0
  23. package/dist/types/helpers/dcr/presets.d.ts +34 -0
  24. package/dist/types/helpers/dcr/uri-policy.d.ts +34 -0
  25. package/dist/types/helpers/password-connection.d.ts +3 -1
  26. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  27. package/dist/types/helpers/self-service-tickets.d.ts +34 -0
  28. package/dist/types/helpers/sso-access-tickets.d.ts +18 -0
  29. package/dist/types/helpers/users.d.ts +29 -4
  30. package/dist/types/index.d.ts +502 -310
  31. package/dist/types/routes/auth-api/authenticate.d.ts +1 -1
  32. package/dist/types/routes/auth-api/dbconnections.d.ts +2 -2
  33. package/dist/types/routes/auth-api/device.d.ts +8 -8
  34. package/dist/types/routes/auth-api/index.d.ts +54 -37
  35. package/dist/types/routes/auth-api/passwordless.d.ts +18 -16
  36. package/dist/types/routes/auth-api/register/index.d.ts +15 -0
  37. package/dist/types/routes/auth-api/token.d.ts +10 -10
  38. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  39. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  40. package/dist/types/routes/management-api/branding.d.ts +13 -13
  41. package/dist/types/routes/management-api/client-grants.d.ts +9 -9
  42. package/dist/types/routes/management-api/client-registration-tokens.d.ts +149 -0
  43. package/dist/types/routes/management-api/connections.d.ts +1 -1
  44. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  45. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  46. package/dist/types/routes/management-api/failed-events.d.ts +2 -2
  47. package/dist/types/routes/management-api/forms.d.ts +144 -144
  48. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  49. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  50. package/dist/types/routes/management-api/index.d.ts +411 -266
  51. package/dist/types/routes/management-api/keys.d.ts +16 -16
  52. package/dist/types/routes/management-api/log-streams.d.ts +6 -6
  53. package/dist/types/routes/management-api/logs.d.ts +4 -4
  54. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  55. package/dist/types/routes/management-api/organizations.d.ts +5 -5
  56. package/dist/types/routes/management-api/prompts.d.ts +6 -6
  57. package/dist/types/routes/management-api/roles.d.ts +1 -1
  58. package/dist/types/routes/management-api/rollouts.d.ts +6 -6
  59. package/dist/types/routes/management-api/self-service-profiles.d.ts +345 -0
  60. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  61. package/dist/types/routes/management-api/tenant-operations.d.ts +10 -10
  62. package/dist/types/routes/management-api/tenants.d.ts +17 -17
  63. package/dist/types/routes/management-api/themes.d.ts +9 -9
  64. package/dist/types/routes/management-api/users.d.ts +17 -17
  65. package/dist/types/routes/universal-login/common.d.ts +10 -8
  66. package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
  67. package/dist/types/routes/universal-login/identifier.d.ts +2 -2
  68. package/dist/types/routes/universal-login/index.d.ts +2 -2
  69. package/dist/types/routes/universal-login/screens/connect-authz.d.ts +9 -0
  70. package/dist/types/routes/universal-login/screens/self-service-app.d.ts +46 -0
  71. package/dist/types/routes/universal-login/u2-index.d.ts +35 -5
  72. package/dist/types/routes/universal-login/u2-routes.d.ts +35 -5
  73. package/dist/types/state-machines/login-session.d.ts +19 -1
  74. package/dist/types/types/Bindings.d.ts +2 -0
  75. package/dist/types/utils/username-password-provider.d.ts +14 -3
  76. package/package.json +6 -6
  77. package/dist/mfa-attempts-C7toCIRn.js +0 -275
@@ -2,6 +2,7 @@ import { ConnectionSelfService, User, UserDataAdapter } from "@authhero/adapter-
2
2
  import { EnrichedClient } from "./client";
3
3
  import { Context } from "hono";
4
4
  import { Bindings, Variables } from "../types";
5
+ import { DatabaseConnectionScope } from "./database-connection-scope";
5
6
  export declare function getUsersByEmail(userAdapter: UserDataAdapter, tenantId: string, email: string): Promise<User[]>;
6
7
  /**
7
8
  * Every user sharing `email`, across all pages.
@@ -15,13 +16,25 @@ export declare function getUsersByEmail(userAdapter: UserDataAdapter, tenantId:
15
16
  * in `resolveLinkCandidates`.
16
17
  */
17
18
  export declare function getAllUsersByEmail(userAdapter: UserDataAdapter, tenantId: string, email: string): Promise<User[]>;
19
+ /**
20
+ * Every user sharing `username`, across all pages. The username counterpart
21
+ * of {@link getAllUsersByEmail}, for the same uniqueness checks.
22
+ */
23
+ export declare function getAllUsersByUsername(userAdapter: UserDataAdapter, tenantId: string, username: string): Promise<User[]>;
18
24
  interface GetUserByProviderParams {
19
25
  userAdapter: UserDataAdapter;
20
26
  tenant_id: string;
21
27
  username: string;
22
28
  provider: string;
29
+ /**
30
+ * Limit the match to one database connection. Every database connection
31
+ * shares the `auth0` provider, so without a scope a lookup can return a
32
+ * user from another database connection. Build it with
33
+ * `resolveDatabaseConnectionScope`; `undefined` keeps the unscoped lookup.
34
+ */
35
+ connection?: DatabaseConnectionScope;
23
36
  }
24
- export declare function getUserByProvider({ userAdapter, tenant_id, username, provider, }: GetUserByProviderParams): Promise<User | null>;
37
+ export declare function getUserByProvider({ userAdapter, tenant_id, username, provider, connection, }: GetUserByProviderParams): Promise<User | null>;
25
38
  /**
26
39
  * Order users by age (oldest first). When account-linking has to choose
27
40
  * which of two matching users should remain primary, the older account
@@ -201,10 +214,20 @@ interface EmailConflictParams {
201
214
  * of its linked secondaries (when the caller passed `connection`).
202
215
  */
203
216
  clusterRootId: string;
217
+ /**
218
+ * The target's database connection scope, when the tenant has several
219
+ * database connections (see `resolveDatabaseConnectionScope`). Between two
220
+ * database users, "same connection" then means what the login lookups see:
221
+ * a legacy row whose `connection` names no database connection counts as
222
+ * part of every connection. Without a scope it is a plain name comparison.
223
+ */
224
+ connectionScope?: DatabaseConnectionScope;
204
225
  }
205
226
  /**
206
227
  * Find the user, if any, that genuinely blocks changing `target`'s email to an
207
- * address already present on other rows.
228
+ * address already present on other rows. The same rules apply to a username
229
+ * change, with candidates from {@link getAllUsersByUsername}: usernames have
230
+ * the same `(tenant_id, provider, username)` unique index.
208
231
  *
209
232
  * Two rows sharing an email is only a *conflict* when it makes a login ambiguous,
210
233
  * and login lookups are always provider-scoped (`getUserByProvider` filters on
@@ -231,7 +254,7 @@ interface EmailConflictParams {
231
254
  * Because AuthHero keeps secondaries as real rows (Auth0 folds them into the
232
255
  * primary's `identities[]`), they'd otherwise surface here as "another user".
233
256
  */
234
- export declare function findEmailConflict({ candidates, target, clusterRootId, }: EmailConflictParams): User | undefined;
257
+ export declare function findEmailConflict({ candidates, target, clusterRootId, connectionScope, }: EmailConflictParams): User | undefined;
235
258
  interface CascadeEmailParams {
236
259
  userAdapter: UserDataAdapter;
237
260
  tenant_id: string;
@@ -268,8 +291,10 @@ interface GetPrimaryUserByProviderParams {
268
291
  tenant_id: string;
269
292
  username: string;
270
293
  provider: string;
294
+ /** See {@link GetUserByProviderParams.connection}. */
295
+ connection?: DatabaseConnectionScope;
271
296
  }
272
- export declare function getPrimaryUserByProvider({ userAdapter, tenant_id, username, provider, }: GetPrimaryUserByProviderParams): Promise<User | null>;
297
+ export declare function getPrimaryUserByProvider({ userAdapter, tenant_id, username, provider, connection, }: GetPrimaryUserByProviderParams): Promise<User | null>;
273
298
  interface GetOrCreateUserByProviderParams {
274
299
  client: EnrichedClient;
275
300
  username: string;