wabe 0.6.0 → 0.6.2
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/dist/index.d.ts +214 -274
- package/dist/index.js +673 -528
- package/generated/schema.graphql +79 -9
- package/generated/wabe.ts +243 -1805
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,52 +4,6 @@
|
|
|
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"
|
|
@@ -61,230 +15,170 @@ declare enum AuthenticationProvider {
|
|
|
61
15
|
phonePassword = "phonePassword"
|
|
62
16
|
}
|
|
63
17
|
declare enum SecondaryFactor {
|
|
64
|
-
EmailOTP = "
|
|
18
|
+
EmailOTP = "emailOTP"
|
|
65
19
|
}
|
|
66
|
-
export type
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
email?: Scalars["Email"]["output"];
|
|
71
|
-
acl?: UserACLObject;
|
|
72
|
-
createdAt?: Scalars["Date"]["output"];
|
|
73
|
-
updatedAt?: Scalars["Date"]["output"];
|
|
74
|
-
search?: Scalars["String"]["output"][];
|
|
75
|
-
authentication?: UserAuthentication;
|
|
76
|
-
provider?: AuthenticationProvider;
|
|
77
|
-
isOauth?: Scalars["Boolean"]["output"];
|
|
78
|
-
verifiedEmail?: Scalars["Boolean"]["output"];
|
|
79
|
-
role?: Role;
|
|
80
|
-
sessions?: _SessionConnection;
|
|
81
|
-
};
|
|
82
|
-
export type UserACLObject = {
|
|
83
|
-
users?: UserACLObjectUsersACL[];
|
|
84
|
-
roles?: UserACLObjectRolesACL[];
|
|
20
|
+
export type ACLObjectUsersACL = {
|
|
21
|
+
userId: string;
|
|
22
|
+
read: boolean;
|
|
23
|
+
write: boolean;
|
|
85
24
|
};
|
|
86
|
-
export type
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
write: Scalars["Boolean"]["output"];
|
|
25
|
+
export type ACLObject = {
|
|
26
|
+
users?: Array<ACLObjectUsersACL>;
|
|
27
|
+
roles?: Array<ACLObjectRolesACL>;
|
|
90
28
|
};
|
|
91
|
-
export type
|
|
92
|
-
roleId:
|
|
93
|
-
read:
|
|
94
|
-
write:
|
|
29
|
+
export type ACLObjectRolesACL = {
|
|
30
|
+
roleId: string;
|
|
31
|
+
read: boolean;
|
|
32
|
+
write: boolean;
|
|
95
33
|
};
|
|
96
|
-
export type
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
google?: UserAuthenticationGoogle;
|
|
100
|
-
github?: UserAuthenticationGithub;
|
|
34
|
+
export type AuthenticationPhonePassword = {
|
|
35
|
+
phone: string;
|
|
36
|
+
password: string;
|
|
101
37
|
};
|
|
102
|
-
export type
|
|
103
|
-
|
|
104
|
-
|
|
38
|
+
export type Authentication = {
|
|
39
|
+
phonePassword?: AuthenticationPhonePassword;
|
|
40
|
+
emailPassword?: AuthenticationEmailPassword;
|
|
41
|
+
google?: AuthenticationGoogle;
|
|
42
|
+
github?: AuthenticationGithub;
|
|
105
43
|
};
|
|
106
|
-
export type
|
|
107
|
-
email:
|
|
108
|
-
password:
|
|
44
|
+
export type AuthenticationEmailPassword = {
|
|
45
|
+
email: string;
|
|
46
|
+
password: string;
|
|
109
47
|
};
|
|
110
|
-
export type
|
|
111
|
-
email:
|
|
112
|
-
verifiedEmail:
|
|
48
|
+
export type AuthenticationGoogle = {
|
|
49
|
+
email: string;
|
|
50
|
+
verifiedEmail: boolean;
|
|
113
51
|
};
|
|
114
|
-
export type
|
|
115
|
-
email:
|
|
116
|
-
avatarUrl:
|
|
117
|
-
username:
|
|
52
|
+
export type AuthenticationGithub = {
|
|
53
|
+
email: string;
|
|
54
|
+
avatarUrl: string;
|
|
55
|
+
username: string;
|
|
118
56
|
};
|
|
119
|
-
export type
|
|
120
|
-
|
|
121
|
-
|
|
57
|
+
export type User = {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
age?: number;
|
|
61
|
+
email?: string;
|
|
62
|
+
acl?: ACLObject;
|
|
63
|
+
createdAt?: string;
|
|
64
|
+
updatedAt?: string;
|
|
65
|
+
search?: Array<string>;
|
|
66
|
+
authentication?: Authentication;
|
|
67
|
+
provider?: AuthenticationProvider;
|
|
68
|
+
isOauth?: boolean;
|
|
69
|
+
verifiedEmail?: boolean;
|
|
70
|
+
role?: Role;
|
|
71
|
+
sessions?: Array<_Session>;
|
|
122
72
|
};
|
|
123
|
-
export type
|
|
124
|
-
|
|
73
|
+
export type Experience = {
|
|
74
|
+
jobTitle: string;
|
|
75
|
+
companyName: string;
|
|
76
|
+
startDate: string;
|
|
77
|
+
endDate: string;
|
|
78
|
+
achievements?: Array<string>;
|
|
125
79
|
};
|
|
126
80
|
export type Post = {
|
|
127
|
-
id:
|
|
128
|
-
name:
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
129
83
|
test2?: RoleEnum;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
roles?: PostACLObjectRolesACL[];
|
|
138
|
-
};
|
|
139
|
-
export type PostACLObjectUsersACL = {
|
|
140
|
-
userId: Scalars["String"]["output"];
|
|
141
|
-
read: Scalars["Boolean"]["output"];
|
|
142
|
-
write: Scalars["Boolean"]["output"];
|
|
143
|
-
};
|
|
144
|
-
export type PostACLObjectRolesACL = {
|
|
145
|
-
roleId: Scalars["String"]["output"];
|
|
146
|
-
read: Scalars["Boolean"]["output"];
|
|
147
|
-
write: Scalars["Boolean"]["output"];
|
|
84
|
+
test3: Array<User>;
|
|
85
|
+
test4: User;
|
|
86
|
+
experiences?: Array<Experience>;
|
|
87
|
+
acl?: ACLObject;
|
|
88
|
+
createdAt?: string;
|
|
89
|
+
updatedAt?: string;
|
|
90
|
+
search?: Array<string>;
|
|
148
91
|
};
|
|
149
92
|
export type _Session = {
|
|
150
|
-
id:
|
|
151
|
-
user
|
|
152
|
-
accessToken:
|
|
153
|
-
accessTokenExpiresAt:
|
|
154
|
-
refreshToken?:
|
|
155
|
-
refreshTokenExpiresAt:
|
|
156
|
-
acl?:
|
|
157
|
-
createdAt?:
|
|
158
|
-
updatedAt?:
|
|
159
|
-
search?:
|
|
160
|
-
};
|
|
161
|
-
export type _SessionACLObject = {
|
|
162
|
-
users?: _SessionACLObjectUsersACL[];
|
|
163
|
-
roles?: _SessionACLObjectRolesACL[];
|
|
164
|
-
};
|
|
165
|
-
export type _SessionACLObjectUsersACL = {
|
|
166
|
-
userId: Scalars["String"]["output"];
|
|
167
|
-
read: Scalars["Boolean"]["output"];
|
|
168
|
-
write: Scalars["Boolean"]["output"];
|
|
169
|
-
};
|
|
170
|
-
export type _SessionACLObjectRolesACL = {
|
|
171
|
-
roleId: Scalars["String"]["output"];
|
|
172
|
-
read: Scalars["Boolean"]["output"];
|
|
173
|
-
write: Scalars["Boolean"]["output"];
|
|
93
|
+
id: string;
|
|
94
|
+
user: User;
|
|
95
|
+
accessToken: string;
|
|
96
|
+
accessTokenExpiresAt: string;
|
|
97
|
+
refreshToken?: string;
|
|
98
|
+
refreshTokenExpiresAt: string;
|
|
99
|
+
acl?: ACLObject;
|
|
100
|
+
createdAt?: string;
|
|
101
|
+
updatedAt?: string;
|
|
102
|
+
search?: Array<string>;
|
|
174
103
|
};
|
|
175
104
|
export type Role = {
|
|
176
|
-
id:
|
|
177
|
-
name:
|
|
178
|
-
users?:
|
|
179
|
-
acl?:
|
|
180
|
-
createdAt?:
|
|
181
|
-
updatedAt?:
|
|
182
|
-
search?:
|
|
183
|
-
};
|
|
184
|
-
export type UserConnection = {
|
|
185
|
-
totalCount?: Scalars["Int"]["output"];
|
|
186
|
-
edges?: UserEdge[];
|
|
187
|
-
};
|
|
188
|
-
export type UserEdge = {
|
|
189
|
-
node: User;
|
|
190
|
-
};
|
|
191
|
-
export type RoleACLObject = {
|
|
192
|
-
users?: RoleACLObjectUsersACL[];
|
|
193
|
-
roles?: RoleACLObjectRolesACL[];
|
|
194
|
-
};
|
|
195
|
-
export type RoleACLObjectUsersACL = {
|
|
196
|
-
userId: Scalars["String"]["output"];
|
|
197
|
-
read: Scalars["Boolean"]["output"];
|
|
198
|
-
write: Scalars["Boolean"]["output"];
|
|
199
|
-
};
|
|
200
|
-
export type RoleACLObjectRolesACL = {
|
|
201
|
-
roleId: Scalars["String"]["output"];
|
|
202
|
-
read: Scalars["Boolean"]["output"];
|
|
203
|
-
write: Scalars["Boolean"]["output"];
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
users?: Array<User>;
|
|
108
|
+
acl?: ACLObject;
|
|
109
|
+
createdAt?: string;
|
|
110
|
+
updatedAt?: string;
|
|
111
|
+
search?: Array<string>;
|
|
204
112
|
};
|
|
205
113
|
export type _InternalConfig = {
|
|
206
|
-
id:
|
|
207
|
-
configKey:
|
|
208
|
-
configValue:
|
|
209
|
-
description?:
|
|
210
|
-
acl?:
|
|
211
|
-
createdAt?:
|
|
212
|
-
updatedAt?:
|
|
213
|
-
search?:
|
|
214
|
-
};
|
|
215
|
-
export type _InternalConfigACLObject = {
|
|
216
|
-
users?: _InternalConfigACLObjectUsersACL[];
|
|
217
|
-
roles?: _InternalConfigACLObjectRolesACL[];
|
|
218
|
-
};
|
|
219
|
-
export type _InternalConfigACLObjectUsersACL = {
|
|
220
|
-
userId: Scalars["String"]["output"];
|
|
221
|
-
read: Scalars["Boolean"]["output"];
|
|
222
|
-
write: Scalars["Boolean"]["output"];
|
|
223
|
-
};
|
|
224
|
-
export type _InternalConfigACLObjectRolesACL = {
|
|
225
|
-
roleId: Scalars["String"]["output"];
|
|
226
|
-
read: Scalars["Boolean"]["output"];
|
|
227
|
-
write: Scalars["Boolean"]["output"];
|
|
114
|
+
id: string;
|
|
115
|
+
configKey: string;
|
|
116
|
+
configValue: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
acl?: ACLObject;
|
|
119
|
+
createdAt?: string;
|
|
120
|
+
updatedAt?: string;
|
|
121
|
+
search?: Array<string>;
|
|
228
122
|
};
|
|
229
123
|
export type SignInWithInput = {
|
|
230
|
-
authentication:
|
|
231
|
-
};
|
|
232
|
-
export type
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
124
|
+
authentication: SignInWithAuthentication;
|
|
125
|
+
};
|
|
126
|
+
export type SignInWithAuthenticationPhonePassword = {
|
|
127
|
+
phone: string;
|
|
128
|
+
password: string;
|
|
129
|
+
};
|
|
130
|
+
export type SignInWithAuthentication = {
|
|
131
|
+
phonePassword?: SignInWithAuthenticationPhonePassword;
|
|
132
|
+
emailPassword?: SignInWithAuthenticationEmailPassword;
|
|
133
|
+
google?: SignInWithAuthenticationGoogle;
|
|
134
|
+
github?: SignInWithAuthenticationGithub;
|
|
135
|
+
otp?: SignInWithAuthenticationOtp;
|
|
238
136
|
secondaryFactor?: SecondaryFactor;
|
|
239
137
|
};
|
|
240
|
-
export type
|
|
241
|
-
|
|
242
|
-
password:
|
|
243
|
-
};
|
|
244
|
-
export type SignInWithAuthenticationEmailPasswordInput = {
|
|
245
|
-
email: Scalars["Email"]["input"];
|
|
246
|
-
password: Scalars["String"]["input"];
|
|
138
|
+
export type SignInWithAuthenticationEmailPassword = {
|
|
139
|
+
email: string;
|
|
140
|
+
password: string;
|
|
247
141
|
};
|
|
248
|
-
export type
|
|
249
|
-
authorizationCode:
|
|
250
|
-
codeVerifier:
|
|
142
|
+
export type SignInWithAuthenticationGoogle = {
|
|
143
|
+
authorizationCode: string;
|
|
144
|
+
codeVerifier: string;
|
|
251
145
|
};
|
|
252
|
-
export type
|
|
253
|
-
authorizationCode:
|
|
254
|
-
codeVerifier:
|
|
146
|
+
export type SignInWithAuthenticationGithub = {
|
|
147
|
+
authorizationCode: string;
|
|
148
|
+
codeVerifier: string;
|
|
255
149
|
};
|
|
256
|
-
export type
|
|
257
|
-
code?:
|
|
150
|
+
export type SignInWithAuthenticationOtp = {
|
|
151
|
+
code?: string;
|
|
258
152
|
};
|
|
259
153
|
export type SignUpWithInput = {
|
|
260
|
-
authentication:
|
|
261
|
-
};
|
|
262
|
-
export type
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
154
|
+
authentication: SignUpWithAuthentication;
|
|
155
|
+
};
|
|
156
|
+
export type SignUpWithAuthenticationPhonePassword = {
|
|
157
|
+
phone: string;
|
|
158
|
+
password: string;
|
|
159
|
+
};
|
|
160
|
+
export type SignUpWithAuthentication = {
|
|
161
|
+
phonePassword?: SignUpWithAuthenticationPhonePassword;
|
|
162
|
+
emailPassword?: SignUpWithAuthenticationEmailPassword;
|
|
163
|
+
google?: SignUpWithAuthenticationGoogle;
|
|
164
|
+
github?: SignUpWithAuthenticationGithub;
|
|
165
|
+
otp?: SignUpWithAuthenticationOtp;
|
|
268
166
|
secondaryFactor?: SecondaryFactor;
|
|
269
167
|
};
|
|
270
|
-
export type
|
|
271
|
-
|
|
272
|
-
password:
|
|
273
|
-
};
|
|
274
|
-
export type SignUpWithAuthenticationEmailPasswordInput = {
|
|
275
|
-
email: Scalars["Email"]["input"];
|
|
276
|
-
password: Scalars["String"]["input"];
|
|
168
|
+
export type SignUpWithAuthenticationEmailPassword = {
|
|
169
|
+
email: string;
|
|
170
|
+
password: string;
|
|
277
171
|
};
|
|
278
|
-
export type
|
|
279
|
-
authorizationCode:
|
|
280
|
-
codeVerifier:
|
|
172
|
+
export type SignUpWithAuthenticationGoogle = {
|
|
173
|
+
authorizationCode: string;
|
|
174
|
+
codeVerifier: string;
|
|
281
175
|
};
|
|
282
|
-
export type
|
|
283
|
-
authorizationCode:
|
|
284
|
-
codeVerifier:
|
|
176
|
+
export type SignUpWithAuthenticationGithub = {
|
|
177
|
+
authorizationCode: string;
|
|
178
|
+
codeVerifier: string;
|
|
285
179
|
};
|
|
286
|
-
export type
|
|
287
|
-
code?:
|
|
180
|
+
export type SignUpWithAuthenticationOtp = {
|
|
181
|
+
code?: string;
|
|
288
182
|
};
|
|
289
183
|
export type WabeSchemaScalars = "";
|
|
290
184
|
export type WabeSchemaEnums = {
|
|
@@ -306,7 +200,9 @@ export interface WabeContext<T extends WabeTypes> {
|
|
|
306
200
|
isRoot: boolean;
|
|
307
201
|
wabe: Wabe<T>;
|
|
308
202
|
}
|
|
309
|
-
export type IsScalar<T> = T extends
|
|
203
|
+
export type IsScalar<T> = T extends string | number | boolean ? true : false;
|
|
204
|
+
export type IsArray<T> = T extends Array<any> ? true : false;
|
|
205
|
+
export type IsObject<T, K extends WabeTypes> = T extends object ? T extends K["types"][keyof K["types"]] ? false : true : false;
|
|
310
206
|
export type ExtractType<T extends WabeTypes, ClassName extends keyof T["types"], FieldName extends keyof T["types"][ClassName]> = T["types"][ClassName][FieldName];
|
|
311
207
|
export type WhereScalar<T> = {
|
|
312
208
|
equalTo?: T;
|
|
@@ -331,7 +227,32 @@ export type WhereConditional<T extends WabeTypes, K extends keyof T["types"]> =
|
|
|
331
227
|
AND?: Array<WhereType<T, K>>;
|
|
332
228
|
};
|
|
333
229
|
export type WhereType<T extends WabeTypes, K extends keyof T["types"]> = Partial<WhereAggregation<T, K>> & WhereConditional<T, K>;
|
|
230
|
+
export type SelectObject<T, K extends WabeTypes, Depth extends number = 3> = {
|
|
231
|
+
[P in keyof T]: IsScalar<T[P]> extends true ? boolean : IsArray<T[P]> extends true ? T[P] extends Array<infer Item> ? (Depth extends 0 ? boolean : SelectObject<Partial<Item>, K, Decrement<Depth>>) | boolean : boolean : IsObject<[
|
|
232
|
+
P
|
|
233
|
+
], K> extends true ? (Depth extends 0 ? boolean : SelectObject<Partial<T[P]>, K, Decrement<Depth>>) | boolean : boolean;
|
|
234
|
+
};
|
|
235
|
+
export type Decrement<N extends number> = [
|
|
236
|
+
-1,
|
|
237
|
+
0,
|
|
238
|
+
1,
|
|
239
|
+
2,
|
|
240
|
+
3,
|
|
241
|
+
4,
|
|
242
|
+
5,
|
|
243
|
+
6,
|
|
244
|
+
7,
|
|
245
|
+
8,
|
|
246
|
+
9,
|
|
247
|
+
10
|
|
248
|
+
][N];
|
|
249
|
+
export type SelectType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], Depth extends number = 3> = Partial<{
|
|
250
|
+
[P in U]: IsScalar<ExtractType<T, K, P>> extends true ? boolean : IsArray<ExtractType<T, K, P>> extends true ? ExtractType<T, K, P> extends Array<infer Item> ? (Depth extends 0 ? boolean : SelectObject<Partial<Item>, T, Decrement<Depth>>) | boolean : boolean : ExtractType<T, K, P> extends object ? (Depth extends 0 ? boolean : SelectObject<Partial<ExtractType<T, K, P>>, T, Decrement<Depth>>) | boolean : boolean;
|
|
251
|
+
}>;
|
|
334
252
|
export type OrderType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = Record<U, "ASC" | "DESC">;
|
|
253
|
+
export type OutputType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = (Pick<T["types"][K], U> & {
|
|
254
|
+
id: string;
|
|
255
|
+
}) | null;
|
|
335
256
|
export interface AdapterOptions {
|
|
336
257
|
databaseUrl: string;
|
|
337
258
|
databaseName: string;
|
|
@@ -346,74 +267,79 @@ export interface GetObjectOptions<T extends WabeTypes, K extends keyof T["types"
|
|
|
346
267
|
className: K;
|
|
347
268
|
id: string;
|
|
348
269
|
where?: WhereType<T, K>;
|
|
349
|
-
fields: Array<U | "*">;
|
|
350
270
|
context: WabeContext<any>;
|
|
351
271
|
skipHooks?: boolean;
|
|
272
|
+
select?: SelectType<T, K, U>;
|
|
273
|
+
isGraphQLCall?: boolean;
|
|
352
274
|
}
|
|
353
275
|
export interface GetObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
354
276
|
className: K;
|
|
355
277
|
where?: WhereType<T, K>;
|
|
356
278
|
order?: OrderType<T, K, U>;
|
|
357
|
-
fields: Array<W | "*">;
|
|
358
279
|
offset?: number;
|
|
359
280
|
first?: number;
|
|
360
281
|
context: WabeContext<any>;
|
|
361
282
|
skipHooks?: boolean;
|
|
283
|
+
select?: SelectType<T, K, W>;
|
|
284
|
+
isGraphQLCall?: boolean;
|
|
362
285
|
}
|
|
363
286
|
export interface CreateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
364
287
|
className: K;
|
|
365
288
|
data: MutationData<T, K, U>;
|
|
366
|
-
fields: Array<W | "*">;
|
|
367
289
|
context: WabeContext<any>;
|
|
290
|
+
select?: SelectType<T, K, W>;
|
|
291
|
+
isGraphQLCall?: boolean;
|
|
368
292
|
}
|
|
369
293
|
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]> {
|
|
370
294
|
className: K;
|
|
371
295
|
data: Array<MutationData<T, K, U>>;
|
|
372
|
-
fields: Array<W | "*">;
|
|
373
296
|
offset?: number;
|
|
374
297
|
first?: number;
|
|
375
298
|
order?: OrderType<T, U, X>;
|
|
376
299
|
context: WabeContext<any>;
|
|
300
|
+
select?: SelectType<T, K, W>;
|
|
301
|
+
isGraphQLCall?: boolean;
|
|
377
302
|
}
|
|
378
303
|
export interface UpdateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
379
304
|
className: K;
|
|
380
305
|
id: string;
|
|
381
306
|
where?: WhereType<T, K>;
|
|
382
307
|
data: MutationData<T, K, U>;
|
|
383
|
-
fields: Array<W | "*">;
|
|
384
308
|
context: WabeContext<any>;
|
|
385
309
|
skipHooks?: boolean;
|
|
310
|
+
select?: SelectType<T, K, W>;
|
|
311
|
+
isGraphQLCall?: boolean;
|
|
386
312
|
}
|
|
387
313
|
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]> {
|
|
388
314
|
className: K;
|
|
389
315
|
where: WhereType<T, K>;
|
|
390
316
|
order?: OrderType<T, K, X>;
|
|
391
317
|
data: MutationData<T, K, U>;
|
|
392
|
-
fields: Array<W | "*">;
|
|
393
318
|
offset?: number;
|
|
394
319
|
first?: number;
|
|
395
320
|
context: WabeContext<any>;
|
|
396
321
|
skipHooks?: boolean;
|
|
322
|
+
select?: SelectType<T, K, W>;
|
|
323
|
+
isGraphQLCall?: boolean;
|
|
397
324
|
}
|
|
398
325
|
export interface DeleteObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> {
|
|
399
326
|
className: K;
|
|
400
327
|
id: string;
|
|
401
328
|
where?: WhereType<T, K>;
|
|
402
|
-
fields: Array<U | "*">;
|
|
403
329
|
context: WabeContext<any>;
|
|
330
|
+
select?: SelectType<T, K, U>;
|
|
331
|
+
isGraphQLCall?: boolean;
|
|
404
332
|
}
|
|
405
333
|
export interface DeleteObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
406
334
|
className: K;
|
|
407
335
|
where: WhereType<T, K>;
|
|
408
336
|
order?: OrderType<T, K, U>;
|
|
409
|
-
fields: Array<W | "*">;
|
|
410
337
|
offset?: number;
|
|
411
338
|
first?: number;
|
|
412
339
|
context: WabeContext<any>;
|
|
340
|
+
select?: SelectType<T, K, W>;
|
|
341
|
+
isGraphQLCall?: boolean;
|
|
413
342
|
}
|
|
414
|
-
export type OutputType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = (Pick<T["types"][K], U> & {
|
|
415
|
-
id: string;
|
|
416
|
-
}) | null;
|
|
417
343
|
export interface DatabaseAdapter<T extends WabeTypes> {
|
|
418
344
|
connect(): Promise<any>;
|
|
419
345
|
close(): Promise<any>;
|
|
@@ -466,21 +392,24 @@ export declare class MongoAdapter<T extends WabeTypes> implements DatabaseAdapte
|
|
|
466
392
|
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: DeleteObjectOptions<T, K, U>): Promise<void>;
|
|
467
393
|
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>;
|
|
468
394
|
}
|
|
469
|
-
export type
|
|
470
|
-
|
|
471
|
-
fieldsOfPointerClass: Array<string>;
|
|
472
|
-
}>;
|
|
473
|
-
export interface PointerFields {
|
|
474
|
-
pointersFieldsId: string[];
|
|
475
|
-
pointers: PointerObject;
|
|
476
|
-
}
|
|
395
|
+
export type Select = Record<string, boolean>;
|
|
396
|
+
export type SelectWithObject = Record<string, object | boolean>;
|
|
477
397
|
export declare class DatabaseController<T extends WabeTypes> {
|
|
478
398
|
adapter: DatabaseAdapter<T>;
|
|
479
399
|
constructor(adapter: DatabaseAdapter<T>);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
400
|
+
_getSelectMinusPointersAndRelations({ className, context, select, }: {
|
|
401
|
+
className: keyof T["types"];
|
|
402
|
+
context: WabeContext<T>;
|
|
403
|
+
select?: SelectWithObject;
|
|
404
|
+
}): {
|
|
405
|
+
pointers: Record<string, {
|
|
406
|
+
className: string;
|
|
407
|
+
select: Select;
|
|
408
|
+
}>;
|
|
409
|
+
selectWithoutPointers: Select;
|
|
410
|
+
};
|
|
411
|
+
_isRelationField(originClassName: string, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
|
|
412
|
+
_isPointerField(originClassName: string, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
|
|
484
413
|
_getWhereObjectWithPointerOrRelation<U extends keyof T["types"]>(className: U, where: WhereType<T, U>, context: WabeContext<T>): Promise<Partial<{
|
|
485
414
|
[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 ? {
|
|
486
415
|
[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 ? {
|
|
@@ -642,19 +571,29 @@ export declare class DatabaseController<T extends WabeTypes> {
|
|
|
642
571
|
AND?: WhereType<T, U>[] | undefined;
|
|
643
572
|
}>;
|
|
644
573
|
_buildWhereWithACL<K extends keyof T["types"]>(where: WhereType<T, K>, context: WabeContext<T>, operation: "write" | "read"): WhereType<T, K>;
|
|
574
|
+
_getFinalObjectWithPointerAndRelation({ pointers, context, originClassName, object, isGraphQLCall, }: {
|
|
575
|
+
originClassName: string;
|
|
576
|
+
pointers: Record<string, {
|
|
577
|
+
className: string;
|
|
578
|
+
select: Select;
|
|
579
|
+
}>;
|
|
580
|
+
context: WabeContext<any>;
|
|
581
|
+
object: Record<string, any>;
|
|
582
|
+
isGraphQLCall?: boolean;
|
|
583
|
+
}): Promise<Record<string, any>>;
|
|
645
584
|
connect(): Promise<any>;
|
|
646
585
|
close(): Promise<any>;
|
|
647
586
|
createClassIfNotExist(className: string, context: WabeContext<T>): Promise<any>;
|
|
648
587
|
count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
|
|
649
588
|
clearDatabase(): Promise<void>;
|
|
650
|
-
getObject<K extends keyof T["types"], U extends keyof T["types"][K]>({
|
|
651
|
-
getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className,
|
|
652
|
-
createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, data,
|
|
653
|
-
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,
|
|
654
|
-
updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ id, className, context, data,
|
|
655
|
-
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,
|
|
656
|
-
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ context, className, id,
|
|
657
|
-
deleteObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context,
|
|
589
|
+
getObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ select, className, context, skipHooks, id, where, isGraphQLCall, }: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
|
|
590
|
+
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, isGraphQLCall, }: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
|
|
591
|
+
createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, data, select, isGraphQLCall, }: CreateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
|
|
592
|
+
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, isGraphQLCall, }: CreateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
|
|
593
|
+
updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ id, className, context, data, select, skipHooks, isGraphQLCall, }: UpdateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
|
|
594
|
+
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, isGraphQLCall, }: UpdateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
|
|
595
|
+
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ context, className, id, select, isGraphQLCall, }: DeleteObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
|
|
596
|
+
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, isGraphQLCall, }: DeleteObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
|
|
658
597
|
}
|
|
659
598
|
export declare enum DatabaseEnum {
|
|
660
599
|
Mongo = "mongo"
|
|
@@ -691,10 +630,10 @@ export declare const _findHooksByPriority: <T extends unknown>({ className, oper
|
|
|
691
630
|
priority: number;
|
|
692
631
|
config: WabeConfig<any>;
|
|
693
632
|
}) => Promise<Hook<any, any>[]>;
|
|
694
|
-
export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context,
|
|
633
|
+
export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context, select, }: {
|
|
695
634
|
className: K;
|
|
696
635
|
newData?: MutationData<DevWabeTypes, any, any>;
|
|
697
|
-
|
|
636
|
+
select: Select;
|
|
698
637
|
context: WabeContext<any>;
|
|
699
638
|
}) => {
|
|
700
639
|
runOnSingleObject: (options: {
|
|
@@ -729,15 +668,15 @@ declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]
|
|
|
729
668
|
context: WabeContext<T>;
|
|
730
669
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
731
670
|
originalObject: OutputType<T, K, keyof T["types"][K]> | undefined;
|
|
732
|
-
|
|
733
|
-
constructor({ newData, className, operationType, context, object, originalObject,
|
|
671
|
+
select: Array<keyof T["types"][K]>;
|
|
672
|
+
constructor({ newData, className, operationType, context, object, originalObject, select, }: {
|
|
734
673
|
className: K;
|
|
735
674
|
newData?: MutationData<T, K, keyof T["types"][K]>;
|
|
736
675
|
operationType: OperationType;
|
|
737
676
|
context: WabeContext<T>;
|
|
738
677
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
739
678
|
originalObject?: OutputType<T, K, keyof T["types"][K]>;
|
|
740
|
-
|
|
679
|
+
select: Select;
|
|
741
680
|
});
|
|
742
681
|
getUser(): User | null | undefined;
|
|
743
682
|
isFieldUpdated(field: keyof T["types"][K]): boolean | undefined;
|
|
@@ -1001,6 +940,7 @@ export declare const generateCodegen: ({ schema, path, graphqlSchema, }: {
|
|
|
1001
940
|
}) => Promise<void>;
|
|
1002
941
|
export declare class FileDevAdapter implements FileAdapter {
|
|
1003
942
|
private basePath;
|
|
943
|
+
rootPath: string;
|
|
1004
944
|
constructor(basePath: string);
|
|
1005
945
|
uploadFile(file: File | Blob): Promise<void>;
|
|
1006
946
|
readFile(fileName: string): Promise<string | null>;
|