wabe 0.5.23 → 0.6.1
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 +1 -2
- package/dist/index.d.ts +232 -258
- package/dist/index.js +3815 -933
- package/generated/schema.graphql +133 -45
- package/generated/wabe.ts +240 -1715
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,258 +4,173 @@
|
|
|
4
4
|
|
|
5
5
|
import { Context, CorsOptions, RateLimitOptions, Wobe, WobeHandler, WobeResponse } from 'wobe';
|
|
6
6
|
|
|
7
|
-
export type Scalars = {
|
|
8
|
-
ID: {
|
|
9
|
-
input: string;
|
|
10
|
-
output: string;
|
|
11
|
-
};
|
|
12
|
-
String: {
|
|
13
|
-
input: string;
|
|
14
|
-
output: string;
|
|
15
|
-
};
|
|
16
|
-
Boolean: {
|
|
17
|
-
input: boolean;
|
|
18
|
-
output: boolean;
|
|
19
|
-
};
|
|
20
|
-
Int: {
|
|
21
|
-
input: number;
|
|
22
|
-
output: number;
|
|
23
|
-
};
|
|
24
|
-
Float: {
|
|
25
|
-
input: number;
|
|
26
|
-
output: number;
|
|
27
|
-
};
|
|
28
|
-
Email: {
|
|
29
|
-
input: string;
|
|
30
|
-
output: string;
|
|
31
|
-
};
|
|
32
|
-
Phone: {
|
|
33
|
-
input: string;
|
|
34
|
-
output: string;
|
|
35
|
-
};
|
|
36
|
-
Date: {
|
|
37
|
-
input: Date;
|
|
38
|
-
output: string;
|
|
39
|
-
};
|
|
40
|
-
Search: {
|
|
41
|
-
input: any;
|
|
42
|
-
output: any;
|
|
43
|
-
};
|
|
44
|
-
Any: {
|
|
45
|
-
input: any;
|
|
46
|
-
output: any;
|
|
47
|
-
};
|
|
48
|
-
File: {
|
|
49
|
-
input: any;
|
|
50
|
-
output: any;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
7
|
declare enum RoleEnum {
|
|
54
8
|
Admin = "Admin",
|
|
55
9
|
Client = "Client"
|
|
56
10
|
}
|
|
57
11
|
declare enum AuthenticationProvider {
|
|
12
|
+
github = "github",
|
|
58
13
|
google = "google",
|
|
59
|
-
emailPassword = "emailPassword"
|
|
14
|
+
emailPassword = "emailPassword",
|
|
15
|
+
phonePassword = "phonePassword"
|
|
60
16
|
}
|
|
61
17
|
declare enum SecondaryFactor {
|
|
62
|
-
EmailOTP = "
|
|
18
|
+
EmailOTP = "emailOTP"
|
|
63
19
|
}
|
|
64
|
-
export type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
acl?: UserACLObject;
|
|
69
|
-
createdAt?: Scalars["Date"]["output"];
|
|
70
|
-
updatedAt?: Scalars["Date"]["output"];
|
|
71
|
-
search?: Scalars["String"]["output"][];
|
|
72
|
-
authentication?: UserAuthentication;
|
|
73
|
-
provider?: AuthenticationProvider;
|
|
74
|
-
isOauth?: Scalars["Boolean"]["output"];
|
|
75
|
-
email?: Scalars["Email"]["output"];
|
|
76
|
-
verifiedEmail?: Scalars["Boolean"]["output"];
|
|
77
|
-
role?: Role;
|
|
78
|
-
sessions?: _SessionConnection;
|
|
20
|
+
export type ACLObjectUsersACL = {
|
|
21
|
+
userId: string;
|
|
22
|
+
read: boolean;
|
|
23
|
+
write: boolean;
|
|
79
24
|
};
|
|
80
|
-
export type
|
|
81
|
-
users?:
|
|
82
|
-
roles?:
|
|
25
|
+
export type ACLObject = {
|
|
26
|
+
users?: Array<ACLObjectUsersACL>;
|
|
27
|
+
roles?: Array<ACLObjectRolesACL>;
|
|
83
28
|
};
|
|
84
|
-
export type
|
|
85
|
-
|
|
86
|
-
read:
|
|
87
|
-
write:
|
|
29
|
+
export type ACLObjectRolesACL = {
|
|
30
|
+
roleId: string;
|
|
31
|
+
read: boolean;
|
|
32
|
+
write: boolean;
|
|
88
33
|
};
|
|
89
|
-
export type
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
write: Scalars["Boolean"]["output"];
|
|
34
|
+
export type AuthenticationPhonePassword = {
|
|
35
|
+
phone: string;
|
|
36
|
+
password: string;
|
|
93
37
|
};
|
|
94
|
-
export type
|
|
95
|
-
|
|
96
|
-
|
|
38
|
+
export type Authentication = {
|
|
39
|
+
phonePassword?: AuthenticationPhonePassword;
|
|
40
|
+
emailPassword?: AuthenticationEmailPassword;
|
|
41
|
+
google?: AuthenticationGoogle;
|
|
42
|
+
github?: AuthenticationGithub;
|
|
97
43
|
};
|
|
98
|
-
export type
|
|
99
|
-
email:
|
|
100
|
-
password:
|
|
44
|
+
export type AuthenticationEmailPassword = {
|
|
45
|
+
email: string;
|
|
46
|
+
password: string;
|
|
101
47
|
};
|
|
102
|
-
export type
|
|
103
|
-
email:
|
|
104
|
-
verifiedEmail:
|
|
105
|
-
idToken: Scalars["String"]["output"];
|
|
48
|
+
export type AuthenticationGoogle = {
|
|
49
|
+
email: string;
|
|
50
|
+
verifiedEmail: boolean;
|
|
106
51
|
};
|
|
107
|
-
export type
|
|
108
|
-
|
|
109
|
-
|
|
52
|
+
export type AuthenticationGithub = {
|
|
53
|
+
email: string;
|
|
54
|
+
avatarUrl: string;
|
|
55
|
+
username: string;
|
|
110
56
|
};
|
|
111
|
-
export type
|
|
112
|
-
|
|
57
|
+
export type User = {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
age?: number;
|
|
61
|
+
email?: string;
|
|
62
|
+
acl?: ACLObject;
|
|
63
|
+
createdAt?: Date;
|
|
64
|
+
updatedAt?: Date;
|
|
65
|
+
search?: Array<string>;
|
|
66
|
+
authentication?: Authentication;
|
|
67
|
+
provider?: AuthenticationProvider;
|
|
68
|
+
isOauth?: boolean;
|
|
69
|
+
verifiedEmail?: boolean;
|
|
70
|
+
role?: Role;
|
|
71
|
+
sessions?: Array<string>;
|
|
113
72
|
};
|
|
114
73
|
export type Post = {
|
|
115
|
-
id:
|
|
116
|
-
name:
|
|
117
|
-
test?: Scalars["File"]["output"];
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
118
76
|
test2?: RoleEnum;
|
|
119
|
-
acl?:
|
|
120
|
-
createdAt?:
|
|
121
|
-
updatedAt?:
|
|
122
|
-
search?:
|
|
123
|
-
};
|
|
124
|
-
export type PostACLObject = {
|
|
125
|
-
users?: PostACLObjectUsersACL[];
|
|
126
|
-
roles?: PostACLObjectRolesACL[];
|
|
127
|
-
};
|
|
128
|
-
export type PostACLObjectUsersACL = {
|
|
129
|
-
userId: Scalars["String"]["output"];
|
|
130
|
-
read: Scalars["Boolean"]["output"];
|
|
131
|
-
write: Scalars["Boolean"]["output"];
|
|
132
|
-
};
|
|
133
|
-
export type PostACLObjectRolesACL = {
|
|
134
|
-
roleId: Scalars["String"]["output"];
|
|
135
|
-
read: Scalars["Boolean"]["output"];
|
|
136
|
-
write: Scalars["Boolean"]["output"];
|
|
77
|
+
acl?: ACLObject;
|
|
78
|
+
createdAt?: Date;
|
|
79
|
+
updatedAt?: Date;
|
|
80
|
+
search?: Array<string>;
|
|
137
81
|
};
|
|
138
82
|
export type _Session = {
|
|
139
|
-
id:
|
|
140
|
-
user
|
|
141
|
-
accessToken:
|
|
142
|
-
accessTokenExpiresAt:
|
|
143
|
-
refreshToken?:
|
|
144
|
-
refreshTokenExpiresAt:
|
|
145
|
-
acl?:
|
|
146
|
-
createdAt?:
|
|
147
|
-
updatedAt?:
|
|
148
|
-
search?:
|
|
149
|
-
};
|
|
150
|
-
export type _SessionACLObject = {
|
|
151
|
-
users?: _SessionACLObjectUsersACL[];
|
|
152
|
-
roles?: _SessionACLObjectRolesACL[];
|
|
153
|
-
};
|
|
154
|
-
export type _SessionACLObjectUsersACL = {
|
|
155
|
-
userId: Scalars["String"]["output"];
|
|
156
|
-
read: Scalars["Boolean"]["output"];
|
|
157
|
-
write: Scalars["Boolean"]["output"];
|
|
158
|
-
};
|
|
159
|
-
export type _SessionACLObjectRolesACL = {
|
|
160
|
-
roleId: Scalars["String"]["output"];
|
|
161
|
-
read: Scalars["Boolean"]["output"];
|
|
162
|
-
write: Scalars["Boolean"]["output"];
|
|
83
|
+
id: string;
|
|
84
|
+
user: User;
|
|
85
|
+
accessToken: string;
|
|
86
|
+
accessTokenExpiresAt: Date;
|
|
87
|
+
refreshToken?: string;
|
|
88
|
+
refreshTokenExpiresAt: Date;
|
|
89
|
+
acl?: ACLObject;
|
|
90
|
+
createdAt?: Date;
|
|
91
|
+
updatedAt?: Date;
|
|
92
|
+
search?: Array<string>;
|
|
163
93
|
};
|
|
164
94
|
export type Role = {
|
|
165
|
-
id:
|
|
166
|
-
name:
|
|
167
|
-
users?:
|
|
168
|
-
acl?:
|
|
169
|
-
createdAt?:
|
|
170
|
-
updatedAt?:
|
|
171
|
-
search?:
|
|
172
|
-
};
|
|
173
|
-
export type UserConnection = {
|
|
174
|
-
totalCount?: Scalars["Int"]["output"];
|
|
175
|
-
edges?: UserEdge[];
|
|
176
|
-
};
|
|
177
|
-
export type UserEdge = {
|
|
178
|
-
node: User;
|
|
179
|
-
};
|
|
180
|
-
export type RoleACLObject = {
|
|
181
|
-
users?: RoleACLObjectUsersACL[];
|
|
182
|
-
roles?: RoleACLObjectRolesACL[];
|
|
183
|
-
};
|
|
184
|
-
export type RoleACLObjectUsersACL = {
|
|
185
|
-
userId: Scalars["String"]["output"];
|
|
186
|
-
read: Scalars["Boolean"]["output"];
|
|
187
|
-
write: Scalars["Boolean"]["output"];
|
|
188
|
-
};
|
|
189
|
-
export type RoleACLObjectRolesACL = {
|
|
190
|
-
roleId: Scalars["String"]["output"];
|
|
191
|
-
read: Scalars["Boolean"]["output"];
|
|
192
|
-
write: Scalars["Boolean"]["output"];
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
users?: Array<string>;
|
|
98
|
+
acl?: ACLObject;
|
|
99
|
+
createdAt?: Date;
|
|
100
|
+
updatedAt?: Date;
|
|
101
|
+
search?: Array<string>;
|
|
193
102
|
};
|
|
194
103
|
export type _InternalConfig = {
|
|
195
|
-
id:
|
|
196
|
-
configKey:
|
|
197
|
-
configValue:
|
|
198
|
-
description?:
|
|
199
|
-
acl?:
|
|
200
|
-
createdAt?:
|
|
201
|
-
updatedAt?:
|
|
202
|
-
search?:
|
|
203
|
-
};
|
|
204
|
-
export type _InternalConfigACLObject = {
|
|
205
|
-
users?: _InternalConfigACLObjectUsersACL[];
|
|
206
|
-
roles?: _InternalConfigACLObjectRolesACL[];
|
|
207
|
-
};
|
|
208
|
-
export type _InternalConfigACLObjectUsersACL = {
|
|
209
|
-
userId: Scalars["String"]["output"];
|
|
210
|
-
read: Scalars["Boolean"]["output"];
|
|
211
|
-
write: Scalars["Boolean"]["output"];
|
|
212
|
-
};
|
|
213
|
-
export type _InternalConfigACLObjectRolesACL = {
|
|
214
|
-
roleId: Scalars["String"]["output"];
|
|
215
|
-
read: Scalars["Boolean"]["output"];
|
|
216
|
-
write: Scalars["Boolean"]["output"];
|
|
104
|
+
id: string;
|
|
105
|
+
configKey: string;
|
|
106
|
+
configValue: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
acl?: ACLObject;
|
|
109
|
+
createdAt?: Date;
|
|
110
|
+
updatedAt?: Date;
|
|
111
|
+
search?: Array<string>;
|
|
217
112
|
};
|
|
218
113
|
export type SignInWithInput = {
|
|
219
|
-
authentication:
|
|
220
|
-
};
|
|
221
|
-
export type
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
114
|
+
authentication: SignInWithAuthentication;
|
|
115
|
+
};
|
|
116
|
+
export type SignInWithAuthenticationPhonePassword = {
|
|
117
|
+
phone: string;
|
|
118
|
+
password: string;
|
|
119
|
+
};
|
|
120
|
+
export type SignInWithAuthentication = {
|
|
121
|
+
phonePassword?: SignInWithAuthenticationPhonePassword;
|
|
122
|
+
emailPassword?: SignInWithAuthenticationEmailPassword;
|
|
123
|
+
google?: SignInWithAuthenticationGoogle;
|
|
124
|
+
github?: SignInWithAuthenticationGithub;
|
|
125
|
+
otp?: SignInWithAuthenticationOtp;
|
|
225
126
|
secondaryFactor?: SecondaryFactor;
|
|
226
127
|
};
|
|
227
|
-
export type
|
|
228
|
-
email:
|
|
229
|
-
password:
|
|
128
|
+
export type SignInWithAuthenticationEmailPassword = {
|
|
129
|
+
email: string;
|
|
130
|
+
password: string;
|
|
230
131
|
};
|
|
231
|
-
export type
|
|
232
|
-
authorizationCode:
|
|
233
|
-
codeVerifier:
|
|
132
|
+
export type SignInWithAuthenticationGoogle = {
|
|
133
|
+
authorizationCode: string;
|
|
134
|
+
codeVerifier: string;
|
|
234
135
|
};
|
|
235
|
-
export type
|
|
236
|
-
|
|
136
|
+
export type SignInWithAuthenticationGithub = {
|
|
137
|
+
authorizationCode: string;
|
|
138
|
+
codeVerifier: string;
|
|
237
139
|
};
|
|
238
|
-
export type
|
|
239
|
-
|
|
140
|
+
export type SignInWithAuthenticationOtp = {
|
|
141
|
+
code?: string;
|
|
240
142
|
};
|
|
241
|
-
export type
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
143
|
+
export type SignUpWithInput = {
|
|
144
|
+
authentication: SignUpWithAuthentication;
|
|
145
|
+
};
|
|
146
|
+
export type SignUpWithAuthenticationPhonePassword = {
|
|
147
|
+
phone: string;
|
|
148
|
+
password: string;
|
|
149
|
+
};
|
|
150
|
+
export type SignUpWithAuthentication = {
|
|
151
|
+
phonePassword?: SignUpWithAuthenticationPhonePassword;
|
|
152
|
+
emailPassword?: SignUpWithAuthenticationEmailPassword;
|
|
153
|
+
google?: SignUpWithAuthenticationGoogle;
|
|
154
|
+
github?: SignUpWithAuthenticationGithub;
|
|
155
|
+
otp?: SignUpWithAuthenticationOtp;
|
|
245
156
|
secondaryFactor?: SecondaryFactor;
|
|
246
157
|
};
|
|
247
|
-
export type
|
|
248
|
-
email:
|
|
249
|
-
password:
|
|
158
|
+
export type SignUpWithAuthenticationEmailPassword = {
|
|
159
|
+
email: string;
|
|
160
|
+
password: string;
|
|
161
|
+
};
|
|
162
|
+
export type SignUpWithAuthenticationGoogle = {
|
|
163
|
+
authorizationCode: string;
|
|
164
|
+
codeVerifier: string;
|
|
250
165
|
};
|
|
251
|
-
export type
|
|
252
|
-
authorizationCode:
|
|
253
|
-
codeVerifier:
|
|
166
|
+
export type SignUpWithAuthenticationGithub = {
|
|
167
|
+
authorizationCode: string;
|
|
168
|
+
codeVerifier: string;
|
|
254
169
|
};
|
|
255
|
-
export type
|
|
256
|
-
code?:
|
|
170
|
+
export type SignUpWithAuthenticationOtp = {
|
|
171
|
+
code?: string;
|
|
257
172
|
};
|
|
258
|
-
export type WabeSchemaScalars = "
|
|
173
|
+
export type WabeSchemaScalars = "";
|
|
259
174
|
export type WabeSchemaEnums = {
|
|
260
175
|
RoleEnum: RoleEnum;
|
|
261
176
|
AuthenticationProvider: AuthenticationProvider;
|
|
@@ -275,7 +190,9 @@ export interface WabeContext<T extends WabeTypes> {
|
|
|
275
190
|
isRoot: boolean;
|
|
276
191
|
wabe: Wabe<T>;
|
|
277
192
|
}
|
|
278
|
-
export type IsScalar<T> = T extends
|
|
193
|
+
export type IsScalar<T> = T extends string | number | boolean ? true : false;
|
|
194
|
+
export type IsArray<T> = T extends Array<any> ? true : false;
|
|
195
|
+
export type IsObject<T, K extends WabeTypes> = T extends object ? T extends K["types"][keyof K["types"]] ? false : true : false;
|
|
279
196
|
export type ExtractType<T extends WabeTypes, ClassName extends keyof T["types"], FieldName extends keyof T["types"][ClassName]> = T["types"][ClassName][FieldName];
|
|
280
197
|
export type WhereScalar<T> = {
|
|
281
198
|
equalTo?: T;
|
|
@@ -300,7 +217,16 @@ export type WhereConditional<T extends WabeTypes, K extends keyof T["types"]> =
|
|
|
300
217
|
AND?: Array<WhereType<T, K>>;
|
|
301
218
|
};
|
|
302
219
|
export type WhereType<T extends WabeTypes, K extends keyof T["types"]> = Partial<WhereAggregation<T, K>> & WhereConditional<T, K>;
|
|
220
|
+
export type SelectObject<T, K extends WabeTypes> = {
|
|
221
|
+
[P in keyof T]: IsScalar<T[P]> | IsArray<T[P]> | IsObject<T[P], K> extends false ? SelectObject<Partial<T[P]>, K> | boolean : boolean;
|
|
222
|
+
};
|
|
223
|
+
export type SelectType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = Partial<{
|
|
224
|
+
[P in U]: IsScalar<ExtractType<T, K, P>> | IsArray<ExtractType<T, K, P>> | IsObject<ExtractType<T, K, P>, T> extends false ? SelectObject<Partial<ExtractType<T, K, P>>, T> | boolean : boolean;
|
|
225
|
+
}>;
|
|
303
226
|
export type OrderType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = Record<U, "ASC" | "DESC">;
|
|
227
|
+
export type OutputType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = (Pick<T["types"][K], U> & {
|
|
228
|
+
id: string;
|
|
229
|
+
}) | null;
|
|
304
230
|
export interface AdapterOptions {
|
|
305
231
|
databaseUrl: string;
|
|
306
232
|
databaseName: string;
|
|
@@ -315,72 +241,71 @@ export interface GetObjectOptions<T extends WabeTypes, K extends keyof T["types"
|
|
|
315
241
|
className: K;
|
|
316
242
|
id: string;
|
|
317
243
|
where?: WhereType<T, K>;
|
|
318
|
-
fields: Array<U | "*">;
|
|
319
244
|
context: WabeContext<any>;
|
|
320
245
|
skipHooks?: boolean;
|
|
246
|
+
select?: SelectType<T, K, U>;
|
|
321
247
|
}
|
|
322
248
|
export interface GetObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
323
249
|
className: K;
|
|
324
250
|
where?: WhereType<T, K>;
|
|
325
251
|
order?: OrderType<T, K, U>;
|
|
326
|
-
fields: Array<W | "*">;
|
|
327
252
|
offset?: number;
|
|
328
253
|
first?: number;
|
|
329
254
|
context: WabeContext<any>;
|
|
330
255
|
skipHooks?: boolean;
|
|
256
|
+
select?: SelectType<T, K, W>;
|
|
331
257
|
}
|
|
332
258
|
export interface CreateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
333
259
|
className: K;
|
|
334
260
|
data: MutationData<T, K, U>;
|
|
335
|
-
fields: Array<W | "*">;
|
|
336
261
|
context: WabeContext<any>;
|
|
262
|
+
select?: SelectType<T, K, W>;
|
|
337
263
|
}
|
|
338
264
|
export interface CreateObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]> {
|
|
339
265
|
className: K;
|
|
340
266
|
data: Array<MutationData<T, K, U>>;
|
|
341
|
-
fields: Array<W | "*">;
|
|
342
267
|
offset?: number;
|
|
343
268
|
first?: number;
|
|
344
269
|
order?: OrderType<T, U, X>;
|
|
345
270
|
context: WabeContext<any>;
|
|
271
|
+
select?: SelectType<T, K, W>;
|
|
346
272
|
}
|
|
347
273
|
export interface UpdateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
348
274
|
className: K;
|
|
349
275
|
id: string;
|
|
350
276
|
where?: WhereType<T, K>;
|
|
351
277
|
data: MutationData<T, K, U>;
|
|
352
|
-
fields: Array<W | "*">;
|
|
353
278
|
context: WabeContext<any>;
|
|
279
|
+
skipHooks?: boolean;
|
|
280
|
+
select?: SelectType<T, K, W>;
|
|
354
281
|
}
|
|
355
282
|
export interface UpdateObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]> {
|
|
356
283
|
className: K;
|
|
357
284
|
where: WhereType<T, K>;
|
|
358
285
|
order?: OrderType<T, K, X>;
|
|
359
286
|
data: MutationData<T, K, U>;
|
|
360
|
-
fields: Array<W | "*">;
|
|
361
287
|
offset?: number;
|
|
362
288
|
first?: number;
|
|
363
289
|
context: WabeContext<any>;
|
|
290
|
+
skipHooks?: boolean;
|
|
291
|
+
select?: SelectType<T, K, W>;
|
|
364
292
|
}
|
|
365
293
|
export interface DeleteObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> {
|
|
366
294
|
className: K;
|
|
367
295
|
id: string;
|
|
368
296
|
where?: WhereType<T, K>;
|
|
369
|
-
fields: Array<U | "*">;
|
|
370
297
|
context: WabeContext<any>;
|
|
298
|
+
select?: SelectType<T, K, U>;
|
|
371
299
|
}
|
|
372
300
|
export interface DeleteObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
373
301
|
className: K;
|
|
374
302
|
where: WhereType<T, K>;
|
|
375
303
|
order?: OrderType<T, K, U>;
|
|
376
|
-
fields: Array<W | "*">;
|
|
377
304
|
offset?: number;
|
|
378
305
|
first?: number;
|
|
379
306
|
context: WabeContext<any>;
|
|
307
|
+
select?: SelectType<T, K, W>;
|
|
380
308
|
}
|
|
381
|
-
export type OutputType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = (Pick<T["types"][K], U> & {
|
|
382
|
-
id: string;
|
|
383
|
-
}) | null;
|
|
384
309
|
export interface DatabaseAdapter<T extends WabeTypes> {
|
|
385
310
|
connect(): Promise<any>;
|
|
386
311
|
close(): Promise<any>;
|
|
@@ -433,21 +358,24 @@ export declare class MongoAdapter<T extends WabeTypes> implements DatabaseAdapte
|
|
|
433
358
|
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: DeleteObjectOptions<T, K, U>): Promise<void>;
|
|
434
359
|
deleteObjects<K extends keyof T["types"], U extends keyof T["types"][U], W extends keyof T["types"][U]>(params: DeleteObjectsOptions<T, K, U, W>): Promise<void>;
|
|
435
360
|
}
|
|
436
|
-
export type
|
|
437
|
-
|
|
438
|
-
fieldsOfPointerClass: Array<string>;
|
|
439
|
-
}>;
|
|
440
|
-
export interface PointerFields {
|
|
441
|
-
pointersFieldsId: string[];
|
|
442
|
-
pointers: PointerObject;
|
|
443
|
-
}
|
|
361
|
+
export type Select = Record<string, boolean>;
|
|
362
|
+
export type SelectWithObject = Record<string, object | boolean>;
|
|
444
363
|
export declare class DatabaseController<T extends WabeTypes> {
|
|
445
364
|
adapter: DatabaseAdapter<T>;
|
|
446
365
|
constructor(adapter: DatabaseAdapter<T>);
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
366
|
+
_getSelectMinusPointersAndRelations({ className, context, select, }: {
|
|
367
|
+
className: keyof T["types"];
|
|
368
|
+
context: WabeContext<T>;
|
|
369
|
+
select?: SelectWithObject;
|
|
370
|
+
}): {
|
|
371
|
+
pointers: Record<string, {
|
|
372
|
+
className: string;
|
|
373
|
+
select: Select;
|
|
374
|
+
}>;
|
|
375
|
+
selectWithoutPointers: Select;
|
|
376
|
+
};
|
|
377
|
+
_isRelationField(originClassName: string, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
|
|
378
|
+
_isPointerField(originClassName: string, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
|
|
451
379
|
_getWhereObjectWithPointerOrRelation<U extends keyof T["types"]>(className: U, where: WhereType<T, U>, context: WabeContext<T>): Promise<Partial<{
|
|
452
380
|
[P in keyof T["types"][U]]: (T["types"][U][P] extends infer T_1 ? T_1 extends T["types"][U][P] ? T_1 extends string | number | boolean ? true : false : never : never) extends false ? Partial<T["types"][U][P]> extends infer T_2 ? {
|
|
453
381
|
[P_1 in keyof T_2]: (Partial<T["types"][U][P]>[P_1] extends infer T_3 ? T_3 extends Partial<T["types"][U][P]>[P_1] ? T_3 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<T["types"][U][P]>[P_1]> extends infer T_4 ? {
|
|
@@ -609,19 +537,28 @@ export declare class DatabaseController<T extends WabeTypes> {
|
|
|
609
537
|
AND?: WhereType<T, U>[] | undefined;
|
|
610
538
|
}>;
|
|
611
539
|
_buildWhereWithACL<K extends keyof T["types"]>(where: WhereType<T, K>, context: WabeContext<T>, operation: "write" | "read"): WhereType<T, K>;
|
|
540
|
+
_getFinalObjectWithPointerAndRelation({ pointers, context, originClassName, object, }: {
|
|
541
|
+
originClassName: string;
|
|
542
|
+
pointers: Record<string, {
|
|
543
|
+
className: string;
|
|
544
|
+
select: Select;
|
|
545
|
+
}>;
|
|
546
|
+
context: WabeContext<any>;
|
|
547
|
+
object: Record<string, any>;
|
|
548
|
+
}): Promise<Record<string, any>>;
|
|
612
549
|
connect(): Promise<any>;
|
|
613
550
|
close(): Promise<any>;
|
|
614
551
|
createClassIfNotExist(className: string, context: WabeContext<T>): Promise<any>;
|
|
615
552
|
count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
|
|
616
553
|
clearDatabase(): Promise<void>;
|
|
617
|
-
getObject<K extends keyof T["types"], U extends keyof T["types"][K]>({
|
|
618
|
-
getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className,
|
|
619
|
-
createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, data,
|
|
620
|
-
createObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>({ data,
|
|
621
|
-
updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ id, className, context, data,
|
|
622
|
-
updateObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>({ className, where, context,
|
|
623
|
-
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ context, className, id,
|
|
624
|
-
deleteObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context,
|
|
554
|
+
getObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ select, className, context, skipHooks, id, where, }: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
|
|
555
|
+
getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, select, context, where, skipHooks, first, offset, order, }: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
|
|
556
|
+
createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, data, select, }: CreateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
|
|
557
|
+
createObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>({ data, select, className, context, first, offset, order, }: CreateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
|
|
558
|
+
updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ id, className, context, data, select, skipHooks, }: UpdateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
|
|
559
|
+
updateObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>({ className, where, context, select, data, first, offset, order, skipHooks, }: UpdateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
|
|
560
|
+
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ context, className, id, select, }: DeleteObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
|
|
561
|
+
deleteObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, select, where, first, offset, order, }: DeleteObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
|
|
625
562
|
}
|
|
626
563
|
export declare enum DatabaseEnum {
|
|
627
564
|
Mongo = "mongo"
|
|
@@ -658,9 +595,10 @@ export declare const _findHooksByPriority: <T extends unknown>({ className, oper
|
|
|
658
595
|
priority: number;
|
|
659
596
|
config: WabeConfig<any>;
|
|
660
597
|
}) => Promise<Hook<any, any>[]>;
|
|
661
|
-
export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context, }: {
|
|
598
|
+
export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context, select, }: {
|
|
662
599
|
className: K;
|
|
663
600
|
newData?: MutationData<DevWabeTypes, any, any>;
|
|
601
|
+
select: Select;
|
|
664
602
|
context: WabeContext<any>;
|
|
665
603
|
}) => {
|
|
666
604
|
runOnSingleObject: (options: {
|
|
@@ -695,13 +633,15 @@ declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]
|
|
|
695
633
|
context: WabeContext<T>;
|
|
696
634
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
697
635
|
originalObject: OutputType<T, K, keyof T["types"][K]> | undefined;
|
|
698
|
-
|
|
636
|
+
select: Array<keyof T["types"][K]>;
|
|
637
|
+
constructor({ newData, className, operationType, context, object, originalObject, select, }: {
|
|
699
638
|
className: K;
|
|
700
639
|
newData?: MutationData<T, K, keyof T["types"][K]>;
|
|
701
640
|
operationType: OperationType;
|
|
702
641
|
context: WabeContext<T>;
|
|
703
642
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
704
643
|
originalObject?: OutputType<T, K, keyof T["types"][K]>;
|
|
644
|
+
select: Select;
|
|
705
645
|
});
|
|
706
646
|
getUser(): User | null | undefined;
|
|
707
647
|
isFieldUpdated(field: keyof T["types"][K]): boolean | undefined;
|
|
@@ -710,7 +650,7 @@ declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]
|
|
|
710
650
|
fetch(): Promise<OutputType<T, K, keyof T["types"][K]>>;
|
|
711
651
|
addACL(type: "users" | "roles", options: AddACLOpptions): Promise<void>;
|
|
712
652
|
}
|
|
713
|
-
export type WabePrimaryTypes = "String" | "Int" | "Float" | "Boolean" | "Email" | "Date" | "File";
|
|
653
|
+
export type WabePrimaryTypes = "String" | "Int" | "Float" | "Boolean" | "Email" | "Phone" | "Date" | "File";
|
|
714
654
|
export type WabeCustomTypes = "Array" | "Object";
|
|
715
655
|
export type WabeRelationTypes = "Pointer" | "Relation";
|
|
716
656
|
export type WabeFieldTypes = WabeCustomTypes | WabePrimaryTypes | WabeRelationTypes;
|
|
@@ -774,7 +714,7 @@ export type TypeFieldCustomEnums<T extends WabeTypes> = {
|
|
|
774
714
|
description?: string;
|
|
775
715
|
defaultValue?: any;
|
|
776
716
|
};
|
|
777
|
-
export type TypeField<T extends WabeTypes> = TypeFieldBase<string, "String"> | TypeFieldBase<number, "Int"> | TypeFieldBase<number, "Float"> | TypeFieldBase<boolean, "Boolean"> | TypeFieldBase<Date, "Date"> | TypeFieldBase<string, "Email"> | TypeFieldArray<T> | TypeFieldObject<T> | TypeFieldPointer<T> | TypeFieldRelation<T> | TypeFieldFile | TypeFieldCustomScalars<T> | TypeFieldCustomEnums<T>;
|
|
717
|
+
export type TypeField<T extends WabeTypes> = TypeFieldBase<string, "String"> | TypeFieldBase<number, "Int"> | TypeFieldBase<number, "Float"> | TypeFieldBase<boolean, "Boolean"> | TypeFieldBase<Date, "Date"> | TypeFieldBase<string, "Email"> | TypeFieldBase<string, "Phone"> | TypeFieldArray<T> | TypeFieldObject<T> | TypeFieldPointer<T> | TypeFieldRelation<T> | TypeFieldFile | TypeFieldCustomScalars<T> | TypeFieldCustomEnums<T>;
|
|
778
718
|
export type SchemaFields<T extends WabeTypes> = Record<string, TypeField<T>>;
|
|
779
719
|
export type ResolverType<T extends WabeTypes> = {
|
|
780
720
|
required?: boolean;
|
|
@@ -877,7 +817,7 @@ export declare class Schema<T extends WabeTypes> {
|
|
|
877
817
|
}
|
|
878
818
|
export declare enum ProviderEnum {
|
|
879
819
|
google = "google",
|
|
880
|
-
|
|
820
|
+
github = "github"
|
|
881
821
|
}
|
|
882
822
|
export interface ProviderConfig {
|
|
883
823
|
clientId: string;
|
|
@@ -948,8 +888,10 @@ export interface Provider {
|
|
|
948
888
|
refreshToken(options: refreshTokenOptions): Promise<void>;
|
|
949
889
|
}
|
|
950
890
|
declare enum AuthenticationProvider$1 {
|
|
891
|
+
GitHub = "github",
|
|
951
892
|
Google = "google",
|
|
952
|
-
EmailPassword = "emailPassword"
|
|
893
|
+
EmailPassword = "emailPassword",
|
|
894
|
+
PhonePassword = "phonePassword"
|
|
953
895
|
}
|
|
954
896
|
export interface WabeRoute {
|
|
955
897
|
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
@@ -961,17 +903,40 @@ export declare const generateCodegen: ({ schema, path, graphqlSchema, }: {
|
|
|
961
903
|
path: string;
|
|
962
904
|
graphqlSchema: GraphQLSchema;
|
|
963
905
|
}) => Promise<void>;
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
906
|
+
export declare class FileDevAdapter implements FileAdapter {
|
|
907
|
+
private basePath;
|
|
908
|
+
rootPath: string;
|
|
909
|
+
constructor(basePath: string);
|
|
910
|
+
uploadFile(file: File | Blob): Promise<void>;
|
|
911
|
+
readFile(fileName: string): Promise<string | null>;
|
|
912
|
+
deleteFile(fileName: string): Promise<void>;
|
|
913
|
+
}
|
|
970
914
|
/**
|
|
971
915
|
* The file config contains the adapter to use to upload file
|
|
916
|
+
* @param adapter: FileAdapter
|
|
917
|
+
* @param urlCacheInSeconds: number Number of seconds to cache the url, equal to the number of seconds the url will be valid
|
|
972
918
|
*/
|
|
973
919
|
export interface FileConfig {
|
|
974
|
-
adapter:
|
|
920
|
+
adapter: FileAdapter;
|
|
921
|
+
urlCacheInSeconds?: number;
|
|
922
|
+
}
|
|
923
|
+
export interface ReadFileOptions {
|
|
924
|
+
urlExpiresIn?: number;
|
|
925
|
+
}
|
|
926
|
+
export interface FileAdapter {
|
|
927
|
+
/**
|
|
928
|
+
* Upload a file and returns the url of the file
|
|
929
|
+
* @param file: File
|
|
930
|
+
*/
|
|
931
|
+
uploadFile(file: File | Blob): Promise<void>;
|
|
932
|
+
/**
|
|
933
|
+
* Read a file and returns the url of the file
|
|
934
|
+
* @param fileName: string
|
|
935
|
+
* @param urlExpiresIn: number Number of seconds to expire the url
|
|
936
|
+
* @returns The url of file or null if the file doesn't exist
|
|
937
|
+
*/
|
|
938
|
+
readFile(fileName: string, options?: ReadFileOptions): Promise<string | null> | string | null;
|
|
939
|
+
deleteFile(fileName: string): Promise<void>;
|
|
975
940
|
}
|
|
976
941
|
export type HtmlTemplates = {
|
|
977
942
|
sendOTPCode: (options: {
|
|
@@ -1282,6 +1247,13 @@ export interface AIAdapter {
|
|
|
1282
1247
|
export interface AIConfig {
|
|
1283
1248
|
adapter: AIAdapter;
|
|
1284
1249
|
}
|
|
1250
|
+
declare class FileController implements FileAdapter {
|
|
1251
|
+
adapter: FileAdapter;
|
|
1252
|
+
constructor(adapter: FileAdapter);
|
|
1253
|
+
uploadFile(file: File | Blob): Promise<void>;
|
|
1254
|
+
readFile(fileName: string): string | Promise<string | null> | null;
|
|
1255
|
+
deleteFile(fileName: string): Promise<void>;
|
|
1256
|
+
}
|
|
1285
1257
|
export type SecurityConfig = {
|
|
1286
1258
|
corsOptions?: CorsOptions;
|
|
1287
1259
|
rateLimit?: RateLimitOptions;
|
|
@@ -1292,6 +1264,7 @@ export interface WabeConfig<T extends WabeTypes> {
|
|
|
1292
1264
|
hostname?: string;
|
|
1293
1265
|
security?: SecurityConfig;
|
|
1294
1266
|
schema?: SchemaInterface<T>;
|
|
1267
|
+
graphqlSchema?: GraphQLSchema;
|
|
1295
1268
|
database: DatabaseConfig;
|
|
1296
1269
|
codegen?: {
|
|
1297
1270
|
enabled: true;
|
|
@@ -1320,6 +1293,7 @@ export type WabeControllers<T extends WabeTypes> = {
|
|
|
1320
1293
|
database: DatabaseController<T>;
|
|
1321
1294
|
email?: EmailController;
|
|
1322
1295
|
payment?: PaymentController;
|
|
1296
|
+
file?: FileController;
|
|
1323
1297
|
};
|
|
1324
1298
|
export declare class Wabe<T extends WabeTypes> {
|
|
1325
1299
|
server: Wobe<WobeCustomContext<T>>;
|