wabe 0.6.0 → 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/dist/index.d.ts +180 -275
- package/dist/index.js +620 -508
- package/generated/wabe.ts +239 -1804
- 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,160 @@ 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[];
|
|
85
|
-
};
|
|
86
|
-
export type UserACLObjectUsersACL = {
|
|
87
|
-
userId: Scalars["String"]["output"];
|
|
88
|
-
read: Scalars["Boolean"]["output"];
|
|
89
|
-
write: Scalars["Boolean"]["output"];
|
|
20
|
+
export type ACLObjectUsersACL = {
|
|
21
|
+
userId: string;
|
|
22
|
+
read: boolean;
|
|
23
|
+
write: boolean;
|
|
90
24
|
};
|
|
91
|
-
export type
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
write: Scalars["Boolean"]["output"];
|
|
25
|
+
export type ACLObject = {
|
|
26
|
+
users?: Array<ACLObjectUsersACL>;
|
|
27
|
+
roles?: Array<ACLObjectRolesACL>;
|
|
95
28
|
};
|
|
96
|
-
export type
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
github?: UserAuthenticationGithub;
|
|
29
|
+
export type ACLObjectRolesACL = {
|
|
30
|
+
roleId: string;
|
|
31
|
+
read: boolean;
|
|
32
|
+
write: boolean;
|
|
101
33
|
};
|
|
102
|
-
export type
|
|
103
|
-
phone:
|
|
104
|
-
password:
|
|
34
|
+
export type AuthenticationPhonePassword = {
|
|
35
|
+
phone: string;
|
|
36
|
+
password: string;
|
|
105
37
|
};
|
|
106
|
-
export type
|
|
107
|
-
|
|
108
|
-
|
|
38
|
+
export type Authentication = {
|
|
39
|
+
phonePassword?: AuthenticationPhonePassword;
|
|
40
|
+
emailPassword?: AuthenticationEmailPassword;
|
|
41
|
+
google?: AuthenticationGoogle;
|
|
42
|
+
github?: AuthenticationGithub;
|
|
109
43
|
};
|
|
110
|
-
export type
|
|
111
|
-
email:
|
|
112
|
-
|
|
44
|
+
export type AuthenticationEmailPassword = {
|
|
45
|
+
email: string;
|
|
46
|
+
password: string;
|
|
113
47
|
};
|
|
114
|
-
export type
|
|
115
|
-
email:
|
|
116
|
-
|
|
117
|
-
username: Scalars["String"]["output"];
|
|
48
|
+
export type AuthenticationGoogle = {
|
|
49
|
+
email: string;
|
|
50
|
+
verifiedEmail: boolean;
|
|
118
51
|
};
|
|
119
|
-
export type
|
|
120
|
-
|
|
121
|
-
|
|
52
|
+
export type AuthenticationGithub = {
|
|
53
|
+
email: string;
|
|
54
|
+
avatarUrl: string;
|
|
55
|
+
username: string;
|
|
122
56
|
};
|
|
123
|
-
export type
|
|
124
|
-
|
|
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>;
|
|
125
72
|
};
|
|
126
73
|
export type Post = {
|
|
127
|
-
id:
|
|
128
|
-
name:
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
129
76
|
test2?: RoleEnum;
|
|
130
|
-
acl?:
|
|
131
|
-
createdAt?:
|
|
132
|
-
updatedAt?:
|
|
133
|
-
search?:
|
|
134
|
-
};
|
|
135
|
-
export type PostACLObject = {
|
|
136
|
-
users?: PostACLObjectUsersACL[];
|
|
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"];
|
|
77
|
+
acl?: ACLObject;
|
|
78
|
+
createdAt?: Date;
|
|
79
|
+
updatedAt?: Date;
|
|
80
|
+
search?: Array<string>;
|
|
148
81
|
};
|
|
149
82
|
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"];
|
|
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>;
|
|
174
93
|
};
|
|
175
94
|
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"];
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
users?: Array<string>;
|
|
98
|
+
acl?: ACLObject;
|
|
99
|
+
createdAt?: Date;
|
|
100
|
+
updatedAt?: Date;
|
|
101
|
+
search?: Array<string>;
|
|
204
102
|
};
|
|
205
103
|
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"];
|
|
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>;
|
|
228
112
|
};
|
|
229
113
|
export type SignInWithInput = {
|
|
230
|
-
authentication:
|
|
231
|
-
};
|
|
232
|
-
export type
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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;
|
|
238
126
|
secondaryFactor?: SecondaryFactor;
|
|
239
127
|
};
|
|
240
|
-
export type
|
|
241
|
-
|
|
242
|
-
password:
|
|
243
|
-
};
|
|
244
|
-
export type SignInWithAuthenticationEmailPasswordInput = {
|
|
245
|
-
email: Scalars["Email"]["input"];
|
|
246
|
-
password: Scalars["String"]["input"];
|
|
128
|
+
export type SignInWithAuthenticationEmailPassword = {
|
|
129
|
+
email: string;
|
|
130
|
+
password: string;
|
|
247
131
|
};
|
|
248
|
-
export type
|
|
249
|
-
authorizationCode:
|
|
250
|
-
codeVerifier:
|
|
132
|
+
export type SignInWithAuthenticationGoogle = {
|
|
133
|
+
authorizationCode: string;
|
|
134
|
+
codeVerifier: string;
|
|
251
135
|
};
|
|
252
|
-
export type
|
|
253
|
-
authorizationCode:
|
|
254
|
-
codeVerifier:
|
|
136
|
+
export type SignInWithAuthenticationGithub = {
|
|
137
|
+
authorizationCode: string;
|
|
138
|
+
codeVerifier: string;
|
|
255
139
|
};
|
|
256
|
-
export type
|
|
257
|
-
code?:
|
|
140
|
+
export type SignInWithAuthenticationOtp = {
|
|
141
|
+
code?: string;
|
|
258
142
|
};
|
|
259
143
|
export type SignUpWithInput = {
|
|
260
|
-
authentication:
|
|
261
|
-
};
|
|
262
|
-
export type
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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;
|
|
268
156
|
secondaryFactor?: SecondaryFactor;
|
|
269
157
|
};
|
|
270
|
-
export type
|
|
271
|
-
|
|
272
|
-
password:
|
|
273
|
-
};
|
|
274
|
-
export type SignUpWithAuthenticationEmailPasswordInput = {
|
|
275
|
-
email: Scalars["Email"]["input"];
|
|
276
|
-
password: Scalars["String"]["input"];
|
|
158
|
+
export type SignUpWithAuthenticationEmailPassword = {
|
|
159
|
+
email: string;
|
|
160
|
+
password: string;
|
|
277
161
|
};
|
|
278
|
-
export type
|
|
279
|
-
authorizationCode:
|
|
280
|
-
codeVerifier:
|
|
162
|
+
export type SignUpWithAuthenticationGoogle = {
|
|
163
|
+
authorizationCode: string;
|
|
164
|
+
codeVerifier: string;
|
|
281
165
|
};
|
|
282
|
-
export type
|
|
283
|
-
authorizationCode:
|
|
284
|
-
codeVerifier:
|
|
166
|
+
export type SignUpWithAuthenticationGithub = {
|
|
167
|
+
authorizationCode: string;
|
|
168
|
+
codeVerifier: string;
|
|
285
169
|
};
|
|
286
|
-
export type
|
|
287
|
-
code?:
|
|
170
|
+
export type SignUpWithAuthenticationOtp = {
|
|
171
|
+
code?: string;
|
|
288
172
|
};
|
|
289
173
|
export type WabeSchemaScalars = "";
|
|
290
174
|
export type WabeSchemaEnums = {
|
|
@@ -306,7 +190,9 @@ export interface WabeContext<T extends WabeTypes> {
|
|
|
306
190
|
isRoot: boolean;
|
|
307
191
|
wabe: Wabe<T>;
|
|
308
192
|
}
|
|
309
|
-
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;
|
|
310
196
|
export type ExtractType<T extends WabeTypes, ClassName extends keyof T["types"], FieldName extends keyof T["types"][ClassName]> = T["types"][ClassName][FieldName];
|
|
311
197
|
export type WhereScalar<T> = {
|
|
312
198
|
equalTo?: T;
|
|
@@ -331,7 +217,16 @@ export type WhereConditional<T extends WabeTypes, K extends keyof T["types"]> =
|
|
|
331
217
|
AND?: Array<WhereType<T, K>>;
|
|
332
218
|
};
|
|
333
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
|
+
}>;
|
|
334
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;
|
|
335
230
|
export interface AdapterOptions {
|
|
336
231
|
databaseUrl: string;
|
|
337
232
|
databaseName: string;
|
|
@@ -346,74 +241,71 @@ export interface GetObjectOptions<T extends WabeTypes, K extends keyof T["types"
|
|
|
346
241
|
className: K;
|
|
347
242
|
id: string;
|
|
348
243
|
where?: WhereType<T, K>;
|
|
349
|
-
fields: Array<U | "*">;
|
|
350
244
|
context: WabeContext<any>;
|
|
351
245
|
skipHooks?: boolean;
|
|
246
|
+
select?: SelectType<T, K, U>;
|
|
352
247
|
}
|
|
353
248
|
export interface GetObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
354
249
|
className: K;
|
|
355
250
|
where?: WhereType<T, K>;
|
|
356
251
|
order?: OrderType<T, K, U>;
|
|
357
|
-
fields: Array<W | "*">;
|
|
358
252
|
offset?: number;
|
|
359
253
|
first?: number;
|
|
360
254
|
context: WabeContext<any>;
|
|
361
255
|
skipHooks?: boolean;
|
|
256
|
+
select?: SelectType<T, K, W>;
|
|
362
257
|
}
|
|
363
258
|
export interface CreateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
364
259
|
className: K;
|
|
365
260
|
data: MutationData<T, K, U>;
|
|
366
|
-
fields: Array<W | "*">;
|
|
367
261
|
context: WabeContext<any>;
|
|
262
|
+
select?: SelectType<T, K, W>;
|
|
368
263
|
}
|
|
369
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]> {
|
|
370
265
|
className: K;
|
|
371
266
|
data: Array<MutationData<T, K, U>>;
|
|
372
|
-
fields: Array<W | "*">;
|
|
373
267
|
offset?: number;
|
|
374
268
|
first?: number;
|
|
375
269
|
order?: OrderType<T, U, X>;
|
|
376
270
|
context: WabeContext<any>;
|
|
271
|
+
select?: SelectType<T, K, W>;
|
|
377
272
|
}
|
|
378
273
|
export interface UpdateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
379
274
|
className: K;
|
|
380
275
|
id: string;
|
|
381
276
|
where?: WhereType<T, K>;
|
|
382
277
|
data: MutationData<T, K, U>;
|
|
383
|
-
fields: Array<W | "*">;
|
|
384
278
|
context: WabeContext<any>;
|
|
385
279
|
skipHooks?: boolean;
|
|
280
|
+
select?: SelectType<T, K, W>;
|
|
386
281
|
}
|
|
387
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]> {
|
|
388
283
|
className: K;
|
|
389
284
|
where: WhereType<T, K>;
|
|
390
285
|
order?: OrderType<T, K, X>;
|
|
391
286
|
data: MutationData<T, K, U>;
|
|
392
|
-
fields: Array<W | "*">;
|
|
393
287
|
offset?: number;
|
|
394
288
|
first?: number;
|
|
395
289
|
context: WabeContext<any>;
|
|
396
290
|
skipHooks?: boolean;
|
|
291
|
+
select?: SelectType<T, K, W>;
|
|
397
292
|
}
|
|
398
293
|
export interface DeleteObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> {
|
|
399
294
|
className: K;
|
|
400
295
|
id: string;
|
|
401
296
|
where?: WhereType<T, K>;
|
|
402
|
-
fields: Array<U | "*">;
|
|
403
297
|
context: WabeContext<any>;
|
|
298
|
+
select?: SelectType<T, K, U>;
|
|
404
299
|
}
|
|
405
300
|
export interface DeleteObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
|
|
406
301
|
className: K;
|
|
407
302
|
where: WhereType<T, K>;
|
|
408
303
|
order?: OrderType<T, K, U>;
|
|
409
|
-
fields: Array<W | "*">;
|
|
410
304
|
offset?: number;
|
|
411
305
|
first?: number;
|
|
412
306
|
context: WabeContext<any>;
|
|
307
|
+
select?: SelectType<T, K, W>;
|
|
413
308
|
}
|
|
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
309
|
export interface DatabaseAdapter<T extends WabeTypes> {
|
|
418
310
|
connect(): Promise<any>;
|
|
419
311
|
close(): Promise<any>;
|
|
@@ -466,21 +358,24 @@ export declare class MongoAdapter<T extends WabeTypes> implements DatabaseAdapte
|
|
|
466
358
|
deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: DeleteObjectOptions<T, K, U>): Promise<void>;
|
|
467
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>;
|
|
468
360
|
}
|
|
469
|
-
export type
|
|
470
|
-
|
|
471
|
-
fieldsOfPointerClass: Array<string>;
|
|
472
|
-
}>;
|
|
473
|
-
export interface PointerFields {
|
|
474
|
-
pointersFieldsId: string[];
|
|
475
|
-
pointers: PointerObject;
|
|
476
|
-
}
|
|
361
|
+
export type Select = Record<string, boolean>;
|
|
362
|
+
export type SelectWithObject = Record<string, object | boolean>;
|
|
477
363
|
export declare class DatabaseController<T extends WabeTypes> {
|
|
478
364
|
adapter: DatabaseAdapter<T>;
|
|
479
365
|
constructor(adapter: DatabaseAdapter<T>);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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;
|
|
484
379
|
_getWhereObjectWithPointerOrRelation<U extends keyof T["types"]>(className: U, where: WhereType<T, U>, context: WabeContext<T>): Promise<Partial<{
|
|
485
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 ? {
|
|
486
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 ? {
|
|
@@ -642,19 +537,28 @@ export declare class DatabaseController<T extends WabeTypes> {
|
|
|
642
537
|
AND?: WhereType<T, U>[] | undefined;
|
|
643
538
|
}>;
|
|
644
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>>;
|
|
645
549
|
connect(): Promise<any>;
|
|
646
550
|
close(): Promise<any>;
|
|
647
551
|
createClassIfNotExist(className: string, context: WabeContext<T>): Promise<any>;
|
|
648
552
|
count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
|
|
649
553
|
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,
|
|
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>[]>;
|
|
658
562
|
}
|
|
659
563
|
export declare enum DatabaseEnum {
|
|
660
564
|
Mongo = "mongo"
|
|
@@ -691,10 +595,10 @@ export declare const _findHooksByPriority: <T extends unknown>({ className, oper
|
|
|
691
595
|
priority: number;
|
|
692
596
|
config: WabeConfig<any>;
|
|
693
597
|
}) => Promise<Hook<any, any>[]>;
|
|
694
|
-
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, }: {
|
|
695
599
|
className: K;
|
|
696
600
|
newData?: MutationData<DevWabeTypes, any, any>;
|
|
697
|
-
|
|
601
|
+
select: Select;
|
|
698
602
|
context: WabeContext<any>;
|
|
699
603
|
}) => {
|
|
700
604
|
runOnSingleObject: (options: {
|
|
@@ -729,15 +633,15 @@ declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]
|
|
|
729
633
|
context: WabeContext<T>;
|
|
730
634
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
731
635
|
originalObject: OutputType<T, K, keyof T["types"][K]> | undefined;
|
|
732
|
-
|
|
733
|
-
constructor({ newData, className, operationType, context, object, originalObject,
|
|
636
|
+
select: Array<keyof T["types"][K]>;
|
|
637
|
+
constructor({ newData, className, operationType, context, object, originalObject, select, }: {
|
|
734
638
|
className: K;
|
|
735
639
|
newData?: MutationData<T, K, keyof T["types"][K]>;
|
|
736
640
|
operationType: OperationType;
|
|
737
641
|
context: WabeContext<T>;
|
|
738
642
|
object: OutputType<T, K, keyof T["types"][K]>;
|
|
739
643
|
originalObject?: OutputType<T, K, keyof T["types"][K]>;
|
|
740
|
-
|
|
644
|
+
select: Select;
|
|
741
645
|
});
|
|
742
646
|
getUser(): User | null | undefined;
|
|
743
647
|
isFieldUpdated(field: keyof T["types"][K]): boolean | undefined;
|
|
@@ -1001,6 +905,7 @@ export declare const generateCodegen: ({ schema, path, graphqlSchema, }: {
|
|
|
1001
905
|
}) => Promise<void>;
|
|
1002
906
|
export declare class FileDevAdapter implements FileAdapter {
|
|
1003
907
|
private basePath;
|
|
908
|
+
rootPath: string;
|
|
1004
909
|
constructor(basePath: string);
|
|
1005
910
|
uploadFile(file: File | Blob): Promise<void>;
|
|
1006
911
|
readFile(fileName: string): Promise<string | null>;
|