@better-auth/stripe 1.3.26 → 1.3.28

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.
@@ -1,15 +1,15 @@
1
1
 
2
- > @better-auth/stripe@1.3.26 build /home/runner/work/better-auth/better-auth/packages/stripe
2
+ > @better-auth/stripe@1.3.28 build /home/runner/work/better-auth/better-auth/packages/stripe
3
3
  > unbuild
4
4
 
5
5
  [info] Automatically detected entries: src/index, src/client [esm] [cjs] [dts]
6
6
  [info] Building stripe
7
7
  [success] Build succeeded for stripe
8
- [log] dist/index.cjs (total size: 49 kB, chunk size: 49 kB, exports: stripe)
8
+ [log] dist/index.cjs (total size: 49.2 kB, chunk size: 49.2 kB, exports: stripe)
9
9
 
10
10
  [log] dist/client.cjs (total size: 270 B, chunk size: 270 B, exports: stripeClient)
11
11
 
12
- [log] dist/index.mjs (total size: 48.2 kB, chunk size: 48.2 kB, exports: stripe)
12
+ [log] dist/index.mjs (total size: 48.3 kB, chunk size: 48.3 kB, exports: stripe)
13
13
 
14
14
  [log] dist/client.mjs (total size: 243 B, chunk size: 243 B, exports: stripeClient)
15
15
 
package/dist/index.cjs CHANGED
@@ -1330,6 +1330,11 @@ const stripe = (options) => {
1330
1330
  message: `Webhook Error: ${err.message}`
1331
1331
  });
1332
1332
  }
1333
+ if (!event) {
1334
+ throw new api.APIError("BAD_REQUEST", {
1335
+ message: "Failed to construct event"
1336
+ });
1337
+ }
1333
1338
  try {
1334
1339
  switch (event.type) {
1335
1340
  case "checkout.session.completed":
package/dist/index.d.cts CHANGED
@@ -1076,7 +1076,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
1076
1076
  emailVerified: boolean;
1077
1077
  name: string;
1078
1078
  image?: string | null | undefined;
1079
- } & Record<string, unknown>, ctx: GenericEndpointContext | undefined): Promise<void>;
1079
+ } & Record<string, unknown>, ctx: GenericEndpointContext<better_auth.BetterAuthOptions> | undefined): Promise<void>;
1080
1080
  };
1081
1081
  update: {
1082
1082
  after(user: {
@@ -1087,7 +1087,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
1087
1087
  emailVerified: boolean;
1088
1088
  name: string;
1089
1089
  image?: string | null | undefined;
1090
- } & Record<string, unknown>, ctx: GenericEndpointContext | undefined): Promise<void>;
1090
+ } & Record<string, unknown>, ctx: GenericEndpointContext<better_auth.BetterAuthOptions> | undefined): Promise<void>;
1091
1091
  };
1092
1092
  };
1093
1093
  };
package/dist/index.d.mts CHANGED
@@ -1076,7 +1076,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
1076
1076
  emailVerified: boolean;
1077
1077
  name: string;
1078
1078
  image?: string | null | undefined;
1079
- } & Record<string, unknown>, ctx: GenericEndpointContext | undefined): Promise<void>;
1079
+ } & Record<string, unknown>, ctx: GenericEndpointContext<better_auth.BetterAuthOptions> | undefined): Promise<void>;
1080
1080
  };
1081
1081
  update: {
1082
1082
  after(user: {
@@ -1087,7 +1087,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
1087
1087
  emailVerified: boolean;
1088
1088
  name: string;
1089
1089
  image?: string | null | undefined;
1090
- } & Record<string, unknown>, ctx: GenericEndpointContext | undefined): Promise<void>;
1090
+ } & Record<string, unknown>, ctx: GenericEndpointContext<better_auth.BetterAuthOptions> | undefined): Promise<void>;
1091
1091
  };
1092
1092
  };
