@buoy-gg/events 7.0.29 → 7.0.31

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.
Files changed (89) hide show
  1. package/lib/commonjs/components/EventsCopySettingsView.js +15 -1
  2. package/lib/commonjs/components/EventsCopySettingsView.js.map +1 -1
  3. package/lib/commonjs/components/EventsModal.js +28 -7
  4. package/lib/commonjs/components/EventsModal.js.map +1 -1
  5. package/lib/commonjs/components/UnifiedEventDetail.js +23 -3
  6. package/lib/commonjs/components/UnifiedEventDetail.js.map +1 -1
  7. package/lib/commonjs/components/UnifiedEventFilters.js +15 -0
  8. package/lib/commonjs/components/UnifiedEventFilters.js.map +1 -1
  9. package/lib/commonjs/components/UnifiedEventItem.js +23 -6
  10. package/lib/commonjs/components/UnifiedEventItem.js.map +1 -1
  11. package/lib/commonjs/components/UnifiedEventList.js +13 -1
  12. package/lib/commonjs/components/UnifiedEventList.js.map +1 -1
  13. package/lib/commonjs/hooks/useUnifiedEvents.js +118 -117
  14. package/lib/commonjs/hooks/useUnifiedEvents.js.map +1 -1
  15. package/lib/commonjs/index.js +25 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/stores/unifiedEventStore.js +57 -3
  18. package/lib/commonjs/stores/unifiedEventStore.js.map +1 -1
  19. package/lib/commonjs/utils/autoDiscoverEventSources.js +54 -0
  20. package/lib/commonjs/utils/autoDiscoverEventSources.js.map +1 -1
  21. package/lib/commonjs/utils/badgeSelectionStorage.js +36 -0
  22. package/lib/commonjs/utils/badgeSelectionStorage.js.map +1 -1
  23. package/lib/commonjs/utils/testIDs.js +91 -0
  24. package/lib/commonjs/utils/testIDs.js.map +1 -0
  25. package/lib/module/components/EventsCopySettingsView.js +15 -1
  26. package/lib/module/components/EventsCopySettingsView.js.map +1 -1
  27. package/lib/module/components/EventsModal.js +30 -8
  28. package/lib/module/components/EventsModal.js.map +1 -1
  29. package/lib/module/components/UnifiedEventDetail.js +23 -3
  30. package/lib/module/components/UnifiedEventDetail.js.map +1 -1
  31. package/lib/module/components/UnifiedEventFilters.js +15 -0
  32. package/lib/module/components/UnifiedEventFilters.js.map +1 -1
  33. package/lib/module/components/UnifiedEventItem.js +23 -6
  34. package/lib/module/components/UnifiedEventItem.js.map +1 -1
  35. package/lib/module/components/UnifiedEventList.js +13 -1
  36. package/lib/module/components/UnifiedEventList.js.map +1 -1
  37. package/lib/module/hooks/useUnifiedEvents.js +120 -119
  38. package/lib/module/hooks/useUnifiedEvents.js.map +1 -1
  39. package/lib/module/index.js +5 -0
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/stores/unifiedEventStore.js +54 -1
  42. package/lib/module/stores/unifiedEventStore.js.map +1 -1
  43. package/lib/module/utils/autoDiscoverEventSources.js +54 -0
  44. package/lib/module/utils/autoDiscoverEventSources.js.map +1 -1
  45. package/lib/module/utils/badgeSelectionStorage.js +34 -0
  46. package/lib/module/utils/badgeSelectionStorage.js.map +1 -1
  47. package/lib/module/utils/testIDs.js +83 -0
  48. package/lib/module/utils/testIDs.js.map +1 -0
  49. package/lib/typescript/components/EventsCopySettingsView.d.ts.map +1 -1
  50. package/lib/typescript/components/EventsModal.d.ts.map +1 -1
  51. package/lib/typescript/components/UnifiedEventDetail.d.ts.map +1 -1
  52. package/lib/typescript/components/UnifiedEventFilters.d.ts.map +1 -1
  53. package/lib/typescript/components/UnifiedEventItem.d.ts.map +1 -1
  54. package/lib/typescript/components/UnifiedEventList.d.ts.map +1 -1
  55. package/lib/typescript/hooks/useUnifiedEvents.d.ts +10 -1
  56. package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +1 -1
  57. package/lib/typescript/index.d.ts +1 -0
  58. package/lib/typescript/index.d.ts.map +1 -1
  59. package/lib/typescript/stores/unifiedEventStore.d.ts +13 -0
  60. package/lib/typescript/stores/unifiedEventStore.d.ts.map +1 -1
  61. package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +1 -1
  62. package/lib/typescript/utils/badgeSelectionStorage.d.ts +9 -0
  63. package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +1 -1
  64. package/lib/typescript/utils/testIDs.d.ts +45 -0
  65. package/lib/typescript/utils/testIDs.d.ts.map +1 -0
  66. package/package.json +7 -8
  67. package/src/components/EventsCopySettingsView.tsx +0 -781
  68. package/src/components/EventsModal.tsx +0 -537
  69. package/src/components/ReactQueryEventDetail.tsx +0 -418
  70. package/src/components/UnifiedEventDetail.tsx +0 -596
  71. package/src/components/UnifiedEventFilters.tsx +0 -226
  72. package/src/components/UnifiedEventItem.tsx +0 -467
  73. package/src/components/UnifiedEventList.tsx +0 -216
  74. package/src/components/UnifiedEventViewer.tsx +0 -133
  75. package/src/hooks/useUnifiedEvents.ts +0 -573
  76. package/src/index.tsx +0 -128
  77. package/src/preset.tsx +0 -57
  78. package/src/sources/sourceIds.ts +0 -25
  79. package/src/stores/unifiedEventStore.ts +0 -686
  80. package/src/sync/__tests__/eventsSyncAdapter.test.ts +0 -471
  81. package/src/sync/eventsSyncAdapter.ts +0 -391
  82. package/src/types/copySettings.ts +0 -299
  83. package/src/types/index.ts +0 -101
  84. package/src/utils/autoDiscoverEventSources.ts +0 -1087
  85. package/src/utils/badgeSelectionStorage.ts +0 -81
  86. package/src/utils/copySettingsStorage.ts +0 -61
  87. package/src/utils/correlationUtils.ts +0 -146
  88. package/src/utils/eventExportFormatter.ts +0 -2066
  89. package/src/utils/eventTransformers.ts +0 -567
