wabe 0.6.7 → 0.6.9
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 +10 -7
- package/dist/authentication/OTP.d.ts +8 -0
- package/dist/authentication/Session.d.ts +5 -5
- package/dist/authentication/index.d.ts +1 -0
- package/dist/authentication/interface.d.ts +43 -26
- 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/authentication/utils.d.ts +0 -1
- package/dist/cron/index.d.ts +8 -8
- package/dist/database/{controllers/DatabaseController.d.ts → DatabaseController.d.ts} +38 -36
- package/dist/database/index.d.ts +6 -9
- package/dist/database/{adapters/adaptersInterface.d.ts → interface.d.ts} +37 -47
- 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 +51013 -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/interface.d.ts +1 -0
- package/dist/server/routes/authHandler.d.ts +11 -0
- package/dist/utils/crypto.d.ts +11 -0
- package/dist/utils/export.d.ts +2 -0
- package/dist/utils/helper.d.ts +3 -6
- package/dist/utils/index.d.ts +20 -2
- package/generated/schema.graphql +87 -76
- package/generated/wabe.ts +49 -52
- package/package.json +52 -54
- 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/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,10 +94,9 @@ export interface GetObjectOptions<
|
|
|
93
94
|
className: K;
|
|
94
95
|
id: string;
|
|
95
96
|
where?: WhereType<T, K>;
|
|
96
|
-
context: WabeContext<
|
|
97
|
-
|
|
97
|
+
context: WabeContext<T>;
|
|
98
|
+
_skipHooks?: boolean;
|
|
98
99
|
select?: SelectType<T, K, U>;
|
|
99
|
-
isGraphQLCall?: boolean;
|
|
100
100
|
}
|
|
101
101
|
export interface GetObjectsOptions<
|
|
102
102
|
T extends WabeTypes,
|
|
@@ -109,10 +109,9 @@ export interface GetObjectsOptions<
|
|
|
109
109
|
order?: OrderType<T, K, U>;
|
|
110
110
|
offset?: number;
|
|
111
111
|
first?: number;
|
|
112
|
-
context: WabeContext<
|
|
113
|
-
|
|
112
|
+
context: WabeContext<T>;
|
|
113
|
+
_skipHooks?: boolean;
|
|
114
114
|
select?: SelectType<T, K, W>;
|
|
115
|
-
isGraphQLCall?: boolean;
|
|
116
115
|
}
|
|
117
116
|
export interface CreateObjectOptions<
|
|
118
117
|
T extends WabeTypes,
|
|
@@ -122,9 +121,8 @@ export interface CreateObjectOptions<
|
|
|
122
121
|
> {
|
|
123
122
|
className: K;
|
|
124
123
|
data: MutationData<T, K, U>;
|
|
125
|
-
context: WabeContext<
|
|
124
|
+
context: WabeContext<T>;
|
|
126
125
|
select?: SelectType<T, K, W>;
|
|
127
|
-
isGraphQLCall?: boolean;
|
|
128
126
|
}
|
|
129
127
|
export interface CreateObjectsOptions<
|
|
130
128
|
T extends WabeTypes,
|
|
@@ -138,9 +136,8 @@ export interface CreateObjectsOptions<
|
|
|
138
136
|
offset?: number;
|
|
139
137
|
first?: number;
|
|
140
138
|
order?: OrderType<T, U, X>;
|
|
141
|
-
context: WabeContext<
|
|
139
|
+
context: WabeContext<T>;
|
|
142
140
|
select?: SelectType<T, K, W>;
|
|
143
|
-
isGraphQLCall?: boolean;
|
|
144
141
|
}
|
|
145
142
|
export interface UpdateObjectOptions<
|
|
146
143
|
T extends WabeTypes,
|
|
@@ -152,10 +149,9 @@ export interface UpdateObjectOptions<
|
|
|
152
149
|
id: string;
|
|
153
150
|
where?: WhereType<T, K>;
|
|
154
151
|
data: MutationData<T, K, U>;
|
|
155
|
-
context: WabeContext<
|
|
156
|
-
|
|
152
|
+
context: WabeContext<T>;
|
|
153
|
+
_skipHooks?: boolean;
|
|
157
154
|
select?: SelectType<T, K, W>;
|
|
158
|
-
isGraphQLCall?: boolean;
|
|
159
155
|
}
|
|
160
156
|
export interface UpdateObjectsOptions<
|
|
161
157
|
T extends WabeTypes,
|
|
@@ -170,10 +166,9 @@ export interface UpdateObjectsOptions<
|
|
|
170
166
|
data: MutationData<T, K, U>;
|
|
171
167
|
offset?: number;
|
|
172
168
|
first?: number;
|
|
173
|
-
context: WabeContext<
|
|
174
|
-
|
|
169
|
+
context: WabeContext<T>;
|
|
170
|
+
_skipHooks?: boolean;
|
|
175
171
|
select?: SelectType<T, K, W>;
|
|
176
|
-
isGraphQLCall?: boolean;
|
|
177
172
|
}
|
|
178
173
|
export interface DeleteObjectOptions<
|
|
179
174
|
T extends WabeTypes,
|
|
@@ -183,9 +178,8 @@ export interface DeleteObjectOptions<
|
|
|
183
178
|
className: K;
|
|
184
179
|
id: string;
|
|
185
180
|
where?: WhereType<T, K>;
|
|
186
|
-
context: WabeContext<
|
|
181
|
+
context: WabeContext<T>;
|
|
187
182
|
select?: SelectType<T, K, U>;
|
|
188
|
-
isGraphQLCall?: boolean;
|
|
189
183
|
}
|
|
190
184
|
export interface DeleteObjectsOptions<
|
|
191
185
|
T extends WabeTypes,
|
|
@@ -198,19 +192,15 @@ export interface DeleteObjectsOptions<
|
|
|
198
192
|
order?: OrderType<T, K, U>;
|
|
199
193
|
offset?: number;
|
|
200
194
|
first?: number;
|
|
201
|
-
context: WabeContext<
|
|
195
|
+
context: WabeContext<T>;
|
|
202
196
|
select?: SelectType<T, K, W>;
|
|
203
|
-
isGraphQLCall?: boolean;
|
|
204
197
|
}
|
|
205
198
|
export interface DatabaseAdapter<T extends WabeTypes> {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
close(): Promise<void>;
|
|
200
|
+
createClassIfNotExist(className: string, schema: SchemaInterface<T>): Promise<any> | any;
|
|
201
|
+
initializeDatabase(schema: SchemaInterface<T>): Promise<void>;
|
|
209
202
|
clearDatabase(): Promise<void>;
|
|
210
|
-
count<
|
|
211
|
-
T extends WabeTypes,
|
|
212
|
-
K extends keyof T["types"]
|
|
213
|
-
>(params: CountOptions<T, K>): Promise<number>;
|
|
203
|
+
count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
|
|
214
204
|
getObject<
|
|
215
205
|
K extends keyof T["types"],
|
|
216
206
|
U extends keyof T["types"][K]
|
|
@@ -225,7 +215,7 @@ export interface DatabaseAdapter<T extends WabeTypes> {
|
|
|
225
215
|
U extends keyof T["types"][K],
|
|
226
216
|
W extends keyof T["types"][K]
|
|
227
217
|
>(params: CreateObjectOptions<T, K, U, W>): Promise<{
|
|
228
|
-
id: string
|
|
218
|
+
id: string;
|
|
229
219
|
}>;
|
|
230
220
|
createObjects<
|
|
231
221
|
K extends keyof T["types"],
|
|
@@ -233,14 +223,14 @@ export interface DatabaseAdapter<T extends WabeTypes> {
|
|
|
233
223
|
W extends keyof T["types"][K],
|
|
234
224
|
X extends keyof T["types"][K]
|
|
235
225
|
>(params: CreateObjectsOptions<T, K, U, W, X>): Promise<Array<{
|
|
236
|
-
id: string
|
|
226
|
+
id: string;
|
|
237
227
|
}>>;
|
|
238
228
|
updateObject<
|
|
239
229
|
K extends keyof T["types"],
|
|
240
230
|
U extends keyof T["types"][K],
|
|
241
231
|
W extends keyof T["types"][K]
|
|
242
232
|
>(params: UpdateObjectOptions<T, K, U, W>): Promise<{
|
|
243
|
-
id: string
|
|
233
|
+
id: string;
|
|
244
234
|
}>;
|
|
245
235
|
updateObjects<
|
|
246
236
|
K extends keyof T["types"],
|
|
@@ -248,7 +238,7 @@ export interface DatabaseAdapter<T extends WabeTypes> {
|
|
|
248
238
|
W extends keyof T["types"][K],
|
|
249
239
|
X extends keyof T["types"][K]
|
|
250
240
|
>(params: UpdateObjectsOptions<T, K, U, W, X>): Promise<Array<{
|
|
251
|
-
id: string
|
|
241
|
+
id: string;
|
|
252
242
|
}>>;
|
|
253
243
|
deleteObject<
|
|
254
244
|
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";
|