@absolutejs/auth 0.7.5 → 0.9.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/.env.example +210 -7
- package/dist/index.js +291 -103
- package/dist/src/index.d.ts +2 -2
- package/dist/src/status.d.ts +2 -3
- package/dist/src/types.d.ts +5 -5
- package/dist/src/utils.d.ts +1 -1
- package/eslint.config.mjs +1 -1
- package/package.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import { AbsoluteAuthProps } from './types';
|
|
3
|
-
export declare const absoluteAuth: <UserType>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, onAuthorize, onProfile, onCallback, onStatus, onRefresh, onSignOut, onRevocation }: AbsoluteAuthProps<UserType>) => Elysia<"", {
|
|
3
|
+
export declare const absoluteAuth: <UserType>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, onAuthorize, onProfile, onCallback, onStatus, onRefresh, onSignOut, onRevocation }: AbsoluteAuthProps<UserType>) => Promise<Elysia<"", {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {
|
|
6
6
|
session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<unknown>;
|
|
@@ -181,7 +181,7 @@ export declare const absoluteAuth: <UserType>({ providersConfiguration, authoriz
|
|
|
181
181
|
derive: {};
|
|
182
182
|
resolve: {};
|
|
183
183
|
schema: {};
|
|
184
|
-
}
|
|
184
|
+
}>>;
|
|
185
185
|
export * from './types';
|
|
186
186
|
export * from './utils';
|
|
187
187
|
export type { OAuth2TokenResponse, OAuth2Client, ProviderOption, PKCEProvider, OIDCProvider, RefreshableProvider, RevocableProvider, ScopeRequiredProvider, CredentialsFor } from 'citra';
|
package/dist/src/status.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import {
|
|
2
|
+
import { OnStatus, RouteString } from './types';
|
|
3
3
|
type StatusProps<UserType> = {
|
|
4
|
-
clientProviders: ClientProviders;
|
|
5
4
|
statusRoute?: RouteString;
|
|
6
5
|
onStatus?: OnStatus<UserType>;
|
|
7
6
|
};
|
|
8
|
-
export declare const status: <UserType>({
|
|
7
|
+
export declare const status: <UserType>({ statusRoute, onStatus }: StatusProps<UserType>) => Elysia<"", {
|
|
9
8
|
decorator: {};
|
|
10
9
|
store: {
|
|
11
10
|
session: import("./types").SessionRecord<UserType>;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ export type UserFunctionProps = {
|
|
|
20
20
|
};
|
|
21
21
|
export type CreateUser<UserType> = ({ userProfile, authProvider }: UserFunctionProps) => Promise<UserType>;
|
|
22
22
|
export type GetUser<UserType> = ({ userProfile, authProvider }: UserFunctionProps) => Promise<UserType | null>;
|
|
23
|
-
export type OnCallback<UserType> = ({ authProvider, tokenResponse,
|
|
23
|
+
export type OnCallback<UserType> = ({ authProvider, tokenResponse, providerInstance, session, user_session_id }: {
|
|
24
|
+
providerInstance: OAuth2Client<ProviderOption>;
|
|
24
25
|
authProvider: string;
|
|
25
26
|
tokenResponse: OAuth2TokenResponse;
|
|
26
|
-
userProfile: Record<string, unknown>;
|
|
27
27
|
session: SessionRecord<UserType>;
|
|
28
28
|
user_session_id: Cookie<string | undefined>;
|
|
29
29
|
}) => void | Promise<void>;
|
|
@@ -76,11 +76,11 @@ export type ClientProviders = Record<string, {
|
|
|
76
76
|
}>;
|
|
77
77
|
export type InsantiateUserSessionProps<UserType> = {
|
|
78
78
|
authProvider: string;
|
|
79
|
-
userProfile: Record<string, unknown>;
|
|
80
79
|
tokenResponse: OAuth2TokenResponse;
|
|
81
80
|
session: SessionRecord<UserType>;
|
|
81
|
+
providerInstance: OAuth2Client<ProviderOption>;
|
|
82
82
|
user_session_id: Cookie<string | undefined>;
|
|
83
|
-
createUser: () => UserType | Promise<UserType>;
|
|
84
|
-
getUser: () => UserType | null | undefined | Promise<UserType | null | undefined>;
|
|
83
|
+
createUser: (userProfile: Record<string, unknown>) => UserType | Promise<UserType>;
|
|
84
|
+
getUser: (userProfile: Record<string, unknown>) => UserType | null | undefined | Promise<UserType | null | undefined>;
|
|
85
85
|
};
|
|
86
86
|
export {};
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AbsoluteAuthProps, InsantiateUserSessionProps, OAuth2ConfigurationOptions } from './types';
|
|
2
|
-
export declare const instantiateUserSession: <UserType>({ user_session_id, session, tokenResponse, getUser, createUser }: InsantiateUserSessionProps<UserType>) => Promise<void>;
|
|
2
|
+
export declare const instantiateUserSession: <UserType>({ user_session_id, authProvider, session, tokenResponse, providerInstance, getUser, createUser }: InsantiateUserSessionProps<UserType>) => Promise<void>;
|
|
3
3
|
export declare const createAuthConfiguration: <UserType>(configuration: AbsoluteAuthProps<UserType>) => AbsoluteAuthProps<UserType>;
|
|
4
4
|
export declare const createProvidersConfiguration: (providersConfiguration: OAuth2ConfigurationOptions) => OAuth2ConfigurationOptions;
|
package/eslint.config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.9.0",
|
|
3
3
|
"name": "@absolutejs/auth",
|
|
4
4
|
"description": "An authorization library for absolutejs",
|
|
5
5
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"elysia": ">= 1.2.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"citra": "0.
|
|
36
|
+
"citra": "0.21.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@absolutejs/absolute": "0.4.0",
|