@absolutejs/auth 0.24.1 → 0.25.1
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.
- package/dist/authSessionStores.d.ts +2 -2
- package/dist/callback.d.ts +2 -2
- package/dist/errors.d.ts +1 -1
- package/dist/htmxRoutes.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +13 -11
- package/dist/index.js.map +16 -16
- package/dist/neonAuthSessionStore.d.ts +2 -2
- package/dist/protectRoute.d.ts +2 -2
- package/dist/refresh.d.ts +2 -2
- package/dist/revoke.d.ts +2 -2
- package/dist/sessionAccess.d.ts +4 -4
- package/dist/sessionCleanup.d.ts +2 -2
- package/dist/sessionTypes.d.ts +1 -1
- package/dist/signout.d.ts +2 -2
- package/dist/types.d.ts +3 -3
- package/dist/ui/types.d.ts +1 -1
- package/dist/userStatus.d.ts +2 -2
- package/dist/utils.d.ts +5 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
2
2
|
export declare const authSessionsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
3
|
name: "auth_sessions";
|
|
4
4
|
schema: undefined;
|
|
@@ -560,4 +560,4 @@ export declare const authSessionSchema: {
|
|
|
560
560
|
}>;
|
|
561
561
|
};
|
|
562
562
|
export type AuthSessionSchema = typeof authSessionSchema;
|
|
563
|
-
export declare const createNeonAuthSessionStore: <UserType>(databaseUrl: string) =>
|
|
563
|
+
export declare const createNeonAuthSessionStore: <UserType>(databaseUrl: string) => AuthSessionStore<UserType>;
|
package/dist/protectRoute.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
type AuthFailError = {
|
|
4
4
|
readonly code: 'Bad Request';
|
|
5
5
|
readonly message: 'Cookies are missing';
|
|
@@ -8,7 +8,7 @@ type AuthFailError = {
|
|
|
8
8
|
readonly message: 'User is not authenticated';
|
|
9
9
|
};
|
|
10
10
|
export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
|
|
11
|
-
authSessionStore?:
|
|
11
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
12
12
|
}) => Elysia<"", {
|
|
13
13
|
decorator: {};
|
|
14
14
|
store: {
|
package/dist/refresh.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
import { ClientProviders, OnRefreshError, OnRefreshSuccess, RouteString } from './types';
|
|
4
4
|
type RefreshProps<UserType> = {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
clientProviders: ClientProviders;
|
|
7
7
|
refreshRoute?: RouteString;
|
|
8
8
|
onRefreshSuccess: OnRefreshSuccess;
|
package/dist/revoke.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
import { ClientProviders, OnRevocationError, OnRevocationSuccess, RouteString } from './types';
|
|
4
4
|
type RevokeProps<UserType> = {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
clientProviders: ClientProviders;
|
|
7
7
|
revokeRoute?: RouteString;
|
|
8
8
|
onRevocationSuccess: OnRevocationSuccess;
|
package/dist/sessionAccess.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Cookie } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
import type { SessionData, SessionRecord, UnregisteredSessionRecord, UserSessionId } from './types';
|
|
4
4
|
export declare const loadSessionFromSource: <UserType>({ authSessionStore, session, userSessionId, removeExpired }: {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
session?: SessionRecord<UserType>;
|
|
7
7
|
userSessionId?: UserSessionId;
|
|
8
8
|
removeExpired?: boolean;
|
|
9
9
|
}) => Promise<SessionData<UserType> | undefined>;
|
|
10
10
|
export declare const getStatusFromSource: <UserType>({ authSessionStore, session, user_session_id }: {
|
|
11
|
-
authSessionStore?:
|
|
11
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
12
12
|
session?: SessionRecord<UserType>;
|
|
13
13
|
user_session_id: Cookie<UserSessionId | undefined>;
|
|
14
14
|
}) => Promise<{
|
|
@@ -22,7 +22,7 @@ export declare const getStatusFromSource: <UserType>({ authSessionStore, session
|
|
|
22
22
|
user: NonNullable<UserType> | null;
|
|
23
23
|
}>;
|
|
24
24
|
export declare const createSessionCompatibilityLayer: <UserType>({ authSessionStore, userSessionId }: {
|
|
25
|
-
authSessionStore?:
|
|
25
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
26
26
|
userSessionId?: UserSessionId;
|
|
27
27
|
}) => Promise<{
|
|
28
28
|
session: SessionRecord<UserType>;
|
package/dist/sessionCleanup.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
import type { OnSessionCleanup, SessionRecord, UnregisteredSessionRecord } from './types';
|
|
4
4
|
type SessionCleanupProps<UserType> = {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
cleanupIntervalMs?: number;
|
|
7
7
|
maxSessions?: number;
|
|
8
8
|
onSessionCleanup?: OnSessionCleanup<UserType>;
|
package/dist/sessionTypes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SessionData, UnregisteredSessionData, UserSessionId } from './types';
|
|
2
|
-
export type
|
|
2
|
+
export type AuthSessionStore<UserType> = {
|
|
3
3
|
getSession: (id: UserSessionId) => Promise<SessionData<UserType> | undefined>;
|
|
4
4
|
setSession: (id: UserSessionId, value: SessionData<UserType>) => Promise<void>;
|
|
5
5
|
removeSession: (id: UserSessionId) => Promise<void>;
|
package/dist/signout.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
import { OnSignOut, RouteString } from './types';
|
|
4
4
|
type SignOutProps<UserType> = {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
signoutRoute?: RouteString;
|
|
7
7
|
onSignOut: OnSignOut<UserType>;
|
|
8
8
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CredentialsFor, NonEmptyArray, OAuth2Client, OAuth2TokenResponse, Provi
|
|
|
2
2
|
import { Cookie, status as statusType, redirect as redirectType } from 'elysia';
|
|
3
3
|
import { ElysiaCustomStatusResponse } from 'elysia/error';
|
|
4
4
|
import type { AuthIdentityConflict } from './errors';
|
|
5
|
-
import type {
|
|
5
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
6
6
|
import type { AuthHtmxConfig, AuthHtmxUser } from './ui/types';
|
|
7
7
|
export type AuthIntent = 'login' | 'link_identity' | 'link_connector';
|
|
8
8
|
export type OAuth2ProviderClientConfiguration<Provider extends ProviderOption> = {
|
|
@@ -138,7 +138,7 @@ export type OnSessionCleanup<UserType> = (({ removedSessions, removedUnregistere
|
|
|
138
138
|
}) => void | Promise<void>) | undefined;
|
|
139
139
|
export type RouteString = `/${string}`;
|
|
140
140
|
export type AuthorizeRoute = `${string}/:provider${'' | `/${string}`}`;
|
|
141
|
-
export type
|
|
141
|
+
export type AuthConfig<UserType> = {
|
|
142
142
|
providersConfiguration: OAuth2ConfigurationOptions;
|
|
143
143
|
authorizeRoute?: AuthorizeRoute;
|
|
144
144
|
profileRoute?: RouteString;
|
|
@@ -150,7 +150,7 @@ export type AbsoluteAuthProps<UserType> = {
|
|
|
150
150
|
cleanupIntervalMs?: number;
|
|
151
151
|
maxSessions?: number;
|
|
152
152
|
sessionDurationMs?: number;
|
|
153
|
-
authSessionStore?:
|
|
153
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
154
154
|
/** Enable the built-in HTMX fragment routes (login, identities, connectors,
|
|
155
155
|
* account, signout, delete-account). Supply provider display data + the
|
|
156
156
|
* identity/connector data actions; the package owns the route wiring and
|
package/dist/ui/types.d.ts
CHANGED
|
@@ -83,7 +83,7 @@ export type AuthHtmxRenderersConfig = {
|
|
|
83
83
|
export type ResolvedAuthHtmxRenderers = Required<AuthHtmxRenderOverrides> & {
|
|
84
84
|
escapeHtml: (value: string) => string;
|
|
85
85
|
};
|
|
86
|
-
/** Config for the `htmx` option on `
|
|
86
|
+
/** Config for the `htmx` option on `auth`. Extends the renderers
|
|
87
87
|
* config with the data actions the fragment routes call — keeping the auth
|
|
88
88
|
* package agnostic of your identity schema while it owns the route wiring
|
|
89
89
|
* (protectRoute gating, payload re-rendering, signout, delete-account flow). */
|
package/dist/userStatus.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
3
3
|
import { OnStatus, RouteString } from './types';
|
|
4
4
|
type StatusProps<UserType> = {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
statusRoute?: RouteString;
|
|
7
7
|
onStatus: OnStatus<UserType>;
|
|
8
8
|
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OAuth2Client, OAuth2TokenResponse, ProviderOption } from 'citra';
|
|
2
2
|
import { Cookie } from 'elysia';
|
|
3
|
-
import {
|
|
3
|
+
import { AuthConfig, InsantiateUserSessionProps, OAuth2ConfigurationOptions, ResolvedOAuthAuthorization, SessionRecord, UnregisteredSessionRecord, UserSessionId } from './types';
|
|
4
|
+
import { AuthHtmxConfig } from './ui/types';
|
|
4
5
|
export declare const resolveOAuthTokenExpiresAt: (tokenResponse: OAuth2TokenResponse, now?: number) => number | undefined;
|
|
5
6
|
export declare const resolveOAuthAuthorization: ({ authProvider, providerInstance, tokenResponse, now }: {
|
|
6
7
|
authProvider: ProviderOption;
|
|
@@ -9,8 +10,9 @@ export declare const resolveOAuthAuthorization: ({ authProvider, providerInstanc
|
|
|
9
10
|
now?: number;
|
|
10
11
|
}) => Promise<ResolvedOAuthAuthorization>;
|
|
11
12
|
export declare const instantiateUserSession: <UserType>({ authProvider, session, user_session_id, unregisteredSession, tokenResponse, providerInstance, getUser, onNewUser, resolvedAuthorization, sessionDurationMs, unregisteredSessionDurationMs }: InsantiateUserSessionProps<UserType>) => Promise<import("./types").StatusReturn | Response | undefined>;
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const defineAuthConfig: <UserType>(configuration: AuthConfig<UserType>) => AuthConfig<UserType>;
|
|
14
|
+
export declare const defineAuthHtmxConfig: (htmxConfig: AuthHtmxConfig) => AuthHtmxConfig;
|
|
15
|
+
export declare const defineProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => OAuth2ConfigurationOptions;
|
|
14
16
|
export declare const getStatus: <UserType>(session: SessionRecord<UserType>, user_session_id: Cookie<UserSessionId | undefined>) => Promise<{
|
|
15
17
|
error: {
|
|
16
18
|
readonly code: "Bad Request";
|
package/package.json
CHANGED