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 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 = "EmailOTP"
18
+ EmailOTP = "emailOTP"
65
19
  }
66
- export type User = {
67
- id: Scalars["ID"]["output"];
68
- name?: Scalars["String"]["output"];
69
- age?: Scalars["Int"]["output"];
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 UserACLObjectUsersACL = {
87
- userId: Scalars["String"]["output"];
88
- read: Scalars["Boolean"]["output"];
89
- write: Scalars["Boolean"]["output"];
25
+ export type ACLObject = {
26
+ users?: Array<ACLObjectUsersACL>;
27
+ roles?: Array<ACLObjectRolesACL>;
90
28
  };
91
- export type UserACLObjectRolesACL = {
92
- roleId: Scalars["String"]["output"];
93
- read: Scalars["Boolean"]["output"];
94
- write: Scalars["Boolean"]["output"];
29
+ export type ACLObjectRolesACL = {
30
+ roleId: string;
31
+ read: boolean;
32
+ write: boolean;
95
33
  };
96
- export type UserAuthentication = {
97
- phonePassword?: UserAuthenticationPhonePassword;
98
- emailPassword?: UserAuthenticationEmailPassword;
99
- google?: UserAuthenticationGoogle;
100
- github?: UserAuthenticationGithub;
34
+ export type AuthenticationPhonePassword = {
35
+ phone: string;
36
+ password: string;
101
37
  };
102
- export type UserAuthenticationPhonePassword = {
103
- phone: Scalars["Phone"]["output"];
104
- password: Scalars["String"]["output"];
38
+ export type Authentication = {
39
+ phonePassword?: AuthenticationPhonePassword;
40
+ emailPassword?: AuthenticationEmailPassword;
41
+ google?: AuthenticationGoogle;
42
+ github?: AuthenticationGithub;
105
43
  };
106
- export type UserAuthenticationEmailPassword = {
107
- email: Scalars["Email"]["output"];
108
- password: Scalars["String"]["output"];
44
+ export type AuthenticationEmailPassword = {
45
+ email: string;
46
+ password: string;
109
47
  };
110
- export type UserAuthenticationGoogle = {
111
- email: Scalars["Email"]["output"];
112
- verifiedEmail: Scalars["Boolean"]["output"];
48
+ export type AuthenticationGoogle = {
49
+ email: string;
50
+ verifiedEmail: boolean;
113
51
  };
114
- export type UserAuthenticationGithub = {
115
- email: Scalars["Email"]["output"];
116
- avatarUrl: Scalars["String"]["output"];
117
- username: Scalars["String"]["output"];
52
+ export type AuthenticationGithub = {
53
+ email: string;
54
+ avatarUrl: string;
55
+ username: string;
118
56
  };
119
- export type _SessionConnection = {
120
- totalCount?: Scalars["Int"]["output"];
121
- edges?: _SessionEdge[];
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 _SessionEdge = {
124
- node: _Session;
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: Scalars["ID"]["output"];
128
- name: Scalars["String"]["output"];
81
+ id: string;
82
+ name: string;
129
83
  test2?: RoleEnum;
130
- acl?: PostACLObject;
131
- createdAt?: Scalars["Date"]["output"];
132
- updatedAt?: Scalars["Date"]["output"];
133
- search?: Scalars["String"]["output"][];
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"];
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: Scalars["ID"]["output"];
151
- user?: User;
152
- accessToken: Scalars["String"]["output"];
153
- accessTokenExpiresAt: Scalars["Date"]["output"];
154
- refreshToken?: Scalars["String"]["output"];
155
- refreshTokenExpiresAt: Scalars["Date"]["output"];
156
- acl?: _SessionACLObject;
157
- createdAt?: Scalars["Date"]["output"];
158
- updatedAt?: Scalars["Date"]["output"];
159
- search?: Scalars["String"]["output"][];
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: Scalars["ID"]["output"];
177
- name: Scalars["String"]["output"];
178
- users?: UserConnection;
179
- acl?: RoleACLObject;
180
- createdAt?: Scalars["Date"]["output"];
181
- updatedAt?: Scalars["Date"]["output"];
182
- search?: Scalars["String"]["output"][];
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: Scalars["ID"]["output"];
207
- configKey: Scalars["String"]["output"];
208
- configValue: Scalars["String"]["output"];
209
- description?: Scalars["String"]["output"];
210
- acl?: _InternalConfigACLObject;
211
- createdAt?: Scalars["Date"]["output"];
212
- updatedAt?: Scalars["Date"]["output"];
213
- search?: Scalars["String"]["output"][];
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: SignInWithAuthenticationInput;
231
- };
232
- export type SignInWithAuthenticationInput = {
233
- phonePassword?: SignInWithAuthenticationPhonePasswordInput;
234
- emailPassword?: SignInWithAuthenticationEmailPasswordInput;
235
- google?: SignInWithAuthenticationGoogleInput;
236
- github?: SignInWithAuthenticationGithubInput;
237
- otp?: SignInWithAuthenticationOtpInput;
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 SignInWithAuthenticationPhonePasswordInput = {
241
- phone: Scalars["Phone"]["input"];
242
- password: Scalars["String"]["input"];
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 SignInWithAuthenticationGoogleInput = {
249
- authorizationCode: Scalars["String"]["input"];
250
- codeVerifier: Scalars["String"]["input"];
142
+ export type SignInWithAuthenticationGoogle = {
143
+ authorizationCode: string;
144
+ codeVerifier: string;
251
145
  };
252
- export type SignInWithAuthenticationGithubInput = {
253
- authorizationCode: Scalars["String"]["input"];
254
- codeVerifier: Scalars["String"]["input"];
146
+ export type SignInWithAuthenticationGithub = {
147
+ authorizationCode: string;
148
+ codeVerifier: string;
255
149
  };
256
- export type SignInWithAuthenticationOtpInput = {
257
- code?: Scalars["String"]["input"];
150
+ export type SignInWithAuthenticationOtp = {
151
+ code?: string;
258
152
  };
259
153
  export type SignUpWithInput = {
260
- authentication: SignUpWithAuthenticationInput;
261
- };
262
- export type SignUpWithAuthenticationInput = {
263
- phonePassword?: SignUpWithAuthenticationPhonePasswordInput;
264
- emailPassword?: SignUpWithAuthenticationEmailPasswordInput;
265
- google?: SignUpWithAuthenticationGoogleInput;
266
- github?: SignUpWithAuthenticationGithubInput;
267
- otp?: SignUpWithAuthenticationOtpInput;
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 SignUpWithAuthenticationPhonePasswordInput = {
271
- phone: Scalars["Phone"]["input"];
272
- password: Scalars["String"]["input"];
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 SignUpWithAuthenticationGoogleInput = {
279
- authorizationCode: Scalars["String"]["input"];
280
- codeVerifier: Scalars["String"]["input"];
172
+ export type SignUpWithAuthenticationGoogle = {
173
+ authorizationCode: string;
174
+ codeVerifier: string;
281
175
  };
282
- export type SignUpWithAuthenticationGithubInput = {
283
- authorizationCode: Scalars["String"]["input"];
284
- codeVerifier: Scalars["String"]["input"];
176
+ export type SignUpWithAuthenticationGithub = {
177
+ authorizationCode: string;
178
+ codeVerifier: string;
285
179
  };
286
- export type SignUpWithAuthenticationOtpInput = {
287
- code?: Scalars["String"]["input"];
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 Scalars["String"]["output"] | Scalars["Int"]["output"] | Scalars["Boolean"]["output"] | Scalars["Date"]["output"] ? true : false;
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 PointerObject = Record<string, {
470
- pointerClass?: string;
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
- _getPointerObject(className: keyof T["types"], fields: string[], context: WabeContext<T>): PointerFields;
481
- _isRelationField<K extends keyof T["types"]>(originClassName: K, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
482
- _isPointerField<K extends keyof T["types"]>(originClassName: K, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
483
- _getFinalObjectWithPointer<K extends keyof T["types"], U extends keyof T["types"][K]>(objectData: OutputType<T, K, U> | null, pointersObject: PointerObject, originClassName: K, context: WabeContext<T>): Promise<Record<any, any>>;
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]>({ fields, className, context, skipHooks, id, where, }: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
651
- getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, fields, context, where, skipHooks, first, offset, order, }: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
652
- createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, data, fields, }: CreateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
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, fields, className, context, first, offset, order, }: CreateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
654
- updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ id, className, context, data, fields, skipHooks, }: UpdateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
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, fields, data, first, offset, order, skipHooks, }: UpdateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
656
- deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ context, className, id, fields, }: DeleteObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
657
- deleteObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, fields, where, first, offset, order, }: DeleteObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
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, fields, }: {
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
- fields: string[];
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
- fields: Array<keyof T["types"][K]>;
733
- constructor({ newData, className, operationType, context, object, originalObject, fields, }: {
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
- fields: Array<keyof T["types"][K]>;
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>;