@better-auth/stripe 1.7.0-beta.0 → 1.7.0-beta.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/dist/client.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as STRIPE_ERROR_CODES, t as PACKAGE_VERSION } from "./version-
|
|
1
|
+
import { n as STRIPE_ERROR_CODES, t as PACKAGE_VERSION } from "./version-Bf-a0R3x.mjs";
|
|
2
2
|
import { APIError, HIDE_METADATA } from "better-auth";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
|
|
@@ -7,9 +7,27 @@ import { getSessionFromCtx, originCheck, sessionMiddleware } from "better-auth/a
|
|
|
7
7
|
import * as z from "zod";
|
|
8
8
|
import { mergeSchema } from "better-auth/db";
|
|
9
9
|
//#region src/metadata.ts
|
|
10
|
+
const UNSAFE_METADATA_KEYS = new Set([
|
|
11
|
+
"__proto__",
|
|
12
|
+
"constructor",
|
|
13
|
+
"prototype"
|
|
14
|
+
]);
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
16
|
+
* Merge flat Stripe metadata objects, giving `internalFields` final priority.
|
|
17
|
+
* Drops reserved keys that could mutate the target's prototype chain.
|
|
12
18
|
*/
|
|
19
|
+
function mergeMetadata(internalFields, userMetadata) {
|
|
20
|
+
const merged = {};
|
|
21
|
+
for (const source of userMetadata) {
|
|
22
|
+
if (!source) continue;
|
|
23
|
+
for (const [key, value] of Object.entries(source)) {
|
|
24
|
+
if (UNSAFE_METADATA_KEYS.has(key)) continue;
|
|
25
|
+
merged[key] = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const [key, value] of Object.entries(internalFields)) merged[key] = value;
|
|
29
|
+
return merged;
|
|
30
|
+
}
|
|
13
31
|
const customerMetadata = {
|
|
14
32
|
keys: {
|
|
15
33
|
userId: "userId",
|
|
@@ -17,7 +35,7 @@ const customerMetadata = {
|
|
|
17
35
|
customerType: "customerType"
|
|
18
36
|
},
|
|
19
37
|
set(internalFields, ...userMetadata) {
|
|
20
|
-
return
|
|
38
|
+
return mergeMetadata(internalFields, userMetadata);
|
|
21
39
|
},
|
|
22
40
|
get(metadata) {
|
|
23
41
|
return {
|
|
@@ -27,9 +45,6 @@ const customerMetadata = {
|
|
|
27
45
|
};
|
|
28
46
|
}
|
|
29
47
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Subscription/Checkout metadata - set internal fields and extract typed fields.
|
|
32
|
-
*/
|
|
33
48
|
const subscriptionMetadata = {
|
|
34
49
|
keys: {
|
|
35
50
|
userId: "userId",
|
|
@@ -37,7 +52,7 @@ const subscriptionMetadata = {
|
|
|
37
52
|
referenceId: "referenceId"
|
|
38
53
|
},
|
|
39
54
|
set(internalFields, ...userMetadata) {
|
|
40
|
-
return
|
|
55
|
+
return mergeMetadata(internalFields, userMetadata);
|
|
41
56
|
},
|
|
42
57
|
get(metadata) {
|
|
43
58
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/stripe",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.1",
|
|
4
4
|
"description": "Stripe plugin for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"defu": "^6.1.
|
|
54
|
+
"defu": "^6.1.5",
|
|
55
55
|
"zod": "^4.3.6"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"better-call": "1.3.5",
|
|
59
59
|
"stripe": "^22.0.1",
|
|
60
60
|
"tsdown": "0.21.1",
|
|
61
|
-
"@better-auth/core": "1.7.0-beta.
|
|
62
|
-
"better-auth": "1.7.0-beta.
|
|
61
|
+
"@better-auth/core": "1.7.0-beta.1",
|
|
62
|
+
"better-auth": "1.7.0-beta.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"better-call": "1.3.5",
|
|
66
66
|
"stripe": "^18 || ^19 || ^20 || ^21 || ^22",
|
|
67
|
-
"@better-auth/core": "^1.7.0-beta.
|
|
68
|
-
"better-auth": "^1.7.0-beta.
|
|
67
|
+
"@better-auth/core": "^1.7.0-beta.1",
|
|
68
|
+
"better-auth": "^1.7.0-beta.1"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsdown",
|