fix types
This commit is contained in:
parent
d87ad8f1af
commit
e5b7ff5d63
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@bowong/better-auth-stripe",
|
||||
"author": "Bowong",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.0-beta.10",
|
||||
"main": "dist/index.cjs",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
import type { BetterAuthClientPlugin } from "better-auth";
|
||||
import type { stripe } from "./index";
|
||||
import {type BetterAuthClientPlugin} from "better-auth";
|
||||
import type {stripe} from "./index";
|
||||
|
||||
export const stripeClient = <
|
||||
O extends {
|
||||
subscription: boolean;
|
||||
},
|
||||
O extends {
|
||||
subscription: boolean;
|
||||
},
|
||||
>(
|
||||
options?: O,
|
||||
) => {
|
||||
return {
|
||||
id: "stripe-client",
|
||||
$InferServerPlugin: {} as ReturnType<
|
||||
typeof stripe<
|
||||
O["subscription"] extends true
|
||||
? {
|
||||
stripeClient: any;
|
||||
stripeWebhookSecret: string;
|
||||
subscription: {
|
||||
enabled: true;
|
||||
plans: [];
|
||||
};
|
||||
}
|
||||
: {
|
||||
stripeClient: any;
|
||||
stripeWebhookSecret: string;
|
||||
}
|
||||
>
|
||||
>,
|
||||
pathMethods: {
|
||||
"/subscription/restore": "POST",
|
||||
"/subscription/billing-portal": "POST",
|
||||
"/subscription/meter-event": "POST",
|
||||
},
|
||||
} satisfies BetterAuthClientPlugin;
|
||||
options?: O,
|
||||
): BetterAuthClientPlugin => {
|
||||
return {
|
||||
id: "stripe-client",
|
||||
$InferServerPlugin: {} as ReturnType<
|
||||
typeof stripe<
|
||||
O["subscription"] extends true
|
||||
? {
|
||||
stripeClient: any;
|
||||
stripeWebhookSecret: string;
|
||||
subscription: {
|
||||
enabled: true;
|
||||
plans: [];
|
||||
};
|
||||
}
|
||||
: {
|
||||
stripeClient: any;
|
||||
stripeWebhookSecret: string;
|
||||
}
|
||||
>
|
||||
>,
|
||||
pathMethods: {
|
||||
"/subscription/restore": "POST",
|
||||
"/subscription/billing-portal": "POST",
|
||||
"/subscription/meter-event": "POST",
|
||||
},
|
||||
} satisfies BetterAuthClientPlugin;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
type GenericEndpointContext,
|
||||
type BetterAuthPlugin,
|
||||
logger,
|
||||
logger, type BetterAuthClientPlugin,
|
||||
} from "better-auth";
|
||||
import {createAuthEndpoint, createAuthMiddleware} from "better-auth/plugins";
|
||||
import Stripe from "stripe";
|
||||
|
|
@ -64,7 +64,7 @@ async function resolvePriceIdFromLookupKey(
|
|||
return prices.data[0]?.id;
|
||||
}
|
||||
|
||||
export const stripe = <O extends StripeOptions>(options: O) => {
|
||||
export const stripe = <O extends StripeOptions>(options: O) : BetterAuthPlugin => {
|
||||
const client = options.stripeClient;
|
||||
|
||||
const referenceMiddleware = (
|
||||
|
|
|
|||
Loading…
Reference in New Issue