@absolutejs/auth 0.55.2 → 0.55.4

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 (39) hide show
  1. package/dist/apikeys/routes.d.ts +2 -2
  2. package/dist/authInstance.d.ts +4 -9
  3. package/dist/authorization/protectPermission.d.ts +2 -2
  4. package/dist/compliance/routes.d.ts +2 -2
  5. package/dist/credentials/login.d.ts +6 -6
  6. package/dist/credentials/register.d.ts +2 -2
  7. package/dist/credentials/routes.d.ts +6 -6
  8. package/dist/htmx/routes.d.ts +2 -2
  9. package/dist/index.d.ts +2 -65
  10. package/dist/index.js.map +2 -2
  11. package/dist/mfa/challenge.d.ts +2 -2
  12. package/dist/mfa/management.d.ts +2 -2
  13. package/dist/mfa/routes.d.ts +4 -4
  14. package/dist/mfa/sms.d.ts +4 -4
  15. package/dist/mfa/totp.d.ts +2 -2
  16. package/dist/oidc/routes.d.ts +15 -15
  17. package/dist/organizations/routes.d.ts +3 -4
  18. package/dist/passwordless/routes.d.ts +6 -7
  19. package/dist/portal/routes.d.ts +3 -3
  20. package/dist/roles/routes.d.ts +3 -4
  21. package/dist/routes/callback.d.ts +2 -2
  22. package/dist/routes/profile.d.ts +2 -2
  23. package/dist/routes/protectRoute.d.ts +2 -2
  24. package/dist/routes/refresh.d.ts +3 -3
  25. package/dist/routes/revoke.d.ts +3 -3
  26. package/dist/routes/sessions.d.ts +5 -5
  27. package/dist/routes/signout.d.ts +3 -3
  28. package/dist/routes/stepUp.d.ts +2 -2
  29. package/dist/routes/userStatus.d.ts +2 -2
  30. package/dist/server.js.map +2 -2
  31. package/dist/session/cleanup.d.ts +3 -3
  32. package/dist/session/internalData.d.ts +34 -0
  33. package/dist/session/state.d.ts +3 -3
  34. package/dist/sso/discoveryRoute.d.ts +1 -1
  35. package/dist/sso/oidcRoutes.d.ts +4 -4
  36. package/dist/sso/samlIdpRoutes.d.ts +3 -3
  37. package/dist/sso/samlRoutes.d.ts +6 -7
  38. package/dist/webauthn/routes.d.ts +2 -2
  39. package/package.json +1 -1
