@rio.js/enterprise 1.4.0

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.
Files changed (41) hide show
  1. package/README.md +89 -0
  2. package/dist/adapter-factory-BTRALCLD-kJBwe70v.mjs +836 -0
  3. package/dist/better-auth-CStoaWiq.d.mts +10 -0
  4. package/dist/better-auth-CqfhQJYE.mjs +558 -0
  5. package/dist/better-auth.d.mts +2 -0
  6. package/dist/better-auth.mjs +17 -0
  7. package/dist/bun-sqlite-dialect-2R9nCsVF-DFs6tpGr.mjs +155 -0
  8. package/dist/client--1_AEBPu-8Ae9icC9.mjs +125 -0
  9. package/dist/client.d.mts +17 -0
  10. package/dist/client.mjs +381 -0
  11. package/dist/db-BVXTgOd3.mjs +681 -0
  12. package/dist/db-BadqSwVl.d.mts +9542 -0
  13. package/dist/db-schema.final-DWleoQm0.mjs +785 -0
  14. package/dist/db.d.mts +2 -0
  15. package/dist/db.mjs +3 -0
  16. package/dist/dialect-C6_pK3V9-CPJHWkYR.mjs +72 -0
  17. package/dist/dist-CygcgJYk.mjs +422 -0
  18. package/dist/env-DwlNAN_D-C1zHd0cf-Cdlw8sNp.mjs +289 -0
  19. package/dist/esm-C5TuvtGn.mjs +15816 -0
  20. package/dist/index.d.mts +6 -0
  21. package/dist/index.mjs +17 -0
  22. package/dist/init-D8lwWc90.mjs +27 -0
  23. package/dist/json-oFuWgANh-O1U6k3bL.mjs +3811 -0
  24. package/dist/kysely-adapter-D_seG51p.mjs +297 -0
  25. package/dist/memory-adapter-CY-oDozb.mjs +215 -0
  26. package/dist/misc-CbURQDlR-sLtUwwQY.mjs +7 -0
  27. package/dist/node-sqlite-dialect-CdC7L-ji-QLbJGmDc.mjs +155 -0
  28. package/dist/parser-bL7W2mQ0-YdTgjtji.mjs +140 -0
  29. package/dist/plugins-BNFht2HW.mjs +23358 -0
  30. package/dist/plugins.d.mts +1 -0
  31. package/dist/plugins.mjs +13 -0
  32. package/dist/react--VZQu7s1.mjs +560 -0
  33. package/dist/react.d.mts +1 -0
  34. package/dist/react.mjs +6 -0
  35. package/dist/server.d.mts +10 -0
  36. package/dist/server.mjs +45 -0
  37. package/dist/social-providers-DNfE9Ak7-Be5zMAEe.mjs +2920 -0
  38. package/dist/social-providers.d.mts +1 -0
  39. package/dist/social-providers.mjs +6 -0
  40. package/dist/verify-CN5Qc0e-.mjs +1183 -0
  41. package/package.json +98 -0
