From e5b7ff5d63d28ba7709f49248575f17da0ec8d30 Mon Sep 17 00:00:00 2001 From: Yudi Xiao <463708580@qq.com> Date: Mon, 13 Oct 2025 18:00:33 +0800 Subject: [PATCH] fix types --- package.json | 2 +- src/client.ts | 64 +++++++++++++++++++++++++-------------------------- src/index.ts | 4 ++-- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 60076be..d54edd5 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/client.ts b/src/client.ts index 410ee0c..36ee7dd 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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; }; diff --git a/src/index.ts b/src/index.ts index 1c480f4..37778d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 = (options: O) => { +export const stripe = (options: O) : BetterAuthPlugin => { const client = options.stripeClient; const referenceMiddleware = (