@@ -46,9 +46,9 @@ export declare const apiKeysRoutes: ({ accessTokenStore, accessTokenTtlMs, apiCl
46
46
  [x: string]: {
47
47
  post: {
48
48
  body: {
49
- client_id?: string | undefined;
50
- scope?: string | undefined;
51
49
  grant_type?: string | undefined;
50
+ scope?: string | undefined;
51
+ client_id?: string | undefined;
52
52
  client_secret?: string | undefined;
53
53
  };
54
54
  params: {};
@@ -1,12 +1,7 @@
1
- import type { Elysia } from 'elysia';
2
- import type { agentAuthContextPlugin } from './agents/context';
3
1
  import type { protectRoutePlugin } from './routes/protectRoute';
4
- import type { stepUpPlugin } from './routes/stepUp';
5
- /** Merge the stable context contributed by independent Auth plugins without
6
- * exposing the configurable route graph in consumer declarations. */
7
- type MergeAuthContext<Base, Extra> = Base extends Elysia<infer Path, infer Singleton, infer Definitions, infer Metadata, infer Routes, infer Ephemeral, infer Volatile> ? Extra extends Elysia<infer ExtraPath, infer ExtraSingleton, infer ExtraDefinitions, infer ExtraMetadata, infer ExtraRoutes, infer ExtraEphemeral, infer ExtraVolatile> ? Elysia<Path & ExtraPath, Singleton & ExtraSingleton, Definitions & ExtraDefinitions, Metadata & ExtraMetadata, Routes & ExtraRoutes, Ephemeral & ExtraEphemeral, Volatile & ExtraVolatile> : never : never;
8
2
  /** The consumer-facing context contributed by `auth()`. Configurable auth
9
3
  * routes are available at runtime but intentionally omitted from this type:
10
- * their user-defined paths cannot form useful literal route declarations. */
11
- export type AuthInstance<UserType> = MergeAuthContext<MergeAuthContext<ReturnType<typeof protectRoutePlugin<UserType>>, ReturnType<typeof stepUpPlugin<UserType>>>, ReturnType<typeof agentAuthContextPlugin>>;
12
- export {};
4
+ * their user-defined paths cannot form useful literal route declarations.
5
+ * Optional step-up and agent contexts remain available through their explicit
6
+ * plugins without multiplying the default application's Elysia type graph. */
7
+ export type AuthInstance<UserType> = ReturnType<typeof protectRoutePlugin<UserType>>;
@@ -13,8 +13,8 @@ type PermissionFailError = {
13
13
  export declare const protectPermissionPlugin: <UserType>({ authSessionStore, emit, hasPermission }: AuthorizationPluginProps<UserType>) => Elysia<"", {
14
14
  decorator: {};
15
15
  store: {
16
- session: import("..").SessionRecord<UserType>;
17
- unregisteredSession: import("..").UnregisteredSessionRecord;
16
+ session: import("../session/internalData").InternalSessionRecord<UserType>;
17
+ unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
18
18
  };
19
19
  derive: {
20
20
  readonly protectPermission: <AuthReturn, AuthFailReturn>(check: PermissionCheck, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: PermissionFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn> | import("elysia").ElysiaCustomStatusResponse<"Forbidden", "Insufficient permissions", 403>>;
@@ -3,8 +3,8 @@ import type { CompliancePluginProps } from './config';
3
3
  export declare const complianceRoutes: <UserType>({ authSessionStore, complianceRoute, deleteUserData, emit, exportUserData, getUserId }: CompliancePluginProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: import("..").SessionRecord<UserType>;
7
- unregisteredSession: import("..").UnregisteredSessionRecord;
6
+ session: import("../session/internalData").InternalSessionRecord<UserType>;
7
+ unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
8
8
  };
9
9
  derive: {};
10
10
  resolve: {};
@@ -3,8 +3,8 @@ import { type CredentialRouteProps } from './config';
3
3
  export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreachesOnLogin, cookieSecure, credentialStore, getUserByEmail, isMfaRequired, lockoutGuard, loginRoute, onCredentialsLoginError, onCredentialsLoginSuccess, passwordVerifier, rehashOnLogin, requireEmailVerification, sessionDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: import("..").SessionRecord<UserType>;
7
- unregisteredSession: import("..").UnregisteredSessionRecord;
6
+ session: import("../session/internalData").InternalSessionRecord<UserType>;
7
+ unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
8
8
  };
9
9
  derive: {};
10
10
  resolve: {};
@@ -39,6 +39,10 @@ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreac
39
39
  readonly passwordCompromised: boolean;
40
40
  readonly status: "authenticated";
41
41
  };
42
+ 429: {
43
+ readonly retryAfterMs: number | undefined;
44
+ readonly status: "account_locked";
45
+ };
42
46
  422: {
43
47
  type: "validation";
44
48
  on: string;
@@ -48,10 +52,6 @@ export declare const credentialsLogin: <UserType>({ authSessionStore, checkBreac
48
52
  property?: string;
49
53
  expected?: string;
50
54
  };
51
- 429: {
52
- readonly retryAfterMs: number | undefined;
53
- readonly status: "account_locked";
54
- };
55
55
  };
56
56
  };
57
57
  };
@@ -3,8 +3,8 @@ import { type CredentialRouteProps } from './config';
3
3
  export declare const credentialsRegister: <UserType>({ authSessionStore, cookieSecure, credentialStore, onCreateCredentialUser, onCredentialsLoginSuccess, onRegistrationSuccess, onSendEmail, passwordPolicy, registerRoute, requireEmailVerification, sessionDurationMs, verificationTokenDurationMs }: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: import("..").SessionRecord<UserType>;
7
- unregisteredSession: import("..").UnregisteredSessionRecord;
6
+ session: import("../session/internalData").InternalSessionRecord<UserType>;
7
+ unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
8
8
  };
9
9
  derive: {};
10
10
  resolve: {};
@@ -3,8 +3,8 @@ import type { CredentialRouteProps } from './config';
3
3
  export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<UserType>) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: import("..").SessionRecord<UserType>;
7
- unregisteredSession: import("..").UnregisteredSessionRecord;
6
+ session: import("../session/internalData").InternalSessionRecord<UserType>;
7
+ unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
8
8
  };
9
9
  derive: {};
10
10
  resolve: {};
@@ -107,6 +107,10 @@ export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<U
107
107
  readonly passwordCompromised: boolean;
108
108
  readonly status: "authenticated";
109
109
  };
110
+ 429: {
111
+ readonly retryAfterMs: number | undefined;
112
+ readonly status: "account_locked";
113
+ };
110
114
  422: {
111
115
  type: "validation";
112
116
  on: string;
@@ -116,10 +120,6 @@ export declare const credentialRoutes: <UserType>(config: CredentialRouteProps<U
116
120
  property?: string;
117
121
  expected?: string;
118
122
  };
119
- 429: {
120
- readonly retryAfterMs: number | undefined;
121
- readonly status: "account_locked";
122
- };
123
123
  };
124
124
  };
125
125
  };
