wabe 0.6.1 → 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
@@ -60,44 +60,54 @@ export type User = {
60
60
  age?: number;
61
61
  email?: string;
62
62
  acl?: ACLObject;
63
- createdAt?: Date;
64
- updatedAt?: Date;
63
+ createdAt?: string;
64
+ updatedAt?: string;
65
65
  search?: Array<string>;
66
66
  authentication?: Authentication;
67
67
  provider?: AuthenticationProvider;
68
68
  isOauth?: boolean;
69
69
  verifiedEmail?: boolean;
70
70
  role?: Role;
71
- sessions?: Array<string>;
71
+ sessions?: Array<_Session>;
72
+ };
73
+ export type Experience = {
74
+ jobTitle: string;
75
+ companyName: string;
76
+ startDate: string;
77
+ endDate: string;
78
+ achievements?: Array<string>;
72
79
  };
73
80
  export type Post = {
74
81
  id: string;
75
82
  name: string;
76
83
  test2?: RoleEnum;
84
+ test3: Array<User>;
85
+ test4: User;
86
+ experiences?: Array<Experience>;
77
87
  acl?: ACLObject;
78
- createdAt?: Date;
79
- updatedAt?: Date;
88
+ createdAt?: string;
89
+ updatedAt?: string;
80
90
  search?: Array<string>;
81
91
  };
82
92
  export type _Session = {
83
93
  id: string;
84
94
  user: User;
85
95
  accessToken: string;
86
- accessTokenExpiresAt: Date;
96
+ accessTokenExpiresAt: string;
87
97
  refreshToken?: string;
88
- refreshTokenExpiresAt: Date;
98
+ refreshTokenExpiresAt: string;
89
99
  acl?: ACLObject;
90
- createdAt?: Date;
91
- updatedAt?: Date;
100
+ createdAt?: string;
101
+ updatedAt?: string;
92
102
  search?: Array<string>;
93
103
  };
94
104
  export type Role = {
95
105
  id: string;
96
106
  name: string;
97
- users?: Array<string>;
107
+ users?: Array<User>;
98
108
  acl?: ACLObject;
99
- createdAt?: Date;
100
- updatedAt?: Date;
109
+ createdAt?: string;
110
+ updatedAt?: string;
101
111
  search?: Array<string>;
102
112
  };
103
113
  export type _InternalConfig = {
@@ -106,8 +116,8 @@ export type _InternalConfig = {
106
116
  configValue: string;
107
117
  description?: string;
108
118
  acl?: ACLObject;
109
- createdAt?: Date;
110
- updatedAt?: Date;
119
+ createdAt?: string;
120
+ updatedAt?: string;
111
121
  search?: Array<string>;
112
122
  };
113
123
  export type SignInWithInput = {
@@ -217,11 +227,27 @@ export type WhereConditional<T extends WabeTypes, K extends keyof T["types"]> =
217
227
  AND?: Array<WhereType<T, K>>;
218
228
  };
219
229
  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;
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;
225
251
  }>;
226
252
  export type OrderType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = Record<U, "ASC" | "DESC">;
