@absolutejs/auth 0.24.1 → 0.25.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.
- 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 +11 -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 +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthSessionStore } from './sessionTypes';
|
|
2
2
|
import type { SessionData, UnregisteredSessionData, UserSessionId } from './types';
|
|
3
3
|
export type CreateInMemoryAuthSessionStoreOptions<UserType> = {
|
|
4
4
|
sessions?: Record<UserSessionId, SessionData<UserType>>;
|
|
5
5
|
unregisteredSessions?: Record<UserSessionId, UnregisteredSessionData>;
|
|
6
6
|
};
|
|
7
|
-
export declare const createInMemoryAuthSessionStore: <UserType>(input?: CreateInMemoryAuthSessionStoreOptions<UserType>) =>
|
|
7
|
+
export declare const createInMemoryAuthSessionStore: <UserType>(input?: CreateInMemoryAuthSessionStoreOptions<UserType>) => AuthSessionStore<UserType>;
|
package/dist/callback.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, OnCallbackError, OnCallbackSuccess, OnLinkConnector, OnLinkIdentity, OnLinkIdentityConflict, ResolveAuthIntent, RouteString } from './types';
|
|
4
4
|
type CallbackProps<UserType> = {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
clientProviders: ClientProviders;
|
|
7
7
|
callbackRoute?: RouteString;
|
|
8
8
|
resolveAuthIntent?: ResolveAuthIntent<UserType>;
|
package/dist/errors.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type AuthIdentityConflict = {
|
|
|
6
6
|
currentUserAuthSub?: string;
|
|
7
7
|
intent?: AuthIntent;
|
|
8
8
|
};
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class AuthIdentityConflictError extends Error {
|
|
10
10
|
conflict: AuthIdentityConflict;
|
|
11
11
|
constructor(conflict: AuthIdentityConflict);
|
|
12
12
|
}
|
package/dist/htmxRoutes.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 { AuthHtmxConfig, AuthHtmxUser } from './ui/types';
|
|
4
4
|
export declare const createAuthHtmxRoutes: <UserType extends AuthHtmxUser>(config: AuthHtmxConfig & {
|
|
5
|
-
authSessionStore?:
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
6
|
}) => Elysia<"", {
|
|
7
7
|
decorator: {};
|
|
8
8
|
store: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import {
|
|
2
|
+
import { AuthConfig } from './types';
|
|
3
3
|
import type { AuthHtmxUser } from './ui/types';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const auth: <UserType>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, cleanupIntervalMs, maxSessions, sessionDurationMs, authSessionStore, htmx, resolveAuthIntent, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onLinkIdentity, onLinkIdentityConflict, onLinkConnector, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError, onSessionCleanup }: AuthConfig<UserType>) => Promise<Elysia<"", {
|
|
5
5
|
decorator: {};
|
|
6
6
|
store: {
|
|
7
7
|
session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<unknown>;
|
|
@@ -772,9 +772,9 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
772
772
|
}>>;
|
|
773
773
|
export * from './types';
|
|
774
774
|
export * from './typebox';
|
|
775
|
-
export type {
|
|
775
|
+
export type { AuthSessionStore } from './sessionTypes';
|
|
776
776
|
export { isAuthIntent, isUserSessionId, isValidUser } from './typeGuards';
|
|
777
|
-
export {
|
|
777
|
+
export { AuthIdentityConflictError } from './errors';
|
|
778
778
|
export { sessionStore } from './sessionStore';
|
|
779
779
|
export { createInMemoryAuthSessionStore } from './authSessionStores';
|
|
780
780
|
export { createNeonAuthSessionStore } from './neonAuthSessionStore';
|
package/dist/index.js
CHANGED
|
@@ -2417,11 +2417,11 @@ var authorize = ({
|
|
|
2417
2417
|
import { Elysia as Elysia3, t as t3 } from "elysia";
|
|
2418
2418
|
|
|
2419
2419
|
// src/errors.ts
|
|
2420
|
-
class
|
|
2420
|
+
class AuthIdentityConflictError extends Error {
|
|
2421
2421
|
conflict;
|
|
2422
2422
|
constructor(conflict) {
|
|
2423
2423
|
super(`${conflict.authProvider} identity ${conflict.providerSubject} is already linked to ${conflict.existingUserAuthSub}`);
|
|
2424
|
-
this.name = "
|
|
2424
|
+
this.name = "AuthIdentityConflictError";
|
|
2425
2425
|
this.conflict = conflict;
|
|
2426
2426
|
}
|
|
2427
2427
|
}
|
|
@@ -2667,7 +2667,7 @@ var callback = ({
|
|
|
2667
2667
|
try {
|
|
2668
2668
|
response = authIntent === "link_identity" && onLinkIdentity ? await onLinkIdentity(callbackContext) : authIntent === "link_connector" && onLinkConnector ? await onLinkConnector(callbackContext) : await onCallbackSuccess?.(callbackContext);
|
|
2669
2669
|
} catch (err) {
|
|
2670
|
-
if (authIntent === "link_identity" && err instanceof
|
|
2670
|
+
if (authIntent === "link_identity" && err instanceof AuthIdentityConflictError && onLinkIdentityConflict) {
|
|
2671
2671
|
response = await onLinkIdentityConflict({
|
|
2672
2672
|
...callbackContext,
|
|
2673
2673
|
conflict: {
|
|
@@ -13860,8 +13860,8 @@ var instantiateUserSession = async ({
|
|
|
13860
13860
|
};
|
|
13861
13861
|
return response;
|
|
13862
13862
|
};
|
|
13863
|
-
var
|
|
13864
|
-
var
|
|
13863
|
+
var defineAuthConfig = (configuration) => configuration;
|
|
13864
|
+
var defineProvidersConfiguration = (providersConfiguration) => providersConfiguration;
|
|
13865
13865
|
var getStatus = async (session, user_session_id) => {
|
|
13866
13866
|
if (user_session_id === undefined) {
|
|
13867
13867
|
return {
|
|
@@ -13925,7 +13925,7 @@ var getUserSessionId = ({
|
|
|
13925
13925
|
};
|
|
13926
13926
|
|
|
13927
13927
|
// src/index.ts
|
|
13928
|
-
var
|
|
13928
|
+
var auth = async ({
|
|
13929
13929
|
providersConfiguration,
|
|
13930
13930
|
authorizeRoute,
|
|
13931
13931
|
callbackRoute,
|
|
@@ -14033,8 +14033,9 @@ export {
|
|
|
14033
14033
|
getUserSessionId,
|
|
14034
14034
|
getStatus,
|
|
14035
14035
|
extractPropFromIdentity,
|
|
14036
|
+
defineProvidersConfiguration,
|
|
14037
|
+
defineAuthConfig,
|
|
14036
14038
|
decodeJWT,
|
|
14037
|
-
createProvidersConfiguration,
|
|
14038
14039
|
createOAuthLinkedProviderCredentialResolver,
|
|
14039
14040
|
createNeonOAuthLinkedProviderCredentialResolver,
|
|
14040
14041
|
createNeonLinkedProviderStores,
|
|
@@ -14043,14 +14044,13 @@ export {
|
|
|
14043
14044
|
createInMemoryLinkedProviderStores,
|
|
14044
14045
|
createInMemoryAuthSessionStore,
|
|
14045
14046
|
createAuthHtmxRoutes,
|
|
14046
|
-
createAuthConfiguration,
|
|
14047
14047
|
buildClientProviders,
|
|
14048
14048
|
authProviderOption,
|
|
14049
14049
|
authIntentOption,
|
|
14050
14050
|
authClientOption,
|
|
14051
|
-
|
|
14052
|
-
|
|
14051
|
+
auth,
|
|
14052
|
+
AuthIdentityConflictError
|
|
14053
14053
|
};
|
|
14054
14054
|
|
|
14055
|
-
//# debugId=
|
|
14055
|
+
//# debugId=26C8391A6D84F55864756E2164756E21
|
|
14056
14056
|
//# sourceMappingURL=index.js.map
|