wabe 0.6.4 → 0.6.5
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/README.md +2 -1
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/interface.d.ts +9 -0
- package/dist/authentication/OTP.d.ts +8 -0
- package/dist/authentication/Session.d.ts +21 -0
- package/dist/authentication/defaultAuthentication.d.ts +3 -0
- package/dist/authentication/index.d.ts +2 -0
- package/dist/authentication/interface.d.ts +118 -0
- package/dist/authentication/oauth/GitHub.d.ts +13 -0
- package/dist/authentication/oauth/Google.d.ts +13 -0
- package/dist/authentication/oauth/Oauth2Client.d.ts +33 -0
- package/dist/authentication/oauth/index.d.ts +2 -0
- package/dist/authentication/oauth/utils.d.ts +14 -0
- package/dist/authentication/providers/EmailOTP.d.ts +11 -0
- package/dist/authentication/providers/EmailPassword.d.ts +13 -0
- package/dist/authentication/providers/GitHub.d.ts +12 -0
- package/dist/authentication/providers/Google.d.ts +12 -0
- package/dist/authentication/providers/OAuth.d.ts +6 -0
- package/dist/authentication/providers/PhonePassword.d.ts +13 -0
- package/dist/authentication/providers/index.d.ts +5 -0
- package/dist/authentication/resolvers/refreshResolver.d.ts +1 -0
- package/dist/authentication/resolvers/signInWithResolver.d.ts +1 -0
- package/dist/authentication/resolvers/signOutResolver.d.ts +1 -0
- package/dist/authentication/resolvers/signUpWithResolver.d.ts +1 -0
- package/dist/authentication/resolvers/verifyChallenge.d.ts +1 -0
- package/dist/authentication/roles.d.ts +1 -0
- package/dist/authentication/srp/processSRPChallenge.d.ts +1 -0
- package/dist/authentication/srp/signInWithSRP.d.ts +1 -0
- package/dist/authentication/srp/signUpWithSRP.d.ts +1 -0
- package/dist/authentication/utils.d.ts +8 -0
- package/dist/cron/index.d.ts +32 -0
- package/dist/database/adapters/MongoAdapter.d.ts +64 -0
- package/dist/database/adapters/adaptersInterface.d.ts +263 -0
- package/dist/database/adapters/index.d.ts +2 -0
- package/dist/database/controllers/DatabaseController.d.ts +90 -0
- package/dist/database/controllers/index.d.ts +1 -0
- package/dist/database/index.d.ts +10 -0
- package/dist/email/DevAdapter.d.ts +4 -0
- package/dist/email/EmailController.d.ts +6 -0
- package/dist/email/index.d.ts +2 -0
- package/dist/email/interface.d.ts +35 -0
- package/dist/email/templates/sendOtpCode.d.ts +1 -0
- package/dist/files/FileController.d.ts +10 -0
- package/dist/files/FileDevAdapter.d.ts +8 -0
- package/dist/files/hookDeleteFile.d.ts +1 -0
- package/dist/files/hookReadFile.d.ts +1 -0
- package/dist/files/hookUploadFile.d.ts +2 -0
- package/dist/files/index.d.ts +2 -0
- package/dist/files/interface.d.ts +30 -0
- package/dist/graphql/GraphQLSchema.d.ts +75 -0
- package/dist/graphql/index.d.ts +2 -0
- package/dist/graphql/parser.d.ts +38 -0
- package/dist/graphql/pointerAndRelationFunction.d.ts +20 -0
- package/dist/graphql/resolvers.d.ts +20 -0
- package/dist/graphql/types.d.ts +18 -0
- package/dist/hooks/HookObject.d.ts +39 -0
- package/dist/hooks/authentication.d.ts +2 -0
- package/dist/hooks/defaultFields.d.ts +3 -0
- package/dist/hooks/deleteSession.d.ts +1 -0
- package/dist/hooks/index.d.ts +41 -0
- package/dist/hooks/permissions.d.ts +6 -0
- package/dist/hooks/protected.d.ts +3 -0
- package/dist/hooks/searchableFields.d.ts +3 -0
- package/dist/hooks/session.d.ts +3 -0
- package/dist/hooks/setEmail.d.ts +2 -0
- package/dist/hooks/setupAcl.d.ts +2 -0
- package/dist/index.d.ts +11 -1469
- package/dist/index.js +486 -76827
- package/dist/payment/DevAdapter.d.ts +17 -0
- package/dist/payment/PaymentController.d.ts +19 -0
- package/dist/payment/index.d.ts +2 -0
- package/dist/payment/interface.d.ts +235 -0
- package/dist/schema/Schema.d.ts +164 -0
- package/dist/schema/defaultResolvers.d.ts +7 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/resolvers/meResolver.d.ts +1 -0
- package/dist/schema/resolvers/resetPassword.d.ts +1 -0
- package/dist/schema/resolvers/sendEmail.d.ts +1 -0
- package/dist/schema/resolvers/sendOtpCode.d.ts +1 -0
- package/dist/server/defaultHandlers.d.ts +1 -0
- package/dist/server/generateCodegen.d.ts +1 -0
- package/dist/server/index.d.ts +77 -0
- package/dist/server/routes/authHandler.d.ts +2 -0
- package/dist/server/routes/index.d.ts +8 -0
- package/dist/utils/export.d.ts +2 -0
- package/dist/utils/helper.d.ts +21 -0
- package/dist/utils/index.d.ts +17 -0
- package/generated/schema.graphql +126 -21
- package/generated/wabe.ts +135 -25
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## What is Wabe?
|
|
10
10
|
|
|
11
|
-
Wabe is an open-source backend that allows you to create your own fully customizable backend in just a few minutes. It handles database access, automatic GraphQL API generation, authentication with various methods (classic or OAuth), permissions, security, payment, emails, and more for you.
|
|
11
|
+
Wabe is an open-source backend as a service that allows you to create your own fully customizable backend in just a few minutes. It handles database access, automatic GraphQL API generation, authentication with various methods (classic or OAuth), permissions, security, payment, emails, and more for you.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
@@ -27,6 +27,7 @@ const run = async () => {
|
|
|
27
27
|
// Ensure your database is running before run the file
|
|
28
28
|
|
|
29
29
|
const wabe = new Wabe({
|
|
30
|
+
isProduction: process.env.NODE_ENV === "production",
|
|
30
31
|
// Root key example (must be long minimal 64 characters, you can generate it online)
|
|
31
32
|
rootKey:
|
|
32
33
|
"0uwFvUxM$ceFuF1aEtTtZMa7DUN2NZudqgY5ve5W*QCyb58cwMj9JeoaV@d#%29v&aJzswuudVU1%nAT+rxS0Bh&OkgBYc0PH18*",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./interface";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WabeContext } from "../server/interface";
|
|
2
|
+
import type { User } from "../../generated/wabe";
|
|
3
|
+
import type { WabeConfig } from "../server";
|
|
4
|
+
import type { DevWabeTypes } from "../utils/helper";
|
|
5
|
+
export declare class Session {
|
|
6
|
+
private accessToken;
|
|
7
|
+
private refreshToken;
|
|
8
|
+
getAccessTokenExpireAt(config: WabeConfig<DevWabeTypes>);
|
|
9
|
+
_getRefreshTokenExpiresInMs(config: WabeConfig<DevWabeTypes>);
|
|
10
|
+
getRefreshTokenExpireAt(config: WabeConfig<DevWabeTypes>);
|
|
11
|
+
meFromAccessToken(accessToken: string, context: WabeContext<DevWabeTypes>): Promise<{
|
|
12
|
+
sessionId: string | null
|
|
13
|
+
user: User | null
|
|
14
|
+
accessToken: string | null
|
|
15
|
+
refreshToken?: string | null
|
|
16
|
+
}>;
|
|
17
|
+
create(userId: string, context: WabeContext<DevWabeTypes>);
|
|
18
|
+
delete(context: WabeContext<DevWabeTypes>);
|
|
19
|
+
_isRefreshTokenExpired(userRefreshTokenExpiresAt: Date, refreshTokenAgeInMs: number);
|
|
20
|
+
refresh(accessToken: string, refreshToken: string, context: WabeContext<DevWabeTypes>);
|
|
21
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { User } from "../../generated/wabe";
|
|
2
|
+
import type { WabeContext } from "../server/interface";
|
|
3
|
+
import type { SchemaFields } from "../schema";
|
|
4
|
+
import type { WabeTypes, WobeCustomContext } from "../server";
|
|
5
|
+
export declare enum ProviderEnum {
|
|
6
|
+
google = "google",
|
|
7
|
+
github = "github",
|
|
8
|
+
}
|
|
9
|
+
export interface ProviderConfig {
|
|
10
|
+
clientId: string;
|
|
11
|
+
clientSecret: string;
|
|
12
|
+
}
|
|
13
|
+
export type AuthenticationEventsOptions<
|
|
14
|
+
T extends WabeTypes,
|
|
15
|
+
K
|
|
16
|
+
> = {
|
|
17
|
+
context: WabeContext<T>
|
|
18
|
+
input: K
|
|
19
|
+
};
|
|
20
|
+
export type AuthenticationEventsOptionsWithUserId<
|
|
21
|
+
T extends WabeTypes,
|
|
22
|
+
K
|
|
23
|
+
> = AuthenticationEventsOptions<T, K> & {
|
|
24
|
+
userId: string
|
|
25
|
+
};
|
|
26
|
+
export type OnSendChallengeOptions<T extends WabeTypes> = {
|
|
27
|
+
context: WabeContext<T>
|
|
28
|
+
user: T["types"]["User"]
|
|
29
|
+
};
|
|
30
|
+
export type OnVerifyChallengeOptions<
|
|
31
|
+
T extends WabeTypes,
|
|
32
|
+
K
|
|
33
|
+
> = {
|
|
34
|
+
context: WabeContext<T>
|
|
35
|
+
input: K
|
|
36
|
+
};
|
|
37
|
+
export type ProviderInterface<
|
|
38
|
+
T extends WabeTypes,
|
|
39
|
+
K = any
|
|
40
|
+
> = {
|
|
41
|
+
onSignIn: (options: AuthenticationEventsOptions<T, K>) => Promise<{
|
|
42
|
+
user: Partial<User>
|
|
43
|
+
}>
|
|
44
|
+
onSignUp: (options: AuthenticationEventsOptions<T, K>) => Promise<{
|
|
45
|
+
authenticationDataToSave: any
|
|
46
|
+
}>
|
|
47
|
+
onUpdateAuthenticationData?: (options: AuthenticationEventsOptionsWithUserId<T, K>) => Promise<{
|
|
48
|
+
authenticationDataToSave: any
|
|
49
|
+
}>
|
|
50
|
+
};
|
|
51
|
+
export type SecondaryProviderInterface<
|
|
52
|
+
T extends WabeTypes,
|
|
53
|
+
K = any
|
|
54
|
+
> = {
|
|
55
|
+
onSendChallenge: (options: OnSendChallengeOptions<T>) => Promise<void> | void
|
|
56
|
+
onVerifyChallenge: (options: OnVerifyChallengeOptions<T, K>) => Promise<{
|
|
57
|
+
userId: string
|
|
58
|
+
} | null> | ({
|
|
59
|
+
userId: string
|
|
60
|
+
} | null)
|
|
61
|
+
};
|
|
62
|
+
export type CustomAuthenticationMethods<
|
|
63
|
+
T extends WabeTypes,
|
|
64
|
+
U = ProviderInterface<T> | SecondaryProviderInterface<T>,
|
|
65
|
+
K = SchemaFields<T>,
|
|
66
|
+
W = SchemaFields<T>
|
|
67
|
+
> = {
|
|
68
|
+
name: string
|
|
69
|
+
input: K
|
|
70
|
+
dataToStore?: W
|
|
71
|
+
provider: U
|
|
72
|
+
isSecondaryFactor?: boolean
|
|
73
|
+
};
|
|
74
|
+
export type RoleConfig = Array<string>;
|
|
75
|
+
export interface SessionConfig {
|
|
76
|
+
/**
|
|
77
|
+
* The time in milliseconds that the access token will expire
|
|
78
|
+
*/
|
|
79
|
+
accessTokenExpiresInMs?: number;
|
|
80
|
+
/**
|
|
81
|
+
* The time in milliseconds that the refresh token will expire
|
|
82
|
+
*/
|
|
83
|
+
refreshTokenExpiresInMs?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Set to true to automatically store the session tokens in cookies
|
|
86
|
+
*/
|
|
87
|
+
cookieSession?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface AuthenticationConfig<T extends WabeTypes> {
|
|
90
|
+
session?: SessionConfig;
|
|
91
|
+
roles?: RoleConfig;
|
|
92
|
+
successRedirectPath?: string;
|
|
93
|
+
failureRedirectPath?: string;
|
|
94
|
+
frontDomain?: string;
|
|
95
|
+
backDomain?: string;
|
|
96
|
+
providers?: Partial<Record<ProviderEnum, ProviderConfig>>;
|
|
97
|
+
customAuthenticationMethods?: CustomAuthenticationMethods<T>[];
|
|
98
|
+
sessionHandler?: (context: WobeCustomContext<T>) => void | Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
export interface CreateTokenFromAuthorizationCodeOptions {
|
|
101
|
+
code: string;
|
|
102
|
+
}
|
|
103
|
+
export interface refreshTokenOptions {
|
|
104
|
+
refreshToken: string;
|
|
105
|
+
}
|
|
106
|
+
export interface Provider {
|
|
107
|
+
createTokenFromAuthorizationCode(options: CreateTokenFromAuthorizationCodeOptions): Promise<void>;
|
|
108
|
+
refreshToken(options: refreshTokenOptions): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
export declare enum AuthenticationProvider {
|
|
111
|
+
GitHub = "github",
|
|
112
|
+
Google = "google",
|
|
113
|
+
EmailPassword = "emailPassword",
|
|
114
|
+
PhonePassword = "phonePassword",
|
|
115
|
+
}
|
|
116
|
+
export declare enum SecondaryFactor {
|
|
117
|
+
EmailOTP = "emailOTP",
|
|
118
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WabeConfig } from "../../server";
|
|
2
|
+
import type { OAuth2ProviderWithPKCE, Tokens } from "./utils";
|
|
3
|
+
export declare class GitHub implements OAuth2ProviderWithPKCE {
|
|
4
|
+
private client;
|
|
5
|
+
private clientSecret;
|
|
6
|
+
constructor(config: WabeConfig<any>);
|
|
7
|
+
createAuthorizationURL(state: string, codeVerifier: string, options?: {
|
|
8
|
+
scopes?: string[]
|
|
9
|
+
}): URL;
|
|
10
|
+
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
11
|
+
refreshAccessToken(refreshToken: string): Promise<Tokens>;
|
|
12
|
+
getUserInfo(accessToken: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WabeConfig } from "../../server";
|
|
2
|
+
import type { OAuth2ProviderWithPKCE, Tokens } from "./utils";
|
|
3
|
+
export declare class Google implements OAuth2ProviderWithPKCE {
|
|
4
|
+
private client;
|
|
5
|
+
private clientSecret;
|
|
6
|
+
constructor(config: WabeConfig<any>);
|
|
7
|
+
createAuthorizationURL(state: string, codeVerifier: string, options?: {
|
|
8
|
+
scopes?: string[]
|
|
9
|
+
}): URL;
|
|
10
|
+
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
11
|
+
refreshAccessToken(refreshToken: string): Promise<Tokens>;
|
|
12
|
+
getUserInfo(accessToken: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface TokenResponseBody {
|
|
2
|
+
access_token: string;
|
|
3
|
+
token_type?: string;
|
|
4
|
+
expires_in?: number;
|
|
5
|
+
refresh_token?: string;
|
|
6
|
+
scope?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class OAuth2Client {
|
|
9
|
+
clientId: string;
|
|
10
|
+
private authorizeEndpoint;
|
|
11
|
+
private tokenEndpoint;
|
|
12
|
+
private redirectURI;
|
|
13
|
+
constructor(clientId: string, authorizeEndpoint: string, tokenEndpoint: string, redirectURI: string);
|
|
14
|
+
createAuthorizationURL(options?: {
|
|
15
|
+
state?: string
|
|
16
|
+
codeVerifier?: string
|
|
17
|
+
scopes?: string[]
|
|
18
|
+
}): URL;
|
|
19
|
+
validateAuthorizationCode<_TokenResponseBody extends TokenResponseBody>(authorizationCode: string, options?: {
|
|
20
|
+
codeVerifier?: string
|
|
21
|
+
credentials?: string
|
|
22
|
+
authenticateWith?: "http_basic_auth" | "request_body"
|
|
23
|
+
}): Promise<_TokenResponseBody>;
|
|
24
|
+
refreshAccessToken<_TokenResponseBody extends TokenResponseBody>(refreshToken: string, options?: {
|
|
25
|
+
credentials?: string
|
|
26
|
+
authenticateWith?: "http_basic_auth" | "request_body"
|
|
27
|
+
scopes?: string[]
|
|
28
|
+
}): Promise<_TokenResponseBody>;
|
|
29
|
+
_sendTokenRequest<_TokenResponseBody extends TokenResponseBody>(body: URLSearchParams, options?: {
|
|
30
|
+
credentials?: string
|
|
31
|
+
authenticateWith?: "http_basic_auth" | "request_body"
|
|
32
|
+
}): Promise<_TokenResponseBody>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Tokens {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken?: string | null;
|
|
4
|
+
accessTokenExpiresAt?: Date;
|
|
5
|
+
refreshTokenExpiresAt?: Date | null;
|
|
6
|
+
idToken?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface OAuth2ProviderWithPKCE {
|
|
9
|
+
createAuthorizationURL(state: string, codeVerifier: string): URL;
|
|
10
|
+
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
11
|
+
refreshAccessToken?(refreshToken: string): Promise<Tokens>;
|
|
12
|
+
}
|
|
13
|
+
export declare const base64URLencode: unknown;
|
|
14
|
+
export declare const generateRandomValues: unknown;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
|
+
import type { OnSendChallengeOptions, OnVerifyChallengeOptions, SecondaryProviderInterface } from "../interface";
|
|
3
|
+
type EmailOTPInterface = {
|
|
4
|
+
email: string
|
|
5
|
+
otp: string
|
|
6
|
+
};
|
|
7
|
+
export declare class EmailOTP implements SecondaryProviderInterface<DevWabeTypes, EmailOTPInterface> {
|
|
8
|
+
onSendChallenge({ context, user }: OnSendChallengeOptions<DevWabeTypes>);
|
|
9
|
+
onVerifyChallenge({ context, input }: OnVerifyChallengeOptions<DevWabeTypes, EmailOTPInterface>);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AuthenticationEventsOptions, AuthenticationEventsOptionsWithUserId, ProviderInterface } from "../interface";
|
|
2
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
3
|
+
type EmailPasswordInterface = {
|
|
4
|
+
password: string
|
|
5
|
+
email: string
|
|
6
|
+
otp?: string
|
|
7
|
+
};
|
|
8
|
+
export declare class EmailPassword implements ProviderInterface<DevWabeTypes, EmailPasswordInterface> {
|
|
9
|
+
onSignIn({ input, context }: AuthenticationEventsOptions<DevWabeTypes, EmailPasswordInterface>);
|
|
10
|
+
onSignUp({ input, context }: AuthenticationEventsOptions<DevWabeTypes, EmailPasswordInterface>);
|
|
11
|
+
onUpdateAuthenticationData({ userId, input, context }: AuthenticationEventsOptionsWithUserId<DevWabeTypes, EmailPasswordInterface>);
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
|
+
import { type AuthenticationEventsOptions, type ProviderInterface } from "../interface";
|
|
3
|
+
type GitHubInterface = {
|
|
4
|
+
authorizationCode: string
|
|
5
|
+
codeVerifier: string
|
|
6
|
+
};
|
|
7
|
+
export declare class GitHub implements ProviderInterface<DevWabeTypes, GitHubInterface> {
|
|
8
|
+
name: string;
|
|
9
|
+
onSignIn(options: AuthenticationEventsOptions<DevWabeTypes, GitHubInterface>);
|
|
10
|
+
onSignUp();
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
|
+
import { type AuthenticationEventsOptions, type ProviderInterface } from "../interface";
|
|
3
|
+
type GoogleInterface = {
|
|
4
|
+
authorizationCode: string
|
|
5
|
+
codeVerifier: string
|
|
6
|
+
};
|
|
7
|
+
export declare class Google implements ProviderInterface<DevWabeTypes, GoogleInterface> {
|
|
8
|
+
name: string;
|
|
9
|
+
onSignIn(options: AuthenticationEventsOptions<DevWabeTypes, GoogleInterface>);
|
|
10
|
+
onSignUp();
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AuthenticationEventsOptions, AuthenticationEventsOptionsWithUserId, ProviderInterface } from "../interface";
|
|
2
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
3
|
+
type PhonePasswordInterface = {
|
|
4
|
+
password: string
|
|
5
|
+
phone: string
|
|
6
|
+
otp?: string
|
|
7
|
+
};
|
|
8
|
+
export declare class PhonePassword implements ProviderInterface<DevWabeTypes, PhonePasswordInterface> {
|
|
9
|
+
onSignIn({ input, context }: AuthenticationEventsOptions<DevWabeTypes, PhonePasswordInterface>);
|
|
10
|
+
onSignUp({ input, context }: AuthenticationEventsOptions<DevWabeTypes, PhonePasswordInterface>);
|
|
11
|
+
onUpdateAuthenticationData({ userId, input, context }: AuthenticationEventsOptionsWithUserId<DevWabeTypes, PhonePasswordInterface>);
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const refreshResolver: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const signInWithResolver: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const signOutResolver: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const signUpWithResolver: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const verifyChallengeResolver: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initializeRoles: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const processSRPChallenge: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const signInWithSRP: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const signUpWithSRP: unknown;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WabeTypes } from "../server";
|
|
2
|
+
import type { WabeContext } from "../server/interface";
|
|
3
|
+
import type { CustomAuthenticationMethods, ProviderInterface, SecondaryProviderInterface } from "./interface";
|
|
4
|
+
export declare const getAuthenticationMethod: <
|
|
5
|
+
T extends WabeTypes,
|
|
6
|
+
U = ProviderInterface<T> | SecondaryProviderInterface<T>
|
|
7
|
+
>(listOfMethods: string[], context: WabeContext<any>) => CustomAuthenticationMethods<T, U>;
|
|
8
|
+
export declare const hashPassword: unknown;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Cron } from "croner";
|
|
2
|
+
import type { Wabe, WabeTypes } from "../server";
|
|
3
|
+
export type OutputCron<T extends WabeTypes> = (wabe: Wabe<T>) => Cron;
|
|
4
|
+
export declare const cron: <T extends WabeTypes>({ pattern, run, maxRuns, enabledProtectedRuns }: {
|
|
5
|
+
pattern: string
|
|
6
|
+
maxRuns?: number
|
|
7
|
+
enabledProtectedRuns?: boolean
|
|
8
|
+
run: (wabe: Wabe<T>) => any | Promise<any>
|
|
9
|
+
}) => OutputCron<T>;
|
|
10
|
+
export declare enum CronExpressions {
|
|
11
|
+
EVERY_SECOND = "* * * * * *",
|
|
12
|
+
EVERY_MINUTE = "0 * * * * *",
|
|
13
|
+
EVERY_HOUR = "0 0 * * * *",
|
|
14
|
+
EVERY_DAY_AT_MIDNIGHT = "0 0 0 * * *",
|
|
15
|
+
EVERY_WEEK = "0 0 0 * * 0",
|
|
16
|
+
EVERY_MONTH = "0 0 0 1 * *",
|
|
17
|
+
EVERY_YEAR = "0 0 0 1 1 *",
|
|
18
|
+
WEEKDAYS_MORNING = "0 0 7 * * 1-5",
|
|
19
|
+
WEEKENDS_EVENING = "0 0 19 * * 6-7",
|
|
20
|
+
FIRST_DAY_OF_MONTH = "0 0 0 1 * *",
|
|
21
|
+
LAST_DAY_OF_MONTH = "0 0 0 L * *",
|
|
22
|
+
EVERY_15_MINUTES = "0 */15 * * * *",
|
|
23
|
+
EVERY_30_MINUTES = "0 */30 * * * *",
|
|
24
|
+
EVERY_2_HOURS = "0 0 */2 * * *",
|
|
25
|
+
EVERY_6_HOURS = "0 0 */6 * * *",
|
|
26
|
+
EVERY_12_HOURS = "0 0 */12 * * *",
|
|
27
|
+
}
|
|
28
|
+
export type CronConfig<T extends WabeTypes> = Array<{
|
|
29
|
+
name: string
|
|
30
|
+
cron: OutputCron<T>
|
|
31
|
+
job?: Cron
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Db, MongoClient } from "mongodb";
|
|
2
|
+
import type { AdapterOptions, DatabaseAdapter, GetObjectOptions, CreateObjectOptions, UpdateObjectOptions, GetObjectsOptions, CreateObjectsOptions, UpdateObjectsOptions, DeleteObjectsOptions, WhereType, DeleteObjectOptions, OutputType, CountOptions, OrderType } from "./adaptersInterface";
|
|
3
|
+
import type { WabeTypes } from "../../server";
|
|
4
|
+
import type { WabeContext } from "../../server/interface";
|
|
5
|
+
export declare const buildMongoOrderQuery: <
|
|
6
|
+
T extends WabeTypes,
|
|
7
|
+
K extends keyof T["types"],
|
|
8
|
+
U extends keyof T["types"][K]
|
|
9
|
+
>(order?: OrderType<T, K, U>) => Record<string, any>;
|
|
10
|
+
export declare const buildMongoWhereQuery: <
|
|
11
|
+
T extends WabeTypes,
|
|
12
|
+
K extends keyof T["types"]
|
|
13
|
+
>(where?: WhereType<T, K>) => Record<string, any>;
|
|
14
|
+
export declare class MongoAdapter<T extends WabeTypes> implements DatabaseAdapter<T> {
|
|
15
|
+
options: AdapterOptions;
|
|
16
|
+
database?: Db;
|
|
17
|
+
client: MongoClient;
|
|
18
|
+
constructor(options: AdapterOptions);
|
|
19
|
+
connect();
|
|
20
|
+
close();
|
|
21
|
+
createClassIfNotExist(className: keyof T["types"], context: WabeContext<T>);
|
|
22
|
+
count<K extends keyof T["types"]>(params: CountOptions<T, K>);
|
|
23
|
+
clearDatabase();
|
|
24
|
+
getObject<
|
|
25
|
+
K extends keyof T["types"],
|
|
26
|
+
U extends keyof T["types"][K]
|
|
27
|
+
>(params: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
|
|
28
|
+
getObjects<
|
|
29
|
+
K extends keyof T["types"],
|
|
30
|
+
U extends keyof T["types"][K],
|
|
31
|
+
W extends keyof T["types"][K]
|
|
32
|
+
>(params: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
|
|
33
|
+
createObject<
|
|
34
|
+
K extends keyof T["types"],
|
|
35
|
+
U extends keyof T["types"][K],
|
|
36
|
+
W extends keyof T["types"][K]
|
|
37
|
+
>(params: CreateObjectOptions<T, K, U, W>);
|
|
38
|
+
createObjects<
|
|
39
|
+
K extends keyof T["types"],
|
|
40
|
+
U extends keyof T["types"][K],
|
|
41
|
+
W extends keyof T["types"][K],
|
|
42
|
+
X extends keyof T["types"][K]
|
|
43
|
+
>(params: CreateObjectsOptions<T, K, U, W, X>);
|
|
44
|
+
updateObject<
|
|
45
|
+
K extends keyof T["types"],
|
|
46
|
+
U extends keyof T["types"][K],
|
|
47
|
+
W extends keyof T["types"][K]
|
|
48
|
+
>(params: UpdateObjectOptions<T, K, U, W>);
|
|
49
|
+
updateObjects<
|
|
50
|
+
K extends keyof T["types"],
|
|
51
|
+
U extends keyof T["types"][K],
|
|
52
|
+
W extends keyof T["types"][K],
|
|
53
|
+
X extends keyof T["types"][K]
|
|
54
|
+
>(params: UpdateObjectsOptions<T, K, U, W, X>);
|
|
55
|
+
deleteObject<
|
|
56
|
+
K extends keyof T["types"],
|
|
57
|
+
U extends keyof T["types"][K]
|
|
58
|
+
>(params: DeleteObjectOptions<T, K, U>);
|
|
59
|
+
deleteObjects<
|
|
60
|
+
K extends keyof T["types"],
|
|
61
|
+
U extends keyof T["types"][U],
|
|
62
|
+
W extends keyof T["types"][U]
|
|
63
|
+
>(params: DeleteObjectsOptions<T, K, U, W>);
|
|
64
|
+
}
|