@dodopayments/better-auth 1.3.4 → 1.3.5
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/{chunk-FBAIEKOL.js → chunk-CRRND2EH.js} +2 -5
- package/dist/{chunk-FBAIEKOL.js.map → chunk-CRRND2EH.js.map} +1 -1
- package/dist/{chunk-YK6XO66Y.js → chunk-HHIXOUFD.js} +2 -6
- package/dist/{chunk-YK6XO66Y.js.map → chunk-HHIXOUFD.js.map} +1 -1
- package/dist/{chunk-52LQJCF4.js → chunk-J55PDPLE.js} +4 -7
- package/dist/{chunk-52LQJCF4.js.map → chunk-J55PDPLE.js.map} +1 -1
- package/dist/{chunk-Z7VSWPPK.js → chunk-O3BTJOIO.js} +3 -7
- package/dist/{chunk-Z7VSWPPK.js.map → chunk-O3BTJOIO.js.map} +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/hooks/customer.cjs +3 -13947
- package/dist/hooks/customer.cjs.map +1 -1
- package/dist/hooks/customer.d.cts +1 -1
- package/dist/hooks/customer.d.ts +1 -1
- package/dist/hooks/customer.js +1 -2
- package/dist/index.cjs +43 -14263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -8
- package/dist/index.d.ts +120 -8
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/plugins/checkout.cjs +13 -14240
- package/dist/plugins/checkout.cjs.map +1 -1
- package/dist/plugins/checkout.d.cts +1 -1
- package/dist/plugins/checkout.d.ts +1 -1
- package/dist/plugins/checkout.js +1 -3
- package/dist/plugins/portal.cjs +20 -14246
- package/dist/plugins/portal.cjs.map +1 -1
- package/dist/plugins/portal.d.cts +1 -1
- package/dist/plugins/portal.d.ts +1 -1
- package/dist/plugins/portal.js +1 -3
- package/dist/plugins/webhooks.cjs +7 -13951
- package/dist/plugins/webhooks.cjs.map +1 -1
- package/dist/plugins/webhooks.d.cts +1 -1
- package/dist/plugins/webhooks.d.ts +1 -1
- package/dist/plugins/webhooks.js +1 -2
- package/dist/{types-CbotWcHh.d.cts → types-yAk7fHrK.d.cts} +118 -6
- package/dist/{types-CbotWcHh.d.ts → types-yAk7fHrK.d.ts} +118 -6
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
- package/dist/chunk-QR7PLJJQ.js +0 -13943
- package/dist/chunk-QR7PLJJQ.js.map +0 -1
- package/dist/chunk-WIFOXVZ3.js +0 -291
- package/dist/chunk-WIFOXVZ3.js.map +0 -1
package/dist/chunk-WIFOXVZ3.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BetterAuthError,
|
|
3
|
-
createAuthMiddleware,
|
|
4
|
-
generateId,
|
|
5
|
-
sessionMiddleware
|
|
6
|
-
} from "./chunk-QR7PLJJQ.js";
|
|
7
|
-
|
|
8
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.C1Ly154X.mjs
|
|
9
|
-
import * as z3 from "zod/v4";
|
|
10
|
-
|
|
11
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.ffWeg50w.mjs
|
|
12
|
-
var SPECIAL_VALUES = {
|
|
13
|
-
true: true,
|
|
14
|
-
false: false,
|
|
15
|
-
null: null,
|
|
16
|
-
undefined: void 0,
|
|
17
|
-
nan: Number.NaN,
|
|
18
|
-
infinity: Number.POSITIVE_INFINITY,
|
|
19
|
-
"-infinity": Number.NEGATIVE_INFINITY
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.DGaVMVAI.mjs
|
|
23
|
-
import * as z from "zod/v4";
|
|
24
|
-
var orgMiddleware = createAuthMiddleware(async () => {
|
|
25
|
-
return {};
|
|
26
|
-
});
|
|
27
|
-
var orgSessionMiddleware = createAuthMiddleware(
|
|
28
|
-
{
|
|
29
|
-
use: [sessionMiddleware]
|
|
30
|
-
},
|
|
31
|
-
async (ctx) => {
|
|
32
|
-
const session = ctx.context.session;
|
|
33
|
-
return {
|
|
34
|
-
session
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
var role = z.string();
|
|
39
|
-
var invitationStatus = z.enum(["pending", "accepted", "rejected", "canceled"]).default("pending");
|
|
40
|
-
z.object({
|
|
41
|
-
id: z.string().default(generateId),
|
|
42
|
-
name: z.string(),
|
|
43
|
-
slug: z.string(),
|
|
44
|
-
logo: z.string().nullish().optional(),
|
|
45
|
-
metadata: z.record(z.string(), z.unknown()).or(z.string().transform((v) => JSON.parse(v))).optional(),
|
|
46
|
-
createdAt: z.date()
|
|
47
|
-
});
|
|
48
|
-
z.object({
|
|
49
|
-
id: z.string().default(generateId),
|
|
50
|
-
organizationId: z.string(),
|
|
51
|
-
userId: z.coerce.string(),
|
|
52
|
-
role,
|
|
53
|
-
createdAt: z.date().default(() => /* @__PURE__ */ new Date())
|
|
54
|
-
});
|
|
55
|
-
z.object({
|
|
56
|
-
id: z.string().default(generateId),
|
|
57
|
-
organizationId: z.string(),
|
|
58
|
-
email: z.string(),
|
|
59
|
-
role,
|
|
60
|
-
status: invitationStatus,
|
|
61
|
-
teamId: z.string().optional(),
|
|
62
|
-
inviterId: z.string(),
|
|
63
|
-
expiresAt: z.date()
|
|
64
|
-
});
|
|
65
|
-
var teamSchema = z.object({
|
|
66
|
-
id: z.string().default(generateId),
|
|
67
|
-
name: z.string().min(1),
|
|
68
|
-
organizationId: z.string(),
|
|
69
|
-
createdAt: z.date(),
|
|
70
|
-
updatedAt: z.date().optional()
|
|
71
|
-
});
|
|
72
|
-
z.object({
|
|
73
|
-
id: z.string().default(generateId),
|
|
74
|
-
teamId: z.string(),
|
|
75
|
-
userId: z.string(),
|
|
76
|
-
createdAt: z.date().default(() => /* @__PURE__ */ new Date())
|
|
77
|
-
});
|
|
78
|
-
var defaultRoles = ["admin", "member", "owner"];
|
|
79
|
-
z.union([
|
|
80
|
-
z.enum(defaultRoles),
|
|
81
|
-
z.array(z.enum(defaultRoles))
|
|
82
|
-
]);
|
|
83
|
-
|
|
84
|
-
// ../../node_modules/better-auth/dist/plugins/access/index.mjs
|
|
85
|
-
function role2(statements) {
|
|
86
|
-
return {
|
|
87
|
-
authorize(request, connector = "AND") {
|
|
88
|
-
let success = false;
|
|
89
|
-
for (const [requestedResource, requestedActions] of Object.entries(
|
|
90
|
-
request
|
|
91
|
-
)) {
|
|
92
|
-
const allowedActions = statements[requestedResource];
|
|
93
|
-
if (!allowedActions) {
|
|
94
|
-
return {
|
|
95
|
-
success: false,
|
|
96
|
-
error: `You are not allowed to access resource: ${requestedResource}`
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (Array.isArray(requestedActions)) {
|
|
100
|
-
success = requestedActions.every(
|
|
101
|
-
(requestedAction) => allowedActions.includes(requestedAction)
|
|
102
|
-
);
|
|
103
|
-
} else {
|
|
104
|
-
if (typeof requestedActions === "object") {
|
|
105
|
-
const actions = requestedActions;
|
|
106
|
-
if (actions.connector === "OR") {
|
|
107
|
-
success = actions.actions.some(
|
|
108
|
-
(requestedAction) => allowedActions.includes(requestedAction)
|
|
109
|
-
);
|
|
110
|
-
} else {
|
|
111
|
-
success = actions.actions.every(
|
|
112
|
-
(requestedAction) => allowedActions.includes(requestedAction)
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
throw new BetterAuthError("Invalid access control request");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (success && connector === "OR") {
|
|
120
|
-
return { success };
|
|
121
|
-
}
|
|
122
|
-
if (!success && connector === "AND") {
|
|
123
|
-
return {
|
|
124
|
-
success: false,
|
|
125
|
-
error: `unauthorized to access resource "${requestedResource}"`
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (success) {
|
|
130
|
-
return {
|
|
131
|
-
success
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
success: false,
|
|
136
|
-
error: "Not authorized"
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
statements
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function createAccessControl(s) {
|
|
143
|
-
return {
|
|
144
|
-
newRole(statements) {
|
|
145
|
-
return role2(statements);
|
|
146
|
-
},
|
|
147
|
-
statements: s
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// ../../node_modules/better-auth/dist/plugins/organization/access/index.mjs
|
|
152
|
-
var defaultStatements = {
|
|
153
|
-
organization: ["update", "delete"],
|
|
154
|
-
member: ["create", "update", "delete"],
|
|
155
|
-
invitation: ["create", "cancel"],
|
|
156
|
-
team: ["create", "update", "delete"]
|
|
157
|
-
};
|
|
158
|
-
var defaultAc = createAccessControl(defaultStatements);
|
|
159
|
-
var adminAc = defaultAc.newRole({
|
|
160
|
-
organization: ["update"],
|
|
161
|
-
invitation: ["create", "cancel"],
|
|
162
|
-
member: ["create", "update", "delete"],
|
|
163
|
-
team: ["create", "update", "delete"]
|
|
164
|
-
});
|
|
165
|
-
var ownerAc = defaultAc.newRole({
|
|
166
|
-
organization: ["update", "delete"],
|
|
167
|
-
member: ["create", "update", "delete"],
|
|
168
|
-
invitation: ["create", "cancel"],
|
|
169
|
-
team: ["create", "update", "delete"]
|
|
170
|
-
});
|
|
171
|
-
var memberAc = defaultAc.newRole({
|
|
172
|
-
organization: [],
|
|
173
|
-
member: [],
|
|
174
|
-
invitation: [],
|
|
175
|
-
team: []
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.DXqcUO8W.mjs
|
|
179
|
-
import * as z2 from "zod/v4";
|
|
180
|
-
|
|
181
|
-
// ../../node_modules/better-auth/dist/plugins/two-factor/index.mjs
|
|
182
|
-
import * as z4 from "zod/v4";
|
|
183
|
-
|
|
184
|
-
// ../../node_modules/better-auth/dist/plugins/username/index.mjs
|
|
185
|
-
import * as z5 from "zod/v4";
|
|
186
|
-
|
|
187
|
-
// ../../node_modules/better-auth/dist/plugins/bearer/index.mjs
|
|
188
|
-
import "zod/v4";
|
|
189
|
-
|
|
190
|
-
// ../../node_modules/better-auth/dist/plugins/magic-link/index.mjs
|
|
191
|
-
import * as z6 from "zod/v4";
|
|
192
|
-
|
|
193
|
-
// ../../node_modules/better-auth/dist/plugins/phone-number/index.mjs
|
|
194
|
-
import * as z7 from "zod/v4";
|
|
195
|
-
|
|
196
|
-
// ../../node_modules/better-auth/dist/plugins/anonymous/index.mjs
|
|
197
|
-
import "zod/v4";
|
|
198
|
-
|
|
199
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.DygEm6OX.mjs
|
|
200
|
-
import * as z8 from "zod/v4";
|
|
201
|
-
|
|
202
|
-
// ../../node_modules/better-auth/dist/plugins/admin/access/index.mjs
|
|
203
|
-
var defaultStatements2 = {
|
|
204
|
-
user: [
|
|
205
|
-
"create",
|
|
206
|
-
"list",
|
|
207
|
-
"set-role",
|
|
208
|
-
"ban",
|
|
209
|
-
"impersonate",
|
|
210
|
-
"delete",
|
|
211
|
-
"set-password",
|
|
212
|
-
"update"
|
|
213
|
-
],
|
|
214
|
-
session: ["list", "revoke", "delete"]
|
|
215
|
-
};
|
|
216
|
-
var defaultAc2 = createAccessControl(defaultStatements2);
|
|
217
|
-
var adminAc2 = defaultAc2.newRole({
|
|
218
|
-
user: [
|
|
219
|
-
"create",
|
|
220
|
-
"list",
|
|
221
|
-
"set-role",
|
|
222
|
-
"ban",
|
|
223
|
-
"impersonate",
|
|
224
|
-
"delete",
|
|
225
|
-
"set-password",
|
|
226
|
-
"update"
|
|
227
|
-
],
|
|
228
|
-
session: ["list", "revoke", "delete"]
|
|
229
|
-
});
|
|
230
|
-
var userAc = defaultAc2.newRole({
|
|
231
|
-
user: [],
|
|
232
|
-
session: []
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
// ../../node_modules/better-auth/dist/plugins/generic-oauth/index.mjs
|
|
236
|
-
import * as z9 from "zod/v4";
|
|
237
|
-
|
|
238
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.CGrHn1Ih.mjs
|
|
239
|
-
import * as z10 from "zod/v4";
|
|
240
|
-
z10.object({
|
|
241
|
-
id: z10.string(),
|
|
242
|
-
publicKey: z10.string(),
|
|
243
|
-
privateKey: z10.string(),
|
|
244
|
-
createdAt: z10.date()
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
// ../../node_modules/better-auth/dist/plugins/jwt/index.mjs
|
|
248
|
-
import "zod/v4";
|
|
249
|
-
|
|
250
|
-
// ../../node_modules/better-auth/dist/plugins/multi-session/index.mjs
|
|
251
|
-
import * as z11 from "zod/v4";
|
|
252
|
-
|
|
253
|
-
// ../../node_modules/better-auth/dist/plugins/email-otp/index.mjs
|
|
254
|
-
import * as z12 from "zod/v4";
|
|
255
|
-
|
|
256
|
-
// ../../node_modules/better-auth/dist/plugins/one-tap/index.mjs
|
|
257
|
-
import * as z13 from "zod/v4";
|
|
258
|
-
|
|
259
|
-
// ../../node_modules/better-auth/dist/plugins/oauth-proxy/index.mjs
|
|
260
|
-
import * as z14 from "zod/v4";
|
|
261
|
-
|
|
262
|
-
// ../../node_modules/better-auth/dist/plugins/custom-session/index.mjs
|
|
263
|
-
import * as z15 from "zod/v4";
|
|
264
|
-
|
|
265
|
-
// ../../node_modules/better-auth/dist/plugins/open-api/index.mjs
|
|
266
|
-
import { ZodObject, ZodType, ZodOptional, z as z16, ZodString, ZodNumber, ZodBoolean, ZodArray } from "zod/v4";
|
|
267
|
-
|
|
268
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.CvxACSRz.mjs
|
|
269
|
-
import * as z17 from "zod/v4";
|
|
270
|
-
|
|
271
|
-
// ../../node_modules/better-auth/dist/plugins/captcha/index.mjs
|
|
272
|
-
var Providers = {
|
|
273
|
-
CLOUDFLARE_TURNSTILE: "cloudflare-turnstile",
|
|
274
|
-
GOOGLE_RECAPTCHA: "google-recaptcha",
|
|
275
|
-
HCAPTCHA: "hcaptcha"
|
|
276
|
-
};
|
|
277
|
-
var siteVerifyMap = {
|
|
278
|
-
[Providers.CLOUDFLARE_TURNSTILE]: "https://challenges.cloudflare.com/turnstile/v0/siteverify",
|
|
279
|
-
[Providers.GOOGLE_RECAPTCHA]: "https://www.google.com/recaptcha/api/siteverify",
|
|
280
|
-
[Providers.HCAPTCHA]: "https://api.hcaptcha.com/siteverify"
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// ../../node_modules/better-auth/dist/shared/better-auth.Bqt8-7ls.mjs
|
|
284
|
-
import * as z18 from "zod/v4";
|
|
285
|
-
|
|
286
|
-
// ../../node_modules/better-auth/dist/plugins/haveibeenpwned/index.mjs
|
|
287
|
-
import "zod/v4";
|
|
288
|
-
|
|
289
|
-
// ../../node_modules/better-auth/dist/plugins/index.mjs
|
|
290
|
-
import * as z19 from "zod/v4";
|
|
291
|
-
//# sourceMappingURL=chunk-WIFOXVZ3.js.map
|