wabe 0.5.0 → 0.5.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/README.md CHANGED
@@ -25,7 +25,7 @@ yarn add wabe # On yarn
25
25
  import { DatabaseEnum, Wabe } from "wabe";
26
26
 
27
27
  const run = async () => {
28
- // Insure your database is running before run the file
28
+ // Ensure your database is running before run the file
29
29
 
30
30
  const wabe = new Wabe({
31
31
  // Root key example (must be long minimal 64 characters, you can generate it online)
@@ -63,7 +63,7 @@ Of course, you can also use Wabe for your backend; that is the better contributi
63
63
 
64
64
  If you like the project don't forget to share it.
65
65
 
66
- More informations on the [Contribution guide](https://github.com/palixir/wabe/blob/main/CONTRIBUTING.md)
66
+ More information on the [Contribution guide](https://github.com/palixir/wabe/blob/main/CONTRIBUTING.md)
67
67
 
68
68
  ## License
69
69
 
@@ -823,6 +823,8 @@ export type Mutation = {
823
823
  createMutation: Scalars['Boolean']['output'];
824
824
  customMutation?: Maybe<Scalars['Int']['output']>;
825
825
  secondCustomMutation?: Maybe<Scalars['Int']['output']>;
826
+ /** Send basic email with text and html, returns the id of the email */
827
+ sendEmail?: Maybe<Scalars['String']['output']>;
826
828
  signInWith?: Maybe<SignInWithOutput>;
827
829
  signUpWith?: Maybe<SignUpWithOutput>;
828
830
  signOut?: Maybe<Scalars['Boolean']['output']>;
@@ -830,97 +832,100 @@ export type Mutation = {
830
832
  verifyChallenge?: Maybe<Scalars['Boolean']['output']>;
831
833
  };
832
834
  export type MutationCreateUserArgs = {
833
- input?: InputMaybe<CreateUserInput>;
835
+ input: CreateUserInput;
834
836
  };
835
837
  export type MutationCreateUsersArgs = {
836
- input?: InputMaybe<CreateUsersInput>;
838
+ input: CreateUsersInput;
837
839
  };
838
840
  export type MutationUpdateUserArgs = {
839
- input?: InputMaybe<UpdateUserInput>;
841
+ input: UpdateUserInput;
840
842
  };
841
843
  export type MutationUpdateUsersArgs = {
842
- input?: InputMaybe<UpdateUsersInput>;
844
+ input: UpdateUsersInput;
843
845
  };
844
846
  export type MutationDeleteUserArgs = {
845
- input?: InputMaybe<DeleteUserInput>;
847
+ input: DeleteUserInput;
846
848
  };
847
849
  export type MutationDeleteUsersArgs = {
848
- input?: InputMaybe<DeleteUsersInput>;
850
+ input: DeleteUsersInput;
849
851
  };
850
852
  export type MutationCreatePostArgs = {
851
- input?: InputMaybe<CreatePostInput>;
853
+ input: CreatePostInput;
852
854
  };
853
855
  export type MutationCreatePostsArgs = {
854
- input?: InputMaybe<CreatePostsInput>;
856
+ input: CreatePostsInput;
855
857
  };
856
858
  export type MutationUpdatePostArgs = {
857
- input?: InputMaybe<UpdatePostInput>;
859
+ input: UpdatePostInput;
858
860
  };
859
861
  export type MutationUpdatePostsArgs = {
860
- input?: InputMaybe<UpdatePostsInput>;
862
+ input: UpdatePostsInput;
861
863
  };
862
864
  export type MutationDeletePostArgs = {
863
- input?: InputMaybe<DeletePostInput>;
865
+ input: DeletePostInput;
864
866
  };
865
867
  export type MutationDeletePostsArgs = {
866
- input?: InputMaybe<DeletePostsInput>;
868
+ input: DeletePostsInput;
867
869
  };
868
870
  export type MutationCreate_SessionArgs = {
869
- input?: InputMaybe<Create_SessionInput>;
871
+ input: Create_SessionInput;
870
872
  };
871
873
  export type MutationCreate_SessionsArgs = {
872
- input?: InputMaybe<Create_SessionsInput>;
874
+ input: Create_SessionsInput;
873
875
  };
874
876
  export type MutationUpdate_SessionArgs = {
875
- input?: InputMaybe<Update_SessionInput>;
877
+ input: Update_SessionInput;
876
878
  };
877
879
  export type MutationUpdate_SessionsArgs = {
878
- input?: InputMaybe<Update_SessionsInput>;
880
+ input: Update_SessionsInput;
879
881
  };
880
882
  export type MutationDelete_SessionArgs = {
881
- input?: InputMaybe<Delete_SessionInput>;
883
+ input: Delete_SessionInput;
882
884
  };
883
885
  export type MutationDelete_SessionsArgs = {
884
- input?: InputMaybe<Delete_SessionsInput>;
886
+ input: Delete_SessionsInput;
885
887
  };
886
888
  export type MutationCreateRoleArgs = {
887
- input?: InputMaybe<CreateRoleInput>;
889
+ input: CreateRoleInput;
888
890
  };
889
891
  export type MutationCreateRolesArgs = {
890
- input?: InputMaybe<CreateRolesInput>;
892
+ input: CreateRolesInput;
891
893
  };
892
894
  export type MutationUpdateRoleArgs = {
893
- input?: InputMaybe<UpdateRoleInput>;
895
+ input: UpdateRoleInput;
894
896
  };
895
897
  export type MutationUpdateRolesArgs = {
896
- input?: InputMaybe<UpdateRolesInput>;
898
+ input: UpdateRolesInput;
897
899
  };
898
900
  export type MutationDeleteRoleArgs = {
899
- input?: InputMaybe<DeleteRoleInput>;
901
+ input: DeleteRoleInput;
900
902
  };
901
903
  export type MutationDeleteRolesArgs = {
902
- input?: InputMaybe<DeleteRolesInput>;
904
+ input: DeleteRolesInput;
903
905
  };
904
906
  export type MutationCreateMutationArgs = {
905
- input?: InputMaybe<CreateMutationInput>;
907
+ input: CreateMutationInput;
906
908
  };
907
909
  export type MutationCustomMutationArgs = {
908
- input?: InputMaybe<CustomMutationInput>;
910
+ input: CustomMutationInput;
909
911
  };
910
912
  export type MutationSecondCustomMutationArgs = {
911
- input?: InputMaybe<SecondCustomMutationInput>;
913
+ input: SecondCustomMutationInput;
914
+ };
915
+ export type MutationSendEmailArgs = {
916
+ input: SendEmailInput;
912
917
  };
913
918
  export type MutationSignInWithArgs = {
914
- input?: InputMaybe<SignInWithInput>;
919
+ input: SignInWithInput;
915
920
  };
916
921
  export type MutationSignUpWithArgs = {
917
- input?: InputMaybe<SignUpWithInput>;
922
+ input: SignUpWithInput;
918
923
  };
919
924
  export type MutationRefreshArgs = {
920
- input?: InputMaybe<RefreshInput>;
925
+ input: RefreshInput;
921
926
  };
922
927
  export type MutationVerifyChallengeArgs = {
923
- input?: InputMaybe<VerifyChallengeInput>;
928
+ input: VerifyChallengeInput;
924
929
  };
925
930
  export type CreateUserPayload = {
926
931
  __typename?: 'CreateUserPayload';
@@ -1204,6 +1209,13 @@ export type SecondCustomMutationSumInput = {
1204
1209
  a: Scalars['Int']['input'];
1205
1210
  b: Scalars['Int']['input'];
1206
1211
  };
1212
+ export type SendEmailInput = {
1213
+ from: Scalars['String']['input'];
1214
+ to: Array<Scalars['String']['input']>;
1215
+ subject: Scalars['String']['input'];
1216
+ text?: InputMaybe<Scalars['String']['input']>;
1217
+ html?: InputMaybe<Scalars['String']['input']>;
1218
+ };
1207
1219
  export type SignInWithOutput = {
1208
1220
  __typename?: 'SignInWithOutput';
1209
1221
  id?: Maybe<Scalars['String']['output']>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
+ /// <reference types="react" />
4
+
3
5
  import { Wobe, WobeHandler, WobeResponse } from 'wobe';
4
6
 
5
7
  export type Maybe<T> = T | null;
@@ -674,11 +676,11 @@ export interface SessionConfig {
674
676
  /**
675
677
  * The time in milliseconds that the access token will expire
676
678
  */
677
- accessTokenExpiresIn?: number;
679
+ accessTokenExpiresInMs?: number;
678
680
  /**
679
681
  * The time in milliseconds that the refresh token will expire
680
682
  */
681
- refreshTokenExpiresIn?: number;
683
+ refreshTokenExpiresInMs?: number;
682
684
  /**
683
685
  * Set to true to automatically store the session tokens in cookies
684
686
  */
@@ -799,6 +801,30 @@ export type WabeFileAdapter = (file: File) => Promise<string>;
799
801
  export interface FileConfig {
800
802
  adapter: WabeFileAdapter;
801
803
  }
804
+ export interface EmailSendOptions {
805
+ from: string;
806
+ to: Array<string>;
807
+ subject: string;
808
+ node?: React.ReactNode;
809
+ html?: string;
810
+ text?: string;
811
+ }
812
+ export interface EmailAdapter {
813
+ /**
814
+ * Send an email using the provided adapter
815
+ * @param options Mail options (expeditor, recipient, subject ...)
816
+ * @return The id of the email sended, throw an error if something wrong
817
+ */
818
+ send(options: EmailSendOptions): Promise<string>;
819
+ }
820
+ export interface EmailConfig {
821
+ adapter: EmailAdapter;
822
+ }
823
+ declare class EmailController implements EmailAdapter {
824
+ adapter: EmailAdapter;
825
+ constructor(adapter: EmailAdapter);
826
+ send(options: EmailSendOptions): Promise<string>;
827
+ }
802
828
  export interface WabeConfig<T extends WabeTypes> {
803
829
  port: number;
804
830
  schema?: SchemaInterface<T>;
@@ -813,6 +839,7 @@ export interface WabeConfig<T extends WabeTypes> {
813
839
  routes?: WabeRoute[];
814
840
  rootKey: string;
815
841
  hooks?: Hook<any>[];
842
+ email?: EmailConfig;
816
843
  file?: FileConfig;
817
844
  }
818
845
  export type WabeTypes = {
@@ -823,13 +850,15 @@ export type WabeTypes = {
823
850
  export type WobeCustomContext<T extends WabeTypes> = {
824
851
  wabe: WabeContext<T>;
825
852
  };
853
+ export type WabeControllers<T extends WabeTypes> = {
854
+ database: DatabaseController<T>;
855
+ email?: EmailController;
856
+ };
826
857
  export declare class Wabe<T extends WabeTypes> {
827
858
  server: Wobe<WobeCustomContext<T>>;
828
859
  config: WabeConfig<T>;
829
- controllers: {
830
- database: DatabaseController<T>;
831
- };
832
- constructor({ port, schema, database, authentication, rootKey, codegen, hooks, file, }: WabeConfig<T>);
860
+ controllers: WabeControllers<T>;
861
+ constructor({ port, schema, database, authentication, rootKey, codegen, hooks, file, email, routes, }: WabeConfig<T>);
833
862
  loadAuthenticationMethods(): void;
834
863
  loadHooks(): void;
835
864
  loadDefaultRoutes(): void;