mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 12:27:44 +00:00
chore: use tsconfig monorepo setup (#4826)
This commit is contained in:
@@ -24,14 +24,10 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "unbuild --clean",
|
"build": "unbuild --clean",
|
||||||
"dev": "concurrently \"unbuild --watch\" \"npm run dev:types\"",
|
|
||||||
"dev:types": "tsc --project tsconfig.declarations.json --watch",
|
|
||||||
"build:types": "tsc --project tsconfig.declarations.json",
|
|
||||||
"stub": "unbuild --stub",
|
"stub": "unbuild --stub",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"bump": "bumpp",
|
|
||||||
"prepare": "prisma generate --schema ./src/adapters/prisma-adapter/test/normal-tests/schema.prisma && prisma generate --schema ./src/adapters/prisma-adapter/test/number-id-tests/schema.prisma",
|
"prepare": "prisma generate --schema ./src/adapters/prisma-adapter/test/normal-tests/schema.prisma && prisma generate --schema ./src/adapters/prisma-adapter/test/number-id-tests/schema.prisma",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"main": "./dist/index.cjs",
|
"main": "./dist/index.cjs",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
|
|||||||
@@ -18,29 +18,28 @@ export const opts = ({
|
|||||||
}: {
|
}: {
|
||||||
database: BetterAuthOptions["database"];
|
database: BetterAuthOptions["database"];
|
||||||
isNumberIdTest: boolean;
|
isNumberIdTest: boolean;
|
||||||
}) =>
|
}): BetterAuthOptions => ({
|
||||||
({
|
database: database,
|
||||||
database: database,
|
user: {
|
||||||
user: {
|
fields: {
|
||||||
fields: {
|
email: "email_address",
|
||||||
email: "email_address",
|
},
|
||||||
},
|
additionalFields: {
|
||||||
additionalFields: {
|
test: {
|
||||||
test: {
|
type: "string",
|
||||||
type: "string",
|
defaultValue: "test",
|
||||||
defaultValue: "test",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
session: {
|
},
|
||||||
modelName: "sessions",
|
session: {
|
||||||
|
modelName: "sessions",
|
||||||
|
},
|
||||||
|
advanced: {
|
||||||
|
database: {
|
||||||
|
useNumberId: isNumberIdTest,
|
||||||
},
|
},
|
||||||
advanced: {
|
},
|
||||||
database: {
|
});
|
||||||
useNumberId: isNumberIdTest,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}) satisfies BetterAuthOptions;
|
|
||||||
|
|
||||||
const sqlite = new Database(path.join(__dirname, "test.db"));
|
const sqlite = new Database(path.join(__dirname, "test.db"));
|
||||||
const mysql = createPool("mysql://user:password@localhost:3306/better_auth");
|
const mysql = createPool("mysql://user:password@localhost:3306/better_auth");
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import { kakao } from "./kakao";
|
|||||||
import { naver } from "./naver";
|
import { naver } from "./naver";
|
||||||
import { line } from "./line";
|
import { line } from "./line";
|
||||||
import { paypal } from "./paypal";
|
import { paypal } from "./paypal";
|
||||||
import type { OAuthProvider } from "../oauth2";
|
|
||||||
|
|
||||||
export const socialProviders = {
|
export const socialProviders = {
|
||||||
apple,
|
apple,
|
||||||
@@ -62,11 +61,6 @@ export const socialProviders = {
|
|||||||
naver,
|
naver,
|
||||||
line,
|
line,
|
||||||
paypal,
|
paypal,
|
||||||
} satisfies {
|
|
||||||
[key: string]: (
|
|
||||||
// todo: fix any here
|
|
||||||
config: any,
|
|
||||||
) => OAuthProvider;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const socialProviderList = Object.keys(socialProviders) as [
|
export const socialProviderList = Object.keys(socialProviders) as [
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export async function getTestInstance<
|
|||||||
...options?.advanced,
|
...options?.advanced,
|
||||||
},
|
},
|
||||||
plugins: [bearer(), ...(options?.plugins || [])],
|
plugins: [bearer(), ...(options?.plugins || [])],
|
||||||
} as unknown as O extends undefined ? typeof opts : O & typeof opts);
|
} as unknown as O);
|
||||||
|
|
||||||
const testUser = {
|
const testUser = {
|
||||||
email: "test@test.com",
|
email: "test@test.com",
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"declaration": true,
|
|
||||||
"emitDeclarationOnly": true,
|
|
||||||
"declarationMap": true,
|
|
||||||
"outDir": "dist",
|
|
||||||
"noEmit": false,
|
|
||||||
"composite": false,
|
|
||||||
"target": "es2022",
|
|
||||||
"incremental": true,
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"strict": true,
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"module": "Preserve",
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"types": ["node"],
|
|
||||||
"isolatedModules": true,
|
|
||||||
"preserveSymlinks": true,
|
|
||||||
"noImplicitOverride": true
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist",
|
|
||||||
"**/*.test.ts",
|
|
||||||
"**/*.spec.ts",
|
|
||||||
"**/test/**/*.ts",
|
|
||||||
"**/test-utils/**/*.ts"
|
|
||||||
],
|
|
||||||
"references": [],
|
|
||||||
"include": ["src/**/*"]
|
|
||||||
}
|
|
||||||
@@ -1,25 +1,11 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"esModuleInterop": true,
|
"rootDir": "./src",
|
||||||
"skipLibCheck": true,
|
"outDir": "./dist",
|
||||||
"target": "es2022",
|
"lib": ["esnext", "dom", "dom.iterable"],
|
||||||
"allowJs": true,
|
"noUncheckedIndexedAccess": false,
|
||||||
"resolveJsonModule": true,
|
"types": ["node", "bun"]
|
||||||
"module": "ESNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"isolatedModules": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"composite": false,
|
|
||||||
"incremental": true,
|
|
||||||
"tsBuildInfoFile": ".tsbuildinfo",
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"downlevelIteration": true
|
|
||||||
},
|
},
|
||||||
"exclude": ["**/dist", "node_modules"],
|
|
||||||
"references": [],
|
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
"stub": "unbuild --stub",
|
"stub": "unbuild --stub",
|
||||||
"start": "node ./dist/index.mjs",
|
"start": "node ./dist/index.mjs",
|
||||||
"dev": "tsx ./src/index.ts",
|
"dev": "tsx ./src/index.ts",
|
||||||
"test": "vitest"
|
"test": "vitest",
|
||||||
|
"typecheck": "tsc --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public",
|
"access": "public",
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
"exports": "./dist/index.mjs",
|
"exports": "./dist/index.mjs",
|
||||||
"bin": "./dist/index.mjs",
|
"bin": "./dist/index.mjs",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/semver": "^7.7.1",
|
||||||
"tsx": "^4.20.5",
|
"tsx": "^4.20.5",
|
||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
"unbuild": "catalog:"
|
"unbuild": "catalog:"
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
"dotenv": "^17.2.2",
|
"dotenv": "^17.2.2",
|
||||||
"drizzle-orm": "^0.33.0",
|
"drizzle-orm": "^0.33.0",
|
||||||
"get-tsconfig": "^4.10.1",
|
"get-tsconfig": "^4.10.1",
|
||||||
|
"jiti": "^2.6.0",
|
||||||
"open": "^10.2.0",
|
"open": "^10.2.0",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prisma": "^5.22.0",
|
"prisma": "^5.22.0",
|
||||||
|
|||||||
14
packages/cli/tsconfig.json
Normal file
14
packages/cli/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./dist",
|
||||||
|
"lib": ["esnext", "dom", "dom.iterable"]
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../better-auth/tsconfig.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"build": "unbuild --clean",
|
"build": "unbuild --clean",
|
||||||
"dev": "unbuild --watch",
|
"dev": "unbuild --watch",
|
||||||
"stub": "unbuild --stub"
|
"stub": "unbuild --stub",
|
||||||
|
"typecheck": "tsc --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@better-fetch/fetch": "catalog:",
|
"@better-fetch/fetch": "catalog:",
|
||||||
|
"@types/better-sqlite3": "^7.6.13",
|
||||||
"better-auth": "workspace:*",
|
"better-auth": "workspace:*",
|
||||||
"better-sqlite3": "^12.2.0",
|
"better-sqlite3": "^12.2.0",
|
||||||
"expo-constants": "~17.1.7",
|
"expo-constants": "~17.1.7",
|
||||||
@@ -58,6 +60,7 @@
|
|||||||
"expo-linking": "~7.1.7",
|
"expo-linking": "~7.1.7",
|
||||||
"expo-secure-store": "~14.2.3",
|
"expo-secure-store": "~14.2.3",
|
||||||
"expo-web-browser": "~14.2.0",
|
"expo-web-browser": "~14.2.0",
|
||||||
|
"react-native": "~0.80.2",
|
||||||
"unbuild": "^3.6.1"
|
"unbuild": "^3.6.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { BetterAuthClientPlugin, Store } from "better-auth/types";
|
import type { BetterAuthClientPlugin, Store } from "better-auth/types";
|
||||||
import * as Linking from "expo-linking";
|
import * as Linking from "expo-linking";
|
||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
import Constants from "expo-constants";
|
import Constants from "expo-constants";
|
||||||
import { BetterFetchOption } from "@better-fetch/fetch";
|
import type { BetterFetchOption } from "@better-fetch/fetch";
|
||||||
|
|
||||||
interface CookieAttributes {
|
interface CookieAttributes {
|
||||||
value: string;
|
value: string;
|
||||||
@@ -23,15 +23,15 @@ export function parseSetCookieHeader(
|
|||||||
cookies.forEach((cookie) => {
|
cookies.forEach((cookie) => {
|
||||||
const parts = cookie.split(";").map((p) => p.trim());
|
const parts = cookie.split(";").map((p) => p.trim());
|
||||||
const [nameValue, ...attributes] = parts;
|
const [nameValue, ...attributes] = parts;
|
||||||
const [name, ...valueParts] = nameValue.split("=");
|
const [name, ...valueParts] = nameValue!.split("=");
|
||||||
const value = valueParts.join("=");
|
const value = valueParts.join("=");
|
||||||
const cookieObj: CookieAttributes = { value };
|
const cookieObj: CookieAttributes = { value };
|
||||||
attributes.forEach((attr) => {
|
attributes.forEach((attr) => {
|
||||||
const [attrName, ...attrValueParts] = attr.split("=");
|
const [attrName, ...attrValueParts] = attr.split("=");
|
||||||
const attrValue = attrValueParts.join("=");
|
const attrValue = attrValueParts.join("=");
|
||||||
cookieObj[attrName.toLowerCase() as "value"] = attrValue;
|
cookieObj[attrName!.toLowerCase() as "value"] = attrValue;
|
||||||
});
|
});
|
||||||
cookieMap.set(name, cookieObj);
|
cookieMap.set(name!, cookieObj);
|
||||||
});
|
});
|
||||||
return cookieMap;
|
return cookieMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ describe("expo", async () => {
|
|||||||
provider: "google",
|
provider: "google",
|
||||||
callbackURL: "/dashboard",
|
callbackURL: "/dashboard",
|
||||||
});
|
});
|
||||||
const stateId = res?.url?.split("state=")[1].split("&")[0];
|
const stateId = res?.url?.split("state=")[1]!.split("&")[0];
|
||||||
const ctx = await auth.$context;
|
const ctx = await auth.$context;
|
||||||
if (!stateId) {
|
if (!stateId) {
|
||||||
throw new Error("State ID not found");
|
throw new Error("State ID not found");
|
||||||
@@ -157,9 +157,9 @@ describe("expo", async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should preserve unchanged client store session properties on signout", async () => {
|
it("should preserve unchanged client store session properties on signout", async () => {
|
||||||
const before = client.$store.atoms.session.get();
|
const before = client.$store.atoms.session!.get();
|
||||||
await client.signOut();
|
await client.signOut();
|
||||||
const after = client.$store.atoms.session.get();
|
const after = client.$store.atoms.session!.get();
|
||||||
|
|
||||||
expect(after).toMatchObject({
|
expect(after).toMatchObject({
|
||||||
...before,
|
...before,
|
||||||
|
|||||||
@@ -1,25 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"rootDir": "./src",
|
||||||
"emitDeclarationOnly": true,
|
"outDir": "./dist",
|
||||||
"declarationMap": true,
|
"lib": ["esnext", "dom", "dom.iterable"]
|
||||||
"outDir": "dist",
|
|
||||||
"noEmit": false,
|
|
||||||
"composite": false,
|
|
||||||
"target": "es2022",
|
|
||||||
"incremental": true,
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"strict": true,
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"module": "Preserve",
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"types": ["node"],
|
|
||||||
"isolatedModules": true,
|
|
||||||
"tsBuildInfoFile": ".tsbuildinfo",
|
|
||||||
"preserveSymlinks": true,
|
|
||||||
"noImplicitOverride": true
|
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist"],
|
"references": [
|
||||||
"references": [],
|
{
|
||||||
"include": ["src/**/*"]
|
"path": "../better-auth/tsconfig.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"build": "unbuild",
|
"build": "unbuild",
|
||||||
"typecheck": "tsc --noEmit",
|
"dev": "unbuild --watch",
|
||||||
"dev": "unbuild --watch"
|
"typecheck": "tsc --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"esModuleInterop": true,
|
"rootDir": "./src",
|
||||||
"skipLibCheck": true,
|
"outDir": "./dist",
|
||||||
"target": "es2022",
|
"lib": ["esnext", "dom", "dom.iterable"]
|
||||||
"allowJs": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"module": "ESNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"isolatedModules": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
"noFallthroughCasesInSwitch": true
|
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist"],
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../better-auth/tsconfig.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"build": "unbuild",
|
"build": "unbuild",
|
||||||
"typecheck": "tsc --noEmit",
|
"dev": "unbuild --watch",
|
||||||
"dev": "unbuild --watch"
|
"typecheck": "tsc --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export async function onCheckoutSessionCompleted(
|
|||||||
checkoutSession?.client_reference_id ||
|
checkoutSession?.client_reference_id ||
|
||||||
checkoutSession?.metadata?.referenceId;
|
checkoutSession?.metadata?.referenceId;
|
||||||
const subscriptionId = checkoutSession?.metadata?.subscriptionId;
|
const subscriptionId = checkoutSession?.metadata?.subscriptionId;
|
||||||
const seats = subscription.items.data[0].quantity;
|
const seats = subscription.items.data[0]!.quantity;
|
||||||
if (referenceId && subscriptionId) {
|
if (referenceId && subscriptionId) {
|
||||||
const trial =
|
const trial =
|
||||||
subscription.trial_start && subscription.trial_end
|
subscription.trial_start && subscription.trial_end
|
||||||
@@ -47,10 +47,10 @@ export async function onCheckoutSessionCompleted(
|
|||||||
status: subscription.status,
|
status: subscription.status,
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
periodStart: new Date(
|
periodStart: new Date(
|
||||||
subscription.items.data[0].current_period_start * 1000,
|
subscription.items.data[0]!.current_period_start * 1000,
|
||||||
),
|
),
|
||||||
periodEnd: new Date(
|
periodEnd: new Date(
|
||||||
subscription.items.data[0].current_period_end * 1000,
|
subscription.items.data[0]!.current_period_end * 1000,
|
||||||
),
|
),
|
||||||
stripeSubscriptionId: checkoutSession.subscription as string,
|
stripeSubscriptionId: checkoutSession.subscription as string,
|
||||||
seats,
|
seats,
|
||||||
@@ -106,9 +106,9 @@ export async function onSubscriptionUpdated(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const subscriptionUpdated = event.data.object as Stripe.Subscription;
|
const subscriptionUpdated = event.data.object as Stripe.Subscription;
|
||||||
const priceId = subscriptionUpdated.items.data[0].price.id;
|
const priceId = subscriptionUpdated.items.data[0]!.price.id;
|
||||||
const priceLookupKey =
|
const priceLookupKey =
|
||||||
subscriptionUpdated.items.data[0].price.lookup_key || null;
|
subscriptionUpdated.items.data[0]!.price.lookup_key || null;
|
||||||
const plan = await getPlanByPriceInfo(options, priceId, priceLookupKey);
|
const plan = await getPlanByPriceInfo(options, priceId, priceLookupKey);
|
||||||
|
|
||||||
const subscriptionId = subscriptionUpdated.metadata?.subscriptionId;
|
const subscriptionId = subscriptionUpdated.metadata?.subscriptionId;
|
||||||
@@ -137,11 +137,11 @@ export async function onSubscriptionUpdated(
|
|||||||
}
|
}
|
||||||
subscription = activeSub;
|
subscription = activeSub;
|
||||||
} else {
|
} else {
|
||||||
subscription = subs[0];
|
subscription = subs[0]!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const seats = subscriptionUpdated.items.data[0].quantity;
|
const seats = subscriptionUpdated.items.data[0]!.quantity;
|
||||||
await ctx.context.adapter.update({
|
await ctx.context.adapter.update({
|
||||||
model: "subscription",
|
model: "subscription",
|
||||||
update: {
|
update: {
|
||||||
@@ -154,10 +154,10 @@ export async function onSubscriptionUpdated(
|
|||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
status: subscriptionUpdated.status,
|
status: subscriptionUpdated.status,
|
||||||
periodStart: new Date(
|
periodStart: new Date(
|
||||||
subscriptionUpdated.items.data[0].current_period_start * 1000,
|
subscriptionUpdated.items.data[0]!.current_period_start * 1000,
|
||||||
),
|
),
|
||||||
periodEnd: new Date(
|
periodEnd: new Date(
|
||||||
subscriptionUpdated.items.data[0].current_period_end * 1000,
|
subscriptionUpdated.items.data[0]!.current_period_end * 1000,
|
||||||
),
|
),
|
||||||
cancelAtPeriodEnd: subscriptionUpdated.cancel_at_period_end,
|
cancelAtPeriodEnd: subscriptionUpdated.cancel_at_period_end,
|
||||||
seats,
|
seats,
|
||||||
|
|||||||
@@ -1026,8 +1026,8 @@ export const stripe = <O extends StripeOptions>(options: O) => {
|
|||||||
if (stripeSubscription) {
|
if (stripeSubscription) {
|
||||||
const plan = await getPlanByPriceInfo(
|
const plan = await getPlanByPriceInfo(
|
||||||
options,
|
options,
|
||||||
stripeSubscription.items.data[0]?.price.id,
|
stripeSubscription.items.data[0]?.price.id!,
|
||||||
stripeSubscription.items.data[0]?.price.lookup_key,
|
stripeSubscription.items.data[0]?.price.lookup_key!,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (plan && subscription) {
|
if (plan && subscription) {
|
||||||
@@ -1038,11 +1038,11 @@ export const stripe = <O extends StripeOptions>(options: O) => {
|
|||||||
seats: stripeSubscription.items.data[0]?.quantity || 1,
|
seats: stripeSubscription.items.data[0]?.quantity || 1,
|
||||||
plan: plan.name.toLowerCase(),
|
plan: plan.name.toLowerCase(),
|
||||||
periodEnd: new Date(
|
periodEnd: new Date(
|
||||||
stripeSubscription.items.data[0]?.current_period_end *
|
stripeSubscription.items.data[0]?.current_period_end! *
|
||||||
1000,
|
1000,
|
||||||
),
|
),
|
||||||
periodStart: new Date(
|
periodStart: new Date(
|
||||||
stripeSubscription.items.data[0]?.current_period_start *
|
stripeSubscription.items.data[0]?.current_period_start! *
|
||||||
1000,
|
1000,
|
||||||
),
|
),
|
||||||
stripeSubscriptionId: stripeSubscription.id,
|
stripeSubscriptionId: stripeSubscription.id,
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"esModuleInterop": true,
|
"rootDir": "./src",
|
||||||
"skipLibCheck": true,
|
"outDir": "./dist",
|
||||||
"target": "es2022",
|
"lib": ["esnext", "dom", "dom.iterable"]
|
||||||
"allowJs": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"module": "ESNext",
|
|
||||||
"noEmit": true,
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"isolatedModules": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
"noFallthroughCasesInSwitch": true
|
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "dist"],
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../better-auth/tsconfig.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
433
pnpm-lock.yaml
generated
433
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,42 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"target": "es2022",
|
|
||||||
"allowJs": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"module": "Preserve",
|
|
||||||
"noEmit": true,
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"isolatedModules": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"target": "esnext",
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"noImplicitOverride": true,
|
"exactOptionalPropertyTypes": false,
|
||||||
"noFallthroughCasesInSwitch": true
|
"declaration": true,
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"composite": true,
|
||||||
|
"incremental": true,
|
||||||
|
"noErrorTruncation": true,
|
||||||
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./packages/better-auth"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./packages/cli"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./packages/expo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./packages/sso"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./packages/stripe"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
"exclude": ["**/dist/**", "**/node_modules/**", "**/examples/**"]
|
"exclude": ["**/dist/**", "**/node_modules/**", "**/examples/**"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
"outputs": []
|
"outputs": []
|
||||||
},
|
},
|
||||||
"typecheck": {
|
"typecheck": {
|
||||||
"outputs": [],
|
"outputs": [".tsbuildinfo", "dist/**"],
|
||||||
"cache": true
|
"cache": true
|
||||||
},
|
},
|
||||||
"deploy": {
|
"deploy": {
|
||||||
|
|||||||
Reference in New Issue
Block a user