@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,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EventsModal = EventsModal;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _expoRouter = require("expo-router");
|
|
10
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
+
var _useUnifiedEvents = require("../hooks/useUnifiedEvents");
|
|
12
|
+
var _UnifiedEventFilters = require("./UnifiedEventFilters");
|
|
13
|
+
var _UnifiedEventList = require("./UnifiedEventList");
|
|
14
|
+
var _UnifiedEventDetail = require("./UnifiedEventDetail");
|
|
15
|
+
var _EventsCopySettingsView = require("./EventsCopySettingsView");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* EventsModal
|
|
19
|
+
*
|
|
20
|
+
* Modal wrapper for the unified events timeline.
|
|
21
|
+
* Uses JsModal for consistent bottom sheet behavior.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Try to load TickProvider from network package for time refresh
|
|
25
|
+
let TickProvider = null;
|
|
26
|
+
try {
|
|
27
|
+
// @ts-ignore - Dynamic import that may not exist
|
|
28
|
+
const network = require("@buoy-gg/network");
|
|
29
|
+
TickProvider = network.TickProvider;
|
|
30
|
+
} catch {
|
|
31
|
+
// Network package not installed, times won't auto-refresh
|
|
32
|
+
}
|
|
33
|
+
function EventsModal({
|
|
34
|
+
visible,
|
|
35
|
+
onClose,
|
|
36
|
+
onBack,
|
|
37
|
+
onMinimize,
|
|
38
|
+
enableSharedModalDimensions = false
|
|
39
|
+
}) {
|
|
40
|
+
const router = (0, _expoRouter.useRouter)();
|
|
41
|
+
const {
|
|
42
|
+
filteredEvents,
|
|
43
|
+
availableSources,
|
|
44
|
+
toggleSource,
|
|
45
|
+
clearEvents,
|
|
46
|
+
totalCount,
|
|
47
|
+
filteredCount,
|
|
48
|
+
isCapturing,
|
|
49
|
+
toggleCapturing,
|
|
50
|
+
hiddenEventsCount
|
|
51
|
+
} = (0, _useUnifiedEvents.useUnifiedEvents)();
|
|
52
|
+
const [currentView, setCurrentView] = (0, _react.useState)("list");
|
|
53
|
+
const [selectedEvent, setSelectedEvent] = (0, _react.useState)(null);
|
|
54
|
+
const [expandedEventId, setExpandedEventId] = (0, _react.useState)(null);
|
|
55
|
+
const [showUpgradeModal, setShowUpgradeModal] = (0, _react.useState)(false);
|
|
56
|
+
|
|
57
|
+
// Navigation handler for route events
|
|
58
|
+
const handleNavigate = (0, _react.useCallback)(pathname => {
|
|
59
|
+
try {
|
|
60
|
+
router.push(pathname);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
_reactNative.Alert.alert("Navigation Error", String(error));
|
|
63
|
+
}
|
|
64
|
+
}, [router]);
|
|
65
|
+
const handleEventPress = (0, _react.useCallback)(event => {
|
|
66
|
+
// Route events expand in-place instead of navigating to detail
|
|
67
|
+
if (event.source === "route") {
|
|
68
|
+
setExpandedEventId(prev => prev === event.id ? null : event.id);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setSelectedEvent(event);
|
|
72
|
+
setCurrentView("detail");
|
|
73
|
+
}, []);
|
|
74
|
+
const handleBack = (0, _react.useCallback)(() => {
|
|
75
|
+
if (currentView === "detail") {
|
|
76
|
+
setSelectedEvent(null);
|
|
77
|
+
setCurrentView("list");
|
|
78
|
+
} else if (currentView === "copySettings") {
|
|
79
|
+
setCurrentView("list");
|
|
80
|
+
}
|
|
81
|
+
}, [currentView]);
|
|
82
|
+
const handleOpenCopySettings = (0, _react.useCallback)(() => {
|
|
83
|
+
setCurrentView("copySettings");
|
|
84
|
+
}, []);
|
|
85
|
+
const handleModeChange = (0, _react.useCallback)(_mode => {
|
|
86
|
+
// Mode changes handled by JsModal
|
|
87
|
+
}, []);
|
|
88
|
+
const persistenceKey = enableSharedModalDimensions ? _sharedUi.devToolsStorageKeys.modal.root() : "buoy-events-modal";
|
|
89
|
+
if (!visible) return null;
|
|
90
|
+
const renderHeaderContent = () => {
|
|
91
|
+
// Detail view header
|
|
92
|
+
if (currentView === "detail" && selectedEvent) {
|
|
93
|
+
const copyData = {
|
|
94
|
+
source: selectedEvent.source,
|
|
95
|
+
title: selectedEvent.title,
|
|
96
|
+
subtitle: selectedEvent.subtitle,
|
|
97
|
+
status: selectedEvent.status,
|
|
98
|
+
timestamp: new Date(selectedEvent.timestamp).toISOString(),
|
|
99
|
+
data: selectedEvent.originalEvent
|
|
100
|
+
};
|
|
101
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
|
|
102
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
|
|
103
|
+
onBack: handleBack
|
|
104
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
|
|
105
|
+
title: selectedEvent.title
|
|
106
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Actions, {
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton, {
|
|
108
|
+
value: copyData
|
|
109
|
+
})
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Copy settings view header
|
|
115
|
+
if (currentView === "copySettings") {
|
|
116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
|
|
118
|
+
onBack: handleBack
|
|
119
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
|
|
120
|
+
title: "Copy Settings"
|
|
121
|
+
})]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// List view header (default)
|
|
126
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader, {
|
|
127
|
+
children: [onBack && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation, {
|
|
128
|
+
onBack: onBack
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
|
|
130
|
+
title: "",
|
|
131
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
132
|
+
style: styles.headerTitleContainer,
|
|
133
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
134
|
+
style: styles.headerTitle,
|
|
135
|
+
children: "Events"
|
|
136
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
137
|
+
style: styles.headerSubtitle,
|
|
138
|
+
children: [totalCount, " captured"]
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions, {
|
|
142
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
143
|
+
onPress: handleOpenCopySettings,
|
|
144
|
+
style: [styles.headerActionButton, totalCount === 0 && styles.headerActionButtonDisabled],
|
|
145
|
+
disabled: totalCount === 0,
|
|
146
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Copy, {
|
|
147
|
+
size: 14,
|
|
148
|
+
color: totalCount > 0 ? _sharedUi.buoyColors.textMuted : _sharedUi.buoyColors.textMuted + "50"
|
|
149
|
+
})
|
|
150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
151
|
+
onPress: toggleCapturing,
|
|
152
|
+
style: [styles.headerActionButton, isCapturing ? styles.startButton : styles.stopButton],
|
|
153
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Power, {
|
|
154
|
+
size: 14,
|
|
155
|
+
color: isCapturing ? _sharedUi.buoyColors.success : _sharedUi.buoyColors.error
|
|
156
|
+
})
|
|
157
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
158
|
+
onPress: clearEvents,
|
|
159
|
+
style: [styles.headerActionButton, totalCount === 0 && styles.headerActionButtonDisabled],
|
|
160
|
+
disabled: totalCount === 0,
|
|
161
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
|
|
162
|
+
size: 14,
|
|
163
|
+
color: totalCount > 0 ? _sharedUi.buoyColors.textMuted : _sharedUi.buoyColors.textMuted + "50"
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
const content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
170
|
+
style: styles.container,
|
|
171
|
+
children: currentView === "copySettings" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_EventsCopySettingsView.EventsCopySettingsView, {
|
|
172
|
+
events: filteredEvents
|
|
173
|
+
}) : currentView === "detail" && selectedEvent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnifiedEventDetail.UnifiedEventDetail, {
|
|
174
|
+
event: selectedEvent,
|
|
175
|
+
onBack: handleBack
|
|
176
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
177
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_UnifiedEventFilters.UnifiedEventFilters, {
|
|
178
|
+
availableSources: availableSources,
|
|
179
|
+
onToggleSource: toggleSource,
|
|
180
|
+
totalCount: totalCount,
|
|
181
|
+
filteredCount: filteredCount
|
|
182
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_UnifiedEventList.UnifiedEventList, {
|
|
183
|
+
events: filteredEvents,
|
|
184
|
+
selectedEventId: undefined,
|
|
185
|
+
expandedEventId: expandedEventId,
|
|
186
|
+
onEventPress: handleEventPress,
|
|
187
|
+
onNavigate: handleNavigate,
|
|
188
|
+
isCapturing: isCapturing,
|
|
189
|
+
hiddenEventsCount: hiddenEventsCount,
|
|
190
|
+
onUpgradePress: () => setShowUpgradeModal(true)
|
|
191
|
+
})]
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
195
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.JsModal, {
|
|
196
|
+
visible: visible,
|
|
197
|
+
onClose: onClose,
|
|
198
|
+
onMinimize: onMinimize,
|
|
199
|
+
persistenceKey: persistenceKey,
|
|
200
|
+
header: {
|
|
201
|
+
showToggleButton: true,
|
|
202
|
+
customContent: renderHeaderContent()
|
|
203
|
+
},
|
|
204
|
+
onModeChange: handleModeChange,
|
|
205
|
+
enablePersistence: true,
|
|
206
|
+
initialMode: "bottomSheet",
|
|
207
|
+
enableGlitchEffects: true,
|
|
208
|
+
styles: {},
|
|
209
|
+
disableScrollWrapper: true,
|
|
210
|
+
children: TickProvider ? /*#__PURE__*/(0, _jsxRuntime.jsx)(TickProvider, {
|
|
211
|
+
children: content
|
|
212
|
+
}) : content
|
|
213
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.UpgradeModal, {
|
|
214
|
+
visible: showUpgradeModal,
|
|
215
|
+
onClose: () => setShowUpgradeModal(false),
|
|
216
|
+
featureName: "Unlimited Events",
|
|
217
|
+
description: "View your complete event history to debug complex flows and track down issues.",
|
|
218
|
+
benefits: ["Unlimited event history (vs 25 events)", "Export events to Markdown, JSON, or plain text", "Share event flows with teammates", "Feed event context directly to AI assistants"]
|
|
219
|
+
})]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const styles = _reactNative.StyleSheet.create({
|
|
223
|
+
container: {
|
|
224
|
+
flex: 1,
|
|
225
|
+
backgroundColor: _sharedUi.buoyColors.base
|
|
226
|
+
},
|
|
227
|
+
headerTitleContainer: {
|
|
228
|
+
flexDirection: "row",
|
|
229
|
+
alignItems: "baseline",
|
|
230
|
+
gap: 8
|
|
231
|
+
},
|
|
232
|
+
headerTitle: {
|
|
233
|
+
fontSize: 16,
|
|
234
|
+
fontWeight: "600",
|
|
235
|
+
color: _sharedUi.buoyColors.text
|
|
236
|
+
},
|
|
237
|
+
headerSubtitle: {
|
|
238
|
+
fontSize: 12,
|
|
239
|
+
color: _sharedUi.buoyColors.textMuted
|
|
240
|
+
},
|
|
241
|
+
headerActionButton: {
|
|
242
|
+
width: 32,
|
|
243
|
+
height: 32,
|
|
244
|
+
borderRadius: 8,
|
|
245
|
+
backgroundColor: _sharedUi.buoyColors.card,
|
|
246
|
+
borderWidth: 1,
|
|
247
|
+
borderColor: _sharedUi.buoyColors.border,
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
justifyContent: "center"
|
|
250
|
+
},
|
|
251
|
+
headerActionButtonDisabled: {
|
|
252
|
+
opacity: 0.55
|
|
253
|
+
},
|
|
254
|
+
startButton: {
|
|
255
|
+
backgroundColor: _sharedUi.buoyColors.success + "20",
|
|
256
|
+
borderColor: _sharedUi.buoyColors.success + "40"
|
|
257
|
+
},
|
|
258
|
+
stopButton: {
|
|
259
|
+
backgroundColor: _sharedUi.buoyColors.error + "20",
|
|
260
|
+
borderColor: _sharedUi.buoyColors.error + "40"
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
//# sourceMappingURL=EventsModal.js.map
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactQueryEventDetail = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* ReactQueryEventDetail
|
|
14
|
+
*
|
|
15
|
+
* Detail view for React Query events in the Events DevTools.
|
|
16
|
+
* Styled similarly to the React Query DevTools detail view.
|
|
17
|
+
*
|
|
18
|
+
* Uses local type definitions to avoid hard dependency on @buoy-gg/react-query.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Extended React Query event with additional data fields
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Event type display configuration
|
|
27
|
+
*/
|
|
28
|
+
const EVENT_TYPE_CONFIG = {
|
|
29
|
+
"query-fetch-start": {
|
|
30
|
+
label: "Query Fetching",
|
|
31
|
+
color: _sharedUi.buoyColors.primary,
|
|
32
|
+
icon: "hourglass"
|
|
33
|
+
},
|
|
34
|
+
"query-fetch-success": {
|
|
35
|
+
label: "Query Success",
|
|
36
|
+
color: _sharedUi.buoyColors.success,
|
|
37
|
+
icon: "checkmark"
|
|
38
|
+
},
|
|
39
|
+
"query-fetch-error": {
|
|
40
|
+
label: "Query Error",
|
|
41
|
+
color: _sharedUi.buoyColors.error,
|
|
42
|
+
icon: "close"
|
|
43
|
+
},
|
|
44
|
+
"query-invalidated": {
|
|
45
|
+
label: "Query Invalidated",
|
|
46
|
+
color: _sharedUi.buoyColors.warning,
|
|
47
|
+
icon: "refresh"
|
|
48
|
+
},
|
|
49
|
+
"mutation-start": {
|
|
50
|
+
label: "Mutation Started",
|
|
51
|
+
color: _sharedUi.buoyColors.primary,
|
|
52
|
+
icon: "hourglass"
|
|
53
|
+
},
|
|
54
|
+
"mutation-success": {
|
|
55
|
+
label: "Mutation Success",
|
|
56
|
+
color: _sharedUi.buoyColors.success,
|
|
57
|
+
icon: "checkmark"
|
|
58
|
+
},
|
|
59
|
+
"mutation-error": {
|
|
60
|
+
label: "Mutation Error",
|
|
61
|
+
color: _sharedUi.buoyColors.error,
|
|
62
|
+
icon: "close"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const ReactQueryEventDetail = exports.ReactQueryEventDetail = /*#__PURE__*/(0, _react.memo)(function ReactQueryEventDetail({
|
|
66
|
+
event
|
|
67
|
+
}) {
|
|
68
|
+
const reactQueryEvent = event.originalEvent;
|
|
69
|
+
const eventConfig = EVENT_TYPE_CONFIG[reactQueryEvent.type] || {
|
|
70
|
+
label: reactQueryEvent.type,
|
|
71
|
+
color: _sharedUi.buoyColors.textMuted,
|
|
72
|
+
icon: "help"
|
|
73
|
+
};
|
|
74
|
+
const isQuery = reactQueryEvent.type.startsWith("query-");
|
|
75
|
+
const isMutation = reactQueryEvent.type.startsWith("mutation-");
|
|
76
|
+
|
|
77
|
+
// Format query/mutation key for display
|
|
78
|
+
const keyDisplay = (0, _react.useMemo)(() => {
|
|
79
|
+
const key = isQuery ? reactQueryEvent.queryKey : reactQueryEvent.mutationKey;
|
|
80
|
+
if (!key) {
|
|
81
|
+
// For mutations without a key, show the mutation ID
|
|
82
|
+
if (isMutation && reactQueryEvent.mutationId !== undefined) {
|
|
83
|
+
return `Mutation #${reactQueryEvent.mutationId}`;
|
|
84
|
+
}
|
|
85
|
+
return "No key";
|
|
86
|
+
}
|
|
87
|
+
return (0, _sharedUi.displayValue)(key, true);
|
|
88
|
+
}, [reactQueryEvent, isQuery, isMutation]);
|
|
89
|
+
|
|
90
|
+
// Format timestamp
|
|
91
|
+
const timestamp = new Date(reactQueryEvent.timestamp);
|
|
92
|
+
const timeString = timestamp.toLocaleTimeString("en-US", {
|
|
93
|
+
hour: "2-digit",
|
|
94
|
+
minute: "2-digit",
|
|
95
|
+
second: "2-digit",
|
|
96
|
+
hour12: true
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Determine what data to show
|
|
100
|
+
const hasData = isQuery ? !!reactQueryEvent.queryData : !!reactQueryEvent.mutationData;
|
|
101
|
+
const hasError = isQuery ? !!reactQueryEvent.queryError : !!reactQueryEvent.mutationError;
|
|
102
|
+
const hasVariables = isMutation && !!reactQueryEvent.mutationVariables;
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
104
|
+
style: styles.container,
|
|
105
|
+
contentContainerStyle: styles.contentContainer,
|
|
106
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
107
|
+
style: styles.section,
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
109
|
+
style: [styles.eventTypeContainer, {
|
|
110
|
+
borderColor: eventConfig.color + "4D"
|
|
111
|
+
}],
|
|
112
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
113
|
+
style: [styles.eventTypeHeader, {
|
|
114
|
+
backgroundColor: eventConfig.color + "15",
|
|
115
|
+
color: eventConfig.color
|
|
116
|
+
}],
|
|
117
|
+
children: eventConfig.label
|
|
118
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
119
|
+
style: styles.eventTypeContent,
|
|
120
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
121
|
+
style: styles.keyRow,
|
|
122
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
123
|
+
horizontal: true,
|
|
124
|
+
style: styles.keyScrollView,
|
|
125
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
126
|
+
style: styles.keyText,
|
|
127
|
+
children: keyDisplay
|
|
128
|
+
})
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(EventStatusChip, {
|
|
130
|
+
type: reactQueryEvent.type,
|
|
131
|
+
color: eventConfig.color
|
|
132
|
+
})]
|
|
133
|
+
}), reactQueryEvent.duration !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
134
|
+
style: styles.row,
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
136
|
+
style: styles.labelText,
|
|
137
|
+
children: "Duration:"
|
|
138
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
139
|
+
style: styles.valueText,
|
|
140
|
+
children: [reactQueryEvent.duration.toFixed(0), "ms"]
|
|
141
|
+
})]
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
143
|
+
style: styles.row,
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
145
|
+
style: styles.labelText,
|
|
146
|
+
children: "Timestamp:"
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
148
|
+
style: styles.valueText,
|
|
149
|
+
children: timeString
|
|
150
|
+
})]
|
|
151
|
+
}), isQuery && reactQueryEvent.queryHash && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
152
|
+
style: styles.row,
|
|
153
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
154
|
+
style: styles.labelText,
|
|
155
|
+
children: "Query Hash:"
|
|
156
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
157
|
+
style: [styles.valueText, styles.hashText],
|
|
158
|
+
numberOfLines: 1,
|
|
159
|
+
children: reactQueryEvent.queryHash
|
|
160
|
+
})]
|
|
161
|
+
}), isMutation && reactQueryEvent.mutationId !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
162
|
+
style: styles.row,
|
|
163
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
164
|
+
style: styles.labelText,
|
|
165
|
+
children: "Mutation ID:"
|
|
166
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
167
|
+
style: styles.valueText,
|
|
168
|
+
children: ["#", reactQueryEvent.mutationId]
|
|
169
|
+
})]
|
|
170
|
+
})]
|
|
171
|
+
})]
|
|
172
|
+
})
|
|
173
|
+
}), hasVariables && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
174
|
+
style: styles.section,
|
|
175
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
176
|
+
style: styles.dataContainer,
|
|
177
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
178
|
+
style: [styles.dataHeader, {
|
|
179
|
+
color: _sharedUi.buoyColors.warning
|
|
180
|
+
}],
|
|
181
|
+
children: "Variables"
|
|
182
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
183
|
+
style: styles.dataContent,
|
|
184
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
185
|
+
title: "",
|
|
186
|
+
data: reactQueryEvent.mutationVariables,
|
|
187
|
+
showTypeFilter: false,
|
|
188
|
+
initialExpanded: true
|
|
189
|
+
})
|
|
190
|
+
})]
|
|
191
|
+
})
|
|
192
|
+
}), hasData && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
193
|
+
style: styles.section,
|
|
194
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
195
|
+
style: styles.dataContainer,
|
|
196
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
197
|
+
style: [styles.dataHeader, {
|
|
198
|
+
color: _sharedUi.buoyColors.success
|
|
199
|
+
}],
|
|
200
|
+
children: isQuery ? "Query Data" : "Mutation Result"
|
|
201
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
202
|
+
style: styles.dataContent,
|
|
203
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
204
|
+
title: "",
|
|
205
|
+
data: isQuery ? reactQueryEvent.queryData : reactQueryEvent.mutationData,
|
|
206
|
+
showTypeFilter: false,
|
|
207
|
+
initialExpanded: true
|
|
208
|
+
})
|
|
209
|
+
})]
|
|
210
|
+
})
|
|
211
|
+
}), hasError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
212
|
+
style: styles.section,
|
|
213
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
214
|
+
style: [styles.dataContainer, styles.errorContainer],
|
|
215
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
216
|
+
style: [styles.dataHeader, styles.errorHeader],
|
|
217
|
+
children: "Error"
|
|
218
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
219
|
+
style: styles.dataContent,
|
|
220
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
221
|
+
title: "",
|
|
222
|
+
data: isQuery ? reactQueryEvent.queryError : reactQueryEvent.mutationError,
|
|
223
|
+
showTypeFilter: false,
|
|
224
|
+
initialExpanded: true
|
|
225
|
+
})
|
|
226
|
+
})]
|
|
227
|
+
})
|
|
228
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
229
|
+
style: styles.section,
|
|
230
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
231
|
+
style: styles.dataContainer,
|
|
232
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
233
|
+
style: styles.dataHeader,
|
|
234
|
+
children: "Event Details"
|
|
235
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
236
|
+
style: styles.dataContent,
|
|
237
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
238
|
+
title: "",
|
|
239
|
+
data: reactQueryEvent,
|
|
240
|
+
showTypeFilter: true,
|
|
241
|
+
initialExpanded: false
|
|
242
|
+
})
|
|
243
|
+
})]
|
|
244
|
+
})
|
|
245
|
+
})]
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Status chip component for event type
|
|
251
|
+
*/
|
|
252
|
+
function EventStatusChip({
|
|
253
|
+
type,
|
|
254
|
+
color
|
|
255
|
+
}) {
|
|
256
|
+
const getStatusLabel = () => {
|
|
257
|
+
if (type.includes("start")) return "PENDING";
|
|
258
|
+
if (type.includes("success")) return "SUCCESS";
|
|
259
|
+
if (type.includes("error")) return "ERROR";
|
|
260
|
+
if (type.includes("invalidated")) return "INVALIDATED";
|
|
261
|
+
return type.toUpperCase();
|
|
262
|
+
};
|
|
263
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
264
|
+
style: [styles.statusChip, {
|
|
265
|
+
backgroundColor: color + "15",
|
|
266
|
+
borderColor: color + "33"
|
|
267
|
+
}],
|
|
268
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
269
|
+
style: [styles.statusChipText, {
|
|
270
|
+
color
|
|
271
|
+
}],
|
|
272
|
+
children: getStatusLabel()
|
|
273
|
+
})
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
const styles = _reactNative.StyleSheet.create({
|
|
277
|
+
container: {
|
|
278
|
+
flex: 1,
|
|
279
|
+
backgroundColor: _sharedUi.buoyColors.base
|
|
280
|
+
},
|
|
281
|
+
contentContainer: {
|
|
282
|
+
padding: 8,
|
|
283
|
+
paddingBottom: 24
|
|
284
|
+
},
|
|
285
|
+
section: {
|
|
286
|
+
marginBottom: 12
|
|
287
|
+
},
|
|
288
|
+
// Event type container (like QueryDetails)
|
|
289
|
+
eventTypeContainer: {
|
|
290
|
+
minWidth: 200,
|
|
291
|
+
backgroundColor: _sharedUi.buoyColors.card,
|
|
292
|
+
borderRadius: 6,
|
|
293
|
+
borderWidth: 1,
|
|
294
|
+
overflow: "hidden",
|
|
295
|
+
shadowColor: _sharedUi.buoyColors.primary,
|
|
296
|
+
shadowOffset: {
|
|
297
|
+
width: 0,
|
|
298
|
+
height: 0
|
|
299
|
+
},
|
|
300
|
+
shadowOpacity: 0.1,
|
|
301
|
+
shadowRadius: 6
|
|
302
|
+
},
|
|
303
|
+
eventTypeHeader: {
|
|
304
|
+
paddingHorizontal: 12,
|
|
305
|
+
paddingVertical: 10,
|
|
306
|
+
fontWeight: "600",
|
|
307
|
+
fontSize: 12,
|
|
308
|
+
borderBottomWidth: 1,
|
|
309
|
+
borderBottomColor: _sharedUi.buoyColors.primary + "33",
|
|
310
|
+
letterSpacing: 0.5,
|
|
311
|
+
textTransform: "uppercase",
|
|
312
|
+
fontFamily: "monospace"
|
|
313
|
+
},
|
|
314
|
+
eventTypeContent: {
|
|
315
|
+
padding: 0
|
|
316
|
+
},
|
|
317
|
+
keyRow: {
|
|
318
|
+
flexDirection: "row",
|
|
319
|
+
justifyContent: "space-between",
|
|
320
|
+
alignItems: "center",
|
|
321
|
+
paddingHorizontal: 12,
|
|
322
|
+
paddingVertical: 10,
|
|
323
|
+
borderBottomWidth: 1,
|
|
324
|
+
borderBottomColor: _sharedUi.buoyColors.textMuted + "66"
|
|
325
|
+
},
|
|
326
|
+
keyScrollView: {
|
|
327
|
+
flex: 1,
|
|
328
|
+
marginRight: 8
|
|
329
|
+
},
|
|
330
|
+
keyText: {
|
|
331
|
+
fontSize: 12,
|
|
332
|
+
color: _sharedUi.buoyColors.text,
|
|
333
|
+
fontFamily: "monospace",
|
|
334
|
+
lineHeight: 18,
|
|
335
|
+
backgroundColor: _sharedUi.buoyColors.primary + "15",
|
|
336
|
+
paddingHorizontal: 8,
|
|
337
|
+
paddingVertical: 4,
|
|
338
|
+
borderRadius: 4,
|
|
339
|
+
borderWidth: 1,
|
|
340
|
+
borderColor: _sharedUi.buoyColors.primary + "4D"
|
|
341
|
+
},
|
|
342
|
+
row: {
|
|
343
|
+
flexDirection: "row",
|
|
344
|
+
justifyContent: "space-between",
|
|
345
|
+
alignItems: "center",
|
|
346
|
+
paddingHorizontal: 12,
|
|
347
|
+
paddingVertical: 10,
|
|
348
|
+
borderBottomWidth: 1,
|
|
349
|
+
borderBottomColor: _sharedUi.buoyColors.textMuted + "66"
|
|
350
|
+
},
|
|
351
|
+
labelText: {
|
|
352
|
+
fontSize: 10,
|
|
353
|
+
color: _sharedUi.buoyColors.textSecondary,
|
|
354
|
+
fontWeight: "600",
|
|
355
|
+
letterSpacing: 0.5,
|
|
356
|
+
textTransform: "uppercase",
|
|
357
|
+
fontFamily: "monospace"
|
|
358
|
+
},
|
|
359
|
+
valueText: {
|
|
360
|
+
fontSize: 12,
|
|
361
|
+
color: _sharedUi.buoyColors.text,
|
|
362
|
+
fontWeight: "500",
|
|
363
|
+
fontVariant: ["tabular-nums"],
|
|
364
|
+
fontFamily: "monospace"
|
|
365
|
+
},
|
|
366
|
+
hashText: {
|
|
367
|
+
flex: 1,
|
|
368
|
+
textAlign: "right",
|
|
369
|
+
marginLeft: 8
|
|
370
|
+
},
|
|
371
|
+
// Status chip
|
|
372
|
+
statusChip: {
|
|
373
|
+
paddingHorizontal: 8,
|
|
374
|
+
paddingVertical: 4,
|
|
375
|
+
borderWidth: 1,
|
|
376
|
+
borderRadius: 6,
|
|
377
|
+
alignSelf: "flex-start"
|
|
378
|
+
},
|
|
379
|
+
statusChipText: {
|
|
380
|
+
fontSize: 11,
|
|
381
|
+
fontWeight: "600",
|
|
382
|
+
textTransform: "uppercase",
|
|
383
|
+
letterSpacing: 0.5,
|
|
384
|
+
fontFamily: "monospace"
|
|
385
|
+
},
|
|
386
|
+
// Data containers
|
|
387
|
+
dataContainer: {
|
|
388
|
+
minWidth: 200,
|
|
389
|
+
backgroundColor: _sharedUi.buoyColors.card,
|
|
390
|
+
borderRadius: 6,
|
|
391
|
+
borderWidth: 1,
|
|
392
|
+
borderColor: _sharedUi.buoyColors.primary + "4D",
|
|
393
|
+
overflow: "hidden",
|
|
394
|
+
shadowColor: _sharedUi.buoyColors.primary,
|
|
395
|
+
shadowOffset: {
|
|
396
|
+
width: 0,
|
|
397
|
+
height: 0
|
|
398
|
+
},
|
|
399
|
+
shadowOpacity: 0.1,
|
|
400
|
+
shadowRadius: 6
|
|
401
|
+
},
|
|
402
|
+
dataHeader: {
|
|
403
|
+
backgroundColor: _sharedUi.buoyColors.primary + "1A",
|
|
404
|
+
paddingHorizontal: 12,
|
|
405
|
+
paddingVertical: 10,
|
|
406
|
+
fontWeight: "600",
|
|
407
|
+
fontSize: 12,
|
|
408
|
+
color: _sharedUi.buoyColors.primary,
|
|
409
|
+
borderBottomWidth: 1,
|
|
410
|
+
borderBottomColor: _sharedUi.buoyColors.primary + "33",
|
|
411
|
+
letterSpacing: 0.5,
|
|
412
|
+
textTransform: "uppercase",
|
|
413
|
+
fontFamily: "monospace"
|
|
414
|
+
},
|
|
415
|
+
dataContent: {
|
|
416
|
+
padding: 8
|
|
417
|
+
},
|
|
418
|
+
// Error container
|
|
419
|
+
errorContainer: {
|
|
420
|
+
borderColor: _sharedUi.buoyColors.error + "4D"
|
|
421
|
+
},
|
|
422
|
+
errorHeader: {
|
|
423
|
+
backgroundColor: _sharedUi.buoyColors.error + "1A",
|
|
424
|
+
color: _sharedUi.buoyColors.error,
|
|
425
|
+
borderBottomColor: _sharedUi.buoyColors.error + "33"
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
//# sourceMappingURL=ReactQueryEventDetail.js.map
|