wabe 0.5.4 → 0.5.5

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://wabe.dev"><img src="https://www.wabe.dev/logo.png" alt="Wabe logo" height=170></a>
2
+ <a href="https://wabe.dev"><img src="https://www.wabe.dev/logo.webp" alt="Wabe logo" height=170></a>
3
3
  </p>
4
4
  <h1 align="center">Wabe</h1>
5
5
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## What is Wabe?
11
11
 
12
- Wabe is an open-source backend that allows you to create your own fully customizable backend in just a few minutes. It handles database access, automatic GraphQL API generation, authentication with various methods (classic or OAuth), permissions, security, and more for you.
12
+ Wabe is an open-source backend that allows you to create your own fully customizable backend in just a few minutes. It handles database access, automatic GraphQL API generation, authentication with various methods (classic or OAuth), permissions, security, payment, emails, and more for you.
13
13
 
14
14
  ## Install
15
15
 
package/dist/index.d.ts CHANGED
@@ -251,6 +251,34 @@ export type PaymentAclObjectRolesAcl = {
251
251
  read: Scalars["Boolean"]["output"];
252
252
  write: Scalars["Boolean"]["output"];
253
253
  };
254
+ export type _InternalConfig = {
255
+ __typename?: "_InternalConfig";
256
+ id: Scalars["ID"]["output"];
257
+ configKey: Scalars["String"]["output"];
258
+ configValue: Scalars["String"]["output"];
259
+ description?: Maybe<Scalars["String"]["output"]>;
260
+ acl?: Maybe<_InternalConfigAclObject>;
261
+ createdAt?: Maybe<Scalars["Date"]["output"]>;
262
+ updatedAt?: Maybe<Scalars["Date"]["output"]>;
263
+ search?: Maybe<Array<Maybe<Scalars["String"]["output"]>>>;
264
+ };
265
+ export type _InternalConfigAclObject = {
266
+ __typename?: "_InternalConfigACLObject";
267
+ users?: Maybe<Array<Maybe<_InternalConfigAclObjectUsersAcl>>>;
268
+ roles?: Maybe<Array<Maybe<_InternalConfigAclObjectRolesAcl>>>;
269
+ };
270
+ export type _InternalConfigAclObjectUsersAcl = {
271
+ __typename?: "_InternalConfigACLObjectUsersACL";
272
+ userId: Scalars["String"]["output"];
273
+ read: Scalars["Boolean"]["output"];
274
+ write: Scalars["Boolean"]["output"];
275
+ };
276
+ export type _InternalConfigAclObjectRolesAcl = {
277
+ __typename?: "_InternalConfigACLObjectRolesACL";
278
+ roleId: Scalars["String"]["output"];
279
+ read: Scalars["Boolean"]["output"];
280
+ write: Scalars["Boolean"]["output"];
281
+ };
254
282
  export type SignInWithInput = {
255
283
  authentication?: InputMaybe<SignInWithAuthenticationInput>;
256
284
  };
@@ -299,11 +327,12 @@ export type WabeSchemaTypes = {
299
327
  _Session: _Session;
300
328
  Role: Role;
301
329
  Payment: Payment;
330
+ _InternalConfig: _InternalConfig;
302
331
  };
303
332
  export interface WabeContext<T extends WabeTypes> {
304
333
  response?: WobeResponse;
305
334
  user?: User | null;
306
- sessionId?: string;
335
+ sessionId?: string | null;
307
336
  isRoot: boolean;
308
337
  wabe: Wabe<T>;
309
338
  }
@@ -516,11 +545,11 @@ export interface DatabaseConfig {
516
545
  name: string;
517
546
  }
518
547
  export declare enum OperationType {
519
- AfterCreate = "AfterCreate",
548
+ AfterCreate = "afterCreate",
520
549
  AfterUpdate = "afterUpdate",
521
550
  AfterDelete = "afterDelete",
522
551
  AfterRead = "afterRead",
523
- BeforeCreate = "beforeInsert",
552
+ BeforeCreate = "beforeCreate",
524
553
  BeforeUpdate = "beforeUpdate",
525
554
  BeforeDelete = "beforeDelete",
526
555
  BeforeRead = "beforeRead"
@@ -763,6 +792,7 @@ export declare class Schema<T extends WabeTypes> {
763
792
  sessionClass(): ClassInterface<T>;
764
793
  paymentClass(): ClassInterface<T>;
765
794
  roleClass(): ClassInterface<T>;
795
+ internalConfigClass(): ClassInterface<T>;
766
796
  userClass(): ClassInterface<T>;
767
797
  defaultFields(): SchemaFields<T>;
768
798
  mergeClass(newClass: ClassInterface<T>[]): ClassInterface<T>[];
@@ -780,6 +810,9 @@ export type AuthenticationEventsOptions<T> = {
780
810
  input: T;
781
811
  context: WabeContext<any>;
782
812
  };
813
+ export type AuthenticationEventsOptionsWithUserId<T> = AuthenticationEventsOptions<T> & {
814
+ userId: string;
815
+ };
783
816
  export type ProviderInterface<T = any> = {
784
817
  onSignIn: (options: AuthenticationEventsOptions<T>) => Promise<{
785
818
  user: Partial<User>;
@@ -793,6 +826,9 @@ export type ProviderInterface<T = any> = {
793
826
  onSignUp: (options: AuthenticationEventsOptions<T>) => Promise<{
794
827
  authenticationDataToSave: any;
795
828
  }>;
829
+ onUpdateAuthenticationData?: (options: AuthenticationEventsOptionsWithUserId<T>) => Promise<{
830
+ authenticationDataToSave: any;
831
+ }>;
796
832
  };
797
833
  export type SecondaryProviderInterface<T = any> = {
798
834
  onSendChallenge: () => Promise<void>;
@@ -869,6 +905,7 @@ export type WabeFileAdapter = (file: File) => Promise<string>;
869
905
  export interface FileConfig {
870
906
  adapter: WabeFileAdapter;
871
907
  }
908
+ export type Templates = "sendOTPCode";
872
909
  export interface EmailSendOptions {
873
910
  from: string;
874
911
  to: Array<string>;
@@ -885,8 +922,19 @@ export interface EmailAdapter {
885
922
  */
886
923
  send(options: EmailSendOptions): Promise<string>;
887
924
  }
925
+ /**
926
+ * Configuration for the email in Wabe
927
+ * @property adapter The adapter to use to send emails
928
+ * @property mainEmail The email to use as sender for emails sent by Wabe
929
+ * @property templates The html templates to use for a specific email. If not provided, Wabe will use the default templates
930
+ */
888
931
  export interface EmailConfig {
889
932
  adapter: EmailAdapter;
933
+ mainEmail?: string;
934
+ htmlTemplates?: Record<Templates, (payload: any) => string>;
935
+ }
936
+ export declare class EmailDevAdapter implements EmailAdapter {
937
+ send(): Promise<string>;
890
938
  }
891
939
  declare class EmailController implements EmailAdapter {
892
940
  adapter: EmailAdapter;