@@ -0,0 +1,140 @@
1
+ import { g as BetterAuthError, i as env } from "./env-DwlNAN_D-C1zHd0cf-Cdlw8sNp.mjs";
2
+
3
+ //#region ../better-auth/dist/url-BmKM7xgt.mjs
4
+ function checkHasPath(url) {
5
+ try {
6
+ return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
7
+ } catch (error) {
8
+ throw new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`);
9
+ }
10
+ }
11
+ function assertHasProtocol(url) {
12
+ try {
13
+ const parsedUrl = new URL(url);
14
+ if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") throw new BetterAuthError(`Invalid base URL: ${url}. URL must include 'http://' or 'https://'`);
15
+ } catch (error) {
16
+ if (error instanceof BetterAuthError) throw error;
17
+ throw new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`, String(error));
18
+ }
19
+ }
20
+ function withPath(url, path = "/api/auth") {
21
+ assertHasProtocol(url);
22
+ if (checkHasPath(url)) return url;
23
+ const trimmedUrl = url.replace(/\/+$/, "");
24
+ if (!path || path === "/") return trimmedUrl;
25
+ path = path.startsWith("/") ? path : `/${path}`;
26
+ return `${trimmedUrl}${path}`;
27
+ }
28
+ function getBaseURL(url, path, request, loadEnv) {
29
+ if (url) return withPath(url, path);
30
+ if (loadEnv !== false) {
31
+ const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
32
+ if (fromEnv) return withPath(fromEnv, path);
33
+ }
34
+ const fromRequest = request?.headers.get("x-forwarded-host");
35
+ const fromRequestProto = request?.headers.get("x-forwarded-proto");
36
+ if (fromRequest && fromRequestProto) return withPath(`${fromRequestProto}://${fromRequest}`, path);
37
+ if (request) {
38
+ const url$1 = getOrigin(request.url);
39
+ if (!url$1) throw new BetterAuthError("Could not get origin from request. Please provide a valid base URL.");
40
+ return withPath(url$1, path);
41
+ }
42
+ if (typeof window !== "undefined" && window.location) return withPath(window.location.origin, path);
43
+ }
44
+ function getOrigin(url) {
45
+ try {
46
+ const parsedUrl = new URL(url);
47
+ return parsedUrl.origin === "null" ? null : parsedUrl.origin;
48
+ } catch (error) {
49
+ return null;
50
+ }
51
+ }
52
+ function getProtocol(url) {
53
+ try {
54
+ return new URL(url).protocol;
55
+ } catch (error) {
56
+ return null;
57
+ }
58
+ }
59
+ function getHost(url) {
60
+ try {
61
+ return new URL(url).host;
62
+ } catch (error) {
63
+ return null;
64
+ }
65
+ }
66
+
67
+ //#endregion
68
+ //#region ../better-auth/dist/parser-bL7W2mQ0.mjs
69
+ const PROTO_POLLUTION_PATTERNS = {
70
+ proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
71
+ constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
72
+ protoShort: /"__proto__"\s*:/,
73
+ constructorShort: /"constructor"\s*:/
74
+ };
75
+ const JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
76
+ const SPECIAL_VALUES = {
77
+ true: true,
78
+ false: false,
79
+ null: null,
80
+ undefined: void 0,
81
+ nan: NaN,
82
+ infinity: Number.POSITIVE_INFINITY,
83
+ "-infinity": Number.NEGATIVE_INFINITY
84
+ };
85
+ const ISO_DATE_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
86
+ function isValidDate(date) {
87
+ return date instanceof Date && !isNaN(date.getTime());
88
+ }
89
+ function parseISODate(value) {
90
+ const match = ISO_DATE_REGEX.exec(value);
91
+ if (!match) return null;
92
+ const [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;
93
+ let date = new Date(Date.UTC(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10), parseInt(hour, 10), parseInt(minute, 10), parseInt(second, 10), ms ? parseInt(ms.padEnd(3, "0"), 10) : 0));
94
+ if (offsetSign) {
95
+ const offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === "+" ? -1 : 1);
96
+ date.setUTCMinutes(date.getUTCMinutes() + offset);
97
+ }
98
+ return isValidDate(date) ? date : null;
99
+ }
100
+ function betterJSONParse(value, options = {}) {
101
+ const { strict = false, warnings = false, reviver, parseDates = true } = options;
102
+ if (typeof value !== "string") return value;
103
+ const trimmed = value.trim();
104
+ if (trimmed.length > 0 && trimmed[0] === "\"" && trimmed.endsWith("\"") && !trimmed.slice(1, -1).includes("\"")) return trimmed.slice(1, -1);
105
+ const lowerValue = trimmed.toLowerCase();
106
+ if (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];
107
+ if (!JSON_SIGNATURE.test(trimmed)) {
108
+ if (strict) throw new SyntaxError("[better-json] Invalid JSON");
109
+ return value;
110
+ }
111
+ if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
112
+ const matches = pattern.test(trimmed);
113
+ if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
114
+ return matches;
115
+ }) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
116
+ try {
117
+ const secureReviver = (key, value$1) => {
118
+ if (key === "__proto__" || key === "constructor" && value$1 && typeof value$1 === "object" && "prototype" in value$1) {
119
+ if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
120
+ return;
121
+ }
122
+ if (parseDates && typeof value$1 === "string") {
123
+ const date = parseISODate(value$1);
124
+ if (date) return date;
125
+ }
126
+ return reviver ? reviver(key, value$1) : value$1;
127
+ };
128
+ return JSON.parse(trimmed, secureReviver);
129
+ } catch (error) {
130
+ if (strict) throw error;
131
+ return value;
132
+ }
133
+ }
134
+ function parseJSON(value, options = { strict: true }) {
135
+ return betterJSONParse(value, options);
136
+ }
137
+ var parser_default = parseJSON;
138
+
139
+ //#endregion
140
+ export { getOrigin as a, getHost as i, parser_default as n, getProtocol as o, getBaseURL as r, parseJSON as t };