@faire-auth/stripe 1.0.4 → 1.1.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/.turbo/turbo-build.log +29 -22
- package/dist/client.cjs +3 -5
- package/dist/client.d.cts +3 -7
- package/dist/client.d.mts +3 -7
- package/dist/client.mjs +2 -4
- package/dist/{index-6UTHxaqg.d.cts → index-CWz-G_AJ.d.cts} +223 -328
- package/dist/{index-CYV4awaB.d.mts → index-D4yUrDJc.d.mts} +221 -326
- package/dist/index.cjs +192 -124
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +128 -59
- package/package.json +13 -13
- package/tsdown.config.ts +10 -8
- package/.turbo/turbo-test.log +0 -1578
- package/.turbo/turbo-typecheck.log +0 -4
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import * as faire_auth0 from "faire-auth";
|
|
2
1
|
import { ContextVars, InferOptionSchema } from "faire-auth";
|
|
3
2
|
import Stripe from "stripe";
|
|
4
3
|
import * as z from "zod";
|
|
5
4
|
import { Session, User } from "faire-auth/db";
|
|
6
|
-
import * as hono0 from "hono";
|
|
7
|
-
import * as _faire_auth_core_types0 from "@faire-auth/core/types";
|
|
8
5
|
import { Context } from "@faire-auth/core/types";
|
|
9
|
-
|
|
10
|
-
//#region src/schema.d.ts
|
|
11
6
|
declare const subscriptions: {
|
|
12
7
|
subscription: {
|
|
13
8
|
fields: {
|
|
@@ -69,8 +64,6 @@ declare const user: {
|
|
|
69
64
|
};
|
|
70
65
|
};
|
|
71
66
|
};
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/types.d.ts
|
|
74
67
|
type StripePlan = {
|
|
75
68
|
/**
|
|
76
69
|
* Monthly price id
|
|
@@ -377,12 +370,15 @@ interface StripeOptions {
|
|
|
377
370
|
*/
|
|
378
371
|
schema?: InferOptionSchema<typeof subscriptions & typeof user>;
|
|
379
372
|
}
|
|
380
|
-
//#endregion
|
|
381
|
-
//#region src/index.d.ts
|
|
382
373
|
declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
383
374
|
id: "stripe";
|
|
384
375
|
routes: {
|
|
385
|
-
stripeWebhook:
|
|
376
|
+
stripeWebhook: import("faire-auth").AuthEndpoint<{
|
|
377
|
+
getRoutingPath: () => "/stripe/webhook";
|
|
378
|
+
operationId: "stripeWebhook";
|
|
379
|
+
method: "post";
|
|
380
|
+
path: "/stripe/webhook";
|
|
381
|
+
client: false;
|
|
386
382
|
responses: {
|
|
387
383
|
200: {
|
|
388
384
|
description: string;
|
|
@@ -403,7 +399,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
403
399
|
success: z.ZodLiteral<false>;
|
|
404
400
|
code: z.ZodOptional<z.ZodString>;
|
|
405
401
|
message: z.ZodOptional<z.ZodString>;
|
|
406
|
-
}, z.core.$strip>, "error">;
|
|
402
|
+
}, z.core.$strip>, "error", "out">;
|
|
407
403
|
};
|
|
408
404
|
};
|
|
409
405
|
};
|
|
@@ -416,16 +412,11 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
416
412
|
success: z.ZodLiteral<false>;
|
|
417
413
|
code: z.ZodOptional<z.ZodString>;
|
|
418
414
|
message: z.ZodOptional<z.ZodString>;
|
|
419
|
-
}, z.core.$strip>, "error">;
|
|
415
|
+
}, z.core.$strip>, "error", "out">;
|
|
420
416
|
};
|
|
421
417
|
};
|
|
422
418
|
};
|
|
423
419
|
};
|
|
424
|
-
operationId: "stripeWebhook";
|
|
425
|
-
path: "/stripe/webhook";
|
|
426
|
-
method: "post";
|
|
427
|
-
client: false;
|
|
428
|
-
getRoutingPath: () => "/stripe/webhook";
|
|
429
420
|
}>;
|
|
430
421
|
} & (O["subscription"] extends {
|
|
431
422
|
enabled: boolean;
|
|
@@ -445,66 +436,12 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
445
436
|
*
|
|
446
437
|
* @see [Read our docs to learn more.](https://faire-auth.com/docs/plugins/stripe#api-method-subscription-upgrade)
|
|
447
438
|
*/
|
|
448
|
-
readonly upgradeSubscription:
|
|
449
|
-
|
|
450
|
-
200: {
|
|
451
|
-
description: string;
|
|
452
|
-
content: {
|
|
453
|
-
"application/json": {
|
|
454
|
-
schema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
455
|
-
redirect: z.ZodLiteral<false>;
|
|
456
|
-
url: z.ZodDefault<z.ZodNull>;
|
|
457
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
458
|
-
redirect: z.ZodLiteral<true>;
|
|
459
|
-
url: z.ZodURL;
|
|
460
|
-
}, z.core.$strip>], "redirect">, z.ZodType<Partial<Stripe.Checkout.Session>, Partial<Stripe.Checkout.Session>, z.core.$ZodTypeInternals<Partial<Stripe.Checkout.Session>, Partial<Stripe.Checkout.Session>>>>;
|
|
461
|
-
};
|
|
462
|
-
};
|
|
463
|
-
};
|
|
464
|
-
} & {
|
|
465
|
-
400: {
|
|
466
|
-
description: string;
|
|
467
|
-
content: {
|
|
468
|
-
"application/json": {
|
|
469
|
-
schema: z.core.$ZodBranded<z.ZodObject<{
|
|
470
|
-
success: z.ZodLiteral<false>;
|
|
471
|
-
code: z.ZodOptional<z.ZodString>;
|
|
472
|
-
message: z.ZodOptional<z.ZodString>;
|
|
473
|
-
}, z.core.$strip>, "error">;
|
|
474
|
-
};
|
|
475
|
-
};
|
|
476
|
-
};
|
|
477
|
-
} & {
|
|
478
|
-
401: {
|
|
479
|
-
description: string;
|
|
480
|
-
content: {
|
|
481
|
-
"application/json": {
|
|
482
|
-
schema: z.core.$ZodBranded<z.ZodObject<{
|
|
483
|
-
success: z.ZodLiteral<false>;
|
|
484
|
-
code: z.ZodOptional<z.ZodString>;
|
|
485
|
-
message: z.ZodOptional<z.ZodString>;
|
|
486
|
-
}, z.core.$strip>, "error">;
|
|
487
|
-
};
|
|
488
|
-
};
|
|
489
|
-
};
|
|
490
|
-
} & {
|
|
491
|
-
500: {
|
|
492
|
-
description: string;
|
|
493
|
-
content: {
|
|
494
|
-
"application/json": {
|
|
495
|
-
schema: z.core.$ZodBranded<z.ZodObject<{
|
|
496
|
-
success: z.ZodLiteral<false>;
|
|
497
|
-
code: z.ZodOptional<z.ZodString>;
|
|
498
|
-
message: z.ZodOptional<z.ZodString>;
|
|
499
|
-
}, z.core.$strip>, "error">;
|
|
500
|
-
};
|
|
501
|
-
};
|
|
502
|
-
};
|
|
503
|
-
};
|
|
439
|
+
readonly upgradeSubscription: import("faire-auth").AuthEndpoint<{
|
|
440
|
+
getRoutingPath: () => "/subscription/upgrade";
|
|
504
441
|
operationId: "upgradeSubscription";
|
|
505
|
-
path: "/subscription/upgrade";
|
|
506
442
|
method: "post";
|
|
507
|
-
|
|
443
|
+
path: "/subscription/upgrade";
|
|
444
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
508
445
|
session: {
|
|
509
446
|
user: {
|
|
510
447
|
stripeCustomerId?: string;
|
|
@@ -512,38 +449,19 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
512
449
|
};
|
|
513
450
|
} & {
|
|
514
451
|
session: {
|
|
515
|
-
session:
|
|
516
|
-
|
|
517
|
-
createdAt: Date;
|
|
518
|
-
updatedAt: Date;
|
|
519
|
-
userId: string;
|
|
520
|
-
expiresAt: Date;
|
|
521
|
-
token: string;
|
|
522
|
-
id?: string;
|
|
523
|
-
ipAddress?: string | null;
|
|
524
|
-
userAgent?: string | null;
|
|
525
|
-
};
|
|
526
|
-
user: {
|
|
527
|
-
[x: string]: unknown;
|
|
528
|
-
id: string;
|
|
529
|
-
createdAt: Date;
|
|
530
|
-
updatedAt: Date;
|
|
531
|
-
email: string;
|
|
532
|
-
emailVerified: boolean;
|
|
533
|
-
name?: string;
|
|
534
|
-
image?: string | null;
|
|
535
|
-
};
|
|
452
|
+
session: Session;
|
|
453
|
+
user: User;
|
|
536
454
|
};
|
|
537
|
-
}>, string, {}>, next:
|
|
455
|
+
}>, string, {}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
538
456
|
success: false;
|
|
539
457
|
code?: string | undefined;
|
|
540
458
|
message?: string | undefined;
|
|
541
|
-
}, 401>)>, (ctx:
|
|
459
|
+
}, 401>)>, (ctx: import("hono").Context<import("faire-auth").ContextVars<object>, string, {}>, next: import("hono").Next) => Promise<void | Response>, (ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
542
460
|
session?: {
|
|
543
461
|
session: Session;
|
|
544
462
|
user: User;
|
|
545
463
|
};
|
|
546
|
-
}>, "/subscription/
|
|
464
|
+
}>, "/subscription/billing-portal" | "/subscription/cancel" | "/subscription/list" | "/subscription/restore" | "/subscription/upgrade", {
|
|
547
465
|
out: {
|
|
548
466
|
json: {
|
|
549
467
|
referenceId?: string;
|
|
@@ -552,9 +470,9 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
552
470
|
referenceId?: string;
|
|
553
471
|
};
|
|
554
472
|
};
|
|
555
|
-
}>, next:
|
|
473
|
+
}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
556
474
|
success: false;
|
|
557
|
-
}, 401, "json">) | (Response &
|
|
475
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
558
476
|
success: false;
|
|
559
477
|
}, 400, "json">)>];
|
|
560
478
|
request: {
|
|
@@ -579,65 +497,36 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
579
497
|
required: true;
|
|
580
498
|
};
|
|
581
499
|
};
|
|
582
|
-
getRoutingPath: () => "/subscription/upgrade";
|
|
583
|
-
}>;
|
|
584
|
-
readonly cancelSubscriptionCallback: faire_auth0.AuthEndpoint<{
|
|
585
500
|
responses: {
|
|
586
501
|
200: {
|
|
587
502
|
description: string;
|
|
588
503
|
content: {
|
|
589
504
|
"application/json": {
|
|
590
|
-
schema: z.
|
|
505
|
+
schema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
506
|
+
redirect: z.ZodLiteral<false>;
|
|
507
|
+
url: z.ZodDefault<z.ZodNull>;
|
|
508
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
509
|
+
redirect: z.ZodLiteral<true>;
|
|
510
|
+
url: z.ZodURL;
|
|
511
|
+
}, z.core.$strip>], "redirect">, z.ZodType<Partial<Stripe.Checkout.Session>, Partial<Stripe.Checkout.Session>, z.core.$ZodTypeInternals<Partial<Stripe.Checkout.Session>, Partial<Stripe.Checkout.Session>>>>;
|
|
591
512
|
};
|
|
592
513
|
};
|
|
593
514
|
};
|
|
594
515
|
} & {
|
|
595
|
-
|
|
596
|
-
description: string;
|
|
597
|
-
};
|
|
598
|
-
};
|
|
599
|
-
operationId: "cancelSubscriptionCallback";
|
|
600
|
-
path: "/subscription/cancel/callback";
|
|
601
|
-
method: "get";
|
|
602
|
-
middleware: [(ctx: hono0.Context<faire_auth0.ContextVars<object>, string, {}>, next: hono0.Next) => Promise<void | Response>];
|
|
603
|
-
request: {
|
|
604
|
-
query: z.ZodObject<{
|
|
605
|
-
callbackURL: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodTransform<string | undefined, string | undefined>, z.ZodOptional<z.ZodURL>>, z.ZodTransform<string | undefined, string | undefined>>>;
|
|
606
|
-
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
607
|
-
}, z.core.$strip>;
|
|
608
|
-
};
|
|
609
|
-
getRoutingPath: () => "/subscription/cancel/callback";
|
|
610
|
-
}>;
|
|
611
|
-
/**
|
|
612
|
-
* ### Endpoint
|
|
613
|
-
*
|
|
614
|
-
* POST `/subscription/cancel`
|
|
615
|
-
*
|
|
616
|
-
* ### API Methods
|
|
617
|
-
*
|
|
618
|
-
* **server:**
|
|
619
|
-
* `auth.api.cancelSubscription`
|
|
620
|
-
*
|
|
621
|
-
* **client:**
|
|
622
|
-
* `authClient.subscription.cancel`
|
|
623
|
-
*
|
|
624
|
-
* @see [Read our docs to learn more.](https://faire-auth.com/docs/plugins/stripe#api-method-subscription-cancel)
|
|
625
|
-
*/
|
|
626
|
-
readonly cancelSubscription: faire_auth0.AuthEndpoint<{
|
|
627
|
-
responses: {
|
|
628
|
-
200: {
|
|
516
|
+
400: {
|
|
629
517
|
description: string;
|
|
630
518
|
content: {
|
|
631
519
|
"application/json": {
|
|
632
|
-
schema: z.ZodObject<{
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
520
|
+
schema: z.core.$ZodBranded<z.ZodObject<{
|
|
521
|
+
success: z.ZodLiteral<false>;
|
|
522
|
+
code: z.ZodOptional<z.ZodString>;
|
|
523
|
+
message: z.ZodOptional<z.ZodString>;
|
|
524
|
+
}, z.core.$strip>, "error", "out">;
|
|
636
525
|
};
|
|
637
526
|
};
|
|
638
527
|
};
|
|
639
528
|
} & {
|
|
640
|
-
|
|
529
|
+
401: {
|
|
641
530
|
description: string;
|
|
642
531
|
content: {
|
|
643
532
|
"application/json": {
|
|
@@ -645,12 +534,12 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
645
534
|
success: z.ZodLiteral<false>;
|
|
646
535
|
code: z.ZodOptional<z.ZodString>;
|
|
647
536
|
message: z.ZodOptional<z.ZodString>;
|
|
648
|
-
}, z.core.$strip>, "error">;
|
|
537
|
+
}, z.core.$strip>, "error", "out">;
|
|
649
538
|
};
|
|
650
539
|
};
|
|
651
540
|
};
|
|
652
541
|
} & {
|
|
653
|
-
|
|
542
|
+
500: {
|
|
654
543
|
description: string;
|
|
655
544
|
content: {
|
|
656
545
|
"application/json": {
|
|
@@ -658,48 +547,74 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
658
547
|
success: z.ZodLiteral<false>;
|
|
659
548
|
code: z.ZodOptional<z.ZodString>;
|
|
660
549
|
message: z.ZodOptional<z.ZodString>;
|
|
661
|
-
}, z.core.$strip>, "error">;
|
|
550
|
+
}, z.core.$strip>, "error", "out">;
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
}>;
|
|
556
|
+
readonly cancelSubscriptionCallback: import("faire-auth").AuthEndpoint<{
|
|
557
|
+
getRoutingPath: () => "/subscription/cancel/callback";
|
|
558
|
+
operationId: "cancelSubscriptionCallback";
|
|
559
|
+
method: "get";
|
|
560
|
+
path: "/subscription/cancel/callback";
|
|
561
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<object>, string, {}>, next: import("hono").Next) => Promise<void | Response>];
|
|
562
|
+
request: {
|
|
563
|
+
query: z.ZodObject<{
|
|
564
|
+
callbackURL: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodTransform<string | undefined, string | undefined>, z.ZodOptional<z.ZodURL>>, z.ZodTransform<string | undefined, string | undefined>>>;
|
|
565
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
566
|
+
}, z.core.$strip>;
|
|
567
|
+
};
|
|
568
|
+
responses: {
|
|
569
|
+
200: {
|
|
570
|
+
description: string;
|
|
571
|
+
content: {
|
|
572
|
+
"application/json": {
|
|
573
|
+
schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
662
574
|
};
|
|
663
575
|
};
|
|
664
576
|
};
|
|
577
|
+
} & {
|
|
578
|
+
302: {
|
|
579
|
+
description: string;
|
|
580
|
+
};
|
|
665
581
|
};
|
|
582
|
+
}>;
|
|
583
|
+
/**
|
|
584
|
+
* ### Endpoint
|
|
585
|
+
*
|
|
586
|
+
* POST `/subscription/cancel`
|
|
587
|
+
*
|
|
588
|
+
* ### API Methods
|
|
589
|
+
*
|
|
590
|
+
* **server:**
|
|
591
|
+
* `auth.api.cancelSubscription`
|
|
592
|
+
*
|
|
593
|
+
* **client:**
|
|
594
|
+
* `authClient.subscription.cancel`
|
|
595
|
+
*
|
|
596
|
+
* @see [Read our docs to learn more.](https://faire-auth.com/docs/plugins/stripe#api-method-subscription-cancel)
|
|
597
|
+
*/
|
|
598
|
+
readonly cancelSubscription: import("faire-auth").AuthEndpoint<{
|
|
599
|
+
getRoutingPath: () => "/subscription/cancel";
|
|
666
600
|
operationId: "cancelSubscription";
|
|
667
|
-
path: "/subscription/cancel";
|
|
668
601
|
method: "post";
|
|
669
|
-
|
|
602
|
+
path: "/subscription/cancel";
|
|
603
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<object & {
|
|
670
604
|
session: {
|
|
671
|
-
session:
|
|
672
|
-
|
|
673
|
-
createdAt: Date;
|
|
674
|
-
updatedAt: Date;
|
|
675
|
-
userId: string;
|
|
676
|
-
expiresAt: Date;
|
|
677
|
-
token: string;
|
|
678
|
-
id?: string;
|
|
679
|
-
ipAddress?: string | null;
|
|
680
|
-
userAgent?: string | null;
|
|
681
|
-
};
|
|
682
|
-
user: {
|
|
683
|
-
[x: string]: unknown;
|
|
684
|
-
id: string;
|
|
685
|
-
createdAt: Date;
|
|
686
|
-
updatedAt: Date;
|
|
687
|
-
email: string;
|
|
688
|
-
emailVerified: boolean;
|
|
689
|
-
name?: string;
|
|
690
|
-
image?: string | null;
|
|
691
|
-
};
|
|
605
|
+
session: Session;
|
|
606
|
+
user: User;
|
|
692
607
|
};
|
|
693
|
-
}>, string, {}>, next:
|
|
608
|
+
}>, string, {}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
694
609
|
success: false;
|
|
695
610
|
code?: string | undefined;
|
|
696
611
|
message?: string | undefined;
|
|
697
|
-
}, 401>)>, (ctx:
|
|
612
|
+
}, 401>)>, (ctx: import("hono").Context<import("faire-auth").ContextVars<object>, string, {}>, next: import("hono").Next) => Promise<void | Response>, (ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
698
613
|
session?: {
|
|
699
614
|
session: Session;
|
|
700
615
|
user: User;
|
|
701
616
|
};
|
|
702
|
-
}>, "/subscription/
|
|
617
|
+
}>, "/subscription/billing-portal" | "/subscription/cancel" | "/subscription/list" | "/subscription/restore" | "/subscription/upgrade", {
|
|
703
618
|
out: {
|
|
704
619
|
json: {
|
|
705
620
|
referenceId?: string;
|
|
@@ -708,9 +623,9 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
708
623
|
referenceId?: string;
|
|
709
624
|
};
|
|
710
625
|
};
|
|
711
|
-
}>, next:
|
|
626
|
+
}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
712
627
|
success: false;
|
|
713
|
-
}, 401, "json">) | (Response &
|
|
628
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
714
629
|
success: false;
|
|
715
630
|
}, 400, "json">)>];
|
|
716
631
|
request: {
|
|
@@ -728,15 +643,15 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
728
643
|
required: true;
|
|
729
644
|
};
|
|
730
645
|
};
|
|
731
|
-
getRoutingPath: () => "/subscription/cancel";
|
|
732
|
-
}>;
|
|
733
|
-
readonly restoreSubscription: faire_auth0.AuthEndpoint<{
|
|
734
646
|
responses: {
|
|
735
647
|
200: {
|
|
736
648
|
description: string;
|
|
737
649
|
content: {
|
|
738
650
|
"application/json": {
|
|
739
|
-
schema: z.
|
|
651
|
+
schema: z.ZodObject<{
|
|
652
|
+
url: z.ZodString;
|
|
653
|
+
redirect: z.ZodLiteral<true>;
|
|
654
|
+
}, z.core.$strip>;
|
|
740
655
|
};
|
|
741
656
|
};
|
|
742
657
|
};
|
|
@@ -749,7 +664,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
749
664
|
success: z.ZodLiteral<false>;
|
|
750
665
|
code: z.ZodOptional<z.ZodString>;
|
|
751
666
|
message: z.ZodOptional<z.ZodString>;
|
|
752
|
-
}, z.core.$strip>, "error">;
|
|
667
|
+
}, z.core.$strip>, "error", "out">;
|
|
753
668
|
};
|
|
754
669
|
};
|
|
755
670
|
};
|
|
@@ -762,48 +677,32 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
762
677
|
success: z.ZodLiteral<false>;
|
|
763
678
|
code: z.ZodOptional<z.ZodString>;
|
|
764
679
|
message: z.ZodOptional<z.ZodString>;
|
|
765
|
-
}, z.core.$strip>, "error">;
|
|
680
|
+
}, z.core.$strip>, "error", "out">;
|
|
766
681
|
};
|
|
767
682
|
};
|
|
768
683
|
};
|
|
769
684
|
};
|
|
685
|
+
}>;
|
|
686
|
+
readonly restoreSubscription: import("faire-auth").AuthEndpoint<{
|
|
687
|
+
getRoutingPath: () => "/subscription/restore";
|
|
770
688
|
operationId: "restoreSubscription";
|
|
771
|
-
path: "/subscription/restore";
|
|
772
689
|
method: "post";
|
|
773
|
-
|
|
690
|
+
path: "/subscription/restore";
|
|
691
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<object & {
|
|
774
692
|
session: {
|
|
775
|
-
session:
|
|
776
|
-
|
|
777
|
-
createdAt: Date;
|
|
778
|
-
updatedAt: Date;
|
|
779
|
-
userId: string;
|
|
780
|
-
expiresAt: Date;
|
|
781
|
-
token: string;
|
|
782
|
-
id?: string;
|
|
783
|
-
ipAddress?: string | null;
|
|
784
|
-
userAgent?: string | null;
|
|
785
|
-
};
|
|
786
|
-
user: {
|
|
787
|
-
[x: string]: unknown;
|
|
788
|
-
id: string;
|
|
789
|
-
createdAt: Date;
|
|
790
|
-
updatedAt: Date;
|
|
791
|
-
email: string;
|
|
792
|
-
emailVerified: boolean;
|
|
793
|
-
name?: string;
|
|
794
|
-
image?: string | null;
|
|
795
|
-
};
|
|
693
|
+
session: Session;
|
|
694
|
+
user: User;
|
|
796
695
|
};
|
|
797
|
-
}>, string, {}>, next:
|
|
696
|
+
}>, string, {}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
798
697
|
success: false;
|
|
799
698
|
code?: string | undefined;
|
|
800
699
|
message?: string | undefined;
|
|
801
|
-
}, 401>)>, (ctx:
|
|
700
|
+
}, 401>)>, (ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
802
701
|
session?: {
|
|
803
702
|
session: Session;
|
|
804
703
|
user: User;
|
|
805
704
|
};
|
|
806
|
-
}>, "/subscription/
|
|
705
|
+
}>, "/subscription/billing-portal" | "/subscription/cancel" | "/subscription/list" | "/subscription/restore" | "/subscription/upgrade", {
|
|
807
706
|
out: {
|
|
808
707
|
json: {
|
|
809
708
|
referenceId?: string;
|
|
@@ -812,9 +711,9 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
812
711
|
referenceId?: string;
|
|
813
712
|
};
|
|
814
713
|
};
|
|
815
|
-
}>, next:
|
|
714
|
+
}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
816
715
|
success: false;
|
|
817
|
-
}, 401, "json">) | (Response &
|
|
716
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
818
717
|
success: false;
|
|
819
718
|
}, 400, "json">)>];
|
|
820
719
|
request: {
|
|
@@ -831,30 +730,12 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
831
730
|
required: true;
|
|
832
731
|
};
|
|
833
732
|
};
|
|
834
|
-
getRoutingPath: () => "/subscription/restore";
|
|
835
|
-
}>;
|
|
836
|
-
/**
|
|
837
|
-
* ### Endpoint
|
|
838
|
-
*
|
|
839
|
-
* GET `/subscription/list`
|
|
840
|
-
*
|
|
841
|
-
* ### API Methods
|
|
842
|
-
*
|
|
843
|
-
* **server:**
|
|
844
|
-
* `auth.api.listActiveSubscriptions`
|
|
845
|
-
*
|
|
846
|
-
* **client:**
|
|
847
|
-
* `authClient.subscription.list`
|
|
848
|
-
*
|
|
849
|
-
* @see [Read our docs to learn more.](https://faire-auth.com/docs/plugins/stripe#api-method-subscription-list)
|
|
850
|
-
*/
|
|
851
|
-
readonly listActiveSubscriptions: faire_auth0.AuthEndpoint<{
|
|
852
733
|
responses: {
|
|
853
734
|
200: {
|
|
854
735
|
description: string;
|
|
855
736
|
content: {
|
|
856
737
|
"application/json": {
|
|
857
|
-
schema: z.ZodType<Subscription
|
|
738
|
+
schema: z.ZodType<Stripe.Subscription, unknown, z.core.$ZodTypeInternals<Stripe.Subscription, unknown>>;
|
|
858
739
|
};
|
|
859
740
|
};
|
|
860
741
|
};
|
|
@@ -867,7 +748,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
867
748
|
success: z.ZodLiteral<false>;
|
|
868
749
|
code: z.ZodOptional<z.ZodString>;
|
|
869
750
|
message: z.ZodOptional<z.ZodString>;
|
|
870
|
-
}, z.core.$strip>, "error">;
|
|
751
|
+
}, z.core.$strip>, "error", "out">;
|
|
871
752
|
};
|
|
872
753
|
};
|
|
873
754
|
};
|
|
@@ -880,48 +761,47 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
880
761
|
success: z.ZodLiteral<false>;
|
|
881
762
|
code: z.ZodOptional<z.ZodString>;
|
|
882
763
|
message: z.ZodOptional<z.ZodString>;
|
|
883
|
-
}, z.core.$strip>, "error">;
|
|
764
|
+
}, z.core.$strip>, "error", "out">;
|
|
884
765
|
};
|
|
885
766
|
};
|
|
886
767
|
};
|
|
887
768
|
};
|
|
769
|
+
}>;
|
|
770
|
+
/**
|
|
771
|
+
* ### Endpoint
|
|
772
|
+
*
|
|
773
|
+
* GET `/subscription/list`
|
|
774
|
+
*
|
|
775
|
+
* ### API Methods
|
|
776
|
+
*
|
|
777
|
+
* **server:**
|
|
778
|
+
* `auth.api.listActiveSubscriptions`
|
|
779
|
+
*
|
|
780
|
+
* **client:**
|
|
781
|
+
* `authClient.subscription.list`
|
|
782
|
+
*
|
|
783
|
+
* @see [Read our docs to learn more.](https://faire-auth.com/docs/plugins/stripe#api-method-subscription-list)
|
|
784
|
+
*/
|
|
785
|
+
readonly listActiveSubscriptions: import("faire-auth").AuthEndpoint<{
|
|
786
|
+
getRoutingPath: () => "/subscription/list";
|
|
888
787
|
operationId: "listActiveSubscriptions";
|
|
889
|
-
path: "/subscription/list";
|
|
890
788
|
method: "get";
|
|
891
|
-
|
|
789
|
+
path: "/subscription/list";
|
|
790
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<object & {
|
|
892
791
|
session: {
|
|
893
|
-
session:
|
|
894
|
-
|
|
895
|
-
createdAt: Date;
|
|
896
|
-
updatedAt: Date;
|
|
897
|
-
userId: string;
|
|
898
|
-
expiresAt: Date;
|
|
899
|
-
token: string;
|
|
900
|
-
id?: string;
|
|
901
|
-
ipAddress?: string | null;
|
|
902
|
-
userAgent?: string | null;
|
|
903
|
-
};
|
|
904
|
-
user: {
|
|
905
|
-
[x: string]: unknown;
|
|
906
|
-
id: string;
|
|
907
|
-
createdAt: Date;
|
|
908
|
-
updatedAt: Date;
|
|
909
|
-
email: string;
|
|
910
|
-
emailVerified: boolean;
|
|
911
|
-
name?: string;
|
|
912
|
-
image?: string | null;
|
|
913
|
-
};
|
|
792
|
+
session: Session;
|
|
793
|
+
user: User;
|
|
914
794
|
};
|
|
915
|
-
}>, string, {}>, next:
|
|
795
|
+
}>, string, {}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
916
796
|
success: false;
|
|
917
797
|
code?: string | undefined;
|
|
918
798
|
message?: string | undefined;
|
|
919
|
-
}, 401>)>, (ctx:
|
|
799
|
+
}, 401>)>, (ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
920
800
|
session?: {
|
|
921
801
|
session: Session;
|
|
922
802
|
user: User;
|
|
923
803
|
};
|
|
924
|
-
}>, "/subscription/
|
|
804
|
+
}>, "/subscription/billing-portal" | "/subscription/cancel" | "/subscription/list" | "/subscription/restore" | "/subscription/upgrade", {
|
|
925
805
|
out: {
|
|
926
806
|
json: {
|
|
927
807
|
referenceId?: string;
|
|
@@ -930,9 +810,9 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
930
810
|
referenceId?: string;
|
|
931
811
|
};
|
|
932
812
|
};
|
|
933
|
-
}>, next:
|
|
813
|
+
}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
934
814
|
success: false;
|
|
935
|
-
}, 401, "json">) | (Response &
|
|
815
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
936
816
|
success: false;
|
|
937
817
|
}, 400, "json">)>];
|
|
938
818
|
request: {
|
|
@@ -940,45 +820,12 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
940
820
|
referenceId: z.ZodOptional<z.ZodString>;
|
|
941
821
|
}, z.core.$strip>;
|
|
942
822
|
};
|
|
943
|
-
getRoutingPath: () => "/subscription/list";
|
|
944
|
-
}>;
|
|
945
|
-
readonly subscriptionSuccess: faire_auth0.AuthEndpoint<{
|
|
946
|
-
responses: {
|
|
947
|
-
200: {
|
|
948
|
-
description: string;
|
|
949
|
-
content: {
|
|
950
|
-
"application/json": {
|
|
951
|
-
schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
952
|
-
};
|
|
953
|
-
};
|
|
954
|
-
};
|
|
955
|
-
} & {
|
|
956
|
-
302: {
|
|
957
|
-
description: string;
|
|
958
|
-
};
|
|
959
|
-
};
|
|
960
|
-
operationId: "subscriptionSuccess";
|
|
961
|
-
path: "/subscription/success";
|
|
962
|
-
method: "get";
|
|
963
|
-
middleware: [(ctx: hono0.Context<faire_auth0.ContextVars<object>, string, {}>, next: hono0.Next) => Promise<void | Response>];
|
|
964
|
-
request: {
|
|
965
|
-
query: z.ZodObject<{
|
|
966
|
-
callbackURL: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodTransform<string | undefined, string | undefined>, z.ZodOptional<z.ZodURL>>, z.ZodTransform<string | undefined, string | undefined>>>;
|
|
967
|
-
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
968
|
-
}, z.core.$strip>;
|
|
969
|
-
};
|
|
970
|
-
getRoutingPath: () => "/subscription/success";
|
|
971
|
-
}>;
|
|
972
|
-
readonly createBillingPortal: faire_auth0.AuthEndpoint<{
|
|
973
823
|
responses: {
|
|
974
824
|
200: {
|
|
975
825
|
description: string;
|
|
976
826
|
content: {
|
|
977
827
|
"application/json": {
|
|
978
|
-
schema: z.
|
|
979
|
-
url: z.ZodString;
|
|
980
|
-
redirect: z.ZodLiteral<true>;
|
|
981
|
-
}, z.core.$strip>;
|
|
828
|
+
schema: z.ZodType<Subscription[], unknown, z.core.$ZodTypeInternals<Subscription[], unknown>>;
|
|
982
829
|
};
|
|
983
830
|
};
|
|
984
831
|
};
|
|
@@ -991,7 +838,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
991
838
|
success: z.ZodLiteral<false>;
|
|
992
839
|
code: z.ZodOptional<z.ZodString>;
|
|
993
840
|
message: z.ZodOptional<z.ZodString>;
|
|
994
|
-
}, z.core.$strip>, "error">;
|
|
841
|
+
}, z.core.$strip>, "error", "out">;
|
|
995
842
|
};
|
|
996
843
|
};
|
|
997
844
|
};
|
|
@@ -1004,15 +851,45 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
1004
851
|
success: z.ZodLiteral<false>;
|
|
1005
852
|
code: z.ZodOptional<z.ZodString>;
|
|
1006
853
|
message: z.ZodOptional<z.ZodString>;
|
|
1007
|
-
}, z.core.$strip>, "error">;
|
|
854
|
+
}, z.core.$strip>, "error", "out">;
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
}>;
|
|
860
|
+
readonly subscriptionSuccess: import("faire-auth").AuthEndpoint<{
|
|
861
|
+
getRoutingPath: () => "/subscription/success";
|
|
862
|
+
operationId: "subscriptionSuccess";
|
|
863
|
+
method: "get";
|
|
864
|
+
path: "/subscription/success";
|
|
865
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<object>, string, {}>, next: import("hono").Next) => Promise<void | Response>];
|
|
866
|
+
request: {
|
|
867
|
+
query: z.ZodObject<{
|
|
868
|
+
callbackURL: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodTransform<string | undefined, string | undefined>, z.ZodOptional<z.ZodURL>>, z.ZodTransform<string | undefined, string | undefined>>>;
|
|
869
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
870
|
+
}, z.core.$strip>;
|
|
871
|
+
};
|
|
872
|
+
responses: {
|
|
873
|
+
200: {
|
|
874
|
+
description: string;
|
|
875
|
+
content: {
|
|
876
|
+
"application/json": {
|
|
877
|
+
schema: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
1008
878
|
};
|
|
1009
879
|
};
|
|
1010
880
|
};
|
|
881
|
+
} & {
|
|
882
|
+
302: {
|
|
883
|
+
description: string;
|
|
884
|
+
};
|
|
1011
885
|
};
|
|
886
|
+
}>;
|
|
887
|
+
readonly createBillingPortal: import("faire-auth").AuthEndpoint<{
|
|
888
|
+
getRoutingPath: () => "/subscription/billing-portal";
|
|
1012
889
|
operationId: "createBillingPortal";
|
|
1013
|
-
path: "/subscription/billing-portal";
|
|
1014
890
|
method: "post";
|
|
1015
|
-
|
|
891
|
+
path: "/subscription/billing-portal";
|
|
892
|
+
middleware: [(ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
1016
893
|
session: {
|
|
1017
894
|
user: {
|
|
1018
895
|
stripeCustomerId?: string;
|
|
@@ -1020,38 +897,19 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
1020
897
|
};
|
|
1021
898
|
} & {
|
|
1022
899
|
session: {
|
|
1023
|
-
session:
|
|
1024
|
-
|
|
1025
|
-
createdAt: Date;
|
|
1026
|
-
updatedAt: Date;
|
|
1027
|
-
userId: string;
|
|
1028
|
-
expiresAt: Date;
|
|
1029
|
-
token: string;
|
|
1030
|
-
id?: string;
|
|
1031
|
-
ipAddress?: string | null;
|
|
1032
|
-
userAgent?: string | null;
|
|
1033
|
-
};
|
|
1034
|
-
user: {
|
|
1035
|
-
[x: string]: unknown;
|
|
1036
|
-
id: string;
|
|
1037
|
-
createdAt: Date;
|
|
1038
|
-
updatedAt: Date;
|
|
1039
|
-
email: string;
|
|
1040
|
-
emailVerified: boolean;
|
|
1041
|
-
name?: string;
|
|
1042
|
-
image?: string | null;
|
|
1043
|
-
};
|
|
900
|
+
session: Session;
|
|
901
|
+
user: User;
|
|
1044
902
|
};
|
|
1045
|
-
}>, string, {}>, next:
|
|
903
|
+
}>, string, {}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
1046
904
|
success: false;
|
|
1047
905
|
code?: string | undefined;
|
|
1048
906
|
message?: string | undefined;
|
|
1049
|
-
}, 401>)>, (ctx:
|
|
907
|
+
}, 401>)>, (ctx: import("hono").Context<import("faire-auth").ContextVars<object>, string, {}>, next: import("hono").Next) => Promise<void | Response>, (ctx: import("hono").Context<import("faire-auth").ContextVars<{
|
|
1050
908
|
session?: {
|
|
1051
909
|
session: Session;
|
|
1052
910
|
user: User;
|
|
1053
911
|
};
|
|
1054
|
-
}>, "/subscription/
|
|
912
|
+
}>, "/subscription/billing-portal" | "/subscription/cancel" | "/subscription/list" | "/subscription/restore" | "/subscription/upgrade", {
|
|
1055
913
|
out: {
|
|
1056
914
|
json: {
|
|
1057
915
|
referenceId?: string;
|
|
@@ -1060,9 +918,9 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
1060
918
|
referenceId?: string;
|
|
1061
919
|
};
|
|
1062
920
|
};
|
|
1063
|
-
}>, next:
|
|
921
|
+
}>, next: import("hono").Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
1064
922
|
success: false;
|
|
1065
|
-
}, 401, "json">) | (Response &
|
|
923
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
1066
924
|
success: false;
|
|
1067
925
|
}, 400, "json">)>];
|
|
1068
926
|
request: {
|
|
@@ -1080,10 +938,48 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
1080
938
|
required: true;
|
|
1081
939
|
};
|
|
1082
940
|
};
|
|
1083
|
-
|
|
941
|
+
responses: {
|
|
942
|
+
200: {
|
|
943
|
+
description: string;
|
|
944
|
+
content: {
|
|
945
|
+
"application/json": {
|
|
946
|
+
schema: z.ZodObject<{
|
|
947
|
+
url: z.ZodString;
|
|
948
|
+
redirect: z.ZodLiteral<true>;
|
|
949
|
+
}, z.core.$strip>;
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
};
|
|
953
|
+
} & {
|
|
954
|
+
400: {
|
|
955
|
+
description: string;
|
|
956
|
+
content: {
|
|
957
|
+
"application/json": {
|
|
958
|
+
schema: z.core.$ZodBranded<z.ZodObject<{
|
|
959
|
+
success: z.ZodLiteral<false>;
|
|
960
|
+
code: z.ZodOptional<z.ZodString>;
|
|
961
|
+
message: z.ZodOptional<z.ZodString>;
|
|
962
|
+
}, z.core.$strip>, "error", "out">;
|
|
963
|
+
};
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
} & {
|
|
967
|
+
401: {
|
|
968
|
+
description: string;
|
|
969
|
+
content: {
|
|
970
|
+
"application/json": {
|
|
971
|
+
schema: z.core.$ZodBranded<z.ZodObject<{
|
|
972
|
+
success: z.ZodLiteral<false>;
|
|
973
|
+
code: z.ZodOptional<z.ZodString>;
|
|
974
|
+
message: z.ZodOptional<z.ZodString>;
|
|
975
|
+
}, z.core.$strip>, "error", "out">;
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
};
|
|
1084
980
|
}>;
|
|
1085
981
|
} : {});
|
|
1086
|
-
init(ctx:
|
|
982
|
+
init(ctx: import("@faire-auth/core/types").AuthContext<import("faire-auth").ContextVars<any>, import("@faire-auth/core/types").FaireAuthOptions<import("faire-auth").ContextVars<any>>>): {
|
|
1087
983
|
options: {
|
|
1088
984
|
databaseHooks: {
|
|
1089
985
|
user: {
|
|
@@ -1097,7 +993,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
1097
993
|
emailVerified: boolean;
|
|
1098
994
|
name?: string;
|
|
1099
995
|
image?: string | null;
|
|
1100
|
-
}, ctx:
|
|
996
|
+
}, ctx: import("hono").Context<any, any, {}> | undefined): Promise<void>;
|
|
1101
997
|
};
|
|
1102
998
|
};
|
|
1103
999
|
};
|
|
@@ -1106,5 +1002,4 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
|
|
|
1106
1002
|
schema: {};
|
|
1107
1003
|
};
|
|
1108
1004
|
type StripePlugin<O extends StripeOptions> = ReturnType<typeof stripe<O>>;
|
|
1109
|
-
//#endregion
|
|
1110
1005
|
export { Subscription as i, stripe as n, StripePlan as r, StripePlugin as t };
|