wabe 0.6.7 → 0.6.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/README.md +8 -7
- package/bucket/b.txt +1 -0
- package/dist/authentication/OTP.d.ts +5 -0
- package/dist/authentication/Session.d.ts +4 -4
- package/dist/authentication/index.d.ts +1 -0
- package/dist/authentication/interface.d.ts +36 -25
- package/dist/authentication/oauth/GitHub.d.ts +1 -1
- package/dist/authentication/oauth/Google.d.ts +1 -1
- package/dist/authentication/oauth/Oauth2Client.d.ts +11 -11
- package/dist/authentication/oauth/utils.d.ts +1 -0
- package/dist/authentication/providers/EmailOTP.d.ts +2 -2
- package/dist/authentication/providers/EmailPassword.d.ts +3 -3
- package/dist/authentication/providers/EmailPasswordSRP.d.ts +21 -0
- package/dist/authentication/providers/GitHub.d.ts +3 -2
- package/dist/authentication/providers/Google.d.ts +3 -2
- package/dist/authentication/providers/OAuth.d.ts +2 -2
- package/dist/authentication/providers/PhonePassword.d.ts +3 -3
- package/dist/authentication/providers/QRCodeOTP.d.ts +11 -0
- package/dist/authentication/providers/index.d.ts +1 -0
- package/dist/authentication/resolvers/signInWithResolver.d.ts +4 -0
- package/dist/authentication/resolvers/signUpWithResolver.d.ts +4 -0
- package/dist/cron/index.d.ts +8 -8
- package/dist/database/{controllers/DatabaseController.d.ts → DatabaseController.d.ts} +29 -27
- package/dist/database/index.d.ts +6 -9
- package/dist/database/{adapters/adaptersInterface.d.ts → interface.d.ts} +33 -35
- package/dist/email/DevAdapter.d.ts +1 -0
- package/dist/email/interface.d.ts +4 -4
- package/dist/{files → file}/FileController.d.ts +1 -1
- package/dist/{files → file}/FileDevAdapter.d.ts +1 -1
- package/dist/{files → file}/interface.d.ts +9 -3
- package/dist/graphql/GraphQLSchema.d.ts +32 -32
- package/dist/graphql/parser.d.ts +13 -13
- package/dist/graphql/pointerAndRelationFunction.d.ts +6 -6
- package/dist/graphql/resolvers.d.ts +5 -5
- package/dist/hooks/HookObject.d.ts +13 -12
- package/dist/hooks/createUser.d.ts +1 -0
- package/dist/hooks/deleteSession.d.ts +2 -0
- package/dist/hooks/hashFieldHook.d.ts +6 -0
- package/dist/hooks/index.d.ts +17 -13
- package/dist/hooks/setEmail.d.ts +2 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +50770 -486
- package/dist/schema/Schema.d.ts +59 -57
- package/dist/schema/defaultResolvers.d.ts +2 -2
- package/dist/server/index.d.ts +20 -24
- package/dist/server/routes/authHandler.d.ts +11 -0
- package/dist/utils/export.d.ts +1 -0
- package/dist/utils/helper.d.ts +3 -6
- package/dist/utils/index.d.ts +6 -1
- package/generated/schema.graphql +85 -75
- package/generated/wabe.ts +47 -51
- package/package.json +5 -6
- package/dist/authentication/srp/processSRPChallenge.d.ts +0 -1
- package/dist/authentication/srp/signInWithSRP.d.ts +0 -1
- package/dist/authentication/srp/signUpWithSRP.d.ts +0 -1
- package/dist/database/adapters/MongoAdapter.d.ts +0 -64
- package/dist/database/adapters/index.d.ts +0 -2
- package/dist/database/controllers/index.d.ts +0 -1
- package/dist/hooks/authentication.d.ts +0 -2
- package/dist/payment/DevAdapter.d.ts +0 -17
- package/dist/payment/PaymentController.d.ts +0 -19
- package/dist/payment/index.d.ts +0 -2
- package/dist/payment/interface.d.ts +0 -235
- /package/dist/{files → file}/hookDeleteFile.d.ts +0 -0
- /package/dist/{files → file}/hookReadFile.d.ts +0 -0
- /package/dist/{files → file}/hookUploadFile.d.ts +0 -0
- /package/dist/{files → file}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## What is Wabe?
|
|
10
10
|
|
|
11
|
-
Wabe is an open-source backend as a service
|
|
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, emails, and more for you.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
@@ -21,7 +21,8 @@ yarn add wabe # On yarn
|
|
|
21
21
|
## Basic example
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import {
|
|
24
|
+
import { Wabe } from "wabe";
|
|
25
|
+
import { MongoAdapter } from "wabe-mongodb";
|
|
25
26
|
|
|
26
27
|
const run = async () => {
|
|
27
28
|
// Ensure your database is running before run the file
|
|
@@ -32,11 +33,12 @@ const run = async () => {
|
|
|
32
33
|
rootKey:
|
|
33
34
|
"0uwFvUxM$ceFuF1aEtTtZMa7DUN2NZudqgY5ve5W*QCyb58cwMj9JeoaV@d#%29v&aJzswuudVU1%nAT+rxS0Bh&OkgBYc0PH18*",
|
|
34
35
|
database: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
adapter: new MongoAdapter({
|
|
37
|
+
databaseName: "WabeApp",
|
|
38
|
+
url: "mongodb://127.0.0.1:27045",
|
|
39
|
+
}),
|
|
38
40
|
},
|
|
39
|
-
port:
|
|
41
|
+
port: 3001,
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
await wabe.start();
|
|
@@ -53,7 +55,6 @@ await run();
|
|
|
53
55
|
- **GraphQL API**: A flexible and powerful GraphQL API (following GraphQL Relay standard) to interact with your data.
|
|
54
56
|
- **Hooks**: Powerful hooks system to execute custom actions before or after database requests.
|
|
55
57
|
- **Email**: Send emails with your favorite provider with very simple integration.
|
|
56
|
-
- **Payment**: Accept payments with Stripe or create your own payment provider adapter.
|
|
57
58
|
|
|
58
59
|
## Contributing
|
|
59
60
|
|
package/bucket/b.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b
|
|
@@ -5,4 +5,9 @@ export declare class OTP {
|
|
|
5
5
|
constructor(rootKey: string);
|
|
6
6
|
generate(userId: string): string;
|
|
7
7
|
verify(otp: string, userId: string): boolean;
|
|
8
|
+
generateKeyuri({ userId, emailOrUsername, applicationName }: {
|
|
9
|
+
userId: string;
|
|
10
|
+
emailOrUsername: string;
|
|
11
|
+
applicationName: string;
|
|
12
|
+
}): string;
|
|
8
13
|
}
|
|
@@ -9,10 +9,10 @@ export declare class Session {
|
|
|
9
9
|
_getRefreshTokenExpiresInMs(config: WabeConfig<DevWabeTypes>);
|
|
10
10
|
getRefreshTokenExpireAt(config: WabeConfig<DevWabeTypes>);
|
|
11
11
|
meFromAccessToken(accessToken: string, context: WabeContext<DevWabeTypes>): Promise<{
|
|
12
|
-
sessionId: string | null
|
|
13
|
-
user: User | null
|
|
14
|
-
accessToken: string | null
|
|
15
|
-
refreshToken?: string | null
|
|
12
|
+
sessionId: string | null;
|
|
13
|
+
user: User | null;
|
|
14
|
+
accessToken: string | null;
|
|
15
|
+
refreshToken?: string | null;
|
|
16
16
|
}>;
|
|
17
17
|
create(userId: string, context: WabeContext<DevWabeTypes>);
|
|
18
18
|
delete(context: WabeContext<DevWabeTypes>);
|
|
@@ -4,7 +4,7 @@ import type { SchemaFields } from "../schema";
|
|
|
4
4
|
import type { WabeTypes, WobeCustomContext } from "../server";
|
|
5
5
|
export declare enum ProviderEnum {
|
|
6
6
|
google = "google",
|
|
7
|
-
github = "github"
|
|
7
|
+
github = "github"
|
|
8
8
|
}
|
|
9
9
|
export interface ProviderConfig {
|
|
10
10
|
clientId: string;
|
|
@@ -14,50 +14,60 @@ export type AuthenticationEventsOptions<
|
|
|
14
14
|
T extends WabeTypes,
|
|
15
15
|
K
|
|
16
16
|
> = {
|
|
17
|
-
context: WabeContext<T
|
|
18
|
-
input: K
|
|
17
|
+
context: WabeContext<T>;
|
|
18
|
+
input: K;
|
|
19
19
|
};
|
|
20
20
|
export type AuthenticationEventsOptionsWithUserId<
|
|
21
21
|
T extends WabeTypes,
|
|
22
22
|
K
|
|
23
23
|
> = AuthenticationEventsOptions<T, K> & {
|
|
24
|
-
userId: string
|
|
24
|
+
userId: string;
|
|
25
25
|
};
|
|
26
26
|
export type OnSendChallengeOptions<T extends WabeTypes> = {
|
|
27
|
-
context: WabeContext<T
|
|
28
|
-
user: T["types"]["User"]
|
|
27
|
+
context: WabeContext<T>;
|
|
28
|
+
user: T["types"]["User"];
|
|
29
29
|
};
|
|
30
30
|
export type OnVerifyChallengeOptions<
|
|
31
31
|
T extends WabeTypes,
|
|
32
32
|
K
|
|
33
33
|
> = {
|
|
34
|
-
context: WabeContext<T
|
|
35
|
-
input: K
|
|
34
|
+
context: WabeContext<T>;
|
|
35
|
+
input: K;
|
|
36
36
|
};
|
|
37
37
|
export type ProviderInterface<
|
|
38
38
|
T extends WabeTypes,
|
|
39
39
|
K = any
|
|
40
40
|
> = {
|
|
41
41
|
onSignIn: (options: AuthenticationEventsOptions<T, K>) => Promise<{
|
|
42
|
-
user: Partial<User
|
|
43
|
-
|
|
42
|
+
user: Partial<User>;
|
|
43
|
+
srp?: {
|
|
44
|
+
salt: string;
|
|
45
|
+
serverPublic: string;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
44
48
|
onSignUp: (options: AuthenticationEventsOptions<T, K>) => Promise<{
|
|
45
|
-
authenticationDataToSave: any
|
|
46
|
-
}
|
|
49
|
+
authenticationDataToSave: any;
|
|
50
|
+
}>;
|
|
47
51
|
onUpdateAuthenticationData?: (options: AuthenticationEventsOptionsWithUserId<T, K>) => Promise<{
|
|
48
|
-
authenticationDataToSave: any
|
|
49
|
-
}
|
|
52
|
+
authenticationDataToSave: any;
|
|
53
|
+
}>;
|
|
50
54
|
};
|
|
51
55
|
export type SecondaryProviderInterface<
|
|
52
56
|
T extends WabeTypes,
|
|
53
57
|
K = any
|
|
54
58
|
> = {
|
|
55
|
-
onSendChallenge
|
|
59
|
+
onSendChallenge?: (options: OnSendChallengeOptions<T>) => Promise<void> | void;
|
|
56
60
|
onVerifyChallenge: (options: OnVerifyChallengeOptions<T, K>) => Promise<{
|
|
57
|
-
userId: string
|
|
61
|
+
userId: string;
|
|
62
|
+
srp?: {
|
|
63
|
+
serverSessionProof: string;
|
|
64
|
+
};
|
|
58
65
|
} | null> | ({
|
|
59
|
-
userId: string
|
|
60
|
-
|
|
66
|
+
userId: string;
|
|
67
|
+
srp?: {
|
|
68
|
+
serverSessionProof: string;
|
|
69
|
+
};
|
|
70
|
+
} | null);
|
|
61
71
|
};
|
|
62
72
|
export type CustomAuthenticationMethods<
|
|
63
73
|
T extends WabeTypes,
|
|
@@ -65,11 +75,11 @@ export type CustomAuthenticationMethods<
|
|
|
65
75
|
K = SchemaFields<T>,
|
|
66
76
|
W = SchemaFields<T>
|
|
67
77
|
> = {
|
|
68
|
-
name: string
|
|
69
|
-
input: K
|
|
70
|
-
dataToStore?: W
|
|
71
|
-
provider: U
|
|
72
|
-
isSecondaryFactor?: boolean
|
|
78
|
+
name: string;
|
|
79
|
+
input: K;
|
|
80
|
+
dataToStore?: W;
|
|
81
|
+
provider: U;
|
|
82
|
+
isSecondaryFactor?: boolean;
|
|
73
83
|
};
|
|
74
84
|
export type RoleConfig = Array<string>;
|
|
75
85
|
export interface SessionConfig {
|
|
@@ -100,6 +110,7 @@ export interface AuthenticationConfig<T extends WabeTypes> {
|
|
|
100
110
|
providers?: Partial<Record<ProviderEnum, ProviderConfig>>;
|
|
101
111
|
customAuthenticationMethods?: CustomAuthenticationMethods<T>[];
|
|
102
112
|
sessionHandler?: (context: WobeCustomContext<T>) => void | Promise<void>;
|
|
113
|
+
disableSignUp?: boolean;
|
|
103
114
|
}
|
|
104
115
|
export interface CreateTokenFromAuthorizationCodeOptions {
|
|
105
116
|
code: string;
|
|
@@ -115,8 +126,8 @@ export declare enum AuthenticationProvider {
|
|
|
115
126
|
GitHub = "github",
|
|
116
127
|
Google = "google",
|
|
117
128
|
EmailPassword = "emailPassword",
|
|
118
|
-
PhonePassword = "phonePassword"
|
|
129
|
+
PhonePassword = "phonePassword"
|
|
119
130
|
}
|
|
120
131
|
export declare enum SecondaryFactor {
|
|
121
|
-
EmailOTP = "emailOTP"
|
|
132
|
+
EmailOTP = "emailOTP"
|
|
122
133
|
}
|
|
@@ -5,7 +5,7 @@ export declare class GitHub implements OAuth2ProviderWithPKCE {
|
|
|
5
5
|
private clientSecret;
|
|
6
6
|
constructor(config: WabeConfig<any>);
|
|
7
7
|
createAuthorizationURL(state: string, codeVerifier: string, options?: {
|
|
8
|
-
scopes?: string[]
|
|
8
|
+
scopes?: string[];
|
|
9
9
|
}): URL;
|
|
10
10
|
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
11
11
|
refreshAccessToken(refreshToken: string): Promise<Tokens>;
|
|
@@ -5,7 +5,7 @@ export declare class Google implements OAuth2ProviderWithPKCE {
|
|
|
5
5
|
private clientSecret;
|
|
6
6
|
constructor(config: WabeConfig<any>);
|
|
7
7
|
createAuthorizationURL(state: string, codeVerifier: string, options?: {
|
|
8
|
-
scopes?: string[]
|
|
8
|
+
scopes?: string[];
|
|
9
9
|
}): URL;
|
|
10
10
|
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
11
11
|
refreshAccessToken(refreshToken: string): Promise<Tokens>;
|
|
@@ -12,22 +12,22 @@ export declare class OAuth2Client {
|
|
|
12
12
|
private redirectURI;
|
|
13
13
|
constructor(clientId: string, authorizeEndpoint: string, tokenEndpoint: string, redirectURI: string);
|
|
14
14
|
createAuthorizationURL(options?: {
|
|
15
|
-
state?: string
|
|
16
|
-
codeVerifier?: string
|
|
17
|
-
scopes?: string[]
|
|
15
|
+
state?: string;
|
|
16
|
+
codeVerifier?: string;
|
|
17
|
+
scopes?: string[];
|
|
18
18
|
}): URL;
|
|
19
19
|
validateAuthorizationCode<_TokenResponseBody extends TokenResponseBody>(authorizationCode: string, options?: {
|
|
20
|
-
codeVerifier?: string
|
|
21
|
-
credentials?: string
|
|
22
|
-
authenticateWith?: "http_basic_auth" | "request_body"
|
|
20
|
+
codeVerifier?: string;
|
|
21
|
+
credentials?: string;
|
|
22
|
+
authenticateWith?: "http_basic_auth" | "request_body";
|
|
23
23
|
}): Promise<_TokenResponseBody>;
|
|
24
24
|
refreshAccessToken<_TokenResponseBody extends TokenResponseBody>(refreshToken: string, options?: {
|
|
25
|
-
credentials?: string
|
|
26
|
-
authenticateWith?: "http_basic_auth" | "request_body"
|
|
27
|
-
scopes?: string[]
|
|
25
|
+
credentials?: string;
|
|
26
|
+
authenticateWith?: "http_basic_auth" | "request_body";
|
|
27
|
+
scopes?: string[];
|
|
28
28
|
}): Promise<_TokenResponseBody>;
|
|
29
29
|
_sendTokenRequest<_TokenResponseBody extends TokenResponseBody>(body: URLSearchParams, options?: {
|
|
30
|
-
credentials?: string
|
|
31
|
-
authenticateWith?: "http_basic_auth" | "request_body"
|
|
30
|
+
credentials?: string;
|
|
31
|
+
authenticateWith?: "http_basic_auth" | "request_body";
|
|
32
32
|
}): Promise<_TokenResponseBody>;
|
|
33
33
|
}
|
|
@@ -10,5 +10,6 @@ export interface OAuth2ProviderWithPKCE {
|
|
|
10
10
|
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
11
11
|
refreshAccessToken?(refreshToken: string): Promise<Tokens>;
|
|
12
12
|
}
|
|
13
|
+
// https://datatracker.ietf.org/doc/html/rfc7636#appendix-A
|
|
13
14
|
export declare const base64URLencode: unknown;
|
|
14
15
|
export declare const generateRandomValues: unknown;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
2
|
import type { OnSendChallengeOptions, OnVerifyChallengeOptions, SecondaryProviderInterface } from "../interface";
|
|
3
3
|
type EmailOTPInterface = {
|
|
4
|
-
email: string
|
|
5
|
-
otp: string
|
|
4
|
+
email: string;
|
|
5
|
+
otp: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class EmailOTP implements SecondaryProviderInterface<DevWabeTypes, EmailOTPInterface> {
|
|
8
8
|
onSendChallenge({ context, user }: OnSendChallengeOptions<DevWabeTypes>);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AuthenticationEventsOptions, AuthenticationEventsOptionsWithUserId, ProviderInterface } from "../interface";
|
|
2
2
|
import type { DevWabeTypes } from "../../utils/helper";
|
|
3
3
|
type EmailPasswordInterface = {
|
|
4
|
-
password: string
|
|
5
|
-
email: string
|
|
6
|
-
otp?: string
|
|
4
|
+
password: string;
|
|
5
|
+
email: string;
|
|
6
|
+
otp?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare class EmailPassword implements ProviderInterface<DevWabeTypes, EmailPasswordInterface> {
|
|
9
9
|
onSignIn({ input, context }: AuthenticationEventsOptions<DevWabeTypes, EmailPasswordInterface>);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AuthenticationEventsOptions, OnVerifyChallengeOptions, ProviderInterface, SecondaryProviderInterface } from "../interface";
|
|
2
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
3
|
+
type EmailPasswordSRPInterface = {
|
|
4
|
+
clientPublic: string;
|
|
5
|
+
email: string;
|
|
6
|
+
salt?: string;
|
|
7
|
+
verifier?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class EmailPasswordSRP implements ProviderInterface<DevWabeTypes, EmailPasswordSRPInterface> {
|
|
10
|
+
onSignIn({ input, context }: AuthenticationEventsOptions<DevWabeTypes, EmailPasswordSRPInterface>);
|
|
11
|
+
onSignUp({ input, context }: AuthenticationEventsOptions<DevWabeTypes, EmailPasswordSRPInterface>);
|
|
12
|
+
}
|
|
13
|
+
export interface EmailPasswordSRPChallengeInterface {
|
|
14
|
+
email: string;
|
|
15
|
+
clientPublic: string;
|
|
16
|
+
clientSessionProof: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class EmailPasswordSRPChallenge implements SecondaryProviderInterface<DevWabeTypes, EmailPasswordSRPChallengeInterface> {
|
|
19
|
+
onVerifyChallenge({ context, input }: OnVerifyChallengeOptions<DevWabeTypes, EmailPasswordSRPChallengeInterface>);
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
2
|
import { type AuthenticationEventsOptions, type ProviderInterface } from "../interface";
|
|
3
3
|
type GitHubInterface = {
|
|
4
|
-
authorizationCode: string
|
|
5
|
-
codeVerifier: string
|
|
4
|
+
authorizationCode: string;
|
|
5
|
+
codeVerifier: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class GitHub implements ProviderInterface<DevWabeTypes, GitHubInterface> {
|
|
8
8
|
name: string;
|
|
9
9
|
onSignIn(options: AuthenticationEventsOptions<DevWabeTypes, GitHubInterface>);
|
|
10
|
+
// @ts-expect-error
|
|
10
11
|
onSignUp();
|
|
11
12
|
}
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
2
|
import { type AuthenticationEventsOptions, type ProviderInterface } from "../interface";
|
|
3
3
|
type GoogleInterface = {
|
|
4
|
-
authorizationCode: string
|
|
5
|
-
codeVerifier: string
|
|
4
|
+
authorizationCode: string;
|
|
5
|
+
codeVerifier: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class Google implements ProviderInterface<DevWabeTypes, GoogleInterface> {
|
|
8
8
|
name: string;
|
|
9
9
|
onSignIn(options: AuthenticationEventsOptions<DevWabeTypes, GoogleInterface>);
|
|
10
|
+
// @ts-expect-error
|
|
10
11
|
onSignUp();
|
|
11
12
|
}
|
|
12
13
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AuthenticationEventsOptions, AuthenticationEventsOptionsWithUserId, ProviderInterface } from "../interface";
|
|
2
2
|
import type { DevWabeTypes } from "../../utils/helper";
|
|
3
3
|
type PhonePasswordInterface = {
|
|
4
|
-
password: string
|
|
5
|
-
phone: string
|
|
6
|
-
otp?: string
|
|
4
|
+
password: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
otp?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare class PhonePassword implements ProviderInterface<DevWabeTypes, PhonePasswordInterface> {
|
|
9
9
|
onSignIn({ input, context }: AuthenticationEventsOptions<DevWabeTypes, PhonePasswordInterface>);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DevWabeTypes } from "../../utils/helper";
|
|
2
|
+
import type { OnVerifyChallengeOptions, SecondaryProviderInterface } from "../interface";
|
|
3
|
+
type QRCodeOTPInterface = {
|
|
4
|
+
email: string;
|
|
5
|
+
otp: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class QRCodeOTP implements SecondaryProviderInterface<DevWabeTypes, QRCodeOTPInterface> {
|
|
8
|
+
onSendChallenge();
|
|
9
|
+
onVerifyChallenge({ context, input }: OnVerifyChallengeOptions<DevWabeTypes, QRCodeOTPInterface>);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
package/dist/cron/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { Cron } from "croner";
|
|
|
2
2
|
import type { Wabe, WabeTypes } from "../server";
|
|
3
3
|
export type OutputCron<T extends WabeTypes> = (wabe: Wabe<T>) => Cron;
|
|
4
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
|
|
5
|
+
pattern: string;
|
|
6
|
+
maxRuns?: number;
|
|
7
|
+
enabledProtectedRuns?: boolean;
|
|
8
|
+
run: (wabe: Wabe<T>) => any | Promise<any>;
|
|
9
9
|
}) => OutputCron<T>;
|
|
10
10
|
export declare enum CronExpressions {
|
|
11
11
|
EVERY_SECOND = "* * * * * *",
|
|
@@ -23,10 +23,10 @@ export declare enum CronExpressions {
|
|
|
23
23
|
EVERY_30_MINUTES = "0 */30 * * * *",
|
|
24
24
|
EVERY_2_HOURS = "0 0 */2 * * *",
|
|
25
25
|
EVERY_6_HOURS = "0 0 */6 * * *",
|
|
26
|
-
EVERY_12_HOURS = "0 0 */12 * * *"
|
|
26
|
+
EVERY_12_HOURS = "0 0 */12 * * *"
|
|
27
27
|
}
|
|
28
28
|
export type CronConfig<T extends WabeTypes> = Array<{
|
|
29
|
-
name: string
|
|
30
|
-
cron: OutputCron<T
|
|
31
|
-
job?: Cron
|
|
29
|
+
name: string;
|
|
30
|
+
cron: OutputCron<T>;
|
|
31
|
+
job?: Cron;
|
|
32
32
|
}>;
|
|
@@ -1,49 +1,51 @@
|
|
|
1
1
|
import type { WabeTypes } from "../..";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { SchemaInterface } from "../schema";
|
|
3
|
+
import type { WabeContext } from "../server/interface";
|
|
4
|
+
import type { CountOptions, CreateObjectOptions, CreateObjectsOptions, DatabaseAdapter, DeleteObjectOptions, DeleteObjectsOptions, GetObjectOptions, GetObjectsOptions, OutputType, UpdateObjectOptions, UpdateObjectsOptions, WhereType } from "./interface";
|
|
4
5
|
export type Select = Record<string, boolean>;
|
|
5
6
|
type SelectWithObject = Record<string, object | boolean>;
|
|
6
7
|
export declare class DatabaseController<T extends WabeTypes> {
|
|
7
8
|
adapter: DatabaseAdapter<T>;
|
|
8
9
|
constructor(adapter: DatabaseAdapter<T>);
|
|
9
10
|
_getSelectMinusPointersAndRelations({ className, context, select }: {
|
|
10
|
-
className: keyof T["types"]
|
|
11
|
-
context: WabeContext<T
|
|
12
|
-
select?: SelectWithObject
|
|
11
|
+
className: keyof T["types"];
|
|
12
|
+
context: WabeContext<T>;
|
|
13
|
+
select?: SelectWithObject;
|
|
13
14
|
}): {
|
|
15
|
+
// We associated the fieldName with a className and a select object
|
|
14
16
|
pointers: Record<string, {
|
|
15
|
-
className: string
|
|
16
|
-
select: Select
|
|
17
|
-
}
|
|
18
|
-
selectWithoutPointers: Select
|
|
17
|
+
className: string;
|
|
18
|
+
select: Select;
|
|
19
|
+
}>;
|
|
20
|
+
selectWithoutPointers: Select;
|
|
19
21
|
};
|
|
20
22
|
_isRelationField({ pointerField, currentClassName, context, originClassName }: {
|
|
21
|
-
pointerField: string
|
|
22
|
-
originClassName: string
|
|
23
|
-
context: WabeContext<T
|
|
24
|
-
currentClassName?: string
|
|
23
|
+
pointerField: string;
|
|
24
|
+
originClassName: string;
|
|
25
|
+
context: WabeContext<T>;
|
|
26
|
+
currentClassName?: string;
|
|
25
27
|
});
|
|
26
28
|
_isPointerField({ pointerField, currentClassName, context, originClassName }: {
|
|
27
|
-
originClassName: string
|
|
28
|
-
context: WabeContext<T
|
|
29
|
-
pointerField: string
|
|
30
|
-
currentClassName?: string
|
|
29
|
+
originClassName: string;
|
|
30
|
+
context: WabeContext<T>;
|
|
31
|
+
pointerField: string;
|
|
32
|
+
currentClassName?: string;
|
|
31
33
|
});
|
|
32
34
|
_getWhereObjectWithPointerOrRelation<U extends keyof T["types"]>(className: U, where: WhereType<T, U>, context: WabeContext<T>);
|
|
33
35
|
_buildWhereWithACL<K extends keyof T["types"]>(where: WhereType<T, K>, context: WabeContext<T>, operation: "write" | "read"): WhereType<T, K>;
|
|
34
36
|
_getFinalObjectWithPointerAndRelation({ pointers, context, originClassName, object, isGraphQLCall }: {
|
|
35
|
-
originClassName: string
|
|
37
|
+
originClassName: string;
|
|
36
38
|
pointers: Record<string, {
|
|
37
|
-
className: string
|
|
38
|
-
select: Select
|
|
39
|
-
}
|
|
40
|
-
context: WabeContext<any
|
|
41
|
-
object: Record<string, any
|
|
42
|
-
isGraphQLCall?: boolean
|
|
39
|
+
className: string;
|
|
40
|
+
select: Select;
|
|
41
|
+
}>;
|
|
42
|
+
context: WabeContext<any>;
|
|
43
|
+
object: Record<string, any>;
|
|
44
|
+
isGraphQLCall?: boolean;
|
|
43
45
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
close();
|
|
47
|
+
createClassIfNotExist(className: string, schema: SchemaInterface<T>): Promise<any>;
|
|
48
|
+
initializeDatabase(schema: SchemaInterface<T>): Promise<void>;
|
|
47
49
|
count<K extends keyof T["types"]>({ className, context, where }: CountOptions<T, K>): Promise<number>;
|
|
48
50
|
clearDatabase(): Promise<void>;
|
|
49
51
|
getObject<
|
package/dist/database/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { WabeTypes } from "../server";
|
|
2
|
+
import type { DatabaseAdapter } from "./interface";
|
|
3
|
+
export interface DatabaseConfig<T extends WabeTypes> {
|
|
4
|
+
adapter: DatabaseAdapter<T>;
|
|
3
5
|
}
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
url: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
export * from "./adapters";
|
|
10
|
-
export * from "./controllers";
|
|
6
|
+
export * from "./DatabaseController";
|
|
7
|
+
export * from "./interface";
|