wabe 0.6.6 → 0.6.8
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 +8 -7
- package/bucket/b.txt +1 -0
- package/dist/authentication/OTP.d.ts +5 -0
- package/dist/authentication/Session.d.ts +4 -4
- package/dist/authentication/index.d.ts +1 -0
- package/dist/authentication/interface.d.ts +40 -25
- package/dist/authentication/oauth/GitHub.d.ts +1 -1
- package/dist/authentication/oauth/Google.d.ts +1 -1
- package/dist/authentication/oauth/Oauth2Client.d.ts +11 -11
- package/dist/authentication/oauth/utils.d.ts +1 -0
- package/dist/authentication/providers/EmailOTP.d.ts +2 -2
- package/dist/authentication/providers/EmailPassword.d.ts +3 -3
- package/dist/authentication/providers/EmailPasswordSRP.d.ts +21 -0
- package/dist/authentication/providers/GitHub.d.ts +3 -2
- package/dist/authentication/providers/Google.d.ts +3 -2
- package/dist/authentication/providers/OAuth.d.ts +2 -2
- package/dist/authentication/providers/PhonePassword.d.ts +3 -3
- package/dist/authentication/providers/QRCodeOTP.d.ts +11 -0
- package/dist/authentication/providers/index.d.ts +1 -0
- package/dist/authentication/resolvers/signInWithResolver.d.ts +4 -0
- package/dist/authentication/resolvers/signUpWithResolver.d.ts +4 -0
- package/dist/cron/index.d.ts +8 -8
- package/dist/database/{controllers/DatabaseController.d.ts → DatabaseController.d.ts} +29 -27
- package/dist/database/index.d.ts +6 -9
- package/dist/database/{adapters/adaptersInterface.d.ts → interface.d.ts} +33 -35
- package/dist/email/DevAdapter.d.ts +1 -0
- package/dist/email/interface.d.ts +4 -4
- package/dist/{files → file}/FileController.d.ts +1 -1
- package/dist/{files → file}/FileDevAdapter.d.ts +1 -1
- package/dist/{files → file}/interface.d.ts +9 -3
- package/dist/graphql/GraphQLSchema.d.ts +32 -32
- package/dist/graphql/parser.d.ts +13 -13
- package/dist/graphql/pointerAndRelationFunction.d.ts +6 -6
- package/dist/graphql/resolvers.d.ts +5 -5
- package/dist/hooks/HookObject.d.ts +13 -12
- package/dist/hooks/createUser.d.ts +1 -0
- package/dist/hooks/deleteSession.d.ts +2 -0
- package/dist/hooks/hashFieldHook.d.ts +6 -0
- package/dist/hooks/index.d.ts +17 -13
- package/dist/hooks/setEmail.d.ts +2 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +50770 -486
- package/dist/schema/Schema.d.ts +59 -57
- package/dist/schema/defaultResolvers.d.ts +2 -2
- package/dist/server/index.d.ts +20 -24
- package/dist/server/routes/authHandler.d.ts +11 -0
- package/dist/utils/export.d.ts +1 -0
- package/dist/utils/helper.d.ts +3 -6
- package/dist/utils/index.d.ts +6 -1
- package/generated/schema.graphql +85 -75
- package/generated/wabe.ts +47 -51
- package/package.json +5 -6
- package/dist/authentication/srp/processSRPChallenge.d.ts +0 -1
- package/dist/authentication/srp/signInWithSRP.d.ts +0 -1
- package/dist/authentication/srp/signUpWithSRP.d.ts +0 -1
- package/dist/database/adapters/MongoAdapter.d.ts +0 -64
- package/dist/database/adapters/index.d.ts +0 -2
- package/dist/database/controllers/index.d.ts +0 -1
- package/dist/hooks/authentication.d.ts +0 -2
- package/dist/payment/DevAdapter.d.ts +0 -17
- package/dist/payment/PaymentController.d.ts +0 -19
- package/dist/payment/index.d.ts +0 -2
- package/dist/payment/interface.d.ts +0 -235
- /package/dist/{files → file}/hookDeleteFile.d.ts +0 -0
- /package/dist/{files → file}/hookReadFile.d.ts +0 -0
- /package/dist/{files → file}/hookUploadFile.d.ts +0 -0
- /package/dist/{files → file}/index.d.ts +0 -0
package/generated/wabe.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export enum RoleEnum {
|
|
2
|
+
DashboardAdmin = "DashboardAdmin",
|
|
2
3
|
Admin = "Admin",
|
|
3
4
|
Client = "Client"
|
|
4
5
|
}
|
|
@@ -31,17 +32,24 @@ export type ACLObjectRolesACL = {
|
|
|
31
32
|
write: boolean
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
export type AuthenticationEmailPasswordSRP = {
|
|
36
|
+
email: string,
|
|
37
|
+
salt: string,
|
|
38
|
+
verifier: string,
|
|
39
|
+
serverSecret?: string
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
export type Authentication = {
|
|
43
|
+
emailPasswordSRP?: AuthenticationEmailPasswordSRP,
|
|
40
44
|
phonePassword?: AuthenticationPhonePassword,
|
|
41
45
|
emailPassword?: AuthenticationEmailPassword,
|
|
42
46
|
google?: AuthenticationGoogle,
|
|
43
|
-
github?: AuthenticationGithub
|
|
44
|
-
|
|
47
|
+
github?: AuthenticationGithub
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type AuthenticationPhonePassword = {
|
|
51
|
+
phone: string,
|
|
52
|
+
password: string
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export type AuthenticationEmailPassword = {
|
|
@@ -60,12 +68,6 @@ export type AuthenticationGithub = {
|
|
|
60
68
|
username: string
|
|
61
69
|
}
|
|
62
70
|
|
|
63
|
-
export type AuthenticationEmailPasswordSRP = {
|
|
64
|
-
salt: string,
|
|
65
|
-
verifier: string,
|
|
66
|
-
serverSecret?: string
|
|
67
|
-
}
|
|
68
|
-
|
|
69
71
|
export type SecondFA = {
|
|
70
72
|
enabled: boolean,
|
|
71
73
|
provider: SecondaryFactor
|
|
@@ -239,35 +241,6 @@ export type SecondCustomMutationSum = {
|
|
|
239
241
|
b: number
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
export type SignUpWithSRPInput = {
|
|
243
|
-
email: string,
|
|
244
|
-
salt: string,
|
|
245
|
-
verifier: string
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export type MutationSignUpWithSRPArgs = {
|
|
249
|
-
input: SignUpWithSRPInput
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export type SignInWithSRPInput = {
|
|
253
|
-
email: string,
|
|
254
|
-
clientPublic: string
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export type MutationSignInWithSRPArgs = {
|
|
258
|
-
input: SignInWithSRPInput
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export type ProcessSRPChallengeInput = {
|
|
262
|
-
email: string,
|
|
263
|
-
clientPublic: string,
|
|
264
|
-
clientSessionProof: string
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export type MutationProcessSRPChallengeArgs = {
|
|
268
|
-
input: ProcessSRPChallengeInput
|
|
269
|
-
}
|
|
270
|
-
|
|
271
244
|
export type ResetPasswordInput = {
|
|
272
245
|
password: string,
|
|
273
246
|
email?: string,
|
|
@@ -307,18 +280,26 @@ export type MutationSignInWithArgs = {
|
|
|
307
280
|
input: SignInWithInput
|
|
308
281
|
}
|
|
309
282
|
|
|
310
|
-
export type
|
|
311
|
-
|
|
312
|
-
|
|
283
|
+
export type SignInWithAuthenticationEmailPasswordSRP = {
|
|
284
|
+
email: string,
|
|
285
|
+
clientPublic?: string,
|
|
286
|
+
salt?: string,
|
|
287
|
+
verifier?: string
|
|
313
288
|
}
|
|
314
289
|
|
|
315
290
|
export type SignInWithAuthentication = {
|
|
291
|
+
emailPasswordSRP?: SignInWithAuthenticationEmailPasswordSRP,
|
|
316
292
|
phonePassword?: SignInWithAuthenticationPhonePassword,
|
|
317
293
|
emailPassword?: SignInWithAuthenticationEmailPassword,
|
|
318
294
|
google?: SignInWithAuthenticationGoogle,
|
|
319
295
|
github?: SignInWithAuthenticationGithub
|
|
320
296
|
}
|
|
321
297
|
|
|
298
|
+
export type SignInWithAuthenticationPhonePassword = {
|
|
299
|
+
phone: string,
|
|
300
|
+
password: string
|
|
301
|
+
}
|
|
302
|
+
|
|
322
303
|
export type SignInWithAuthenticationEmailPassword = {
|
|
323
304
|
email: string,
|
|
324
305
|
password: string
|
|
@@ -342,18 +323,26 @@ export type MutationSignUpWithArgs = {
|
|
|
342
323
|
input: SignUpWithInput
|
|
343
324
|
}
|
|
344
325
|
|
|
345
|
-
export type
|
|
346
|
-
|
|
347
|
-
|
|
326
|
+
export type SignUpWithAuthenticationEmailPasswordSRP = {
|
|
327
|
+
email: string,
|
|
328
|
+
clientPublic?: string,
|
|
329
|
+
salt?: string,
|
|
330
|
+
verifier?: string
|
|
348
331
|
}
|
|
349
332
|
|
|
350
333
|
export type SignUpWithAuthentication = {
|
|
334
|
+
emailPasswordSRP?: SignUpWithAuthenticationEmailPasswordSRP,
|
|
351
335
|
phonePassword?: SignUpWithAuthenticationPhonePassword,
|
|
352
336
|
emailPassword?: SignUpWithAuthenticationEmailPassword,
|
|
353
337
|
google?: SignUpWithAuthenticationGoogle,
|
|
354
338
|
github?: SignUpWithAuthenticationGithub
|
|
355
339
|
}
|
|
356
340
|
|
|
341
|
+
export type SignUpWithAuthenticationPhonePassword = {
|
|
342
|
+
phone: string,
|
|
343
|
+
password: string
|
|
344
|
+
}
|
|
345
|
+
|
|
357
346
|
export type SignUpWithAuthenticationEmailPassword = {
|
|
358
347
|
email: string,
|
|
359
348
|
password: string
|
|
@@ -394,19 +383,26 @@ export type MutationVerifyChallengeArgs = {
|
|
|
394
383
|
input: VerifyChallengeInput
|
|
395
384
|
}
|
|
396
385
|
|
|
397
|
-
export type
|
|
386
|
+
export type VerifyChallengeSecondFAEmailPasswordSRPChallenge = {
|
|
398
387
|
email: string,
|
|
399
|
-
|
|
388
|
+
clientPublic: string,
|
|
389
|
+
clientSessionProof: string
|
|
400
390
|
}
|
|
401
391
|
|
|
402
392
|
export type VerifyChallengeSecondFA = {
|
|
393
|
+
emailPasswordSRPChallenge?: VerifyChallengeSecondFAEmailPasswordSRPChallenge,
|
|
403
394
|
emailOTP?: VerifyChallengeSecondFAEmailOTP,
|
|
404
|
-
|
|
395
|
+
qrCodeOTP?: VerifyChallengeSecondFAQrCodeOTP
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export type VerifyChallengeSecondFAEmailOTP = {
|
|
399
|
+
email: string,
|
|
400
|
+
otp: string
|
|
405
401
|
}
|
|
406
402
|
|
|
407
|
-
export type
|
|
403
|
+
export type VerifyChallengeSecondFAQrCodeOTP = {
|
|
408
404
|
email: string,
|
|
409
|
-
|
|
405
|
+
otp: string
|
|
410
406
|
}
|
|
411
407
|
|
|
412
408
|
export type QueryHelloWorldArgs = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wabe",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Your backend in minutes not days",
|
|
5
5
|
"homepage": "https://wabe.dev",
|
|
6
6
|
"author": {
|
|
@@ -35,22 +35,21 @@
|
|
|
35
35
|
"js-srp6a": "1.0.2",
|
|
36
36
|
"jsonwebtoken": "9.0.2",
|
|
37
37
|
"libphonenumber-js": "1.11.18",
|
|
38
|
-
"mongodb": "6.13.1",
|
|
39
38
|
"otplib": "12.0.1",
|
|
40
39
|
"p-retry": "6.2.1",
|
|
41
40
|
"wobe": "1.1.10",
|
|
42
41
|
"wobe-graphql-yoga": "1.2.6"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@parcel/watcher": "2.3.0",
|
|
46
|
-
"@types/bun": "latest",
|
|
47
44
|
"@types/jsonwebtoken": "9.0.6",
|
|
48
45
|
"@types/uuid": "9.0.6",
|
|
49
|
-
"get-port": "7.1.0",
|
|
50
46
|
"graphql-request": "6.1.0",
|
|
47
|
+
"get-port": "7.1.0",
|
|
51
48
|
"uuid": "10.0.0",
|
|
52
49
|
"wabe-mongodb-launcher": "workspace:*",
|
|
53
50
|
"wabe-pluralize": "workspace:*",
|
|
54
|
-
"wabe-build": "workspace:*"
|
|
51
|
+
"wabe-build": "workspace:*",
|
|
52
|
+
"wabe-mongodb": "workspace:*",
|
|
53
|
+
"wabe": "workspace:*"
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const processSRPChallenge: unknown;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const signInWithSRP: unknown;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const signUpWithSRP: unknown;
|
|
@@ -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 +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
|
-
}
|
package/dist/payment/index.d.ts
DELETED
|
@@ -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
|