wabe 0.6.7 → 0.6.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.
Files changed (68) hide show
  1. package/README.md +10 -7
  2. package/dist/authentication/OTP.d.ts +8 -0
  3. package/dist/authentication/Session.d.ts +5 -5
  4. package/dist/authentication/index.d.ts +1 -0
  5. package/dist/authentication/interface.d.ts +43 -26
  6. package/dist/authentication/oauth/GitHub.d.ts +1 -1
  7. package/dist/authentication/oauth/Google.d.ts +1 -1
  8. package/dist/authentication/oauth/Oauth2Client.d.ts +11 -11
  9. package/dist/authentication/oauth/utils.d.ts +1 -0
  10. package/dist/authentication/providers/EmailOTP.d.ts +2 -2
  11. package/dist/authentication/providers/EmailPassword.d.ts +3 -3
  12. package/dist/authentication/providers/EmailPasswordSRP.d.ts +21 -0
  13. package/dist/authentication/providers/GitHub.d.ts +3 -2
  14. package/dist/authentication/providers/Google.d.ts +3 -2
  15. package/dist/authentication/providers/OAuth.d.ts +2 -2
  16. package/dist/authentication/providers/PhonePassword.d.ts +3 -3
  17. package/dist/authentication/providers/QRCodeOTP.d.ts +11 -0
  18. package/dist/authentication/providers/index.d.ts +1 -0
  19. package/dist/authentication/resolvers/signInWithResolver.d.ts +4 -0
  20. package/dist/authentication/resolvers/signUpWithResolver.d.ts +4 -0
  21. package/dist/authentication/utils.d.ts +0 -1
  22. package/dist/cron/index.d.ts +8 -8
  23. package/dist/database/{controllers/DatabaseController.d.ts → DatabaseController.d.ts} +38 -36
  24. package/dist/database/index.d.ts +6 -9
  25. package/dist/database/{adapters/adaptersInterface.d.ts → interface.d.ts} +37 -47
  26. package/dist/email/DevAdapter.d.ts +1 -0
  27. package/dist/email/interface.d.ts +4 -4
  28. package/dist/{files → file}/FileController.d.ts +1 -1
  29. package/dist/{files → file}/FileDevAdapter.d.ts +1 -1
  30. package/dist/{files → file}/interface.d.ts +9 -3
  31. package/dist/graphql/GraphQLSchema.d.ts +32 -32
  32. package/dist/graphql/parser.d.ts +13 -13
  33. package/dist/graphql/pointerAndRelationFunction.d.ts +6 -6
  34. package/dist/graphql/resolvers.d.ts +5 -5
  35. package/dist/hooks/HookObject.d.ts +13 -12
  36. package/dist/hooks/createUser.d.ts +1 -0
  37. package/dist/hooks/deleteSession.d.ts +2 -0
  38. package/dist/hooks/hashFieldHook.d.ts +6 -0
  39. package/dist/hooks/index.d.ts +17 -13
  40. package/dist/hooks/setEmail.d.ts +2 -0
  41. package/dist/index.d.ts +1 -2
  42. package/dist/index.js +51013 -486
  43. package/dist/schema/Schema.d.ts +59 -57
  44. package/dist/schema/defaultResolvers.d.ts +2 -2
  45. package/dist/server/index.d.ts +20 -24
  46. package/dist/server/interface.d.ts +1 -0
  47. package/dist/server/routes/authHandler.d.ts +11 -0
  48. package/dist/utils/crypto.d.ts +11 -0
  49. package/dist/utils/export.d.ts +2 -0
  50. package/dist/utils/helper.d.ts +3 -6
  51. package/dist/utils/index.d.ts +20 -2
  52. package/generated/schema.graphql +87 -76
  53. package/generated/wabe.ts +49 -52
  54. package/package.json +52 -54
  55. package/dist/authentication/srp/processSRPChallenge.d.ts +0 -1
  56. package/dist/authentication/srp/signInWithSRP.d.ts +0 -1
  57. package/dist/authentication/srp/signUpWithSRP.d.ts +0 -1
  58. package/dist/database/adapters/MongoAdapter.d.ts +0 -64
  59. package/dist/database/adapters/index.d.ts +0 -2
  60. package/dist/database/controllers/index.d.ts +0 -1
  61. package/dist/payment/DevAdapter.d.ts +0 -17
  62. package/dist/payment/PaymentController.d.ts +0 -19
  63. package/dist/payment/index.d.ts +0 -2
  64. package/dist/payment/interface.d.ts +0 -235
  65. /package/dist/{files → file}/hookDeleteFile.d.ts +0 -0
  66. /package/dist/{files → file}/hookReadFile.d.ts +0 -0
  67. /package/dist/{files → file}/hookUploadFile.d.ts +0 -0
  68. /package/dist/{files → file}/index.d.ts +0 -0
