wabe 0.5.7 → 0.5.9

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  /// <reference types="react" />
4
4
 
5
- import { Context, Wobe, WobeHandler, WobeResponse } from 'wobe';
5
+ import { Context, CorsOptions, RateLimitOptions, Wobe, WobeHandler, WobeResponse } from 'wobe';
6
6
 
7
7
  export type Scalars = {
8
8
  ID: {
@@ -683,18 +683,18 @@ export declare const _findHooksByPriority: <T extends unknown>({ className, oper
683
683
  }) => Promise<Hook<any, any>[]>;
684
684
  export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context, }: {
685
685
  className: K;
686
- newData?: MutationData<DevWabeTypes, any, any> | undefined;
686
+ newData?: MutationData<DevWabeTypes, any, any>;
687
687
  context: WabeContext<any>;
688
688
  }) => {
689
689
  runOnSingleObject: ({ operationType, id, object: inputObject, }: {
690
690
  operationType: OperationType;
691
- id?: string | undefined;
692
- object?: OutputType<DevWabeTypes, any, any> | undefined;
691
+ id?: string;
692
+ object?: OutputType<DevWabeTypes, any, any>;
693
693
  }) => Promise<MutationData<T, K, any>>;
694
694
  runOnMultipleObjects: ({ operationType, where, objects: inputObjects, }: {
695
695
  operationType: OperationType;
696
- where?: WhereType<any, any> | undefined;
697
- objects?: OutputType<DevWabeTypes, any, any>[] | undefined;
696
+ where?: WhereType<any, any>;
697
+ objects?: OutputType<DevWabeTypes, any, any>[];
698
698
  }) => Promise<{
699
699
  objects: never[];
700
700
  newData: MutationData<DevWabeTypes, any, any>[];
@@ -1009,7 +1009,11 @@ export type WabeFileAdapter = (file: File) => Promise<string>;
1009
1009
  export interface FileConfig {
1010
1010
  adapter: WabeFileAdapter;
1011
1011
  }
1012
- export type Templates = "sendOTPCode";
1012
+ export type HtmlTemplates = {
1013
+ sendOTPCode: (options: {
1014
+ otp: string;
1015
+ }) => string | Promise<string>;
1016
+ };
1013
1017
  export interface EmailSendOptions {
1014
1018
  from: string;
1015
1019
  to: Array<string>;
@@ -1035,7 +1039,7 @@ export interface EmailAdapter {
1035
1039
  export interface EmailConfig {
1036
1040
  adapter: EmailAdapter;
1037
1041
  mainEmail?: string;
1038
- htmlTemplates?: Record<Templates, (payload: any) => string>;
1042
+ htmlTemplates?: HtmlTemplates;
1039
1043
  }
1040
1044
  export declare class EmailDevAdapter implements EmailAdapter {
1041
1045
  send(): Promise<string>;
@@ -1120,7 +1124,7 @@ export type CreateCustomerOptions = {
1120
1124
  };
1121
1125
  export type CreatePaymentOptions = {
1122
1126
  currency: Currency$1;
1123
- customerEmail: string;
1127
+ customerEmail?: string;
1124
1128
  products: Array<Product>;
1125
1129
  paymentMethod: Array<PaymentMethod>;
1126
1130
  paymentMode: PaymentMode;
@@ -1253,9 +1257,14 @@ declare class PaymentController implements PaymentAdapter {
1253
1257
  getAllTransactions(options: GetAllTransactionsOptions): Promise<Transaction[]>;
1254
1258
  getHypotheticalSubscriptionRevenue(): Promise<number>;
1255
1259
  }
1260
+ export type SecurityConfig = {
1261
+ corsOptions?: CorsOptions;
1262
+ rateLimit?: RateLimitOptions;
1263
+ };
1256
1264
  export interface WabeConfig<T extends WabeTypes> {
1257
1265
  port: number;
1258
- publicUrl?: string;
1266
+ hostname?: string;
1267
+ security?: SecurityConfig;
1259
1268
  schema?: SchemaInterface<T>;
1260
1269
  database: DatabaseConfig;
1261
1270
  codegen?: {
@@ -1289,7 +1298,7 @@ export declare class Wabe<T extends WabeTypes> {
1289
1298
  server: Wobe<WobeCustomContext<T>>;
1290
1299
  config: WabeConfig<T>;
1291
1300
  controllers: WabeControllers<T>;
1292
- constructor({ port, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, publicUrl, }: WabeConfig<T>);
1301
+ constructor({ port, hostname, security, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
1293
1302
  loadRoleEnum(): void;
1294
1303
  loadAuthenticationMethods(): void;
1295
1304
  loadHooks(): void;
@@ -1356,7 +1365,7 @@ export interface Tokens {
1356
1365
  idToken?: string;
1357
1366
  }
1358
1367
  export interface OAuth2ProviderWithPKCE {
1359
- createAuthorizationURL(state: string, codeVerifier: string): Promise<URL>;
1368
+ createAuthorizationURL(state: string, codeVerifier: string): URL;
1360
1369
  validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
1361
1370
  refreshAccessToken?(refreshToken: string): Promise<Tokens>;
1362
1371
  }
@@ -1366,7 +1375,7 @@ export declare class Google implements OAuth2ProviderWithPKCE {
1366
1375
  constructor(config: WabeConfig<any>);
1367
1376
  createAuthorizationURL(state: string, codeVerifier: string, options?: {
1368
1377
  scopes?: string[];
1369
- }): Promise<URL>;
1378
+ }): URL;
1370
1379
  validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
1371
1380
  refreshAccessToken(refreshToken: string): Promise<Tokens>;
1372
1381
  getUserInfo(accessToken: string, idToken: string): Promise<{
@@ -1380,8 +1389,17 @@ export declare class PaymentDevAdapter implements PaymentAdapter {
1380
1389
  }>;
1381
1390
  validateWebhook(): Promise<{
1382
1391
  isValid: boolean;
1383
- payload: {};
1392
+ payload: {
1393
+ type: string;
1394
+ };
1384
1395
  }>;
1396
+ createCustomer(): Promise<string>;
1397
+ createPayment(): Promise<string>;
1398
+ cancelSubscription(): Promise<void>;
1399
+ getInvoices(): Promise<never[]>;
1400
+ getTotalRevenue(): Promise<number>;
1401
+ getAllTransactions(): Promise<never[]>;
1402
+ getHypotheticalSubscriptionRevenue(): Promise<number>;
1385
1403
  }
1386
1404
 
1387
1405
  export {