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 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 = "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[];
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 UserACLObjectRolesACL = {
92
- roleId: Scalars["String"]["output"];
93
- read: Scalars["Boolean"]["output"];
94
- write: Scalars["Boolean"]["output"];
25
+ export type ACLObject = {
26
+ users?: Array<ACLObjectUsersACL>;
27
+ roles?: Array<ACLObjectRolesACL>;
95
28
  };
96
- export type UserAuthentication = {
97
- phonePassword?: UserAuthenticationPhonePassword;
98
- emailPassword?: UserAuthenticationEmailPassword;
99
- google?: UserAuthenticationGoogle;
100
- github?: UserAuthenticationGithub;
29
+ export type ACLObjectRolesACL = {
30
+ roleId: string;
31
+ read: boolean;
32
+ write: boolean;
101
33
  };
102
- export type UserAuthenticationPhonePassword = {
103
- phone: Scalars["Phone"]["output"];
104
- password: Scalars["String"]["output"];
34
+ export type AuthenticationPhonePassword = {
35
+ phone: string;
36
+ password: string;
105
37
  };
106
- export type UserAuthenticationEmailPassword = {
107
- email: Scalars["Email"]["output"];
108
- password: Scalars["String"]["output"];
38
+ export type Authentication = {
39
+ phonePassword?: AuthenticationPhonePassword;
40
+ emailPassword?: AuthenticationEmailPassword;
41
+ google?: AuthenticationGoogle;
42
+ github?: AuthenticationGithub;
109
43
  };
110
- export type UserAuthenticationGoogle = {
111
- email: Scalars["Email"]["output"];
112
- verifiedEmail: Scalars["Boolean"]["output"];
44
+ export type AuthenticationEmailPassword = {
45
+ email: string;
46
+ password: string;
113
47
  };
114
- export type UserAuthenticationGithub = {
115
- email: Scalars["Email"]["output"];
116
- avatarUrl: Scalars["String"]["output"];
117
- username: Scalars["String"]["output"];
48
+ export type AuthenticationGoogle = {
49
+ email: string;
50
+ verifiedEmail: boolean;
118
51
  };
119
- export type _SessionConnection = {
120
- totalCount?: Scalars["Int"]["output"];
121
- edges?: _SessionEdge[];
52
+ export type AuthenticationGithub = {
53
+ email: string;
54
+ avatarUrl: string;
55
+ username: string;
122
56
  };
123
- export type _SessionEdge = {
124
- node: _Session;
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: Scalars["ID"]["output"];
128
- name: Scalars["String"]["output"];
74
+ id: string;
75
+ name: string;
129
76
  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"];
77
+ acl?: ACLObject;
78
+ createdAt?: Date;
79
+ updatedAt?: Date;
80
+ search?: Array<string>;
148
81
  };
149
82
  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"];
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: 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"];
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: 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"];
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: SignInWithAuthenticationInput;
231
- };
232
- export type SignInWithAuthenticationInput = {
233
- phonePassword?: SignInWithAuthenticationPhonePasswordInput;
234
- emailPassword?: SignInWithAuthenticationEmailPasswordInput;
235
- google?: SignInWithAuthenticationGoogleInput;
236
- github?: SignInWithAuthenticationGithubInput;
237
- otp?: SignInWithAuthenticationOtpInput;
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 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"];
128
+ export type SignInWithAuthenticationEmailPassword = {
129
+ email: string;
130
+ password: string;
247
131
  };
248
- export type SignInWithAuthenticationGoogleInput = {
249
- authorizationCode: Scalars["String"]["input"];
250
- codeVerifier: Scalars["String"]["input"];
132
+ export type SignInWithAuthenticationGoogle = {
133
+ authorizationCode: string;
134
+ codeVerifier: string;
251
135
  };
252
- export type SignInWithAuthenticationGithubInput = {
253
- authorizationCode: Scalars["String"]["input"];
254
- codeVerifier: Scalars["String"]["input"];
136
+ export type SignInWithAuthenticationGithub = {
137
+ authorizationCode: string;
138
+ codeVerifier: string;
255
139
  };
256
- export type SignInWithAuthenticationOtpInput = {
257
- code?: Scalars["String"]["input"];
140
+ export type SignInWithAuthenticationOtp = {
141
+ code?: string;
258
142
  };
259
143
  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;
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 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"];
158
+ export type SignUpWithAuthenticationEmailPassword = {
159
+ email: string;
160
+ password: string;
277
161
  };
278
- export type SignUpWithAuthenticationGoogleInput = {
279
- authorizationCode: Scalars["String"]["input"];
280
- codeVerifier: Scalars["String"]["input"];
162
+ export type SignUpWithAuthenticationGoogle = {
163
+ authorizationCode: string;
164
+ codeVerifier: string;
281
165
  };
282
- export type SignUpWithAuthenticationGithubInput = {
283
- authorizationCode: Scalars["String"]["input"];
284
- codeVerifier: Scalars["String"]["input"];
166
+ export type SignUpWithAuthenticationGithub = {
167
+ authorizationCode: string;
168
+ codeVerifier: string;
285
169
  };
286
- export type SignUpWithAuthenticationOtpInput = {
287
- code?: Scalars["String"]["input"];
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 Scalars["String"]["output"] | Scalars["Int"]["output"] | Scalars["Boolean"]["output"] | Scalars["Date"]["output"] ? true : false;
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 PointerObject = Record<string, {
470
- pointerClass?: string;
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
- _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>>;
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]>({ 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>[]>;
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, fields, }: {
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
- fields: string[];
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
- fields: Array<keyof T["types"][K]>;
733
- constructor({ newData, className, operationType, context, object, originalObject, fields, }: {
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
- fields: Array<keyof T["types"][K]>;
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>;