@@ -6,8 +6,8 @@ export declare const createAuthHtmxRoutes: <UserType extends AuthHtmxUser>(confi
6
6
  }) => Elysia<"", {
7
7
  decorator: {};
8
8
  store: {
9
- session: import("..").SessionRecord<UserType>;
10
- unregisteredSession: import("..").UnregisteredSessionRecord;
9
+ session: import("../session/internalData").InternalSessionRecord<UserType>;
10
+ unregisteredSession: import("../session/internalData").InternalUnregisteredSessionRecord;
11
11
  };
12
12
  derive: {
13
13
  readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { AuthConfig } from './types';
3
3
  export declare const auth: <UserType>({ providersConfiguration, authorizeRoute, cookieSecure, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, cleanupIntervalMs, maxSessions, sessionDurationMs, authSessionStore, audit, credentials, customProviders, mfa, passwordless, lockout, sessions, sso, scim, apikeys, agentAuth, oidc, organizations, roles, portal, authorization, compliance, webauthn, webhooks, htmx, tracing, resolveAuthIntent, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onLinkIdentity, onLinkIdentityConflict, onLinkConnector, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError, onSessionCleanup }: AuthConfig<UserType>) => Promise<Elysia<"", {
4
4
  decorator: {};
5
5
  store: {
6
- session: import("./types").SessionRecord<UserType>;
7
- unregisteredSession: import("./types").UnregisteredSessionRecord;
6
+ session: import("./session/internalData").InternalSessionRecord<UserType>;
7
+ unregisteredSession: import("./session/internalData").InternalUnregisteredSessionRecord;
8
8
  };
9
9
  derive: {
10
10
  readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
@@ -16,24 +16,6 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
16
16
  }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
17
17
  };
18
18
  resolve: {};
19
- } & {
20
- decorator: {};
21
- store: {
22
- session: import("./types").SessionRecord<UserType>;
23
- unregisteredSession: import("./types").UnregisteredSessionRecord;
24
- };
25
- derive: {
26
- readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
27
- readonly code: "Unauthorized";
28
- readonly message: "Recent authentication required";
29
- }) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
30
- };
31
- resolve: {};
32
- } & {
33
- decorator: {};
34
- store: {};
35
- derive: {};
36
- resolve: {};
37
19
  }, {
38
20
  typebox: {};
39
21
  error: {};
@@ -56,63 +38,18 @@ export declare const auth: <UserType>({ providersConfiguration, authorizeRoute,
56
38
  readonly message: "User is not authenticated";
57
39
  }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
58
40
  }>;
59
- } & {
60
- schema: import("elysia").UnwrapRoute<{
61
- cookie: import("@sinclair/typebox").TObject<{
62
- user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
63
- }>;
64
- }, {}, "">;
65
- standaloneSchema: {};
66
- macro: {};
67
- macroFn: {};
68
- parser: {};
69
- response: import("elysia").ExtractErrorFromHandle<{
70
- readonly requireRecentAuth: <AuthReturn, AuthFailReturn_1>(maxAgeMs: number, handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
71
- readonly code: "Unauthorized";
72
- readonly message: "Recent authentication required";
73
- }) => AuthFailReturn_1) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "Recent authentication required", 401> | AuthReturn | NonNullable<AuthFailReturn_1>>;
74
- }>;
75
- } & {
76
- schema: {};
77
- standaloneSchema: {};
78
- macro: {};
79
- macroFn: {};
80
- parser: {};
81
- response: {};
82
41
  }, {}, {
83
42
  derive: {};
84
43
  resolve: {};
85
44
  schema: {};
86
45
  standaloneSchema: {};
87
46
  response: {};
88
- } & {
89
- derive: {};
90
- resolve: {};
91
- schema: {};
92
- standaloneSchema: {};
93
- response: {};
94
47
  }, {
95
48
  derive: {};
96
49
  resolve: {};
97
50
  schema: {};
98
51
  standaloneSchema: {};
99
52
  response: {};
100
- } & {
101
- derive: {
102
- readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
103
- code: "Forbidden" | "Unauthorized";
104
- message: "Agent is not authenticated" | "Insufficient agent scopes";
105
- }) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
106
- };
107
- resolve: {};
108
- schema: {};
109
- standaloneSchema: {};
110
- response: import("elysia").ExtractErrorFromHandle<{
111
- readonly protectAgent: <AuthReturn, AuthFailReturn_2>(requiredScopes: string[], handleAuth: (principal: import(".").AgentPrincipal) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: {
112
- code: "Forbidden" | "Unauthorized";
113
- message: "Agent is not authenticated" | "Insufficient agent scopes";
114
- }) => AuthFailReturn_2 | Promise<AuthFailReturn_2>) => Promise<Response | AuthReturn | NonNullable<Awaited<AuthFailReturn_2>>>;
115
- }>;
116
53
  }>>;
117
54
  export * from './actions';
118
55
  export type { AuthInstance } from './authInstance';