@buoy-gg/events 7.0.40 → 7.0.42
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/README.md +11 -60
- package/lib/commonjs/components/EventsCopySettingsView.js +1 -581
- package/lib/commonjs/components/EventsModal.js +1 -387
- package/lib/commonjs/components/ReactQueryEventDetail.js +1 -433
- package/lib/commonjs/components/UnifiedEventDetail.js +1 -556
- package/lib/commonjs/components/UnifiedEventFilters.js +1 -160
- package/lib/commonjs/components/UnifiedEventItem.js +1 -417
- package/lib/commonjs/components/UnifiedEventList.js +1 -187
- package/lib/commonjs/components/UnifiedEventViewer.js +1 -130
- package/lib/commonjs/hooks/useUnifiedEvents.js +1 -419
- package/lib/commonjs/index.js +1 -282
- package/lib/commonjs/preset.js +1 -60
- package/lib/commonjs/sources/sourceIds.js +1 -30
- package/lib/commonjs/stores/unifiedEventStore.js +1 -712
- package/lib/commonjs/sync/eventsSyncAdapter.js +1 -358
- package/lib/commonjs/types/copySettings.js +1 -249
- package/lib/commonjs/types/index.js +1 -17
- package/lib/commonjs/utils/autoDiscoverEventSources.js +1 -1065
- package/lib/commonjs/utils/badgeSelectionStorage.js +1 -126
- package/lib/commonjs/utils/copySettingsStorage.js +1 -43
- package/lib/commonjs/utils/correlationUtils.js +1 -130
- package/lib/commonjs/utils/eventExportFormatter.js +1 -1912
- package/lib/commonjs/utils/eventTransformers.js +1 -496
- package/lib/commonjs/utils/eventVisibility.js +1 -76
- package/lib/commonjs/utils/testIDs.js +1 -91
- package/lib/module/components/EventsCopySettingsView.js +1 -577
- package/lib/module/components/EventsModal.js +1 -383
- package/lib/module/components/ReactQueryEventDetail.js +1 -429
- package/lib/module/components/UnifiedEventDetail.js +1 -552
- package/lib/module/components/UnifiedEventFilters.js +1 -156
- package/lib/module/components/UnifiedEventItem.js +1 -413
- package/lib/module/components/UnifiedEventList.js +1 -183
- package/lib/module/components/UnifiedEventViewer.js +1 -126
- package/lib/module/hooks/useUnifiedEvents.js +1 -416
- package/lib/module/index.js +1 -102
- package/lib/module/preset.js +1 -57
- package/lib/module/sources/sourceIds.js +1 -26
- package/lib/module/stores/unifiedEventStore.js +1 -678
- package/lib/module/sync/eventsSyncAdapter.js +1 -354
- package/lib/module/types/copySettings.js +1 -244
- package/lib/module/types/index.js +1 -37
- package/lib/module/utils/autoDiscoverEventSources.js +1 -1057
- package/lib/module/utils/badgeSelectionStorage.js +1 -116
- package/lib/module/utils/copySettingsStorage.js +1 -37
- package/lib/module/utils/correlationUtils.js +1 -120
- package/lib/module/utils/eventExportFormatter.js +1 -1901
- package/lib/module/utils/eventTransformers.js +1 -487
- package/lib/module/utils/eventVisibility.js +1 -70
- package/lib/module/utils/testIDs.js +1 -83
- package/lib/typescript/components/EventsModal.d.ts +1 -7
- package/lib/typescript/components/UnifiedEventDetail.d.ts +2 -9
- package/lib/typescript/components/UnifiedEventItem.d.ts +0 -7
- package/lib/web/index.mjs +12 -0
- package/package.json +31 -11
- package/lib/commonjs/components/EventsCopySettingsView.js.map +0 -1
- package/lib/commonjs/components/EventsModal.js.map +0 -1
- package/lib/commonjs/components/ReactQueryEventDetail.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventDetail.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventFilters.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventItem.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventList.js.map +0 -1
- package/lib/commonjs/components/UnifiedEventViewer.js.map +0 -1
- package/lib/commonjs/hooks/useUnifiedEvents.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/sources/sourceIds.js.map +0 -1
- package/lib/commonjs/stores/unifiedEventStore.js.map +0 -1
- package/lib/commonjs/sync/eventsSyncAdapter.js.map +0 -1
- package/lib/commonjs/types/copySettings.js.map +0 -1
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/utils/autoDiscoverEventSources.js.map +0 -1
- package/lib/commonjs/utils/badgeSelectionStorage.js.map +0 -1
- package/lib/commonjs/utils/copySettingsStorage.js.map +0 -1
- package/lib/commonjs/utils/correlationUtils.js.map +0 -1
- package/lib/commonjs/utils/eventExportFormatter.js.map +0 -1
- package/lib/commonjs/utils/eventTransformers.js.map +0 -1
- package/lib/commonjs/utils/eventVisibility.js.map +0 -1
- package/lib/commonjs/utils/testIDs.js.map +0 -1
- package/lib/module/components/EventsCopySettingsView.js.map +0 -1
- package/lib/module/components/EventsModal.js.map +0 -1
- package/lib/module/components/ReactQueryEventDetail.js.map +0 -1
- package/lib/module/components/UnifiedEventDetail.js.map +0 -1
- package/lib/module/components/UnifiedEventFilters.js.map +0 -1
- package/lib/module/components/UnifiedEventItem.js.map +0 -1
- package/lib/module/components/UnifiedEventList.js.map +0 -1
- package/lib/module/components/UnifiedEventViewer.js.map +0 -1
- package/lib/module/hooks/useUnifiedEvents.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/sources/sourceIds.js.map +0 -1
- package/lib/module/stores/unifiedEventStore.js.map +0 -1
- package/lib/module/sync/eventsSyncAdapter.js.map +0 -1
- package/lib/module/types/copySettings.js.map +0 -1
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/utils/autoDiscoverEventSources.js.map +0 -1
- package/lib/module/utils/badgeSelectionStorage.js.map +0 -1
- package/lib/module/utils/copySettingsStorage.js.map +0 -1
- package/lib/module/utils/correlationUtils.js.map +0 -1
- package/lib/module/utils/eventExportFormatter.js.map +0 -1
- package/lib/module/utils/eventTransformers.js.map +0 -1
- package/lib/module/utils/eventVisibility.js.map +0 -1
- package/lib/module/utils/testIDs.js.map +0 -1
- package/lib/typescript/components/EventsCopySettingsView.d.ts.map +0 -1
- package/lib/typescript/components/EventsModal.d.ts.map +0 -1
- package/lib/typescript/components/ReactQueryEventDetail.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventDetail.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventFilters.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventItem.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventList.d.ts.map +0 -1
- package/lib/typescript/components/UnifiedEventViewer.d.ts.map +0 -1
- package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/sources/sourceIds.d.ts.map +0 -1
- package/lib/typescript/stores/unifiedEventStore.d.ts.map +0 -1
- package/lib/typescript/sync/eventsSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/types/copySettings.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +0 -1
- package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +0 -1
- package/lib/typescript/utils/copySettingsStorage.d.ts.map +0 -1
- package/lib/typescript/utils/correlationUtils.d.ts.map +0 -1
- package/lib/typescript/utils/eventExportFormatter.d.ts.map +0 -1
- package/lib/typescript/utils/eventTransformers.d.ts.map +0 -1
- package/lib/typescript/utils/eventVisibility.d.ts.map +0 -1
- package/lib/typescript/utils/testIDs.d.ts.map +0 -1
|
@@ -1,496 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformAsyncStorageEvent = transformAsyncStorageEvent;
|
|
7
|
-
exports.transformNetworkEvent = transformNetworkEvent;
|
|
8
|
-
exports.transformReactQueryEvent = transformReactQueryEvent;
|
|
9
|
-
exports.transformReduxAction = transformReduxAction;
|
|
10
|
-
exports.transformRouteEvent = transformRouteEvent;
|
|
11
|
-
exports.transformStorageEvent = transformStorageEvent;
|
|
12
|
-
/**
|
|
13
|
-
* Event Transformers
|
|
14
|
-
*
|
|
15
|
-
* Transform events from each source into the unified UnifiedEvent format.
|
|
16
|
-
*
|
|
17
|
-
* Note: These transformers use generic types to avoid hard dependencies
|
|
18
|
-
* on tool packages. The actual transformation logic is in autoDiscoverEventSources.ts.
|
|
19
|
-
* This file is kept for backwards compatibility and type exports.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
let eventIdCounter = 0;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Generate a unique event ID
|
|
26
|
-
*/
|
|
27
|
-
function generateEventId(source) {
|
|
28
|
-
return `${source}-${Date.now()}-${++eventIdCounter}`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// Storage Event Types (for backwards compatibility)
|
|
33
|
-
// ============================================================================
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* AsyncStorage event action types
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Generic AsyncStorage event structure
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Generic Storage event (AsyncStorage or MMKV)
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get human-readable action name for AsyncStorage events
|
|
49
|
-
*/
|
|
50
|
-
function getAsyncStorageActionLabel(action) {
|
|
51
|
-
switch (action) {
|
|
52
|
-
case "setItem":
|
|
53
|
-
return "Set Item";
|
|
54
|
-
case "removeItem":
|
|
55
|
-
return "Remove Item";
|
|
56
|
-
case "mergeItem":
|
|
57
|
-
return "Merge Item";
|
|
58
|
-
case "clear":
|
|
59
|
-
return "Clear All";
|
|
60
|
-
case "multiSet":
|
|
61
|
-
return "Multi Set";
|
|
62
|
-
case "multiRemove":
|
|
63
|
-
return "Multi Remove";
|
|
64
|
-
case "multiMerge":
|
|
65
|
-
return "Multi Merge";
|
|
66
|
-
default:
|
|
67
|
-
return action;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get subtitle for AsyncStorage event
|
|
73
|
-
*/
|
|
74
|
-
function getAsyncStorageSubtitle(event) {
|
|
75
|
-
const {
|
|
76
|
-
action,
|
|
77
|
-
data
|
|
78
|
-
} = event;
|
|
79
|
-
switch (action) {
|
|
80
|
-
case "setItem":
|
|
81
|
-
case "removeItem":
|
|
82
|
-
case "mergeItem":
|
|
83
|
-
return data?.key || "unknown key";
|
|
84
|
-
case "multiSet":
|
|
85
|
-
case "multiMerge":
|
|
86
|
-
{
|
|
87
|
-
const pairCount = data?.pairs?.length || 0;
|
|
88
|
-
return `${pairCount} key${pairCount !== 1 ? "s" : ""}`;
|
|
89
|
-
}
|
|
90
|
-
case "multiRemove":
|
|
91
|
-
{
|
|
92
|
-
const keyCount = data?.keys?.length || 0;
|
|
93
|
-
return `${keyCount} key${keyCount !== 1 ? "s" : ""}`;
|
|
94
|
-
}
|
|
95
|
-
case "clear":
|
|
96
|
-
return "all keys";
|
|
97
|
-
default:
|
|
98
|
-
return "";
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Get status for storage event based on action type
|
|
104
|
-
*/
|
|
105
|
-
function getStorageStatus(action) {
|
|
106
|
-
if (action.includes("set") || action.includes("Set") || action.includes("merge") || action.includes("Merge")) {
|
|
107
|
-
return "success";
|
|
108
|
-
}
|
|
109
|
-
if (action.includes("remove") || action.includes("Remove") || action === "clear" || action === "delete") {
|
|
110
|
-
return "neutral";
|
|
111
|
-
}
|
|
112
|
-
return "neutral";
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Transform StorageEvent (AsyncStorage or MMKV) to UnifiedEvent
|
|
117
|
-
*/
|
|
118
|
-
function transformStorageEvent(event) {
|
|
119
|
-
if (event.storageType === "async") {
|
|
120
|
-
const asyncEvent = event;
|
|
121
|
-
return {
|
|
122
|
-
id: generateEventId("async"),
|
|
123
|
-
source: "storage-async",
|
|
124
|
-
timestamp: asyncEvent.timestamp.getTime(),
|
|
125
|
-
title: getAsyncStorageActionLabel(asyncEvent.action),
|
|
126
|
-
subtitle: getAsyncStorageSubtitle(asyncEvent),
|
|
127
|
-
status: getStorageStatus(asyncEvent.action),
|
|
128
|
-
originalEvent: asyncEvent
|
|
129
|
-
};
|
|
130
|
-
} else {
|
|
131
|
-
const mmkvEvent = event;
|
|
132
|
-
return {
|
|
133
|
-
id: generateEventId("mmkv"),
|
|
134
|
-
source: "storage-mmkv",
|
|
135
|
-
timestamp: mmkvEvent.timestamp.getTime(),
|
|
136
|
-
title: mmkvEvent.action,
|
|
137
|
-
subtitle: mmkvEvent.data?.key || mmkvEvent.data?.instanceId || "unknown",
|
|
138
|
-
status: getStorageStatus(mmkvEvent.action),
|
|
139
|
-
originalEvent: mmkvEvent
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Legacy export for backwards compatibility
|
|
146
|
-
*/
|
|
147
|
-
function transformAsyncStorageEvent(event) {
|
|
148
|
-
return transformStorageEvent({
|
|
149
|
-
...event,
|
|
150
|
-
storageType: "async"
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// ============================================================================
|
|
155
|
-
// Redux Event Types
|
|
156
|
-
// ============================================================================
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Generic Redux action structure
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Get status for Redux action based on category
|
|
164
|
-
*/
|
|
165
|
-
function getReduxStatus(action) {
|
|
166
|
-
switch (action.category) {
|
|
167
|
-
case "fulfilled":
|
|
168
|
-
return "success";
|
|
169
|
-
case "rejected":
|
|
170
|
-
return "error";
|
|
171
|
-
case "pending":
|
|
172
|
-
return "pending";
|
|
173
|
-
default:
|
|
174
|
-
return action.hasStateChange ? "success" : "neutral";
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Get subtitle for Redux action
|
|
180
|
-
*/
|
|
181
|
-
function getReduxSubtitle(action) {
|
|
182
|
-
if (action.payloadPreview) {
|
|
183
|
-
return action.payloadPreview;
|
|
184
|
-
}
|
|
185
|
-
if (action.hasStateChange && action.diffSummary) {
|
|
186
|
-
return action.diffSummary;
|
|
187
|
-
}
|
|
188
|
-
if (action.duration !== undefined) {
|
|
189
|
-
return `${action.duration.toFixed(1)}ms`;
|
|
190
|
-
}
|
|
191
|
-
return action.sliceName || "";
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Transform ReduxAction to UnifiedEvent
|
|
196
|
-
*/
|
|
197
|
-
function transformReduxAction(action) {
|
|
198
|
-
return {
|
|
199
|
-
id: generateEventId("redux"),
|
|
200
|
-
source: "redux",
|
|
201
|
-
timestamp: action.timestamp,
|
|
202
|
-
title: action.type,
|
|
203
|
-
subtitle: getReduxSubtitle(action),
|
|
204
|
-
status: getReduxStatus(action),
|
|
205
|
-
originalEvent: action
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// ============================================================================
|
|
210
|
-
// Network Event Types
|
|
211
|
-
// ============================================================================
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Generic Network event structure
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Get status for network event based on HTTP status code
|
|
219
|
-
*/
|
|
220
|
-
function getNetworkStatus(event) {
|
|
221
|
-
if (event.status === undefined) {
|
|
222
|
-
return "pending";
|
|
223
|
-
}
|
|
224
|
-
if (event.error || event.status >= 400) {
|
|
225
|
-
return "error";
|
|
226
|
-
}
|
|
227
|
-
if (event.status >= 200 && event.status < 400) {
|
|
228
|
-
return "success";
|
|
229
|
-
}
|
|
230
|
-
return "neutral";
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Get title for network event
|
|
235
|
-
*/
|
|
236
|
-
function getNetworkTitle(event) {
|
|
237
|
-
if (event.operationName) {
|
|
238
|
-
return event.operationName;
|
|
239
|
-
}
|
|
240
|
-
return `${event.method} ${event.path || event.url}`;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Get subtitle for network event
|
|
245
|
-
*/
|
|
246
|
-
function getNetworkSubtitle(event) {
|
|
247
|
-
const parts = [];
|
|
248
|
-
if (event.status !== undefined) {
|
|
249
|
-
parts.push(`${event.status}`);
|
|
250
|
-
} else if (event.error) {
|
|
251
|
-
parts.push("Error");
|
|
252
|
-
} else {
|
|
253
|
-
parts.push("Pending");
|
|
254
|
-
}
|
|
255
|
-
if (event.duration !== undefined) {
|
|
256
|
-
parts.push(`${event.duration.toFixed(0)}ms`);
|
|
257
|
-
}
|
|
258
|
-
if (event.host) {
|
|
259
|
-
parts.push(event.host);
|
|
260
|
-
}
|
|
261
|
-
return parts.join(" · ");
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Transform NetworkEvent to UnifiedEvent
|
|
266
|
-
*/
|
|
267
|
-
function transformNetworkEvent(event) {
|
|
268
|
-
return {
|
|
269
|
-
id: generateEventId("network"),
|
|
270
|
-
source: "network",
|
|
271
|
-
timestamp: event.timestamp,
|
|
272
|
-
title: getNetworkTitle(event),
|
|
273
|
-
subtitle: getNetworkSubtitle(event),
|
|
274
|
-
status: getNetworkStatus(event),
|
|
275
|
-
originalEvent: event
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// ============================================================================
|
|
280
|
-
// React Query Event Types
|
|
281
|
-
// ============================================================================
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Generic React Query event structure
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Format query key for display
|
|
289
|
-
*/
|
|
290
|
-
function formatQueryKey(queryKey) {
|
|
291
|
-
if (!queryKey || queryKey.length === 0) return "unknown";
|
|
292
|
-
return queryKey.map(part => {
|
|
293
|
-
if (typeof part === "string") return part;
|
|
294
|
-
if (typeof part === "number") return String(part);
|
|
295
|
-
if (typeof part === "object" && part !== null) {
|
|
296
|
-
const obj = part;
|
|
297
|
-
const firstValue = Object.values(obj)[0];
|
|
298
|
-
if (typeof firstValue === "string" || typeof firstValue === "number") {
|
|
299
|
-
return String(firstValue);
|
|
300
|
-
}
|
|
301
|
-
return JSON.stringify(part).slice(0, 20);
|
|
302
|
-
}
|
|
303
|
-
return String(part);
|
|
304
|
-
}).join(" › ");
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Get status for React Query event
|
|
309
|
-
*/
|
|
310
|
-
function getReactQueryStatus(event) {
|
|
311
|
-
switch (event.type) {
|
|
312
|
-
case "query-fetch-start":
|
|
313
|
-
case "mutation-start":
|
|
314
|
-
return "pending";
|
|
315
|
-
case "query-fetch-success":
|
|
316
|
-
case "mutation-success":
|
|
317
|
-
return "success";
|
|
318
|
-
case "query-fetch-error":
|
|
319
|
-
case "mutation-error":
|
|
320
|
-
return "error";
|
|
321
|
-
case "query-invalidated":
|
|
322
|
-
return "neutral";
|
|
323
|
-
default:
|
|
324
|
-
return "neutral";
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Get title for React Query event
|
|
330
|
-
*/
|
|
331
|
-
function getReactQueryTitle(event) {
|
|
332
|
-
if (event.queryKey) {
|
|
333
|
-
return formatQueryKey(event.queryKey);
|
|
334
|
-
}
|
|
335
|
-
if (event.mutationKey) {
|
|
336
|
-
return formatQueryKey(event.mutationKey);
|
|
337
|
-
}
|
|
338
|
-
if (event.mutationId !== undefined) {
|
|
339
|
-
return `Mutation #${event.mutationId}`;
|
|
340
|
-
}
|
|
341
|
-
return event.type.replace(/-/g, " ");
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Get subtitle for React Query event
|
|
346
|
-
*/
|
|
347
|
-
function getReactQuerySubtitle(event) {
|
|
348
|
-
const parts = [];
|
|
349
|
-
switch (event.type) {
|
|
350
|
-
case "query-fetch-start":
|
|
351
|
-
parts.push("Fetching");
|
|
352
|
-
break;
|
|
353
|
-
case "query-fetch-success":
|
|
354
|
-
parts.push("Success");
|
|
355
|
-
break;
|
|
356
|
-
case "query-fetch-error":
|
|
357
|
-
parts.push("Error");
|
|
358
|
-
break;
|
|
359
|
-
case "query-invalidated":
|
|
360
|
-
parts.push("Invalidated");
|
|
361
|
-
break;
|
|
362
|
-
case "mutation-start":
|
|
363
|
-
parts.push("Mutating");
|
|
364
|
-
break;
|
|
365
|
-
case "mutation-success":
|
|
366
|
-
parts.push("Success");
|
|
367
|
-
break;
|
|
368
|
-
case "mutation-error":
|
|
369
|
-
parts.push("Error");
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
if (event.duration !== undefined) {
|
|
373
|
-
parts.push(`${event.duration.toFixed(0)}ms`);
|
|
374
|
-
}
|
|
375
|
-
return parts.join(" · ");
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Get correlation ID for React Query event
|
|
380
|
-
*/
|
|
381
|
-
function getReactQueryCorrelationId(event) {
|
|
382
|
-
if (event.queryHash) {
|
|
383
|
-
return `rq-query-${event.queryHash}`;
|
|
384
|
-
}
|
|
385
|
-
if (event.mutationId !== undefined) {
|
|
386
|
-
return `rq-mutation-${event.mutationId}`;
|
|
387
|
-
}
|
|
388
|
-
return undefined;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Get sequence number within correlation group
|
|
393
|
-
*/
|
|
394
|
-
function getReactQuerySequence(event) {
|
|
395
|
-
switch (event.type) {
|
|
396
|
-
case "query-fetch-start":
|
|
397
|
-
case "mutation-start":
|
|
398
|
-
return 1;
|
|
399
|
-
case "query-fetch-success":
|
|
400
|
-
case "query-fetch-error":
|
|
401
|
-
case "mutation-success":
|
|
402
|
-
case "mutation-error":
|
|
403
|
-
return 2;
|
|
404
|
-
case "query-invalidated":
|
|
405
|
-
return 3;
|
|
406
|
-
default:
|
|
407
|
-
return 1;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Determine if a React Query event is a mutation
|
|
413
|
-
*/
|
|
414
|
-
function isReactQueryMutation(event) {
|
|
415
|
-
return event.type.startsWith("mutation-");
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Transform ReactQueryEvent to UnifiedEvent
|
|
420
|
-
*/
|
|
421
|
-
function transformReactQueryEvent(event) {
|
|
422
|
-
const isMutation = isReactQueryMutation(event);
|
|
423
|
-
return {
|
|
424
|
-
id: generateEventId(isMutation ? "react-query-mutation" : "react-query-query"),
|
|
425
|
-
source: isMutation ? "react-query-mutation" : "react-query-query",
|
|
426
|
-
timestamp: event.timestamp,
|
|
427
|
-
title: getReactQueryTitle(event),
|
|
428
|
-
subtitle: getReactQuerySubtitle(event),
|
|
429
|
-
status: getReactQueryStatus(event),
|
|
430
|
-
originalEvent: event,
|
|
431
|
-
correlationId: getReactQueryCorrelationId(event),
|
|
432
|
-
sequenceInGroup: getReactQuerySequence(event)
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// ============================================================================
|
|
437
|
-
// Route Event Types
|
|
438
|
-
// ============================================================================
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Generic Route change event structure
|
|
442
|
-
*/
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Get status for route event
|
|
446
|
-
*/
|
|
447
|
-
function getRouteStatus(event) {
|
|
448
|
-
if (event.pathname === "/") return "success";
|
|
449
|
-
if (Object.keys(event.params).length > 0) return "success";
|
|
450
|
-
return "neutral";
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Get title for route event
|
|
455
|
-
*/
|
|
456
|
-
function getRouteTitle(event) {
|
|
457
|
-
return event.pathname || "/";
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Get subtitle for route event
|
|
462
|
-
*/
|
|
463
|
-
function getRouteSubtitle(event) {
|
|
464
|
-
const parts = [];
|
|
465
|
-
const paramCount = Object.keys(event.params).length;
|
|
466
|
-
if (paramCount > 0) {
|
|
467
|
-
parts.push(`${paramCount} param${paramCount !== 1 ? "s" : ""}`);
|
|
468
|
-
}
|
|
469
|
-
if (event.timeSincePrevious !== undefined && event.timeSincePrevious > 0) {
|
|
470
|
-
if (event.timeSincePrevious < 1000) {
|
|
471
|
-
parts.push(`${event.timeSincePrevious}ms`);
|
|
472
|
-
} else {
|
|
473
|
-
parts.push(`${(event.timeSincePrevious / 1000).toFixed(1)}s`);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
if (event.previousPathname && event.previousPathname !== event.pathname) {
|
|
477
|
-
parts.push(`from ${event.previousPathname}`);
|
|
478
|
-
}
|
|
479
|
-
return parts.join(" · ") || "navigation";
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Transform RouteChangeEvent to UnifiedEvent
|
|
484
|
-
*/
|
|
485
|
-
function transformRouteEvent(event) {
|
|
486
|
-
return {
|
|
487
|
-
id: generateEventId("route"),
|
|
488
|
-
source: "route",
|
|
489
|
-
timestamp: event.timestamp,
|
|
490
|
-
title: getRouteTitle(event),
|
|
491
|
-
subtitle: getRouteSubtitle(event),
|
|
492
|
-
status: getRouteStatus(event),
|
|
493
|
-
originalEvent: event
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
//# sourceMappingURL=eventTransformers.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.transformAsyncStorageEvent=transformAsyncStorageEvent;exports.transformNetworkEvent=transformNetworkEvent;exports.transformReactQueryEvent=transformReactQueryEvent;exports.transformReduxAction=transformReduxAction;exports.transformRouteEvent=transformRouteEvent;exports.transformStorageEvent=transformStorageEvent;let eventIdCounter=0;function generateEventId(e){return`${e}-${Date.now()}-${++eventIdCounter}`}function getAsyncStorageActionLabel(e){switch(e){case"setItem":return"Set Item";case"removeItem":return"Remove Item";case"mergeItem":return"Merge Item";case"clear":return"Clear All";case"multiSet":return"Multi Set";case"multiRemove":return"Multi Remove";case"multiMerge":return"Multi Merge";default:return e}}function getAsyncStorageSubtitle(e){const{action:t,data:r}=e;switch(t){case"setItem":case"removeItem":case"mergeItem":return r?.key||"unknown key";case"multiSet":case"multiMerge":{const u=r?.pairs?.length||0;return`${u} key${u!==1?"s":""}`}case"multiRemove":{const u=r?.keys?.length||0;return`${u} key${u!==1?"s":""}`}case"clear":return"all keys";default:return""}}function getStorageStatus(e){if(e.includes("set")||e.includes("Set")||e.includes("merge")||e.includes("Merge")){return"success"}if(e.includes("remove")||e.includes("Remove")||e==="clear"||e==="delete"){return"neutral"}return"neutral"}function transformStorageEvent(e){if(e.storageType==="async"){const t=e;return{id:generateEventId("async"),source:"storage-async",timestamp:t.timestamp.getTime(),title:getAsyncStorageActionLabel(t.action),subtitle:getAsyncStorageSubtitle(t),status:getStorageStatus(t.action),originalEvent:t}}else{const t=e;return{id:generateEventId("mmkv"),source:"storage-mmkv",timestamp:t.timestamp.getTime(),title:t.action,subtitle:t.data?.key||t.data?.instanceId||"unknown",status:getStorageStatus(t.action),originalEvent:t}}}function transformAsyncStorageEvent(e){return transformStorageEvent({...e,storageType:"async"})}function getReduxStatus(e){switch(e.category){case"fulfilled":return"success";case"rejected":return"error";case"pending":return"pending";default:return e.hasStateChange?"success":"neutral"}}function getReduxSubtitle(e){if(e.payloadPreview){return e.payloadPreview}if(e.hasStateChange&&e.diffSummary){return e.diffSummary}if(e.duration!==void 0){return`${e.duration.toFixed(1)}ms`}return e.sliceName||""}function transformReduxAction(e){return{id:generateEventId("redux"),source:"redux",timestamp:e.timestamp,title:e.type,subtitle:getReduxSubtitle(e),status:getReduxStatus(e),originalEvent:e}}function getNetworkStatus(e){if(e.status===void 0){return"pending"}if(e.error||e.status>=400){return"error"}if(e.status>=200&&e.status<400){return"success"}return"neutral"}function getNetworkTitle(e){if(e.operationName){return e.operationName}return`${e.method} ${e.path||e.url}`}function getNetworkSubtitle(e){const t=[];if(e.status!==void 0){t.push(`${e.status}`)}else if(e.error){t.push("Error")}else{t.push("Pending")}if(e.duration!==void 0){t.push(`${e.duration.toFixed(0)}ms`)}if(e.host){t.push(e.host)}return t.join(" \xB7 ")}function transformNetworkEvent(e){return{id:generateEventId("network"),source:"network",timestamp:e.timestamp,title:getNetworkTitle(e),subtitle:getNetworkSubtitle(e),status:getNetworkStatus(e),originalEvent:e}}function formatQueryKey(e){if(!e||e.length===0)return"unknown";return e.map(t=>{if(typeof t==="string")return t;if(typeof t==="number")return String(t);if(typeof t==="object"&&t!==null){const r=t;const u=Object.values(r)[0];if(typeof u==="string"||typeof u==="number"){return String(u)}return JSON.stringify(t).slice(0,20)}return String(t)}).join(" \u203A ")}function getReactQueryStatus(e){switch(e.type){case"query-fetch-start":case"mutation-start":return"pending";case"query-fetch-success":case"mutation-success":return"success";case"query-fetch-error":case"mutation-error":return"error";case"query-invalidated":return"neutral";default:return"neutral"}}function getReactQueryTitle(e){if(e.queryKey){return formatQueryKey(e.queryKey)}if(e.mutationKey){return formatQueryKey(e.mutationKey)}if(e.mutationId!==void 0){return`Mutation #${e.mutationId}`}return e.type.replace(/-/g," ")}function getReactQuerySubtitle(e){const t=[];switch(e.type){case"query-fetch-start":t.push("Fetching");break;case"query-fetch-success":t.push("Success");break;case"query-fetch-error":t.push("Error");break;case"query-invalidated":t.push("Invalidated");break;case"mutation-start":t.push("Mutating");break;case"mutation-success":t.push("Success");break;case"mutation-error":t.push("Error");break}if(e.duration!==void 0){t.push(`${e.duration.toFixed(0)}ms`)}return t.join(" \xB7 ")}function getReactQueryCorrelationId(e){if(e.queryHash){return`rq-query-${e.queryHash}`}if(e.mutationId!==void 0){return`rq-mutation-${e.mutationId}`}return void 0}function getReactQuerySequence(e){switch(e.type){case"query-fetch-start":case"mutation-start":return 1;case"query-fetch-success":case"query-fetch-error":case"mutation-success":case"mutation-error":return 2;case"query-invalidated":return 3;default:return 1}}function isReactQueryMutation(e){return e.type.startsWith("mutation-")}function transformReactQueryEvent(e){const t=isReactQueryMutation(e);return{id:generateEventId(t?"react-query-mutation":"react-query-query"),source:t?"react-query-mutation":"react-query-query",timestamp:e.timestamp,title:getReactQueryTitle(e),subtitle:getReactQuerySubtitle(e),status:getReactQueryStatus(e),originalEvent:e,correlationId:getReactQueryCorrelationId(e),sequenceInGroup:getReactQuerySequence(e)}}function getRouteStatus(e){if(e.pathname==="/")return"success";if(Object.keys(e.params).length>0)return"success";return"neutral"}function getRouteTitle(e){return e.pathname||"/"}function getRouteSubtitle(e){const t=[];const r=Object.keys(e.params).length;if(r>0){t.push(`${r} param${r!==1?"s":""}`)}if(e.timeSincePrevious!==void 0&&e.timeSincePrevious>0){if(e.timeSincePrevious<1e3){t.push(`${e.timeSincePrevious}ms`)}else{t.push(`${(e.timeSincePrevious/1e3).toFixed(1)}s`)}}if(e.previousPathname&&e.previousPathname!==e.pathname){t.push(`from ${e.previousPathname}`)}return t.join(" \xB7 ")||"navigation"}function transformRouteEvent(e){return{id:generateEventId("route"),source:"route",timestamp:e.timestamp,title:getRouteTitle(e),subtitle:getRouteSubtitle(e),status:getRouteStatus(e),originalEvent:e}}
|
|
@@ -1,76 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isBuoyInternalEvent = isBuoyInternalEvent;
|
|
7
|
-
exports.isEventHiddenFromTool = isEventHiddenFromTool;
|
|
8
|
-
exports.isNetworkEventIgnored = isNetworkEventIgnored;
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
/**
|
|
11
|
-
* Which unified events the Events tool refuses to show, as PURE predicates.
|
|
12
|
-
*
|
|
13
|
-
* These used to live inside `useUnifiedEvents`, which meant the only way to
|
|
14
|
-
* learn "would the tool display this event?" was to render the tool. The
|
|
15
|
-
* desktop Workbench sidebar needs exactly that answer without rendering
|
|
16
|
-
* anything — its per-tool status badge counts events straight off the synced
|
|
17
|
-
* snapshot — and counting the raw snapshot made the badge advertise events
|
|
18
|
-
* that no panel would ever list (an ignored host still ticking up a red ✕).
|
|
19
|
-
*
|
|
20
|
-
* So the rules live here, and both the tool and the sidebar read them.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/** Network hosts used internally by Buoy dev tools */
|
|
24
|
-
const BUOY_INTERNAL_HOSTS = ["api.keygen.sh", "buoy.gg/api/license"];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Check if an event is generated by Buoy's own dev tools (internal housekeeping).
|
|
28
|
-
* These are filtered out by default so users only see their app's events.
|
|
29
|
-
*/
|
|
30
|
-
function isBuoyInternalEvent(event) {
|
|
31
|
-
const original = event.originalEvent;
|
|
32
|
-
if (!original) return false;
|
|
33
|
-
|
|
34
|
-
// Storage events: check if the key belongs to dev tools (@react_buoy prefix)
|
|
35
|
-
if (event.source === "storage-async" || event.source === "storage-mmkv") {
|
|
36
|
-
const key = original.data?.key || original.key;
|
|
37
|
-
if (key && (0, _sharedUi.isDevToolsStorageKey)(key)) return true;
|
|
38
|
-
|
|
39
|
-
// Multi-key operations: check if ALL keys are dev tool keys
|
|
40
|
-
const keys = original.data?.keys || original.data?.pairs?.map(p => p[0]);
|
|
41
|
-
if (keys && keys.length > 0 && keys.every(k => (0, _sharedUi.isDevToolsStorageKey)(k))) return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Network events: check if the host/URL matches Buoy's internal APIs
|
|
45
|
-
if (event.source === "network") {
|
|
46
|
-
const host = original.host || "";
|
|
47
|
-
const url = original.url || "";
|
|
48
|
-
for (const internalHost of BUOY_INTERNAL_HOSTS) {
|
|
49
|
-
if (host.includes(internalHost) || url.includes(internalHost)) return true;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Check whether a network event should be hidden because its URL matches one of
|
|
57
|
-
* the user's shared ignored-domain/URL patterns (the same store the Network tool
|
|
58
|
-
* writes to). Non-network events are never affected.
|
|
59
|
-
*/
|
|
60
|
-
function isNetworkEventIgnored(event, ignoredPatterns) {
|
|
61
|
-
if (event.source !== "network" || ignoredPatterns.length === 0) return false;
|
|
62
|
-
const url = event.originalEvent?.url ?? "";
|
|
63
|
-
return (0, _sharedUi.isUrlIgnored)(url, ignoredPatterns);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Everything the Events tool declines to report on, in one predicate: Buoy's
|
|
68
|
-
* own housekeeping plus the shared ignored-URL patterns. This is hiding the
|
|
69
|
-
* user has no affordance to undo — unlike the source badges and the search box
|
|
70
|
-
* — so anything counting events for display (a header stat, a sidebar badge)
|
|
71
|
-
* must exclude these or it advertises rows that cannot be reached.
|
|
72
|
-
*/
|
|
73
|
-
function isEventHiddenFromTool(event, ignoredPatterns) {
|
|
74
|
-
return isBuoyInternalEvent(event) || isNetworkEventIgnored(event, ignoredPatterns);
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=eventVisibility.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isBuoyInternalEvent=isBuoyInternalEvent;exports.isEventHiddenFromTool=isEventHiddenFromTool;exports.isNetworkEventIgnored=isNetworkEventIgnored;var _sharedUi=require("@buoy-gg/shared-ui");const BUOY_INTERNAL_HOSTS=["api.keygen.sh","buoy.gg/api/license"];function isBuoyInternalEvent(r){const e=r.originalEvent;if(!e)return false;if(r.source==="storage-async"||r.source==="storage-mmkv"){const o=e.data?.key||e.key;if(o&&(0,_sharedUi.isDevToolsStorageKey)(o))return true;const n=e.data?.keys||e.data?.pairs?.map(t=>t[0]);if(n&&n.length>0&&n.every(t=>(0,_sharedUi.isDevToolsStorageKey)(t)))return true}if(r.source==="network"){const o=e.host||"";const n=e.url||"";for(const t of BUOY_INTERNAL_HOSTS){if(o.includes(t)||n.includes(t))return true}}return false}function isNetworkEventIgnored(r,e){if(r.source!=="network"||e.length===0)return false;const o=r.originalEvent?.url??"";return(0,_sharedUi.isUrlIgnored)(o,e)}function isEventHiddenFromTool(r,e){return isBuoyInternalEvent(r)||isNetworkEventIgnored(r,e)}
|
|
@@ -1,91 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.EVENTS_TEST_ID = void 0;
|
|
7
|
-
exports.eventFilterTestID = eventFilterTestID;
|
|
8
|
-
exports.eventIdentity = eventIdentity;
|
|
9
|
-
exports.eventRowTestID = eventRowTestID;
|
|
10
|
-
exports.slugForTestID = slugForTestID;
|
|
11
|
-
/**
|
|
12
|
-
* Events tool test handles.
|
|
13
|
-
*
|
|
14
|
-
* Every tappable and every value the e2e suites read back is addressed
|
|
15
|
-
* `buoy-events-<thing>`. Two rules make this file necessary rather than a
|
|
16
|
-
* convention:
|
|
17
|
-
*
|
|
18
|
-
* 1. **Rows are built by other packages.** A storage row is `StorageEventCard`,
|
|
19
|
-
* a network row is `NetworkEventItemCompact`, and so on — the events tool
|
|
20
|
-
* only wraps them. So the row's handle has to be attached by the wrapper,
|
|
21
|
-
* from the event, which is what `eventRowTestID` is for.
|
|
22
|
-
* 2. **A row's handle must survive the row updating.** A network event is
|
|
23
|
-
* re-emitted when the request completes and REPLACES its row in place, and
|
|
24
|
-
* both its subtitle (status · duration) and its relative timestamp move on
|
|
25
|
-
* their own. Anything derived from what the row renders would therefore
|
|
26
|
-
* change under the test; the identity below is read from `originalEvent`,
|
|
27
|
-
* which is the request itself.
|
|
28
|
-
*
|
|
29
|
-
* The e2e suite mirrors these rules in CommonJS
|
|
30
|
-
* (`example-dev-build/utils/eventsBench.js`) and asserts the two agree.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/** Prefix every handle in this tool shares. */
|
|
34
|
-
const EVENTS_TEST_ID = exports.EVENTS_TEST_ID = "buoy-events";
|
|
35
|
-
|
|
36
|
-
/** `Set Item` → `set-item`. Shared with every other Buoy tool's slug rule. */
|
|
37
|
-
function slugForTestID(value) {
|
|
38
|
-
return String(value ?? "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* What a row is ABOUT, per source — the part a person would use to name it.
|
|
43
|
-
*
|
|
44
|
-
* The title alone is not enough for two sources: every AsyncStorage write is
|
|
45
|
-
* titled "Set Item" (the key is the subtitle), and a React Query entry emits a
|
|
46
|
-
* start and a settle event under one key. Both get their discriminator here.
|
|
47
|
-
*/
|
|
48
|
-
function eventIdentity(event) {
|
|
49
|
-
const original = event.originalEvent ?? {};
|
|
50
|
-
switch (event.source) {
|
|
51
|
-
case "storage-async":
|
|
52
|
-
case "storage-mmkv":
|
|
53
|
-
{
|
|
54
|
-
const data = original.data ?? {};
|
|
55
|
-
const key = data.key ?? (Array.isArray(data.keys) ? data.keys.join("+") : undefined) ?? (Array.isArray(data.pairs) ? data.pairs.map(pair => pair[0]).join("+") : undefined);
|
|
56
|
-
return `${event.title} ${key ?? ""}`;
|
|
57
|
-
}
|
|
58
|
-
case "network":
|
|
59
|
-
{
|
|
60
|
-
// Query strings carry timestamps and cache-busters; the path does not.
|
|
61
|
-
const url = String(original.url ?? "");
|
|
62
|
-
const path = url.split("?")[0] ?? url;
|
|
63
|
-
return `${original.method ?? ""} ${path}`;
|
|
64
|
-
}
|
|
65
|
-
case "react-query":
|
|
66
|
-
case "react-query-query":
|
|
67
|
-
case "react-query-mutation":
|
|
68
|
-
return `${event.title} ${original.type ?? ""}`;
|
|
69
|
-
default:
|
|
70
|
-
// redux (action type), route (pathname), zustand (store), jotai (atom),
|
|
71
|
-
// render (component) all put their identity in the title already.
|
|
72
|
-
return event.title;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Handle for one row of the timeline: `buoy-events-row-network-get-pokemon-1`.
|
|
78
|
-
*
|
|
79
|
-
* Deliberately NOT positional. Rows arrive at the head of the list, so an index
|
|
80
|
-
* names a different event the moment anything else in the app emits — including
|
|
81
|
-
* between the read and the tap.
|
|
82
|
-
*/
|
|
83
|
-
function eventRowTestID(event) {
|
|
84
|
-
return `${EVENTS_TEST_ID}-row-${event.source}-${slugForTestID(eventIdentity(event))}`;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** Handle for a source filter chip: `buoy-events-filter-storage-async`. */
|
|
88
|
-
function eventFilterTestID(source) {
|
|
89
|
-
return `${EVENTS_TEST_ID}-filter-${source}`;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=testIDs.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EVENTS_TEST_ID=void 0;exports.eventFilterTestID=eventFilterTestID;exports.eventIdentity=eventIdentity;exports.eventRowTestID=eventRowTestID;exports.slugForTestID=slugForTestID;const EVENTS_TEST_ID=exports.EVENTS_TEST_ID="buoy-events";function slugForTestID(e){return String(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"unknown"}function eventIdentity(e){const r=e.originalEvent??{};switch(e.source){case"storage-async":case"storage-mmkv":{const t=r.data??{};const s=t.key??(Array.isArray(t.keys)?t.keys.join("+"):void 0)??(Array.isArray(t.pairs)?t.pairs.map(n=>n[0]).join("+"):void 0);return`${e.title} ${s??""}`}case"network":{const t=String(r.url??"");const s=t.split("?")[0]??t;return`${r.method??""} ${s}`}case"react-query":case"react-query-query":case"react-query-mutation":return`${e.title} ${r.type??""}`;default:return e.title}}function eventRowTestID(e){return`${EVENTS_TEST_ID}-row-${e.source}-${slugForTestID(eventIdentity(e))}`}function eventFilterTestID(e){return`${EVENTS_TEST_ID}-filter-${e}`}
|