@buoy-gg/events 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +58 -0
- package/README.md +55 -0
- package/lib/commonjs/components/EventsCopySettingsView.js +645 -0
- package/lib/commonjs/components/EventsModal.js +263 -0
- package/lib/commonjs/components/ReactQueryEventDetail.js +428 -0
- package/lib/commonjs/components/UnifiedEventDetail.js +370 -0
- package/lib/commonjs/components/UnifiedEventFilters.js +113 -0
- package/lib/commonjs/components/UnifiedEventItem.js +349 -0
- package/lib/commonjs/components/UnifiedEventList.js +154 -0
- package/lib/commonjs/components/UnifiedEventViewer.js +126 -0
- package/lib/commonjs/hooks/useUnifiedEvents.js +237 -0
- package/lib/commonjs/index.js +205 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +66 -0
- package/lib/commonjs/stores/unifiedEventStore.js +413 -0
- package/lib/commonjs/types/copySettings.js +220 -0
- package/lib/commonjs/types/index.js +17 -0
- package/lib/commonjs/utils/autoDiscoverEventSources.js +640 -0
- package/lib/commonjs/utils/badgeSelectionStorage.js +58 -0
- package/lib/commonjs/utils/copySettingsStorage.js +66 -0
- package/lib/commonjs/utils/correlationUtils.js +130 -0
- package/lib/commonjs/utils/eventExportFormatter.js +1095 -0
- package/lib/commonjs/utils/eventTransformers.js +496 -0
- package/lib/module/components/EventsCopySettingsView.js +641 -0
- package/lib/module/components/EventsModal.js +259 -0
- package/lib/module/components/ReactQueryEventDetail.js +424 -0
- package/lib/module/components/UnifiedEventDetail.js +366 -0
- package/lib/module/components/UnifiedEventFilters.js +109 -0
- package/lib/module/components/UnifiedEventItem.js +345 -0
- package/lib/module/components/UnifiedEventList.js +150 -0
- package/lib/module/components/UnifiedEventViewer.js +122 -0
- package/lib/module/hooks/useUnifiedEvents.js +234 -0
- package/lib/module/index.js +77 -0
- package/lib/module/preset.js +62 -0
- package/lib/module/stores/unifiedEventStore.js +387 -0
- package/lib/module/types/copySettings.js +215 -0
- package/lib/module/types/index.js +37 -0
- package/lib/module/utils/autoDiscoverEventSources.js +633 -0
- package/lib/module/utils/badgeSelectionStorage.js +52 -0
- package/lib/module/utils/copySettingsStorage.js +61 -0
- package/lib/module/utils/correlationUtils.js +120 -0
- package/lib/module/utils/eventExportFormatter.js +1085 -0
- package/lib/module/utils/eventTransformers.js +487 -0
- package/lib/typescript/components/EventsCopySettingsView.d.ts +16 -0
- package/lib/typescript/components/EventsModal.d.ts +16 -0
- package/lib/typescript/components/ReactQueryEventDetail.d.ts +15 -0
- package/lib/typescript/components/UnifiedEventDetail.d.ts +15 -0
- package/lib/typescript/components/UnifiedEventFilters.d.ts +21 -0
- package/lib/typescript/components/UnifiedEventItem.d.ts +26 -0
- package/lib/typescript/components/UnifiedEventList.d.ts +27 -0
- package/lib/typescript/components/UnifiedEventViewer.d.ts +8 -0
- package/lib/typescript/hooks/useUnifiedEvents.d.ts +30 -0
- package/lib/typescript/index.d.ts +28 -0
- package/lib/typescript/preset.d.ts +62 -0
- package/lib/typescript/stores/unifiedEventStore.d.ts +146 -0
- package/lib/typescript/types/copySettings.d.ts +179 -0
- package/lib/typescript/types/index.d.ts +73 -0
- package/lib/typescript/utils/autoDiscoverEventSources.d.ts +74 -0
- package/lib/typescript/utils/badgeSelectionStorage.d.ts +21 -0
- package/lib/typescript/utils/copySettingsStorage.d.ts +21 -0
- package/lib/typescript/utils/correlationUtils.d.ts +36 -0
- package/lib/typescript/utils/eventExportFormatter.d.ts +49 -0
- package/lib/typescript/utils/eventTransformers.d.ts +119 -0
- package/package.json +91 -0
- package/src/components/EventsCopySettingsView.tsx +742 -0
- package/src/components/EventsModal.tsx +328 -0
- package/src/components/ReactQueryEventDetail.tsx +413 -0
- package/src/components/UnifiedEventDetail.tsx +371 -0
- package/src/components/UnifiedEventFilters.tsx +156 -0
- package/src/components/UnifiedEventItem.tsx +396 -0
- package/src/components/UnifiedEventList.tsx +197 -0
- package/src/components/UnifiedEventViewer.tsx +132 -0
- package/src/hooks/useUnifiedEvents.ts +288 -0
- package/src/index.tsx +112 -0
- package/src/preset.tsx +57 -0
- package/src/stores/unifiedEventStore.ts +405 -0
- package/src/types/copySettings.ts +269 -0
- package/src/types/index.ts +96 -0
- package/src/utils/autoDiscoverEventSources.ts +690 -0
- package/src/utils/badgeSelectionStorage.ts +51 -0
- package/src/utils/copySettingsStorage.ts +61 -0
- package/src/utils/correlationUtils.ts +146 -0
- package/src/utils/eventExportFormatter.ts +1233 -0
- package/src/utils/eventTransformers.ts +567 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Event Transformers
|
|
5
|
+
*
|
|
6
|
+
* Transform events from each source into the unified UnifiedEvent format.
|
|
7
|
+
*
|
|
8
|
+
* Note: These transformers use generic types to avoid hard dependencies
|
|
9
|
+
* on tool packages. The actual transformation logic is in autoDiscoverEventSources.ts.
|
|
10
|
+
* This file is kept for backwards compatibility and type exports.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
let eventIdCounter = 0;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generate a unique event ID
|
|
17
|
+
*/
|
|
18
|
+
function generateEventId(source) {
|
|
19
|
+
return `${source}-${Date.now()}-${++eventIdCounter}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Storage Event Types (for backwards compatibility)
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* AsyncStorage event action types
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Generic AsyncStorage event structure
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generic Storage event (AsyncStorage or MMKV)
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get human-readable action name for AsyncStorage events
|
|
40
|
+
*/
|
|
41
|
+
function getAsyncStorageActionLabel(action) {
|
|
42
|
+
switch (action) {
|
|
43
|
+
case "setItem":
|
|
44
|
+
return "Set Item";
|
|
45
|
+
case "removeItem":
|
|
46
|
+
return "Remove Item";
|
|
47
|
+
case "mergeItem":
|
|
48
|
+
return "Merge Item";
|
|
49
|
+
case "clear":
|
|
50
|
+
return "Clear All";
|
|
51
|
+
case "multiSet":
|
|
52
|
+
return "Multi Set";
|
|
53
|
+
case "multiRemove":
|
|
54
|
+
return "Multi Remove";
|
|
55
|
+
case "multiMerge":
|
|
56
|
+
return "Multi Merge";
|
|
57
|
+
default:
|
|
58
|
+
return action;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get subtitle for AsyncStorage event
|
|
64
|
+
*/
|
|
65
|
+
function getAsyncStorageSubtitle(event) {
|
|
66
|
+
const {
|
|
67
|
+
action,
|
|
68
|
+
data
|
|
69
|
+
} = event;
|
|
70
|
+
switch (action) {
|
|
71
|
+
case "setItem":
|
|
72
|
+
case "removeItem":
|
|
73
|
+
case "mergeItem":
|
|
74
|
+
return data?.key || "unknown key";
|
|
75
|
+
case "multiSet":
|
|
76
|
+
case "multiMerge":
|
|
77
|
+
{
|
|
78
|
+
const pairCount = data?.pairs?.length || 0;
|
|
79
|
+
return `${pairCount} key${pairCount !== 1 ? "s" : ""}`;
|
|
80
|
+
}
|
|
81
|
+
case "multiRemove":
|
|
82
|
+
{
|
|
83
|
+
const keyCount = data?.keys?.length || 0;
|
|
84
|
+
return `${keyCount} key${keyCount !== 1 ? "s" : ""}`;
|
|
85
|
+
}
|
|
86
|
+
case "clear":
|
|
87
|
+
return "all keys";
|
|
88
|
+
default:
|
|
89
|
+
return "";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get status for storage event based on action type
|
|
95
|
+
*/
|
|
96
|
+
function getStorageStatus(action) {
|
|
97
|
+
if (action.includes("set") || action.includes("Set") || action.includes("merge") || action.includes("Merge")) {
|
|
98
|
+
return "success";
|
|
99
|
+
}
|
|
100
|
+
if (action.includes("remove") || action.includes("Remove") || action === "clear" || action === "delete") {
|
|
101
|
+
return "neutral";
|
|
102
|
+
}
|
|
103
|
+
return "neutral";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Transform StorageEvent (AsyncStorage or MMKV) to UnifiedEvent
|
|
108
|
+
*/
|
|
109
|
+
export function transformStorageEvent(event) {
|
|
110
|
+
if (event.storageType === "async") {
|
|
111
|
+
const asyncEvent = event;
|
|
112
|
+
return {
|
|
113
|
+
id: generateEventId("async"),
|
|
114
|
+
source: "storage-async",
|
|
115
|
+
timestamp: asyncEvent.timestamp.getTime(),
|
|
116
|
+
title: getAsyncStorageActionLabel(asyncEvent.action),
|
|
117
|
+
subtitle: getAsyncStorageSubtitle(asyncEvent),
|
|
118
|
+
status: getStorageStatus(asyncEvent.action),
|
|
119
|
+
originalEvent: asyncEvent
|
|
120
|
+
};
|
|
121
|
+
} else {
|
|
122
|
+
const mmkvEvent = event;
|
|
123
|
+
return {
|
|
124
|
+
id: generateEventId("mmkv"),
|
|
125
|
+
source: "storage-mmkv",
|
|
126
|
+
timestamp: mmkvEvent.timestamp.getTime(),
|
|
127
|
+
title: mmkvEvent.action,
|
|
128
|
+
subtitle: mmkvEvent.data?.key || mmkvEvent.data?.instanceId || "unknown",
|
|
129
|
+
status: getStorageStatus(mmkvEvent.action),
|
|
130
|
+
originalEvent: mmkvEvent
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Legacy export for backwards compatibility
|
|
137
|
+
*/
|
|
138
|
+
export function transformAsyncStorageEvent(event) {
|
|
139
|
+
return transformStorageEvent({
|
|
140
|
+
...event,
|
|
141
|
+
storageType: "async"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ============================================================================
|
|
146
|
+
// Redux Event Types
|
|
147
|
+
// ============================================================================
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Generic Redux action structure
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Get status for Redux action based on category
|
|
155
|
+
*/
|
|
156
|
+
function getReduxStatus(action) {
|
|
157
|
+
switch (action.category) {
|
|
158
|
+
case "fulfilled":
|
|
159
|
+
return "success";
|
|
160
|
+
case "rejected":
|
|
161
|
+
return "error";
|
|
162
|
+
case "pending":
|
|
163
|
+
return "pending";
|
|
164
|
+
default:
|
|
165
|
+
return action.hasStateChange ? "success" : "neutral";
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Get subtitle for Redux action
|
|
171
|
+
*/
|
|
172
|
+
function getReduxSubtitle(action) {
|
|
173
|
+
if (action.payloadPreview) {
|
|
174
|
+
return action.payloadPreview;
|
|
175
|
+
}
|
|
176
|
+
if (action.hasStateChange && action.diffSummary) {
|
|
177
|
+
return action.diffSummary;
|
|
178
|
+
}
|
|
179
|
+
if (action.duration !== undefined) {
|
|
180
|
+
return `${action.duration.toFixed(1)}ms`;
|
|
181
|
+
}
|
|
182
|
+
return action.sliceName || "";
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Transform ReduxAction to UnifiedEvent
|
|
187
|
+
*/
|
|
188
|
+
export function transformReduxAction(action) {
|
|
189
|
+
return {
|
|
190
|
+
id: generateEventId("redux"),
|
|
191
|
+
source: "redux",
|
|
192
|
+
timestamp: action.timestamp,
|
|
193
|
+
title: action.type,
|
|
194
|
+
subtitle: getReduxSubtitle(action),
|
|
195
|
+
status: getReduxStatus(action),
|
|
196
|
+
originalEvent: action
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// Network Event Types
|
|
202
|
+
// ============================================================================
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Generic Network event structure
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Get status for network event based on HTTP status code
|
|
210
|
+
*/
|
|
211
|
+
function getNetworkStatus(event) {
|
|
212
|
+
if (event.status === undefined) {
|
|
213
|
+
return "pending";
|
|
214
|
+
}
|
|
215
|
+
if (event.error || event.status >= 400) {
|
|
216
|
+
return "error";
|
|
217
|
+
}
|
|
218
|
+
if (event.status >= 200 && event.status < 400) {
|
|
219
|
+
return "success";
|
|
220
|
+
}
|
|
221
|
+
return "neutral";
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Get title for network event
|
|
226
|
+
*/
|
|
227
|
+
function getNetworkTitle(event) {
|
|
228
|
+
if (event.operationName) {
|
|
229
|
+
return event.operationName;
|
|
230
|
+
}
|
|
231
|
+
return `${event.method} ${event.path || event.url}`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get subtitle for network event
|
|
236
|
+
*/
|
|
237
|
+
function getNetworkSubtitle(event) {
|
|
238
|
+
const parts = [];
|
|
239
|
+
if (event.status !== undefined) {
|
|
240
|
+
parts.push(`${event.status}`);
|
|
241
|
+
} else if (event.error) {
|
|
242
|
+
parts.push("Error");
|
|
243
|
+
} else {
|
|
244
|
+
parts.push("Pending");
|
|
245
|
+
}
|
|
246
|
+
if (event.duration !== undefined) {
|
|
247
|
+
parts.push(`${event.duration.toFixed(0)}ms`);
|
|
248
|
+
}
|
|
249
|
+
if (event.host) {
|
|
250
|
+
parts.push(event.host);
|
|
251
|
+
}
|
|
252
|
+
return parts.join(" · ");
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Transform NetworkEvent to UnifiedEvent
|
|
257
|
+
*/
|
|
258
|
+
export function transformNetworkEvent(event) {
|
|
259
|
+
return {
|
|
260
|
+
id: generateEventId("network"),
|
|
261
|
+
source: "network",
|
|
262
|
+
timestamp: event.timestamp,
|
|
263
|
+
title: getNetworkTitle(event),
|
|
264
|
+
subtitle: getNetworkSubtitle(event),
|
|
265
|
+
status: getNetworkStatus(event),
|
|
266
|
+
originalEvent: event
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ============================================================================
|
|
271
|
+
// React Query Event Types
|
|
272
|
+
// ============================================================================
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Generic React Query event structure
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Format query key for display
|
|
280
|
+
*/
|
|
281
|
+
function formatQueryKey(queryKey) {
|
|
282
|
+
if (!queryKey || queryKey.length === 0) return "unknown";
|
|
283
|
+
return queryKey.map(part => {
|
|
284
|
+
if (typeof part === "string") return part;
|
|
285
|
+
if (typeof part === "number") return String(part);
|
|
286
|
+
if (typeof part === "object" && part !== null) {
|
|
287
|
+
const obj = part;
|
|
288
|
+
const firstValue = Object.values(obj)[0];
|
|
289
|
+
if (typeof firstValue === "string" || typeof firstValue === "number") {
|
|
290
|
+
return String(firstValue);
|
|
291
|
+
}
|
|
292
|
+
return JSON.stringify(part).slice(0, 20);
|
|
293
|
+
}
|
|
294
|
+
return String(part);
|
|
295
|
+
}).join(" › ");
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Get status for React Query event
|
|
300
|
+
*/
|
|
301
|
+
function getReactQueryStatus(event) {
|
|
302
|
+
switch (event.type) {
|
|
303
|
+
case "query-fetch-start":
|
|
304
|
+
case "mutation-start":
|
|
305
|
+
return "pending";
|
|
306
|
+
case "query-fetch-success":
|
|
307
|
+
case "mutation-success":
|
|
308
|
+
return "success";
|
|
309
|
+
case "query-fetch-error":
|
|
310
|
+
case "mutation-error":
|
|
311
|
+
return "error";
|
|
312
|
+
case "query-invalidated":
|
|
313
|
+
return "neutral";
|
|
314
|
+
default:
|
|
315
|
+
return "neutral";
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Get title for React Query event
|
|
321
|
+
*/
|
|
322
|
+
function getReactQueryTitle(event) {
|
|
323
|
+
if (event.queryKey) {
|
|
324
|
+
return formatQueryKey(event.queryKey);
|
|
325
|
+
}
|
|
326
|
+
if (event.mutationKey) {
|
|
327
|
+
return formatQueryKey(event.mutationKey);
|
|
328
|
+
}
|
|
329
|
+
if (event.mutationId !== undefined) {
|
|
330
|
+
return `Mutation #${event.mutationId}`;
|
|
331
|
+
}
|
|
332
|
+
return event.type.replace(/-/g, " ");
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Get subtitle for React Query event
|
|
337
|
+
*/
|
|
338
|
+
function getReactQuerySubtitle(event) {
|
|
339
|
+
const parts = [];
|
|
340
|
+
switch (event.type) {
|
|
341
|
+
case "query-fetch-start":
|
|
342
|
+
parts.push("Fetching");
|
|
343
|
+
break;
|
|
344
|
+
case "query-fetch-success":
|
|
345
|
+
parts.push("Success");
|
|
346
|
+
break;
|
|
347
|
+
case "query-fetch-error":
|
|
348
|
+
parts.push("Error");
|
|
349
|
+
break;
|
|
350
|
+
case "query-invalidated":
|
|
351
|
+
parts.push("Invalidated");
|
|
352
|
+
break;
|
|
353
|
+
case "mutation-start":
|
|
354
|
+
parts.push("Mutating");
|
|
355
|
+
break;
|
|
356
|
+
case "mutation-success":
|
|
357
|
+
parts.push("Success");
|
|
358
|
+
break;
|
|
359
|
+
case "mutation-error":
|
|
360
|
+
parts.push("Error");
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
if (event.duration !== undefined) {
|
|
364
|
+
parts.push(`${event.duration.toFixed(0)}ms`);
|
|
365
|
+
}
|
|
366
|
+
return parts.join(" · ");
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Get correlation ID for React Query event
|
|
371
|
+
*/
|
|
372
|
+
function getReactQueryCorrelationId(event) {
|
|
373
|
+
if (event.queryHash) {
|
|
374
|
+
return `rq-query-${event.queryHash}`;
|
|
375
|
+
}
|
|
376
|
+
if (event.mutationId !== undefined) {
|
|
377
|
+
return `rq-mutation-${event.mutationId}`;
|
|
378
|
+
}
|
|
379
|
+
return undefined;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Get sequence number within correlation group
|
|
384
|
+
*/
|
|
385
|
+
function getReactQuerySequence(event) {
|
|
386
|
+
switch (event.type) {
|
|
387
|
+
case "query-fetch-start":
|
|
388
|
+
case "mutation-start":
|
|
389
|
+
return 1;
|
|
390
|
+
case "query-fetch-success":
|
|
391
|
+
case "query-fetch-error":
|
|
392
|
+
case "mutation-success":
|
|
393
|
+
case "mutation-error":
|
|
394
|
+
return 2;
|
|
395
|
+
case "query-invalidated":
|
|
396
|
+
return 3;
|
|
397
|
+
default:
|
|
398
|
+
return 1;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Determine if a React Query event is a mutation
|
|
404
|
+
*/
|
|
405
|
+
function isReactQueryMutation(event) {
|
|
406
|
+
return event.type.startsWith("mutation-");
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Transform ReactQueryEvent to UnifiedEvent
|
|
411
|
+
*/
|
|
412
|
+
export function transformReactQueryEvent(event) {
|
|
413
|
+
const isMutation = isReactQueryMutation(event);
|
|
414
|
+
return {
|
|
415
|
+
id: generateEventId(isMutation ? "react-query-mutation" : "react-query-query"),
|
|
416
|
+
source: isMutation ? "react-query-mutation" : "react-query-query",
|
|
417
|
+
timestamp: event.timestamp,
|
|
418
|
+
title: getReactQueryTitle(event),
|
|
419
|
+
subtitle: getReactQuerySubtitle(event),
|
|
420
|
+
status: getReactQueryStatus(event),
|
|
421
|
+
originalEvent: event,
|
|
422
|
+
correlationId: getReactQueryCorrelationId(event),
|
|
423
|
+
sequenceInGroup: getReactQuerySequence(event)
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// ============================================================================
|
|
428
|
+
// Route Event Types
|
|
429
|
+
// ============================================================================
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Generic Route change event structure
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Get status for route event
|
|
437
|
+
*/
|
|
438
|
+
function getRouteStatus(event) {
|
|
439
|
+
if (event.pathname === "/") return "success";
|
|
440
|
+
if (Object.keys(event.params).length > 0) return "success";
|
|
441
|
+
return "neutral";
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Get title for route event
|
|
446
|
+
*/
|
|
447
|
+
function getRouteTitle(event) {
|
|
448
|
+
return event.pathname || "/";
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Get subtitle for route event
|
|
453
|
+
*/
|
|
454
|
+
function getRouteSubtitle(event) {
|
|
455
|
+
const parts = [];
|
|
456
|
+
const paramCount = Object.keys(event.params).length;
|
|
457
|
+
if (paramCount > 0) {
|
|
458
|
+
parts.push(`${paramCount} param${paramCount !== 1 ? "s" : ""}`);
|
|
459
|
+
}
|
|
460
|
+
if (event.timeSincePrevious !== undefined && event.timeSincePrevious > 0) {
|
|
461
|
+
if (event.timeSincePrevious < 1000) {
|
|
462
|
+
parts.push(`${event.timeSincePrevious}ms`);
|
|
463
|
+
} else {
|
|
464
|
+
parts.push(`${(event.timeSincePrevious / 1000).toFixed(1)}s`);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (event.previousPathname && event.previousPathname !== event.pathname) {
|
|
468
|
+
parts.push(`from ${event.previousPathname}`);
|
|
469
|
+
}
|
|
470
|
+
return parts.join(" · ") || "navigation";
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Transform RouteChangeEvent to UnifiedEvent
|
|
475
|
+
*/
|
|
476
|
+
export function transformRouteEvent(event) {
|
|
477
|
+
return {
|
|
478
|
+
id: generateEventId("route"),
|
|
479
|
+
source: "route",
|
|
480
|
+
timestamp: event.timestamp,
|
|
481
|
+
title: getRouteTitle(event),
|
|
482
|
+
subtitle: getRouteSubtitle(event),
|
|
483
|
+
status: getRouteStatus(event),
|
|
484
|
+
originalEvent: event
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
//# sourceMappingURL=eventTransformers.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventsCopySettingsView
|
|
3
|
+
*
|
|
4
|
+
* Settings UI for configuring event export format and content.
|
|
5
|
+
* Based on NetworkCopySettingsView pattern.
|
|
6
|
+
*/
|
|
7
|
+
import type { UnifiedEvent } from "../types";
|
|
8
|
+
import { type EventsCopySettings } from "../types/copySettings";
|
|
9
|
+
interface EventsCopySettingsViewProps {
|
|
10
|
+
events?: UnifiedEvent[];
|
|
11
|
+
initialSettings?: EventsCopySettings;
|
|
12
|
+
onSettingsChange?: (settings: EventsCopySettings) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function EventsCopySettingsView({ events, initialSettings, onSettingsChange, }: EventsCopySettingsViewProps): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=EventsCopySettingsView.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventsModal
|
|
3
|
+
*
|
|
4
|
+
* Modal wrapper for the unified events timeline.
|
|
5
|
+
* Uses JsModal for consistent bottom sheet behavior.
|
|
6
|
+
*/
|
|
7
|
+
interface EventsModalProps {
|
|
8
|
+
visible: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onBack?: () => void;
|
|
11
|
+
onMinimize?: (modalState: unknown) => void;
|
|
12
|
+
enableSharedModalDimensions?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function EventsModal({ visible, onClose, onBack, onMinimize, enableSharedModalDimensions, }: EventsModalProps): import("react").JSX.Element | null;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=EventsModal.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReactQueryEventDetail
|
|
3
|
+
*
|
|
4
|
+
* Detail view for React Query events in the Events DevTools.
|
|
5
|
+
* Styled similarly to the React Query DevTools detail view.
|
|
6
|
+
*
|
|
7
|
+
* Uses local type definitions to avoid hard dependency on @buoy-gg/react-query.
|
|
8
|
+
*/
|
|
9
|
+
import type { UnifiedEvent } from "../types";
|
|
10
|
+
interface ReactQueryEventDetailProps {
|
|
11
|
+
event: UnifiedEvent;
|
|
12
|
+
}
|
|
13
|
+
export declare const ReactQueryEventDetail: import("react").NamedExoticComponent<ReactQueryEventDetailProps>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=ReactQueryEventDetail.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedEventDetail
|
|
3
|
+
*
|
|
4
|
+
* Detail view for a single unified event.
|
|
5
|
+
* Uses shared detail components from other packages when available,
|
|
6
|
+
* falls back to generic DataViewer when packages aren't installed.
|
|
7
|
+
*/
|
|
8
|
+
import type { UnifiedEvent } from "../types";
|
|
9
|
+
interface UnifiedEventDetailProps {
|
|
10
|
+
event: UnifiedEvent;
|
|
11
|
+
onBack?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const UnifiedEventDetail: import("react").NamedExoticComponent<UnifiedEventDetailProps>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=UnifiedEventDetail.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedEventFilters
|
|
3
|
+
*
|
|
4
|
+
* Filter bar showing toggleable badges for each available event source.
|
|
5
|
+
* Badges are sorted: enabled first, disabled last.
|
|
6
|
+
* Toggling a badge enables/disables event listening for that source.
|
|
7
|
+
*/
|
|
8
|
+
import type { EventSource, SourceInfo } from "../types";
|
|
9
|
+
interface UnifiedEventFiltersProps {
|
|
10
|
+
/** All available sources (already sorted: enabled first) */
|
|
11
|
+
availableSources: SourceInfo[];
|
|
12
|
+
/** Toggle a source on/off */
|
|
13
|
+
onToggleSource: (source: EventSource) => void;
|
|
14
|
+
/** Total event count */
|
|
15
|
+
totalCount: number;
|
|
16
|
+
/** Filtered event count */
|
|
17
|
+
filteredCount: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const UnifiedEventFilters: import("react").NamedExoticComponent<UnifiedEventFiltersProps>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=UnifiedEventFilters.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedEventItem
|
|
3
|
+
*
|
|
4
|
+
* Renders a single event in the unified event timeline.
|
|
5
|
+
* Uses shared UI components from other packages when available,
|
|
6
|
+
* falls back to generic CompactRow when packages aren't installed.
|
|
7
|
+
*/
|
|
8
|
+
import type { UnifiedEvent } from "../types";
|
|
9
|
+
interface UnifiedEventItemProps {
|
|
10
|
+
event: UnifiedEvent;
|
|
11
|
+
onPress: () => void;
|
|
12
|
+
isSelected?: boolean;
|
|
13
|
+
/** Whether this event is expanded (for route events) */
|
|
14
|
+
isExpanded?: boolean;
|
|
15
|
+
/** Called when navigating to a route */
|
|
16
|
+
onNavigate?: (pathname: string) => void;
|
|
17
|
+
/** Number of events in the correlation group */
|
|
18
|
+
correlationCount?: number;
|
|
19
|
+
/** Label showing position in group (e.g., "1/2") */
|
|
20
|
+
correlationLabel?: string | null;
|
|
21
|
+
/** Color for the correlation indicator */
|
|
22
|
+
correlationColor?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const UnifiedEventItem: import("react").NamedExoticComponent<UnifiedEventItemProps>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=UnifiedEventItem.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedEventList
|
|
3
|
+
*
|
|
4
|
+
* Scrollable list of unified events with empty state handling.
|
|
5
|
+
*/
|
|
6
|
+
import type { UnifiedEvent } from "../types";
|
|
7
|
+
interface UnifiedEventListProps {
|
|
8
|
+
/** Events to display */
|
|
9
|
+
events: UnifiedEvent[];
|
|
10
|
+
/** Currently selected event ID */
|
|
11
|
+
selectedEventId?: string;
|
|
12
|
+
/** Currently expanded event ID (for route events) */
|
|
13
|
+
expandedEventId?: string | null;
|
|
14
|
+
/** Called when an event is pressed */
|
|
15
|
+
onEventPress: (event: UnifiedEvent) => void;
|
|
16
|
+
/** Called when navigating to a route */
|
|
17
|
+
onNavigate?: (pathname: string) => void;
|
|
18
|
+
/** Whether events are being captured */
|
|
19
|
+
isCapturing: boolean;
|
|
20
|
+
/** Number of hidden events (for free tier limit) */
|
|
21
|
+
hiddenEventsCount?: number;
|
|
22
|
+
/** Called when upgrade banner is pressed */
|
|
23
|
+
onUpgradePress?: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const UnifiedEventList: import("react").NamedExoticComponent<UnifiedEventListProps>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=UnifiedEventList.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UnifiedEventViewer
|
|
3
|
+
*
|
|
4
|
+
* Main component for the unified event timeline.
|
|
5
|
+
* Shows events from all sources with filtering and detail view.
|
|
6
|
+
*/
|
|
7
|
+
export declare function UnifiedEventViewer(): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=UnifiedEventViewer.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useUnifiedEvents Hook
|
|
3
|
+
*
|
|
4
|
+
* Main hook for consuming unified events from all sources.
|
|
5
|
+
* Automatically discovers and subscribes to available event sources.
|
|
6
|
+
*/
|
|
7
|
+
import type { UnifiedEvent, EventSource, SourceInfo } from "../types";
|
|
8
|
+
export interface UseUnifiedEventsResult {
|
|
9
|
+
events: UnifiedEvent[];
|
|
10
|
+
filteredEvents: UnifiedEvent[];
|
|
11
|
+
availableSources: SourceInfo[];
|
|
12
|
+
enabledSources: Set<EventSource>;
|
|
13
|
+
toggleSource: (source: EventSource) => void;
|
|
14
|
+
enableAllSources: () => void;
|
|
15
|
+
clearEvents: () => void;
|
|
16
|
+
totalCount: number;
|
|
17
|
+
filteredCount: number;
|
|
18
|
+
isCapturing: boolean;
|
|
19
|
+
startCapturing: () => void;
|
|
20
|
+
stopCapturing: () => void;
|
|
21
|
+
toggleCapturing: () => void;
|
|
22
|
+
/** Which sources are actually available (packages installed) */
|
|
23
|
+
discoveredSources: Set<EventSource>;
|
|
24
|
+
/** Number of events hidden due to free tier limit */
|
|
25
|
+
hiddenEventsCount: number;
|
|
26
|
+
/** Whether user is on Pro plan */
|
|
27
|
+
isPro: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function useUnifiedEvents(): UseUnifiedEventsResult;
|
|
30
|
+
//# sourceMappingURL=useUnifiedEvents.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @buoy-gg/events
|
|
3
|
+
*
|
|
4
|
+
* Unified event timeline for all DevTools sources.
|
|
5
|
+
* Shows events from Storage, Redux, Network, React Query, etc.
|
|
6
|
+
* in a single chronological view.
|
|
7
|
+
*
|
|
8
|
+
* PUBLIC API - Only these exports are supported for external use.
|
|
9
|
+
* Internal stores and subscription mechanisms are not exported to prevent
|
|
10
|
+
* bypassing the tool's intended usage patterns.
|
|
11
|
+
*/
|
|
12
|
+
export { eventsToolPreset, createEventsTool } from "./preset";
|
|
13
|
+
export { UnifiedEventViewer } from "./components/UnifiedEventViewer";
|
|
14
|
+
export { useUnifiedEvents } from "./hooks/useUnifiedEvents";
|
|
15
|
+
export type { UseUnifiedEventsResult } from "./hooks/useUnifiedEvents";
|
|
16
|
+
export type { UnifiedEvent, EventSource, EventStatus, EventFilter, SourceInfo, UnifiedEventListener, EventsCopySettings, CopyPresetName, } from "./types";
|
|
17
|
+
export { DEFAULT_COPY_SETTINGS, COPY_PRESETS, PRESET_METADATA, detectActivePreset, } from "./types/copySettings";
|
|
18
|
+
export { UnifiedEventItem } from "./components/UnifiedEventItem";
|
|
19
|
+
export { UnifiedEventList } from "./components/UnifiedEventList";
|
|
20
|
+
export { UnifiedEventFilters } from "./components/UnifiedEventFilters";
|
|
21
|
+
export { UnifiedEventDetail } from "./components/UnifiedEventDetail";
|
|
22
|
+
export { ReactQueryEventDetail } from "./components/ReactQueryEventDetail";
|
|
23
|
+
export { EventsCopySettingsView } from "./components/EventsCopySettingsView";
|
|
24
|
+
export { findRelatedEvents, hasRelatedEvents, getRelatedEventsCount, buildCorrelationCountMap, getCorrelationGroup, getCorrelationLabel, getCorrelationColor, } from "./utils/correlationUtils";
|
|
25
|
+
export { generateExport, generateMarkdownExport, generateJsonExport, generatePlaintextExport, estimateExportSize, getExportSummary, filterEvents, } from "./utils/eventExportFormatter";
|
|
26
|
+
export type { ExportSummary } from "./utils/eventExportFormatter";
|
|
27
|
+
export { loadCopySettings, saveCopySettings, clearCopySettings, } from "./utils/copySettingsStorage";
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|