@flanksource/clicky-ui 0.3.71 → 0.3.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data/traces/TraceEventStream.cjs +37 -7
- package/dist/data/traces/TraceEventStream.cjs.map +1 -1
- package/dist/data/traces/TraceEventStream.d.ts.map +1 -1
- package/dist/data/traces/TraceEventStream.js +37 -7
- package/dist/data/traces/TraceEventStream.js.map +1 -1
- package/dist/data/traces/TraceFeed.cjs +71 -106
- package/dist/data/traces/TraceFeed.cjs.map +1 -1
- package/dist/data/traces/TraceFeed.d.ts +3 -10
- package/dist/data/traces/TraceFeed.d.ts.map +1 -1
- package/dist/data/traces/TraceFeed.js +72 -107
- package/dist/data/traces/TraceFeed.js.map +1 -1
- package/dist/data/traces/trace-feed.cjs.map +1 -1
- package/dist/data/traces/trace-feed.d.ts +15 -0
- package/dist/data/traces/trace-feed.d.ts.map +1 -1
- package/dist/data/traces/trace-feed.js.map +1 -1
- package/dist/data/traces/use-trace-feed.cjs +100 -0
- package/dist/data/traces/use-trace-feed.cjs.map +1 -0
- package/dist/data/traces/use-trace-feed.d.ts +11 -0
- package/dist/data/traces/use-trace-feed.d.ts.map +1 -0
- package/dist/data/traces/use-trace-feed.js +100 -0
- package/dist/data/traces/use-trace-feed.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/hooks/event-hub.cjs +24 -2
- package/dist/hooks/event-hub.cjs.map +1 -1
- package/dist/hooks/event-hub.d.ts +2 -0
- package/dist/hooks/event-hub.d.ts.map +1 -1
- package/dist/hooks/event-hub.js +24 -2
- package/dist/hooks/event-hub.js.map +1 -1
- package/dist/hooks/event-stream.cjs +64 -0
- package/dist/hooks/event-stream.cjs.map +1 -0
- package/dist/hooks/event-stream.d.ts +13 -0
- package/dist/hooks/event-stream.d.ts.map +1 -0
- package/dist/hooks/event-stream.js +64 -0
- package/dist/hooks/event-stream.js.map +1 -0
- package/dist/hooks/log-tail-session.cjs +53 -0
- package/dist/hooks/log-tail-session.cjs.map +1 -0
- package/dist/hooks/log-tail-session.d.ts +31 -0
- package/dist/hooks/log-tail-session.d.ts.map +1 -0
- package/dist/hooks/log-tail-session.js +53 -0
- package/dist/hooks/log-tail-session.js.map +1 -0
- package/dist/hooks/tail-buffer.cjs +15 -0
- package/dist/hooks/tail-buffer.cjs.map +1 -0
- package/dist/hooks/tail-buffer.d.ts +11 -0
- package/dist/hooks/tail-buffer.d.ts.map +1 -0
- package/dist/hooks/tail-buffer.js +15 -0
- package/dist/hooks/tail-buffer.js.map +1 -0
- package/dist/hooks/use-live-snapshot.cjs +60 -0
- package/dist/hooks/use-live-snapshot.cjs.map +1 -0
- package/dist/hooks/use-live-snapshot.d.ts +9 -0
- package/dist/hooks/use-live-snapshot.d.ts.map +1 -0
- package/dist/hooks/use-live-snapshot.js +60 -0
- package/dist/hooks/use-live-snapshot.js.map +1 -0
- package/dist/hooks/use-log-tail.cjs +125 -112
- package/dist/hooks/use-log-tail.cjs.map +1 -1
- package/dist/hooks/use-log-tail.d.ts +2 -24
- package/dist/hooks/use-log-tail.d.ts.map +1 -1
- package/dist/hooks/use-log-tail.js +125 -112
- package/dist/hooks/use-log-tail.js.map +1 -1
- package/dist/hooks.cjs +6 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +4 -1
- package/dist/index.cjs +6 -0
- package/dist/index.js +4 -1
- package/dist/runtime/barrels.json +6995 -6986
- package/dist/runtime/importmap.json +2120 -2115
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/hooks/log-tail-session.ts
|
|
2
|
+
async function startLogTailSession({ basePath, profile, paramsQuery, signal }) {
|
|
3
|
+
if (typeof globalThis.EventSource === "undefined") return { error: {
|
|
4
|
+
scope: "start",
|
|
5
|
+
message: `cannot follow ${profile}: this browser has no EventSource, and session events are served only as SSE`
|
|
6
|
+
} };
|
|
7
|
+
try {
|
|
8
|
+
const res = await fetch(`${basePath}/profile/${encodeURIComponent(profile)}/sessions?follow=true${paramsQuery}`, {
|
|
9
|
+
method: "POST",
|
|
10
|
+
headers: { Accept: "application/json" },
|
|
11
|
+
signal
|
|
12
|
+
});
|
|
13
|
+
if (signal.aborted) throw signal.reason;
|
|
14
|
+
if (!res.ok) {
|
|
15
|
+
const detail = (await res.text()).trim() || "no detail";
|
|
16
|
+
return { error: {
|
|
17
|
+
scope: "start",
|
|
18
|
+
httpStatus: res.status,
|
|
19
|
+
message: res.status === 409 ? `the server is already running as many follow sessions as it allows (HTTP 409): ${detail}` : `could not start a follow session for ${profile} (HTTP ${res.status}): ${detail}`
|
|
20
|
+
} };
|
|
21
|
+
}
|
|
22
|
+
return { info: await res.json() };
|
|
23
|
+
} catch (cause) {
|
|
24
|
+
return { error: {
|
|
25
|
+
scope: "start",
|
|
26
|
+
message: `could not reach ${basePath} to start a follow session for ${profile}: ${String(cause)}`
|
|
27
|
+
} };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function openLogTailSession({ onStart, onError, ...request }) {
|
|
31
|
+
const aborter = new AbortController();
|
|
32
|
+
let closeSource;
|
|
33
|
+
startLogTailSession({
|
|
34
|
+
...request,
|
|
35
|
+
signal: aborter.signal
|
|
36
|
+
}).then((result) => {
|
|
37
|
+
if (aborter.signal.aborted) return;
|
|
38
|
+
if ("error" in result) {
|
|
39
|
+
onError(result.error);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const close = onStart(result.info);
|
|
43
|
+
if (aborter.signal.aborted) close();
|
|
44
|
+
else closeSource = close;
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
aborter.abort();
|
|
48
|
+
closeSource?.();
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export { openLogTailSession };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=log-tail-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-tail-session.js","names":[],"sources":["../../src/hooks/log-tail-session.ts"],"sourcesContent":["import type { SessionState } from \"../rpc/sessionTypes\";\n\n/** SessionInfo as returned by POST /profile/{name}/sessions and the `done` frame. */\nexport interface LogSessionInfo {\n id: string;\n profile: string;\n kind: string;\n state: SessionState;\n params?: Record<string, unknown>;\n error?: string;\n eventCount: number;\n startedAt: string;\n stoppedAt?: string;\n}\n\nexport interface LogTailError {\n /** Identifies a start failure, an error while streaming, or a session that ended in failure. */\n scope: \"start\" | \"stream\" | \"session\";\n message: string;\n /** HTTP status when a request produced the failure. 409 is the session cap. */\n httpStatus?: number;\n}\n\ninterface LogTailSessionRequest {\n basePath: string;\n profile: string;\n paramsQuery: string;\n}\n\nasync function startLogTailSession({ basePath, profile, paramsQuery, signal }: LogTailSessionRequest & {\n signal: AbortSignal;\n}): Promise<{ info: LogSessionInfo } | { error: LogTailError }> {\n if (typeof globalThis.EventSource === \"undefined\") {\n return { error: {\n scope: \"start\",\n message: `cannot follow ${profile}: this browser has no EventSource, and session events are served only as SSE`,\n } };\n }\n\n try {\n const res = await fetch(\n `${basePath}/profile/${encodeURIComponent(profile)}/sessions?follow=true${paramsQuery}`,\n { method: \"POST\", headers: { Accept: \"application/json\" }, signal },\n );\n if (signal.aborted) throw signal.reason;\n if (!res.ok) {\n const detail = (await res.text()).trim() || \"no detail\";\n return { error: {\n scope: \"start\",\n httpStatus: res.status,\n message: res.status === 409\n ? `the server is already running as many follow sessions as it allows (HTTP 409): ${detail}`\n : `could not start a follow session for ${profile} (HTTP ${res.status}): ${detail}`,\n } };\n }\n return { info: (await res.json()) as LogSessionInfo };\n } catch (cause) {\n return { error: {\n scope: \"start\",\n message: `could not reach ${basePath} to start a follow session for ${profile}: ${String(cause)}`,\n } };\n }\n}\n\nexport function openLogTailSession({ onStart, onError, ...request }: LogTailSessionRequest & {\n onStart: (info: LogSessionInfo) => () => void;\n onError: (error: LogTailError) => void;\n}): () => void {\n const aborter = new AbortController();\n let closeSource: (() => void) | undefined;\n void startLogTailSession({ ...request, signal: aborter.signal }).then(result => {\n if (aborter.signal.aborted) return;\n if (\"error\" in result) {\n onError(result.error);\n return;\n }\n const close = onStart(result.info);\n if (aborter.signal.aborted) close();\n else closeSource = close;\n });\n // A view session without a subscriber ends server-side.\n return () => {\n aborter.abort();\n closeSource?.();\n };\n}\n"],"mappings":";AA6BA,eAAe,oBAAoB,EAAE,UAAU,SAAS,aAAa,UAEL;CAC9D,IAAI,OAAO,WAAW,gBAAgB,aACpC,OAAO,EAAE,OAAO;EACd,OAAO;EACP,SAAS,iBAAiB,QAAQ;CACpC,EAAE;CAGJ,IAAI;EACF,MAAM,MAAM,MAAM,MAChB,GAAG,SAAS,WAAW,mBAAmB,OAAO,EAAE,uBAAuB,eAC1E;GAAE,QAAQ;GAAQ,SAAS,EAAE,QAAQ,mBAAmB;GAAG;EAAO,CACpE;EACA,IAAI,OAAO,SAAS,MAAM,OAAO;EACjC,IAAI,CAAC,IAAI,IAAI;GACX,MAAM,UAAU,MAAM,IAAI,KAAK,EAAA,CAAG,KAAK,KAAK;GAC5C,OAAO,EAAE,OAAO;IACd,OAAO;IACP,YAAY,IAAI;IAChB,SAAS,IAAI,WAAW,MACpB,kFAAkF,WAClF,wCAAwC,QAAQ,SAAS,IAAI,OAAO,KAAK;GAC/E,EAAE;EACJ;EACA,OAAO,EAAE,MAAO,MAAM,IAAI,KAAK,EAAqB;CACtD,SAAS,OAAO;EACd,OAAO,EAAE,OAAO;GACd,OAAO;GACP,SAAS,mBAAmB,SAAS,iCAAiC,QAAQ,IAAI,OAAO,KAAK;EAChG,EAAE;CACJ;AACF;AAEA,SAAgB,mBAAmB,EAAE,SAAS,SAAS,GAAG,WAG3C;CACb,MAAM,UAAU,IAAI,gBAAgB;CACpC,IAAI;CACJ,oBAAyB;EAAE,GAAG;EAAS,QAAQ,QAAQ;CAAO,CAAC,CAAC,CAAC,MAAK,WAAU;EAC9E,IAAI,QAAQ,OAAO,SAAS;EAC5B,IAAI,WAAW,QAAQ;GACrB,QAAQ,OAAO,KAAK;GACpB;EACF;EACA,MAAM,QAAQ,QAAQ,OAAO,IAAI;EACjC,IAAI,QAAQ,OAAO,SAAS,MAAM;OAC7B,cAAc;CACrB,CAAC;CAED,aAAa;EACX,QAAQ,MAAM;EACd,cAAc;CAChB;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/hooks/tail-buffer.ts
|
|
2
|
+
function appendTailRows(current, incoming, options) {
|
|
3
|
+
const { key, order, limit } = options;
|
|
4
|
+
const rows = [...current, ...incoming];
|
|
5
|
+
const unique = key ? [...new Map(rows.map((row) => [key(row), row])).values()] : rows;
|
|
6
|
+
const sorted = order ? order(unique) : unique;
|
|
7
|
+
const dropped = Math.max(0, sorted.length - Math.max(1, limit));
|
|
8
|
+
return {
|
|
9
|
+
rows: sorted.slice(dropped),
|
|
10
|
+
dropped
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.appendTailRows = appendTailRows;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=tail-buffer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail-buffer.cjs","names":[],"sources":["../../src/hooks/tail-buffer.ts"],"sourcesContent":["interface TailBufferOptions<T> {\n limit: number;\n key?: (row: T) => string;\n order?: (rows: T[]) => T[];\n}\n\nexport function appendTailRows<T>(current: readonly T[], incoming: readonly T[], options: TailBufferOptions<T>) {\n const { key, order, limit } = options;\n const rows = [...current, ...incoming];\n const unique = key ? [...new Map(rows.map(row => [key(row), row])).values()] : rows;\n const sorted = order ? order(unique) : unique;\n const dropped = Math.max(0, sorted.length - Math.max(1, limit));\n return { rows: sorted.slice(dropped), dropped };\n}\n"],"mappings":";AAMA,SAAgB,eAAkB,SAAuB,UAAwB,SAA+B;CAC9G,MAAM,EAAE,KAAK,OAAO,UAAU;CAC9B,MAAM,OAAO,CAAC,GAAG,SAAS,GAAG,QAAQ;CACrC,MAAM,SAAS,MAAM,CAAC,GAAG,IAAI,IAAI,KAAK,KAAI,QAAO,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI;CAC/E,MAAM,SAAS,QAAQ,MAAM,MAAM,IAAI;CACvC,MAAM,UAAU,KAAK,IAAI,GAAG,OAAO,SAAS,KAAK,IAAI,GAAG,KAAK,CAAC;CAC9D,OAAO;EAAE,MAAM,OAAO,MAAM,OAAO;EAAG;CAAQ;AAChD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface TailBufferOptions<T> {
|
|
2
|
+
limit: number;
|
|
3
|
+
key?: (row: T) => string;
|
|
4
|
+
order?: (rows: T[]) => T[];
|
|
5
|
+
}
|
|
6
|
+
export declare function appendTailRows<T>(current: readonly T[], incoming: readonly T[], options: TailBufferOptions<T>): {
|
|
7
|
+
rows: T[];
|
|
8
|
+
dropped: number;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=tail-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail-buffer.d.ts","sourceRoot":"","sources":["../../src/hooks/tail-buffer.ts"],"names":[],"mappings":"AAAA,UAAU,iBAAiB,CAAC,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;;;EAO7G"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/hooks/tail-buffer.ts
|
|
2
|
+
function appendTailRows(current, incoming, options) {
|
|
3
|
+
const { key, order, limit } = options;
|
|
4
|
+
const rows = [...current, ...incoming];
|
|
5
|
+
const unique = key ? [...new Map(rows.map((row) => [key(row), row])).values()] : rows;
|
|
6
|
+
const sorted = order ? order(unique) : unique;
|
|
7
|
+
const dropped = Math.max(0, sorted.length - Math.max(1, limit));
|
|
8
|
+
return {
|
|
9
|
+
rows: sorted.slice(dropped),
|
|
10
|
+
dropped
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export { appendTailRows };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=tail-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail-buffer.js","names":[],"sources":["../../src/hooks/tail-buffer.ts"],"sourcesContent":["interface TailBufferOptions<T> {\n limit: number;\n key?: (row: T) => string;\n order?: (rows: T[]) => T[];\n}\n\nexport function appendTailRows<T>(current: readonly T[], incoming: readonly T[], options: TailBufferOptions<T>) {\n const { key, order, limit } = options;\n const rows = [...current, ...incoming];\n const unique = key ? [...new Map(rows.map(row => [key(row), row])).values()] : rows;\n const sorted = order ? order(unique) : unique;\n const dropped = Math.max(0, sorted.length - Math.max(1, limit));\n return { rows: sorted.slice(dropped), dropped };\n}\n"],"mappings":";AAMA,SAAgB,eAAkB,SAAuB,UAAwB,SAA+B;CAC9G,MAAM,EAAE,KAAK,OAAO,UAAU;CAC9B,MAAM,OAAO,CAAC,GAAG,SAAS,GAAG,QAAQ;CACrC,MAAM,SAAS,MAAM,CAAC,GAAG,IAAI,IAAI,KAAK,KAAI,QAAO,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI;CAC/E,MAAM,SAAS,QAAQ,MAAM,MAAM,IAAI;CACvC,MAAM,UAAU,KAAK,IAAI,GAAG,OAAO,SAAS,KAAK,IAAI,GAAG,KAAK,CAAC;CAC9D,OAAO;EAAE,MAAM,OAAO,MAAM,OAAO;EAAG;CAAQ;AAChD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const require_event_source = require("./event-source.cjs");
|
|
2
|
+
const require_event_stream = require("./event-stream.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
// src/hooks/use-live-snapshot.ts
|
|
5
|
+
/** The latest snapshot for a URL. A suspended subscription retains its last frame. */
|
|
6
|
+
function useLiveSnapshot(url, merge) {
|
|
7
|
+
const factory = require_event_source.useEventSourceFactory();
|
|
8
|
+
const [snapshot, setSnapshot] = (0, react.useState)({ url: "" });
|
|
9
|
+
const [attempt, setAttempt] = (0, react.useState)(0);
|
|
10
|
+
const latest = (0, react.useRef)({ url: "" });
|
|
11
|
+
const mergeRef = (0, react.useRef)(merge);
|
|
12
|
+
(0, react.useEffect)(() => {
|
|
13
|
+
mergeRef.current = merge;
|
|
14
|
+
}, [merge]);
|
|
15
|
+
(0, react.useEffect)(() => {
|
|
16
|
+
if (!url) return;
|
|
17
|
+
const update = (value) => setSnapshot((previous) => ({
|
|
18
|
+
...previous.url === url ? previous : { url },
|
|
19
|
+
...value
|
|
20
|
+
}));
|
|
21
|
+
return require_event_stream.subscribeJSON(factory, url, {
|
|
22
|
+
onOpen: () => update({
|
|
23
|
+
error: void 0,
|
|
24
|
+
ended: false
|
|
25
|
+
}),
|
|
26
|
+
onData: (change) => {
|
|
27
|
+
const previous = latest.current.url === url ? latest.current.data : void 0;
|
|
28
|
+
const data = mergeRef.current ? mergeRef.current(previous, change) : change;
|
|
29
|
+
latest.current = {
|
|
30
|
+
url,
|
|
31
|
+
data
|
|
32
|
+
};
|
|
33
|
+
setSnapshot(latest.current);
|
|
34
|
+
},
|
|
35
|
+
onError: (error, terminal) => update({
|
|
36
|
+
error,
|
|
37
|
+
ended: terminal
|
|
38
|
+
}),
|
|
39
|
+
onEnd: () => update({
|
|
40
|
+
error: void 0,
|
|
41
|
+
ended: true
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}, [
|
|
45
|
+
factory,
|
|
46
|
+
url,
|
|
47
|
+
attempt
|
|
48
|
+
]);
|
|
49
|
+
const value = url === null || snapshot.url === url ? snapshot : void 0;
|
|
50
|
+
return {
|
|
51
|
+
data: value?.data,
|
|
52
|
+
error: value?.error,
|
|
53
|
+
ended: value?.ended ?? false,
|
|
54
|
+
pending: !!url && value?.data === void 0 && !value?.ended,
|
|
55
|
+
refresh: () => setAttempt((previous) => previous + 1)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.useLiveSnapshot = useLiveSnapshot;
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=use-live-snapshot.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-live-snapshot.cjs","names":["useEventSourceFactory","useState","useRef","subscribeJSON"],"sources":["../../src/hooks/use-live-snapshot.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useEventSourceFactory } from \"./event-source\";\nimport { subscribeJSON } from \"./event-stream\";\n\ninterface LiveSnapshot<T> {\n url: string;\n data?: T;\n error?: Error | undefined;\n ended?: boolean;\n}\n\n/** The latest snapshot for a URL. A suspended subscription retains its last frame. */\nexport function useLiveSnapshot<T, Change = T>(url: string | null, merge?: (previous: T | undefined, change: Change) => T) {\n const factory = useEventSourceFactory();\n const [snapshot, setSnapshot] = useState<LiveSnapshot<T>>({ url: \"\" });\n const [attempt, setAttempt] = useState(0);\n const latest = useRef<Pick<LiveSnapshot<T>, \"url\" | \"data\">>({ url: \"\" });\n const mergeRef = useRef(merge);\n\n useEffect(() => {\n mergeRef.current = merge;\n }, [merge]);\n\n useEffect(() => {\n if (!url) return;\n const update = (value: Partial<LiveSnapshot<T>>) => setSnapshot(previous => ({ ...(previous.url === url ? previous : { url }), ...value }));\n return subscribeJSON<Change>(factory, url, {\n onOpen: () => update({ error: undefined, ended: false }),\n onData: change => {\n const previous = latest.current.url === url ? latest.current.data : undefined;\n const data = mergeRef.current ? mergeRef.current(previous, change) : change as unknown as T;\n latest.current = { url, data };\n setSnapshot(latest.current);\n },\n onError: (error, terminal) => update({ error, ended: terminal }),\n onEnd: () => update({ error: undefined, ended: true }),\n });\n }, [factory, url, attempt]);\n\n const value = url === null || snapshot.url === url ? snapshot : undefined;\n return { data: value?.data, error: value?.error, ended: value?.ended ?? false, pending: !!url && value?.data === undefined && !value?.ended, refresh: () => setAttempt(previous => previous + 1) };\n}\n"],"mappings":";;;;;AAYA,SAAgB,gBAA+B,KAAoB,OAAwD;CACzH,MAAM,UAAUA,qBAAAA,sBAAsB;CACtC,MAAM,CAAC,UAAU,gBAAA,GAAeC,MAAAA,SAAAA,CAA0B,EAAE,KAAK,GAAG,CAAC;CACrE,MAAM,CAAC,SAAS,eAAA,GAAcA,MAAAA,SAAAA,CAAS,CAAC;CACxC,MAAM,UAAA,GAASC,MAAAA,OAAAA,CAA8C,EAAE,KAAK,GAAG,CAAC;CACxE,MAAM,YAAA,GAAWA,MAAAA,OAAAA,CAAO,KAAK;CAE7B,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,SAAS,UAAU;CACrB,GAAG,CAAC,KAAK,CAAC;CAEV,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,CAAC,KAAK;EACV,MAAM,UAAU,UAAoC,aAAY,cAAa;GAAE,GAAI,SAAS,QAAQ,MAAM,WAAW,EAAE,IAAI;GAAI,GAAG;EAAM,EAAE;EAC1I,OAAOC,qBAAAA,cAAsB,SAAS,KAAK;GACzC,cAAc,OAAO;IAAE,OAAO,KAAA;IAAW,OAAO;GAAM,CAAC;GACvD,SAAQ,WAAU;IAChB,MAAM,WAAW,OAAO,QAAQ,QAAQ,MAAM,OAAO,QAAQ,OAAO,KAAA;IACpE,MAAM,OAAO,SAAS,UAAU,SAAS,QAAQ,UAAU,MAAM,IAAI;IACrE,OAAO,UAAU;KAAE;KAAK;IAAK;IAC7B,YAAY,OAAO,OAAO;GAC5B;GACA,UAAU,OAAO,aAAa,OAAO;IAAE;IAAO,OAAO;GAAS,CAAC;GAC/D,aAAa,OAAO;IAAE,OAAO,KAAA;IAAW,OAAO;GAAK,CAAC;EACvD,CAAC;CACH,GAAG;EAAC;EAAS;EAAK;CAAO,CAAC;CAE1B,MAAM,QAAQ,QAAQ,QAAQ,SAAS,QAAQ,MAAM,WAAW,KAAA;CAChE,OAAO;EAAE,MAAM,OAAO;EAAM,OAAO,OAAO;EAAO,OAAO,OAAO,SAAS;EAAO,SAAS,CAAC,CAAC,OAAO,OAAO,SAAS,KAAA,KAAa,CAAC,OAAO;EAAO,eAAe,YAAW,aAAY,WAAW,CAAC;CAAE;AACnM"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The latest snapshot for a URL. A suspended subscription retains its last frame. */
|
|
2
|
+
export declare function useLiveSnapshot<T, Change = T>(url: string | null, merge?: (previous: T | undefined, change: Change) => T): {
|
|
3
|
+
data: T | undefined;
|
|
4
|
+
error: Error | undefined;
|
|
5
|
+
ended: boolean;
|
|
6
|
+
pending: boolean;
|
|
7
|
+
refresh: () => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=use-live-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-live-snapshot.d.ts","sourceRoot":"","sources":["../../src/hooks/use-live-snapshot.ts"],"names":[],"mappings":"AAWA,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;;;;;;EA6BxH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEventSourceFactory } from "./event-source.js";
|
|
2
|
+
import { subscribeJSON } from "./event-stream.js";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
// src/hooks/use-live-snapshot.ts
|
|
5
|
+
/** The latest snapshot for a URL. A suspended subscription retains its last frame. */
|
|
6
|
+
function useLiveSnapshot(url, merge) {
|
|
7
|
+
const factory = useEventSourceFactory();
|
|
8
|
+
const [snapshot, setSnapshot] = useState({ url: "" });
|
|
9
|
+
const [attempt, setAttempt] = useState(0);
|
|
10
|
+
const latest = useRef({ url: "" });
|
|
11
|
+
const mergeRef = useRef(merge);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
mergeRef.current = merge;
|
|
14
|
+
}, [merge]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!url) return;
|
|
17
|
+
const update = (value) => setSnapshot((previous) => ({
|
|
18
|
+
...previous.url === url ? previous : { url },
|
|
19
|
+
...value
|
|
20
|
+
}));
|
|
21
|
+
return subscribeJSON(factory, url, {
|
|
22
|
+
onOpen: () => update({
|
|
23
|
+
error: void 0,
|
|
24
|
+
ended: false
|
|
25
|
+
}),
|
|
26
|
+
onData: (change) => {
|
|
27
|
+
const previous = latest.current.url === url ? latest.current.data : void 0;
|
|
28
|
+
const data = mergeRef.current ? mergeRef.current(previous, change) : change;
|
|
29
|
+
latest.current = {
|
|
30
|
+
url,
|
|
31
|
+
data
|
|
32
|
+
};
|
|
33
|
+
setSnapshot(latest.current);
|
|
34
|
+
},
|
|
35
|
+
onError: (error, terminal) => update({
|
|
36
|
+
error,
|
|
37
|
+
ended: terminal
|
|
38
|
+
}),
|
|
39
|
+
onEnd: () => update({
|
|
40
|
+
error: void 0,
|
|
41
|
+
ended: true
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}, [
|
|
45
|
+
factory,
|
|
46
|
+
url,
|
|
47
|
+
attempt
|
|
48
|
+
]);
|
|
49
|
+
const value = url === null || snapshot.url === url ? snapshot : void 0;
|
|
50
|
+
return {
|
|
51
|
+
data: value?.data,
|
|
52
|
+
error: value?.error,
|
|
53
|
+
ended: value?.ended ?? false,
|
|
54
|
+
pending: !!url && value?.data === void 0 && !value?.ended,
|
|
55
|
+
refresh: () => setAttempt((previous) => previous + 1)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export { useLiveSnapshot };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=use-live-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-live-snapshot.js","names":[],"sources":["../../src/hooks/use-live-snapshot.ts"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useEventSourceFactory } from \"./event-source\";\nimport { subscribeJSON } from \"./event-stream\";\n\ninterface LiveSnapshot<T> {\n url: string;\n data?: T;\n error?: Error | undefined;\n ended?: boolean;\n}\n\n/** The latest snapshot for a URL. A suspended subscription retains its last frame. */\nexport function useLiveSnapshot<T, Change = T>(url: string | null, merge?: (previous: T | undefined, change: Change) => T) {\n const factory = useEventSourceFactory();\n const [snapshot, setSnapshot] = useState<LiveSnapshot<T>>({ url: \"\" });\n const [attempt, setAttempt] = useState(0);\n const latest = useRef<Pick<LiveSnapshot<T>, \"url\" | \"data\">>({ url: \"\" });\n const mergeRef = useRef(merge);\n\n useEffect(() => {\n mergeRef.current = merge;\n }, [merge]);\n\n useEffect(() => {\n if (!url) return;\n const update = (value: Partial<LiveSnapshot<T>>) => setSnapshot(previous => ({ ...(previous.url === url ? previous : { url }), ...value }));\n return subscribeJSON<Change>(factory, url, {\n onOpen: () => update({ error: undefined, ended: false }),\n onData: change => {\n const previous = latest.current.url === url ? latest.current.data : undefined;\n const data = mergeRef.current ? mergeRef.current(previous, change) : change as unknown as T;\n latest.current = { url, data };\n setSnapshot(latest.current);\n },\n onError: (error, terminal) => update({ error, ended: terminal }),\n onEnd: () => update({ error: undefined, ended: true }),\n });\n }, [factory, url, attempt]);\n\n const value = url === null || snapshot.url === url ? snapshot : undefined;\n return { data: value?.data, error: value?.error, ended: value?.ended ?? false, pending: !!url && value?.data === undefined && !value?.ended, refresh: () => setAttempt(previous => previous + 1) };\n}\n"],"mappings":";;;;;AAYA,SAAgB,gBAA+B,KAAoB,OAAwD;CACzH,MAAM,UAAU,sBAAsB;CACtC,MAAM,CAAC,UAAU,eAAe,SAA0B,EAAE,KAAK,GAAG,CAAC;CACrE,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC;CACxC,MAAM,SAAS,OAA8C,EAAE,KAAK,GAAG,CAAC;CACxE,MAAM,WAAW,OAAO,KAAK;CAE7B,gBAAgB;EACd,SAAS,UAAU;CACrB,GAAG,CAAC,KAAK,CAAC;CAEV,gBAAgB;EACd,IAAI,CAAC,KAAK;EACV,MAAM,UAAU,UAAoC,aAAY,cAAa;GAAE,GAAI,SAAS,QAAQ,MAAM,WAAW,EAAE,IAAI;GAAI,GAAG;EAAM,EAAE;EAC1I,OAAO,cAAsB,SAAS,KAAK;GACzC,cAAc,OAAO;IAAE,OAAO,KAAA;IAAW,OAAO;GAAM,CAAC;GACvD,SAAQ,WAAU;IAChB,MAAM,WAAW,OAAO,QAAQ,QAAQ,MAAM,OAAO,QAAQ,OAAO,KAAA;IACpE,MAAM,OAAO,SAAS,UAAU,SAAS,QAAQ,UAAU,MAAM,IAAI;IACrE,OAAO,UAAU;KAAE;KAAK;IAAK;IAC7B,YAAY,OAAO,OAAO;GAC5B;GACA,UAAU,OAAO,aAAa,OAAO;IAAE;IAAO,OAAO;GAAS,CAAC;GAC/D,aAAa,OAAO;IAAE,OAAO,KAAA;IAAW,OAAO;GAAK,CAAC;EACvD,CAAC;CACH,GAAG;EAAC;EAAS;EAAK;CAAO,CAAC;CAE1B,MAAM,QAAQ,QAAQ,QAAQ,SAAS,QAAQ,MAAM,WAAW,KAAA;CAChE,OAAO;EAAE,MAAM,OAAO;EAAM,OAAO,OAAO;EAAO,OAAO,OAAO,SAAS;EAAO,SAAS,CAAC,CAAC,OAAO,OAAO,SAAS,KAAA,KAAa,CAAC,OAAO;EAAO,eAAe,YAAW,aAAY,WAAW,CAAC;CAAE;AACnM"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const require_sessionTypes = require("../rpc/sessionTypes.cjs");
|
|
2
2
|
const require_event_source = require("./event-source.cjs");
|
|
3
|
+
const require_event_stream = require("./event-stream.cjs");
|
|
4
|
+
const require_log_tail_session = require("./log-tail-session.cjs");
|
|
5
|
+
const require_tail_buffer = require("./tail-buffer.cjs");
|
|
3
6
|
let react = require("react");
|
|
4
7
|
// src/hooks/use-log-tail.ts
|
|
5
8
|
/**
|
|
@@ -61,160 +64,170 @@ function appendTailEvent(buffer, event, maxRows) {
|
|
|
61
64
|
lastSequence: event.sequence
|
|
62
65
|
};
|
|
63
66
|
const incomingClickyRows = event.rows ? event.rows.map(() => void 0) : [event.clickyRow];
|
|
64
|
-
const
|
|
65
|
-
const mergedClickyRows = buffer.clickyRows.concat(incomingClickyRows);
|
|
66
|
-
const overflow = Math.max(0, merged.length - Math.max(1, maxRows));
|
|
67
|
+
const { rows, dropped } = require_tail_buffer.appendTailRows(buffer.rows, incoming, { limit: maxRows });
|
|
67
68
|
return {
|
|
68
|
-
rows
|
|
69
|
-
clickyRows:
|
|
69
|
+
rows,
|
|
70
|
+
clickyRows: buffer.clickyRows.concat(incomingClickyRows).slice(dropped),
|
|
70
71
|
lastSequence: event.sequence,
|
|
71
|
-
dropped: buffer.dropped +
|
|
72
|
+
dropped: buffer.dropped + dropped
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
var DEFAULT_BASE = "/api/v1";
|
|
75
76
|
var DEFAULT_MAX_ROWS = 5e3;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
var emptyLogTailSnapshot = {
|
|
78
|
+
request: null,
|
|
79
|
+
buffer: emptyLogTailBuffer,
|
|
80
|
+
status: "idle",
|
|
81
|
+
error: null,
|
|
82
|
+
session: null
|
|
83
|
+
};
|
|
79
84
|
function useLogTail(options) {
|
|
80
85
|
const { profile, params, basePath = DEFAULT_BASE, following: wantFollow = false, maxRows = DEFAULT_MAX_ROWS, onEvent } = options;
|
|
81
|
-
const [
|
|
82
|
-
const [status, setStatus] = (0, react.useState)("idle");
|
|
83
|
-
const [error, setError] = (0, react.useState)(null);
|
|
84
|
-
const [session, setSession] = (0, react.useState)(null);
|
|
85
|
-
const maxRowsRef = (0, react.useRef)(maxRows);
|
|
86
|
-
maxRowsRef.current = maxRows;
|
|
87
|
-
const onEventRef = (0, react.useRef)(onEvent);
|
|
88
|
-
onEventRef.current = onEvent;
|
|
86
|
+
const [snapshot, setSnapshot] = (0, react.useState)(emptyLogTailSnapshot);
|
|
89
87
|
const eventSourceFactory = require_event_source.useEventSourceFactory();
|
|
90
|
-
const
|
|
91
|
-
|
|
88
|
+
const streamOptions = (0, react.useRef)({
|
|
89
|
+
maxRows,
|
|
90
|
+
onEvent,
|
|
91
|
+
eventSourceFactory
|
|
92
|
+
});
|
|
93
|
+
(0, react.useEffect)(() => {
|
|
94
|
+
streamOptions.current = {
|
|
95
|
+
maxRows,
|
|
96
|
+
onEvent,
|
|
97
|
+
eventSourceFactory
|
|
98
|
+
};
|
|
99
|
+
}, [
|
|
100
|
+
maxRows,
|
|
101
|
+
onEvent,
|
|
102
|
+
eventSourceFactory
|
|
103
|
+
]);
|
|
92
104
|
const paramsQuery = encodeTailParams(params);
|
|
105
|
+
const key = wantFollow ? JSON.stringify([
|
|
106
|
+
basePath,
|
|
107
|
+
profile,
|
|
108
|
+
paramsQuery
|
|
109
|
+
]) : null;
|
|
110
|
+
const { request, buffer, error, session } = snapshot;
|
|
111
|
+
if (key !== (request?.key ?? null)) setSnapshot(key === null ? {
|
|
112
|
+
...snapshot,
|
|
113
|
+
request: null
|
|
114
|
+
} : {
|
|
115
|
+
...emptyLogTailSnapshot,
|
|
116
|
+
request: {
|
|
117
|
+
key,
|
|
118
|
+
basePath,
|
|
119
|
+
profile,
|
|
120
|
+
paramsQuery
|
|
121
|
+
},
|
|
122
|
+
status: "starting"
|
|
123
|
+
});
|
|
93
124
|
(0, react.useEffect)(() => {
|
|
94
|
-
if (!
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
scope: "start",
|
|
102
|
-
message: `cannot follow ${profile}: this browser has no EventSource, and session events are served only as SSE`
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
setStatus("starting");
|
|
107
|
-
let cancelled = false;
|
|
108
|
-
const aborter = new AbortController();
|
|
109
|
-
let source;
|
|
125
|
+
if (!request) return;
|
|
126
|
+
const update = (fields) => {
|
|
127
|
+
setSnapshot((current) => current.request === request ? {
|
|
128
|
+
...current,
|
|
129
|
+
...fields
|
|
130
|
+
} : current);
|
|
131
|
+
};
|
|
110
132
|
let ended = false;
|
|
111
133
|
let delivered = null;
|
|
112
134
|
const deliver = (event) => {
|
|
113
135
|
if (delivered !== null && event.sequence <= delivered) return;
|
|
114
136
|
delivered = event.sequence;
|
|
115
137
|
try {
|
|
116
|
-
|
|
138
|
+
streamOptions.current.onEvent?.(event);
|
|
117
139
|
} catch (cause) {
|
|
118
|
-
|
|
140
|
+
update({ error: {
|
|
119
141
|
scope: "stream",
|
|
120
142
|
message: `onEvent threw on sequence ${event.sequence}: ${String(cause)}`
|
|
121
|
-
});
|
|
143
|
+
} });
|
|
122
144
|
}
|
|
123
145
|
};
|
|
124
146
|
const apply = (event) => {
|
|
125
|
-
|
|
147
|
+
const { maxRows: limit } = streamOptions.current;
|
|
148
|
+
if (event.error) update({ error: {
|
|
126
149
|
scope: "stream",
|
|
127
150
|
message: event.error
|
|
128
|
-
});
|
|
151
|
+
} });
|
|
129
152
|
deliver(event);
|
|
130
|
-
|
|
153
|
+
setSnapshot((current) => {
|
|
154
|
+
if (current.request !== request) return current;
|
|
155
|
+
const next = appendTailEvent(current.buffer, event, limit);
|
|
156
|
+
return next === current.buffer ? current : {
|
|
157
|
+
...current,
|
|
158
|
+
buffer: next
|
|
159
|
+
};
|
|
160
|
+
});
|
|
131
161
|
};
|
|
132
162
|
const readFrame = (label, e) => {
|
|
133
163
|
try {
|
|
134
164
|
return JSON.parse(e.data);
|
|
135
165
|
} catch (cause) {
|
|
136
|
-
|
|
166
|
+
update({ error: {
|
|
137
167
|
scope: "stream",
|
|
138
168
|
message: `unparseable ${label} frame: ${String(cause)}`
|
|
139
|
-
});
|
|
169
|
+
} });
|
|
140
170
|
return;
|
|
141
171
|
}
|
|
142
172
|
};
|
|
143
173
|
const settle = (info) => {
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
174
|
+
ended = isTerminalSessionState(info.state);
|
|
175
|
+
if (info.state === "failed") update({
|
|
176
|
+
session: info,
|
|
177
|
+
status: info.state,
|
|
178
|
+
error: {
|
|
179
|
+
scope: "session",
|
|
180
|
+
message: info.error || `session ${info.id} failed without reporting a reason`
|
|
181
|
+
}
|
|
151
182
|
});
|
|
183
|
+
else update(ended ? {
|
|
184
|
+
session: info,
|
|
185
|
+
status: info.state
|
|
186
|
+
} : { session: info });
|
|
152
187
|
};
|
|
153
|
-
const subscribe = (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
es.addEventListener("event", (e) => {
|
|
158
|
-
const frame = readFrame("event", e);
|
|
159
|
-
if (frame) apply(frame);
|
|
160
|
-
});
|
|
161
|
-
es.addEventListener("done", (e) => {
|
|
162
|
-
const info = readFrame("done", e);
|
|
163
|
-
if (info) settle(info);
|
|
164
|
-
es.close();
|
|
188
|
+
const subscribe = (info) => {
|
|
189
|
+
update({
|
|
190
|
+
session: info,
|
|
191
|
+
status: "streaming"
|
|
165
192
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
193
|
+
return require_event_stream.subscribeJSON(streamOptions.current.eventSourceFactory, `${request.basePath}/sessions/${encodeURIComponent(info.id)}/events`, {
|
|
194
|
+
messageEvent: "event",
|
|
195
|
+
endEvent: "done",
|
|
196
|
+
onOpen: () => update({ status: "streaming" }),
|
|
197
|
+
onData: apply,
|
|
198
|
+
onInvalidMessage: (error) => update({ error: {
|
|
199
|
+
scope: "stream",
|
|
200
|
+
message: error.message
|
|
201
|
+
} }),
|
|
202
|
+
onEnd: (event) => {
|
|
203
|
+
const info = readFrame("done", event);
|
|
204
|
+
if (info) settle(info);
|
|
205
|
+
else update({ status: "failed" });
|
|
206
|
+
},
|
|
207
|
+
onError: (error, terminal) => {
|
|
208
|
+
if (ended) return;
|
|
209
|
+
update(terminal ? {
|
|
210
|
+
status: "failed",
|
|
211
|
+
error: {
|
|
212
|
+
scope: "stream",
|
|
213
|
+
message: error.message
|
|
214
|
+
}
|
|
215
|
+
} : { status: "connection lost — retrying" });
|
|
188
216
|
}
|
|
189
|
-
|
|
190
|
-
} catch (cause) {
|
|
191
|
-
if (cancelled) return;
|
|
192
|
-
setStatus("failed");
|
|
193
|
-
setError({
|
|
194
|
-
scope: "start",
|
|
195
|
-
message: `could not reach ${basePath} to start a follow session for ${profile}: ${String(cause)}`
|
|
196
|
-
});
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if (cancelled) return;
|
|
200
|
-
setSession(info);
|
|
201
|
-
subscribe(info.id);
|
|
202
|
-
};
|
|
203
|
-
start();
|
|
204
|
-
return () => {
|
|
205
|
-
cancelled = true;
|
|
206
|
-
aborter.abort();
|
|
207
|
-
source?.close();
|
|
217
|
+
});
|
|
208
218
|
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
return require_log_tail_session.openLogTailSession({
|
|
220
|
+
basePath: request.basePath,
|
|
221
|
+
profile: request.profile,
|
|
222
|
+
paramsQuery: request.paramsQuery,
|
|
223
|
+
onStart: subscribe,
|
|
224
|
+
onError: (error) => update({
|
|
225
|
+
status: "failed",
|
|
226
|
+
error
|
|
227
|
+
})
|
|
228
|
+
});
|
|
229
|
+
}, [request]);
|
|
230
|
+
const status = request === null && !isTerminalTailStatus(snapshot.status) ? "idle" : snapshot.status;
|
|
218
231
|
return {
|
|
219
232
|
rows: buffer.rows,
|
|
220
233
|
clickyRows: buffer.clickyRows,
|