@@ -1,64 +0,0 @@
1
- import { type Db, MongoClient } from "mongodb";
2
- import type { AdapterOptions, DatabaseAdapter, GetObjectOptions, CreateObjectOptions, UpdateObjectOptions, GetObjectsOptions, CreateObjectsOptions, UpdateObjectsOptions, DeleteObjectsOptions, WhereType, DeleteObjectOptions, OutputType, CountOptions, OrderType } from "./adaptersInterface";
3
- import type { WabeTypes } from "../../server";
4
- import type { WabeContext } from "../../server/interface";
5
- export declare const buildMongoOrderQuery: <
6
- T extends WabeTypes,
7
- K extends keyof T["types"],
8
- U extends keyof T["types"][K]
9
- >(order?: OrderType<T, K, U>) => Record<string, any>;
10
- export declare const buildMongoWhereQuery: <
11
- T extends WabeTypes,
12
- K extends keyof T["types"]
13
- >(where?: WhereType<T, K>) => Record<string, any>;
14
- export declare class MongoAdapter<T extends WabeTypes> implements DatabaseAdapter<T> {
15
- options: AdapterOptions;
16
- database?: Db;
17
- client: MongoClient;
18
- constructor(options: AdapterOptions);
19
- connect();
20
- close();
21
- createClassIfNotExist(className: keyof T["types"], context: WabeContext<T>);
22
- count<K extends keyof T["types"]>(params: CountOptions<T, K>);
23
- clearDatabase();
24
- getObject<
25
- K extends keyof T["types"],
26
- U extends keyof T["types"][K]
27
- >(params: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
28
- getObjects<
29
- K extends keyof T["types"],
30
- U extends keyof T["types"][K],
31
- W extends keyof T["types"][K]
32
- >(params: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
33
- createObject<
34
- K extends keyof T["types"],
35
- U extends keyof T["types"][K],
36
- W extends keyof T["types"][K]
37
- >(params: CreateObjectOptions<T, K, U, W>);
38
- createObjects<
39
- K extends keyof T["types"],
40
- U extends keyof T["types"][K],
41
- W extends keyof T["types"][K],
42
- X extends keyof T["types"][K]
43
- >(params: CreateObjectsOptions<T, K, U, W, X>);
44
- updateObject<
45
- K extends keyof T["types"],
46
- U extends keyof T["types"][K],
47
- W extends keyof T["types"][K]
48
- >(params: UpdateObjectOptions<T, K, U, W>);
49
- updateObjects<
50
- K extends keyof T["types"],
51
- U extends keyof T["types"][K],
52
- W extends keyof T["types"][K],
53
- X extends keyof T["types"][K]
54
- >(params: UpdateObjectsOptions<T, K, U, W, X>);
55
- deleteObject<
56
- K extends keyof T["types"],
57
- U extends keyof T["types"][K]
58
- >(params: DeleteObjectOptions<T, K, U>);
59
- deleteObjects<
60
- K extends keyof T["types"],
61
- U extends keyof T["types"][U],
62
- W extends keyof T["types"][U]
63
- >(params: DeleteObjectsOptions<T, K, U, W>);
64
- }
@@ -1,2 +0,0 @@
1
- export * from "./MongoAdapter";
2
- export * from "./adaptersInterface";
@@ -1 +0,0 @@
1
- export * from "./DatabaseController";
@@ -1,17 +0,0 @@
1
- import type { PaymentAdapter } from "./interface";
2
- export declare class PaymentDevAdapter implements PaymentAdapter {
3
- adapter: {};
4
- getCustomerById();
5
- deleteCoupon();
6
- updatePromotionCode();
7
- createCoupon();
8
- createPromotionCode();
9
- validateWebhook();
10
- createCustomer();
11
- createPayment();
12
- cancelSubscription();
13
- getInvoices();
14
- getTotalRevenue();
15
- getAllTransactions();
16
- getHypotheticalSubscriptionRevenue();
17
- }
@@ -1,19 +0,0 @@
1
- import type { CancelSubscriptionOptions, CreateCustomerOptions, CreatePaymentOptions, GetInvoicesOptions, PaymentAdapter, PaymentConfig, GetTotalRevenueOptions, GetAllTransactionsOptions, GetCustomerByIdOptions, CreateCouponOptions, CreatePromotionCodeOptions, DeleteCouponOptions, UpdatePromotionCodeOptions } from "./interface";
2
- export declare class PaymentController implements PaymentAdapter {
3
- adapter: PaymentAdapter;
4
- private config;
5
- constructor(paymentConfig: PaymentConfig);
6
- deleteCoupon(options: DeleteCouponOptions);
7
- updatePromotionCode(options: UpdatePromotionCodeOptions);
8
- createCoupon(options: CreateCouponOptions);
9
- createPromotionCode(options: CreatePromotionCodeOptions);
10
- getCustomerById(options: GetCustomerByIdOptions);
11
- validateWebhook(ctx: any);
12
- createCustomer(options: CreateCustomerOptions);
13
- createPayment(options: Omit<CreatePaymentOptions, "currency" | "paymentMethod">);
14
- cancelSubscription(options: CancelSubscriptionOptions);
15
- getInvoices(options: GetInvoicesOptions);
16
- getTotalRevenue(options: GetTotalRevenueOptions);
17
- getAllTransactions(options: GetAllTransactionsOptions);
18
- getHypotheticalSubscriptionRevenue();
19
- }
@@ -1,2 +0,0 @@
1
- export * from "./interface";
2
- export * from "./DevAdapter";
@@ -1,235 +0,0 @@
1
- import type { Context } from "wobe";
2
- export declare enum Currency {
3
- EUR = "eur",
4
- USD = "usd",
5
- }
6
- export type Address = {
7
- city: string
8
- country: string
9
- line1: string
10
- line2: string
11
- postalCode: string
12
- state: string
13
- };
14
- export declare enum PaymentMode {
15
- payment = "payment",
16
- subscription = "subscription",
17
- }
18
- export type PaymentMethod = "card" | "paypal" | "link" | "sepa_debit" | "revolut_pay" | "us_bank_account";
19
- export declare enum PaymentReccuringInterval {
20
- Month = "month",
21
- Year = "year",
22
- }
23
- export type Product = {
24
- name: string
25
- unitAmount: number
26
- quantity: number
27
- };
28
- export interface OnPaymentSucceedOptions {
29
- createdAt: number;
30
- amount: number;
31
- customerEmail: string | null;
32
- currency: string;
33
- paymentMethodTypes: Array<string>;
34
- }
35
- export interface OnPaymentFailedOptions {
36
- createdAt: number;
37
- amount: number;
38
- paymentMethodTypes: Array<string>;
39
- }
40
- /**
41
- * PaymentConfig
42
- * @property adapter - The payment adapter
43
- * @property supportedPaymentMethods - The supported payment methods
44
- * @property currency - The currency
45
- */
46
- export interface PaymentConfig {
47
- adapter: PaymentAdapter;
48
- supportedPaymentMethods: Array<PaymentMethod>;
49
- currency: Currency;
50
- }
51
- export type Invoice = {
52
- amountDue: number
53
- amountPaid: number
54
- currency: Currency
55
- id: string
56
- created: number
57
- invoiceUrl: string
58
- isPaid: boolean
59
- };
60
- export type Transaction = {
61
- customerEmail: string
62
- amount: number
63
- currency: Currency
64
- created: number
65
- isSubscription: boolean
66
- reccuringInterval?: "month" | "year"
67
- };
68
- export type CreateCustomerOptions = {
69
- customerName?: string
70
- customerEmail: string
71
- customerPhone?: string
72
- address: Address
73
- paymentMethod: PaymentMethod
74
- };
75
- export type CreatePaymentOptions = {
76
- currency: Currency
77
- customerEmail?: string
78
- products: Array<Product>
79
- paymentMethod: Array<PaymentMethod>
80
- paymentMode: PaymentMode
81
- successUrl: string
82
- cancelUrl: string
83
- automaticTax?: boolean
84
- recurringInterval?: "month" | "year"
85
- createInvoice?: boolean
86
- allowPromotionCode?: boolean
87
- promotionCodeId?: string
88
- couponCodeId?: string
89
- };
90
- export type InitWebhookOptions = {
91
- webhookUrl: string
92
- };
93
- export type CancelSubscriptionOptions = {
94
- email: string
95
- };
96
- export type GetInvoicesOptions = {
97
- email: string
98
- };
99
- export type GetTotalRevenueOptions = {
100
- startRangeTimestamp?: number
101
- endRangeTimestamp?: number
102
- charge: "net" | "gross"
103
- };
104
- export type GetAllTransactionsOptions = {
105
- startRangeTimestamp?: number
106
- endRangeTimestamp?: number
107
- first?: number
108
- };
109
- export type GetCustomerByIdOptions = {
110
- id: string
111
- };
112
- export type ValidateWebhookOptions = {
113
- ctx: Context
114
- endpointSecret: string
115
- };
116
- /**
117
- * ValidateWebhookOutput
118
- * @property valid - Whether the webhook is valid or not
119
- * @property payload - The payload of the webhook
120
- */
121
- export type ValidateWebhookOutput = {
122
- isValid: boolean
123
- type: string
124
- payload: any | null
125
- };
126
- export type InitWebhookOutput = {
127
- webhookId: string
128
- endpointSecret: string
129
- };
130
- export type CreateCouponOptions = {
131
- amountOff?: number
132
- currency?: Currency
133
- duration?: "forever" | "once" | "repeating"
134
- durationInMonths?: number
135
- name?: string
136
- percentOff?: number
137
- maxRedemptions?: number
138
- };
139
- export type CreatePromotionCodeOptions = {
140
- couponId: string
141
- code?: string
142
- active?: boolean
143
- maxRedemptions?: number
144
- };
145
- export type DeleteCouponOptions = {
146
- id: string
147
- };
148
- export type UpdatePromotionCodeOptions = {
149
- id: string
150
- active: boolean
151
- };
152
- export interface PaymentAdapter {
153
- /**
154
- * Delete a coupon
155
- * @param options DeleteCouponOptions
156
- */
157
- deleteCoupon: (options: DeleteCouponOptions) => Promise<void>;
158
- /**
159
- * Create a coupon
160
- * @param options CreateCouponOptions
161
- * @returns id The coupon id
162
- */
163
- createCoupon: (options: CreateCouponOptions) => Promise<{
164
- code: string
165
- id: string
166
- }>;
167
- /**
168
- * Disable a promotion code
169
- * @param options DeletePromotionCodeOptions
170
- */
171
- updatePromotionCode: (options: UpdatePromotionCodeOptions) => Promise<void>;
172
- /**
173
- * Create a promotion code from a coupon
174
- * @param options CreatePromotionCodeOptions
175
- * @returns code, id The promotion code and the stripe id
176
- */
177
- createPromotionCode: (options: CreatePromotionCodeOptions) => Promise<{
178
- id: string
179
- code: string
180
- }>;
181
- /**
182
- * Get a customer by id
183
- * @param id The customer id
184
- * @returns The customer
185
- */
186
- getCustomerById: (options: GetCustomerByIdOptions) => Promise<{
187
- email: string | null
188
- }>;
189
- /**
190
- * Create a customer
191
- * @param options CreateCustomerOptions
192
- * @returns The customer email
193
- */
194
- createCustomer: (options: CreateCustomerOptions) => Promise<string>;
195
- /**
196
- * Create a payment
197
- * @param options CreatePaymentOptions
198
- * @returns The payment url
199
- */
200
- createPayment: (options: CreatePaymentOptions) => Promise<string>;
201
- /**
202
- * Cancel a subscription
203
- * @param options The customer email to cancel the subscription
204
- */
205
- cancelSubscription: (options: CancelSubscriptionOptions) => Promise<void>;
206
- /**
207
- * Get invoices
208
- * @param options The customer email to get the invoices
209
- * @returns The invoices of a customer
210
- */
211
- getInvoices: (options: GetInvoicesOptions) => Promise<Invoice[]>;
212
- /**
213
- * Get total revenue
214
- * @param options The type of charge (net or gross) and the start and end range timestamps to get the total revenue
215
- * @returns The total amount
216
- */
217
- getTotalRevenue: (options: GetTotalRevenueOptions) => Promise<number>;
218
- /**
219
- * Get the list of all transactions
220
- * @param options The start and end range timestamps to get the transactions
221
- * @returns The list of transactions
222
- */
223
- getAllTransactions: (options: GetAllTransactionsOptions) => Promise<Transaction[]>;
224
- /**
225
- * Get the hypothetical revenue of subscriptions
226
- * @returns The hypothetical revenue of subscriptions
227
- */
228
- getHypotheticalSubscriptionRevenue: () => Promise<number>;
229
- /**
230
- * Check if the request on webhook is from a valid provier
231
- * @param ctx The Wobe context of the request
232
- * @returns True if the request is from a valid provider, false otherwise
233
- */
234
- validateWebhook: (options: ValidateWebhookOptions) => Promise<ValidateWebhookOutput>;
235
- }
File without changes
File without changes
File without changes
File without changes