@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,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,9 @@ var instantiateUserSession = async ({
|
|
|
13860
13860
|
};
|
|
13861
13861
|
return response;
|
|
13862
13862
|
};
|
|
13863
|
-
var
|
|
13864
|
-
var
|
|
13863
|
+
var defineAuthConfig = (configuration) => configuration;
|
|
13864
|
+
var defineAuthHtmxConfig = (htmxConfig) => htmxConfig;
|
|
13865
|
+
var defineProvidersConfiguration = (providersConfiguration) => providersConfiguration;
|
|
13865
13866
|
var getStatus = async (session, user_session_id) => {
|
|
13866
13867
|
if (user_session_id === undefined) {
|
|
13867
13868
|
return {
|
|
@@ -13925,7 +13926,7 @@ var getUserSessionId = ({
|
|
|
13925
13926
|
};
|
|
13926
13927
|
|
|
13927
13928
|
// src/index.ts
|
|
13928
|
-
var
|
|
13929
|
+
var auth = async ({
|
|
13929
13930
|
providersConfiguration,
|
|
13930
13931
|
authorizeRoute,
|
|
13931
13932
|
callbackRoute,
|
|
@@ -14033,8 +14034,10 @@ export {
|
|
|
14033
14034
|
getUserSessionId,
|
|
14034
14035
|
getStatus,
|
|
14035
14036
|
extractPropFromIdentity,
|
|
14037
|
+
defineProvidersConfiguration,
|
|
14038
|
+
defineAuthHtmxConfig,
|
|
14039
|
+
defineAuthConfig,
|
|
14036
14040
|
decodeJWT,
|
|
14037
|
-
createProvidersConfiguration,
|
|
14038
14041
|
createOAuthLinkedProviderCredentialResolver,
|
|
14039
14042
|
createNeonOAuthLinkedProviderCredentialResolver,
|
|
14040
14043
|
createNeonLinkedProviderStores,
|
|
@@ -14043,14 +14046,13 @@ export {
|
|
|
14043
14046
|
createInMemoryLinkedProviderStores,
|
|
14044
14047
|
createInMemoryAuthSessionStore,
|
|
14045
14048
|
createAuthHtmxRoutes,
|
|
14046
|
-
createAuthConfiguration,
|
|
14047
14049
|
buildClientProviders,
|
|
14048
14050
|
authProviderOption,
|
|
14049
14051
|
authIntentOption,
|
|
14050
14052
|
authClientOption,
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
+
auth,
|
|
14054
|
+
AuthIdentityConflictError
|
|
14053
14055
|
};
|
|
14054
14056
|
|
|
14055
|
-
//# debugId=
|
|
14057
|
+
//# debugId=9EB8F87FA15CA78664756E2164756E21
|
|
14056
14058
|
//# sourceMappingURL=index.js.map
|