wabe 0.5.18 → 0.5.20

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
@@ -50,6 +50,10 @@ export type Scalars = {
50
50
  output: any;
51
51
  };
52
52
  };
53
+ declare enum RoleEnum {
54
+ Admin = "Admin",
55
+ Client = "Client"
56
+ }
53
57
  declare enum AuthenticationProvider {
54
58
  google = "google",
55
59
  emailPassword = "emailPassword"
@@ -57,6 +61,14 @@ declare enum AuthenticationProvider {
57
61
  declare enum SecondaryFactor {
58
62
  EmailOTP = "EmailOTP"
59
63
  }
64
+ declare enum PaymentMode {
65
+ payment = "payment",
66
+ subscription = "subscription"
67
+ }
68
+ declare enum PaymentReccuringInterval {
69
+ month = "month",
70
+ year = "year"
71
+ }
60
72
  declare enum Currency {
61
73
  eur = "eur",
62
74
  usd = "usd"
@@ -115,6 +127,7 @@ export type Post = {
115
127
  id: Scalars["ID"]["output"];
116
128
  name: Scalars["String"]["output"];
117
129
  test?: Scalars["File"]["output"];
130
+ test2?: RoleEnum;
118
131
  acl?: PostACLObject;
119
132
  createdAt?: Scalars["Date"]["output"];
120
133
  updatedAt?: Scalars["Date"]["output"];
@@ -239,7 +252,7 @@ export type _InternalConfigACLObjectRolesACL = {
239
252
  write: Scalars["Boolean"]["output"];
240
253
  };
241
254
  export type SignInWithInput = {
242
- authentication?: SignInWithAuthenticationInput;
255
+ authentication: SignInWithAuthenticationInput;
243
256
  };
244
257
  export type SignInWithAuthenticationInput = {
245
258
  emailPassword?: SignInWithAuthenticationEmailPasswordInput;
@@ -259,7 +272,7 @@ export type SignInWithAuthenticationOtpInput = {
259
272
  code?: Scalars["String"]["input"];
260
273
  };
261
274
  export type SignUpWithInput = {
262
- authentication?: SignUpWithAuthenticationInput;
275
+ authentication: SignUpWithAuthenticationInput;
263
276
  };
264
277
  export type SignUpWithAuthenticationInput = {
265
278
  emailPassword?: SignUpWithAuthenticationEmailPasswordInput;
@@ -279,7 +292,14 @@ export type SignUpWithAuthenticationOtpInput = {
279
292
  code?: Scalars["String"]["input"];
280
293
  };
281
294
  export type WabeSchemaScalars = "Phone";
282
- export type WabeSchemaEnums = "RoleEnum" | "AuthenticationProvider" | "SecondaryFactor" | "PaymentMode" | "PaymentReccuringInterval" | "Currency";
295
+ export type WabeSchemaEnums = {
296
+ RoleEnum: RoleEnum;
297
+ AuthenticationProvider: AuthenticationProvider;
298
+ SecondaryFactor: SecondaryFactor;
299
+ PaymentMode: PaymentMode;
300
+ PaymentReccuringInterval: PaymentReccuringInterval;
301
+ Currency: Currency;
302
+ };
283
303
  export type WabeSchemaTypes = {
284
304
  User: User;
285
305
  Post: Post;
@@ -702,6 +722,12 @@ export declare const initializeHook: <T extends WabeTypes, K extends keyof T["ty
702
722
  }>;
703
723
  };
704
724
  export declare const getDefaultHooks: () => Hook<any, any>[];
725
+ export type AddACLOpptions = {
726
+ userId?: string;
727
+ role?: RoleEnum;
728
+ read: boolean;
729
+ write: boolean;
730
+ } | null;
705
731
  declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]> {
706
732
  className: K;
707
733
  private newData;
@@ -722,6 +748,7 @@ declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]
722
748
  upsertNewData(field: keyof T["types"][K], value: any): void;
723
749
  getNewData(): MutationData<T, K, keyof T["types"][K]>;
724
750
  fetch(): Promise<OutputType<T, K, keyof T["types"][K]>>;
751
+ addACL(type: "users" | "roles", options: AddACLOpptions): Promise<void>;
725
752
  }
726
753
  export type WabePrimaryTypes = "String" | "Int" | "Float" | "Boolean" | "Email" | "Date" | "File";
727
754
  export type WabeCustomTypes = "Array" | "Object";
@@ -782,7 +809,7 @@ export type TypeFieldCustomScalars<T extends WabeTypes> = {
782
809
  defaultValue?: any;
783
810
  };
784
811
  export type TypeFieldCustomEnums<T extends WabeTypes> = {
785
- type: T["enums"];
812
+ type: keyof T["enums"];
786
813
  required?: boolean;
787
814
  description?: string;
788
815
  defaultValue?: any;
@@ -825,39 +852,20 @@ export type TypeResolver<T extends WabeTypes> = {
825
852
  };
826
853
  };
827
854
  export type PermissionsOperations = "create" | "read" | "update" | "delete";
828
- export interface PermissionProperties {
855
+ export interface PermissionProperties<T extends WabeTypes> {
829
856
  requireAuthentication?: boolean;
830
857
  /**
831
858
  * An empty array means that none role is authorized (except root client)
832
859
  */
833
- authorizedRoles?: Array<string>;
860
+ authorizedRoles?: Array<T["enums"]["RoleEnum"] | "everyone">;
834
861
  }
835
862
  /**
836
863
  * ACL properties
837
- * Automatically create ACL object before insert of the object in the database
838
- * Allow you to specify which user can read or write the object
839
- * You can specify "self" to allow only the user that created the object to read or write it
840
- * You can specify "all" to allow all users to read or write the object
841
- * For some custom use cases, you can specify a callback function that will be called before
842
- * inserting the object in the database.
843
- * Authorized roles is more restristive that at the class level. You can have a role access on all the class
844
- * except one object.
845
- * If the array of authorized users is empty, no user is authorized
846
- * If the array of authorized users is undefined, everyone is authorized
864
+ * Callback to define the ACL object before insert of the object in the database
865
+ * Can be done with a beforeCreate hook but for simplicity we can define it here
847
866
  */
848
- export type ACLProperties = {
849
- authorizedUsers: {
850
- read: Array<"self">;
851
- write: Array<"self">;
852
- };
853
- authorizedRoles: {
854
- read: Array<string>;
855
- write: Array<string>;
856
- };
857
- } | {
858
- callback?: (hookObject: HookObject<any, any>) => void | Promise<void>;
859
- };
860
- export type ClassPermissions = Partial<Record<PermissionsOperations, PermissionProperties> & {
867
+ export type ACLProperties = (hookObject: HookObject<any, any>) => void | Promise<void>;
868
+ export type ClassPermissions<T extends WabeTypes> = Partial<Record<PermissionsOperations, PermissionProperties<T>> & {
861
869
  acl: ACLProperties;
862
870
  }>;
863
871
  export type SearchableFields = Array<string>;
@@ -870,7 +878,7 @@ export interface ClassInterface<T extends WabeTypes> {
870
878
  name: string;
871
879
  fields: SchemaFields<T>;
872
880
  description?: string;
873
- permissions?: ClassPermissions;
881
+ permissions?: ClassPermissions<T>;
874
882
  searchableFields?: SearchableFields;
875
883
  indexes?: ClassIndexes;
876
884
  }
@@ -1062,12 +1070,12 @@ export type Address = {
1062
1070
  postalCode: string;
1063
1071
  state: string;
1064
1072
  };
1065
- export declare enum PaymentMode {
1073
+ declare enum PaymentMode$1 {
1066
1074
  payment = "payment",
1067
1075
  subscription = "subscription"
1068
1076
  }
1069
1077
  export type PaymentMethod = "card" | "paypal" | "link" | "sepa_debit" | "revolut_pay" | "us_bank_account";
1070
- export declare enum PaymentReccuringInterval {
1078
+ declare enum PaymentReccuringInterval$1 {
1071
1079
  Month = "month",
1072
1080
  Year = "year"
1073
1081
  }
@@ -1128,7 +1136,7 @@ export type CreatePaymentOptions = {
1128
1136
  customerEmail?: string;
1129
1137
  products: Array<Product>;
1130
1138
  paymentMethod: Array<PaymentMethod>;
1131
- paymentMode: PaymentMode;
1139
+ paymentMode: PaymentMode$1;
1132
1140
  successUrl: string;
1133
1141
  cancelUrl: string;
1134
1142
  automaticTax?: boolean;
@@ -1337,7 +1345,7 @@ export interface WabeConfig<T extends WabeTypes> {
1337
1345
  export type WabeTypes = {
1338
1346
  types: Record<any, any>;
1339
1347
  scalars: string;
1340
- enums: string;
1348
+ enums: Record<any, any>;
1341
1349
  };
1342
1350
  export type WobeCustomContext<T extends WabeTypes> = {
1343
1351
  wabe: WabeContext<T>;
@@ -1468,6 +1476,8 @@ export declare class PaymentDevAdapter implements PaymentAdapter {
1468
1476
  export {
1469
1477
  AuthenticationProvider$1 as AuthenticationProvider,
1470
1478
  Currency$1 as Currency,
1479
+ PaymentMode$1 as PaymentMode,
1480
+ PaymentReccuringInterval$1 as PaymentReccuringInterval,
1471
1481
  };
1472
1482
 
1473
1483
  export {};
package/dist/index.js CHANGED
@@ -60403,6 +60403,70 @@ class HookObject {
60403
60403
  fields: ["*"]
60404
60404
  });
60405
60405
  }
60406
+ async addACL(type, options) {
60407
+ const updateACL = async (newACLObject) => {
60408
+ if (this.className === "User") {
60409
+ const currentUserId = this.object?.id;
60410
+ if (currentUserId)
60411
+ await this.context.wabe.controllers.database.updateObject({
60412
+ className: this.className,
60413
+ context: { ...this.context, isRoot: true },
60414
+ id: currentUserId,
60415
+ data: {
60416
+ acl: newACLObject
60417
+ },
60418
+ fields: []
60419
+ });
60420
+ return;
60421
+ }
60422
+ this.upsertNewData("acl", newACLObject);
60423
+ };
60424
+ const result = this.className === "User" ? await this.context.wabe.controllers.database.getObject({
60425
+ className: "User",
60426
+ fields: ["acl"],
60427
+ id: this.object?.id,
60428
+ context: {
60429
+ ...this.context,
60430
+ isRoot: true
60431
+ }
60432
+ }) : { acl: this.getNewData().acl };
60433
+ const currentACL = result?.acl || {};
60434
+ if (options === null) {
60435
+ await updateACL({
60436
+ ...currentACL,
60437
+ [type]: []
60438
+ });
60439
+ return;
60440
+ }
60441
+ const { userId, role, read, write } = options;
60442
+ if (userId && role)
60443
+ throw new Error("Cannot specify both userId and role");
60444
+ if (role) {
60445
+ const result2 = await this.context.wabe.controllers.database.getObjects({
60446
+ className: "Role",
60447
+ fields: ["id"],
60448
+ where: {
60449
+ name: {
60450
+ equalTo: role
60451
+ }
60452
+ },
60453
+ context: {
60454
+ ...this.context,
60455
+ isRoot: true
60456
+ }
60457
+ });
60458
+ const roleId = result2[0]?.id;
60459
+ await updateACL({
60460
+ ...currentACL,
60461
+ [type]: [...currentACL?.[type] || [], { roleId, read, write }]
60462
+ });
60463
+ return;
60464
+ }
60465
+ await updateACL({
60466
+ ...currentACL,
60467
+ [type]: [...currentACL?.[type] || [], { userId, read, write }]
60468
+ });
60469
+ }
60406
60470
  }
60407
60471
 
60408
60472
  // src/authentication/utils.ts
@@ -60562,11 +60626,15 @@ var _checkCLP = async (object, operationType) => {
60562
60626
  context: object.context
60563
60627
  });
60564
60628
  if (!permissionProperties)
60565
- return;
60629
+ throw new Error(`Permission denied to ${permissionOperation} class ${object.className}`);
60566
60630
  const sessionId = object.context.sessionId;
60567
60631
  if (!permissionProperties.requireAuthentication)
60568
60632
  return;
60569
- if (!sessionId)
60633
+ if (!sessionId || !object.getUser())
60634
+ throw new Error(`Permission denied to ${permissionOperation} class ${object.className}`);
60635
+ if (permissionProperties.authorizedRoles?.includes("everyone"))
60636
+ return;
60637
+ if (permissionProperties.authorizedRoles?.length === 0 || !permissionProperties)
60570
60638
  throw new Error(`Permission denied to ${permissionOperation} class ${object.className}`);
60571
60639
  const res = await object.context.wabe.controllers.database.getObject({
60572
60640
  className: "_Session",
@@ -61516,79 +61584,22 @@ var defaultSetEmailOnUpdate = (object) => {
61516
61584
  };
61517
61585
 
61518
61586
  // src/hooks/setupAcl.ts
61519
- var isReadTrueOnUser = (aclObject) => aclObject.authorizedUsers?.read?.includes("self");
61520
- var isWriteTrueOnUser = (aclObject) => aclObject.authorizedUsers.write?.includes("self");
61521
- var setAcl = async ({
61522
- hookObject,
61523
- userId,
61524
- isBeforeHook
61525
- }) => {
61587
+ var setupAcl = async (hookObject) => {
61526
61588
  const schemaPermissionsObject = hookObject.context.wabe.config.schema?.classes?.find((c) => c.name === hookObject.className)?.permissions;
61527
61589
  if (!schemaPermissionsObject)
61528
61590
  return;
61529
61591
  const { acl } = schemaPermissionsObject;
61530
61592
  if (hookObject.isFieldUpdated("acl") || !acl)
61531
61593
  return;
61532
- if (acl.callback) {
61533
- await acl.callback(hookObject);
61534
- return;
61535
- }
61536
- const isReadUser = isReadTrueOnUser(acl);
61537
- const isWriteUser = isWriteTrueOnUser(acl);
61538
- const getIdOfAllAuthorizedRoles = async (authorizedRoles, property) => hookObject.context.wabe.controllers.database.getObjects({
61539
- className: "Role",
61540
- fields: ["id"],
61541
- where: {
61542
- name: {
61543
- in: authorizedRoles?.[property]
61544
- }
61545
- },
61546
- context: hookObject.context
61547
- });
61548
- const idOfAllReadRoles = await getIdOfAllAuthorizedRoles(acl.authorizedRoles, "read");
61549
- const idOfAllWriteRoles = await getIdOfAllAuthorizedRoles(acl.authorizedRoles, "write");
61550
- const allRolesIdsWithoutDuplicate = [
61551
- ...new Set([
61552
- ...idOfAllReadRoles.map((role) => role?.id).filter(notEmpty),
61553
- ...idOfAllWriteRoles.map((role) => role?.id).filter(notEmpty)
61554
- ])
61555
- ];
61556
- const isReadOrWriteSpecified = acl.authorizedUsers.read && acl.authorizedUsers.read.length > 0 || acl.authorizedUsers.write && acl.authorizedUsers.write.length > 0;
61557
- const aclObject = {
61558
- users: isReadOrWriteSpecified ? [{ userId, read: !!isReadUser, write: !!isWriteUser }] : [],
61559
- roles: [
61560
- ...allRolesIdsWithoutDuplicate.map((roleId) => ({
61561
- roleId,
61562
- read: idOfAllReadRoles.some((role) => role?.id === roleId),
61563
- write: idOfAllWriteRoles.some((role) => role?.id === roleId)
61564
- }))
61565
- ]
61566
- };
61567
- if (isBeforeHook)
61568
- hookObject.upsertNewData("acl", aclObject);
61569
- else
61570
- await hookObject.context.wabe.controllers.database.updateObject({
61571
- className: hookObject.className,
61572
- context: { ...hookObject.context, isRoot: true },
61573
- id: userId,
61574
- data: {
61575
- acl: aclObject
61576
- },
61577
- fields: []
61578
- });
61594
+ if (acl)
61595
+ await acl(hookObject);
61579
61596
  };
61580
61597
  var defaultSetupAclBeforeCreate = async (hookObject) => {
61581
- const userId = hookObject.getUser()?.id;
61582
- if (hookObject.className === "User" || !userId)
61598
+ if (hookObject.className === "User")
61583
61599
  return;
61584
- await setAcl({ hookObject, userId, isBeforeHook: true });
61585
- };
61586
- var defaultSetupAclOnUserAfterCreate = async (hookObject) => {
61587
- const userId = hookObject.object?.id;
61588
- if (!userId)
61589
- return;
61590
- await setAcl({ hookObject, userId, isBeforeHook: false });
61600
+ await setupAcl(hookObject);
61591
61601
  };
61602
+ var defaultSetupAclOnUserAfterCreate = async (hookObject) => setupAcl(hookObject);
61592
61603
 
61593
61604
  // src/hooks/index.ts
61594
61605
  var OperationType;
@@ -62128,7 +62139,10 @@ class DatabaseController2 {
62128
62139
  return null;
62129
62140
  return this.getObject({
62130
62141
  className,
62131
- context,
62142
+ context: {
62143
+ ...context,
62144
+ isRoot: true
62145
+ },
62132
62146
  fields,
62133
62147
  id,
62134
62148
  skipHooks: true
@@ -62415,7 +62429,10 @@ class Session {
62415
62429
  }, import.meta.env.JWT_SECRET || "dev");
62416
62430
  const res = await context.wabe.controllers.database.createObject({
62417
62431
  className: "_Session",
62418
- context,
62432
+ context: {
62433
+ ...context,
62434
+ isRoot: true
62435
+ },
62419
62436
  data: {
62420
62437
  accessToken: this.accessToken,
62421
62438
  accessTokenExpiresAt: this.getAccessTokenExpireAt(context.wabe.config),
@@ -62438,7 +62455,10 @@ class Session {
62438
62455
  return;
62439
62456
  await context.wabe.controllers.database.deleteObject({
62440
62457
  className: "_Session",
62441
- context,
62458
+ context: {
62459
+ ...context,
62460
+ isRoot: true
62461
+ },
62442
62462
  id: context.sessionId,
62443
62463
  fields: []
62444
62464
  });
@@ -62565,24 +62585,19 @@ var signInWithResolver = async (_, {
62565
62585
  var signUpWithResolver = async (_, {
62566
62586
  input
62567
62587
  }, context) => {
62568
- const userSchema = context.wabe.config.schema?.classes?.find((classItem) => classItem.name === "User");
62569
- if (userSchema?.permissions?.create?.requireAuthentication === true)
62570
- throw new Error("Permission denied to create class User");
62571
62588
  const res = await context.wabe.controllers.database.createObject({
62572
62589
  className: "User",
62573
62590
  data: {
62574
62591
  authentication: input.authentication
62575
62592
  },
62576
- context: {
62577
- ...context,
62578
- isRoot: true
62579
- },
62593
+ context,
62580
62594
  fields: ["id"]
62581
62595
  });
62596
+ const createdUserId = res?.id;
62582
62597
  const session = new Session;
62583
- if (!res)
62598
+ if (!createdUserId)
62584
62599
  throw new Error("User not created");
62585
- const { accessToken, refreshToken } = await session.create(res.id, {
62600
+ const { accessToken, refreshToken } = await session.create(createdUserId, {
62586
62601
  ...context,
62587
62602
  isRoot: true
62588
62603
  });
@@ -62602,7 +62617,7 @@ var signUpWithResolver = async (_, {
62602
62617
  expires: session.getAccessTokenExpireAt(context.wabe.config)
62603
62618
  });
62604
62619
  }
62605
- return { accessToken, refreshToken, id: res.id };
62620
+ return { accessToken, refreshToken, id: createdUserId };
62606
62621
  };
62607
62622
  // src/authentication/oauth/utils.ts
62608
62623
  import crypto from "node:crypto";
@@ -63222,7 +63237,8 @@ class Schema {
63222
63237
  }
63223
63238
  },
63224
63239
  required: true
63225
- }
63240
+ },
63241
+ required: true
63226
63242
  };
63227
63243
  const challengeInputObject = {
63228
63244
  type: "Object",
@@ -63373,6 +63389,20 @@ class Schema {
63373
63389
  type: "Currency",
63374
63390
  required: true
63375
63391
  }
63392
+ },
63393
+ permissions: {
63394
+ read: {
63395
+ authorizedRoles: ["Admin" /* Admin */],
63396
+ requireAuthentication: true
63397
+ },
63398
+ delete: {
63399
+ authorizedRoles: ["Admin" /* Admin */],
63400
+ requireAuthentication: true
63401
+ },
63402
+ update: {
63403
+ authorizedRoles: ["Admin" /* Admin */],
63404
+ requireAuthentication: true
63405
+ }
63376
63406
  }
63377
63407
  };
63378
63408
  }
@@ -63388,6 +63418,24 @@ class Schema {
63388
63418
  type: "Relation",
63389
63419
  class: "User"
63390
63420
  }
63421
+ },
63422
+ permissions: {
63423
+ create: {
63424
+ authorizedRoles: [],
63425
+ requireAuthentication: true
63426
+ },
63427
+ read: {
63428
+ authorizedRoles: ["everyone"],
63429
+ requireAuthentication: true
63430
+ },
63431
+ update: {
63432
+ authorizedRoles: [],
63433
+ requireAuthentication: true
63434
+ },
63435
+ delete: {
63436
+ authorizedRoles: [],
63437
+ requireAuthentication: true
63438
+ }
63391
63439
  }
63392
63440
  };
63393
63441
  }
@@ -64316,7 +64364,9 @@ var executeRelationOnFields = ({
64316
64364
  const entries = Object.entries(fields);
64317
64365
  return entries.reduce(async (acc, [fieldName, value]) => {
64318
64366
  const newAcc = await acc;
64319
- if (typeof value === "object" && value?.createAndLink) {
64367
+ if (value instanceof File) {
64368
+ newAcc[fieldName] = value;
64369
+ } else if (typeof value === "object" && value?.createAndLink) {
64320
64370
  newAcc[fieldName] = await createAndLink({
64321
64371
  createAndLink: value.createAndLink,
64322
64372
  fieldName,
@@ -65327,8 +65377,11 @@ var generateAdditionalTypes = ({
65327
65377
  }) => {
65328
65378
  const listOfScalars = scalars?.map((scalar) => `"${scalar.name}"`) || [];
65329
65379
  const wabeScalarType = listOfScalars.length > 0 ? `export type WabeSchemaScalars = ${listOfScalars.join(" | ")}` : "";
65330
- const wabeEnumsGlobalTypes = enums?.map((wabeEnum) => `"${wabeEnum.name}"`) || [];
65331
- const wabeEnumsGlobalTypesString = wabeEnumsGlobalTypes.length > 0 ? `export type WabeSchemaEnums = ${wabeEnumsGlobalTypes.join(" | ")}` : "";
65380
+ const wabeEnumsGlobalTypes = enums?.map((wabeEnum) => `${wabeEnum.name}: ${wabeEnum.name}`) || [];
65381
+ const wabeEnumsGlobalTypesString = wabeEnumsGlobalTypes.length > 0 ? `export type WabeSchemaEnums = {
65382
+ \t${wabeEnumsGlobalTypes.join(`,
65383
+ \t`)}
65384
+ }` : "";
65332
65385
  const allNames = classes.map((schema) => `${schema.name}: ${schema.name}`).filter((schema) => schema);
65333
65386
  const globalWabeTypeString = `export type WabeSchemaTypes = {
65334
65387
  \t${allNames.join(`,
@@ -75667,6 +75720,9 @@ class PaymentController {
75667
75720
  }
75668
75721
  }
75669
75722
 
75723
+ // ../../node_modules/@graphql-yoga/plugin-disable-introspection/esm/index.js
75724
+ var store = new WeakMap;
75725
+
75670
75726
  // src/server/index.ts
75671
75727
  class Wabe {
75672
75728
  server;
@@ -75853,6 +75909,9 @@ class Wabe {
75853
75909
  schema,
75854
75910
  maskedErrors: false,
75855
75911
  graphqlEndpoint: "/graphql",
75912
+ plugins: [
75913
+ false
75914
+ ],
75856
75915
  context: async (ctx) => ctx.wabe,
75857
75916
  graphqlMiddleware: async (resolve, res) => {
75858
75917
  const response = await resolve();
@@ -75889,8 +75948,7 @@ class Wabe {
75889
75948
  });
75890
75949
  }
75891
75950
  }
75892
- } catch (e) {
75893
- console.error(e);
75951
+ } catch {
75894
75952
  return response;
75895
75953
  }
75896
75954
  return response;
@@ -214,6 +214,7 @@ type Post {
214
214
  id: ID!
215
215
  name: String!
216
216
  test: File
217
+ test2: RoleEnum
217
218
  acl: PostACLObject
218
219
  createdAt: Date
219
220
  updatedAt: Date
@@ -243,6 +244,7 @@ type PostACLObjectRolesACL {
243
244
  input PostInput {
244
245
  name: String!
245
246
  test: File
247
+ test2: RoleEnum
246
248
  acl: PostACLObjectInput
247
249
  createdAt: Date
248
250
  updatedAt: Date
@@ -276,6 +278,7 @@ input PostPointerInput {
276
278
  input PostCreateFieldsInput {
277
279
  name: String
278
280
  test: File
281
+ test2: RoleEnum
279
282
  acl: PostACLObjectCreateFieldsInput
280
283
  createdAt: Date
281
284
  updatedAt: Date
@@ -971,6 +974,7 @@ input PostWhereInput {
971
974
  id: IdWhereInput
972
975
  name: StringWhereInput
973
976
  test: FileWhereInput
977
+ test2: AnyWhereInput
974
978
  acl: PostACLObjectWhereInput
975
979
  createdAt: DateWhereInput
976
980
  updatedAt: DateWhereInput
@@ -1014,6 +1018,8 @@ enum PostOrder {
1014
1018
  name_DESC
1015
1019
  test_ASC
1016
1020
  test_DESC
1021
+ test2_ASC
1022
+ test2_DESC
1017
1023
  acl_ASC
1018
1024
  acl_DESC
1019
1025
  createdAt_ASC
@@ -1391,6 +1397,7 @@ input UpdatePostInput {
1391
1397
  input PostUpdateFieldsInput {
1392
1398
  name: String
1393
1399
  test: File
1400
+ test2: RoleEnum
1394
1401
  acl: PostACLObjectUpdateFieldsInput
1395
1402
  createdAt: Date
1396
1403
  updatedAt: Date
@@ -1781,7 +1788,7 @@ type SignInWithOutput {
1781
1788
  }
1782
1789
 
1783
1790
  input SignInWithInput {
1784
- authentication: SignInWithAuthenticationInput
1791
+ authentication: SignInWithAuthenticationInput!
1785
1792
  }
1786
1793
 
1787
1794
  input SignInWithAuthenticationInput {
@@ -1812,7 +1819,7 @@ type SignUpWithOutput {
1812
1819
  }
1813
1820
 
1814
1821
  input SignUpWithInput {
1815
- authentication: SignUpWithAuthenticationInput
1822
+ authentication: SignUpWithAuthenticationInput!
1816
1823
  }
1817
1824
 
1818
1825
  input SignUpWithAuthenticationInput {
package/generated/wabe.ts CHANGED
@@ -215,6 +215,7 @@ export type Post = {
215
215
  id: Scalars['ID']['output'];
216
216
  name: Scalars['String']['output'];
217
217
  test?: Scalars['File']['output'];
218
+ test2?: RoleEnum;
218
219
  acl?: PostACLObject;
219
220
  createdAt?: Scalars['Date']['output'];
220
221
  updatedAt?: Scalars['Date']['output'];
@@ -241,6 +242,7 @@ export type PostACLObjectRolesACL = {
241
242
  export type PostInput = {
242
243
  name: Scalars['String']['input'];
243
244
  test?: Scalars['File']['input'];
245
+ test2?: RoleEnum;
244
246
  acl?: PostACLObjectInput;
245
247
  createdAt?: Scalars['Date']['input'];
246
248
  updatedAt?: Scalars['Date']['input'];
@@ -273,6 +275,7 @@ export type PostPointerInput = {
273
275
  export type PostCreateFieldsInput = {
274
276
  name?: Scalars['String']['input'];
275
277
  test?: Scalars['File']['input'];
278
+ test2?: RoleEnum;
276
279
  acl?: PostACLObjectCreateFieldsInput;
277
280
  createdAt?: Scalars['Date']['input'];
278
281
  updatedAt?: Scalars['Date']['input'];
@@ -1015,6 +1018,7 @@ export type PostWhereInput = {
1015
1018
  id?: IdWhereInput;
1016
1019
  name?: StringWhereInput;
1017
1020
  test?: FileWhereInput;
1021
+ test2?: AnyWhereInput;
1018
1022
  acl?: PostACLObjectWhereInput;
1019
1023
  createdAt?: DateWhereInput;
1020
1024
  updatedAt?: DateWhereInput;
@@ -1058,6 +1062,8 @@ export enum PostOrder {
1058
1062
  name_DESC = "name_DESC",
1059
1063
  test_ASC = "test_ASC",
1060
1064
  test_DESC = "test_DESC",
1065
+ test2_ASC = "test2_ASC",
1066
+ test2_DESC = "test2_DESC",
1061
1067
  acl_ASC = "acl_ASC",
1062
1068
  acl_DESC = "acl_DESC",
1063
1069
  createdAt_ASC = "createdAt_ASC",
@@ -1601,6 +1607,7 @@ export type UpdatePostInput = {
1601
1607
  export type PostUpdateFieldsInput = {
1602
1608
  name?: Scalars['String']['input'];
1603
1609
  test?: Scalars['File']['input'];
1610
+ test2?: RoleEnum;
1604
1611
  acl?: PostACLObjectUpdateFieldsInput;
1605
1612
  createdAt?: Scalars['Date']['input'];
1606
1613
  updatedAt?: Scalars['Date']['input'];
@@ -1991,7 +1998,7 @@ export type SignInWithOutput = {
1991
1998
  };
1992
1999
 
1993
2000
  export type SignInWithInput = {
1994
- authentication?: SignInWithAuthenticationInput;
2001
+ authentication: SignInWithAuthenticationInput;
1995
2002
  };
1996
2003
 
1997
2004
  export type SignInWithAuthenticationInput = {
@@ -2022,7 +2029,7 @@ export type SignUpWithOutput = {
2022
2029
  };
2023
2030
 
2024
2031
  export type SignUpWithInput = {
2025
- authentication?: SignUpWithAuthenticationInput;
2032
+ authentication: SignUpWithAuthenticationInput;
2026
2033
  };
2027
2034
 
2028
2035
  export type SignUpWithAuthenticationInput = {
@@ -2071,7 +2078,14 @@ export type VerifyChallengeFactorOtpInput = {
2071
2078
 
2072
2079
  export type WabeSchemaScalars = "Phone"
2073
2080
 
2074
- export type WabeSchemaEnums = "RoleEnum" | "AuthenticationProvider" | "SecondaryFactor" | "PaymentMode" | "PaymentReccuringInterval" | "Currency"
2081
+ export type WabeSchemaEnums = {
2082
+ RoleEnum: RoleEnum,
2083
+ AuthenticationProvider: AuthenticationProvider,
2084
+ SecondaryFactor: SecondaryFactor,
2085
+ PaymentMode: PaymentMode,
2086
+ PaymentReccuringInterval: PaymentReccuringInterval,
2087
+ Currency: Currency
2088
+ }
2075
2089
 
2076
2090
  export type WabeSchemaTypes = {
2077
2091
  User: User,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wabe",
3
- "version": "0.5.18",
3
+ "version": "0.5.20",
4
4
  "description": "Your backend in minutes not days",
5
5
  "homepage": "https://wabe.dev",
6
6
  "author": {
@@ -24,12 +24,13 @@
24
24
  "generate:types": "dts-bundle-generator -o dist/index.d.ts src/index.ts --no-check --external-imports=wobe",
25
25
  "check": "tsc --project $(pwd)/tsconfig.json",
26
26
  "lint": "biome lint . --no-errors-on-unmatched --config-path=../../",
27
- "ci": "bun generate:codegen && bun check && bun lint $(pwd) && bun test src",
27
+ "ci": "bun generate:codegen && bun lint $(pwd) && bun check && bun test src",
28
28
  "format": "biome format --write . --config-path=../../",
29
29
  "dev": "bun run --watch dev/index.ts",
30
30
  "generate:codegen": "touch generated/wabe.ts && CODEGEN=true bun dev/index.ts"
31
31
  },
32
32
  "dependencies": {
33
+ "@graphql-yoga/plugin-disable-introspection": "2.10.9",
33
34
  "@graphql-tools/graphql-file-loader": "8.0.1",
34
35
  "@graphql-tools/load": "8.0.2",
35
36
  "@node-rs/argon2": "2.0.0",