durable-actors-observer 0.16.0 → 0.17.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/dist/client/DatatContext.d.ts +2 -0
- package/dist/client/cacheKeys.d.ts +1 -3
- package/dist/client/events.d.ts +22 -0
- package/dist/components/actorType/timingCard.d.ts +1 -2
- package/dist/components/ui/residencyBar.d.ts +3 -4
- package/dist/components/ui/statCard.d.ts +1 -2
- package/dist/components/ui/trendCard.d.ts +2 -11
- package/dist/format.d.ts +1 -2
- package/dist/hooks/useActorRequests.d.ts +2 -3
- package/dist/hooks/useActors.d.ts +3 -3
- package/dist/hooks/useLiveView.d.ts +11 -0
- package/dist/hooks/useNow.d.ts +2 -0
- package/dist/hooks/useRequests.d.ts +3 -3
- package/dist/hooks/useWebSockets.d.ts +3 -3
- package/dist/index.js +1327 -1153
- package/dist/lib/requestStats.d.ts +0 -3
- package/dist/lib/sockets.d.ts +1 -1
- package/dist/lib/timeRange.d.ts +3 -2
- package/dist/lib/views/actors.d.ts +6 -0
- package/dist/lib/views/logs.d.ts +15 -0
- package/dist/lib/views/requests.d.ts +8 -0
- package/dist/lib/views/residency.d.ts +4 -0
- package/dist/lib/views/sockets.d.ts +5 -0
- package/dist/standalone/app.css +1 -1
- package/dist/standalone/app.js +15 -15
- package/dist/theme.css +1 -1
- package/dist/types/Actors.d.ts +13 -6
- package/dist/types/Events.d.ts +71 -0
- package/dist/types/Overview.d.ts +0 -8
- package/dist/types/Requests.d.ts +1 -3
- package/dist/types/Sockets.d.ts +10 -5
- package/package.json +1 -1
- package/dist/client/streams/actorStream.d.ts +0 -2
- package/dist/client/streams/logStream.d.ts +0 -2
- package/dist/client/streams/requestStream.d.ts +0 -2
- package/dist/components/overview/trendCard.d.ts +0 -22
- package/dist/components/ui/delta.d.ts +0 -5
- package/dist/hooks/useWindowedSWR.d.ts +0 -5
|
@@ -2,8 +2,10 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { ActorInventory } from "../types/Actors.js";
|
|
3
3
|
import type { RequestTrace } from "../types/Requests.js";
|
|
4
4
|
import type { SocketSession } from "../types/Sockets.js";
|
|
5
|
+
import type { EventBus } from "./events.js";
|
|
5
6
|
type DataContextType = {
|
|
6
7
|
baseUrl: string;
|
|
8
|
+
events: EventBus | null;
|
|
7
9
|
actorTypes: ActorInventory | null;
|
|
8
10
|
isError: boolean;
|
|
9
11
|
requests: RequestTrace[] | null;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { LogFilter } from "../types/Logs.js";
|
|
2
2
|
export declare const actorsKey: (baseUrl: string) => readonly ["actors", string];
|
|
3
|
-
export declare const actorEventsKey: (baseUrl: string) => readonly ["actors/events", string];
|
|
4
3
|
export declare const requestsKey: (baseUrl: string) => readonly ["requests", string];
|
|
5
|
-
export declare const requestEventsKey: (baseUrl: string, durationMs: number) => readonly ["requests/events", string, number];
|
|
6
4
|
export declare const residencyKey: (baseUrl: string, actorName: string) => readonly ["residency", string, string];
|
|
7
5
|
export declare const webSocketsKey: (baseUrl: string) => readonly ["websockets", string];
|
|
8
6
|
export declare const logsKey: (baseUrl: string, { actorName, actorId, requestId, level, search }: LogFilter) => readonly ["logs", string, string, string, string | null, import("../types/Logs.js").LogLevel | null, string];
|
|
9
7
|
export declare const logHistogramKey: (baseUrl: string, { actorName, actorId, requestId, search }: LogFilter) => readonly ["logs/histogram", string, string, string, string | null, string];
|
|
10
|
-
export declare const
|
|
8
|
+
export declare const logLinesKey: (baseUrl: string, filter: LogFilter) => readonly ["logs/streamed", ...(string | null)[]];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ObserveEvent } from "../types/Events.js";
|
|
2
|
+
type Listener = (events: ObserveEvent[]) => void;
|
|
3
|
+
/**
|
|
4
|
+
* The events one `observe/events` stream delivers. Views read the store when they open, then
|
|
5
|
+
* apply each event; the recent ones are applied again on top of every read so a change the store
|
|
6
|
+
* has yet to receive is not lost.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EventBus {
|
|
9
|
+
private readonly listeners;
|
|
10
|
+
private readonly reconnectListeners;
|
|
11
|
+
private recent;
|
|
12
|
+
subscribe(listener: Listener): () => void;
|
|
13
|
+
/** Runs after the stream reconnects, when events may have been missed. */
|
|
14
|
+
onReconnect(listener: () => void): () => void;
|
|
15
|
+
/** Forgets the recent events when the stream starts over with a different query. */
|
|
16
|
+
reset(): void;
|
|
17
|
+
recentEvents(): ObserveEvent[];
|
|
18
|
+
publish(events: ObserveEvent[]): void;
|
|
19
|
+
reconnected(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare function openEventStream(baseUrl: string, query: URLSearchParams, bus: EventBus): () => void;
|
|
22
|
+
export {};
|
|
@@ -3,7 +3,6 @@ import type { RequestTrace } from "../../types/Requests.js";
|
|
|
3
3
|
import type { TimeWindow } from "../../types/TimeRange.js";
|
|
4
4
|
export type TimingCardProps = {
|
|
5
5
|
label: string;
|
|
6
|
-
window: string;
|
|
7
6
|
pick: TimingPick;
|
|
8
7
|
color: string;
|
|
9
8
|
chartLabel: string;
|
|
@@ -11,4 +10,4 @@ export type TimingCardProps = {
|
|
|
11
10
|
failed: boolean;
|
|
12
11
|
timeWindow: TimeWindow;
|
|
13
12
|
};
|
|
14
|
-
export declare function TimingCard({ label,
|
|
13
|
+
export declare function TimingCard({ label, pick, color, chartLabel, requests, failed, timeWindow }: TimingCardProps): import("react").JSX.Element;
|
|
@@ -7,9 +7,8 @@ export type ResidencyBarProps = {
|
|
|
7
7
|
style?: CSSProperties;
|
|
8
8
|
};
|
|
9
9
|
export declare function ResidencyBar({ liveShare, label, pulse, className, style }: ResidencyBarProps): import("react").JSX.Element;
|
|
10
|
-
export declare function ResidencyLegend({ live, dormant
|
|
11
|
-
live
|
|
12
|
-
dormant
|
|
13
|
-
showCounts?: boolean;
|
|
10
|
+
export declare function ResidencyLegend({ live, dormant }: {
|
|
11
|
+
live?: number;
|
|
12
|
+
dormant?: number;
|
|
14
13
|
}): import("react").JSX.Element;
|
|
15
14
|
export declare function ResidencyBarSkeleton(): import("react").JSX.Element;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
export type StatCardProps = {
|
|
3
3
|
label: string;
|
|
4
|
-
aside?: ReactNode;
|
|
5
4
|
value?: ReactNode;
|
|
6
5
|
unit?: ReactNode;
|
|
7
6
|
busy?: boolean;
|
|
8
7
|
children?: ReactNode;
|
|
9
8
|
};
|
|
10
|
-
export declare function StatCard({ label,
|
|
9
|
+
export declare function StatCard({ label, value, unit, busy, children }: StatCardProps): import("react").JSX.Element;
|
|
11
10
|
export declare function StatFigure({ value, unit, className }: {
|
|
12
11
|
value: ReactNode;
|
|
13
12
|
unit?: ReactNode;
|
|
@@ -2,23 +2,14 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import { type PointDescription } from "./sparkline.js";
|
|
3
3
|
export type TrendCardProps = {
|
|
4
4
|
label: string;
|
|
5
|
-
window: string;
|
|
6
5
|
value: ReactNode;
|
|
7
6
|
unit: ReactNode;
|
|
8
7
|
busy?: boolean;
|
|
8
|
+
failed?: boolean;
|
|
9
9
|
series: number[];
|
|
10
10
|
axis: string[];
|
|
11
11
|
color: string;
|
|
12
12
|
chartLabel: string;
|
|
13
13
|
describePoint: (index: number) => PointDescription;
|
|
14
|
-
children: ReactNode;
|
|
15
14
|
};
|
|
16
|
-
export declare function TrendCard({ label,
|
|
17
|
-
export declare function TrendStatsSkeleton({ failed }: {
|
|
18
|
-
failed: boolean;
|
|
19
|
-
}): import("react").JSX.Element;
|
|
20
|
-
export declare function TrendStat({ label, value, suffix }: {
|
|
21
|
-
label: string;
|
|
22
|
-
value: string;
|
|
23
|
-
suffix?: string;
|
|
24
|
-
}): import("react").JSX.Element;
|
|
15
|
+
export declare function TrendCard({ label, value, unit, busy, failed, series, axis, color, chartLabel, describePoint }: TrendCardProps): import("react").JSX.Element;
|
package/dist/format.d.ts
CHANGED
|
@@ -8,10 +8,9 @@ export declare const formatLogClock: (ms: number) => string;
|
|
|
8
8
|
export declare const formatCount: (value: number) => string;
|
|
9
9
|
export declare const formatDecimal: (value: number) => string;
|
|
10
10
|
export declare const formatPercent: (ratio: number) => string;
|
|
11
|
-
export declare const formatSignedPercent: (ratio: number) => string;
|
|
12
|
-
export declare const formatMsValue: (ms: number) => string;
|
|
13
11
|
export declare const formatMs: (ms: number) => string;
|
|
14
12
|
export declare const formatMegabytes: (bytes: number) => string;
|
|
15
13
|
export declare const formatPlural: (value: number, noun: string) => string;
|
|
14
|
+
export declare function formatMsParts(ms: number): [value: string, unit: string];
|
|
16
15
|
export declare function formatDuration(ms: number): string;
|
|
17
16
|
export declare function formatAgo(ms: number, now: number): string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { RequestTrace } from "../types/Requests.js";
|
|
2
1
|
export declare function useActorTypeRequests(actorName: string): {
|
|
3
|
-
requests: RequestTrace[] | null;
|
|
2
|
+
requests: import("../types/Requests.js").RequestTrace[] | null;
|
|
4
3
|
isLoading: boolean;
|
|
5
4
|
isError: boolean;
|
|
6
5
|
error: any;
|
|
7
6
|
};
|
|
8
7
|
export declare function useInstanceRequests(actorName: string, actorId: string): {
|
|
9
|
-
requests: RequestTrace[] | null;
|
|
8
|
+
requests: import("../types/Requests.js").RequestTrace[] | null;
|
|
10
9
|
isLoading: boolean;
|
|
11
10
|
isError: boolean;
|
|
12
11
|
error: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useActors(baseUrl: string): {
|
|
3
|
-
|
|
1
|
+
import type { EventBus } from "../client/events.js";
|
|
2
|
+
export declare function useActors(baseUrl: string, events: EventBus | null): {
|
|
3
|
+
inventory: import("../types/Actors.js").ActorInventory | null;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
isError: boolean;
|
|
6
6
|
error: any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Key, type SWRConfiguration } from "swr";
|
|
2
|
+
import { EventBus } from "../client/events.js";
|
|
3
|
+
import type { ObserveEvent } from "../types/Events.js";
|
|
4
|
+
export type ApplyEvents<T> = (data: T, events: ObserveEvent[]) => T;
|
|
5
|
+
/**
|
|
6
|
+
* The standard way a view stays current: read the store when the view opens, then apply each
|
|
7
|
+
* event from the stream. Without a bus the view is a plain read.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useLiveView<T>(key: Key, read: () => Promise<T>, apply: ApplyEvents<T>, bus: EventBus | null, config?: SWRConfiguration<T>): import("swr").SWRResponse<T, any, SWRConfiguration<T, any, import("swr").BareFetcher<T>> | undefined>;
|
|
10
|
+
/** One `observe/events` stream for as long as the caller is mounted with a query. */
|
|
11
|
+
export declare function useEventStream(baseUrl: string, query: URLSearchParams | null): EventBus | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EventBus } from "../client/events.js";
|
|
2
2
|
import type { TimeWindow } from "../types/TimeRange.js";
|
|
3
|
-
export declare function useRequests(baseUrl: string, timeWindow: TimeWindow): {
|
|
4
|
-
requests: RequestTrace[] | null;
|
|
3
|
+
export declare function useRequests(baseUrl: string, timeWindow: TimeWindow, events: EventBus | null): {
|
|
4
|
+
requests: import("../types/Requests.js").RequestTrace[] | null;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
isError: boolean;
|
|
7
7
|
error: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useWebSockets(baseUrl: string): {
|
|
3
|
-
sessions: SocketSession[] | null;
|
|
1
|
+
import type { EventBus } from "../client/events.js";
|
|
2
|
+
export declare function useWebSockets(baseUrl: string, events: EventBus | null): {
|
|
3
|
+
sessions: import("../types/Sockets.js").SocketSession[] | null;
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
isError: boolean;
|
|
6
6
|
error: any;
|