227
253
  export type OutputType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = (Pick<T["types"][K], U> & {
@@ -244,6 +270,7 @@ export interface GetObjectOptions<T extends WabeTypes, K extends keyof T["types"
244
270
  context: WabeContext<any>;
245
271
  skipHooks?: boolean;
246
272
  select?: SelectType<T, K, U>;
273
+ isGraphQLCall?: boolean;
247
274
  }
248
275
  export interface GetObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
249
276
  className: K;
@@ -254,12 +281,14 @@ export interface GetObjectsOptions<T extends WabeTypes, K extends keyof T["types
254
281
  context: WabeContext<any>;
255
282
  skipHooks?: boolean;
256
283
  select?: SelectType<T, K, W>;
284
+ isGraphQLCall?: boolean;
257
285
  }
258
286
  export interface CreateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
259
287
  className: K;
260
288
  data: MutationData<T, K, U>;
261
289
  context: WabeContext<any>;
262
290
  select?: SelectType<T, K, W>;
291
+ isGraphQLCall?: boolean;
263
292
  }
264
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]> {
265
294
  className: K;
@@ -269,6 +298,7 @@ export interface CreateObjectsOptions<T extends WabeTypes, K extends keyof T["ty
269
298
  order?: OrderType<T, U, X>;
270
299
  context: WabeContext<any>;
271
300
  select?: SelectType<T, K, W>;
301
+ isGraphQLCall?: boolean;
272
302
  }
273
303
  export interface UpdateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
274
304
  className: K;
@@ -278,6 +308,7 @@ export interface UpdateObjectOptions<T extends WabeTypes, K extends keyof T["typ
278
308
  context: WabeContext<any>;
279
309
  skipHooks?: boolean;
280
310
  select?: SelectType<T, K, W>;
311
+ isGraphQLCall?: boolean;
281
312
  }
282
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]> {
283
314
  className: K;
@@ -289,6 +320,7 @@ export interface UpdateObjectsOptions<T extends WabeTypes, K extends keyof T["ty
289
320
  context: WabeContext<any>;
290
321
  skipHooks?: boolean;
291
322
  select?: SelectType<T, K, W>;
323
+ isGraphQLCall?: boolean;
292
324
  }
293
325
  export interface DeleteObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> {
294
326
  className: K;
@@ -296,6 +328,7 @@ export interface DeleteObjectOptions<T extends WabeTypes, K extends keyof T["typ
296
328
  where?: WhereType<T, K>;
297
329
  context: WabeContext<any>;
298
330
  select?: SelectType<T, K, U>;
331
+ isGraphQLCall?: boolean;
299
332
  }
300
333
  export interface DeleteObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
301
334
  className: K;
@@ -305,6 +338,7 @@ export interface DeleteObjectsOptions<T extends WabeTypes, K extends keyof T["ty
305
338
  first?: number;
306
339
  context: WabeContext<any>;
307
340
  select?: SelectType<T, K, W>;
341
+ isGraphQLCall?: boolean;
308
342
  }
309
343
  export interface DatabaseAdapter<T extends WabeTypes> {
310
344
  connect(): Promise<any>;
@@ -537,7 +571,7 @@ export declare class DatabaseController<T extends WabeTypes> {
537
571
  AND?: WhereType<T, U>[] | undefined;
538
572
  }>;
539
573
  _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, }: {
574
+ _getFinalObjectWithPointerAndRelation({ pointers, context, originClassName, object, isGraphQLCall, }: {
541
575
  originClassName: string;
542
576
  pointers: Record<string, {
543
577
  className: string;
@@ -545,20 +579,21 @@ export declare class DatabaseController<T extends WabeTypes> {
545
579
  }>;
546
580
  context: WabeContext<any>;
547
581
  object: Record<string, any>;
582
+ isGraphQLCall?: boolean;
548
583
  }): Promise<Record<string, any>>;
549
584
  connect(): Promise<any>;
550
585
  close(): Promise<any>;
551
586
  createClassIfNotExist(className: string, context: WabeContext<T>): Promise<any>;
552
587
  count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
553
588
  clearDatabase(): Promise<void>;
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>[]>;
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>[]>;
562
597
  }
563
598
  export declare enum DatabaseEnum {
564
599
  Mongo = "mongo"
package/dist/index.js CHANGED
@@ -62406,11 +62406,12 @@ class DatabaseController2 {
62406
62406
  ].filter(notEmpty)
62407
62407
  };
62408
62408
  }
62409
- async _getFinalObjectWithPointerAndRelation({
62409
+ _getFinalObjectWithPointerAndRelation({
62410
62410
  pointers,
62411
62411
  context,
62412
62412
  originClassName,
62413
- object
62413
+ object,
62414
+ isGraphQLCall
62414
62415
  }) {
62415
62416
  return Object.entries(pointers).reduce(async (acc, [pointerField, { className: currentClassName, select: currentSelect }]) => {
62416
62417
  const accObject = await acc;
@@ -62444,12 +62445,12 @@ class DatabaseController2 {
62444
62445
  });
62445
62446
  return {
62446
62447
  ...acc,
62447
- [pointerField]: {
62448
+ [pointerField]: isGraphQLCall ? {
62448
62449
  totalCount: relationObjects.length,
62449
62450
  edges: relationObjects.map((object2) => ({
62450
62451
  node: object2
62451
62452
  }))
62452
- }
62453
+ } : relationObjects
62453
62454
  };
62454
62455
  }
62455
62456
  return accObject;
@@ -62476,7 +62477,8 @@ class DatabaseController2 {
62476
62477
  context,
62477
62478
  skipHooks,
62478
62479
  id,
62479
- where
62480
+ where,
62481
+ isGraphQLCall = false
62480
62482
  }) {
62481
62483
  const { pointers, selectWithoutPointers } = this._getSelectMinusPointersAndRelations({
62482
62484
  className,
@@ -62515,7 +62517,8 @@ class DatabaseController2 {
62515
62517
  context,
62516
62518
  originClassName: className,
62517
62519
  pointers,
62518
- object: objectToReturn
62520
+ object: objectToReturn,
62521
+ isGraphQLCall
62519
62522
  })
62520
62523
  };
62521
62524
  }
@@ -62527,7 +62530,8 @@ class DatabaseController2 {
62527
62530
  skipHooks,
62528
62531
  first,
62529
62532
  offset,
62530
- order
62533
+ order,
62534
+ isGraphQLCall = false
62531
62535
  }) {
62532
62536
  const { pointers, selectWithoutPointers } = this._getSelectMinusPointersAndRelations({
62533
62537
  className,
@@ -62569,7 +62573,8 @@ class DatabaseController2 {
62569
62573
  object,
62570
62574
  context,
62571
62575
  originClassName: className,
62572
- pointers
62576
+ pointers,
62577
+ isGraphQLCall
62573
62578
  })
62574
62579
  })));
62575
62580
  }
