wabe 0.6.6 → 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 +40 -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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { WabeContext } from "
|
|
2
|
-
import type { WabeTypes } from "
|
|
1
|
+
import type { WabeContext } from "../server/interface";
|
|
2
|
+
import type { WabeTypes } from "../server";
|
|
3
|
+
import type { SchemaInterface } from "../schema";
|
|
3
4
|
type IsScalar<T> = T extends string | number | boolean | Date ? true : false;
|
|
4
5
|
type IsArray<T> = T extends Array<any> ? true : false;
|
|
5
6
|
type IsObject<
|
|
@@ -17,16 +18,16 @@ type ExtractWhereType<
|
|
|
17
18
|
FieldName extends keyof T["where"][ClassName]
|
|
18
19
|
> = T["where"][ClassName][FieldName];
|
|
19
20
|
type WhereScalar<T> = {
|
|
20
|
-
equalTo?: T
|
|
21
|
-
notEqualTo?: T
|
|
22
|
-
greaterThan?: T
|
|
23
|
-
lessThan?: T
|
|
24
|
-
greaterThanOrEqualTo?: T
|
|
25
|
-
lessThanOrEqualTo?: T
|
|
26
|
-
in?: T[]
|
|
27
|
-
notIn?: T[]
|
|
28
|
-
contains?: T
|
|
29
|
-
notContains?: T
|
|
21
|
+
equalTo?: T;
|
|
22
|
+
notEqualTo?: T;
|
|
23
|
+
greaterThan?: T;
|
|
24
|
+
lessThan?: T;
|
|
25
|
+
greaterThanOrEqualTo?: T;
|
|
26
|
+
lessThanOrEqualTo?: T;
|
|
27
|
+
in?: T[];
|
|
28
|
+
notIn?: T[];
|
|
29
|
+
contains?: T;
|
|
30
|
+
notContains?: T;
|
|
30
31
|
};
|
|
31
32
|
type WhereObject<T> = { [P in keyof T] : IsScalar<T[P]> extends false ? WhereObject<Partial<T[P]>> : WhereScalar<T[P]> };
|
|
32
33
|
type WhereAggregation<
|
|
@@ -37,8 +38,8 @@ type WhereConditional<
|
|
|
37
38
|
T extends WabeTypes,
|
|
38
39
|
K = keyof T["where"]
|
|
39
40
|
> = {
|
|
40
|
-
OR?: Array<WhereType<T, K
|
|
41
|
-
AND?: Array<WhereType<T, K
|
|
41
|
+
OR?: Array<WhereType<T, K>>;
|
|
42
|
+
AND?: Array<WhereType<T, K>>;
|
|
42
43
|
};
|
|
43
44
|
export type WhereType<
|
|
44
45
|
T extends WabeTypes,
|
|
@@ -66,7 +67,7 @@ export type OutputType<
|
|
|
66
67
|
K extends keyof T["types"],
|
|
67
68
|
U extends keyof T["types"][K]
|
|
68
69
|
> = (Pick<T["types"][K], U> & {
|
|
69
|
-
id: string
|
|
70
|
+
id: string;
|
|
70
71
|
}) | null;
|
|
71
72
|
export interface AdapterOptions {
|
|
72
73
|
databaseUrl: string;
|
|
@@ -83,7 +84,7 @@ export interface CountOptions<
|
|
|
83
84
|
> {
|
|
84
85
|
className: K;
|
|
85
86
|
where?: WhereType<T, K>;
|
|
86
|
-
context: WabeContext<
|
|
87
|
+
context: WabeContext<T>;
|
|
87
88
|
}
|
|
88
89
|
export interface GetObjectOptions<
|
|
89
90
|
T extends WabeTypes,
|
|
@@ -93,7 +94,7 @@ export interface GetObjectOptions<
|
|
|
93
94
|
className: K;
|
|
94
95
|
id: string;
|
|
95
96
|
where?: WhereType<T, K>;
|
|
96
|
-
context: WabeContext<
|
|
97
|
+
context: WabeContext<T>;
|
|
97
98
|
skipHooks?: boolean;
|
|
98
99
|
select?: SelectType<T, K, U>;
|
|
99
100
|
isGraphQLCall?: boolean;
|
|
@@ -109,7 +110,7 @@ export interface GetObjectsOptions<
|
|
|
109
110
|
order?: OrderType<T, K, U>;
|
|
110
111
|
offset?: number;
|
|
111
112
|
first?: number;
|
|
112
|
-
context: WabeContext<
|
|
113
|
+
context: WabeContext<T>;
|
|
113
114
|
skipHooks?: boolean;
|
|
114
115
|
select?: SelectType<T, K, W>;
|
|
115
116
|
isGraphQLCall?: boolean;
|
|
@@ -122,7 +123,7 @@ export interface CreateObjectOptions<
|
|
|
122
123
|
> {
|
|
123
124
|
className: K;
|
|
124
125
|
data: MutationData<T, K, U>;
|
|
125
|
-
context: WabeContext<
|
|
126
|
+
context: WabeContext<T>;
|
|
126
127
|
select?: SelectType<T, K, W>;
|
|
127
128
|
isGraphQLCall?: boolean;
|
|
128
129
|
}
|
|
@@ -138,7 +139,7 @@ export interface CreateObjectsOptions<
|
|
|
138
139
|
offset?: number;
|
|
139
140
|
first?: number;
|
|
140
141
|
order?: OrderType<T, U, X>;
|
|
141
|
-
context: WabeContext<
|
|
142
|
+
context: WabeContext<T>;
|
|
142
143
|
select?: SelectType<T, K, W>;
|
|
143
144
|
isGraphQLCall?: boolean;
|
|
144
145
|
}
|
|
@@ -152,7 +153,7 @@ export interface UpdateObjectOptions<
|
|
|
152
153
|
id: string;
|
|
153
154
|
where?: WhereType<T, K>;
|
|
154
155
|
data: MutationData<T, K, U>;
|
|
155
|
-
context: WabeContext<
|
|
156
|
+
context: WabeContext<T>;
|
|
156
157
|
skipHooks?: boolean;
|
|
157
158
|
select?: SelectType<T, K, W>;
|
|
158
159
|
isGraphQLCall?: boolean;
|
|
@@ -170,7 +171,7 @@ export interface UpdateObjectsOptions<
|
|
|
170
171
|
data: MutationData<T, K, U>;
|
|
171
172
|
offset?: number;
|
|
172
173
|
first?: number;
|
|
173
|
-
context: WabeContext<
|
|
174
|
+
context: WabeContext<T>;
|
|
174
175
|
skipHooks?: boolean;
|
|
175
176
|
select?: SelectType<T, K, W>;
|
|
176
177
|
isGraphQLCall?: boolean;
|
|
@@ -183,7 +184,7 @@ export interface DeleteObjectOptions<
|
|
|
183
184
|
className: K;
|
|
184
185
|
id: string;
|
|
185
186
|
where?: WhereType<T, K>;
|
|
186
|
-
context: WabeContext<
|
|
187
|
+
context: WabeContext<T>;
|
|
187
188
|
select?: SelectType<T, K, U>;
|
|
188
189
|
isGraphQLCall?: boolean;
|
|
189
190
|
}
|
|
@@ -198,19 +199,16 @@ export interface DeleteObjectsOptions<
|
|
|
198
199
|
order?: OrderType<T, K, U>;
|
|
199
200
|
offset?: number;
|
|
200
201
|
first?: number;
|
|
201
|
-
context: WabeContext<
|
|
202
|
+
context: WabeContext<T>;
|
|
202
203
|
select?: SelectType<T, K, W>;
|
|
203
204
|
isGraphQLCall?: boolean;
|
|
204
205
|
}
|
|
205
206
|
export interface DatabaseAdapter<T extends WabeTypes> {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
close(): Promise<void>;
|
|
208
|
+
createClassIfNotExist(className: string, schema: SchemaInterface<T>): Promise<any>;
|
|
209
|
+
initializeDatabase(schema: SchemaInterface<T>): Promise<void>;
|
|
209
210
|
clearDatabase(): Promise<void>;
|
|
210
|
-
count<
|
|
211
|
-
T extends WabeTypes,
|
|
212
|
-
K extends keyof T["types"]
|
|
213
|
-
>(params: CountOptions<T, K>): Promise<number>;
|
|
211
|
+
count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
|
|
214
212
|
getObject<
|
|
215
213
|
K extends keyof T["types"],
|
|
216
214
|
U extends keyof T["types"][K]
|
|
@@ -225,7 +223,7 @@ export interface DatabaseAdapter<T extends WabeTypes> {
|
|
|
225
223
|
U extends keyof T["types"][K],
|
|
226
224
|
W extends keyof T["types"][K]
|
|
227
225
|
>(params: CreateObjectOptions<T, K, U, W>): Promise<{
|
|
228
|
-
id: string
|
|
226
|
+
id: string;
|
|
229
227
|
}>;
|
|
230
228
|
createObjects<
|
|
231
229
|
K extends keyof T["types"],
|
|
@@ -233,14 +231,14 @@ export interface DatabaseAdapter<T extends WabeTypes> {
|
|
|
233
231
|
W extends keyof T["types"][K],
|
|
234
232
|
X extends keyof T["types"][K]
|
|
235
233
|
>(params: CreateObjectsOptions<T, K, U, W, X>): Promise<Array<{
|
|
236
|
-
id: string
|
|
234
|
+
id: string;
|
|
237
235
|
}>>;
|
|
238
236
|
updateObject<
|
|
239
237
|
K extends keyof T["types"],
|
|
240
238
|
U extends keyof T["types"][K],
|
|
241
239
|
W extends keyof T["types"][K]
|
|
242
240
|
>(params: UpdateObjectOptions<T, K, U, W>): Promise<{
|
|
243
|
-
id: string
|
|
241
|
+
id: string;
|
|
244
242
|
}>;
|
|
245
243
|
updateObjects<
|
|
246
244
|
K extends keyof T["types"],
|
|
@@ -248,7 +246,7 @@ export interface DatabaseAdapter<T extends WabeTypes> {
|
|
|
248
246
|
W extends keyof T["types"][K],
|
|
249
247
|
X extends keyof T["types"][K]
|
|
250
248
|
>(params: UpdateObjectsOptions<T, K, U, W, X>): Promise<Array<{
|
|
251
|
-
id: string
|
|
249
|
+
id: string;
|
|
252
250
|
}>>;
|
|
253
251
|
deleteObject<
|
|
254
252
|
K extends keyof T["types"],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export type HtmlTemplates = {
|
|
2
2
|
sendOTPCode: {
|
|
3
3
|
fn: (options: {
|
|
4
|
-
otp: string
|
|
5
|
-
}) => string | Promise<string
|
|
6
|
-
subject: string
|
|
7
|
-
}
|
|
4
|
+
otp: string;
|
|
5
|
+
}) => string | Promise<string>;
|
|
6
|
+
subject: string;
|
|
7
|
+
};
|
|
8
8
|
};
|
|
9
9
|
export interface EmailSendOptions {
|
|
10
10
|
from: string;
|
|
@@ -4,7 +4,7 @@ export declare class FileController implements FileAdapter {
|
|
|
4
4
|
adapter: FileAdapter;
|
|
5
5
|
private wabe;
|
|
6
6
|
constructor(adapter: FileAdapter, wabe: Wabe<any>);
|
|
7
|
-
uploadFile(file: File
|
|
7
|
+
uploadFile(file: File);
|
|
8
8
|
readFile(fileName: string, options?: ReadFileOptions);
|
|
9
9
|
deleteFile(fileName: string);
|
|
10
10
|
}
|
|
@@ -2,7 +2,7 @@ import type { FileAdapter, ReadFileOptions } from ".";
|
|
|
2
2
|
export declare class FileDevAdapter implements FileAdapter {
|
|
3
3
|
private basePath;
|
|
4
4
|
private rootPath;
|
|
5
|
-
uploadFile(file: File
|
|
5
|
+
uploadFile(file: File): Promise<void>;
|
|
6
6
|
readFile(fileName: string, options?: ReadFileOptions): Promise<string | null>;
|
|
7
7
|
deleteFile(fileName: string): Promise<void>;
|
|
8
8
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import type { WabeContext, WabeTypes } from "src/server";
|
|
1
2
|
/**
|
|
2
3
|
* The file config contains the adapter to use to upload file
|
|
3
4
|
* @param adapter: FileAdapter
|
|
4
5
|
* @param urlCacheInSeconds: number Number of seconds to cache the url, equal to the number of seconds the url will be valid
|
|
5
6
|
* @param devDirectory: string The directory where the files will be uploaded
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
+
export type FileConfig<T extends WabeTypes> = {
|
|
8
9
|
adapter: FileAdapter;
|
|
9
10
|
urlCacheInSeconds?: number;
|
|
10
11
|
devDirectory?: string;
|
|
11
|
-
|
|
12
|
+
beforeUpload?: (file: File, context: WabeContext<T>) => Promise<File> | File;
|
|
13
|
+
};
|
|
12
14
|
export interface ReadFileOptions {
|
|
13
15
|
urlExpiresIn?: number;
|
|
14
16
|
port?: number;
|
|
@@ -18,7 +20,7 @@ export interface FileAdapter {
|
|
|
18
20
|
* Upload a file and returns the url of the file
|
|
19
21
|
* @param file: File
|
|
20
22
|
*/
|
|
21
|
-
uploadFile(file: File
|
|
23
|
+
uploadFile(file: File): Promise<void>;
|
|
22
24
|
/**
|
|
23
25
|
* Read a file and returns the url of the file
|
|
24
26
|
* @param fileName: string
|
|
@@ -26,5 +28,9 @@ export interface FileAdapter {
|
|
|
26
28
|
* @returns The url of file or null if the file doesn't exist
|
|
27
29
|
*/
|
|
28
30
|
readFile(fileName: string, options?: ReadFileOptions): Promise<string | null> | string | null;
|
|
31
|
+
/*+
|
|
32
|
+
* Delete a file
|
|
33
|
+
* @param fileName: string
|
|
34
|
+
*/
|
|
29
35
|
deleteFile(fileName: string): Promise<void>;
|
|
30
36
|
}
|
|
@@ -14,62 +14,62 @@ export declare class GraphQLSchema {
|
|
|
14
14
|
createOrderEnumType(wabeClass: ClassInterface<DevWabeTypes>);
|
|
15
15
|
createEnums();
|
|
16
16
|
createObject({ wabeClass, graphqlParser }: {
|
|
17
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
18
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
17
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
18
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
19
19
|
});
|
|
20
20
|
createPointerInputObject({ wabeClass, inputCreateFields }: {
|
|
21
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
22
|
-
inputCreateFields: GraphQLInputObjectType
|
|
21
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
22
|
+
inputCreateFields: GraphQLInputObjectType;
|
|
23
23
|
});
|
|
24
24
|
createRelationInputObject({ wabeClass, inputCreateFields }: {
|
|
25
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
26
|
-
inputCreateFields: GraphQLInputObjectType
|
|
25
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
26
|
+
inputCreateFields: GraphQLInputObjectType;
|
|
27
27
|
});
|
|
28
28
|
createInputObject({ wabeClass, graphqlParser }: {
|
|
29
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
30
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
29
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
30
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
31
31
|
});
|
|
32
32
|
createCreateInputObject({ wabeClass, graphqlParser }: {
|
|
33
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
34
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
33
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
34
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
35
35
|
});
|
|
36
36
|
createUpdateInputObject({ wabeClass, graphqlParser }: {
|
|
37
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
38
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
37
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
38
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
39
39
|
});
|
|
40
40
|
createWhereInputObject({ wabeClass, graphqlParser }: {
|
|
41
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
42
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
41
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
42
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
43
43
|
});
|
|
44
44
|
createConnectionObject({ object, wabeClass }: {
|
|
45
|
-
object: GraphQLObjectType
|
|
46
|
-
wabeClass: ClassInterface<DevWabeTypes
|
|
45
|
+
object: GraphQLObjectType;
|
|
46
|
+
wabeClass: ClassInterface<DevWabeTypes>;
|
|
47
47
|
});
|
|
48
48
|
createCompleteObject(graphqlParser: GraphqlParserFactory<DevWabeTypes>, wabeClass: ClassInterface<DevWabeTypes>);
|
|
49
49
|
_getGraphQLOutputType(currentQueryOrMutation: QueryResolver<DevWabeTypes> | MutationResolver<DevWabeTypes>, graphqlParser: GraphqlParserFactory<DevWabeTypes>, currentArgs: SchemaFields<DevWabeTypes>): GraphQLOutputType | undefined;
|
|
50
50
|
createCustomMutations({ resolvers, graphqlParser }: {
|
|
51
|
-
resolvers: Record<string, MutationResolver<DevWabeTypes
|
|
52
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
51
|
+
resolvers: Record<string, MutationResolver<DevWabeTypes>>;
|
|
52
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
53
53
|
});
|
|
54
54
|
createCustomQueries({ resolvers, graphqlParser }: {
|
|
55
|
-
resolvers: Record<string, QueryResolver<DevWabeTypes
|
|
56
|
-
graphqlParser: GraphqlParserFactory<DevWabeTypes
|
|
55
|
+
resolvers: Record<string, QueryResolver<DevWabeTypes>>;
|
|
56
|
+
graphqlParser: GraphqlParserFactory<DevWabeTypes>;
|
|
57
57
|
});
|
|
58
58
|
createDefaultQueries({ className, whereInputType, object, connectionObject, orderEnumType }: {
|
|
59
|
-
className: string
|
|
60
|
-
whereInputType: GraphQLInputObjectType
|
|
61
|
-
object: GraphQLObjectType
|
|
62
|
-
connectionObject: GraphQLObjectType
|
|
63
|
-
orderEnumType: GraphQLEnumType
|
|
59
|
+
className: string;
|
|
60
|
+
whereInputType: GraphQLInputObjectType;
|
|
61
|
+
object: GraphQLObjectType;
|
|
62
|
+
connectionObject: GraphQLObjectType;
|
|
63
|
+
orderEnumType: GraphQLEnumType;
|
|
64
64
|
}): Record<string, GraphQLFieldConfig<any, any, any>>;
|
|
65
65
|
createDefaultMutations({ className, object, defaultUpdateInputType, defaultCreateInputType, whereInputType, connectionObject, orderEnumType }: {
|
|
66
|
-
className: string
|
|
67
|
-
defaultUpdateInputType: GraphQLInputObjectType
|
|
68
|
-
defaultCreateInputType: GraphQLInputObjectType
|
|
69
|
-
whereInputType: GraphQLInputObjectType
|
|
70
|
-
object: GraphQLObjectType
|
|
71
|
-
connectionObject: GraphQLObjectType
|
|
72
|
-
orderEnumType: GraphQLEnumType
|
|
66
|
+
className: string;
|
|
67
|
+
defaultUpdateInputType: GraphQLInputObjectType;
|
|
68
|
+
defaultCreateInputType: GraphQLInputObjectType;
|
|
69
|
+
whereInputType: GraphQLInputObjectType;
|
|
70
|
+
object: GraphQLObjectType;
|
|
71
|
+
connectionObject: GraphQLObjectType;
|
|
72
|
+
orderEnumType: GraphQLEnumType;
|
|
73
73
|
}): Record<string, GraphQLFieldConfig<any, any, any>>;
|
|
74
74
|
}
|
|
75
75
|
export {};
|
package/dist/graphql/parser.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import type { WabeTypes } from "../server";
|
|
|
5
5
|
import type { DevWabeTypes } from "../utils/helper";
|
|
6
6
|
type GraphqlObjectType = "Object" | "InputObject" | "CreateFieldsInput" | "UpdateFieldsInput" | "WhereInputObject";
|
|
7
7
|
type ParseObjectOptions = {
|
|
8
|
-
required?: boolean
|
|
9
|
-
description?: string
|
|
10
|
-
objectToParse: ClassInterface<any
|
|
11
|
-
nameOfTheObject: string
|
|
8
|
+
required?: boolean;
|
|
9
|
+
description?: string;
|
|
10
|
+
objectToParse: ClassInterface<any>;
|
|
11
|
+
nameOfTheObject: string;
|
|
12
12
|
};
|
|
13
13
|
export declare const templateScalarType: Record<WabePrimaryTypes, GraphQLScalarType>;
|
|
14
14
|
export declare const templateWhereInput: Record<WabePrimaryTypes | "Array", GraphQLInputObjectType>;
|
|
@@ -22,16 +22,16 @@ interface GraphqlParserConstructorOptions {
|
|
|
22
22
|
enums: GraphQLEnumType[];
|
|
23
23
|
}
|
|
24
24
|
export type GraphqlParserFactory<T extends WabeTypes> = (options: GraphqlParserFactoryOptions) => {
|
|
25
|
-
_parseWabeObject(options: ParseObjectOptions): any
|
|
26
|
-
_parseWabeWhereInputObject(options: ParseObjectOptions): any
|
|
27
|
-
_parseWabeInputObject(options: ParseObjectOptions): any
|
|
28
|
-
_parseWabeUpdateInputObject(options: ParseObjectOptions): any
|
|
25
|
+
_parseWabeObject(options: ParseObjectOptions): any;
|
|
26
|
+
_parseWabeWhereInputObject(options: ParseObjectOptions): any;
|
|
27
|
+
_parseWabeInputObject(options: ParseObjectOptions): any;
|
|
28
|
+
_parseWabeUpdateInputObject(options: ParseObjectOptions): any;
|
|
29
29
|
getGraphqlType(options: {
|
|
30
|
-
type: WabePrimaryTypes | "Array" | T["enums"] | T["scalars"]
|
|
31
|
-
typeValue?: WabePrimaryTypes
|
|
32
|
-
isWhereType?: boolean
|
|
33
|
-
}): any
|
|
34
|
-
getGraphqlFields(nameOfTheObject: string): any
|
|
30
|
+
type: WabePrimaryTypes | "Array" | T["enums"] | T["scalars"];
|
|
31
|
+
typeValue?: WabePrimaryTypes;
|
|
32
|
+
isWhereType?: boolean;
|
|
33
|
+
}): any;
|
|
34
|
+
getGraphqlFields(nameOfTheObject: string): any;
|
|
35
35
|
};
|
|
36
36
|
export type GraphqlParserConstructor = <T extends WabeTypes>(options: GraphqlParserConstructorOptions) => GraphqlParserFactory<T>;
|
|
37
37
|
export declare const GraphqlParser: GraphqlParserConstructor;
|
|
@@ -6,12 +6,12 @@ type Remove = Array<string>;
|
|
|
6
6
|
type CreateAndAdd = Array<any>;
|
|
7
7
|
export type TypeOfExecution = "create" | "update" | "updateMany";
|
|
8
8
|
export type InputFields = Record<string, {
|
|
9
|
-
createAndLink?: CreateAndLink
|
|
10
|
-
link?: Link
|
|
11
|
-
unlink?: Unlink
|
|
12
|
-
add?: Add
|
|
13
|
-
remove?: Remove
|
|
14
|
-
createAndAdd?: CreateAndAdd
|
|
9
|
+
createAndLink?: CreateAndLink;
|
|
10
|
+
link?: Link;
|
|
11
|
+
unlink?: Unlink;
|
|
12
|
+
add?: Add;
|
|
13
|
+
remove?: Remove;
|
|
14
|
+
createAndAdd?: CreateAndAdd;
|
|
15
15
|
} | string>;
|
|
16
16
|
export declare const createAndLink: unknown;
|
|
17
17
|
export declare const createAndAdd: unknown;
|
|
@@ -2,12 +2,12 @@ import type { SelectionSetNode } from "graphql";
|
|
|
2
2
|
import type { WabeContext } from "../server/interface";
|
|
3
3
|
export declare const extractFieldsFromSetNode: (selectionSet: SelectionSetNode, className: string) => Record<string, any>;
|
|
4
4
|
export declare const getFieldsOfClassName: ({ fields, className, context }: {
|
|
5
|
-
fields: string[]
|
|
6
|
-
className: string
|
|
7
|
-
context: WabeContext<any
|
|
5
|
+
fields: string[];
|
|
6
|
+
className: string;
|
|
7
|
+
context: WabeContext<any>;
|
|
8
8
|
}) => {
|
|
9
|
-
classFields: string[]
|
|
10
|
-
othersFields: string[]
|
|
9
|
+
classFields: string[];
|
|
10
|
+
othersFields: string[];
|
|
11
11
|
};
|
|
12
12
|
export declare const executeRelationOnFields: unknown;
|
|
13
13
|
export declare const queryForOneObject: unknown;
|
|
@@ -4,10 +4,10 @@ import type { MutationData, OutputType, Select } from "../database";
|
|
|
4
4
|
import type { WabeTypes } from "../server";
|
|
5
5
|
import type { WabeContext } from "../server/interface";
|
|
6
6
|
type AddACLOpptions = {
|
|
7
|
-
userId?: string
|
|
8
|
-
role?: RoleEnum
|
|
9
|
-
read: boolean
|
|
10
|
-
write: boolean
|
|
7
|
+
userId?: string;
|
|
8
|
+
role?: RoleEnum;
|
|
9
|
+
read: boolean;
|
|
10
|
+
write: boolean;
|
|
11
11
|
} | null;
|
|
12
12
|
export declare class HookObject<
|
|
13
13
|
T extends WabeTypes,
|
|
@@ -15,19 +15,20 @@ export declare class HookObject<
|
|
|
15
15
|
> {
|
|
16
16
|
className: K;
|
|
17
17
|
private newData;
|
|
18
|
-
|
|
18
|
+
operationType: OperationType;
|
|
19
19
|
context: WabeContext<T>;
|
|
20
20
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
21
|
+
// Object before any mutation, for example before delete
|
|
21
22
|
originalObject: OutputType<T, K, keyof T["types"][K]> | undefined;
|
|
22
23
|
select: Select;
|
|
23
24
|
constructor({ newData, className, operationType, context, object, originalObject, select }: {
|
|
24
|
-
className: K
|
|
25
|
-
newData?: MutationData<T, K, keyof T["types"][K]
|
|
26
|
-
operationType: OperationType
|
|
27
|
-
context: WabeContext<T
|
|
28
|
-
object: OutputType<T, K, keyof T["types"][K]
|
|
29
|
-
originalObject?: OutputType<T, K, keyof T["types"][K]
|
|
30
|
-
select: Select
|
|
25
|
+
className: K;
|
|
26
|
+
newData?: MutationData<T, K, keyof T["types"][K]>;
|
|
27
|
+
operationType: OperationType;
|
|
28
|
+
context: WabeContext<T>;
|
|
29
|
+
object: OutputType<T, K, keyof T["types"][K]>;
|
|
30
|
+
originalObject?: OutputType<T, K, keyof T["types"][K]>;
|
|
31
|
+
select: Select;
|
|
31
32
|
});
|
|
32
33
|
getUser();
|
|
33
34
|
isFieldUpdated(field: keyof T["types"][K]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultBeforeCreateUser: unknown;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -11,31 +11,35 @@ export declare enum OperationType {
|
|
|
11
11
|
BeforeCreate = "beforeCreate",
|
|
12
12
|
BeforeUpdate = "beforeUpdate",
|
|
13
13
|
BeforeDelete = "beforeDelete",
|
|
14
|
-
BeforeRead = "beforeRead"
|
|
14
|
+
BeforeRead = "beforeRead"
|
|
15
15
|
}
|
|
16
16
|
export type Hook<
|
|
17
17
|
T extends WabeTypes,
|
|
18
18
|
K extends keyof WabeTypes["types"]
|
|
19
19
|
> = {
|
|
20
|
-
operationType: OperationType
|
|
21
|
-
className
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
operationType: OperationType;
|
|
21
|
+
// If the className is undefined the hook is called on each class
|
|
22
|
+
className?: K;
|
|
23
|
+
// The priority of the hook. The lower the number the earlier the hook is called
|
|
24
|
+
// The priority 0 is for the security hooks
|
|
25
|
+
// The default priority is 1
|
|
26
|
+
priority: number;
|
|
27
|
+
callback: (hookObject: HookObject<T, K>) => Promise<void> | void;
|
|
24
28
|
};
|
|
25
29
|
export declare const _findHooksByPriority: unknown;
|
|
26
30
|
export declare const initializeHook: <
|
|
27
31
|
T extends WabeTypes,
|
|
28
32
|
K extends keyof T["types"]
|
|
29
33
|
>({ className, newData, context, select }: {
|
|
30
|
-
className: K
|
|
31
|
-
newData?: MutationData<DevWabeTypes, any, any
|
|
32
|
-
select: Select
|
|
33
|
-
context: WabeContext<any
|
|
34
|
+
className: K;
|
|
35
|
+
newData?: MutationData<DevWabeTypes, any, any>;
|
|
36
|
+
select: Select;
|
|
37
|
+
context: WabeContext<any>;
|
|
34
38
|
}) => {
|
|
35
39
|
runOnSingleObject: (options: {
|
|
36
|
-
operationType: OperationType
|
|
37
|
-
id?: string
|
|
38
|
-
originalObject?: OutputType<DevWabeTypes, any, any
|
|
39
|
-
}) => Promise<MutationData<T, K, any
|
|
40
|
+
operationType: OperationType;
|
|
41
|
+
id?: string;
|
|
42
|
+
originalObject?: OutputType<DevWabeTypes, any, any>;
|
|
43
|
+
}) => Promise<MutationData<T, K, any>>;
|
|
40
44
|
};
|
|
41
45
|
export declare const getDefaultHooks: () => Hook<any, any>[];
|
package/dist/hooks/setEmail.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ export * from "./hooks";
|
|
|
3
3
|
export * from "./schema";
|
|
4
4
|
export * from "./database";
|
|
5
5
|
export * from "./authentication";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./file";
|
|
7
7
|
export * from "./email";
|
|
8
|
-
export * from "./payment";
|
|
9
8
|
export * from "./ai";
|
|
10
9
|
export * from "./utils/export";
|
|
11
10
|
export * from "./cron";
|