@@ -1,418 +0,0 @@
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
-
10
- import { memo, useMemo } from "react";
11
- import { View, Text, StyleSheet, ScrollView } from "react-native";
12
- import { buoyColors, night, formatRelativeTime, displayValue } from "@buoy-gg/shared-ui";
13
- import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
14
- import type { UnifiedEvent } from "../types";
15
- import type { ReactQueryEvent } from "../utils/eventTransformers";
16
-
17
- /**
18
- * Extended React Query event with additional data fields
19
- */
20
- interface ExtendedReactQueryEvent extends ReactQueryEvent {
21
- queryData?: unknown;
22
- queryError?: unknown;
23
- mutationData?: unknown;
24
- mutationError?: unknown;
25
- mutationVariables?: unknown;
26
- }
27
-
28
- /**
29
- * Event type display configuration
30
- */
31
- const EVENT_TYPE_CONFIG: Record<
32
- string,
33
- { label: string; color: string; icon: string }
34
- > = {
35
- "query-fetch-start": {
36
- label: "Query Fetching",
37
- color: night.color.accent,
38
- icon: "hourglass",
39
- },
40
- "query-fetch-success": {
41
- label: "Query Success",
42
- color: buoyColors.success,
43
- icon: "checkmark",
44
- },
45
- "query-fetch-error": {
46
- label: "Query Error",
47
- color: buoyColors.error,
48
- icon: "close",
49
- },
50
- "query-invalidated": {
51
- label: "Query Invalidated",
52
- color: buoyColors.warning,
53
- icon: "refresh",
54
- },
55
- "mutation-start": {
56
- label: "Mutation Started",
57
- color: night.color.accent,
58
- icon: "hourglass",
59
- },
60
- "mutation-success": {
61
- label: "Mutation Success",
62
- color: buoyColors.success,
63
- icon: "checkmark",
64
- },
65
- "mutation-error": {
66
- label: "Mutation Error",
67
- color: buoyColors.error,
68
- icon: "close",
69
- },
70
- };
71
-
72
- interface ReactQueryEventDetailProps {
73
- event: UnifiedEvent;
74
- }
75
-
76
- export const ReactQueryEventDetail = memo(function ReactQueryEventDetail({
77
- event,
78
- }: ReactQueryEventDetailProps) {
79
- const reactQueryEvent = event.originalEvent as ExtendedReactQueryEvent;
80
- const eventConfig = EVENT_TYPE_CONFIG[reactQueryEvent.type] || {
81
- label: reactQueryEvent.type,
82
- color: night.color.textTertiary,
83
- icon: "help",
84
- };
85
-
86
- const isQuery = reactQueryEvent.type.startsWith("query-");
87
- const isMutation = reactQueryEvent.type.startsWith("mutation-");
88
-
89
- // Format query/mutation key for display
90
- const keyDisplay = useMemo(() => {
91
- const key = isQuery ? reactQueryEvent.queryKey : reactQueryEvent.mutationKey;
92
- if (!key) {
93
- // For mutations without a key, show the mutation ID
94
- if (isMutation && reactQueryEvent.mutationId !== undefined) {
95
- return `Mutation #${reactQueryEvent.mutationId}`;
96
- }
97
- return "No key";
98
- }
99
- return displayValue(key, true);
100
- }, [reactQueryEvent, isQuery, isMutation]);
101
-
102
- // Format timestamp
103
- const timestamp = new Date(reactQueryEvent.timestamp);
104
- const timeString = timestamp.toLocaleTimeString("en-US", {
105
- hour: "2-digit",
106
- minute: "2-digit",
107
- second: "2-digit",
108
- hour12: true,
109
- });
110
-
111
- // Determine what data to show
112
- const hasData = isQuery
113
- ? !!reactQueryEvent.queryData
114
- : !!reactQueryEvent.mutationData;
115
- const hasError = isQuery
116
- ? !!reactQueryEvent.queryError
117
- : !!reactQueryEvent.mutationError;
118
- const hasVariables = isMutation && !!reactQueryEvent.mutationVariables;
119
-
120
- return (
121
- <ScrollView
122
- style={styles.container}
123
- contentContainerStyle={styles.contentContainer}
124
- >
125
- {/* Event Type Header */}
126
- <View style={styles.section}>
127
- <View
128
- style={[
129
- styles.eventTypeContainer,
130
- { borderColor: eventConfig.color + "4D" },
131
- ]}
132
- >
133
- <Text
134
- style={[
135
- styles.eventTypeHeader,
136
- { backgroundColor: eventConfig.color + "15", color: eventConfig.color },
137
- ]}
138
- >
139
- {eventConfig.label}
140
- </Text>
141
- <View style={styles.eventTypeContent}>
142
- <View style={styles.keyRow}>
143
- <ScrollView horizontal style={styles.keyScrollView}>
144
- <Text style={styles.keyText}>{keyDisplay}</Text>
145
- </ScrollView>
146
- <EventStatusChip type={reactQueryEvent.type} color={eventConfig.color} />
147
- </View>
148
- {reactQueryEvent.duration !== undefined && (
149
- <View style={styles.row}>
150
- <Text style={styles.labelText}>Duration:</Text>
151
- <Text style={styles.valueText}>{reactQueryEvent.duration.toFixed(0)}ms</Text>
152
- </View>
153
- )}
154
- <View style={styles.row}>
155
- <Text style={styles.labelText}>Timestamp:</Text>
156
- <Text style={styles.valueText}>{timeString}</Text>
157
- </View>
158
- {isQuery && reactQueryEvent.queryHash && (
159
- <View style={styles.row}>
160
- <Text style={styles.labelText}>Query Hash:</Text>
161
- <Text style={[styles.valueText, styles.hashText]} numberOfLines={1}>
162
- {reactQueryEvent.queryHash}
163
- </Text>
164
- </View>
165
- )}
166
- {isMutation && reactQueryEvent.mutationId !== undefined && (
167
- <View style={styles.row}>
168
- <Text style={styles.labelText}>Mutation ID:</Text>
169
- <Text style={styles.valueText}>#{reactQueryEvent.mutationId}</Text>
170
- </View>
171
- )}
172
- </View>
173
- </View>
174
- </View>
175
-
176
- {/* Mutation Variables Section */}
177
- {hasVariables && (
178
- <View style={styles.section}>
179
- <View style={styles.dataContainer}>
180
- <Text style={[styles.dataHeader, { color: buoyColors.warning }]}>
181
- Variables
182
- </Text>
183
- <View style={styles.dataContent}>
184
- <DataViewer
185
- title=""
186
- data={reactQueryEvent.mutationVariables}
187
- showTypeFilter={true}
188
- rawMode={true}
189
- initialExpanded={true}
190
- />
191
- </View>
192
- </View>
193
- </View>
194
- )}
195
-
196
- {/* Data Section */}
197
- {hasData && (
198
- <View style={styles.section}>
199
- <View style={styles.dataContainer}>
200
- <Text style={[styles.dataHeader, { color: buoyColors.success }]}>
201
- {isQuery ? "Query Data" : "Mutation Result"}
202
- </Text>
203
- <View style={styles.dataContent}>
204
- <DataViewer
205
- title=""
206
- data={isQuery ? reactQueryEvent.queryData : reactQueryEvent.mutationData}
207
- showTypeFilter={true}
208
- rawMode={true}
209
- initialExpanded={true}
210
- />
211
- </View>
212
- </View>
213
- </View>
214
- )}
215
-
216
- {/* Error Section */}
217
- {hasError && (
218
- <View style={styles.section}>
219
- <View style={[styles.dataContainer, styles.errorContainer]}>
220
- <Text style={[styles.dataHeader, styles.errorHeader]}>Error</Text>
221
- <View style={styles.dataContent}>
222
- <DataViewer
223
- title=""
224
- data={isQuery ? reactQueryEvent.queryError : reactQueryEvent.mutationError}
225
- showTypeFilter={true}
226
- rawMode={true}
227
- initialExpanded={true}
228
- />
229
- </View>
230
- </View>
231
- </View>
232
- )}
233
-
234
- {/* Full Event Data Section */}
235
- <View style={styles.section}>
236
- <View style={styles.dataContainer}>
237
- <Text style={styles.dataHeader}>Event Details</Text>
238
- <View style={styles.dataContent}>
239
- <DataViewer
240
- title=""
241
- data={reactQueryEvent}
242
- showTypeFilter={true}
243
- rawMode={true}
244
- initialExpanded={false}
245
- />
246
- </View>
247
- </View>
248
- </View>
249
- </ScrollView>
250
- );
251
- });
252
-
253
- /**
254
- * Status chip component for event type
255
- */
256
- function EventStatusChip({ type, color }: { type: string; color: string }) {
257
- const getStatusLabel = () => {
258
- if (type.includes("start")) return "PENDING";
259
- if (type.includes("success")) return "SUCCESS";
260
- if (type.includes("error")) return "ERROR";
261
- if (type.includes("invalidated")) return "INVALIDATED";
262
- return type.toUpperCase();
263
- };
264
-
265
- return (
266
- <View style={[styles.statusChip, { backgroundColor: color + "15", borderColor: color + "33" }]}>
267
- <Text style={[styles.statusChipText, { color }]}>{getStatusLabel()}</Text>
268
- </View>
269
- );
270
- }
271
-
272
- const styles = StyleSheet.create({
273
- container: {
274
- flex: 1,
275
- // Transparent so the night sheet's star field shows through.
276
- backgroundColor: "transparent",
277
- },
278
- contentContainer: {
279
- padding: 8,
280
- paddingBottom: 24,
281
- },
282
- section: {
283
- marginBottom: 12,
284
- },
285
- // Event type container (like QueryDetails)
286
- eventTypeContainer: {
287
- minWidth: 200,
288
- backgroundColor: night.color.surface,
289
- borderRadius: 6,
290
- borderWidth: 1,
291
- overflow: "hidden",
292
- shadowColor: night.color.accent,
293
- shadowOffset: { width: 0, height: 0 },
294
- shadowOpacity: 0.1,
295
- shadowRadius: 6,
296
- },
297
- eventTypeHeader: {
298
- paddingHorizontal: 12,
299
- paddingVertical: 10,
300
- fontWeight: "600",
301
- fontSize: 12,
302
- borderBottomWidth: 1,
303
- borderBottomColor: night.color.accentBorder,
304
- letterSpacing: 0.5,
305
- textTransform: "uppercase",
306
- fontFamily: "monospace",
307
- },
308
- eventTypeContent: {
309
- padding: 0,
310
- },
311
- keyRow: {
312
- flexDirection: "row",
313
- justifyContent: "space-between",
314
- alignItems: "center",
315
- paddingHorizontal: 12,
316
- paddingVertical: 10,
317
- borderBottomWidth: 1,
318
- borderBottomColor: night.color.separator,
319
- },
320
- keyScrollView: {
321
- flex: 1,
322
- marginRight: 8,
323
- },
324
- keyText: {
325
- fontSize: 12,
326
- color: night.color.text,
327
- fontFamily: "monospace",
328
- lineHeight: 18,
329
- backgroundColor: night.color.accentSoft,
330
- paddingHorizontal: 8,
331
- paddingVertical: 4,
332
- borderRadius: 4,
333
- borderWidth: 1,
334
- borderColor: night.color.accentBorderStrong,
335
- },
336
- row: {
337
- flexDirection: "row",
338
- justifyContent: "space-between",
339
- alignItems: "center",
340
- paddingHorizontal: 12,
341
- paddingVertical: 10,
342
- borderBottomWidth: 1,
343
- borderBottomColor: night.color.separator,
344
- },
345
- labelText: {
346
- fontSize: 10,
347
- color: night.color.textSecondary,
348
- fontWeight: "600",
349
- letterSpacing: 0.5,
350
- textTransform: "uppercase",
351
- fontFamily: "monospace",
352
- },
353
- valueText: {
354
- fontSize: 12,
355
- color: night.color.text,
356
- fontWeight: "500",
357
- fontVariant: ["tabular-nums"],
358
- fontFamily: "monospace",
359
- },
360
- hashText: {
361
- flex: 1,
362
- textAlign: "right",
363
- marginLeft: 8,
364
- },
365
- // Status chip
366
- statusChip: {
367
- paddingHorizontal: 8,
368
- paddingVertical: 4,
369
- borderWidth: 1,
370
- borderRadius: 6,
371
- alignSelf: "flex-start",
372
- },
373
- statusChipText: {
374
- fontSize: 11,
375
- fontWeight: "600",
376
- textTransform: "uppercase",
377
- letterSpacing: 0.5,
378
- fontFamily: "monospace",
379
- },
380
- // Data containers
381
- dataContainer: {
382
- minWidth: 200,
383
- backgroundColor: night.color.surface,
384
- borderRadius: 6,
385
- borderWidth: 1,
386
- borderColor: night.color.accentBorderStrong,
387
- overflow: "hidden",
388
- shadowColor: night.color.accent,
389
- shadowOffset: { width: 0, height: 0 },
390
- shadowOpacity: 0.1,
391
- shadowRadius: 6,
392
- },
393
- dataHeader: {
394
- backgroundColor: night.color.accentSoft,
395
- paddingHorizontal: 12,
396
- paddingVertical: 10,
397
- fontWeight: "600",
398
- fontSize: 12,
399
- color: night.color.accent,
400
- borderBottomWidth: 1,
401
- borderBottomColor: night.color.accentBorder,
402
- letterSpacing: 0.5,
403
- textTransform: "uppercase",
404
- fontFamily: "monospace",
405
- },
406
- dataContent: {
407
- padding: 8,
408
- },
409
- // Error container
410
- errorContainer: {
411
- borderColor: buoyColors.error + "4D",
412
- },
413
- errorHeader: {
414
- backgroundColor: buoyColors.error + "1A",
415
- color: buoyColors.error,
416
- borderBottomColor: buoyColors.error + "33",
417
- },
418
- });