docs-i18n 0.10.0 → 0.11.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/admin/app/lib/auth-client.ts +21 -0
- package/admin/app/lib/auth.server.ts +62 -0
- package/admin/app/routeTree.gen.ts +21 -3
- package/admin/app/routes/index.tsx +68 -8
- package/admin/app/routes/login.tsx +207 -0
- package/admin/app/server.ts +23 -0
- package/admin/app/styles.css +146 -0
- package/admin/app/worker.ts +61 -0
- package/admin/dist/client/assets/auth-client-DqJZaFZR.js +3 -0
- package/admin/dist/client/assets/login-CQjkiBAF.js +1 -0
- package/admin/dist/client/assets/main-bc5tcdGg.js +18 -0
- package/admin/dist/client/assets/routes-CTPOG_v1.js +3 -0
- package/admin/dist/client/assets/{styles-DJ6QEJmN.css → styles-zS0BbO7e.css} +1 -1
- package/admin/dist/client/assets/useNavigate-CEOVvMjz.js +1 -0
- package/admin/dist/server/assets/{react-dom-CpO9xk_L.js → __tanstack-start-server-fn-resolver-N1N5mZVv.js} +83 -507
- package/admin/dist/server/assets/_tanstack-start-manifest_v-BgMVPPt2.js +21 -0
- package/admin/dist/server/assets/adapter-DjXlUL1J.js +2253 -0
- package/admin/dist/server/assets/auth-client-CoUpyQIM.js +807 -0
- package/admin/dist/server/assets/auth-dSAIPjBw.js +72 -0
- package/admin/dist/server/assets/auth.server-BLVDnTCZ.js +31352 -0
- package/admin/dist/server/assets/bun-sqlite-dialect-C8OaCWSL-BNNY-FoT.js +154 -0
- package/admin/dist/server/assets/compiled-query-CnFG_BVV.js +6967 -0
- package/admin/dist/server/assets/d1-sqlite-dialect-sYHNqBte-Bjz-cybU.js +115 -0
- package/admin/dist/server/assets/dist-C3-e8E2B.js +215 -0
- package/admin/dist/server/assets/dist-CUzFWZag.js +6039 -0
- package/admin/dist/server/assets/{init-DJr2glb3.js → dist-DBv71kqn.js} +21 -381
- package/admin/dist/server/assets/error-CASJ5tIm.js +457 -0
- package/admin/dist/server/assets/error-codes-BhMTGvV6.js +1153 -0
- package/admin/dist/server/assets/init-CJJUsPDL.js +49 -0
- package/admin/dist/server/assets/job-manager-D9Ab9hgu.js +179 -0
- package/admin/dist/server/assets/{jobs-bQfYqSk7.js → jobs-DrEe9YOj.js} +18 -5
- package/admin/dist/server/assets/kysely-adapter-YC8RFPyc.js +2 -0
- package/admin/dist/server/assets/login-SqzTMYOZ.js +228 -0
- package/admin/dist/server/assets/migrator-ZpVZslbq.js +2926 -0
- package/admin/dist/server/assets/{misc-DOk3t9vs.js → misc-BSoYldBT.js} +22 -9
- package/admin/dist/server/assets/{models-CBb8Owe5.js → models-CoviNHUP.js} +1 -1
- package/admin/dist/server/assets/node-sqlite-dialect-BJIaP6lL.js +154 -0
- package/admin/dist/server/assets/{router-DlU_fGDK.js → router-Cxm33tn3.js} +23 -11
- package/admin/dist/server/assets/{routes-pIM0fgUO.js → routes-CxGhew8Z.js} +56 -22
- package/admin/dist/server/assets/{routes-BcfX6iub.js → routes-DtWFPDUc.js} +43 -29
- package/admin/dist/server/assets/sqlite-adapter-CL2EidjD.js +69 -0
- package/admin/dist/server/assets/{start-BS52hm79.js → start-BiybVoR2.js} +1 -1
- package/admin/dist/server/assets/status-B1AGLvHn.js +162 -0
- package/admin/dist/server/assets/status-D7PU72hm.js +262 -0
- package/admin/dist/server/assets/string-B4XlckmJ.js +6 -0
- package/admin/dist/server/assets/useNavigate-0H08s_Q2.js +29 -0
- package/admin/dist/server/assets/useRouter-BXJvr8to.js +508 -0
- package/admin/dist/server/server.js +70 -90
- package/admin/package.json +6 -1
- package/admin/server/functions/auth.ts +89 -0
- package/admin/server/functions/jobs.ts +30 -2
- package/admin/server/functions/misc.ts +25 -5
- package/admin/server/functions/status.ts +52 -3
- package/admin/server/index.ts +1 -1
- package/admin/server/init.ts +21 -9
- package/admin/server/services/d1-status.ts +282 -0
- package/admin/vite.config.ts +29 -15
- package/admin/wrangler.jsonc +16 -0
- package/package.json +1 -1
- package/template/content/docs-i18n/en/cli.md +9 -5
- package/template/content/docs-i18n/en/deployment.md +85 -68
- package/admin/dist/client/assets/main-CSFhgz4p.js +0 -17
- package/admin/dist/client/assets/routes-C6bCOSX-.js +0 -3
- package/admin/dist/server/assets/_tanstack-start-manifest_v-BE5XHVZ2.js +0 -17
- package/admin/dist/server/assets/redirect-DtfSYi2g.js +0 -51
- package/admin/dist/server/assets/status-CZz8Rs_7.js +0 -81
- /package/admin/dist/server/assets/{createServerRpc-DJq9yo-B.js → createServerRpc-Cyyxq9HQ.js} +0 -0
|
@@ -0,0 +1,807 @@
|
|
|
1
|
+
import { i as __toESM } from "./chunk-CNvmzFzq.js";
|
|
2
|
+
import { l as require_react } from "./useRouter-BXJvr8to.js";
|
|
3
|
+
import { a as adminAc, c as USERNAME_ERROR_CODES, f as defu, i as ADMIN_ERROR_CODES, n as ANONYMOUS_ERROR_CODES, p as getBaseURL, r as hasPermission, s as userAc, t as parseJSON, u as createFetch } from "./error-codes-BhMTGvV6.js";
|
|
4
|
+
import { t as capitalizeFirstLetter } from "./string-B4XlckmJ.js";
|
|
5
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
6
|
+
var redirectPlugin = {
|
|
7
|
+
id: "redirect",
|
|
8
|
+
name: "Redirect",
|
|
9
|
+
hooks: { onSuccess(context) {
|
|
10
|
+
if (context.data?.url && context.data?.redirect) {
|
|
11
|
+
if (typeof window !== "undefined" && window.location) {
|
|
12
|
+
if (window.location) try {
|
|
13
|
+
window.location.href = context.data.url;
|
|
14
|
+
} catch {}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} }
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region ../../node_modules/.bun/nanostores@1.2.0/node_modules/nanostores/atom/index.js
|
|
21
|
+
var listenerQueue = [];
|
|
22
|
+
var lqIndex = 0;
|
|
23
|
+
var QUEUE_ITEMS_PER_LISTENER = 4;
|
|
24
|
+
var epoch = 0;
|
|
25
|
+
var atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
|
|
26
|
+
let listeners = [];
|
|
27
|
+
let $atom = {
|
|
28
|
+
get() {
|
|
29
|
+
if (!$atom.lc) $atom.listen(() => {})();
|
|
30
|
+
return $atom.value;
|
|
31
|
+
},
|
|
32
|
+
init: initialValue,
|
|
33
|
+
lc: 0,
|
|
34
|
+
listen(listener) {
|
|
35
|
+
$atom.lc = listeners.push(listener);
|
|
36
|
+
return () => {
|
|
37
|
+
for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length;) if (listenerQueue[i] === listener) listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
|
|
38
|
+
else i += QUEUE_ITEMS_PER_LISTENER;
|
|
39
|
+
let index = listeners.indexOf(listener);
|
|
40
|
+
if (~index) {
|
|
41
|
+
listeners.splice(index, 1);
|
|
42
|
+
if (!--$atom.lc) $atom.off();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
notify(oldValue, changedKey) {
|
|
47
|
+
epoch++;
|
|
48
|
+
let runListenerQueue = !listenerQueue.length;
|
|
49
|
+
for (let listener of listeners) listenerQueue.push(listener, $atom.value, oldValue, changedKey);
|
|
50
|
+
if (runListenerQueue) {
|
|
51
|
+
for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) listenerQueue[lqIndex](listenerQueue[lqIndex + 1], listenerQueue[lqIndex + 2], listenerQueue[lqIndex + 3]);
|
|
52
|
+
listenerQueue.length = 0;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
off() {},
|
|
56
|
+
set(newValue) {
|
|
57
|
+
let oldValue = $atom.value;
|
|
58
|
+
if (oldValue !== newValue) {
|
|
59
|
+
$atom.value = newValue;
|
|
60
|
+
$atom.notify(oldValue);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
subscribe(listener) {
|
|
64
|
+
let unbind = $atom.listen(listener);
|
|
65
|
+
listener($atom.value);
|
|
66
|
+
return unbind;
|
|
67
|
+
},
|
|
68
|
+
value: initialValue
|
|
69
|
+
};
|
|
70
|
+
return $atom;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../../node_modules/.bun/nanostores@1.2.0/node_modules/nanostores/lifecycle/index.js
|
|
74
|
+
var MOUNT = 5;
|
|
75
|
+
var UNMOUNT = 6;
|
|
76
|
+
var REVERT_MUTATION = 10;
|
|
77
|
+
var on = (object, listener, eventKey, mutateStore) => {
|
|
78
|
+
object.events = object.events || {};
|
|
79
|
+
if (!object.events[eventKey + REVERT_MUTATION]) object.events[eventKey + REVERT_MUTATION] = mutateStore((eventProps) => {
|
|
80
|
+
object.events[eventKey].reduceRight((event, l) => (l(event), event), {
|
|
81
|
+
shared: {},
|
|
82
|
+
...eventProps
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
object.events[eventKey] = object.events[eventKey] || [];
|
|
86
|
+
object.events[eventKey].push(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
let currentListeners = object.events[eventKey];
|
|
89
|
+
let index = currentListeners.indexOf(listener);
|
|
90
|
+
currentListeners.splice(index, 1);
|
|
91
|
+
if (!currentListeners.length) {
|
|
92
|
+
delete object.events[eventKey];
|
|
93
|
+
object.events[eventKey + REVERT_MUTATION]();
|
|
94
|
+
delete object.events[eventKey + REVERT_MUTATION];
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
var STORE_UNMOUNT_DELAY = 1e3;
|
|
99
|
+
var onMount = ($store, initialize) => {
|
|
100
|
+
let listener = (payload) => {
|
|
101
|
+
let destroy = initialize(payload);
|
|
102
|
+
if (destroy) $store.events[UNMOUNT].push(destroy);
|
|
103
|
+
};
|
|
104
|
+
return on($store, listener, MOUNT, (runListeners) => {
|
|
105
|
+
let originListen = $store.listen;
|
|
106
|
+
$store.listen = (...args) => {
|
|
107
|
+
if (!$store.lc && !$store.active) {
|
|
108
|
+
$store.active = true;
|
|
109
|
+
runListeners();
|
|
110
|
+
}
|
|
111
|
+
return originListen(...args);
|
|
112
|
+
};
|
|
113
|
+
let originOff = $store.off;
|
|
114
|
+
$store.events[UNMOUNT] = [];
|
|
115
|
+
$store.off = () => {
|
|
116
|
+
originOff();
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
if ($store.active && !$store.lc) {
|
|
119
|
+
$store.active = false;
|
|
120
|
+
for (let destroy of $store.events[UNMOUNT]) destroy();
|
|
121
|
+
$store.events[UNMOUNT] = [];
|
|
122
|
+
}
|
|
123
|
+
}, STORE_UNMOUNT_DELAY);
|
|
124
|
+
};
|
|
125
|
+
return () => {
|
|
126
|
+
$store.listen = originListen;
|
|
127
|
+
$store.off = originOff;
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region ../../node_modules/.bun/nanostores@1.2.0/node_modules/nanostores/listen-keys/index.js
|
|
133
|
+
function listenKeys($store, keys, listener) {
|
|
134
|
+
let keysSet = new Set(keys).add(void 0);
|
|
135
|
+
return $store.listen((value, oldValue, changed) => {
|
|
136
|
+
if (keysSet.has(changed)) listener(value, oldValue, changed);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/query.mjs
|
|
141
|
+
var isServer = () => typeof window === "undefined";
|
|
142
|
+
var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
143
|
+
const value = /* @__PURE__ */ atom({
|
|
144
|
+
data: null,
|
|
145
|
+
error: null,
|
|
146
|
+
isPending: true,
|
|
147
|
+
isRefetching: false,
|
|
148
|
+
refetch: (queryParams) => fn(queryParams)
|
|
149
|
+
});
|
|
150
|
+
const fn = async (queryParams) => {
|
|
151
|
+
return new Promise((resolve) => {
|
|
152
|
+
const opts = typeof options === "function" ? options({
|
|
153
|
+
data: value.get().data,
|
|
154
|
+
error: value.get().error,
|
|
155
|
+
isPending: value.get().isPending
|
|
156
|
+
}) : options;
|
|
157
|
+
$fetch(path, {
|
|
158
|
+
...opts,
|
|
159
|
+
query: {
|
|
160
|
+
...opts?.query,
|
|
161
|
+
...queryParams?.query
|
|
162
|
+
},
|
|
163
|
+
async onSuccess(context) {
|
|
164
|
+
value.set({
|
|
165
|
+
data: context.data,
|
|
166
|
+
error: null,
|
|
167
|
+
isPending: false,
|
|
168
|
+
isRefetching: false,
|
|
169
|
+
refetch: value.value.refetch
|
|
170
|
+
});
|
|
171
|
+
await opts?.onSuccess?.(context);
|
|
172
|
+
},
|
|
173
|
+
async onError(context) {
|
|
174
|
+
const { request } = context;
|
|
175
|
+
const retryAttempts = typeof request.retry === "number" ? request.retry : request.retry?.attempts;
|
|
176
|
+
const retryAttempt = request.retryAttempt || 0;
|
|
177
|
+
if (retryAttempts && retryAttempt < retryAttempts) return;
|
|
178
|
+
const isUnauthorized = context.error.status === 401;
|
|
179
|
+
value.set({
|
|
180
|
+
error: context.error,
|
|
181
|
+
data: isUnauthorized ? null : value.get().data,
|
|
182
|
+
isPending: false,
|
|
183
|
+
isRefetching: false,
|
|
184
|
+
refetch: value.value.refetch
|
|
185
|
+
});
|
|
186
|
+
await opts?.onError?.(context);
|
|
187
|
+
},
|
|
188
|
+
async onRequest(context) {
|
|
189
|
+
const currentValue = value.get();
|
|
190
|
+
value.set({
|
|
191
|
+
isPending: currentValue.data === null,
|
|
192
|
+
data: currentValue.data,
|
|
193
|
+
error: null,
|
|
194
|
+
isRefetching: true,
|
|
195
|
+
refetch: value.value.refetch
|
|
196
|
+
});
|
|
197
|
+
await opts?.onRequest?.(context);
|
|
198
|
+
}
|
|
199
|
+
}).catch((error) => {
|
|
200
|
+
value.set({
|
|
201
|
+
error,
|
|
202
|
+
data: value.get().data,
|
|
203
|
+
isPending: false,
|
|
204
|
+
isRefetching: false,
|
|
205
|
+
refetch: value.value.refetch
|
|
206
|
+
});
|
|
207
|
+
}).finally(() => {
|
|
208
|
+
resolve(void 0);
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
initializedAtom = Array.isArray(initializedAtom) ? initializedAtom : [initializedAtom];
|
|
213
|
+
let isMounted = false;
|
|
214
|
+
for (const initAtom of initializedAtom) initAtom.subscribe(async () => {
|
|
215
|
+
if (isServer()) return;
|
|
216
|
+
if (isMounted) await fn();
|
|
217
|
+
else onMount(value, () => {
|
|
218
|
+
const timeoutId = setTimeout(async () => {
|
|
219
|
+
if (!isMounted) {
|
|
220
|
+
await fn();
|
|
221
|
+
isMounted = true;
|
|
222
|
+
}
|
|
223
|
+
}, 0);
|
|
224
|
+
return () => {
|
|
225
|
+
value.off();
|
|
226
|
+
initAtom.off();
|
|
227
|
+
clearTimeout(timeoutId);
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
return value;
|
|
232
|
+
};
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
235
|
+
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
236
|
+
var now$1 = () => Math.floor(Date.now() / 1e3);
|
|
237
|
+
var WindowBroadcastChannel = class {
|
|
238
|
+
listeners = /* @__PURE__ */ new Set();
|
|
239
|
+
name;
|
|
240
|
+
constructor(name = "better-auth.message") {
|
|
241
|
+
this.name = name;
|
|
242
|
+
}
|
|
243
|
+
subscribe(listener) {
|
|
244
|
+
this.listeners.add(listener);
|
|
245
|
+
return () => {
|
|
246
|
+
this.listeners.delete(listener);
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
post(message) {
|
|
250
|
+
if (typeof window === "undefined") return;
|
|
251
|
+
try {
|
|
252
|
+
localStorage.setItem(this.name, JSON.stringify({
|
|
253
|
+
...message,
|
|
254
|
+
timestamp: now$1()
|
|
255
|
+
}));
|
|
256
|
+
} catch {}
|
|
257
|
+
}
|
|
258
|
+
setup() {
|
|
259
|
+
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
260
|
+
const handler = (event) => {
|
|
261
|
+
if (event.key !== this.name) return;
|
|
262
|
+
const message = JSON.parse(event.newValue ?? "{}");
|
|
263
|
+
if (message?.event !== "session" || !message?.data) return;
|
|
264
|
+
this.listeners.forEach((listener) => listener(message));
|
|
265
|
+
};
|
|
266
|
+
window.addEventListener("storage", handler);
|
|
267
|
+
return () => {
|
|
268
|
+
window.removeEventListener("storage", handler);
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
273
|
+
if (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);
|
|
274
|
+
return globalThis[kBroadcastChannel];
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
278
|
+
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
279
|
+
var WindowFocusManager = class {
|
|
280
|
+
listeners = /* @__PURE__ */ new Set();
|
|
281
|
+
subscribe(listener) {
|
|
282
|
+
this.listeners.add(listener);
|
|
283
|
+
return () => {
|
|
284
|
+
this.listeners.delete(listener);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
setFocused(focused) {
|
|
288
|
+
this.listeners.forEach((listener) => listener(focused));
|
|
289
|
+
}
|
|
290
|
+
setup() {
|
|
291
|
+
if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
292
|
+
const visibilityHandler = () => {
|
|
293
|
+
if (document.visibilityState === "visible") this.setFocused(true);
|
|
294
|
+
};
|
|
295
|
+
document.addEventListener("visibilitychange", visibilityHandler, false);
|
|
296
|
+
return () => {
|
|
297
|
+
document.removeEventListener("visibilitychange", visibilityHandler, false);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
function getGlobalFocusManager() {
|
|
302
|
+
if (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();
|
|
303
|
+
return globalThis[kFocusManager];
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/online-manager.mjs
|
|
307
|
+
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
308
|
+
var WindowOnlineManager = class {
|
|
309
|
+
listeners = /* @__PURE__ */ new Set();
|
|
310
|
+
isOnline = typeof navigator !== "undefined" ? navigator.onLine : true;
|
|
311
|
+
subscribe(listener) {
|
|
312
|
+
this.listeners.add(listener);
|
|
313
|
+
return () => {
|
|
314
|
+
this.listeners.delete(listener);
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
setOnline(online) {
|
|
318
|
+
this.isOnline = online;
|
|
319
|
+
this.listeners.forEach((listener) => listener(online));
|
|
320
|
+
}
|
|
321
|
+
setup() {
|
|
322
|
+
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
323
|
+
const onOnline = () => this.setOnline(true);
|
|
324
|
+
const onOffline = () => this.setOnline(false);
|
|
325
|
+
window.addEventListener("online", onOnline, false);
|
|
326
|
+
window.addEventListener("offline", onOffline, false);
|
|
327
|
+
return () => {
|
|
328
|
+
window.removeEventListener("online", onOnline, false);
|
|
329
|
+
window.removeEventListener("offline", onOffline, false);
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
function getGlobalOnlineManager() {
|
|
334
|
+
if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
|
|
335
|
+
return globalThis[kOnlineManager];
|
|
336
|
+
}
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
339
|
+
var now = () => Math.floor(Date.now() / 1e3);
|
|
340
|
+
/**
|
|
341
|
+
* Normalize $fetch response: `throw: true` returns data directly, otherwise `{ data, error }`.
|
|
342
|
+
*/
|
|
343
|
+
function normalizeSessionResponse(res) {
|
|
344
|
+
if (typeof res === "object" && res !== null && "data" in res && "error" in res) return res;
|
|
345
|
+
return {
|
|
346
|
+
data: res,
|
|
347
|
+
error: null
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
352
|
+
*/
|
|
353
|
+
var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
|
|
354
|
+
function createSessionRefreshManager(opts) {
|
|
355
|
+
const { sessionAtom, sessionSignal, $fetch, options = {} } = opts;
|
|
356
|
+
const refetchInterval = options.sessionOptions?.refetchInterval ?? 0;
|
|
357
|
+
const refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;
|
|
358
|
+
const refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;
|
|
359
|
+
const state = {
|
|
360
|
+
lastSync: 0,
|
|
361
|
+
lastSessionRequest: 0,
|
|
362
|
+
cachedSession: void 0
|
|
363
|
+
};
|
|
364
|
+
const shouldRefetch = () => {
|
|
365
|
+
return refetchWhenOffline || getGlobalOnlineManager().isOnline;
|
|
366
|
+
};
|
|
367
|
+
const triggerRefetch = (event) => {
|
|
368
|
+
if (!shouldRefetch()) return;
|
|
369
|
+
if (event?.event === "storage") {
|
|
370
|
+
state.lastSync = now();
|
|
371
|
+
sessionSignal.set(!sessionSignal.get());
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const currentSession = sessionAtom.get();
|
|
375
|
+
const fetchSessionWithRefresh = () => {
|
|
376
|
+
state.lastSessionRequest = now();
|
|
377
|
+
$fetch("/get-session").then(async (res) => {
|
|
378
|
+
let { data, error } = normalizeSessionResponse(res);
|
|
379
|
+
if (data?.needsRefresh) try {
|
|
380
|
+
const refreshRes = await $fetch("/get-session", { method: "POST" });
|
|
381
|
+
({data, error} = normalizeSessionResponse(refreshRes));
|
|
382
|
+
} catch {}
|
|
383
|
+
const sessionData = data?.session && data?.user ? data : null;
|
|
384
|
+
sessionAtom.set({
|
|
385
|
+
...currentSession,
|
|
386
|
+
data: sessionData,
|
|
387
|
+
error
|
|
388
|
+
});
|
|
389
|
+
state.lastSync = now();
|
|
390
|
+
sessionSignal.set(!sessionSignal.get());
|
|
391
|
+
}).catch(() => {});
|
|
392
|
+
};
|
|
393
|
+
if (event?.event === "poll") {
|
|
394
|
+
fetchSessionWithRefresh();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (event?.event === "visibilitychange") {
|
|
398
|
+
if (now() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;
|
|
399
|
+
state.lastSessionRequest = now();
|
|
400
|
+
}
|
|
401
|
+
if (event?.event === "visibilitychange") {
|
|
402
|
+
fetchSessionWithRefresh();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (currentSession?.data === null || currentSession?.data === void 0) {
|
|
406
|
+
state.lastSync = now();
|
|
407
|
+
sessionSignal.set(!sessionSignal.get());
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
const broadcastSessionUpdate = (trigger) => {
|
|
411
|
+
getGlobalBroadcastChannel().post({
|
|
412
|
+
event: "session",
|
|
413
|
+
data: { trigger },
|
|
414
|
+
clientId: Math.random().toString(36).substring(7)
|
|
415
|
+
});
|
|
416
|
+
};
|
|
417
|
+
const setupPolling = () => {
|
|
418
|
+
if (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {
|
|
419
|
+
if (sessionAtom.get()?.data) triggerRefetch({ event: "poll" });
|
|
420
|
+
}, refetchInterval * 1e3);
|
|
421
|
+
};
|
|
422
|
+
const setupBroadcast = () => {
|
|
423
|
+
state.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {
|
|
424
|
+
triggerRefetch({ event: "storage" });
|
|
425
|
+
});
|
|
426
|
+
};
|
|
427
|
+
const setupFocusRefetch = () => {
|
|
428
|
+
if (!refetchOnWindowFocus) return;
|
|
429
|
+
state.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {
|
|
430
|
+
triggerRefetch({ event: "visibilitychange" });
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
const setupOnlineRefetch = () => {
|
|
434
|
+
state.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {
|
|
435
|
+
if (online) triggerRefetch({ event: "visibilitychange" });
|
|
436
|
+
});
|
|
437
|
+
};
|
|
438
|
+
const init = () => {
|
|
439
|
+
setupPolling();
|
|
440
|
+
setupBroadcast();
|
|
441
|
+
setupFocusRefetch();
|
|
442
|
+
setupOnlineRefetch();
|
|
443
|
+
getGlobalBroadcastChannel().setup();
|
|
444
|
+
getGlobalFocusManager().setup();
|
|
445
|
+
getGlobalOnlineManager().setup();
|
|
446
|
+
};
|
|
447
|
+
const cleanup = () => {
|
|
448
|
+
if (state.pollInterval) {
|
|
449
|
+
clearInterval(state.pollInterval);
|
|
450
|
+
state.pollInterval = void 0;
|
|
451
|
+
}
|
|
452
|
+
if (state.unsubscribeBroadcast) {
|
|
453
|
+
state.unsubscribeBroadcast();
|
|
454
|
+
state.unsubscribeBroadcast = void 0;
|
|
455
|
+
}
|
|
456
|
+
if (state.unsubscribeFocus) {
|
|
457
|
+
state.unsubscribeFocus();
|
|
458
|
+
state.unsubscribeFocus = void 0;
|
|
459
|
+
}
|
|
460
|
+
if (state.unsubscribeOnline) {
|
|
461
|
+
state.unsubscribeOnline();
|
|
462
|
+
state.unsubscribeOnline = void 0;
|
|
463
|
+
}
|
|
464
|
+
state.lastSync = 0;
|
|
465
|
+
state.lastSessionRequest = 0;
|
|
466
|
+
state.cachedSession = void 0;
|
|
467
|
+
};
|
|
468
|
+
return {
|
|
469
|
+
init,
|
|
470
|
+
cleanup,
|
|
471
|
+
triggerRefetch,
|
|
472
|
+
broadcastSessionUpdate
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/session-atom.mjs
|
|
477
|
+
function getSessionAtom($fetch, options) {
|
|
478
|
+
const $signal = /* @__PURE__ */ atom(false);
|
|
479
|
+
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
480
|
+
let broadcastSessionUpdate = () => {};
|
|
481
|
+
onMount(session, () => {
|
|
482
|
+
const refreshManager = createSessionRefreshManager({
|
|
483
|
+
sessionAtom: session,
|
|
484
|
+
sessionSignal: $signal,
|
|
485
|
+
$fetch,
|
|
486
|
+
options
|
|
487
|
+
});
|
|
488
|
+
refreshManager.init();
|
|
489
|
+
broadcastSessionUpdate = refreshManager.broadcastSessionUpdate;
|
|
490
|
+
return () => {
|
|
491
|
+
refreshManager.cleanup();
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
return {
|
|
495
|
+
session,
|
|
496
|
+
$sessionSignal: $signal,
|
|
497
|
+
broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
//#endregion
|
|
501
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/config.mjs
|
|
502
|
+
var resolvePublicAuthUrl = (basePath) => {
|
|
503
|
+
if (typeof process === "undefined") return void 0;
|
|
504
|
+
const path = basePath ?? "/api/auth";
|
|
505
|
+
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
506
|
+
if (typeof window === "undefined") {
|
|
507
|
+
if (process.env.NEXTAUTH_URL) try {
|
|
508
|
+
return process.env.NEXTAUTH_URL;
|
|
509
|
+
} catch {}
|
|
510
|
+
if (process.env.VERCEL_URL) try {
|
|
511
|
+
const protocol = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
|
|
512
|
+
return `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;
|
|
513
|
+
} catch {}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
var getClientConfig = (options, loadEnv) => {
|
|
517
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
518
|
+
const baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
|
|
519
|
+
const pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];
|
|
520
|
+
const lifeCyclePlugin = {
|
|
521
|
+
id: "lifecycle-hooks",
|
|
522
|
+
name: "lifecycle-hooks",
|
|
523
|
+
hooks: {
|
|
524
|
+
onSuccess: options?.fetchOptions?.onSuccess,
|
|
525
|
+
onError: options?.fetchOptions?.onError,
|
|
526
|
+
onRequest: options?.fetchOptions?.onRequest,
|
|
527
|
+
onResponse: options?.fetchOptions?.onResponse
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
const { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};
|
|
531
|
+
const $fetch = createFetch({
|
|
532
|
+
baseURL,
|
|
533
|
+
...isCredentialsSupported ? { credentials: "include" } : {},
|
|
534
|
+
method: "GET",
|
|
535
|
+
jsonParser(text) {
|
|
536
|
+
if (!text) return null;
|
|
537
|
+
return parseJSON(text, { strict: false });
|
|
538
|
+
},
|
|
539
|
+
customFetchImpl: fetch,
|
|
540
|
+
...restOfFetchOptions,
|
|
541
|
+
plugins: [
|
|
542
|
+
lifeCyclePlugin,
|
|
543
|
+
...restOfFetchOptions.plugins || [],
|
|
544
|
+
...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
|
|
545
|
+
...pluginsFetchPlugins
|
|
546
|
+
]
|
|
547
|
+
});
|
|
548
|
+
const { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);
|
|
549
|
+
const plugins = options?.plugins || [];
|
|
550
|
+
let pluginsActions = {};
|
|
551
|
+
const pluginsAtoms = {
|
|
552
|
+
$sessionSignal,
|
|
553
|
+
session
|
|
554
|
+
};
|
|
555
|
+
const pluginPathMethods = {
|
|
556
|
+
"/sign-out": "POST",
|
|
557
|
+
"/revoke-sessions": "POST",
|
|
558
|
+
"/revoke-other-sessions": "POST",
|
|
559
|
+
"/delete-user": "POST"
|
|
560
|
+
};
|
|
561
|
+
const atomListeners = [{
|
|
562
|
+
signal: "$sessionSignal",
|
|
563
|
+
matcher(path) {
|
|
564
|
+
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 === "/change-email";
|
|
565
|
+
},
|
|
566
|
+
callback(path) {
|
|
567
|
+
if (path === "/sign-out") broadcastSessionUpdate("signout");
|
|
568
|
+
else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
|
|
569
|
+
}
|
|
570
|
+
}];
|
|
571
|
+
for (const plugin of plugins) {
|
|
572
|
+
if (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));
|
|
573
|
+
if (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);
|
|
574
|
+
if (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);
|
|
575
|
+
}
|
|
576
|
+
const $store = {
|
|
577
|
+
notify: (signal) => {
|
|
578
|
+
pluginsAtoms[signal].set(!pluginsAtoms[signal].get());
|
|
579
|
+
},
|
|
580
|
+
listen: (signal, listener) => {
|
|
581
|
+
pluginsAtoms[signal].subscribe(listener);
|
|
582
|
+
},
|
|
583
|
+
atoms: pluginsAtoms
|
|
584
|
+
};
|
|
585
|
+
for (const plugin of plugins) if (plugin.getActions) pluginsActions = defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
|
|
586
|
+
return {
|
|
587
|
+
get baseURL() {
|
|
588
|
+
return baseURL;
|
|
589
|
+
},
|
|
590
|
+
pluginsActions,
|
|
591
|
+
pluginsAtoms,
|
|
592
|
+
pluginPathMethods,
|
|
593
|
+
atomListeners,
|
|
594
|
+
$fetch,
|
|
595
|
+
$store
|
|
596
|
+
};
|
|
597
|
+
};
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
600
|
+
function isAtom(value) {
|
|
601
|
+
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/proxy.mjs
|
|
605
|
+
function getMethod(path, knownPathMethods, args) {
|
|
606
|
+
const method = knownPathMethods[path];
|
|
607
|
+
const { fetchOptions, query: _query, ...body } = args || {};
|
|
608
|
+
if (method) return method;
|
|
609
|
+
if (fetchOptions?.method) return fetchOptions.method;
|
|
610
|
+
if (body && Object.keys(body).length > 0) return "POST";
|
|
611
|
+
return "GET";
|
|
612
|
+
}
|
|
613
|
+
function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
|
|
614
|
+
function createProxy(path = []) {
|
|
615
|
+
return new Proxy(function() {}, {
|
|
616
|
+
get(_, prop) {
|
|
617
|
+
if (typeof prop !== "string") return;
|
|
618
|
+
if (prop === "then" || prop === "catch" || prop === "finally") return;
|
|
619
|
+
const fullPath = [...path, prop];
|
|
620
|
+
let current = routes;
|
|
621
|
+
for (const segment of fullPath) if (current && typeof current === "object" && segment in current) current = current[segment];
|
|
622
|
+
else {
|
|
623
|
+
current = void 0;
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
if (typeof current === "function") return current;
|
|
627
|
+
if (isAtom(current)) return current;
|
|
628
|
+
return createProxy(fullPath);
|
|
629
|
+
},
|
|
630
|
+
apply: async (_, __, args) => {
|
|
631
|
+
const routePath = "/" + path.map((segment) => segment.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)).join("/");
|
|
632
|
+
const arg = args[0] || {};
|
|
633
|
+
const fetchOptions = args[1] || {};
|
|
634
|
+
const { query, fetchOptions: argFetchOptions, ...body } = arg;
|
|
635
|
+
const options = {
|
|
636
|
+
...fetchOptions,
|
|
637
|
+
...argFetchOptions
|
|
638
|
+
};
|
|
639
|
+
const method = getMethod(routePath, knownPathMethods, arg);
|
|
640
|
+
return await client(routePath, {
|
|
641
|
+
...options,
|
|
642
|
+
body: method === "GET" ? void 0 : {
|
|
643
|
+
...body,
|
|
644
|
+
...options?.body || {}
|
|
645
|
+
},
|
|
646
|
+
query: query || options?.query,
|
|
647
|
+
method,
|
|
648
|
+
async onSuccess(context) {
|
|
649
|
+
await options?.onSuccess?.(context);
|
|
650
|
+
if (!atomListeners || options.disableSignal) return;
|
|
651
|
+
/**
|
|
652
|
+
* We trigger listeners
|
|
653
|
+
*/
|
|
654
|
+
const matches = atomListeners.filter((s) => s.matcher(routePath));
|
|
655
|
+
if (!matches.length) return;
|
|
656
|
+
const visited = /* @__PURE__ */ new Set();
|
|
657
|
+
for (const match of matches) {
|
|
658
|
+
const signal = atoms[match.signal];
|
|
659
|
+
if (!signal) return;
|
|
660
|
+
if (visited.has(match.signal)) continue;
|
|
661
|
+
visited.add(match.signal);
|
|
662
|
+
/**
|
|
663
|
+
* To avoid race conditions we set the signal in a setTimeout
|
|
664
|
+
*/
|
|
665
|
+
const val = signal.get();
|
|
666
|
+
setTimeout(() => {
|
|
667
|
+
signal.set(!val);
|
|
668
|
+
}, 10);
|
|
669
|
+
match.callback?.(routePath);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
return createProxy();
|
|
677
|
+
}
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/react/react-store.mjs
|
|
680
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
681
|
+
/**
|
|
682
|
+
* Subscribe to store changes and get store's value.
|
|
683
|
+
*
|
|
684
|
+
* Can be used with store builder too.
|
|
685
|
+
*
|
|
686
|
+
* ```js
|
|
687
|
+
* import { useStore } from 'nanostores/react'
|
|
688
|
+
*
|
|
689
|
+
* import { router } from '../store/router'
|
|
690
|
+
*
|
|
691
|
+
* export const Layout = () => {
|
|
692
|
+
* let page = useStore(router)
|
|
693
|
+
* if (page.route === 'home') {
|
|
694
|
+
* return <HomePage />
|
|
695
|
+
* } else {
|
|
696
|
+
* return <Error404 />
|
|
697
|
+
* }
|
|
698
|
+
* }
|
|
699
|
+
* ```
|
|
700
|
+
*
|
|
701
|
+
* @param store Store instance.
|
|
702
|
+
* @returns Store value.
|
|
703
|
+
*/
|
|
704
|
+
function useStore(store, options = {}) {
|
|
705
|
+
const snapshotRef = (0, import_react.useRef)(store.get());
|
|
706
|
+
const { keys, deps = [store, keys] } = options;
|
|
707
|
+
const subscribe = (0, import_react.useCallback)((onChange) => {
|
|
708
|
+
const emitChange = (value) => {
|
|
709
|
+
if (snapshotRef.current === value) return;
|
|
710
|
+
snapshotRef.current = value;
|
|
711
|
+
onChange();
|
|
712
|
+
};
|
|
713
|
+
emitChange(store.value);
|
|
714
|
+
if (keys?.length) return listenKeys(store, keys, emitChange);
|
|
715
|
+
return store.listen(emitChange);
|
|
716
|
+
}, deps);
|
|
717
|
+
const get = () => snapshotRef.current;
|
|
718
|
+
return (0, import_react.useSyncExternalStore)(subscribe, get, get);
|
|
719
|
+
}
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/client/react/index.mjs
|
|
722
|
+
function getAtomKey(str) {
|
|
723
|
+
return `use${capitalizeFirstLetter(str)}`;
|
|
724
|
+
}
|
|
725
|
+
function createAuthClient(options) {
|
|
726
|
+
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, $store, atomListeners } = getClientConfig(options);
|
|
727
|
+
const resolvedHooks = {};
|
|
728
|
+
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
729
|
+
return createDynamicPathProxy({
|
|
730
|
+
...pluginsActions,
|
|
731
|
+
...resolvedHooks,
|
|
732
|
+
$fetch,
|
|
733
|
+
$store
|
|
734
|
+
}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
735
|
+
}
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/plugins/admin/client.mjs
|
|
738
|
+
var adminClient = (options) => {
|
|
739
|
+
const roles = {
|
|
740
|
+
admin: adminAc,
|
|
741
|
+
user: userAc,
|
|
742
|
+
...options?.roles
|
|
743
|
+
};
|
|
744
|
+
return {
|
|
745
|
+
id: "admin-client",
|
|
746
|
+
$InferServerPlugin: {},
|
|
747
|
+
getActions: () => ({ admin: { checkRolePermission: (data) => {
|
|
748
|
+
return hasPermission({
|
|
749
|
+
role: data.role,
|
|
750
|
+
options: {
|
|
751
|
+
ac: options?.ac,
|
|
752
|
+
roles
|
|
753
|
+
},
|
|
754
|
+
permissions: data.permissions
|
|
755
|
+
});
|
|
756
|
+
} } }),
|
|
757
|
+
pathMethods: {
|
|
758
|
+
"/admin/list-users": "GET",
|
|
759
|
+
"/admin/stop-impersonating": "POST"
|
|
760
|
+
},
|
|
761
|
+
$ERROR_CODES: ADMIN_ERROR_CODES
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/plugins/anonymous/client.mjs
|
|
766
|
+
var anonymousClient = () => {
|
|
767
|
+
return {
|
|
768
|
+
id: "anonymous",
|
|
769
|
+
$InferServerPlugin: {},
|
|
770
|
+
pathMethods: {
|
|
771
|
+
"/sign-in/anonymous": "POST",
|
|
772
|
+
"/delete-anonymous-user": "POST"
|
|
773
|
+
},
|
|
774
|
+
atomListeners: [{
|
|
775
|
+
matcher: (path) => path === "/sign-in/anonymous",
|
|
776
|
+
signal: "$sessionSignal"
|
|
777
|
+
}],
|
|
778
|
+
$ERROR_CODES: ANONYMOUS_ERROR_CODES
|
|
779
|
+
};
|
|
780
|
+
};
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region ../../node_modules/.bun/better-auth@1.5.6+a1a83433c99f55aa/node_modules/better-auth/dist/plugins/username/client.mjs
|
|
783
|
+
var usernameClient = () => {
|
|
784
|
+
return {
|
|
785
|
+
id: "username",
|
|
786
|
+
$InferServerPlugin: {},
|
|
787
|
+
atomListeners: [{
|
|
788
|
+
matcher: (path) => path === "/sign-in/username",
|
|
789
|
+
signal: "$sessionSignal"
|
|
790
|
+
}],
|
|
791
|
+
$ERROR_CODES: USERNAME_ERROR_CODES
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region app/lib/auth-client.ts
|
|
796
|
+
var authClient = createAuthClient({
|
|
797
|
+
baseURL: typeof window !== "undefined" ? window.location.origin : "http://localhost:3456",
|
|
798
|
+
basePath: "/api/auth",
|
|
799
|
+
plugins: [
|
|
800
|
+
usernameClient(),
|
|
801
|
+
anonymousClient(),
|
|
802
|
+
adminClient()
|
|
803
|
+
]
|
|
804
|
+
});
|
|
805
|
+
var { useSession, signIn, signUp, signOut } = authClient;
|
|
806
|
+
//#endregion
|
|
807
|
+
export { authClient as t };
|