wabe 0.5.0 → 0.5.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/README.md +2 -2
- package/dist/generated/wabe.d.ts +97 -32
- package/dist/index.d.ts +147 -21
- package/dist/index.js +13802 -35491
- package/generated/schema.graphql +96 -31
- package/generated/wabe.ts +113 -32
- package/package.json +18 -13
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
|
-
//
|
|
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
|
|
66
|
+
More information on the [Contribution guide](https://github.com/palixir/wabe/blob/main/CONTRIBUTING.md)
|
|
67
67
|
|
|
68
68
|
## License
|
|
69
69
|
|
package/dist/generated/wabe.d.ts
CHANGED
|
@@ -79,6 +79,18 @@ export declare enum AuthenticationProvider {
|
|
|
79
79
|
export declare enum SecondaryFactor {
|
|
80
80
|
EmailOtp = "EmailOTP"
|
|
81
81
|
}
|
|
82
|
+
export declare enum PaymentMode {
|
|
83
|
+
Payment = "payment",
|
|
84
|
+
Subscription = "subscription"
|
|
85
|
+
}
|
|
86
|
+
export declare enum PaymentReccuringInterval {
|
|
87
|
+
Month = "month",
|
|
88
|
+
Year = "year"
|
|
89
|
+
}
|
|
90
|
+
export declare enum Currency {
|
|
91
|
+
Eur = "eur",
|
|
92
|
+
Usd = "usd"
|
|
93
|
+
}
|
|
82
94
|
/** User class */
|
|
83
95
|
export type User = {
|
|
84
96
|
__typename?: 'User';
|
|
@@ -519,6 +531,8 @@ export type Query = {
|
|
|
519
531
|
/** Hello world description */
|
|
520
532
|
helloWorld?: Maybe<Scalars['String']['output']>;
|
|
521
533
|
me?: Maybe<MeOutput>;
|
|
534
|
+
/** Get invoices of a customer */
|
|
535
|
+
getInvoices: Array<Maybe<Invoice>>;
|
|
522
536
|
};
|
|
523
537
|
export type QueryUserArgs = {
|
|
524
538
|
id?: InputMaybe<Scalars['ID']['input']>;
|
|
@@ -555,6 +569,9 @@ export type QueryRolesArgs = {
|
|
|
555
569
|
export type QueryHelloWorldArgs = {
|
|
556
570
|
name: Scalars['String']['input'];
|
|
557
571
|
};
|
|
572
|
+
export type QueryGetInvoicesArgs = {
|
|
573
|
+
email: Scalars['Email']['input'];
|
|
574
|
+
};
|
|
558
575
|
/** User class */
|
|
559
576
|
export type UserWhereInput = {
|
|
560
577
|
id?: InputMaybe<IdWhereInput>;
|
|
@@ -788,6 +805,16 @@ export type MeOutput = {
|
|
|
788
805
|
__typename?: 'MeOutput';
|
|
789
806
|
user?: Maybe<User>;
|
|
790
807
|
};
|
|
808
|
+
export type Invoice = {
|
|
809
|
+
__typename?: 'Invoice';
|
|
810
|
+
amountDue: Scalars['Int']['output'];
|
|
811
|
+
amountPaid: Scalars['Int']['output'];
|
|
812
|
+
currency: Currency;
|
|
813
|
+
id: Scalars['String']['output'];
|
|
814
|
+
created: Scalars['Int']['output'];
|
|
815
|
+
invoiceUrl: Scalars['String']['output'];
|
|
816
|
+
isPaid: Scalars['Boolean']['output'];
|
|
817
|
+
};
|
|
791
818
|
export type Mutation = {
|
|
792
819
|
__typename?: 'Mutation';
|
|
793
820
|
/** User class */
|
|
@@ -823,6 +850,11 @@ export type Mutation = {
|
|
|
823
850
|
createMutation: Scalars['Boolean']['output'];
|
|
824
851
|
customMutation?: Maybe<Scalars['Int']['output']>;
|
|
825
852
|
secondCustomMutation?: Maybe<Scalars['Int']['output']>;
|
|
853
|
+
/** Create a payment with the payment provider. Returns the url to redirect the user to pay */
|
|
854
|
+
createPayment?: Maybe<Scalars['String']['output']>;
|
|
855
|
+
cancelSubscription?: Maybe<Scalars['Boolean']['output']>;
|
|
856
|
+
/** Send basic email with text and html, returns the id of the email */
|
|
857
|
+
sendEmail?: Maybe<Scalars['String']['output']>;
|
|
826
858
|
signInWith?: Maybe<SignInWithOutput>;
|
|
827
859
|
signUpWith?: Maybe<SignUpWithOutput>;
|
|
828
860
|
signOut?: Maybe<Scalars['Boolean']['output']>;
|
|
@@ -830,97 +862,106 @@ export type Mutation = {
|
|
|
830
862
|
verifyChallenge?: Maybe<Scalars['Boolean']['output']>;
|
|
831
863
|
};
|
|
832
864
|
export type MutationCreateUserArgs = {
|
|
833
|
-
input
|
|
865
|
+
input: CreateUserInput;
|
|
834
866
|
};
|
|
835
867
|
export type MutationCreateUsersArgs = {
|
|
836
|
-
input
|
|
868
|
+
input: CreateUsersInput;
|
|
837
869
|
};
|
|
838
870
|
export type MutationUpdateUserArgs = {
|
|
839
|
-
input
|
|
871
|
+
input: UpdateUserInput;
|
|
840
872
|
};
|
|
841
873
|
export type MutationUpdateUsersArgs = {
|
|
842
|
-
input
|
|
874
|
+
input: UpdateUsersInput;
|
|
843
875
|
};
|
|
844
876
|
export type MutationDeleteUserArgs = {
|
|
845
|
-
input
|
|
877
|
+
input: DeleteUserInput;
|
|
846
878
|
};
|
|
847
879
|
export type MutationDeleteUsersArgs = {
|
|
848
|
-
input
|
|
880
|
+
input: DeleteUsersInput;
|
|
849
881
|
};
|
|
850
882
|
export type MutationCreatePostArgs = {
|
|
851
|
-
input
|
|
883
|
+
input: CreatePostInput;
|
|
852
884
|
};
|
|
853
885
|
export type MutationCreatePostsArgs = {
|
|
854
|
-
input
|
|
886
|
+
input: CreatePostsInput;
|
|
855
887
|
};
|
|
856
888
|
export type MutationUpdatePostArgs = {
|
|
857
|
-
input
|
|
889
|
+
input: UpdatePostInput;
|
|
858
890
|
};
|
|
859
891
|
export type MutationUpdatePostsArgs = {
|
|
860
|
-
input
|
|
892
|
+
input: UpdatePostsInput;
|
|
861
893
|
};
|
|
862
894
|
export type MutationDeletePostArgs = {
|
|
863
|
-
input
|
|
895
|
+
input: DeletePostInput;
|
|
864
896
|
};
|
|
865
897
|
export type MutationDeletePostsArgs = {
|
|
866
|
-
input
|
|
898
|
+
input: DeletePostsInput;
|
|
867
899
|
};
|
|
868
900
|
export type MutationCreate_SessionArgs = {
|
|
869
|
-
input
|
|
901
|
+
input: Create_SessionInput;
|
|
870
902
|
};
|
|
871
903
|
export type MutationCreate_SessionsArgs = {
|
|
872
|
-
input
|
|
904
|
+
input: Create_SessionsInput;
|
|
873
905
|
};
|
|
874
906
|
export type MutationUpdate_SessionArgs = {
|
|
875
|
-
input
|
|
907
|
+
input: Update_SessionInput;
|
|
876
908
|
};
|
|
877
909
|
export type MutationUpdate_SessionsArgs = {
|
|
878
|
-
input
|
|
910
|
+
input: Update_SessionsInput;
|
|
879
911
|
};
|
|
880
912
|
export type MutationDelete_SessionArgs = {
|
|
881
|
-
input
|
|
913
|
+
input: Delete_SessionInput;
|
|
882
914
|
};
|
|
883
915
|
export type MutationDelete_SessionsArgs = {
|
|
884
|
-
input
|
|
916
|
+
input: Delete_SessionsInput;
|
|
885
917
|
};
|
|
886
918
|
export type MutationCreateRoleArgs = {
|
|
887
|
-
input
|
|
919
|
+
input: CreateRoleInput;
|
|
888
920
|
};
|
|
889
921
|
export type MutationCreateRolesArgs = {
|
|
890
|
-
input
|
|
922
|
+
input: CreateRolesInput;
|
|
891
923
|
};
|
|
892
924
|
export type MutationUpdateRoleArgs = {
|
|
893
|
-
input
|
|
925
|
+
input: UpdateRoleInput;
|
|
894
926
|
};
|
|
895
927
|
export type MutationUpdateRolesArgs = {
|
|
896
|
-
input
|
|
928
|
+
input: UpdateRolesInput;
|
|
897
929
|
};
|
|
898
930
|
export type MutationDeleteRoleArgs = {
|
|
899
|
-
input
|
|
931
|
+
input: DeleteRoleInput;
|
|
900
932
|
};
|
|
901
933
|
export type MutationDeleteRolesArgs = {
|
|
902
|
-
input
|
|
934
|
+
input: DeleteRolesInput;
|
|
903
935
|
};
|
|
904
936
|
export type MutationCreateMutationArgs = {
|
|
905
|
-
input
|
|
937
|
+
input: CreateMutationInput;
|
|
906
938
|
};
|
|
907
939
|
export type MutationCustomMutationArgs = {
|
|
908
|
-
input
|
|
940
|
+
input: CustomMutationInput;
|
|
909
941
|
};
|
|
910
942
|
export type MutationSecondCustomMutationArgs = {
|
|
911
|
-
input
|
|
943
|
+
input: SecondCustomMutationInput;
|
|
944
|
+
};
|
|
945
|
+
export type MutationCreatePaymentArgs = {
|
|
946
|
+
input: CreatePaymentInput;
|
|
947
|
+
};
|
|
948
|
+
export type MutationCancelSubscriptionArgs = {
|
|
949
|
+
input: CancelSubscriptionInput;
|
|
950
|
+
};
|
|
951
|
+
export type MutationSendEmailArgs = {
|
|
952
|
+
input: SendEmailInput;
|
|
912
953
|
};
|
|
913
954
|
export type MutationSignInWithArgs = {
|
|
914
|
-
input
|
|
955
|
+
input: SignInWithInput;
|
|
915
956
|
};
|
|
916
957
|
export type MutationSignUpWithArgs = {
|
|
917
|
-
input
|
|
958
|
+
input: SignUpWithInput;
|
|
918
959
|
};
|
|
919
960
|
export type MutationRefreshArgs = {
|
|
920
|
-
input
|
|
961
|
+
input: RefreshInput;
|
|
921
962
|
};
|
|
922
963
|
export type MutationVerifyChallengeArgs = {
|
|
923
|
-
input
|
|
964
|
+
input: VerifyChallengeInput;
|
|
924
965
|
};
|
|
925
966
|
export type CreateUserPayload = {
|
|
926
967
|
__typename?: 'CreateUserPayload';
|
|
@@ -1204,6 +1245,30 @@ export type SecondCustomMutationSumInput = {
|
|
|
1204
1245
|
a: Scalars['Int']['input'];
|
|
1205
1246
|
b: Scalars['Int']['input'];
|
|
1206
1247
|
};
|
|
1248
|
+
export type CreatePaymentInput = {
|
|
1249
|
+
customerEmail?: InputMaybe<Scalars['Email']['input']>;
|
|
1250
|
+
paymentMode: PaymentMode;
|
|
1251
|
+
successUrl: Scalars['String']['input'];
|
|
1252
|
+
cancelUrl: Scalars['String']['input'];
|
|
1253
|
+
products: Array<InputMaybe<CreatePaymentProductInput>>;
|
|
1254
|
+
automaticTax?: InputMaybe<Scalars['Boolean']['input']>;
|
|
1255
|
+
recurringInterval?: InputMaybe<PaymentReccuringInterval>;
|
|
1256
|
+
};
|
|
1257
|
+
export type CreatePaymentProductInput = {
|
|
1258
|
+
name: Scalars['String']['input'];
|
|
1259
|
+
unitAmount: Scalars['Int']['input'];
|
|
1260
|
+
quantity: Scalars['Int']['input'];
|
|
1261
|
+
};
|
|
1262
|
+
export type CancelSubscriptionInput = {
|
|
1263
|
+
email: Scalars['Email']['input'];
|
|
1264
|
+
};
|
|
1265
|
+
export type SendEmailInput = {
|
|
1266
|
+
from: Scalars['String']['input'];
|
|
1267
|
+
to: Array<Scalars['String']['input']>;
|
|
1268
|
+
subject: Scalars['String']['input'];
|
|
1269
|
+
text?: InputMaybe<Scalars['String']['input']>;
|
|
1270
|
+
html?: InputMaybe<Scalars['String']['input']>;
|
|
1271
|
+
};
|
|
1207
1272
|
export type SignInWithOutput = {
|
|
1208
1273
|
__typename?: 'SignInWithOutput';
|
|
1209
1274
|
id?: Maybe<Scalars['String']['output']>;
|
|
@@ -1278,7 +1343,7 @@ export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, st
|
|
|
1278
1343
|
export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {};
|
|
1279
1344
|
export type Sdk = ReturnType<typeof getSdk>;
|
|
1280
1345
|
export type WabeSchemaScalars = "Phone";
|
|
1281
|
-
export type WabeSchemaEnums = "AuthenticationProvider" | "SecondaryFactor";
|
|
1346
|
+
export type WabeSchemaEnums = "AuthenticationProvider" | "SecondaryFactor" | "PaymentMode" | "PaymentReccuringInterval" | "Currency";
|
|
1282
1347
|
export type WabeSchemaTypes = {
|
|
1283
1348
|
User: User;
|
|
1284
1349
|
Post: Post;
|
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;
|
|
@@ -257,7 +259,7 @@ export type SignUpWithAuthenticationOtpInput = {
|
|
|
257
259
|
code?: InputMaybe<Scalars["String"]["input"]>;
|
|
258
260
|
};
|
|
259
261
|
export type WabeSchemaScalars = "Phone";
|
|
260
|
-
export type WabeSchemaEnums = "AuthenticationProvider" | "SecondaryFactor";
|
|
262
|
+
export type WabeSchemaEnums = "AuthenticationProvider" | "SecondaryFactor" | "PaymentMode" | "PaymentReccuringInterval" | "Currency";
|
|
261
263
|
export type WabeSchemaTypes = {
|
|
262
264
|
User: User;
|
|
263
265
|
Post: Post;
|
|
@@ -539,10 +541,9 @@ export type TypeFieldCustomEnums<T extends WabeTypes> = {
|
|
|
539
541
|
};
|
|
540
542
|
export type TypeField<T extends WabeTypes> = TypeFieldBase<string, "String"> | TypeFieldBase<number, "Int"> | TypeFieldBase<number, "Float"> | TypeFieldBase<boolean, "Boolean"> | TypeFieldBase<Date, "Date"> | TypeFieldBase<string, "Email"> | TypeFieldArray<T> | TypeFieldObject<T> | TypeFieldPointer<T> | TypeFieldRelation<T> | TypeFieldFile | TypeFieldCustomScalars<T> | TypeFieldCustomEnums<T>;
|
|
541
543
|
export type SchemaFields<T extends WabeTypes> = Record<string, TypeField<T>>;
|
|
542
|
-
export type
|
|
544
|
+
export type ResolverType<T extends WabeTypes> = {
|
|
543
545
|
required?: boolean;
|
|
544
546
|
description?: string;
|
|
545
|
-
args?: SchemaFields<T>;
|
|
546
547
|
resolve: (...args: any) => any;
|
|
547
548
|
} & ({
|
|
548
549
|
type: WabePrimaryTypes;
|
|
@@ -552,23 +553,21 @@ export type QueryResolver<T extends WabeTypes> = {
|
|
|
552
553
|
} | {
|
|
553
554
|
type: "Array";
|
|
554
555
|
typeValue: WabePrimaryTypes;
|
|
556
|
+
typeValueRequired?: boolean;
|
|
557
|
+
} | {
|
|
558
|
+
type: "Array";
|
|
559
|
+
typeValue: "Object";
|
|
560
|
+
outputObject: ClassInterface<T>;
|
|
561
|
+
typeValueRequired?: boolean;
|
|
555
562
|
});
|
|
563
|
+
export type QueryResolver<T extends WabeTypes> = {
|
|
564
|
+
args?: SchemaFields<T>;
|
|
565
|
+
} & ResolverType<T>;
|
|
556
566
|
export type MutationResolver<T extends WabeTypes> = {
|
|
557
|
-
required?: boolean;
|
|
558
|
-
description?: string;
|
|
559
567
|
args?: {
|
|
560
568
|
input: SchemaFields<T>;
|
|
561
569
|
};
|
|
562
|
-
|
|
563
|
-
} & ({
|
|
564
|
-
type: WabePrimaryTypes;
|
|
565
|
-
} | {
|
|
566
|
-
type: "Object";
|
|
567
|
-
outputObject: ClassInterface<T>;
|
|
568
|
-
} | {
|
|
569
|
-
type: "Array";
|
|
570
|
-
typeValue: WabePrimaryTypes;
|
|
571
|
-
});
|
|
570
|
+
} & ResolverType<T>;
|
|
572
571
|
export type TypeResolver<T extends WabeTypes> = {
|
|
573
572
|
queries?: {
|
|
574
573
|
[key: string]: QueryResolver<T>;
|
|
@@ -674,11 +673,11 @@ export interface SessionConfig {
|
|
|
674
673
|
/**
|
|
675
674
|
* The time in milliseconds that the access token will expire
|
|
676
675
|
*/
|
|
677
|
-
|
|
676
|
+
accessTokenExpiresInMs?: number;
|
|
678
677
|
/**
|
|
679
678
|
* The time in milliseconds that the refresh token will expire
|
|
680
679
|
*/
|
|
681
|
-
|
|
680
|
+
refreshTokenExpiresInMs?: number;
|
|
682
681
|
/**
|
|
683
682
|
* Set to true to automatically store the session tokens in cookies
|
|
684
683
|
*/
|
|
@@ -799,6 +798,128 @@ export type WabeFileAdapter = (file: File) => Promise<string>;
|
|
|
799
798
|
export interface FileConfig {
|
|
800
799
|
adapter: WabeFileAdapter;
|
|
801
800
|
}
|
|
801
|
+
export interface EmailSendOptions {
|
|
802
|
+
from: string;
|
|
803
|
+
to: Array<string>;
|
|
804
|
+
subject: string;
|
|
805
|
+
node?: React.ReactNode;
|
|
806
|
+
html?: string;
|
|
807
|
+
text?: string;
|
|
808
|
+
}
|
|
809
|
+
export interface EmailAdapter {
|
|
810
|
+
/**
|
|
811
|
+
* Send an email using the provided adapter
|
|
812
|
+
* @param options Mail options (expeditor, recipient, subject ...)
|
|
813
|
+
* @return The id of the email sended, throw an error if something wrong
|
|
814
|
+
*/
|
|
815
|
+
send(options: EmailSendOptions): Promise<string>;
|
|
816
|
+
}
|
|
817
|
+
export interface EmailConfig {
|
|
818
|
+
adapter: EmailAdapter;
|
|
819
|
+
}
|
|
820
|
+
declare class EmailController implements EmailAdapter {
|
|
821
|
+
adapter: EmailAdapter;
|
|
822
|
+
constructor(adapter: EmailAdapter);
|
|
823
|
+
send(options: EmailSendOptions): Promise<string>;
|
|
824
|
+
}
|
|
825
|
+
export declare enum Currency {
|
|
826
|
+
EUR = "eur",
|
|
827
|
+
USD = "usd"
|
|
828
|
+
}
|
|
829
|
+
export type Address = {
|
|
830
|
+
city: string;
|
|
831
|
+
country: string;
|
|
832
|
+
line1: string;
|
|
833
|
+
line2: string;
|
|
834
|
+
postalCode: string;
|
|
835
|
+
state: string;
|
|
836
|
+
};
|
|
837
|
+
export declare enum PaymentMode {
|
|
838
|
+
Payment = "payment",
|
|
839
|
+
Subscription = "subscription"
|
|
840
|
+
}
|
|
841
|
+
export type PaymentMethod = "card" | "paypal" | "link" | "sepa_debit" | "revolut_pay" | "us_bank_account";
|
|
842
|
+
export declare enum PaymentReccuringInterval {
|
|
843
|
+
Month = "month",
|
|
844
|
+
Year = "year"
|
|
845
|
+
}
|
|
846
|
+
export type Product = {
|
|
847
|
+
name: string;
|
|
848
|
+
unitAmount: number;
|
|
849
|
+
quantity: number;
|
|
850
|
+
};
|
|
851
|
+
export interface PaymentConfig {
|
|
852
|
+
adapter: PaymentAdapter;
|
|
853
|
+
supportedPaymentMethods: Array<PaymentMethod>;
|
|
854
|
+
currency: Currency;
|
|
855
|
+
}
|
|
856
|
+
export type Invoice = {
|
|
857
|
+
amountDue: number;
|
|
858
|
+
amountPaid: number;
|
|
859
|
+
currency: Currency;
|
|
860
|
+
id: string;
|
|
861
|
+
created: number;
|
|
862
|
+
invoiceUrl: string;
|
|
863
|
+
isPaid: boolean;
|
|
864
|
+
};
|
|
865
|
+
export type CreateCustomerOptions = {
|
|
866
|
+
customerName?: string;
|
|
867
|
+
customerEmail: string;
|
|
868
|
+
customerPhone?: string;
|
|
869
|
+
address: Address;
|
|
870
|
+
paymentMethod: PaymentMethod;
|
|
871
|
+
};
|
|
872
|
+
export type CreatePaymentOptions = {
|
|
873
|
+
currency: Currency;
|
|
874
|
+
customerEmail: string;
|
|
875
|
+
products: Array<Product>;
|
|
876
|
+
paymentMethod: Array<PaymentMethod>;
|
|
877
|
+
paymentMode: PaymentMode;
|
|
878
|
+
successUrl: string;
|
|
879
|
+
cancelUrl: string;
|
|
880
|
+
automaticTax?: boolean;
|
|
881
|
+
recurringInterval?: "month" | "year";
|
|
882
|
+
};
|
|
883
|
+
export type CancelSubscriptionOptions = {
|
|
884
|
+
email: string;
|
|
885
|
+
};
|
|
886
|
+
export type GetInvoicesOptions = {
|
|
887
|
+
email: string;
|
|
888
|
+
};
|
|
889
|
+
export interface PaymentAdapter {
|
|
890
|
+
/**
|
|
891
|
+
* Create a customer
|
|
892
|
+
* @param options CreateCustomerOptions
|
|
893
|
+
* @returns The customer email
|
|
894
|
+
*/
|
|
895
|
+
createCustomer: (options: CreateCustomerOptions) => Promise<string>;
|
|
896
|
+
/**
|
|
897
|
+
* Create a payment
|
|
898
|
+
* @param options CreatePaymentOptions
|
|
899
|
+
* @returns The payment url
|
|
900
|
+
*/
|
|
901
|
+
createPayment: (options: CreatePaymentOptions) => Promise<string>;
|
|
902
|
+
/**
|
|
903
|
+
* Cancel a subscription
|
|
904
|
+
* @param options The customer email to cancel the subscription
|
|
905
|
+
*/
|
|
906
|
+
cancelSubscription: (options: CancelSubscriptionOptions) => Promise<void>;
|
|
907
|
+
/**
|
|
908
|
+
* Get invoices
|
|
909
|
+
* @param options The customer email to get the invoices
|
|
910
|
+
* @returns The invoices of a customer
|
|
911
|
+
*/
|
|
912
|
+
getInvoices: (options: GetInvoicesOptions) => Promise<Invoice[]>;
|
|
913
|
+
}
|
|
914
|
+
declare class PaymentController implements PaymentAdapter {
|
|
915
|
+
private adapter;
|
|
916
|
+
private config;
|
|
917
|
+
constructor(paymentConfig: PaymentConfig);
|
|
918
|
+
createCustomer(options: CreateCustomerOptions): Promise<string>;
|
|
919
|
+
createPayment(options: Omit<CreatePaymentOptions, "currency" | "paymentMethod">): Promise<string>;
|
|
920
|
+
cancelSubscription(options: CancelSubscriptionOptions): Promise<void>;
|
|
921
|
+
getInvoices(options: GetInvoicesOptions): Promise<Invoice[]>;
|
|
922
|
+
}
|
|
802
923
|
export interface WabeConfig<T extends WabeTypes> {
|
|
803
924
|
port: number;
|
|
804
925
|
schema?: SchemaInterface<T>;
|
|
@@ -813,6 +934,8 @@ export interface WabeConfig<T extends WabeTypes> {
|
|
|
813
934
|
routes?: WabeRoute[];
|
|
814
935
|
rootKey: string;
|
|
815
936
|
hooks?: Hook<any>[];
|
|
937
|
+
email?: EmailConfig;
|
|
938
|
+
payment?: PaymentConfig;
|
|
816
939
|
file?: FileConfig;
|
|
817
940
|
}
|
|
818
941
|
export type WabeTypes = {
|
|
@@ -823,13 +946,16 @@ export type WabeTypes = {
|
|
|
823
946
|
export type WobeCustomContext<T extends WabeTypes> = {
|
|
824
947
|
wabe: WabeContext<T>;
|
|
825
948
|
};
|
|
949
|
+
export type WabeControllers<T extends WabeTypes> = {
|
|
950
|
+
database: DatabaseController<T>;
|
|
951
|
+
email?: EmailController;
|
|
952
|
+
payment?: PaymentController;
|
|
953
|
+
};
|
|
826
954
|
export declare class Wabe<T extends WabeTypes> {
|
|
827
955
|
server: Wobe<WobeCustomContext<T>>;
|
|
828
956
|
config: WabeConfig<T>;
|
|
829
|
-
controllers:
|
|
830
|
-
|
|
831
|
-
};
|
|
832
|
-
constructor({ port, schema, database, authentication, rootKey, codegen, hooks, file, }: WabeConfig<T>);
|
|
957
|
+
controllers: WabeControllers<T>;
|
|
958
|
+
constructor({ port, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
|
|
833
959
|
loadAuthenticationMethods(): void;
|
|
834
960
|
loadHooks(): void;
|
|
835
961
|
loadDefaultRoutes(): void;
|