@@ -62577,7 +62582,8 @@ class DatabaseController2 {
62577
62582
  className,
62578
62583
  context,
62579
62584
  data,
62580
- select
62585
+ select,
62586
+ isGraphQLCall = false
62581
62587
  }) {
62582
62588
  const hook = initializeHook({
62583
62589
  className,
@@ -62605,7 +62611,8 @@ class DatabaseController2 {
62605
62611
  context: contextWithRoot(context),
62606
62612
  select,
62607
62613
  id,
62608
- skipHooks: true
62614
+ skipHooks: true,
62615
+ isGraphQLCall
62609
62616
  });
62610
62617
  }
62611
62618
  async createObjects({
@@ -62615,7 +62622,8 @@ class DatabaseController2 {
62615
62622
  context,
62616
62623
  first,
62617
62624
  offset,
62618
- order
62625
+ order,
62626
+ isGraphQLCall = false
62619
62627
  }) {
62620
62628
  if (data.length === 0)
62621
62629
  return [];
@@ -62652,7 +62660,8 @@ class DatabaseController2 {
62652
62660
  skipHooks: true,
62653
62661
  first,
62654
62662
  offset,
62655
- order
62663
+ order,
62664
+ isGraphQLCall
62656
62665
  });
62657
62666
  }
62658
62667
  async updateObject({
@@ -62661,7 +62670,8 @@ class DatabaseController2 {
62661
62670
  context,
62662
62671
  data,
62663
62672
  select,
62664
- skipHooks
62673
+ skipHooks,
62674
+ isGraphQLCall = false
62665
62675
  }) {
62666
62676
  const hook = !skipHooks ? initializeHook({
62667
62677
  className,
@@ -62694,7 +62704,8 @@ class DatabaseController2 {
62694
62704
  context,
62695
62705
  select,
62696
62706
  id,
62697
- skipHooks: true
62707
+ skipHooks: true,
62708
+ isGraphQLCall
62698
62709
  });
62699
62710
  }
62700
62711
  async updateObjects({
@@ -62706,7 +62717,8 @@ class DatabaseController2 {
62706
62717
  first,
62707
62718
  offset,
62708
62719
  order,
62709
- skipHooks
62720
+ skipHooks,
62721
+ isGraphQLCall = false
62710
62722
  }) {
62711
62723
  const whereObject = await this._getWhereObjectWithPointerOrRelation(className, where || {}, context);
62712
62724
  const hook = !skipHooks ? initializeHook({
@@ -62746,14 +62758,16 @@ class DatabaseController2 {
62746
62758
  skipHooks: true,
62747
62759
  first,
62748
62760
  offset,
62749
- order
62761
+ order,
62762
+ isGraphQLCall
62750
62763
  });
62751
62764
  }
62752
62765
  async deleteObject({
62753
62766
  context,
62754
62767
  className,
62755
62768
  id,
62756
- select
62769
+ select,
62770
+ isGraphQLCall = false
62757
62771
  }) {
62758
62772
  const hook = initializeHook({
62759
62773
  className,
@@ -62768,7 +62782,8 @@ class DatabaseController2 {
62768
62782
  select,
62769
62783
  id,
62770
62784
  context,
62771
- skipHooks: true
62785
+ skipHooks: true,
62786
+ isGraphQLCall
62772
62787
  });
62773
62788
  const resultOfBeforeDelete = await hook.runOnSingleObject({
62774
62789
  operationType: "beforeDelete" /* BeforeDelete */,
@@ -62794,7 +62809,8 @@ class DatabaseController2 {
62794
62809
  where,
62795
62810
  first,
62796
62811
  offset,
62797
- order
62812
+ order,
62813
+ isGraphQLCall = false
62798
62814
  }) {
62799
62815
  const whereObject = await this._getWhereObjectWithPointerOrRelation(className, where || {}, context);
62800
62816
  const hook = initializeHook({
@@ -62813,7 +62829,8 @@ class DatabaseController2 {
62813
62829
  first,
62814
62830
  offset,
62815
62831
  order,
62816
- skipHooks: true
62832
+ skipHooks: true,
62833
+ isGraphQLCall
62817
62834
  });
62818
62835
  const resultOfBeforeDelete = await hook.runOnMultipleObjects({
62819
62836
  operationType: "beforeDelete" /* BeforeDelete */,
@@ -67157,7 +67174,8 @@ var queryForOneObject = (_, { id }, context, info, className) => {
67157
67174
  className,
67158
67175
  id,
67159
67176
  select,
67160
- context
67177
+ context,
67178
+ isGraphQLCall: true
67161
67179
  });
67162
67180
  };
67163
67181
  var queryForMultipleObject = async (_, { where, offset, first, order }, context, info, className) => {
@@ -67169,7 +67187,8 @@ var queryForMultipleObject = async (_, { where, offset, first, order }, context,
67169
67187
  offset,
67170
67188
  first,
67171
67189
  context,
67172
- order: transformOrder(order)
67190
+ order: transformOrder(order),
67191
+ isGraphQLCall: true
67173
67192
  });
67174
67193
  return {
67175
67194
  totalCount: select.totalCount ? await context.wabe.controllers.database.count({
@@ -67194,7 +67213,8 @@ var mutationToCreateObject = async (_, args, context, info, className) => {
67194
67213
  className,
67195
67214
  data: updatedFieldsToCreate,
67196
67215
  select,
67197
- context
67216
+ context,
67217
+ isGraphQLCall: true
67198
67218
  }),
67199
67219
  ...select.ok ? { ok: true } : {}
67200
67220
  };
@@ -67214,7 +67234,8 @@ var mutationToCreateMultipleObjects = async (_, { input: { fields, offset, first
67214
67234
  offset,
67215
67235
  first,
67216
67236
  context,
67217
- order: transformOrder(order)
67237
+ order: transformOrder(order),
67238
+ isGraphQLCall: true
67218
67239
  });
67219
67240
  return {
67220
67241
  edges: objects.map((object) => ({ node: object }))
@@ -67235,7 +67256,8 @@ var mutationToUpdateObject = async (_, args, context, info, className) => {
67235
67256
  id: args.input?.id,
67236
67257
  data: updatedFields,
67237
67258
  select,
67238
- context
67259
+ context,
67260
+ isGraphQLCall: true
67239
67261
  }),
67240
67262
  ...select.ok ? { ok: true } : {}
67241
67263
  };
@@ -67257,7 +67279,8 @@ var mutationToUpdateMultipleObjects = async (_, { input: { fields, where, offset
67257
67279
  offset,
67258
67280
  first,
67259
67281
  context,
67260
- order
67282
+ order,
67283
+ isGraphQLCall: true
67261
67284
  });
67262
67285
  return {
67263
67286
  edges: objects.map((object) => ({ node: object }))
@@ -67270,7 +67293,8 @@ var mutationToDeleteObject = async (_, args, context, info, className) => {
67270
67293
  className,
67271
67294
  id: args.input?.id,
67272
67295
  select,
67273
- context
67296
+ context,
67297
+ isGraphQLCall: true
67274
67298
  }),
67275
67299
  ...select.ok ? { ok: true } : {}
67276
67300
  };
@@ -67284,7 +67308,8 @@ var mutationToDeleteMultipleObjects = async (_, { input: { where, offset, first,
67284
67308
  offset,
67285
67309
  first,
67286
67310
  context,
67287
- order
67311
+ order,
67312
+ isGraphQLCall: true
67288
67313
  });
67289
67314
  return {
67290
67315
  edges: objects.map((object) => ({ node: object }))
@@ -68107,15 +68132,21 @@ var wabePrimaryTypesToTypescriptTypes = {
68107
68132
  Date: "Date",
68108
68133
  File: "{url: string, name: string}"
68109
68134
  };
68110
- var wabeTypesToTypescriptTypes = (field) => {
68135
+ var wabeTypesToTypescriptTypes = ({
68136
+ field,
68137
+ isInput = false
68138
+ }) => {
68111
68139
  switch (field.type) {
68140
+ case "Date":
68141
+ if (isInput)
68142
+ return "Date";
68143
+ return "string";
68112
68144
  case "Boolean":
68113
68145
  case "Int":
68114
68146
  case "Float":
68115
68147
  case "String":
68116
68148
  case "Email":
68117
68149
  case "Phone":
68118
- case "Date":
68119
68150
  case "File":
68120
68151
  return wabePrimaryTypesToTypescriptTypes[field.type];
68121
68152
  case "Array":
@@ -68125,7 +68156,7 @@ var wabeTypesToTypescriptTypes = (field) => {
68125
68156
  case "Pointer":
68126
68157
  return field.class;
68127
68158
  case "Relation":
68128
- return "Array<string>";
68159
+ return `Array<${field.class}>`;
68129
68160
  case "Object":
68130
68161
  return `${field.object.name}`;
68131
68162
  default:
@@ -68135,7 +68166,7 @@ var wabeTypesToTypescriptTypes = (field) => {
68135
68166
  var generateWabeObject = (object, prefix = "") => {
68136
68167
  const objectName = object.name;
68137
68168
  return Object.entries(object.fields).reduce((acc, [fieldName, field]) => {
68138
- const type = wabeTypesToTypescriptTypes(field);
68169
+ const type = wabeTypesToTypescriptTypes({ field });
68139
68170
  const objectNameWithPrefix = `${prefix}${firstLetterUpperCase(objectName)}`;
68140
68171
  if (field.type === "Object" || field.type === "Array" && field.typeValue === "Object") {
68141
68172
  const subObject = generateWabeObject(field.object, objectNameWithPrefix);
@@ -68167,8 +68198,8 @@ var generateWabeTypes = (classes) => {
68167
68198
  const { name, fields } = classType;
68168
68199
  const objectsToLoad = [];
68169
68200
  const currentClass = Object.entries(fields).reduce((acc2, [name2, field]) => {
68170
- const type = wabeTypesToTypescriptTypes(field);
68171
- if (field.type === "Object") {
68201
+ const type = wabeTypesToTypescriptTypes({ field });
68202
+ if (field.type === "Object" || field.type === "Array" && field.typeValue === "Object") {
68172
68203
  const wabeObject = generateWabeObject(field.object);
68173
68204
  objectsToLoad.push(wabeObject);
68174
68205
  }
@@ -68211,7 +68242,7 @@ var generateWabeMutationOrQueryInput = (mutationOrQueryName, resolver, isMutatio
68211
68242
  const objectsToLoad = [];
68212
68243
  const mutationNameWithFirstLetterUpperCase = firstLetterUpperCase(mutationOrQueryName);
68213
68244
  const mutationObject = Object.entries((isMutation ? resolver.args?.input : resolver.args) || {}).reduce((acc, [name, field]) => {
68214
- let type = wabeTypesToTypescriptTypes(field);
68245
+ let type = wabeTypesToTypescriptTypes({ field, isInput: true });
68215
68246
  if (field.type === "Object") {
68216
68247
  type = firstLetterInUpperCase(name);
68217
68248
  const wabeObject = generateWabeObject({
@@ -68236,10 +68267,12 @@ var generateWabeMutationOrQueryInput = (mutationOrQueryName, resolver, isMutatio
68236
68267
  };
68237
68268
  }, {});
68238
68269
  return {
68239
- [`${firstLetterInUpperCase(mutationOrQueryName)}Input`]: mutationObject,
68240
- [`${isMutation ? "Mutation" : "Query"}${firstLetterInUpperCase(mutationOrQueryName)}Args`]: {
68270
+ ...isMutation ? {
68271
+ [`${firstLetterInUpperCase(mutationOrQueryName)}Input`]: mutationObject
68272
+ } : {},
68273
+ [`${isMutation ? "Mutation" : "Query"}${firstLetterInUpperCase(mutationOrQueryName)}Args`]: isMutation ? {
68241
68274
  input: `${firstLetterInUpperCase(mutationOrQueryName)}Input`
68242
- },
68275
+ } : mutationObject,
68243
68276
  ...objects
68244
68277
  };
68245
68278
  };
@@ -245,12 +245,32 @@ type Post {
245
245
  id: ID!
246
246
  name: String!
247
247
  test2: RoleEnum
248
+ test3: UserConnection
249
+ test4: User
250
+ experiences: [PostExperience!]
248
251
  acl: PostACLObject
249
252
  createdAt: Date
250
253
  updatedAt: Date
251
254
  search: [String]
252
255
  }
253
256
 
257
+ type UserConnection {
258
+ totalCount: Int
259
+ edges: [UserEdge]
260
+ }
261
+
262
+ type UserEdge {
263
+ node: User!
264
+ }
265
+
266
+ type PostExperience {
267
+ jobTitle: String!
268
+ companyName: String!
269
+ startDate: String!
270
+ endDate: String!
271
+ achievements: [String]
272
+ }
273
+
254
274
  type PostACLObject {
255
275
  users: [PostACLObjectUsersACL]
256
276
  roles: [PostACLObjectRolesACL]
@@ -271,12 +291,23 @@ type PostACLObjectRolesACL {
271
291
  input PostInput {
272
292
  name: String!
273
293
  test2: RoleEnum
294
+ test3: UserRelationInput
295
+ test4: UserPointerInput
296
+ experiences: [PostExperienceInput!]
274
297
  acl: PostACLObjectInput
275
298
  createdAt: Date
276
299
  updatedAt: Date
277
300
  search: [String]
278
301
  }
279
302
 
303
+ input PostExperienceInput {
304
+ jobTitle: String!
305
+ companyName: String!
306
+ startDate: String!
307
+ endDate: String!
308
+ achievements: [String]
309
+ }
310
+
280
311
  input PostACLObjectInput {
281
312
  users: [PostACLObjectUsersACLInput]
282
313
  roles: [PostACLObjectRolesACLInput]
@@ -304,12 +335,23 @@ input PostPointerInput {
304
335
  input PostCreateFieldsInput {
305
336
  name: String
306
337
  test2: RoleEnum
338
+ test3: UserRelationInput
339
+ test4: UserPointerInput
340
+ experiences: [PostExperienceCreateFieldsInput!]
307
341
  acl: PostACLObjectCreateFieldsInput
308
342
  createdAt: Date
309
343
  updatedAt: Date
310
344
  search: [String]
311
345
  }
312
346
 
347
+ input PostExperienceCreateFieldsInput {
348
+ jobTitle: String
349
+ companyName: String
350
+ startDate: String
351
+ endDate: String
352
+ achievements: [String]
353
+ }
354
+
313
355
  input PostACLObjectCreateFieldsInput {
314
356
  users: [PostACLObjectUsersACLCreateFieldsInput]
315
357
  roles: [PostACLObjectRolesACLCreateFieldsInput]
@@ -446,15 +488,6 @@ type Role {
446
488
  search: [String]
447
489
  }
448
490
 
449
- type UserConnection {
450
- totalCount: Int
451
- edges: [UserEdge]
452
- }
453
-
454
- type UserEdge {
455
- node: User!
456
- }
457
-
458
491
  type RoleACLObject {
459
492
  users: [RoleACLObjectUsersACL]
460
493
  roles: [RoleACLObjectRolesACL]
@@ -924,6 +957,9 @@ input PostWhereInput {
924
957
  id: IdWhereInput
925
958
  name: StringWhereInput
926
959
  test2: AnyWhereInput
960
+ test3: UserWhereInput
961
+ test4: UserWhereInput
962
+ experiences: [PostExperienceWhereInput!]
927
963
  acl: PostACLObjectWhereInput
928
964
  createdAt: DateWhereInput
929
965
  updatedAt: DateWhereInput
@@ -932,6 +968,23 @@ input PostWhereInput {
932
968
  AND: [PostWhereInput]
933
969
  }
934
970
 
971
+ input PostExperienceWhereInput {
972
+ jobTitle: StringWhereInput
973
+ companyName: StringWhereInput
974
+ startDate: StringWhereInput
975
+ endDate: StringWhereInput
976
+ achievements: ArrayWhereInput
977
+ OR: [PostExperienceWhereInput]
978
+ AND: [PostExperienceWhereInput]
979
+ }
980
+
981
+ input ArrayWhereInput {
982
+ equalTo: Any
983
+ notEqualTo: Any
984
+ contains: Any
985
+ notContains: Any
986
+ }
987
+
935
988
  input PostACLObjectWhereInput {
936
989
  users: [PostACLObjectUsersACLWhereInput]
937
990
  roles: [PostACLObjectRolesACLWhereInput]
@@ -960,6 +1013,12 @@ enum PostOrder {
960
1013
  name_DESC
961
1014
  test2_ASC
962
1015
  test2_DESC
1016
+ test3_ASC
1017
+ test3_DESC
1018
+ test4_ASC
1019
+ test4_DESC
1020
+ experiences_ASC
1021
+ experiences_DESC
963
1022
  acl_ASC
964
1023
  acl_DESC
965
1024
  createdAt_ASC
@@ -1281,12 +1340,23 @@ input UpdatePostInput {
1281
1340
  input PostUpdateFieldsInput {
1282
1341
  name: String
1283
1342
  test2: RoleEnum
1343
+ test3: UserRelationInput
1344
+ test4: UserPointerInput
1345
+ experiences: [PostExperienceUpdateFieldsInput!]
1284
1346
  acl: PostACLObjectUpdateFieldsInput
1285
1347
  createdAt: Date
1286
1348
  updatedAt: Date
1287
1349
  search: [String]
1288
1350
  }
1289
1351
 
1352
+ input PostExperienceUpdateFieldsInput {
1353
+ jobTitle: String
1354
+ companyName: String
1355
+ startDate: String
1356
+ endDate: String
1357
+ achievements: [String]
1358
+ }
1359
+
1290
1360
  input PostACLObjectUpdateFieldsInput {
1291
1361
  users: [PostACLObjectUsersACLUpdateFieldsInput]
1292
1362
  roles: [PostACLObjectRolesACLUpdateFieldsInput]
package/generated/wabe.ts CHANGED
@@ -65,24 +65,35 @@ export type User = {
65
65
  age?: number,
66
66
  email?: string,
67
67
  acl?: ACLObject,
68
- createdAt?: Date,
69
- updatedAt?: Date,
68
+ createdAt?: string,
69
+ updatedAt?: string,
70
70
  search?: Array<string>,
71
71
  authentication?: Authentication,
72
72
  provider?: AuthenticationProvider,
73
73
  isOauth?: boolean,
74
74
  verifiedEmail?: boolean,
75
75
  role?: Role,
76
- sessions?: Array<string>
76
+ sessions?: Array<_Session>
77
+ }
78
+
79
+ export type Experience = {
80
+ jobTitle: string,
81
+ companyName: string,
82
+ startDate: string,
83
+ endDate: string,
84
+ achievements?: Array<string>
77
85
  }
78
86
 
79
87
  export type Post = {
80
88
  id: string,
81
89
  name: string,
82
90
  test2?: RoleEnum,
91
+ test3: Array<User>,
92
+ test4: User,
93
+ experiences?: Array<Experience>,
83
94
  acl?: ACLObject,
84
- createdAt?: Date,
85
- updatedAt?: Date,
95
+ createdAt?: string,
96
+ updatedAt?: string,
86
97
  search?: Array<string>
87
98
  }
88
99
 
@@ -90,22 +101,22 @@ export type _Session = {
90
101
  id: string,
91
102
  user: User,
92
103
  accessToken: string,
93
- accessTokenExpiresAt: Date,
104
+ accessTokenExpiresAt: string,
94
105
  refreshToken?: string,
95
- refreshTokenExpiresAt: Date,
106
+ refreshTokenExpiresAt: string,
96
107
  acl?: ACLObject,
97
- createdAt?: Date,
98
- updatedAt?: Date,
108
+ createdAt?: string,
109
+ updatedAt?: string,
99
110
  search?: Array<string>
100
111
  }
101
112
 
102
113
  export type Role = {
103
114
  id: string,
104
115
  name: string,
105
- users?: Array<string>,
116
+ users?: Array<User>,
106
117
  acl?: ACLObject,
107
- createdAt?: Date,
108
- updatedAt?: Date,
118
+ createdAt?: string,
119
+ updatedAt?: string,
109
120
  search?: Array<string>
110
121
  }
111
122
 
@@ -115,8 +126,8 @@ export type _InternalConfig = {
115
126
  configValue: string,
116
127
  description?: string,
117
128
  acl?: ACLObject,
118
- createdAt?: Date,
119
- updatedAt?: Date,
129
+ createdAt?: string,
130
+ updatedAt?: string,
120
131
  search?: Array<string>
121
132
  }
122
133
 
@@ -296,20 +307,12 @@ export type VerifyChallengeFactor = {
296
307
  otp?: VerifyChallengeFactorOtp
297
308
  }
298
309
 
299
- export type HelloWorldInput = {
300
- name: string
301
- }
302
-
303
310
  export type QueryHelloWorldArgs = {
304
- input: HelloWorldInput
305
- }
306
-
307
- export type MeInput = {
308
-
311
+ name: string
309
312
  }
310
313
 
311
314
  export type QueryMeArgs = {
312
- input: MeInput
315
+
313
316
  }
314
317
 
315
318
  export type WabeSchemaScalars = ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wabe",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Your backend in minutes not days",
5
5
  "homepage": "https://wabe.dev",
6
6
  "author": {