@kky42/pievo-server 2.4.14 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/MarkdownView-BuFKr9Jg.js +66 -0
- package/.output/public/assets/{actionUi-5PtES4q0.js → actionUi-BZrLpgHT.js} +1 -1
- package/.output/public/assets/app-x1CeeY7N.css +2 -0
- package/.output/public/assets/index-D0FIKiiW.js +10 -0
- package/.output/public/assets/loops._loopId-DTkIz4C0.js +2 -0
- package/.output/public/assets/loops._loopId_.runs._runId-CsV2Ih4Z.js +3 -0
- package/.output/public/assets/preload-helper-BSxGu4d0.js +3 -0
- package/.output/public/assets/{routes-Dm_3J2aV.js → routes-BIOJZsig.js} +1 -1
- package/.output/public/assets/routes-m4Z90DTR.js +1 -0
- package/.output/server/_chunks/ssr-renderer.mjs +1 -1
- package/.output/server/_libs/{drizzle-orm+postgres.mjs → drizzle-orm.mjs} +93 -2218
- package/.output/server/_ssr/{MachinesModal-BaEtzycr.mjs → MachinesModal-CLBZxZkq.mjs} +47 -47
- package/.output/server/_ssr/MarkdownView-D1J7ImYF.mjs +70 -0
- package/.output/server/_ssr/{actionUi-5HOCZnom.mjs → actionUi-DE-Pb2tv.mjs} +1 -2
- package/.output/server/_ssr/artifactFiles-B0NPRDOR.mjs +52 -0
- package/.output/server/_ssr/{artifactKind-DwDr8IYc.mjs → artifactKind-a2oxT2wQ.mjs} +4 -10
- package/.output/server/_ssr/{boot-C472kLwY.mjs → boot-DmpKtb0A.mjs} +2659 -890
- package/.output/server/_ssr/lifecycleUi-DEjM8Etm.mjs +106 -0
- package/.output/server/_ssr/{loopApi-DT751TJA.mjs → loopApi-DK1lQPrx.mjs} +53 -69
- package/.output/server/_ssr/{loopProjection-qaD2I48a.mjs → loopProjection-DdFivf7-.mjs} +6 -24
- package/.output/server/_ssr/{loops._loopId-CXgw2Rz1.mjs → loops._loopId-DVCvGSEc.mjs} +36 -116
- package/.output/server/_ssr/{loops._loopId_.runs._runId-SASSqOfy.mjs → loops._loopId_.runs._runId-BXbTfLlC.mjs} +35 -39
- package/.output/server/_ssr/{loops._loopId_.runs._runId-Dk94Z0Jq.mjs → loops._loopId_.runs._runId-Dr6E-FA5.mjs} +3 -8
- package/.output/server/_ssr/{machineFns-BSrIgn3f.mjs → machineFns-DLRHgDdS.mjs} +13 -50
- package/.output/server/_ssr/networkAccess-CIlK3ION.mjs +30 -0
- package/.output/server/_ssr/router-BhHsTGqu.mjs +355 -0
- package/.output/server/_ssr/routes-CCallyCT.mjs +12 -0
- package/.output/server/_ssr/{routes-Cr-9yDEH.mjs → routes-CL2Kef-Q.mjs} +91 -50
- package/.output/server/_ssr/{routes-DRBS4Zi4.mjs → routes-ngpX7h8D.mjs} +2 -4
- package/.output/server/_ssr/ssr.mjs +25 -34
- package/.output/server/_ssr/start-B5_9Z5W-.mjs +35 -0
- package/.output/server/{_tanstack-start-manifest_v-DxLIQ0cc.mjs → _tanstack-start-manifest_v-BPiJ4yWT.mjs} +9 -15
- package/.output/server/drizzle/0000_baseline.sql +6 -97
- package/.output/server/drizzle/0001_loop_files.sql +9 -0
- package/.output/server/drizzle/meta/_journal.json +3 -17
- package/.output/server/index.mjs +50 -50
- package/drizzle/0000_baseline.sql +6 -97
- package/drizzle/0001_loop_files.sql +9 -0
- package/drizzle/meta/_journal.json +3 -17
- package/package.json +4 -8
- package/scripts/pievo-server.mjs +49 -47
- package/scripts/server-cli-lib.mjs +21 -12
- package/scripts/server-network.mjs +139 -0
- package/.output/public/assets/SignIn-CIFwnZtF.js +0 -1
- package/.output/public/assets/app-DvHMhs7S.css +0 -2
- package/.output/public/assets/index-CRX2pu0W.js +0 -10
- package/.output/public/assets/loops._loopId-BsuV-Rmf.js +0 -67
- package/.output/public/assets/loops._loopId_.runs._runId-DpK_fzmZ.js +0 -3
- package/.output/public/assets/preload-helper-sAZOZb3G.js +0 -5
- package/.output/public/assets/routes-DxF_s3cD.js +0 -1
- package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +0 -419
- package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +0 -10732
- package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +0 -9475
- package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +0 -137
- package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +0 -440
- package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +0 -62
- package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +0 -818
- package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +0 -59
- package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +0 -342
- package/.output/server/_libs/aws-crypto__crc32c.mjs +0 -314
- package/.output/server/_libs/aws-sdk__nested-clients.mjs +0 -2671
- package/.output/server/_ssr/SignIn-sHQaBQJC.mjs +0 -53
- package/.output/server/_ssr/artifactFiles-DO43wwXA.mjs +0 -60
- package/.output/server/_ssr/artifacts-Cd7Qx3Qp.mjs +0 -2
- package/.output/server/_ssr/auth-0AamrwHo.mjs +0 -38355
- package/.output/server/_ssr/auth-client-lSMb_Idt.mjs +0 -1070
- package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-DLIXocA0.mjs +0 -162
- package/.output/server/_ssr/core-RrmWoKne.mjs +0 -5
- package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-BoFMIPr_.mjs +0 -112
- package/.output/server/_ssr/db-BzvMQ2kx.mjs +0 -2
- package/.output/server/_ssr/dist-ClzqkwxD.mjs +0 -342
- package/.output/server/_ssr/factory-ixUjZqJn.mjs +0 -6903
- package/.output/server/_ssr/kysely-adapter-DkZbmKgV.mjs +0 -2
- package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +0 -19
- package/.output/server/_ssr/logger-DDjsYB2X.mjs +0 -2
- package/.output/server/_ssr/loopTags-CXx5UdGf.mjs +0 -3356
- package/.output/server/_ssr/node-sqlite-dialect-BbUqnnYv.mjs +0 -162
- package/.output/server/_ssr/router-BlLlhfJe.mjs +0 -543
- package/.output/server/_ssr/routes-DTBltabU.mjs +0 -27
- package/.output/server/_ssr/start-4ifArtKx.mjs +0 -4
- package/.output/server/_ssr/store-vDZ9INSa.mjs +0 -2
- package/.output/server/_ssr/tokens-BHiCElYD.mjs +0 -2
- package/.output/server/drizzle/0001_add_pi_agent.sql +0 -9
- package/.output/server/drizzle/0002_remove_teams.sql +0 -15
- package/.output/server/drizzle/0003_add_loop_tags.sql +0 -5
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/package.json +0 -9
- package/drizzle/0001_add_pi_agent.sql +0 -9
- package/drizzle/0002_remove_teams.sql +0 -15
- package/drizzle/0003_add_loop_tags.sql +0 -5
- package/scripts/prestart.mjs +0 -66
|
@@ -1,1070 +0,0 @@
|
|
|
1
|
-
import { o as __toESM } from "../_runtime.mjs";
|
|
2
|
-
import { J as getBaseURL, On as toKebabCase, R as defu, S as capitalizeFirstLetter, gt as isSafeUrlScheme, k as createFetch } from "./loopTags-CXx5UdGf.mjs";
|
|
3
|
-
import { g as require_react, h as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
|
|
4
|
-
import { n as createServerFn, r as getServerFnById, t as TSS_SERVER_FUNCTION } from "./ssr.mjs";
|
|
5
|
-
//#region node_modules/.nitro/vite/services/ssr/assets/auth-client-lSMb_Idt.js
|
|
6
|
-
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
7
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
8
|
-
var createSsrRpc = (functionId) => {
|
|
9
|
-
const url = "/_serverFn/" + functionId;
|
|
10
|
-
const serverFnMeta = { id: functionId };
|
|
11
|
-
const fn = async (...args) => {
|
|
12
|
-
return (await getServerFnById(functionId, { origin: "server" }))(...args);
|
|
13
|
-
};
|
|
14
|
-
return Object.assign(fn, {
|
|
15
|
-
url,
|
|
16
|
-
serverFnMeta,
|
|
17
|
-
[TSS_SERVER_FUNCTION]: true
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Server functions backing the dashboard. They run server-side (createServerFn
|
|
22
|
-
* → RPC) and call the IN-PROCESS scheduler + store directly — the scheduler
|
|
23
|
-
* lives in this same TanStack process (booted on first call via ensureServer).
|
|
24
|
-
* The machine-facing poll, CLI, report, and artifact-sync endpoints are sibling
|
|
25
|
-
* server routes in this same process, so one process owns the single scheduler.
|
|
26
|
-
*
|
|
27
|
-
* Reads and writes are scoped through requestScope/ownedLoop so auth-mode users
|
|
28
|
-
* can access only their own loops. Open mode intentionally shares all loops.
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Resolve a loop and authorize the request against its owner. Returns the loop,
|
|
32
|
-
* or undefined when it's missing OR (gate on) owned by a different user — callers
|
|
33
|
-
* treat both as "not found" so existence never leaks across users.
|
|
34
|
-
*/
|
|
35
|
-
var getAuthState = createServerFn({ method: "GET" }).handler(createSsrRpc("b8119d5fe6ca1ed9f609702aa2133b5ac5337030c0bdcf92dc7eba889d6bd2e6"));
|
|
36
|
-
/**
|
|
37
|
-
* Client config. `pievoCli` is the CLI invocation prefix the skill + connect
|
|
38
|
-
* dialog use for every verb (`daemon start`, `new`, …) — defaults to the globally
|
|
39
|
-
* installed `pievo`. Set PIEVO_CLI locally to a runnable command that points at the in-repo
|
|
40
|
-
* daemon, e.g. `tsx /abs/packages/daemon/src/cli.ts` or
|
|
41
|
-
* `node /abs/packages/daemon/dist/cli.js`, so loops created from THIS server tell
|
|
42
|
-
* Claude Code to run your local code instead of the registry build.
|
|
43
|
-
*/
|
|
44
|
-
var getConfig = createServerFn({ method: "GET" }).handler(createSsrRpc("cbb6a1b09b309459bbba3dc3851ae85fc468658b3cda77e22b6c6f3e28b65af4"));
|
|
45
|
-
/** GET — visible loops as compact summaries, most recently run first. */
|
|
46
|
-
var listLoops = createServerFn({ method: "GET" }).handler(createSsrRpc("23e290b2b7483ceea6fe669024c35b12c2c4ddd76649f6fab21c958ceda02940"));
|
|
47
|
-
var getLoopDetail = createServerFn({ method: "GET" }).validator((id) => id).handler(createSsrRpc("b050455aacc84dd2a2c9a45517826ad10f91d8f1545e87cc7015784cc7116a97"));
|
|
48
|
-
var loadOlderRuns = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("85fdf73d4fee43aed762f93c5d47d33200fbff39e2d082647dc921f610d32698"));
|
|
49
|
-
var getArtifacts = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("b18bbec3d06dfc77714e1e527dfb9172fd7575a64a6c0d6e73ba6dc658dccf0d"));
|
|
50
|
-
var getArtifact = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("ed10d5fe79208e5e0e4e18e4a17b18d7f7db4dd16204c00c3ac90c4644668841"));
|
|
51
|
-
/** GET — a run's per-file diff vs the previous run. Lazy by runId like
|
|
52
|
-
* computed on the server at read time (no stored diffs). Old runs
|
|
53
|
-
* with no snapshot return `hasSnapshot: false` for the degrade copy. */
|
|
54
|
-
var getRunDiff = createServerFn({ method: "GET" }).validator((d) => d).handler(createSsrRpc("08c28b892712a1b491b120b74c7dcb81761988d31ccea60216d1807b73c1182c"));
|
|
55
|
-
var patchLoop = createServerFn({ method: "POST" }).validator((d) => d).handler(createSsrRpc("9befe6b8d67ccbbd7aa9b538bde2a161a9894761c8936761a9503fda1a88c0fc"));
|
|
56
|
-
/** Dedicated lifecycle operations. Dashboard callers never synthesize these
|
|
57
|
-
* transitions with patchLoop: each delegates to the loop-locked store operation. */
|
|
58
|
-
var pauseLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("95b7483b333d7649e70c848319417e83c2af6a0327bbcda2d0e331f626dffe05"));
|
|
59
|
-
var startLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("5660ea82ea5ff2549e0ce2f8f070c54f3e9e24fee84d547601ef5d6ef49a4016"));
|
|
60
|
-
var stopLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("e233a461e4526dec3cc4cbaa891a7c3621d5967ce7f32b4fb17e9fb645857b9a"));
|
|
61
|
-
/** Delete is one confirmed operation. Reachable machines get the graceful
|
|
62
|
-
* Stop-and-wait path; a machine already offline at click time cannot acknowledge
|
|
63
|
-
* Stop, so retire its execution authority and remove server data immediately.
|
|
64
|
-
* Local files are never touched by either path. */
|
|
65
|
-
var deleteLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("5e0d6b55f5629faac2f55a68661eeb82668b2be752192b16264ffb5cd1e6fabe"));
|
|
66
|
-
var runLoop = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("08565e35f6a3dd06ef25401de0343976c47f7ae319d3baed6320b56dd3718311"));
|
|
67
|
-
/** Dedicated Stop-run operation. Pending work cancels immediately; running work
|
|
68
|
-
* records intent and stays Running until the daemon reports its actual result. */
|
|
69
|
-
var stopRun = createServerFn({ method: "POST" }).validator((id) => id).handler(createSsrRpc("6850ba403da9dec5aff45794eb52636ca540ddec2d9e59f5c75ccbb852bfeacb"));
|
|
70
|
-
/** Mint the key shown in the New-loop daemon connection command. */
|
|
71
|
-
var mintConnectKey = createServerFn({ method: "POST" }).handler(createSsrRpc("ce43dcb9366e7c8f7338a6ad28e4290b75a5ee3b13d0d2c9cb585020008f12c6"));
|
|
72
|
-
var DAEMON_UPGRADE_REQUIRED = "Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.";
|
|
73
|
-
function deriveLoopLifecycle(loop) {
|
|
74
|
-
if (loop.deleteRequestedAt != null) return "deleting";
|
|
75
|
-
const running = loop.runs.find((run) => run.phase === "running");
|
|
76
|
-
if (!loop.enabled && running?.cancelRequested) return "stopping";
|
|
77
|
-
if (!loop.enabled && (loop.running || running)) return "paused-finishing";
|
|
78
|
-
if (!loop.enabled) return "paused";
|
|
79
|
-
return "active";
|
|
80
|
-
}
|
|
81
|
-
/** Stable lifecycle badge shared by dashboard cards and loop detail. It shows
|
|
82
|
-
* only scheduling state and its durable pause cause; execution transients
|
|
83
|
-
* (queued/running/stopping) stay in the runs timeline and never replace it. */
|
|
84
|
-
function lifecyclePresentation(loop) {
|
|
85
|
-
if (loop.deleteRequestedAt != null) return {
|
|
86
|
-
label: "Deleting",
|
|
87
|
-
tone: "accent"
|
|
88
|
-
};
|
|
89
|
-
if (loop.enabled) return {
|
|
90
|
-
label: "Active",
|
|
91
|
-
tone: "success"
|
|
92
|
-
};
|
|
93
|
-
if (loop.pauseCause?.kind === "blocked") return {
|
|
94
|
-
label: "Paused · blocked",
|
|
95
|
-
tone: "attention"
|
|
96
|
-
};
|
|
97
|
-
if (loop.pauseCause?.kind === "failure-streak") return {
|
|
98
|
-
label: "Paused · failure streak",
|
|
99
|
-
tone: "attention"
|
|
100
|
-
};
|
|
101
|
-
if (loop.pauseCause?.kind === "owner") return {
|
|
102
|
-
label: "Paused · owner",
|
|
103
|
-
tone: "neutral"
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
label: "Paused",
|
|
107
|
-
tone: "neutral"
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function daemonStopSupport(protocol) {
|
|
111
|
-
return protocol === 4 ? {
|
|
112
|
-
supported: true,
|
|
113
|
-
label: `Daemon protocol 4 · Stop supported`
|
|
114
|
-
} : {
|
|
115
|
-
supported: false,
|
|
116
|
-
label: `Daemon protocol ${protocol ?? "unknown"} · upgrade required`
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function OpenModeWarning({ className = "" }) {
|
|
120
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
121
|
-
role: "alert",
|
|
122
|
-
className: `${className} rounded-control border border-warn/40 bg-warn/10 px-4 py-3 text-meta text-primary`,
|
|
123
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Open mode:" }), " anyone who can reach this server can view and manage every loop, machine, run, and artifact. Restrict access to localhost, a trusted private network, or an authenticated reverse proxy."]
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Shared Pievo mark geometry: eight durable steps form a cycle and the
|
|
128
|
-
* interactive-blue runner marks the next scheduled pass.
|
|
129
|
-
*
|
|
130
|
-
* Variants are props on one geometry (styles in app.css):
|
|
131
|
-
* - `plate` - dark tile behind the steps (favicon / app-icon contexts);
|
|
132
|
-
* without it the steps inherit currentColor (inline contexts).
|
|
133
|
-
* - `trail` - two fading steps behind the runner, so a static rendering
|
|
134
|
-
* still reads as motion (print / social cards).
|
|
135
|
-
* - `animated` - the runner advances around the cycle; reduced-motion users
|
|
136
|
-
* see the canonical static first frame.
|
|
137
|
-
*/
|
|
138
|
-
var RING = [
|
|
139
|
-
[9, 9],
|
|
140
|
-
[37, 9],
|
|
141
|
-
[65, 9],
|
|
142
|
-
[65, 37],
|
|
143
|
-
[65, 65],
|
|
144
|
-
[37, 65],
|
|
145
|
-
[9, 65],
|
|
146
|
-
[9, 37]
|
|
147
|
-
];
|
|
148
|
-
function RingLogo({ size = 24, plate = false, trail = false, animated = false }) {
|
|
149
|
-
const cellClass = (i) => {
|
|
150
|
-
const parts = ["ring-cell", `rc${i}`];
|
|
151
|
-
if (i === 0) parts.push("ring-runner");
|
|
152
|
-
else if (trail && i === 7) parts.push("ring-trail-1");
|
|
153
|
-
else if (trail && i === 6) parts.push("ring-trail-2");
|
|
154
|
-
return parts.join(" ");
|
|
155
|
-
};
|
|
156
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
|
|
157
|
-
width: size,
|
|
158
|
-
height: size,
|
|
159
|
-
viewBox: "0 0 96 96",
|
|
160
|
-
role: "img",
|
|
161
|
-
"aria-label": "Pievo",
|
|
162
|
-
className: [
|
|
163
|
-
"ring-logo",
|
|
164
|
-
plate && "ring-logo-plate",
|
|
165
|
-
animated && "ring-logo-animated"
|
|
166
|
-
].filter(Boolean).join(" "),
|
|
167
|
-
children: [plate && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
168
|
-
width: "96",
|
|
169
|
-
height: "96",
|
|
170
|
-
rx: "15",
|
|
171
|
-
fill: "#0b0b0b"
|
|
172
|
-
}), RING.map(([x, y], i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
173
|
-
x,
|
|
174
|
-
y,
|
|
175
|
-
width: 22,
|
|
176
|
-
height: 22,
|
|
177
|
-
rx: 6,
|
|
178
|
-
className: cellClass(i)
|
|
179
|
-
}, i))]
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Pievo's primary product mark: one scheduled pass moving around a durable ring.
|
|
184
|
-
* It reuses the same geometry as the favicon and README asset; animation is a
|
|
185
|
-
* progressive enhancement and parks on the canonical first frame when reduced
|
|
186
|
-
* motion is requested.
|
|
187
|
-
*/
|
|
188
|
-
function PievoLogo({ size = 56 }) {
|
|
189
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RingLogo, {
|
|
190
|
-
size,
|
|
191
|
-
plate: true,
|
|
192
|
-
animated: true
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
var GITHUB_URL = "https://github.com/kky42/pievo";
|
|
196
|
-
function GitHubIcon({ className }) {
|
|
197
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
198
|
-
viewBox: "0 0 24 24",
|
|
199
|
-
fill: "currentColor",
|
|
200
|
-
"aria-hidden": true,
|
|
201
|
-
className,
|
|
202
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.55 0-.27-.01-1.17-.02-2.12-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.75 2.69 1.25 3.34.95.1-.74.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.68 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.8 0c2.2-1.49 3.17-1.18 3.17-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.41-2.69 5.38-5.25 5.67.41.35.77 1.05.77 2.12 0 1.53-.01 2.76-.01 3.14 0 .3.2.66.8.55A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5z" })
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
var PROTO_POLLUTION_PATTERNS = {
|
|
206
|
-
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*:/,
|
|
207
|
-
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*:/,
|
|
208
|
-
protoShort: /"__proto__"\s*:/,
|
|
209
|
-
constructorShort: /"constructor"\s*:/
|
|
210
|
-
};
|
|
211
|
-
var JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
212
|
-
var SPECIAL_VALUES = {
|
|
213
|
-
true: true,
|
|
214
|
-
false: false,
|
|
215
|
-
null: null,
|
|
216
|
-
undefined: void 0,
|
|
217
|
-
nan: NaN,
|
|
218
|
-
infinity: Number.POSITIVE_INFINITY,
|
|
219
|
-
"-infinity": Number.NEGATIVE_INFINITY
|
|
220
|
-
};
|
|
221
|
-
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}))$/;
|
|
222
|
-
function isValidDate(date) {
|
|
223
|
-
return date instanceof Date && !isNaN(date.getTime());
|
|
224
|
-
}
|
|
225
|
-
function parseISODate(value) {
|
|
226
|
-
const match = ISO_DATE_REGEX.exec(value);
|
|
227
|
-
if (!match) return null;
|
|
228
|
-
const [, year, month, day, hour, minute, second, ms, offsetSign, offsetHour, offsetMinute] = match;
|
|
229
|
-
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));
|
|
230
|
-
if (offsetSign) {
|
|
231
|
-
const offset = (parseInt(offsetHour, 10) * 60 + parseInt(offsetMinute, 10)) * (offsetSign === "+" ? -1 : 1);
|
|
232
|
-
date.setUTCMinutes(date.getUTCMinutes() + offset);
|
|
233
|
-
}
|
|
234
|
-
return isValidDate(date) ? date : null;
|
|
235
|
-
}
|
|
236
|
-
function betterJSONParse(value, options = {}) {
|
|
237
|
-
const { strict = false, warnings = false, reviver, parseDates = true } = options;
|
|
238
|
-
if (typeof value !== "string") return value;
|
|
239
|
-
const trimmed = value.trim();
|
|
240
|
-
const lowerValue = trimmed.toLowerCase();
|
|
241
|
-
if (lowerValue.length <= 9 && lowerValue in SPECIAL_VALUES) return SPECIAL_VALUES[lowerValue];
|
|
242
|
-
if (!JSON_SIGNATURE.test(trimmed)) {
|
|
243
|
-
if (strict) throw new SyntaxError("[better-json] Invalid JSON");
|
|
244
|
-
return value;
|
|
245
|
-
}
|
|
246
|
-
if (Object.entries(PROTO_POLLUTION_PATTERNS).some(([key, pattern]) => {
|
|
247
|
-
const matches = pattern.test(trimmed);
|
|
248
|
-
if (matches && warnings) console.warn(`[better-json] Detected potential prototype pollution attempt using ${key} pattern`);
|
|
249
|
-
return matches;
|
|
250
|
-
}) && strict) throw new Error("[better-json] Potential prototype pollution attempt detected");
|
|
251
|
-
try {
|
|
252
|
-
const secureReviver = (key, value) => {
|
|
253
|
-
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
254
|
-
if (warnings) console.warn(`[better-json] Dropping "${key}" key to prevent prototype pollution`);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (parseDates && typeof value === "string") {
|
|
258
|
-
const date = parseISODate(value);
|
|
259
|
-
if (date) return date;
|
|
260
|
-
}
|
|
261
|
-
return reviver ? reviver(key, value) : value;
|
|
262
|
-
};
|
|
263
|
-
return JSON.parse(trimmed, secureReviver);
|
|
264
|
-
} catch (error) {
|
|
265
|
-
if (strict) throw error;
|
|
266
|
-
return value;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function parseJSON(value, options = { strict: true }) {
|
|
270
|
-
return betterJSONParse(value, options);
|
|
271
|
-
}
|
|
272
|
-
var redirectPlugin = {
|
|
273
|
-
id: "redirect",
|
|
274
|
-
name: "Redirect",
|
|
275
|
-
hooks: { onSuccess(context) {
|
|
276
|
-
if (context.data?.url && context.data?.redirect && isSafeUrlScheme(context.data.url)) {
|
|
277
|
-
if (typeof window !== "undefined" && window.location) {
|
|
278
|
-
if (window.location) try {
|
|
279
|
-
window.location.href = context.data.url;
|
|
280
|
-
} catch {}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
} }
|
|
284
|
-
};
|
|
285
|
-
var listenerQueue = [];
|
|
286
|
-
var lqIndex = 0;
|
|
287
|
-
var QUEUE_ITEMS_PER_LISTENER = 4;
|
|
288
|
-
var nanostoresGlobal = globalThis.nanostoresGlobal ||= { epoch: 0 };
|
|
289
|
-
var atom = /* @__NO_SIDE_EFFECTS__ */ (initialValue) => {
|
|
290
|
-
let listeners = [];
|
|
291
|
-
let $atom = {
|
|
292
|
-
get() {
|
|
293
|
-
if (!$atom.lc) $atom.listen(() => {})();
|
|
294
|
-
return $atom.value;
|
|
295
|
-
},
|
|
296
|
-
init: initialValue,
|
|
297
|
-
lc: 0,
|
|
298
|
-
listen(listener) {
|
|
299
|
-
$atom.lc = listeners.push(listener);
|
|
300
|
-
return () => {
|
|
301
|
-
for (let i = lqIndex + QUEUE_ITEMS_PER_LISTENER; i < listenerQueue.length;) if (listenerQueue[i] === listener) listenerQueue.splice(i, QUEUE_ITEMS_PER_LISTENER);
|
|
302
|
-
else i += QUEUE_ITEMS_PER_LISTENER;
|
|
303
|
-
let index = listeners.indexOf(listener);
|
|
304
|
-
if (~index) {
|
|
305
|
-
listeners.splice(index, 1);
|
|
306
|
-
if (!--$atom.lc) $atom.off();
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
},
|
|
310
|
-
notify(oldValue, changedKey) {
|
|
311
|
-
nanostoresGlobal.epoch++;
|
|
312
|
-
let runListenerQueue = !listenerQueue.length;
|
|
313
|
-
for (let listener of listeners) listenerQueue.push(listener, $atom.value, oldValue, changedKey);
|
|
314
|
-
if (runListenerQueue) {
|
|
315
|
-
for (lqIndex = 0; lqIndex < listenerQueue.length; lqIndex += QUEUE_ITEMS_PER_LISTENER) listenerQueue[lqIndex](listenerQueue[lqIndex + 1], listenerQueue[lqIndex + 2], listenerQueue[lqIndex + 3]);
|
|
316
|
-
listenerQueue.length = 0;
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
off() {},
|
|
320
|
-
set(newValue) {
|
|
321
|
-
let oldValue = $atom.value;
|
|
322
|
-
if (oldValue !== newValue) {
|
|
323
|
-
$atom.value = newValue;
|
|
324
|
-
$atom.notify(oldValue);
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
subscribe(listener) {
|
|
328
|
-
let unbind = $atom.listen(listener);
|
|
329
|
-
listener($atom.value);
|
|
330
|
-
return unbind;
|
|
331
|
-
},
|
|
332
|
-
value: initialValue
|
|
333
|
-
};
|
|
334
|
-
return $atom;
|
|
335
|
-
};
|
|
336
|
-
var SET = 2;
|
|
337
|
-
var MOUNT = 5;
|
|
338
|
-
var UNMOUNT = 6;
|
|
339
|
-
var REVERT_MUTATION = 10;
|
|
340
|
-
var on = (object, listener, eventKey, mutateStore) => {
|
|
341
|
-
object.events = object.events || {};
|
|
342
|
-
if (!object.events[eventKey + REVERT_MUTATION]) object.events[eventKey + REVERT_MUTATION] = mutateStore((eventProps) => {
|
|
343
|
-
object.events[eventKey].reduceRight((event, l) => (l(event), event), {
|
|
344
|
-
shared: {},
|
|
345
|
-
...eventProps
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
object.events[eventKey] = object.events[eventKey] || [];
|
|
349
|
-
object.events[eventKey].push(listener);
|
|
350
|
-
return () => {
|
|
351
|
-
let currentListeners = object.events[eventKey];
|
|
352
|
-
let index = currentListeners.indexOf(listener);
|
|
353
|
-
currentListeners.splice(index, 1);
|
|
354
|
-
if (!currentListeners.length) {
|
|
355
|
-
delete object.events[eventKey];
|
|
356
|
-
object.events[eventKey + REVERT_MUTATION]();
|
|
357
|
-
delete object.events[eventKey + REVERT_MUTATION];
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
};
|
|
361
|
-
var onSet = ($store, listener) => on($store, listener, SET, (runListeners) => {
|
|
362
|
-
let originSet = $store.set;
|
|
363
|
-
let originSetKey = $store.setKey;
|
|
364
|
-
if ($store.setKey) $store.setKey = (changed, changedValue) => {
|
|
365
|
-
let isAborted;
|
|
366
|
-
let abort = () => {
|
|
367
|
-
isAborted = true;
|
|
368
|
-
};
|
|
369
|
-
runListeners({
|
|
370
|
-
abort,
|
|
371
|
-
changed,
|
|
372
|
-
newValue: {
|
|
373
|
-
...$store.value,
|
|
374
|
-
[changed]: changedValue
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
if (!isAborted) return originSetKey(changed, changedValue);
|
|
378
|
-
};
|
|
379
|
-
$store.set = (newValue) => {
|
|
380
|
-
let isAborted;
|
|
381
|
-
let abort = () => {
|
|
382
|
-
isAborted = true;
|
|
383
|
-
};
|
|
384
|
-
runListeners({
|
|
385
|
-
abort,
|
|
386
|
-
newValue
|
|
387
|
-
});
|
|
388
|
-
if (!isAborted) return originSet(newValue);
|
|
389
|
-
};
|
|
390
|
-
return () => {
|
|
391
|
-
$store.set = originSet;
|
|
392
|
-
$store.setKey = originSetKey;
|
|
393
|
-
};
|
|
394
|
-
});
|
|
395
|
-
var STORE_UNMOUNT_DELAY = 1e3;
|
|
396
|
-
var onMount = ($store, initialize) => {
|
|
397
|
-
let listener = (payload) => {
|
|
398
|
-
let destroy = initialize(payload);
|
|
399
|
-
if (destroy) $store.events[UNMOUNT].push(destroy);
|
|
400
|
-
};
|
|
401
|
-
return on($store, listener, MOUNT, (runListeners) => {
|
|
402
|
-
let originListen = $store.listen;
|
|
403
|
-
$store.listen = (...args) => {
|
|
404
|
-
if (!$store.lc && !$store.active) {
|
|
405
|
-
$store.active = true;
|
|
406
|
-
runListeners();
|
|
407
|
-
}
|
|
408
|
-
return originListen(...args);
|
|
409
|
-
};
|
|
410
|
-
let originOff = $store.off;
|
|
411
|
-
$store.events[UNMOUNT] = [];
|
|
412
|
-
$store.off = () => {
|
|
413
|
-
originOff();
|
|
414
|
-
setTimeout(() => {
|
|
415
|
-
if ($store.active && !$store.lc) {
|
|
416
|
-
$store.active = false;
|
|
417
|
-
for (let destroy of $store.events[UNMOUNT]) destroy();
|
|
418
|
-
$store.events[UNMOUNT] = [];
|
|
419
|
-
}
|
|
420
|
-
}, STORE_UNMOUNT_DELAY);
|
|
421
|
-
};
|
|
422
|
-
return () => {
|
|
423
|
-
$store.listen = originListen;
|
|
424
|
-
$store.off = originOff;
|
|
425
|
-
};
|
|
426
|
-
});
|
|
427
|
-
};
|
|
428
|
-
function listenKeys($store, keys, listener) {
|
|
429
|
-
let keysSet = new Set(keys).add(void 0);
|
|
430
|
-
return $store.listen((value, oldValue, changed) => {
|
|
431
|
-
if (keysSet.has(changed)) listener(value, oldValue, changed);
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
function isPlainObject(value) {
|
|
435
|
-
if (typeof value !== "object" || value === null) return false;
|
|
436
|
-
const prototype = Object.getPrototypeOf(value);
|
|
437
|
-
return prototype === Object.prototype || prototype === null;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Deep structural equality for JSON-serializable values.
|
|
441
|
-
* Handles: primitives, null, arrays, and plain objects.
|
|
442
|
-
* Short-circuits on referential equality at every recursion level.
|
|
443
|
-
*/
|
|
444
|
-
function isJsonEqual(a, b) {
|
|
445
|
-
if (a === b) return true;
|
|
446
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
447
|
-
if (a.length !== b.length) return false;
|
|
448
|
-
for (let i = 0; i < a.length; i++) if (!isJsonEqual(a[i], b[i])) return false;
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
452
|
-
const keysA = Object.keys(a);
|
|
453
|
-
const keysB = Object.keys(b);
|
|
454
|
-
if (keysA.length !== keysB.length) return false;
|
|
455
|
-
for (const key of keysA) if (!(key in b) || !isJsonEqual(a[key], b[key])) return false;
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Attach an equality gate to a nanostores atom via `onSet`.
|
|
462
|
-
* When `isEqual(currentValue, newValue)` returns true, the `set()` call
|
|
463
|
-
* is aborted: no listeners fire, no framework re-renders occur.
|
|
464
|
-
*
|
|
465
|
-
* Returns the unsubscribe function from `onSet`.
|
|
466
|
-
*/
|
|
467
|
-
function withEquality(store, isEqual) {
|
|
468
|
-
return onSet(store, ({ newValue, abort }) => {
|
|
469
|
-
if (isEqual(store.value, newValue)) abort();
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
473
|
-
var now$1 = () => Math.floor(Date.now() / 1e3);
|
|
474
|
-
var WindowBroadcastChannel = class {
|
|
475
|
-
listeners = /* @__PURE__ */ new Set();
|
|
476
|
-
name;
|
|
477
|
-
constructor(name = "better-auth.message") {
|
|
478
|
-
this.name = name;
|
|
479
|
-
}
|
|
480
|
-
subscribe(listener) {
|
|
481
|
-
this.listeners.add(listener);
|
|
482
|
-
return () => {
|
|
483
|
-
this.listeners.delete(listener);
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
post(message) {
|
|
487
|
-
if (typeof window === "undefined") return;
|
|
488
|
-
try {
|
|
489
|
-
localStorage.setItem(this.name, JSON.stringify({
|
|
490
|
-
...message,
|
|
491
|
-
timestamp: now$1()
|
|
492
|
-
}));
|
|
493
|
-
} catch {}
|
|
494
|
-
}
|
|
495
|
-
setup() {
|
|
496
|
-
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
497
|
-
const handler = (event) => {
|
|
498
|
-
if (event.key !== this.name) return;
|
|
499
|
-
const message = JSON.parse(event.newValue ?? "{}");
|
|
500
|
-
if (message?.event !== "session" || !message?.data) return;
|
|
501
|
-
this.listeners.forEach((listener) => listener(message));
|
|
502
|
-
};
|
|
503
|
-
window.addEventListener("storage", handler);
|
|
504
|
-
return () => {
|
|
505
|
-
window.removeEventListener("storage", handler);
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
510
|
-
if (!globalThis[kBroadcastChannel]) globalThis[kBroadcastChannel] = new WindowBroadcastChannel(name);
|
|
511
|
-
return globalThis[kBroadcastChannel];
|
|
512
|
-
}
|
|
513
|
-
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
514
|
-
var WindowFocusManager = class {
|
|
515
|
-
listeners = /* @__PURE__ */ new Set();
|
|
516
|
-
subscribe(listener) {
|
|
517
|
-
this.listeners.add(listener);
|
|
518
|
-
return () => {
|
|
519
|
-
this.listeners.delete(listener);
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
setFocused(focused) {
|
|
523
|
-
this.listeners.forEach((listener) => listener(focused));
|
|
524
|
-
}
|
|
525
|
-
setup() {
|
|
526
|
-
if (typeof window === "undefined" || typeof document === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
527
|
-
const visibilityHandler = () => {
|
|
528
|
-
if (document.visibilityState === "visible") this.setFocused(true);
|
|
529
|
-
};
|
|
530
|
-
document.addEventListener("visibilitychange", visibilityHandler, false);
|
|
531
|
-
return () => {
|
|
532
|
-
document.removeEventListener("visibilitychange", visibilityHandler, false);
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
function getGlobalFocusManager() {
|
|
537
|
-
if (!globalThis[kFocusManager]) globalThis[kFocusManager] = new WindowFocusManager();
|
|
538
|
-
return globalThis[kFocusManager];
|
|
539
|
-
}
|
|
540
|
-
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
541
|
-
var WindowOnlineManager = class {
|
|
542
|
-
listeners = /* @__PURE__ */ new Set();
|
|
543
|
-
isOnline = typeof navigator !== "undefined" ? navigator.onLine : true;
|
|
544
|
-
subscribe(listener) {
|
|
545
|
-
this.listeners.add(listener);
|
|
546
|
-
return () => {
|
|
547
|
-
this.listeners.delete(listener);
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
setOnline(online) {
|
|
551
|
-
this.isOnline = online;
|
|
552
|
-
this.listeners.forEach((listener) => listener(online));
|
|
553
|
-
}
|
|
554
|
-
setup() {
|
|
555
|
-
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
556
|
-
const onOnline = () => this.setOnline(true);
|
|
557
|
-
const onOffline = () => this.setOnline(false);
|
|
558
|
-
window.addEventListener("online", onOnline, false);
|
|
559
|
-
window.addEventListener("offline", onOffline, false);
|
|
560
|
-
return () => {
|
|
561
|
-
window.removeEventListener("online", onOnline, false);
|
|
562
|
-
window.removeEventListener("offline", onOffline, false);
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
function getGlobalOnlineManager() {
|
|
567
|
-
if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
|
|
568
|
-
return globalThis[kOnlineManager];
|
|
569
|
-
}
|
|
570
|
-
var now = () => Math.floor(Date.now() / 1e3);
|
|
571
|
-
/**
|
|
572
|
-
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
573
|
-
*/
|
|
574
|
-
var FOCUS_REFETCH_RATE_LIMIT_SECONDS = 5;
|
|
575
|
-
function createSessionRefreshManager(opts) {
|
|
576
|
-
const { fetchSession, shouldPollSession = () => true, sessionSignal, options = {} } = opts;
|
|
577
|
-
const refetchInterval = options.sessionOptions?.refetchInterval ?? 0;
|
|
578
|
-
const refetchOnWindowFocus = options.sessionOptions?.refetchOnWindowFocus ?? true;
|
|
579
|
-
const refetchWhenOffline = options.sessionOptions?.refetchWhenOffline ?? false;
|
|
580
|
-
const state = {
|
|
581
|
-
isInitialized: false,
|
|
582
|
-
lastSessionRequest: 0
|
|
583
|
-
};
|
|
584
|
-
const shouldRefetch = () => {
|
|
585
|
-
return refetchWhenOffline || getGlobalOnlineManager().isOnline;
|
|
586
|
-
};
|
|
587
|
-
const triggerRefetch = (event) => {
|
|
588
|
-
if (!shouldRefetch()) return;
|
|
589
|
-
if (event?.event === "storage") {
|
|
590
|
-
fetchSession();
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
if (event?.event === "poll") {
|
|
594
|
-
state.lastSessionRequest = now();
|
|
595
|
-
fetchSession();
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
if (event?.event === "visibilitychange") {
|
|
599
|
-
if (now() - state.lastSessionRequest < FOCUS_REFETCH_RATE_LIMIT_SECONDS) return;
|
|
600
|
-
state.lastSessionRequest = now();
|
|
601
|
-
fetchSession();
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
fetchSession();
|
|
605
|
-
};
|
|
606
|
-
const broadcastSessionUpdate = (trigger) => {
|
|
607
|
-
getGlobalBroadcastChannel().post({
|
|
608
|
-
event: "session",
|
|
609
|
-
data: { trigger },
|
|
610
|
-
clientId: Math.random().toString(36).substring(7)
|
|
611
|
-
});
|
|
612
|
-
};
|
|
613
|
-
const setupPolling = () => {
|
|
614
|
-
if (refetchInterval && refetchInterval > 0) state.pollInterval = setInterval(() => {
|
|
615
|
-
if (shouldPollSession()) triggerRefetch({ event: "poll" });
|
|
616
|
-
}, refetchInterval * 1e3);
|
|
617
|
-
};
|
|
618
|
-
const setupBroadcast = () => {
|
|
619
|
-
state.unsubscribeBroadcast = getGlobalBroadcastChannel().subscribe(() => {
|
|
620
|
-
triggerRefetch({ event: "storage" });
|
|
621
|
-
});
|
|
622
|
-
};
|
|
623
|
-
const setupFocusRefetch = () => {
|
|
624
|
-
if (!refetchOnWindowFocus) return;
|
|
625
|
-
state.unsubscribeFocus = getGlobalFocusManager().subscribe(() => {
|
|
626
|
-
triggerRefetch({ event: "visibilitychange" });
|
|
627
|
-
});
|
|
628
|
-
};
|
|
629
|
-
const setupOnlineRefetch = () => {
|
|
630
|
-
state.unsubscribeOnline = getGlobalOnlineManager().subscribe((online) => {
|
|
631
|
-
if (online) triggerRefetch({ event: "visibilitychange" });
|
|
632
|
-
});
|
|
633
|
-
};
|
|
634
|
-
const setupSignalSubscription = () => {
|
|
635
|
-
state.unsubscribeSignal = sessionSignal.listen(() => {
|
|
636
|
-
fetchSession();
|
|
637
|
-
});
|
|
638
|
-
};
|
|
639
|
-
const init = () => {
|
|
640
|
-
if (state.isInitialized) return;
|
|
641
|
-
state.isInitialized = true;
|
|
642
|
-
setupPolling();
|
|
643
|
-
setupBroadcast();
|
|
644
|
-
setupFocusRefetch();
|
|
645
|
-
setupOnlineRefetch();
|
|
646
|
-
setupSignalSubscription();
|
|
647
|
-
state.cleanupBroadcastSetup = getGlobalBroadcastChannel().setup();
|
|
648
|
-
state.cleanupFocusSetup = getGlobalFocusManager().setup();
|
|
649
|
-
state.cleanupOnlineSetup = getGlobalOnlineManager().setup();
|
|
650
|
-
};
|
|
651
|
-
const cleanup = () => {
|
|
652
|
-
if (!state.isInitialized) return;
|
|
653
|
-
if (state.pollInterval) {
|
|
654
|
-
clearInterval(state.pollInterval);
|
|
655
|
-
state.pollInterval = void 0;
|
|
656
|
-
}
|
|
657
|
-
if (state.unsubscribeBroadcast) {
|
|
658
|
-
state.unsubscribeBroadcast();
|
|
659
|
-
state.unsubscribeBroadcast = void 0;
|
|
660
|
-
}
|
|
661
|
-
if (state.unsubscribeFocus) {
|
|
662
|
-
state.unsubscribeFocus();
|
|
663
|
-
state.unsubscribeFocus = void 0;
|
|
664
|
-
}
|
|
665
|
-
if (state.unsubscribeOnline) {
|
|
666
|
-
state.unsubscribeOnline();
|
|
667
|
-
state.unsubscribeOnline = void 0;
|
|
668
|
-
}
|
|
669
|
-
if (state.unsubscribeSignal) {
|
|
670
|
-
state.unsubscribeSignal();
|
|
671
|
-
state.unsubscribeSignal = void 0;
|
|
672
|
-
}
|
|
673
|
-
if (state.cleanupBroadcastSetup) {
|
|
674
|
-
state.cleanupBroadcastSetup();
|
|
675
|
-
state.cleanupBroadcastSetup = void 0;
|
|
676
|
-
}
|
|
677
|
-
if (state.cleanupFocusSetup) {
|
|
678
|
-
state.cleanupFocusSetup();
|
|
679
|
-
state.cleanupFocusSetup = void 0;
|
|
680
|
-
}
|
|
681
|
-
if (state.cleanupOnlineSetup) {
|
|
682
|
-
state.cleanupOnlineSetup();
|
|
683
|
-
state.cleanupOnlineSetup = void 0;
|
|
684
|
-
}
|
|
685
|
-
state.isInitialized = false;
|
|
686
|
-
state.lastSessionRequest = 0;
|
|
687
|
-
};
|
|
688
|
-
return {
|
|
689
|
-
init,
|
|
690
|
-
cleanup,
|
|
691
|
-
triggerRefetch,
|
|
692
|
-
broadcastSessionUpdate
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
var isServer = () => typeof window === "undefined";
|
|
696
|
-
/**
|
|
697
|
-
* Normalize $fetch response: `throw: true` returns data directly,
|
|
698
|
-
* otherwise `{ data, error }`.
|
|
699
|
-
*/
|
|
700
|
-
function normalizeSessionResponse(res) {
|
|
701
|
-
if (typeof res === "object" && res !== null && "data" in res && "error" in res) return res;
|
|
702
|
-
return {
|
|
703
|
-
data: res,
|
|
704
|
-
error: null
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
function normalizeSessionData(data) {
|
|
708
|
-
if (!data) return null;
|
|
709
|
-
if (data.session === null && data.user === null) return null;
|
|
710
|
-
return data;
|
|
711
|
-
}
|
|
712
|
-
function isSessionAtomEqual(a, b) {
|
|
713
|
-
return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
|
|
714
|
-
}
|
|
715
|
-
function getSessionAtom($fetch, options) {
|
|
716
|
-
const $signal = /* @__PURE__ */ atom(false);
|
|
717
|
-
let abortController;
|
|
718
|
-
const refetch = (queryParams) => fetchSession(queryParams);
|
|
719
|
-
const session = /* @__PURE__ */ atom({
|
|
720
|
-
data: null,
|
|
721
|
-
error: null,
|
|
722
|
-
isPending: true,
|
|
723
|
-
isRefetching: false,
|
|
724
|
-
refetch
|
|
725
|
-
});
|
|
726
|
-
withEquality(session, isSessionAtomEqual);
|
|
727
|
-
const settleAbortedFetch = (controller) => {
|
|
728
|
-
if (abortController !== controller) return;
|
|
729
|
-
const current = session.get();
|
|
730
|
-
abortController = void 0;
|
|
731
|
-
if (!current.isPending && !current.isRefetching) return;
|
|
732
|
-
session.set({
|
|
733
|
-
...current,
|
|
734
|
-
isPending: false,
|
|
735
|
-
isRefetching: false,
|
|
736
|
-
refetch
|
|
737
|
-
});
|
|
738
|
-
};
|
|
739
|
-
const fetchSession = async (queryParams) => {
|
|
740
|
-
abortController?.abort();
|
|
741
|
-
const controller = new AbortController();
|
|
742
|
-
abortController = controller;
|
|
743
|
-
const current = session.get();
|
|
744
|
-
session.set({
|
|
745
|
-
...current,
|
|
746
|
-
isPending: current.data === null,
|
|
747
|
-
isRefetching: true,
|
|
748
|
-
error: null,
|
|
749
|
-
refetch
|
|
750
|
-
});
|
|
751
|
-
try {
|
|
752
|
-
const res = await $fetch("/get-session", {
|
|
753
|
-
method: "GET",
|
|
754
|
-
query: queryParams?.query,
|
|
755
|
-
signal: controller.signal
|
|
756
|
-
});
|
|
757
|
-
if (controller.signal.aborted) {
|
|
758
|
-
settleAbortedFetch(controller);
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
let { data, error } = normalizeSessionResponse(res);
|
|
762
|
-
if (data?.needsRefresh) try {
|
|
763
|
-
const refreshRes = await $fetch("/get-session", {
|
|
764
|
-
method: "POST",
|
|
765
|
-
signal: controller.signal
|
|
766
|
-
});
|
|
767
|
-
if (controller.signal.aborted) {
|
|
768
|
-
settleAbortedFetch(controller);
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
({data, error} = normalizeSessionResponse(refreshRes));
|
|
772
|
-
} catch {
|
|
773
|
-
if (controller.signal.aborted) {
|
|
774
|
-
settleAbortedFetch(controller);
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
if (error) {
|
|
779
|
-
const latest = session.get();
|
|
780
|
-
const isUnauthorized = error?.status === 401;
|
|
781
|
-
session.set({
|
|
782
|
-
data: isUnauthorized ? null : latest.data,
|
|
783
|
-
error,
|
|
784
|
-
isPending: false,
|
|
785
|
-
isRefetching: false,
|
|
786
|
-
refetch
|
|
787
|
-
});
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
const sessionData = normalizeSessionData(data);
|
|
791
|
-
const current = session.get();
|
|
792
|
-
const stableData = current.data != null && sessionData != null && isJsonEqual(current.data, sessionData) ? current.data : sessionData;
|
|
793
|
-
session.set({
|
|
794
|
-
data: stableData,
|
|
795
|
-
error: null,
|
|
796
|
-
isPending: false,
|
|
797
|
-
isRefetching: false,
|
|
798
|
-
refetch
|
|
799
|
-
});
|
|
800
|
-
} catch (fetchError) {
|
|
801
|
-
if (controller.signal.aborted) {
|
|
802
|
-
settleAbortedFetch(controller);
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
|
-
const latest = session.get();
|
|
806
|
-
session.set({
|
|
807
|
-
data: latest.data,
|
|
808
|
-
error: fetchError,
|
|
809
|
-
isPending: false,
|
|
810
|
-
isRefetching: false,
|
|
811
|
-
refetch
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
let broadcastSessionUpdate = () => {};
|
|
816
|
-
onMount(session, () => {
|
|
817
|
-
let timeoutId;
|
|
818
|
-
if (!isServer()) timeoutId = setTimeout(() => {
|
|
819
|
-
fetchSession();
|
|
820
|
-
}, 0);
|
|
821
|
-
const refreshManager = createSessionRefreshManager({
|
|
822
|
-
fetchSession,
|
|
823
|
-
shouldPollSession: () => session.get().data != null,
|
|
824
|
-
sessionSignal: $signal,
|
|
825
|
-
options
|
|
826
|
-
});
|
|
827
|
-
refreshManager.init();
|
|
828
|
-
broadcastSessionUpdate = refreshManager.broadcastSessionUpdate;
|
|
829
|
-
return () => {
|
|
830
|
-
if (timeoutId) clearTimeout(timeoutId);
|
|
831
|
-
const controller = abortController;
|
|
832
|
-
controller?.abort();
|
|
833
|
-
if (controller) settleAbortedFetch(controller);
|
|
834
|
-
refreshManager.cleanup();
|
|
835
|
-
};
|
|
836
|
-
});
|
|
837
|
-
return {
|
|
838
|
-
session,
|
|
839
|
-
$sessionSignal: $signal,
|
|
840
|
-
broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
var resolvePublicAuthUrl = (basePath) => {
|
|
844
|
-
if (typeof process === "undefined") return void 0;
|
|
845
|
-
const path = basePath ?? "/api/auth";
|
|
846
|
-
if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
|
|
847
|
-
if (typeof window === "undefined") {
|
|
848
|
-
if (process.env.NEXTAUTH_URL) try {
|
|
849
|
-
return process.env.NEXTAUTH_URL;
|
|
850
|
-
} catch {}
|
|
851
|
-
if (process.env.VERCEL_URL) try {
|
|
852
|
-
const protocol = process.env.VERCEL_URL.startsWith("http") ? "" : "https://";
|
|
853
|
-
return `${new URL(`${protocol}${process.env.VERCEL_URL}`).origin}${path}`;
|
|
854
|
-
} catch {}
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
var getClientConfig = (options, loadEnv) => {
|
|
858
|
-
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
859
|
-
const baseURL = getBaseURL(options?.baseURL, options?.basePath, void 0, loadEnv) ?? resolvePublicAuthUrl(options?.basePath) ?? "/api/auth";
|
|
860
|
-
const pluginsFetchPlugins = options?.plugins?.flatMap((plugin) => plugin.fetchPlugins).filter((pl) => pl !== void 0) || [];
|
|
861
|
-
const lifeCyclePlugin = {
|
|
862
|
-
id: "lifecycle-hooks",
|
|
863
|
-
name: "lifecycle-hooks",
|
|
864
|
-
hooks: {
|
|
865
|
-
onSuccess: options?.fetchOptions?.onSuccess,
|
|
866
|
-
onError: options?.fetchOptions?.onError,
|
|
867
|
-
onRequest: options?.fetchOptions?.onRequest,
|
|
868
|
-
onResponse: options?.fetchOptions?.onResponse
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
const { onSuccess: _onSuccess, onError: _onError, onRequest: _onRequest, onResponse: _onResponse, ...restOfFetchOptions } = options?.fetchOptions || {};
|
|
872
|
-
const $fetch = createFetch({
|
|
873
|
-
baseURL,
|
|
874
|
-
...isCredentialsSupported ? { credentials: "include" } : {},
|
|
875
|
-
method: "GET",
|
|
876
|
-
jsonParser(text) {
|
|
877
|
-
if (!text) return null;
|
|
878
|
-
return parseJSON(text, { strict: false });
|
|
879
|
-
},
|
|
880
|
-
customFetchImpl: fetch,
|
|
881
|
-
...restOfFetchOptions,
|
|
882
|
-
plugins: [
|
|
883
|
-
lifeCyclePlugin,
|
|
884
|
-
...restOfFetchOptions.plugins || [],
|
|
885
|
-
...options?.disableDefaultFetchPlugins ? [] : [redirectPlugin],
|
|
886
|
-
...pluginsFetchPlugins
|
|
887
|
-
]
|
|
888
|
-
});
|
|
889
|
-
const { $sessionSignal, session, broadcastSessionUpdate } = getSessionAtom($fetch, options);
|
|
890
|
-
const plugins = options?.plugins || [];
|
|
891
|
-
let pluginsActions = {};
|
|
892
|
-
const pluginsAtoms = {
|
|
893
|
-
$sessionSignal,
|
|
894
|
-
session
|
|
895
|
-
};
|
|
896
|
-
const pluginPathMethods = {
|
|
897
|
-
"/sign-out": "POST",
|
|
898
|
-
"/revoke-sessions": "POST",
|
|
899
|
-
"/revoke-other-sessions": "POST",
|
|
900
|
-
"/delete-user": "POST"
|
|
901
|
-
};
|
|
902
|
-
const atomListeners = [{
|
|
903
|
-
signal: "$sessionSignal",
|
|
904
|
-
matcher(path) {
|
|
905
|
-
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";
|
|
906
|
-
},
|
|
907
|
-
callback(path) {
|
|
908
|
-
if (path === "/sign-out") broadcastSessionUpdate("signout");
|
|
909
|
-
else if (path === "/update-user" || path === "/update-session") broadcastSessionUpdate("updateUser");
|
|
910
|
-
}
|
|
911
|
-
}];
|
|
912
|
-
for (const plugin of plugins) {
|
|
913
|
-
if (plugin.getAtoms) Object.assign(pluginsAtoms, plugin.getAtoms?.($fetch));
|
|
914
|
-
if (plugin.pathMethods) Object.assign(pluginPathMethods, plugin.pathMethods);
|
|
915
|
-
if (plugin.atomListeners) atomListeners.push(...plugin.atomListeners);
|
|
916
|
-
}
|
|
917
|
-
const $store = {
|
|
918
|
-
notify: (signal) => {
|
|
919
|
-
pluginsAtoms[signal].set(!pluginsAtoms[signal].get());
|
|
920
|
-
},
|
|
921
|
-
listen: (signal, listener) => {
|
|
922
|
-
pluginsAtoms[signal].subscribe(listener);
|
|
923
|
-
},
|
|
924
|
-
atoms: pluginsAtoms
|
|
925
|
-
};
|
|
926
|
-
for (const plugin of plugins) if (plugin.getActions) pluginsActions = defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
|
|
927
|
-
return {
|
|
928
|
-
get baseURL() {
|
|
929
|
-
return baseURL;
|
|
930
|
-
},
|
|
931
|
-
pluginsActions,
|
|
932
|
-
pluginsAtoms,
|
|
933
|
-
pluginPathMethods,
|
|
934
|
-
atomListeners,
|
|
935
|
-
$fetch,
|
|
936
|
-
$store
|
|
937
|
-
};
|
|
938
|
-
};
|
|
939
|
-
function isAtom(value) {
|
|
940
|
-
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
941
|
-
}
|
|
942
|
-
function getMethod(path, knownPathMethods, args) {
|
|
943
|
-
const method = knownPathMethods[path];
|
|
944
|
-
const { fetchOptions, query: _query, ...body } = args || {};
|
|
945
|
-
if (method) return method;
|
|
946
|
-
if (fetchOptions?.method) return fetchOptions.method;
|
|
947
|
-
if (body && Object.keys(body).length > 0) return "POST";
|
|
948
|
-
return "GET";
|
|
949
|
-
}
|
|
950
|
-
function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
|
|
951
|
-
function createProxy(path = []) {
|
|
952
|
-
return new Proxy(function() {}, {
|
|
953
|
-
get(_, prop) {
|
|
954
|
-
if (typeof prop !== "string") return;
|
|
955
|
-
if (prop === "then" || prop === "catch" || prop === "finally") return;
|
|
956
|
-
const fullPath = [...path, prop];
|
|
957
|
-
let current = routes;
|
|
958
|
-
for (const segment of fullPath) if (current && typeof current === "object" && segment in current) current = current[segment];
|
|
959
|
-
else {
|
|
960
|
-
current = void 0;
|
|
961
|
-
break;
|
|
962
|
-
}
|
|
963
|
-
if (typeof current === "function") return current;
|
|
964
|
-
if (isAtom(current)) return current;
|
|
965
|
-
return createProxy(fullPath);
|
|
966
|
-
},
|
|
967
|
-
apply: async (_, __, args) => {
|
|
968
|
-
const routePath = "/" + path.map(toKebabCase).join("/");
|
|
969
|
-
const arg = args[0] || {};
|
|
970
|
-
const fetchOptions = args[1] || {};
|
|
971
|
-
const { query, fetchOptions: argFetchOptions, ...body } = arg;
|
|
972
|
-
const options = {
|
|
973
|
-
...fetchOptions,
|
|
974
|
-
...argFetchOptions
|
|
975
|
-
};
|
|
976
|
-
const method = getMethod(routePath, knownPathMethods, arg);
|
|
977
|
-
return await client(routePath, {
|
|
978
|
-
...options,
|
|
979
|
-
body: method === "GET" ? void 0 : {
|
|
980
|
-
...body,
|
|
981
|
-
...options?.body || {}
|
|
982
|
-
},
|
|
983
|
-
query: query || options?.query,
|
|
984
|
-
method,
|
|
985
|
-
async onSuccess(context) {
|
|
986
|
-
await options?.onSuccess?.(context);
|
|
987
|
-
if (!atomListeners || options.disableSignal) return;
|
|
988
|
-
/**
|
|
989
|
-
* We trigger listeners
|
|
990
|
-
*/
|
|
991
|
-
const matches = atomListeners.filter((s) => s.matcher(routePath));
|
|
992
|
-
if (!matches.length) return;
|
|
993
|
-
const visited = /* @__PURE__ */ new Set();
|
|
994
|
-
for (const match of matches) {
|
|
995
|
-
const signal = atoms[match.signal];
|
|
996
|
-
if (!signal) return;
|
|
997
|
-
if (visited.has(match.signal)) continue;
|
|
998
|
-
visited.add(match.signal);
|
|
999
|
-
/**
|
|
1000
|
-
* To avoid race conditions we set the signal in a setTimeout
|
|
1001
|
-
*/
|
|
1002
|
-
const val = signal.get();
|
|
1003
|
-
setTimeout(() => {
|
|
1004
|
-
signal.set(!val);
|
|
1005
|
-
}, 10);
|
|
1006
|
-
match.callback?.(routePath);
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
});
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
}
|
|
1013
|
-
return createProxy();
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Subscribe to store changes and get store's value.
|
|
1017
|
-
*
|
|
1018
|
-
* Can be used with store builder too.
|
|
1019
|
-
*
|
|
1020
|
-
* ```js
|
|
1021
|
-
* import { useStore } from 'nanostores/react'
|
|
1022
|
-
*
|
|
1023
|
-
* import { router } from '../store/router'
|
|
1024
|
-
*
|
|
1025
|
-
* export const Layout = () => {
|
|
1026
|
-
* let page = useStore(router)
|
|
1027
|
-
* if (page.route === 'home') {
|
|
1028
|
-
* return <HomePage />
|
|
1029
|
-
* } else {
|
|
1030
|
-
* return <Error404 />
|
|
1031
|
-
* }
|
|
1032
|
-
* }
|
|
1033
|
-
* ```
|
|
1034
|
-
*
|
|
1035
|
-
* @param store Store instance.
|
|
1036
|
-
* @returns Store value.
|
|
1037
|
-
*/
|
|
1038
|
-
function useStore(store, options = {}) {
|
|
1039
|
-
const snapshotRef = (0, import_react.useRef)(store.get());
|
|
1040
|
-
const { keys, deps = [store, keys] } = options;
|
|
1041
|
-
const subscribe = (0, import_react.useCallback)((onChange) => {
|
|
1042
|
-
const emitChange = (value) => {
|
|
1043
|
-
if (snapshotRef.current === value) return;
|
|
1044
|
-
snapshotRef.current = value;
|
|
1045
|
-
onChange();
|
|
1046
|
-
};
|
|
1047
|
-
emitChange(store.value);
|
|
1048
|
-
if (keys?.length) return listenKeys(store, keys, emitChange);
|
|
1049
|
-
return store.listen(emitChange);
|
|
1050
|
-
}, deps);
|
|
1051
|
-
const get = () => snapshotRef.current;
|
|
1052
|
-
return (0, import_react.useSyncExternalStore)(subscribe, get, get);
|
|
1053
|
-
}
|
|
1054
|
-
function getAtomKey(str) {
|
|
1055
|
-
return `use${capitalizeFirstLetter(str)}`;
|
|
1056
|
-
}
|
|
1057
|
-
function createAuthClient(options) {
|
|
1058
|
-
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, $store, atomListeners } = getClientConfig(options);
|
|
1059
|
-
const resolvedHooks = {};
|
|
1060
|
-
for (const [key, value] of Object.entries(pluginsAtoms)) resolvedHooks[getAtomKey(key)] = () => useStore(value);
|
|
1061
|
-
return createDynamicPathProxy({
|
|
1062
|
-
...pluginsActions,
|
|
1063
|
-
...resolvedHooks,
|
|
1064
|
-
$fetch,
|
|
1065
|
-
$store
|
|
1066
|
-
}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
1067
|
-
}
|
|
1068
|
-
var { signIn, signOut, useSession } = createAuthClient();
|
|
1069
|
-
//#endregion
|
|
1070
|
-
export { signIn as C, stopRun as D, stopLoop as E, useSession as O, runLoop as S, startLoop as T, listLoops as _, PievoLogo as a, patchLoop as b, deleteLoop as c, getArtifacts as d, getAuthState as f, lifecyclePresentation as g, getRunDiff as h, OpenModeWarning as i, deriveLoopLifecycle as l, getLoopDetail as m, GITHUB_URL as n, createSsrRpc as o, getConfig as p, GitHubIcon as r, daemonStopSupport as s, DAEMON_UPGRADE_REQUIRED as t, getArtifact as u, loadOlderRuns as v, signOut as w, pauseLoop as x, mintConnectKey as y };
|