@absolutejs/auth 0.17.6 → 0.17.8
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/src/callback.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export declare const callback: <UserType>({ clientProviders, callbackRoute, onCa
|
|
|
31
31
|
query: unknown;
|
|
32
32
|
headers: unknown;
|
|
33
33
|
response: {
|
|
34
|
-
[x:
|
|
35
|
-
200:
|
|
34
|
+
[x: string]: any;
|
|
35
|
+
200: any;
|
|
36
36
|
400: "Cookies are missing" | "Invalid callback request" | "Invalid state mismatch" | "Code verifier not found and is required";
|
|
37
37
|
401: "Invalid provider" | "Client provider not found" | "No auth provider found";
|
|
38
38
|
500: `${string} - ${string}` | `Failed to validate authorization code: Unknown status: ${string}`;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
19
19
|
} | {
|
|
20
20
|
readonly code: "Unauthorized";
|
|
21
21
|
readonly message: "User is not authenticated";
|
|
22
|
-
}) => Promise<Response | import("./types").StatusReturn>) => Promise<
|
|
22
|
+
}) => Promise<Response | import("./types").StatusReturn>) => Promise<import("./types").StatusReturn | Response | import("elysia/error").ElysiaCustomStatusResponse<"Bad Request" | "Internal Server Error", "Cookies are missing" | `Error: ${string} - ${string}` | `Unknown Error: ${string}`, 400 | 500> | import("elysia/error").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401>>;
|
|
23
23
|
};
|
|
24
24
|
resolve: {};
|
|
25
25
|
}, {
|
|
@@ -174,8 +174,8 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
174
174
|
query: unknown;
|
|
175
175
|
headers: unknown;
|
|
176
176
|
response: {
|
|
177
|
-
[x:
|
|
178
|
-
200:
|
|
177
|
+
[x: string]: any;
|
|
178
|
+
200: any;
|
|
179
179
|
400: "Cookies are missing" | "Invalid callback request" | "Invalid state mismatch" | "Code verifier not found and is required";
|
|
180
180
|
401: "Invalid provider" | "Client provider not found" | "No auth provider found";
|
|
181
181
|
500: `${string} - ${string}` | `Failed to validate authorization code: Unknown status: ${string}`;
|
|
@@ -12,7 +12,7 @@ export declare const protectRoute: <UserType>() => Elysia<"", {
|
|
|
12
12
|
unregisteredSession: import("./types").UnregisteredSessionRecord;
|
|
13
13
|
};
|
|
14
14
|
derive: {
|
|
15
|
-
readonly protectRoute: (handleAuth: (user: UserType) => Promise<Response | StatusReturn>, handleAuthFail?: (error: AuthFailError) => Promise<Response | StatusReturn>) => Promise<
|
|
15
|
+
readonly protectRoute: (handleAuth: (user: UserType) => Promise<Response | StatusReturn>, handleAuthFail?: (error: AuthFailError) => Promise<Response | StatusReturn>) => Promise<StatusReturn | Response | import("elysia/error").ElysiaCustomStatusResponse<"Bad Request" | "Internal Server Error", "Cookies are missing" | `Error: ${string} - ${string}` | `Unknown Error: ${string}`, 400 | 500> | import("elysia/error").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401>>;
|
|
16
16
|
};
|
|
17
17
|
resolve: {};
|
|
18
18
|
}, {
|
package/dist/src/types.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export type UnregisteredSessionRecord = Record<string, {
|
|
|
22
22
|
userIdentity: Record<string, unknown>;
|
|
23
23
|
expiresAt: number;
|
|
24
24
|
}>;
|
|
25
|
-
export type
|
|
25
|
+
export type StatusReturn = ElysiaCustomStatusResponse<any, any, any>;
|
|
26
|
+
export type OnNewUser<UserType> = (userIdentity: Record<string, unknown>) => UserType | StatusReturn | Response | Promise<UserType | StatusReturn | Response>;
|
|
26
27
|
export type GetUser<UserType> = (userIdentity: Record<string, unknown>) => UserType | null | undefined | Promise<UserType | null | undefined>;
|
|
27
28
|
export type CallbackCookie = Record<string, Cookie<string | undefined>> & {
|
|
28
29
|
user_session_id: Cookie<`${string}-${string}-${string}-${string}-${string}` | undefined>;
|
|
@@ -91,10 +92,6 @@ export type GetStatusProps<UserType> = {
|
|
|
91
92
|
session: SessionRecord<UserType>;
|
|
92
93
|
onStatus?: OnStatus<UserType>;
|
|
93
94
|
};
|
|
94
|
-
type AllowedStatusText = Parameters<typeof statusType>[0];
|
|
95
|
-
type AllowedBody = Parameters<typeof statusType>[1];
|
|
96
|
-
type StatusCodeFor<Text extends AllowedStatusText> = ReturnType<typeof statusType> extends ElysiaCustomStatusResponse<Text, infer InferredBody, infer InferredCode> ? [InferredBody] extends [unknown] ? InferredCode : never : never;
|
|
97
|
-
export type StatusReturn<Text extends AllowedStatusText = AllowedStatusText, Body extends AllowedBody = AllowedBody> = ElysiaCustomStatusResponse<Text, Body, StatusCodeFor<Text>>;
|
|
98
95
|
export type AbsoluteAuthProps<UserType> = {
|
|
99
96
|
providersConfiguration: OAuth2ConfigurationOptions;
|
|
100
97
|
authorizeRoute?: AuthorizeRoute;
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbsoluteAuthProps, GetStatusProps, InsantiateUserSessionProps, OAuth2ConfigurationOptions } from './types';
|
|
2
|
-
export declare const instantiateUserSession: <UserType>({ userSessionId, authProvider, session, unregisteredSession, tokenResponse, providerInstance, getUser, onNewUser }: InsantiateUserSessionProps<UserType>) => Promise<
|
|
2
|
+
export declare const instantiateUserSession: <UserType>({ userSessionId, authProvider, session, unregisteredSession, tokenResponse, providerInstance, getUser, onNewUser }: InsantiateUserSessionProps<UserType>) => Promise<import("./types").StatusReturn | Response | undefined>;
|
|
3
3
|
export declare const createAuthConfiguration: <UserType>(configuration: AbsoluteAuthProps<UserType>) => AbsoluteAuthProps<UserType>;
|
|
4
4
|
export declare const createProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => OAuth2ConfigurationOptions;
|
|
5
5
|
export declare const getStatus: <UserType>({ user_session_id, session, onStatus }: GetStatusProps<UserType>) => Promise<{
|
package/package.json
CHANGED