@concavejs/devtools 0.0.1-alpha.4
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.
Potentially problematic release.
This version of @concavejs/devtools might be problematic. Click here for more details.
- package/README.md +263 -0
- package/dist/client-D6NyDOCN.js +2781 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.js +5 -0
- package/dist/extension/page-agent.d.ts +8 -0
- package/dist/extension/panel.d.ts +14 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +380 -0
- package/dist/interceptor/index.d.ts +5 -0
- package/dist/interceptor/websocket-interceptor.d.ts +67 -0
- package/dist/overlay/ActivityPanel.d.ts +10 -0
- package/dist/overlay/ContextMenu.d.ts +23 -0
- package/dist/overlay/DataInspector.d.ts +12 -0
- package/dist/overlay/DevToolbar.d.ts +11 -0
- package/dist/overlay/LogsPanel.d.ts +10 -0
- package/dist/overlay/NetworkPanel.d.ts +9 -0
- package/dist/overlay/PerformancePanel.d.ts +10 -0
- package/dist/overlay/SearchField.d.ts +9 -0
- package/dist/overlay/SettingsPanel.d.ts +9 -0
- package/dist/overlay/SubscriptionsPanel.d.ts +9 -0
- package/dist/overlay/TimelinePanel.d.ts +9 -0
- package/dist/overlay/utils.d.ts +16 -0
- package/dist/standalone.d.ts +11 -0
- package/dist/store/event-store.d.ts +165 -0
- package/dist/store/safe-storage.d.ts +7 -0
- package/dist/types.d.ts +146 -0
- package/dist/version.d.ts +10 -0
- package/dist/vite-plugin/index.d.ts +16 -0
- package/dist/vite-plugin.js +544 -0
- package/package.json +62 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side Event Store
|
|
3
|
+
*
|
|
4
|
+
* Maintains a circular buffer of events captured from WebSocket interception
|
|
5
|
+
* with persistence, export/import, and time-travel capabilities
|
|
6
|
+
*/
|
|
7
|
+
import type { DevToolsEvent, ActiveSubscription, PerformanceMetrics } from "../types";
|
|
8
|
+
export type EventListener = (event: DevToolsEvent) => void;
|
|
9
|
+
export type FocusListener = (eventId: string | null) => void;
|
|
10
|
+
export interface StoreSnapshot {
|
|
11
|
+
timestamp: number;
|
|
12
|
+
events: DevToolsEvent[];
|
|
13
|
+
subscriptions: Array<[number, ActiveSubscription]>;
|
|
14
|
+
}
|
|
15
|
+
export interface ExportedSession {
|
|
16
|
+
version: string;
|
|
17
|
+
exportedAt: number;
|
|
18
|
+
events: DevToolsEvent[];
|
|
19
|
+
subscriptions: Array<[number, ActiveSubscription]>;
|
|
20
|
+
metadata: {
|
|
21
|
+
userAgent: string;
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface EventStoreOptions {
|
|
26
|
+
maxEvents?: number;
|
|
27
|
+
storageScope?: string;
|
|
28
|
+
enablePersistence?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare class EventStore {
|
|
31
|
+
private events;
|
|
32
|
+
private maxEvents;
|
|
33
|
+
private listeners;
|
|
34
|
+
private focusListeners;
|
|
35
|
+
private subscriptions;
|
|
36
|
+
private snapshots;
|
|
37
|
+
private maxSnapshots;
|
|
38
|
+
private isPaused;
|
|
39
|
+
private focusedEventId;
|
|
40
|
+
private readonly storageKey;
|
|
41
|
+
private readonly settingsKey;
|
|
42
|
+
private readonly persistenceEnabled;
|
|
43
|
+
private recentEventIds;
|
|
44
|
+
private persistTimer;
|
|
45
|
+
private settings;
|
|
46
|
+
private static readonly MIN_EVENTS;
|
|
47
|
+
private static readonly MAX_EVENTS;
|
|
48
|
+
constructor(options?: number | EventStoreOptions, legacyStorageScope?: string);
|
|
49
|
+
/**
|
|
50
|
+
* Add an event to the store
|
|
51
|
+
*/
|
|
52
|
+
addEvent(event: DevToolsEvent): void;
|
|
53
|
+
/**
|
|
54
|
+
* Subscribe to new events
|
|
55
|
+
*/
|
|
56
|
+
subscribe(listener: EventListener): () => void;
|
|
57
|
+
/**
|
|
58
|
+
* Subscribe to focus/navigation changes across panels
|
|
59
|
+
*/
|
|
60
|
+
subscribeFocus(listener: FocusListener): () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Set the currently focused event (for cross-panel navigation)
|
|
63
|
+
*/
|
|
64
|
+
setFocusedEventId(eventId: string | null): void;
|
|
65
|
+
/**
|
|
66
|
+
* Get focused event id
|
|
67
|
+
*/
|
|
68
|
+
getFocusedEventId(): string | null;
|
|
69
|
+
/**
|
|
70
|
+
* Get all events
|
|
71
|
+
*/
|
|
72
|
+
getAllEvents(): DevToolsEvent[];
|
|
73
|
+
/**
|
|
74
|
+
* Get events by type
|
|
75
|
+
*/
|
|
76
|
+
getEventsByType<T extends DevToolsEvent>(type: T["type"]): T[];
|
|
77
|
+
/**
|
|
78
|
+
* Get recent events
|
|
79
|
+
*/
|
|
80
|
+
getRecentEvents(count: number): DevToolsEvent[];
|
|
81
|
+
/**
|
|
82
|
+
* Get events for a specific function
|
|
83
|
+
*/
|
|
84
|
+
getEventsByFunction(udfPath: string): DevToolsEvent[];
|
|
85
|
+
/**
|
|
86
|
+
* Get active subscriptions
|
|
87
|
+
*/
|
|
88
|
+
getActiveSubscriptions(): ActiveSubscription[];
|
|
89
|
+
/**
|
|
90
|
+
* Get subscription by query ID
|
|
91
|
+
*/
|
|
92
|
+
getSubscription(queryId: number): ActiveSubscription | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Calculate performance metrics
|
|
95
|
+
*/
|
|
96
|
+
getPerformanceMetrics(): PerformanceMetrics;
|
|
97
|
+
/**
|
|
98
|
+
* Clear all events
|
|
99
|
+
*/
|
|
100
|
+
clear(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Pause event capture
|
|
103
|
+
*/
|
|
104
|
+
pause(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Resume event capture
|
|
107
|
+
*/
|
|
108
|
+
resume(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Check if paused
|
|
111
|
+
*/
|
|
112
|
+
isPausedState(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Create a snapshot of current state (for time-travel)
|
|
115
|
+
*/
|
|
116
|
+
createSnapshot(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Restore from a snapshot
|
|
119
|
+
*/
|
|
120
|
+
restoreSnapshot(timestamp: number): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Get all snapshots
|
|
123
|
+
*/
|
|
124
|
+
getSnapshots(): StoreSnapshot[];
|
|
125
|
+
/**
|
|
126
|
+
* Export session data
|
|
127
|
+
*/
|
|
128
|
+
exportSession(): ExportedSession;
|
|
129
|
+
/**
|
|
130
|
+
* Import session data
|
|
131
|
+
*/
|
|
132
|
+
importSession(session: ExportedSession): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Save settings
|
|
135
|
+
*/
|
|
136
|
+
saveSettings(settings: Partial<typeof this.settings>): void;
|
|
137
|
+
/**
|
|
138
|
+
* Get settings
|
|
139
|
+
*/
|
|
140
|
+
getSettings(): typeof this.settings;
|
|
141
|
+
/**
|
|
142
|
+
* Whether this store supports local persistence
|
|
143
|
+
*/
|
|
144
|
+
isPersistenceEnabled(): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Load settings from localStorage
|
|
147
|
+
*/
|
|
148
|
+
private loadSettings;
|
|
149
|
+
/**
|
|
150
|
+
* Persist events to localStorage
|
|
151
|
+
*/
|
|
152
|
+
private persistEvents;
|
|
153
|
+
/**
|
|
154
|
+
* Load persisted events from localStorage
|
|
155
|
+
*/
|
|
156
|
+
private loadPersistedEvents;
|
|
157
|
+
/**
|
|
158
|
+
* Update subscription tracking
|
|
159
|
+
*/
|
|
160
|
+
private updateSubscription;
|
|
161
|
+
private sanitizeEvents;
|
|
162
|
+
private isEventLike;
|
|
163
|
+
private normalizeMaxEvents;
|
|
164
|
+
}
|
|
165
|
+
export declare function getGlobalEventStore(): EventStore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe localStorage wrapper that gracefully handles sandboxed iframes,
|
|
3
|
+
* restrictive CSP, and other environments where localStorage is unavailable.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getItem(key: string): string | null;
|
|
6
|
+
export declare function setItem(key: string, value: string): void;
|
|
7
|
+
export declare function removeItem(key: string): void;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Devtools Event Types
|
|
3
|
+
*
|
|
4
|
+
* These types represent the telemetry data captured from the Convex sync protocol
|
|
5
|
+
*/
|
|
6
|
+
export type JSONValue = null | boolean | number | string | JSONValue[] | {
|
|
7
|
+
[key: string]: JSONValue;
|
|
8
|
+
};
|
|
9
|
+
export type EventType = "query" | "mutation" | "action" | "subscription" | "log" | "auth";
|
|
10
|
+
export type EventStatus = "pending" | "success" | "error";
|
|
11
|
+
export type SubscriptionStatus = "added" | "updated" | "removed";
|
|
12
|
+
/**
|
|
13
|
+
* Base event interface
|
|
14
|
+
*/
|
|
15
|
+
export interface BaseEvent {
|
|
16
|
+
id: string;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
type: EventType;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Query execution event (captured from AddQuery + QueryUpdated/QueryFailed)
|
|
22
|
+
*/
|
|
23
|
+
export interface QueryEvent extends BaseEvent {
|
|
24
|
+
type: "query";
|
|
25
|
+
queryId: number;
|
|
26
|
+
udfPath: string;
|
|
27
|
+
args: JSONValue[];
|
|
28
|
+
componentPath?: string;
|
|
29
|
+
status: EventStatus;
|
|
30
|
+
result?: JSONValue;
|
|
31
|
+
error?: string;
|
|
32
|
+
logLines?: string[];
|
|
33
|
+
duration?: number;
|
|
34
|
+
/** ID of the mutation that likely triggered this query update */
|
|
35
|
+
triggeredBy?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Mutation execution event (captured from MutationRequest + MutationResponse)
|
|
39
|
+
*/
|
|
40
|
+
export interface MutationEvent extends BaseEvent {
|
|
41
|
+
type: "mutation";
|
|
42
|
+
requestId: number;
|
|
43
|
+
udfPath: string;
|
|
44
|
+
args: JSONValue[];
|
|
45
|
+
componentPath?: string;
|
|
46
|
+
status: EventStatus;
|
|
47
|
+
result?: JSONValue;
|
|
48
|
+
error?: string;
|
|
49
|
+
logLines?: string[];
|
|
50
|
+
duration?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Action execution event (captured from ActionRequest + ActionResponse)
|
|
54
|
+
*/
|
|
55
|
+
export interface ActionEvent extends BaseEvent {
|
|
56
|
+
type: "action";
|
|
57
|
+
requestId: number;
|
|
58
|
+
udfPath: string;
|
|
59
|
+
args: JSONValue[];
|
|
60
|
+
componentPath?: string;
|
|
61
|
+
status: EventStatus;
|
|
62
|
+
result?: JSONValue;
|
|
63
|
+
error?: string;
|
|
64
|
+
logLines?: string[];
|
|
65
|
+
duration?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Subscription event (captured from ModifyQuerySet)
|
|
69
|
+
*/
|
|
70
|
+
export interface SubscriptionEvent extends BaseEvent {
|
|
71
|
+
type: "subscription";
|
|
72
|
+
queryId: number;
|
|
73
|
+
udfPath: string;
|
|
74
|
+
args: JSONValue[];
|
|
75
|
+
componentPath?: string;
|
|
76
|
+
status: SubscriptionStatus;
|
|
77
|
+
updateCount?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Log event (extracted from logLines in responses)
|
|
81
|
+
*/
|
|
82
|
+
export interface LogEvent extends BaseEvent {
|
|
83
|
+
type: "log";
|
|
84
|
+
level: "log" | "info" | "warn" | "error";
|
|
85
|
+
message: string;
|
|
86
|
+
relatedEventId?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Authentication protocol event (Connect / Authenticate / AuthError / Authenticated)
|
|
90
|
+
*/
|
|
91
|
+
export interface AuthEvent extends BaseEvent {
|
|
92
|
+
type: "auth";
|
|
93
|
+
direction: "client" | "server";
|
|
94
|
+
messageType: string;
|
|
95
|
+
status: EventStatus;
|
|
96
|
+
tokenType?: string;
|
|
97
|
+
error?: string;
|
|
98
|
+
details?: JSONValue;
|
|
99
|
+
}
|
|
100
|
+
export type DevToolsEvent = QueryEvent | MutationEvent | ActionEvent | SubscriptionEvent | LogEvent | AuthEvent;
|
|
101
|
+
/**
|
|
102
|
+
* Active subscription tracking
|
|
103
|
+
*/
|
|
104
|
+
export interface ActiveSubscription {
|
|
105
|
+
queryId: number;
|
|
106
|
+
udfPath: string;
|
|
107
|
+
args: JSONValue[];
|
|
108
|
+
componentPath?: string;
|
|
109
|
+
addedAt: number;
|
|
110
|
+
updateCount: number;
|
|
111
|
+
lastUpdate: number;
|
|
112
|
+
currentValue?: JSONValue;
|
|
113
|
+
previousValue?: JSONValue;
|
|
114
|
+
status: "active" | "error";
|
|
115
|
+
error?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Performance metrics
|
|
119
|
+
*/
|
|
120
|
+
export interface PerformanceMetrics {
|
|
121
|
+
totalQueries: number;
|
|
122
|
+
totalMutations: number;
|
|
123
|
+
totalActions: number;
|
|
124
|
+
avgQueryDuration: number;
|
|
125
|
+
avgMutationDuration: number;
|
|
126
|
+
avgActionDuration: number;
|
|
127
|
+
p50QueryDuration: number;
|
|
128
|
+
p50MutationDuration: number;
|
|
129
|
+
p50ActionDuration: number;
|
|
130
|
+
p90QueryDuration: number;
|
|
131
|
+
p90MutationDuration: number;
|
|
132
|
+
p90ActionDuration: number;
|
|
133
|
+
p95QueryDuration: number;
|
|
134
|
+
p95MutationDuration: number;
|
|
135
|
+
p95ActionDuration: number;
|
|
136
|
+
p99QueryDuration: number;
|
|
137
|
+
p99MutationDuration: number;
|
|
138
|
+
p99ActionDuration: number;
|
|
139
|
+
slowestOperations: Array<{
|
|
140
|
+
type: "query" | "mutation" | "action";
|
|
141
|
+
eventId: string;
|
|
142
|
+
udfPath: string;
|
|
143
|
+
duration: number;
|
|
144
|
+
timestamp: number;
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DevTools package semantic version (source of truth: package.json).
|
|
3
|
+
*/
|
|
4
|
+
export declare const DEVTOOLS_VERSION: string;
|
|
5
|
+
/**
|
|
6
|
+
* Chrome extension public version.
|
|
7
|
+
*
|
|
8
|
+
* Chrome Web Store requires numeric dot-separated version strings.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CHROME_EXTENSION_VERSION: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite Plugin for injecting Concave DevTools
|
|
3
|
+
*/
|
|
4
|
+
import type { Plugin } from "vite";
|
|
5
|
+
export interface DevToolsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Enable devtools (default: true in dev mode)
|
|
8
|
+
*/
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Position of the devtools overlay
|
|
12
|
+
*/
|
|
13
|
+
position?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
14
|
+
}
|
|
15
|
+
export declare function concaveDevTools(options?: DevToolsOptions): Plugin;
|
|
16
|
+
export default concaveDevTools;
|