@buoy-gg/events 7.0.41 → 7.0.43

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