@access-dlsu/leapify 0.260505.5 → 0.260507.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/app.d.ts +15 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/auth/auth.d.ts +99 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/middleware.d.ts +20 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/types.d.ts +17 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/bun-sqlite-dialect-na--YwnN-NIYANHVJ.cjs +162 -0
- package/dist/bun-sqlite-dialect-na--YwnN-NIYANHVJ.cjs.map +1 -0
- package/dist/bun-sqlite-dialect-na--YwnN-XVQNOKSL.js +160 -0
- package/dist/bun-sqlite-dialect-na--YwnN-XVQNOKSL.js.map +1 -0
- package/dist/chunk-4DPT2KQR.cjs +467 -0
- package/dist/chunk-4DPT2KQR.cjs.map +1 -0
- package/dist/chunk-5JKLV7IE.cjs +2962 -0
- package/dist/chunk-5JKLV7IE.cjs.map +1 -0
- package/dist/chunk-5OQD5ALM.cjs +76 -0
- package/dist/chunk-5OQD5ALM.cjs.map +1 -0
- package/dist/{chunk-FLR7TNLN.js → chunk-63CUZGSZ.js} +4 -12
- package/dist/chunk-63CUZGSZ.js.map +1 -0
- package/dist/chunk-6MMWL46O.cjs +7170 -0
- package/dist/chunk-6MMWL46O.cjs.map +1 -0
- package/dist/chunk-ANNHE3PZ.js +2285 -0
- package/dist/chunk-ANNHE3PZ.js.map +1 -0
- package/dist/chunk-EGRHWZRV.js +3 -0
- package/dist/chunk-EGRHWZRV.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-FUCJEA2S.js +6196 -0
- package/dist/chunk-FUCJEA2S.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-GNRL67OU.js +2949 -0
- package/dist/chunk-GNRL67OU.js.map +1 -0
- package/dist/chunk-HHNEB7YR.js +8 -0
- package/dist/chunk-HHNEB7YR.js.map +1 -0
- package/dist/chunk-IQEWVHLM.js +889 -0
- package/dist/chunk-IQEWVHLM.js.map +1 -0
- package/dist/chunk-JIZPYG6H.js +72 -0
- package/dist/chunk-JIZPYG6H.js.map +1 -0
- package/dist/chunk-JPVIXCF5.cjs +10 -0
- package/dist/chunk-JPVIXCF5.cjs.map +1 -0
- package/dist/chunk-JQSZJWBN.cjs +3075 -0
- package/dist/chunk-JQSZJWBN.cjs.map +1 -0
- package/dist/chunk-MNEW2V4T.js +447 -0
- package/dist/chunk-MNEW2V4T.js.map +1 -0
- package/dist/chunk-MY37YE52.js +3034 -0
- package/dist/chunk-MY37YE52.js.map +1 -0
- package/dist/chunk-NKIQRCOM.cjs +4 -0
- package/dist/chunk-NKIQRCOM.cjs.map +1 -0
- package/dist/chunk-OK6RVPEH.cjs +6200 -0
- package/dist/chunk-OK6RVPEH.cjs.map +1 -0
- package/dist/chunk-QARF2YFF.cjs +2296 -0
- package/dist/chunk-QARF2YFF.cjs.map +1 -0
- package/dist/chunk-RFP2X2FA.cjs +903 -0
- package/dist/chunk-RFP2X2FA.cjs.map +1 -0
- package/dist/chunk-XJSWMHDL.js +7142 -0
- package/dist/chunk-XJSWMHDL.js.map +1 -0
- package/dist/{chunk-3ZWIJNZG.cjs → chunk-YFJBE3AU.cjs} +4 -12
- package/dist/chunk-YFJBE3AU.cjs.map +1 -0
- package/dist/client/{index.d.cts → auth.d.ts} +140 -394
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/index.cjs +909 -48
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.ts +83 -1134
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +908 -47
- package/dist/client/index.js.map +1 -1
- package/dist/client/pow.d.ts +28 -0
- package/dist/client/pow.d.ts.map +1 -0
- package/dist/client/session.d.ts +29 -0
- package/dist/client/session.d.ts.map +1 -0
- package/dist/client/types.d.ts +58 -38
- package/dist/client/types.d.ts.map +1 -0
- package/dist/cron/batch-release.d.ts +9 -0
- package/dist/cron/batch-release.d.ts.map +1 -0
- package/dist/cron/lifecycle-check.d.ts +10 -0
- package/dist/cron/lifecycle-check.d.ts.map +1 -0
- package/dist/cron/reconcile-slots.d.ts +10 -0
- package/dist/cron/reconcile-slots.d.ts.map +1 -0
- package/dist/cron/reminder-emails.d.ts +9 -0
- package/dist/cron/reminder-emails.d.ts.map +1 -0
- package/dist/cron/renew-watches.d.ts +9 -0
- package/dist/cron/renew-watches.d.ts.map +1 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-6TVV7EJ5.js +122 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-6TVV7EJ5.js.map +1 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-PE74FLHQ.cjs +124 -0
- package/dist/d1-sqlite-dialect-C2B7YsIT-PE74FLHQ.cjs.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/migrate.d.ts +23 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/schema/auth.d.ts +649 -0
- package/dist/db/schema/auth.d.ts.map +1 -0
- package/dist/db/schema/bookmarks.d.ts +88 -0
- package/dist/db/schema/bookmarks.d.ts.map +1 -0
- package/dist/db/schema/events.d.ts +546 -0
- package/dist/db/schema/events.d.ts.map +1 -0
- package/dist/db/schema/faqs.d.ts +137 -0
- package/dist/db/schema/faqs.d.ts.map +1 -0
- package/dist/db/schema/index.d.ts +9 -0
- package/dist/db/schema/index.d.ts.map +1 -0
- package/dist/db/schema/organizations.d.ts +125 -0
- package/dist/db/schema/organizations.d.ts.map +1 -0
- package/dist/db/schema/site-config.d.ts +64 -0
- package/dist/db/schema/site-config.d.ts.map +1 -0
- package/dist/db/schema/themes.d.ts +104 -0
- package/dist/db/schema/themes.d.ts.map +1 -0
- package/dist/{types-lTjxCp88.d.cts → db/schema/users.d.ts} +11 -96
- package/dist/db/schema/users.d.ts.map +1 -0
- package/dist/dist-DZHA5VYX.cjs +260 -0
- package/dist/dist-DZHA5VYX.cjs.map +1 -0
- package/dist/dist-RRQUBLLO.js +258 -0
- package/dist/dist-RRQUBLLO.js.map +1 -0
- package/dist/index.cjs +38065 -937
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +23 -1818
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37940 -816
- package/dist/index.js.map +1 -1
- package/dist/kysely-adapter-C76KJVG7.js +10 -0
- package/dist/kysely-adapter-C76KJVG7.js.map +1 -0
- package/dist/kysely-adapter-TGY4UUP5.cjs +27 -0
- package/dist/kysely-adapter-TGY4UUP5.cjs.map +1 -0
- package/dist/lib/errors.d.ts +15 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/middleware/cors.d.ts +3 -0
- package/dist/lib/middleware/cors.d.ts.map +1 -0
- package/dist/lib/middleware/error-handler.d.ts +3 -0
- package/dist/lib/middleware/error-handler.d.ts.map +1 -0
- package/dist/lib/middleware/pow-challenge.cjs +7 -7
- package/dist/lib/middleware/pow-challenge.d.ts +29 -18
- package/dist/lib/middleware/pow-challenge.d.ts.map +1 -0
- package/dist/lib/middleware/pow-challenge.js +2 -2
- package/dist/lib/middleware/rate-limit.d.ts +48 -0
- package/dist/lib/middleware/rate-limit.d.ts.map +1 -0
- package/dist/lib/middleware/referer-guard.d.ts +18 -0
- package/dist/lib/middleware/referer-guard.d.ts.map +1 -0
- package/dist/lib/retry.d.ts +12 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/node-sqlite-dialect-B3H37T3R.cjs +162 -0
- package/dist/node-sqlite-dialect-B3H37T3R.cjs.map +1 -0
- package/dist/node-sqlite-dialect-GDP7ZE54.js +160 -0
- package/dist/node-sqlite-dialect-GDP7ZE54.js.map +1 -0
- package/dist/queues/handlers.d.ts +13 -0
- package/dist/queues/handlers.d.ts.map +1 -0
- package/dist/queues/jobs.d.ts +42 -0
- package/dist/queues/jobs.d.ts.map +1 -0
- package/dist/routes/events.d.ts +4 -0
- package/dist/routes/events.d.ts.map +1 -0
- package/dist/routes/faqs.d.ts +4 -0
- package/dist/routes/faqs.d.ts.map +1 -0
- package/dist/routes/health.d.ts +4 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/internal/gforms-webhook.d.ts +4 -0
- package/dist/routes/internal/gforms-webhook.d.ts.map +1 -0
- package/dist/routes/organizations.d.ts +4 -0
- package/dist/routes/organizations.d.ts.map +1 -0
- package/dist/routes/site-config.d.ts +4 -0
- package/dist/routes/site-config.d.ts.map +1 -0
- package/dist/routes/themes.d.ts +4 -0
- package/dist/routes/themes.d.ts.map +1 -0
- package/dist/routes/uploads.d.ts +4 -0
- package/dist/routes/uploads.d.ts.map +1 -0
- package/dist/routes/users.d.ts +4 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/services/cache.d.ts +22 -0
- package/dist/services/cache.d.ts.map +1 -0
- package/dist/services/contentful-management.d.ts +38 -0
- package/dist/services/contentful-management.d.ts.map +1 -0
- package/dist/services/contentful.d.ts +97 -0
- package/dist/services/contentful.d.ts.map +1 -0
- package/dist/services/email.d.ts +75 -0
- package/dist/services/email.d.ts.map +1 -0
- package/dist/services/gforms.d.ts +60 -0
- package/dist/services/gforms.d.ts.map +1 -0
- package/dist/services/resend.d.ts +35 -0
- package/dist/services/resend.d.ts.map +1 -0
- package/dist/services/ses.d.ts +58 -0
- package/dist/services/ses.d.ts.map +1 -0
- package/dist/services/slots.d.ts +48 -0
- package/dist/services/slots.d.ts.map +1 -0
- package/dist/services/snapshot.d.ts +95 -0
- package/dist/services/snapshot.d.ts.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/worker-handler.d.ts +64 -0
- package/dist/worker-handler.d.ts.map +1 -0
- package/dist/worker.d.ts +36 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +1172 -583
- package/dist/worker.js.map +1 -1
- package/package.json +153 -152
- package/dist/chunk-3ZWIJNZG.cjs.map +0 -1
- package/dist/chunk-FLR7TNLN.js.map +0 -1
- package/dist/client/types.d.cts +0 -192
- package/dist/index.d.cts +0 -1879
- package/dist/lib/middleware/pow-challenge.d.cts +0 -47
- package/dist/types-lTjxCp88.d.ts +0 -208
package/dist/client/index.cjs
CHANGED
|
@@ -1,11 +1,803 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../chunk-
|
|
4
|
-
var
|
|
3
|
+
var chunkRFP2X2FA_cjs = require('../chunk-RFP2X2FA.cjs');
|
|
4
|
+
var chunkJPVIXCF5_cjs = require('../chunk-JPVIXCF5.cjs');
|
|
5
|
+
require('../chunk-NKIQRCOM.cjs');
|
|
6
|
+
require('../chunk-4DPT2KQR.cjs');
|
|
7
|
+
require('../chunk-EMMSS5I5.cjs');
|
|
5
8
|
|
|
9
|
+
// node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
10
|
+
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
11
|
+
var now = () => Math.floor(Date.now() / 1e3);
|
|
12
|
+
var WindowBroadcastChannel = class {
|
|
13
|
+
listeners = /* @__PURE__ */ new Set();
|
|
14
|
+
name;
|
|
15
|
+
constructor(name = "better-auth.message") {
|
|
16
|
+
this.name = name;
|
|
17
|
+
}
|
|
18
|
+
subscribe(listener) {
|
|
19
|
+
this.listeners.add(listener);
|
|
20
|
+
return () => {
|
|
21
|
+
this.listeners.delete(listener);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
post(message) {
|
|
25
|
+
if (typeof window === "undefined") return;
|
|
26
|
+
try {
|
|
27
|
+
localStorage.setItem(this.name, JSON.stringify({
|
|
28
|
+
...message,
|
|
29
|
+
timestamp: now()
|
|
30
|
+
}));
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
setup() {
|
|
35
|
+
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {
|
|
36
|
+
};
|
|
37
|
+
const handler = (event) => {
|
|
38
|
+
if (event.key !== this.name) return;
|
|
39
|
+
const message = JSON.parse(event.newValue ?? "{}");
|
|
40
|
+
if (message?.event !== "session" || !message?.data) return;
|
|
41
|
+
this.listeners.forEach((listener) => listener(message));
|
|
42
|
+
};
|
|
43
|
+
window.addEventListener("storage", handler);
|
|
44
|
+
return () => {
|
|
45
|
+
window.removeEventListener("storage", handler);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
50
|
+
if (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);
|
|
51
|
+
return globalThis[kBroadcastChannel];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// node_modules/better-auth/dist/client/focus-manager.mjs
|
|
55
|
+
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
56
|
+
var WindowFocusManager = class {
|
|
57
|
+
listeners = /* @__PURE__ */ new Set();
|
|
58
|
+
subscribe(listener) {
|
|
59
|
+
this.listeners.add(listener);
|
|
60
|
+
return () => {
|
|
61
|
+
this.listeners.delete(listener);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
setFocused(focused) {
|
|
65
|
+
this.listeners.forEach((listener) => listener(focused));
|
|
66
|
+
}
|
|
67
|
+
setup() {
|
|
68
|
+
if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener === "undefined") return () => {
|
|
69
|
+
};
|
|
70
|
+
const visibilityHandler = () => {
|
|
71
|
+
if (document.visibilityState === "visible") this.setFocused(true);
|
|
72
|
+
};
|
|
73
|
+
document.addEventListener("visibilitychange", visibilityHandler, false);
|
|
74
|
+
return () => {
|
|
75
|
+
document.removeEventListener("visibilitychange", visibilityHandler, false);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
function getGlobalFocusManager() {
|
|
80
|
+
if (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();
|
|
81
|
+
return globalThis[kFocusManager];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// node_modules/better-auth/dist/client/online-manager.mjs
|
|
85
|
+
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
86
|
+
var WindowOnlineManager = class {
|
|
87
|
+
listeners = /* @__PURE__ */ new Set();
|
|
88
|
+
isOnline = typeof navigator !== "undefined" ? navigator.onLine : true;
|
|
89
|
+
subscribe(listener) {
|
|
90
|
+
this.listeners.add(listener);
|
|
91
|
+
return () => {
|
|
92
|
+
this.listeners.delete(listener);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
setOnline(online) {
|
|
96
|
+
this.isOnline = online;
|
|
97
|
+
this.listeners.forEach((listener) => listener(online));
|
|
98
|
+
}
|
|
99
|
+
setup() {
|
|
100
|
+
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {
|
|
101
|
+
};
|
|
102
|
+
const onOnline = () => this.setOnline(true);
|
|
103
|
+
const onOffline = () => this.setOnline(false);
|
|
104
|
+
window.addEventListener("online", onOnline, false);
|
|
105
|
+
window.addEventListener("offline", onOffline, false);
|
|
106
|
+
return () => {
|
|
107
|
+
window.removeEventListener("online", onOnline, false);
|
|
108
|
+
window.removeEventListener("offline", onOffline, false);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
function getGlobalOnlineManager() {
|
|
113
|
+
if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
|
|
114
|
+
return globalThis[kOnlineManager];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// node_modules/better-auth/dist/client/parser.mjs
|
|
118
|
+
var PROTO_POLLUTION_PATTERNS = {
|
|
119
|
+
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*:/,
|
|
120
|
+
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*:/,
|
|
121
|
+
protoShort: /"__proto__"\s*:/,
|
|
122
|
+
constructorShort: /"constructor"\s*:/
|
|
123
|
+
};
|
|
124
|
+
var JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
125
|
+
var SPECIAL_VALUES = {
|
|
126
|
+
true: true,
|
|
127
|
+
false: false,
|
|
128
|
+
null: null,
|
|
129
|
+
undefined: void 0,
|
|
130
|
+
nan: NaN,
|
|
131
|
+
infinity: Number.POSITIVE_INFINITY,
|
|
132
|
+
"-infinity": Number.NEGATIVE_INFINITY
|
|
133
|
+
};
|
|
134
|
+
var ISO_DATE_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
|
|
135
|
+
function isValidDate(date) {
|
|
136
|
+
return date instanceof Date && !isNaN(date.getTime());
|
|
137
|
+
}
|
|
138
|
+
function parseISODate(value) {
|
|
139
|
+
const match = ISO_DATE_REGEX.exec(value);
|
|
140
|
+
if (!match) return null;
|
|
141
|
+
const [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;
|
|
142
|
+
const 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));
|
|
143
|
+
if (offsetSign) {
|
|
144
|
+
const offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === "+" ? -1 : 1);
|
|
145
|
+
date.setUTCMinutes(date.getUTCMinutes() + offset);
|
|
146
|
+
}
|
|
147
|
+
return isValidDate(date) ? date : null;
|
|
148
|
+
}
|
|
149
|
+
function betterJSONParse(value, options = {}) {
|
|
150
|
+
const { strict = false, warnings = false, reviver, parseDates = true } = options;
|
|
151
|
+
if (typeof value !== "string") return value;
|
|
152
|
+
const trimmed = value.trim();
|
|
153
|
+
if (trimmed.length > 0 && trimmed[0] === '"' && trimmed.endsWith('"') && !trimmed.slice(1, -1).includes('"')) return trimmed.slice(1, -1);
|
|
154
|
+
const lowerValue = trimmed.toLowerCase();
|
|
155
|
+
if (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];
|
|
156
|
+
if (!JSON_SIGNATURE.test(trimmed)) {
|
|
157
|
+
if (strict) throw new SyntaxError("[better-json] Invalid JSON");
|
|
158
|
+
return value;
|
|
159
|
+
}
|
|
160
|
+
if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
|
|
161
|
+
const matches = pattern.test(trimmed);
|
|
162
|
+
if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
|
|
163
|
+
return matches;
|
|
164
|
+
}) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
165
|
+
try {
|
|
166
|
+
const secureReviver = (key, value2) => {
|
|
167
|
+
if (key === "__proto__" || key === "constructor" && value2 && typeof value2 === "object" && "prototype" in value2) {
|
|
168
|
+
if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (parseDates && typeof value2 === "string") {
|
|
172
|
+
const date = parseISODate(value2);
|
|
173
|
+
if (date) return date;
|
|
174
|
+
}
|
|
175
|
+
return reviver ? reviver(key, value2) : value2;
|
|
176
|
+
};
|
|
177
|
+
return JSON.parse(trimmed, secureReviver);
|
|
178
|
+
} catch (error) {
|
|
179
|
+
if (strict) throw error;
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function parseJSON(value, options = { strict: true }) {
|
|
184
|
+
return betterJSONParse(value, options);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// node_modules/nanostores/clean-stores/index.js
|
|
188
|
+
var clean = Symbol("clean");
|
|
189
|
+
|
|
190
|
+
// node_modules/nanostores/atom/index.js
|
|
191
|
+
var listenerQueue = [];
|
|
192
|
+
var lqIndex = 0;
|
|
193
|
+
var QUEUE_ITEMS_PER_LISTENER = 4;
|
|
194
|
+
var nanostoresGlobal = globalThis.nanostoresGlobal ||= { epoch: 0 };
|
|
195
|
+
var atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
|
|
196
|
+
let listeners = [];
|
|
197
|
+
let $atom = {
|
|
198
|
+
get() {
|
|
199
|
+
if (!$atom.lc) {
|
|
200
|
+
$atom.listen(() => {
|
|
201
|
+
})();
|
|
202
|
+
}
|
|
203
|
+
return $atom.value;
|
|
204
|
+
},
|
|
205
|
+
init: initialValue,
|
|
206
|
+
lc: 0,
|
|
207
|
+
listen(listener) {
|
|
208
|
+
$atom.lc = listeners.push(listener);
|
|
209
|
+
return () => {
|
|
210
|
+
for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length; ) {
|
|
211
|
+
if (listenerQueue[i] === listener) {
|
|
212
|
+
listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
|
|
213
|
+
} else {
|
|
214
|
+
i += QUEUE_ITEMS_PER_LISTENER;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
let index = listeners.indexOf(listener);
|
|
218
|
+
if (~index) {
|
|
219
|
+
listeners.splice(index, 1);
|
|
220
|
+
if (!--$atom.lc) $atom.off();
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
notify(oldValue, changedKey) {
|
|
225
|
+
nanostoresGlobal.epoch++;
|
|
226
|
+
let runListenerQueue = !listenerQueue.length;
|
|
227
|
+
for (let listener of listeners) {
|
|
228
|
+
listenerQueue.push(listener, $atom.value, oldValue, changedKey);
|
|
229
|
+
}
|
|
230
|
+
if (runListenerQueue) {
|
|
231
|
+
for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) {
|
|
232
|
+
listenerQueue[lqIndex](
|
|
233
|
+
listenerQueue[lqIndex + 1],
|
|
234
|
+
listenerQueue[lqIndex + 2],
|
|
235
|
+
listenerQueue[lqIndex + 3]
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
listenerQueue.length = 0;
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
/* It will be called on last listener unsubscribing.
|
|
242
|
+
We will redefine it in onMount and onStop. */
|
|
243
|
+
off() {
|
|
244
|
+
},
|
|
245
|
+
set(newValue) {
|
|
246
|
+
let oldValue = $atom.value;
|
|
247
|
+
if (oldValue !== newValue) {
|
|
248
|
+
$atom.value = newValue;
|
|
249
|
+
$atom.notify(oldValue);
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
subscribe(listener) {
|
|
253
|
+
let unbind = $atom.listen(listener);
|
|
254
|
+
listener($atom.value);
|
|
255
|
+
return unbind;
|
|
256
|
+
},
|
|
257
|
+
value: initialValue
|
|
258
|
+
};
|
|
259
|
+
{
|
|
260
|
+
$atom[clean] = () => {
|
|
261
|
+
listeners = [];
|
|
262
|
+
$atom.lc = 0;
|
|
263
|
+
$atom.off();
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return $atom;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// node_modules/nanostores/lifecycle/index.js
|
|
270
|
+
var MOUNT = 5;
|
|
271
|
+
var UNMOUNT = 6;
|
|
272
|
+
var REVERT_MUTATION = 10;
|
|
273
|
+
var on = (object, listener, eventKey, mutateStore) => {
|
|
274
|
+
object.events = object.events || {};
|
|
275
|
+
if (!object.events[eventKey + REVERT_MUTATION]) {
|
|
276
|
+
object.events[eventKey + REVERT_MUTATION] = mutateStore((eventProps) => {
|
|
277
|
+
object.events[eventKey].reduceRight((event, l) => (l(event), event), {
|
|
278
|
+
shared: {},
|
|
279
|
+
...eventProps
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
object.events[eventKey] = object.events[eventKey] || [];
|
|
284
|
+
object.events[eventKey].push(listener);
|
|
285
|
+
return () => {
|
|
286
|
+
let currentListeners = object.events[eventKey];
|
|
287
|
+
let index = currentListeners.indexOf(listener);
|
|
288
|
+
currentListeners.splice(index, 1);
|
|
289
|
+
if (!currentListeners.length) {
|
|
290
|
+
delete object.events[eventKey];
|
|
291
|
+
object.events[eventKey + REVERT_MUTATION]();
|
|
292
|
+
delete object.events[eventKey + REVERT_MUTATION];
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
var STORE_UNMOUNT_DELAY = 1e3;
|
|
297
|
+
var onMount = ($store, initialize) => {
|
|
298
|
+
let listener = (payload) => {
|
|
299
|
+
let destroy = initialize(payload);
|
|
300
|
+
if (destroy) $store.events[UNMOUNT].push(destroy);
|
|
301
|
+
};
|
|
302
|
+
return on($store, listener, MOUNT, (runListeners) => {
|
|
303
|
+
let originListen = $store.listen;
|
|
304
|
+
$store.listen = (...args) => {
|
|
305
|
+
if (!$store.lc && !$store.active) {
|
|
306
|
+
$store.active = true;
|
|
307
|
+
runListeners();
|
|
308
|
+
}
|
|
309
|
+
return originListen(...args);
|
|
310
|
+
};
|
|
311
|
+
let originOff = $store.off;
|
|
312
|
+
$store.events[UNMOUNT] = [];
|
|
313
|
+
$store.off = () => {
|
|
314
|
+
originOff();
|
|
315
|
+
setTimeout(() => {
|
|
316
|
+
if ($store.active && !$store.lc) {
|
|
317
|
+
$store.active = false;
|
|
318
|
+
for (let destroy of $store.events[UNMOUNT]) destroy();
|
|
319
|
+
$store.events[UNMOUNT] = [];
|
|
320
|
+
}
|
|
321
|
+
}, STORE_UNMOUNT_DELAY);
|
|
322
|
+
};
|
|
323
|
+
{
|
|
324
|
+
let originClean = $store[clean];
|
|
325
|
+
$store[clean] = () => {
|
|
326
|
+
for (let destroy of $store.events[UNMOUNT]) destroy();
|
|
327
|
+
$store.events[UNMOUNT] = [];
|
|
328
|
+
$store.active = false;
|
|
329
|
+
originClean();
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
return () => {
|
|
333
|
+
$store.listen = originListen;
|
|
334
|
+
$store.off = originOff;
|
|
335
|
+
};
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
// node_modules/better-auth/dist/client/query.mjs
|
|
340
|
+
var isServer = () => typeof window === "undefined";
|
|
341
|
+
var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
342
|
+
const value = atom({
|
|
343
|
+
data: null,
|
|
344
|
+
error: null,
|
|
345
|
+
isPending: true,
|
|
346
|
+
isRefetching: false,
|
|
347
|
+
refetch: (queryParams) => fn(queryParams)
|
|
348
|
+
});
|
|
349
|
+
const fn = async (queryParams) => {
|
|
350
|
+
return new Promise((resolve) => {
|
|
351
|
+
const opts = typeof options === "function" ? options({
|
|
352
|
+
data: value.get().data,
|
|
353
|
+
error: value.get().error,
|
|
354
|
+
isPending: value.get().isPending
|
|
355
|
+
}) : options;
|
|
356
|
+
$fetch(path, {
|
|
357
|
+
...opts,
|
|
358
|
+
query: {
|
|
359
|
+
...opts?.query,
|
|
360
|
+
...queryParams?.query
|
|
361
|
+
},
|
|
362
|
+
async onSuccess(context) {
|
|
363
|
+
value.set({
|
|
364
|
+
data: context.data,
|
|
365
|
+
error: null,
|
|
366
|
+
isPending: false,
|
|
367
|
+
isRefetching: false,
|
|
368
|
+
refetch: value.value.refetch
|
|
369
|
+
});
|
|
370
|
+
await opts?.onSuccess?.(context);
|
|
371
|
+
},
|
|
372
|
+
async onError(context) {
|
|
373
|
+
const { request } = context;
|
|
374
|
+
const retryAttempts = typeof request.retry === "number" ? request.retry : request.retry?.attempts;
|
|
375
|
+
const retryAttempt = request.retryAttempt || 0;
|
|
376
|
+
if (retryAttempts && retryAttempt < retryAttempts) return;
|
|
377
|
+
const isUnauthorized = context.error.status === 401;
|
|
378
|
+
value.set({
|
|
379
|
+
error: context.error,
|
|
380
|
+
data: isUnauthorized ? null : value.get().data,
|
|
381
|
+
isPending: false,
|
|
382
|
+
isRefetching: false,
|
|
383
|
+
refetch: value.value.refetch
|
|
384
|
+
});
|
|
385
|
+
await opts?.onError?.(context);
|
|
386
|
+
},
|
|
387
|
+
async onRequest(context) {
|
|
388
|
+
const currentValue = value.get();
|
|
389
|
+
value.set({
|
|
390
|
+
isPending: currentValue.data === null,
|
|
391
|
+
data: currentValue.data,
|
|
392
|
+
error: null,
|
|
393
|
+
isRefetching: true,
|
|
394
|
+
refetch: value.value.refetch
|
|
395
|
+
});
|
|
396
|
+
await opts?.onRequest?.(context);
|
|
397
|
+
}
|
|
398
|
+
}).catch((error) => {
|
|
399
|
+
value.set({
|
|
400
|
+
error,
|
|
401
|
+
data: value.get().data,
|
|
402
|
+
isPending: false,
|
|
403
|
+
isRefetching: false,
|
|
404
|
+
refetch: value.value.refetch
|
|
405
|
+
});
|
|
406
|
+
}).finally(() => {
|
|
407
|
+
resolve(void 0);
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
initializedAtom = Array.isArray(initializedAtom) ? initializedAtom : [initializedAtom];
|
|
412
|
+
let isInitialized = false;
|
|
413
|
+
for (const initAtom of initializedAtom) initAtom.subscribe(async () => {
|
|
414
|
+
if (isServer()) return;
|
|
415
|
+
if (isInitialized) await fn();
|
|
416
|
+
else onMount(value, () => {
|
|
417
|
+
const timeoutId = setTimeout(async () => {
|
|
418
|
+
if (!isInitialized) {
|
|
419
|
+
isInitialized = true;
|
|
420
|
+
await fn();
|
|
421
|
+
}
|
|
422
|
+
}, 0);
|
|
423
|
+
return () => {
|
|
424
|
+
value.off();
|
|
425
|
+
initAtom.off();
|
|
426
|
+
clearTimeout(timeoutId);
|
|
427
|
+
};
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
return value;
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// node_modules/better-auth/dist/client/session-refresh.mjs
|
|
434
|
+
var now2 = () => Math.floor(Date.now() / 1e3);
|
|
435
|
+
function normalizeSessionResponse(res) {
|
|
436
|
+
if (typeof res === "object" && res !== null && "data" in res && "error" in res) return res;
|
|
437
|
+
return {
|
|
438
|
+
data: res,
|
|
439
|
+
error: null
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
|
|
443
|
+
function createSessionRefreshManager(opts) {
|
|
444
|
+
const { sessionAtom, sessionSignal, $fetch, options = {} } = opts;
|
|
445
|
+
const refetchInterval = options.sessionOptions?.refetchInterval ?? 0;
|
|
446
|
+
const refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;
|
|
447
|
+
const refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;
|
|
448
|
+
const state = {
|
|
449
|
+
lastSync: 0,
|
|
450
|
+
lastSessionRequest: 0,
|
|
451
|
+
cachedSession: void 0
|
|
452
|
+
};
|
|
453
|
+
const shouldRefetch = () => {
|
|
454
|
+
return refetchWhenOffline || getGlobalOnlineManager().isOnline;
|
|
455
|
+
};
|
|
456
|
+
const triggerRefetch = (event) => {
|
|
457
|
+
if (!shouldRefetch()) return;
|
|
458
|
+
if (event?.event === "storage") {
|
|
459
|
+
state.lastSync = now2();
|
|
460
|
+
sessionSignal.set(!sessionSignal.get());
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const currentSession = sessionAtom.get();
|
|
464
|
+
const fetchSessionWithRefresh = () => {
|
|
465
|
+
state.lastSessionRequest = now2();
|
|
466
|
+
$fetch("/get-session").then(async (res) => {
|
|
467
|
+
let { data, error } = normalizeSessionResponse(res);
|
|
468
|
+
if (data?.needsRefresh) try {
|
|
469
|
+
const refreshRes = await $fetch("/get-session", { method: "POST" });
|
|
470
|
+
({ data, error } = normalizeSessionResponse(refreshRes));
|
|
471
|
+
} catch {
|
|
472
|
+
}
|
|
473
|
+
const sessionData = data?.session && data?.user ? data : null;
|
|
474
|
+
sessionAtom.set({
|
|
475
|
+
...currentSession,
|
|
476
|
+
data: sessionData,
|
|
477
|
+
error
|
|
478
|
+
});
|
|
479
|
+
state.lastSync = now2();
|
|
480
|
+
sessionSignal.set(!sessionSignal.get());
|
|
481
|
+
}).catch(() => {
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
if (event?.event === "poll") {
|
|
485
|
+
fetchSessionWithRefresh();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (event?.event === "visibilitychange") {
|
|
489
|
+
if (now2() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;
|
|
490
|
+
state.lastSessionRequest = now2();
|
|
491
|
+
}
|
|
492
|
+
if (event?.event === "visibilitychange") {
|
|
493
|
+
fetchSessionWithRefresh();
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
if (currentSession?.data === null || currentSession?.data === void 0) {
|
|
497
|
+
state.lastSync = now2();
|
|
498
|
+
sessionSignal.set(!sessionSignal.get());
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
const broadcastSessionUpdate = (trigger) => {
|
|
502
|
+
getGlobalBroadcastChannel().post({
|
|
503
|
+
event: "session",
|
|
504
|
+
data: { trigger },
|
|
505
|
+
clientId: Math.random().toString(36).substring(7)
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
const setupPolling = () => {
|
|
509
|
+
if (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {
|
|
510
|
+
if (sessionAtom.get()?.data) triggerRefetch({ event: "poll" });
|
|
511
|
+
}, refetchInterval * 1e3);
|
|
512
|
+
};
|
|
513
|
+
const setupBroadcast = () => {
|
|
514
|
+
state.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {
|
|
515
|
+
triggerRefetch({ event: "storage" });
|
|
516
|
+
});
|
|
517
|
+
};
|
|
518
|
+
const setupFocusRefetch = () => {
|
|
519
|
+
if (!refetchOnWindowFocus) return;
|
|
520
|
+
state.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {
|
|
521
|
+
triggerRefetch({ event: "visibilitychange" });
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
const setupOnlineRefetch = () => {
|
|
525
|
+
state.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {
|
|
526
|
+
if (online) triggerRefetch({ event: "visibilitychange" });
|
|
527
|
+
});
|
|
528
|
+
};
|
|
529
|
+
const init = () => {
|
|
530
|
+
setupPolling();
|
|
531
|
+
setupBroadcast();
|
|
532
|
+
setupFocusRefetch();
|
|
533
|
+
setupOnlineRefetch();
|
|
534
|
+
getGlobalBroadcastChannel().setup();
|
|
535
|
+
getGlobalFocusManager().setup();
|
|
536
|
+
getGlobalOnlineManager().setup();
|
|
537
|
+
};
|
|
538
|
+
const cleanup = () => {
|
|
539
|
+
if (state.pollInterval) {
|
|
540
|
+
clearInterval(state.pollInterval);
|
|
541
|
+
state.pollInterval = void 0;
|
|
542
|
+
}
|
|
543
|
+
if (state.unsubscribeBroadcast) {
|
|
544
|
+
state.unsubscribeBroadcast();
|
|
545
|
+
state.unsubscribeBroadcast = void 0;
|
|
546
|
+
}
|
|
547
|
+
if (state.unsubscribeFocus) {
|
|
548
|
+
state.unsubscribeFocus();
|
|
549
|
+
state.unsubscribeFocus = void 0;
|
|
550
|
+
}
|
|
551
|
+
if (state.unsubscribeOnline) {
|
|
552
|
+
state.unsubscribeOnline();
|
|
553
|
+
state.unsubscribeOnline = void 0;
|
|
554
|
+
}
|
|
555
|
+
state.lastSync = 0;
|
|
556
|
+
state.lastSessionRequest = 0;
|
|
557
|
+
state.cachedSession = void 0;
|
|
558
|
+
};
|
|
559
|
+
return {
|
|
560
|
+
init,
|
|
561
|
+
cleanup,
|
|
562
|
+
triggerRefetch,
|
|
563
|
+
broadcastSessionUpdate
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
568
|
+
var redirectPlugin = {
|
|
569
|
+
id: "redirect",
|
|
570
|
+
name: "Redirect",
|
|
571
|
+
hooks: { onSuccess(context) {
|
|
572
|
+
if (context.data?.url && context.data?.redirect) {
|
|
573
|
+
if (typeof window !== "undefined" && window.location) {
|
|
574
|
+
if (window.location) try {
|
|
575
|
+
window.location.href = context.data.url;
|
|
576
|
+
} catch {
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
} }
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
// node_modules/better-auth/dist/client/session-atom.mjs
|
|
584
|
+
function getSessionAtom($fetch, options) {
|
|
585
|
+
const $signal = atom(false);
|
|
586
|
+
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
587
|
+
let broadcastSessionUpdate = () => {
|
|
588
|
+
};
|
|
589
|
+
onMount(session, () => {
|
|
590
|
+
const refreshManager = createSessionRefreshManager({
|
|
591
|
+
sessionAtom: session,
|
|
592
|
+
sessionSignal: $signal,
|
|
593
|
+
$fetch,
|
|
594
|
+
options
|
|
595
|
+
});
|
|
596
|
+
refreshManager.init();
|
|
597
|
+
broadcastSessionUpdate = refreshManager.broadcastSessionUpdate;
|
|
598
|
+
return () => {
|
|
599
|
+
refreshManager.cleanup();
|
|
600
|
+
};
|
|
601
|
+
});
|
|
602
|
+
return {
|
|
603
|
+
session,
|
|
604
|
+
$sessionSignal: $signal,
|
|
605
|
+
broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// node_modules/better-auth/dist/client/config.mjs
|
|
610
|
+
var resolvePublicAuthUrl = (basePath) => {
|
|
611
|
+
if (typeof process === "undefined") return void 0;
|
|
612
|
+
const path = basePath ?? "/api/auth";
|
|
613
|
+
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
614
|
+
if (typeof window === "undefined") {
|
|
615
|
+
if (process.env.NEXTAUTH_URL) try {
|
|
616
|
+
return process.env.NEXTAUTH_URL;
|
|
617
|
+
} catch {
|
|
618
|
+
}
|
|
619
|
+
if (process.env.VERCEL_URL) try {
|
|
620
|
+
const protocol = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
|
|
621
|
+
return `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;
|
|
622
|
+
} catch {
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
var getClientConfig = (options, loadEnv) => {
|
|
627
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
628
|
+
const baseURL = chunkRFP2X2FA_cjs.getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
|
|
629
|
+
const pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];
|
|
630
|
+
const lifeCyclePlugin = {
|
|
631
|
+
id: "lifecycle-hooks",
|
|
632
|
+
name: "lifecycle-hooks",
|
|
633
|
+
hooks: {
|
|
634
|
+
onSuccess: options?.fetchOptions?.onSuccess,
|
|
635
|
+
onError: options?.fetchOptions?.onError,
|
|
636
|
+
onRequest: options?.fetchOptions?.onRequest,
|
|
637
|
+
onResponse: options?.fetchOptions?.onResponse
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
const { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};
|
|
641
|
+
const $fetch = chunkRFP2X2FA_cjs.createFetch({
|
|
642
|
+
baseURL,
|
|
643
|
+
...isCredentialsSupported ? { credentials: "include" } : {},
|
|
644
|
+
method: "GET",
|
|
645
|
+
jsonParser(text) {
|
|
646
|
+
if (!text) return null;
|
|
647
|
+
return parseJSON(text, { strict: false });
|
|
648
|
+
},
|
|
649
|
+
customFetchImpl: fetch,
|
|
650
|
+
...restOfFetchOptions,
|
|
651
|
+
plugins: [
|
|
652
|
+
lifeCyclePlugin,
|
|
653
|
+
...restOfFetchOptions.plugins || [],
|
|
654
|
+
...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
|
|
655
|
+
...pluginsFetchPlugins
|
|
656
|
+
]
|
|
657
|
+
});
|
|
658
|
+
const { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);
|
|
659
|
+
const plugins = options?.plugins || [];
|
|
660
|
+
let pluginsActions = {};
|
|
661
|
+
const pluginsAtoms = {
|
|
662
|
+
$sessionSignal,
|
|
663
|
+
session
|
|
664
|
+
};
|
|
665
|
+
const pluginPathMethods = {
|
|
666
|
+
"/sign-out": "POST",
|
|
667
|
+
"/revoke-sessions": "POST",
|
|
668
|
+
"/revoke-other-sessions": "POST",
|
|
669
|
+
"/delete-user": "POST"
|
|
670
|
+
};
|
|
671
|
+
const atomListeners = [{
|
|
672
|
+
signal: "$sessionSignal",
|
|
673
|
+
matcher(path) {
|
|
674
|
+
return path === "/sign-out" || path === "/update-user" || path === "/update-session" || path === "/sign-up/email" || path === "/sign-in/email" || path === "/delete-user" || path === "/verify-email" || path === "/revoke-sessions" || path === "/revoke-session" || path === "/revoke-other-sessions" || path === "/change-email" || path === "/change-password";
|
|
675
|
+
},
|
|
676
|
+
callback(path) {
|
|
677
|
+
if (path === "/sign-out") broadcastSessionUpdate("signout");
|
|
678
|
+
else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
|
|
679
|
+
}
|
|
680
|
+
}];
|
|
681
|
+
for (const plugin of plugins) {
|
|
682
|
+
if (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));
|
|
683
|
+
if (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);
|
|
684
|
+
if (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);
|
|
685
|
+
}
|
|
686
|
+
const $store = {
|
|
687
|
+
notify: (signal) => {
|
|
688
|
+
pluginsAtoms[signal].set(!pluginsAtoms[signal].get());
|
|
689
|
+
},
|
|
690
|
+
listen: (signal, listener) => {
|
|
691
|
+
pluginsAtoms[signal].subscribe(listener);
|
|
692
|
+
},
|
|
693
|
+
atoms: pluginsAtoms
|
|
694
|
+
};
|
|
695
|
+
for (const plugin of plugins) if (plugin.getActions) pluginsActions = chunkRFP2X2FA_cjs.defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
|
|
696
|
+
return {
|
|
697
|
+
get baseURL() {
|
|
698
|
+
return baseURL;
|
|
699
|
+
},
|
|
700
|
+
pluginsActions,
|
|
701
|
+
pluginsAtoms,
|
|
702
|
+
pluginPathMethods,
|
|
703
|
+
atomListeners,
|
|
704
|
+
$fetch,
|
|
705
|
+
$store
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
// node_modules/better-auth/dist/utils/is-atom.mjs
|
|
710
|
+
function isAtom(value) {
|
|
711
|
+
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// node_modules/better-auth/dist/client/proxy.mjs
|
|
715
|
+
function getMethod(path, knownPathMethods, args) {
|
|
716
|
+
const method = knownPathMethods[path];
|
|
717
|
+
const { fetchOptions, query: _query, ...body } = args || {};
|
|
718
|
+
if (method) return method;
|
|
719
|
+
if (fetchOptions?.method) return fetchOptions.method;
|
|
720
|
+
if (body && Object.keys(body).length > 0) return "POST";
|
|
721
|
+
return "GET";
|
|
722
|
+
}
|
|
723
|
+
function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
|
|
724
|
+
function createProxy(path = []) {
|
|
725
|
+
return new Proxy(function() {
|
|
726
|
+
}, {
|
|
727
|
+
get(_, prop) {
|
|
728
|
+
if (typeof prop !== "string") return;
|
|
729
|
+
if (prop === "then" || prop === "catch" || prop === "finally") return;
|
|
730
|
+
const fullPath = [...path, prop];
|
|
731
|
+
let current = routes;
|
|
732
|
+
for (const segment of fullPath) if (current && typeof current === "object" && segment in current) current = current[segment];
|
|
733
|
+
else {
|
|
734
|
+
current = void 0;
|
|
735
|
+
break;
|
|
736
|
+
}
|
|
737
|
+
if (typeof current === "function") return current;
|
|
738
|
+
if (isAtom(current)) return current;
|
|
739
|
+
return createProxy(fullPath);
|
|
740
|
+
},
|
|
741
|
+
apply: async (_, __, args) => {
|
|
742
|
+
const routePath = "/" + path.map((segment) => segment.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)).join("/");
|
|
743
|
+
const arg = args[0] || {};
|
|
744
|
+
const fetchOptions = args[1] || {};
|
|
745
|
+
const { query, fetchOptions: argFetchOptions, ...body } = arg;
|
|
746
|
+
const options = {
|
|
747
|
+
...fetchOptions,
|
|
748
|
+
...argFetchOptions
|
|
749
|
+
};
|
|
750
|
+
const method = getMethod(routePath, knownPathMethods, arg);
|
|
751
|
+
return await client(routePath, {
|
|
752
|
+
...options,
|
|
753
|
+
body: method === "GET" ? void 0 : {
|
|
754
|
+
...body,
|
|
755
|
+
...options?.body || {}
|
|
756
|
+
},
|
|
757
|
+
query: query || options?.query,
|
|
758
|
+
method,
|
|
759
|
+
async onSuccess(context) {
|
|
760
|
+
await options?.onSuccess?.(context);
|
|
761
|
+
if (!atomListeners || options.disableSignal) return;
|
|
762
|
+
const matches = atomListeners.filter((s) => s.matcher(routePath));
|
|
763
|
+
if (!matches.length) return;
|
|
764
|
+
const visited = /* @__PURE__ */ new Set();
|
|
765
|
+
for (const match of matches) {
|
|
766
|
+
const signal = atoms[match.signal];
|
|
767
|
+
if (!signal) return;
|
|
768
|
+
if (visited.has(match.signal)) continue;
|
|
769
|
+
visited.add(match.signal);
|
|
770
|
+
const val = signal.get();
|
|
771
|
+
setTimeout(() => {
|
|
772
|
+
signal.set(!val);
|
|
773
|
+
}, 10);
|
|
774
|
+
match.callback?.(routePath);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
return createProxy();
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// node_modules/better-auth/dist/client/vanilla.mjs
|
|
785
|
+
function createAuthClient(options) {
|
|
786
|
+
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
787
|
+
const resolvedHooks = {};
|
|
788
|
+
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[`use${chunkJPVIXCF5_cjs.capitalizeFirstLetter(key)}`] = value;
|
|
789
|
+
return createDynamicPathProxy({
|
|
790
|
+
...pluginsActions,
|
|
791
|
+
...resolvedHooks,
|
|
792
|
+
$fetch,
|
|
793
|
+
$store
|
|
794
|
+
}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// src/client/auth.ts
|
|
6
798
|
var AUTH_TOKEN_KEY = "better-auth.session_token";
|
|
7
799
|
function createLeapifyAuthClient(baseUrl) {
|
|
8
|
-
return
|
|
800
|
+
return createAuthClient({
|
|
9
801
|
baseURL: baseUrl,
|
|
10
802
|
fetchOptions: {
|
|
11
803
|
auth: {
|
|
@@ -57,7 +849,7 @@ async function solvePowChallenge(baseUrl) {
|
|
|
57
849
|
const base = baseUrl?.replace(/\/$/, "") ?? "";
|
|
58
850
|
let html;
|
|
59
851
|
try {
|
|
60
|
-
const res = await fetch(`${base}/events`, { credentials: "include" });
|
|
852
|
+
const res = await fetch(`${base}/api/events`, { credentials: "include" });
|
|
61
853
|
const ct = res.headers.get("content-type") || "";
|
|
62
854
|
if (!ct.includes("text/html")) {
|
|
63
855
|
return false;
|
|
@@ -98,7 +890,7 @@ async function initializeSession(baseUrl, getToken) {
|
|
|
98
890
|
const token = await getToken();
|
|
99
891
|
if (!token) return null;
|
|
100
892
|
const base = baseUrl.replace(/\/$/, "");
|
|
101
|
-
const res = await fetch(`${base}/users/me`, {
|
|
893
|
+
const res = await fetch(`${base}/api/users/me`, {
|
|
102
894
|
headers: { Authorization: `Bearer ${token}` }
|
|
103
895
|
});
|
|
104
896
|
if (!res.ok) return null;
|
|
@@ -107,7 +899,7 @@ async function initializeSession(baseUrl, getToken) {
|
|
|
107
899
|
}
|
|
108
900
|
|
|
109
901
|
// src/client/index.ts
|
|
110
|
-
function
|
|
902
|
+
function getClientConfig2() {
|
|
111
903
|
if (typeof window === "undefined") return null;
|
|
112
904
|
const config = window.__CONFIG__;
|
|
113
905
|
if (!config || typeof config !== "object") return null;
|
|
@@ -207,163 +999,232 @@ function createLeapifyClient(baseUrl, getToken) {
|
|
|
207
999
|
* Use `now` (server unix epoch) for timestamp comparisons.
|
|
208
1000
|
*/
|
|
209
1001
|
getConfig() {
|
|
210
|
-
return get("/config");
|
|
1002
|
+
return get("/api/config");
|
|
211
1003
|
},
|
|
212
1004
|
/**
|
|
213
|
-
* PATCH /config/:key — admin only.
|
|
1005
|
+
* PATCH /api/config/:key — admin only.
|
|
214
1006
|
* Upserts a site config value. Requires admin or super_admin role.
|
|
215
1007
|
*/
|
|
216
1008
|
updateConfig(key, value) {
|
|
217
|
-
return patch(`/config/${encodeURIComponent(key)}`, { value });
|
|
1009
|
+
return patch(`/api/config/${encodeURIComponent(key)}`, { value });
|
|
218
1010
|
},
|
|
219
1011
|
// ── Events ─────────────────────────────────────────────────────────────
|
|
220
1012
|
/**
|
|
221
|
-
* GET /events
|
|
1013
|
+
* GET /api/events
|
|
222
1014
|
* Returns all published events. Response is ETag-cached for 7 days.
|
|
223
1015
|
*/
|
|
224
1016
|
getEvents() {
|
|
225
|
-
return get("/events");
|
|
1017
|
+
return get("/api/events");
|
|
1018
|
+
},
|
|
1019
|
+
/**
|
|
1020
|
+
* GET /api/events/admin — admin only.
|
|
1021
|
+
* Returns all events regardless of status.
|
|
1022
|
+
*/
|
|
1023
|
+
getAdminEvents() {
|
|
1024
|
+
return get("/api/events/admin");
|
|
226
1025
|
},
|
|
227
1026
|
/**
|
|
228
|
-
*
|
|
1027
|
+
* POST /api/events/admin/publish — admin only.
|
|
1028
|
+
* Batch publish queued events immediately or schedule them for later.
|
|
1029
|
+
*/
|
|
1030
|
+
batchPublish(ids, releaseAt) {
|
|
1031
|
+
return post("/api/events/admin/publish", { ids, releaseAt });
|
|
1032
|
+
},
|
|
1033
|
+
/**
|
|
1034
|
+
* GET /api/events/:slug
|
|
229
1035
|
* Returns a single published event by slug.
|
|
230
1036
|
*/
|
|
231
1037
|
getEvent(slug) {
|
|
232
|
-
return get(`/events/${encodeURIComponent(slug)}`);
|
|
1038
|
+
return get(`/api/events/${encodeURIComponent(slug)}`);
|
|
233
1039
|
},
|
|
234
1040
|
/**
|
|
235
|
-
* GET /events/:slug/slots
|
|
1041
|
+
* GET /api/events/:slug/slots
|
|
236
1042
|
* Returns real-time slot availability. CF edge caches this for 5 seconds.
|
|
237
1043
|
* Poll every 8–10 seconds on event detail pages.
|
|
238
1044
|
*/
|
|
239
1045
|
getSlots(slug) {
|
|
240
|
-
return get(`/events/${encodeURIComponent(slug)}/slots`);
|
|
1046
|
+
return get(`/api/events/${encodeURIComponent(slug)}/slots`);
|
|
241
1047
|
},
|
|
242
1048
|
/**
|
|
243
|
-
* POST /events — admin only.
|
|
1049
|
+
* POST /api/events — admin only.
|
|
244
1050
|
* Creates a new event. Auto-generates slug from title.
|
|
245
1051
|
*/
|
|
246
1052
|
createEvent(data) {
|
|
247
|
-
return post("/events", data);
|
|
1053
|
+
return post("/api/events", data);
|
|
248
1054
|
},
|
|
249
1055
|
/**
|
|
250
|
-
* PATCH /events/:slug — admin only.
|
|
1056
|
+
* PATCH /api/events/:slug — admin only.
|
|
251
1057
|
* Updates an existing event by slug.
|
|
252
1058
|
*/
|
|
253
1059
|
updateEvent(slug, data) {
|
|
254
|
-
return patch(`/events/${encodeURIComponent(slug)}`, data);
|
|
1060
|
+
return patch(`/api/events/${encodeURIComponent(slug)}`, data);
|
|
1061
|
+
},
|
|
1062
|
+
/**
|
|
1063
|
+
* DELETE /api/events/:slug — admin only.
|
|
1064
|
+
* Deletes an event.
|
|
1065
|
+
*/
|
|
1066
|
+
deleteEvent(slug) {
|
|
1067
|
+
return del(`/api/events/${encodeURIComponent(slug)}`);
|
|
255
1068
|
},
|
|
256
1069
|
// ── Themes ─────────────────────────────────────────────────────────────
|
|
257
1070
|
/**
|
|
258
|
-
* GET /themes
|
|
1071
|
+
* GET /api/themes
|
|
259
1072
|
* Returns all themes.
|
|
260
1073
|
*/
|
|
261
1074
|
getThemes() {
|
|
262
|
-
return get("/themes");
|
|
1075
|
+
return get("/api/themes");
|
|
263
1076
|
},
|
|
264
1077
|
/**
|
|
265
|
-
* POST /themes — admin only.
|
|
1078
|
+
* POST /api/themes — admin only.
|
|
266
1079
|
*/
|
|
267
1080
|
createTheme(data) {
|
|
268
|
-
return post("/themes", data);
|
|
1081
|
+
return post("/api/themes", data);
|
|
269
1082
|
},
|
|
270
1083
|
/**
|
|
271
|
-
* PATCH /themes/:id — admin only.
|
|
1084
|
+
* PATCH /api/themes/:id — admin only.
|
|
272
1085
|
*/
|
|
273
1086
|
updateTheme(id, data) {
|
|
274
|
-
return patch(`/themes/${encodeURIComponent(id)}`, data);
|
|
1087
|
+
return patch(`/api/themes/${encodeURIComponent(id)}`, data);
|
|
275
1088
|
},
|
|
276
1089
|
/**
|
|
277
|
-
* DELETE /themes/:id — admin only.
|
|
1090
|
+
* DELETE /api/themes/:id — admin only.
|
|
278
1091
|
*/
|
|
279
1092
|
deleteTheme(id) {
|
|
280
|
-
return del(`/themes/${encodeURIComponent(id)}`);
|
|
1093
|
+
return del(`/api/themes/${encodeURIComponent(id)}`);
|
|
1094
|
+
},
|
|
1095
|
+
// ── Organizations ──────────────────────────────────────────────────────
|
|
1096
|
+
/**
|
|
1097
|
+
* GET /api/organizations
|
|
1098
|
+
* Returns all organizations.
|
|
1099
|
+
*/
|
|
1100
|
+
getOrganizations() {
|
|
1101
|
+
return get("/api/organizations");
|
|
1102
|
+
},
|
|
1103
|
+
/**
|
|
1104
|
+
* POST /api/organizations — admin only.
|
|
1105
|
+
*/
|
|
1106
|
+
createOrganization(data) {
|
|
1107
|
+
return post("/api/organizations", data);
|
|
1108
|
+
},
|
|
1109
|
+
/**
|
|
1110
|
+
* PATCH /api/organizations/:id — admin only.
|
|
1111
|
+
*/
|
|
1112
|
+
updateOrganization(id, data) {
|
|
1113
|
+
return patch(`/api/organizations/${encodeURIComponent(id)}`, data);
|
|
1114
|
+
},
|
|
1115
|
+
/**
|
|
1116
|
+
* DELETE /api/organizations/:id — admin only.
|
|
1117
|
+
*/
|
|
1118
|
+
deleteOrganization(id) {
|
|
1119
|
+
return del(`/api/organizations/${encodeURIComponent(id)}`);
|
|
281
1120
|
},
|
|
282
1121
|
// ── Users ──────────────────────────────────────────────────────────────
|
|
283
1122
|
/**
|
|
284
|
-
* GET /users/me
|
|
1123
|
+
* GET /api/users/me
|
|
285
1124
|
* Returns the authenticated user's profile, or null for guests.
|
|
286
1125
|
* Use `profile.role` to gate admin UI.
|
|
287
1126
|
*/
|
|
288
1127
|
getMe() {
|
|
289
|
-
return get("/users/me");
|
|
1128
|
+
return get("/api/users/me");
|
|
1129
|
+
},
|
|
1130
|
+
// ── Admin: User Management ────────────────────────────────────────────
|
|
1131
|
+
/**
|
|
1132
|
+
* GET /api/users — admin only.
|
|
1133
|
+
* Returns all registered users.
|
|
1134
|
+
*/
|
|
1135
|
+
getUsers() {
|
|
1136
|
+
return get("/api/users");
|
|
1137
|
+
},
|
|
1138
|
+
/**
|
|
1139
|
+
* PATCH /api/users/:id/role — admin only.
|
|
1140
|
+
* Changes a user's role.
|
|
1141
|
+
*/
|
|
1142
|
+
updateUserRole(id, role) {
|
|
1143
|
+
return patch(`/api/users/${encodeURIComponent(id)}/role`, { role });
|
|
1144
|
+
},
|
|
1145
|
+
/**
|
|
1146
|
+
* POST /api/users/by-email — admin only.
|
|
1147
|
+
* Finds or creates a user by email and sets their role.
|
|
1148
|
+
*/
|
|
1149
|
+
upsertUserByEmail(email, role) {
|
|
1150
|
+
return post("/api/users/by-email", { email, role });
|
|
290
1151
|
},
|
|
291
1152
|
// ── Bookmarks ──────────────────────────────────────────────────────────
|
|
292
1153
|
/**
|
|
293
|
-
* GET /users/me/bookmarks
|
|
1154
|
+
* GET /api/users/me/bookmarks
|
|
294
1155
|
* Returns the authenticated user's bookmarked events.
|
|
295
1156
|
* Returns an empty array for unauthenticated users.
|
|
296
1157
|
*/
|
|
297
1158
|
getBookmarks() {
|
|
298
|
-
return get("/users/me/bookmarks");
|
|
1159
|
+
return get("/api/users/me/bookmarks");
|
|
299
1160
|
},
|
|
300
1161
|
/**
|
|
301
|
-
* POST /users/me/bookmarks/:eventId
|
|
1162
|
+
* POST /api/users/me/bookmarks/:eventId
|
|
302
1163
|
* Toggles a bookmark on/off. Requires authentication.
|
|
303
1164
|
* Returns `{ bookmarked: true }` (201) on add, `{ bookmarked: false }` (200) on remove.
|
|
304
1165
|
*/
|
|
305
1166
|
toggleBookmark(eventId) {
|
|
306
1167
|
return post(
|
|
307
|
-
`/users/me/bookmarks/${encodeURIComponent(eventId)}`
|
|
1168
|
+
`/api/users/me/bookmarks/${encodeURIComponent(eventId)}`
|
|
308
1169
|
);
|
|
309
1170
|
},
|
|
310
1171
|
/**
|
|
311
|
-
* DELETE /users/me/bookmarks/:eventId
|
|
1172
|
+
* DELETE /api/users/me/bookmarks/:eventId
|
|
312
1173
|
* Removes a bookmark. Requires authentication.
|
|
313
1174
|
*/
|
|
314
1175
|
deleteBookmark(eventId) {
|
|
315
1176
|
return del(
|
|
316
|
-
`/users/me/bookmarks/${encodeURIComponent(eventId)}`
|
|
1177
|
+
`/api/users/me/bookmarks/${encodeURIComponent(eventId)}`
|
|
317
1178
|
);
|
|
318
1179
|
},
|
|
319
1180
|
// ── FAQs ───────────────────────────────────────────────────────────────
|
|
320
1181
|
/**
|
|
321
|
-
* GET /faqs
|
|
1182
|
+
* GET /api/faqs
|
|
322
1183
|
* Returns all active FAQs. Cached in KV for 10 minutes.
|
|
323
1184
|
* The `answer` field is markdown — render with a markdown library.
|
|
324
1185
|
*/
|
|
325
1186
|
getFaqs() {
|
|
326
|
-
return get("/faqs");
|
|
1187
|
+
return get("/api/faqs");
|
|
327
1188
|
},
|
|
328
1189
|
/**
|
|
329
|
-
* POST /faqs — admin only.
|
|
1190
|
+
* POST /api/faqs — admin only.
|
|
330
1191
|
* Creates a new FAQ item.
|
|
331
1192
|
*/
|
|
332
1193
|
createFaq(data) {
|
|
333
|
-
return post("/faqs", data);
|
|
1194
|
+
return post("/api/faqs", data);
|
|
334
1195
|
},
|
|
335
1196
|
/**
|
|
336
|
-
* PATCH /faqs/:id — admin only.
|
|
1197
|
+
* PATCH /api/faqs/:id — admin only.
|
|
337
1198
|
* Updates an existing FAQ item.
|
|
338
1199
|
*/
|
|
339
1200
|
updateFaq(id, data) {
|
|
340
|
-
return patch(`/faqs/${encodeURIComponent(id)}`, data);
|
|
1201
|
+
return patch(`/api/faqs/${encodeURIComponent(id)}`, data);
|
|
341
1202
|
},
|
|
342
1203
|
/**
|
|
343
|
-
* DELETE /faqs/:id — admin only.
|
|
1204
|
+
* DELETE /api/faqs/:id — admin only.
|
|
344
1205
|
* Soft-deletes a FAQ (sets isActive: false).
|
|
345
1206
|
*/
|
|
346
1207
|
deleteFaq(id) {
|
|
347
|
-
return del(`/faqs/${encodeURIComponent(id)}`);
|
|
1208
|
+
return del(`/api/faqs/${encodeURIComponent(id)}`);
|
|
348
1209
|
},
|
|
349
1210
|
// ── Uploads ────────────────────────────────────────────────────────────
|
|
350
1211
|
/**
|
|
351
|
-
* POST /uploads/images — admin only.
|
|
1212
|
+
* POST /api/uploads/images — admin only.
|
|
352
1213
|
* Uploads an image file to R2. Accepts multipart/form-data.
|
|
353
1214
|
* Returns the public URL, storage key, size, and content type.
|
|
354
1215
|
*/
|
|
355
1216
|
uploadImage(file) {
|
|
356
1217
|
const formData = new FormData();
|
|
357
1218
|
formData.append("file", file);
|
|
358
|
-
return postFormData("/uploads/images", formData);
|
|
1219
|
+
return postFormData("/api/uploads/images", formData);
|
|
359
1220
|
},
|
|
360
1221
|
// ── Content Sync ───────────────────────────────────────────────────────
|
|
361
1222
|
/**
|
|
362
|
-
* POST /config/sync-content — admin only.
|
|
1223
|
+
* POST /api/config/sync-content — admin only.
|
|
363
1224
|
* Pushes all D1 content to Contentful. Auto-generates content types if missing.
|
|
364
1225
|
*/
|
|
365
1226
|
syncContent() {
|
|
366
|
-
return post("/config/sync-content");
|
|
1227
|
+
return post("/api/config/sync-content");
|
|
367
1228
|
},
|
|
368
1229
|
// ── Health ─────────────────────────────────────────────────────────────
|
|
369
1230
|
/**
|
|
@@ -380,7 +1241,7 @@ exports.LEAPIFY_ERROR_CODES = LEAPIFY_ERROR_CODES;
|
|
|
380
1241
|
exports.LeapifyApiError = LeapifyApiError;
|
|
381
1242
|
exports.createLeapifyAuthClient = createLeapifyAuthClient;
|
|
382
1243
|
exports.createLeapifyClient = createLeapifyClient;
|
|
383
|
-
exports.getClientConfig =
|
|
1244
|
+
exports.getClientConfig = getClientConfig2;
|
|
384
1245
|
exports.getLeapifyToken = getLeapifyToken;
|
|
385
1246
|
exports.initializeSession = initializeSession;
|
|
386
1247
|
exports.signInWithGoogleRedirect = signInWithGoogleRedirect;
|