1093
1093
  };
package/dist/index.d.ts CHANGED
@@ -1076,7 +1076,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
1076
1076
  emailVerified: boolean;
1077
1077
  name: string;
1078
1078
  image?: string | null | undefined;
1079
- } & Record<string, unknown>, ctx: GenericEndpointContext | undefined): Promise<void>;
1079
+ } & Record<string, unknown>, ctx: GenericEndpointContext<better_auth.BetterAuthOptions> | undefined): Promise<void>;
1080
1080
  };
1081
1081
  update: {
1082
1082
  after(user: {
@@ -1087,7 +1087,7 @@ declare const stripe: <O extends StripeOptions>(options: O) => {
1087
1087
  emailVerified: boolean;
1088
1088
  name: string;
1089
1089
  image?: string | null | undefined;
1090
- } & Record<string, unknown>, ctx: GenericEndpointContext | undefined): Promise<void>;
1090
+ } & Record<string, unknown>, ctx: GenericEndpointContext<better_auth.BetterAuthOptions> | undefined): Promise<void>;
1091
1091
  };
1092
1092
  };
1093
1093
  };
package/dist/index.mjs CHANGED
@@ -1314,6 +1314,11 @@ const stripe = (options) => {
1314
1314
  message: `Webhook Error: ${err.message}`
1315
1315
  });
1316
1316
  }
1317
+ if (!event) {
1318
+ throw new APIError("BAD_REQUEST", {
1319
+ message: "Failed to construct event"
1320
+ });
1321
+ }
1317
1322
  try {
1318
1323
  switch (event.type) {
1319
1324
  case "checkout.session.completed":
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@better-auth/stripe",
3
3
  "author": "Bereket Engida",
4
- "version": "1.3.26",
4
+ "version": "1.3.28",
5
5
  "main": "dist/index.cjs",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -42,13 +42,15 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "stripe": "^18",
45
- "better-auth": "1.3.26"
45
+ "@better-auth/core": "1.3.28",
46
+ "better-auth": "1.3.28"
46
47
  },
47
48
  "devDependencies": {
48
49
  "better-call": "1.0.19",
49
50
  "stripe": "^18.5.0",
50
51
  "unbuild": "3.6.1",
51
- "better-auth": "1.3.26"
52
+ "@better-auth/core": "1.3.28",
53
+ "better-auth": "1.3.28"
52
54
  },
53
55
  "scripts": {
54
56
  "test": "vitest",
package/src/index.ts CHANGED
@@ -1255,6 +1255,11 @@ export const stripe = <O extends StripeOptions>(options: O) => {
1255
1255
  message: `Webhook Error: ${err.message}`,
1256
1256
  });
1257
1257
  }
1258
+ if (!event) {
1259
+ throw new APIError("BAD_REQUEST", {
1260
+ message: "Failed to construct event",
1261
+ });
1262
+ }
1258
1263
  try {
1259
1264
  switch (event.type) {
1260
1265
  case "checkout.session.completed":
package/src/schema.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AuthPluginSchema } from "better-auth";
1
+ import type { BetterAuthPluginDBSchema } from "@better-auth/core/db";
2
2
  import type { StripeOptions } from "./types";
3
3
  import { mergeSchema } from "better-auth/db";
4
4
 
@@ -52,7 +52,7 @@ export const subscriptions = {
52
52
  },
53
53
  },
54
54
  },
55
- } satisfies AuthPluginSchema;
55
+ } satisfies BetterAuthPluginDBSchema;
56
56
 
57
57
  export const user = {
58
58
  user: {
@@ -63,7 +63,7 @@ export const user = {
63
63
  },
64
64
  },
65
65
  },
66
- } satisfies AuthPluginSchema;
66
+ } satisfies BetterAuthPluginDBSchema;
67
67
 
68
68
  export const getSchema = (options: StripeOptions) => {
69
69
  let baseSchema = {};