@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,126 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.clearEnabledSources = clearEnabledSources;
|
|
7
|
-
exports.loadCapturingState = loadCapturingState;
|
|
8
|
-
exports.loadEnabledSources = loadEnabledSources;
|
|
9
|
-
exports.loadPausedAt = loadPausedAt;
|
|
10
|
-
exports.saveCapturingState = saveCapturingState;
|
|
11
|
-
exports.saveEnabledSources = saveEnabledSources;
|
|
12
|
-
exports.savePausedAt = savePausedAt;
|
|
13
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
14
|
-
/**
|
|
15
|
-
* Badge Selection Storage
|
|
16
|
-
*
|
|
17
|
-
* Utilities for persisting and restoring the enabled event source badges.
|
|
18
|
-
* Uses the same storage patterns as other packages (React Query, Network, etc.)
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Save the enabled sources to persistent storage
|
|
23
|
-
*/
|
|
24
|
-
async function saveEnabledSources(sources) {
|
|
25
|
-
try {
|
|
26
|
-
const key = _sharedUi.devToolsStorageKeys.events.enabledSources();
|
|
27
|
-
await _sharedUi.persistentStorage.setItem(key, JSON.stringify(sources));
|
|
28
|
-
} catch {
|
|
29
|
-
// Silently fail - persistence is optional
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Load the enabled sources from persistent storage
|
|
35
|
-
* Returns null if no saved state exists
|
|
36
|
-
*/
|
|
37
|
-
async function loadEnabledSources() {
|
|
38
|
-
try {
|
|
39
|
-
const key = _sharedUi.devToolsStorageKeys.events.enabledSources();
|
|
40
|
-
const value = await _sharedUi.persistentStorage.getItem(key);
|
|
41
|
-
if (value && value !== "") {
|
|
42
|
-
return JSON.parse(value);
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
} catch {
|
|
46
|
-
// Silently fail - return null to use defaults
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Clear the saved enabled sources
|
|
53
|
-
*/
|
|
54
|
-
async function clearEnabledSources() {
|
|
55
|
-
try {
|
|
56
|
-
const key = _sharedUi.devToolsStorageKeys.events.enabledSources();
|
|
57
|
-
await _sharedUi.persistentStorage.removeItem(key);
|
|
58
|
-
} catch {
|
|
59
|
-
// Silently fail
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Save the capturing state to persistent storage
|
|
65
|
-
*/
|
|
66
|
-
async function saveCapturingState(isCapturing) {
|
|
67
|
-
try {
|
|
68
|
-
const key = _sharedUi.devToolsStorageKeys.events.isCapturing();
|
|
69
|
-
await _sharedUi.persistentStorage.setItem(key, JSON.stringify(isCapturing));
|
|
70
|
-
} catch {
|
|
71
|
-
// Silently fail - persistence is optional
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Load the capturing state from persistent storage
|
|
77
|
-
* Returns null if no saved state exists (defaults to true on first load)
|
|
78
|
-
*/
|
|
79
|
-
async function loadCapturingState() {
|
|
80
|
-
try {
|
|
81
|
-
const key = _sharedUi.devToolsStorageKeys.events.isCapturing();
|
|
82
|
-
const value = await _sharedUi.persistentStorage.getItem(key);
|
|
83
|
-
if (value !== null && value !== "") {
|
|
84
|
-
return JSON.parse(value);
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
} catch {
|
|
88
|
-
// Silently fail - return null to use defaults
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Persist the moment capture was switched off (ms epoch), or clear it on
|
|
95
|
-
* resume. Kept beside the capturing flag so a remount or relaunch while paused
|
|
96
|
-
* hides events captured into the shared store since the ORIGINAL pause press,
|
|
97
|
-
* not merely since the tool was reopened.
|
|
98
|
-
*/
|
|
99
|
-
async function savePausedAt(pausedAt) {
|
|
100
|
-
try {
|
|
101
|
-
const key = _sharedUi.devToolsStorageKeys.events.pausedAt();
|
|
102
|
-
if (pausedAt === null) {
|
|
103
|
-
await _sharedUi.persistentStorage.removeItem(key);
|
|
104
|
-
} else {
|
|
105
|
-
await _sharedUi.persistentStorage.setItem(key, JSON.stringify(pausedAt));
|
|
106
|
-
}
|
|
107
|
-
} catch {
|
|
108
|
-
// Silently fail - persistence is optional
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** The persisted pause moment, or null when capture is not paused. */
|
|
113
|
-
async function loadPausedAt() {
|
|
114
|
-
try {
|
|
115
|
-
const key = _sharedUi.devToolsStorageKeys.events.pausedAt();
|
|
116
|
-
const value = await _sharedUi.persistentStorage.getItem(key);
|
|
117
|
-
if (value !== null && value !== "") {
|
|
118
|
-
const parsed = JSON.parse(value);
|
|
119
|
-
return typeof parsed === "number" ? parsed : null;
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
} catch {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=badgeSelectionStorage.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.clearEnabledSources=clearEnabledSources;exports.loadCapturingState=loadCapturingState;exports.loadEnabledSources=loadEnabledSources;exports.loadPausedAt=loadPausedAt;exports.saveCapturingState=saveCapturingState;exports.saveEnabledSources=saveEnabledSources;exports.savePausedAt=savePausedAt;var _sharedUi=require("@buoy-gg/shared-ui");async function saveEnabledSources(t){try{const e=_sharedUi.devToolsStorageKeys.events.enabledSources();await _sharedUi.persistentStorage.setItem(e,JSON.stringify(t))}catch{}}async function loadEnabledSources(){try{const t=_sharedUi.devToolsStorageKeys.events.enabledSources();const e=await _sharedUi.persistentStorage.getItem(t);if(e&&e!==""){return JSON.parse(e)}return null}catch{return null}}async function clearEnabledSources(){try{const t=_sharedUi.devToolsStorageKeys.events.enabledSources();await _sharedUi.persistentStorage.removeItem(t)}catch{}}async function saveCapturingState(t){try{const e=_sharedUi.devToolsStorageKeys.events.isCapturing();await _sharedUi.persistentStorage.setItem(e,JSON.stringify(t))}catch{}}async function loadCapturingState(){try{const t=_sharedUi.devToolsStorageKeys.events.isCapturing();const e=await _sharedUi.persistentStorage.getItem(t);if(e!==null&&e!==""){return JSON.parse(e)}return null}catch{return null}}async function savePausedAt(t){try{const e=_sharedUi.devToolsStorageKeys.events.pausedAt();if(t===null){await _sharedUi.persistentStorage.removeItem(e)}else{await _sharedUi.persistentStorage.setItem(e,JSON.stringify(t))}}catch{}}async function loadPausedAt(){try{const t=_sharedUi.devToolsStorageKeys.events.pausedAt();const e=await _sharedUi.persistentStorage.getItem(t);if(e!==null&&e!==""){const s=JSON.parse(e);return typeof s==="number"?s:null}return null}catch{return null}}
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.clearCopySettings = clearCopySettings;
|
|
7
|
-
exports.loadCopySettings = loadCopySettings;
|
|
8
|
-
exports.saveCopySettings = saveCopySettings;
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
var _copySettings = require("../types/copySettings");
|
|
11
|
-
/**
|
|
12
|
-
* Copy Settings Storage
|
|
13
|
-
*
|
|
14
|
-
* Persists the events copy/export settings through the shared
|
|
15
|
-
* `definePersistedSetting` (merge-over-defaults, best-effort save/clear).
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const copySettings = (0, _sharedUi.definePersistedSetting)(_sharedUi.devToolsStorageKeys.events.copySettings(), _copySettings.DEFAULT_COPY_SETTINGS, {
|
|
19
|
-
// Ensure filterSources is always an array
|
|
20
|
-
sanitize: (merged, stored) => ({
|
|
21
|
-
...merged,
|
|
22
|
-
filterSources: stored?.filterSources ?? _copySettings.DEFAULT_COPY_SETTINGS.filterSources
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/** Save the copy settings to persistent storage */
|
|
27
|
-
async function saveCopySettings(settings) {
|
|
28
|
-
await copySettings.save(settings);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Load the copy settings from persistent storage
|
|
33
|
-
* Returns null if no saved state exists
|
|
34
|
-
*/
|
|
35
|
-
async function loadCopySettings() {
|
|
36
|
-
return copySettings.loadOrNull();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Clear the saved copy settings */
|
|
40
|
-
async function clearCopySettings() {
|
|
41
|
-
await copySettings.clear();
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=copySettingsStorage.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.clearCopySettings=clearCopySettings;exports.loadCopySettings=loadCopySettings;exports.saveCopySettings=saveCopySettings;var _sharedUi=require("@buoy-gg/shared-ui");var _copySettings=require("../types/copySettings");const copySettings=(0,_sharedUi.definePersistedSetting)(_sharedUi.devToolsStorageKeys.events.copySettings(),_copySettings.DEFAULT_COPY_SETTINGS,{sanitize:(e,t)=>({...e,filterSources:t?.filterSources??_copySettings.DEFAULT_COPY_SETTINGS.filterSources})});async function saveCopySettings(e){await copySettings.save(e)}async function loadCopySettings(){return copySettings.loadOrNull()}async function clearCopySettings(){await copySettings.clear()}
|
|
@@ -1,130 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buildCorrelationCountMap = buildCorrelationCountMap;
|
|
7
|
-
exports.findRelatedEvents = findRelatedEvents;
|
|
8
|
-
exports.getCorrelationColor = getCorrelationColor;
|
|
9
|
-
exports.getCorrelationGroup = getCorrelationGroup;
|
|
10
|
-
exports.getCorrelationLabel = getCorrelationLabel;
|
|
11
|
-
exports.getRelatedEventsCount = getRelatedEventsCount;
|
|
12
|
-
exports.hasRelatedEvents = hasRelatedEvents;
|
|
13
|
-
/**
|
|
14
|
-
* Correlation Utilities
|
|
15
|
-
*
|
|
16
|
-
* Functions for finding and grouping related events based on correlation IDs.
|
|
17
|
-
* Similar to Redux DevTools' async thunk linking feature.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Find all events related to the given event by correlation ID
|
|
22
|
-
*/
|
|
23
|
-
function findRelatedEvents(event, allEvents) {
|
|
24
|
-
if (!event.correlationId) {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
return allEvents.filter(e => e.correlationId === event.correlationId && e.id !== event.id).sort((a, b) => a.timestamp - b.timestamp);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Check if an event has related events
|
|
32
|
-
*/
|
|
33
|
-
function hasRelatedEvents(event, allEvents) {
|
|
34
|
-
if (!event.correlationId) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
return allEvents.some(e => e.correlationId === event.correlationId && e.id !== event.id);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get count of related events (including the current one)
|
|
42
|
-
*/
|
|
43
|
-
function getRelatedEventsCount(event, allEvents) {
|
|
44
|
-
if (!event.correlationId) {
|
|
45
|
-
return 1;
|
|
46
|
-
}
|
|
47
|
-
return allEvents.filter(e => e.correlationId === event.correlationId).length;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Build a map of correlation ID -> count for efficient lookup
|
|
52
|
-
*/
|
|
53
|
-
function buildCorrelationCountMap(events) {
|
|
54
|
-
const countMap = new Map();
|
|
55
|
-
for (const event of events) {
|
|
56
|
-
if (event.correlationId) {
|
|
57
|
-
const current = countMap.get(event.correlationId) || 0;
|
|
58
|
-
countMap.set(event.correlationId, current + 1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return countMap;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Get all events in a correlation group, sorted by sequence
|
|
66
|
-
*/
|
|
67
|
-
function getCorrelationGroup(correlationId, allEvents) {
|
|
68
|
-
return allEvents.filter(e => e.correlationId === correlationId).sort((a, b) => {
|
|
69
|
-
// Sort by sequence first, then by timestamp
|
|
70
|
-
const seqA = a.sequenceInGroup ?? 0;
|
|
71
|
-
const seqB = b.sequenceInGroup ?? 0;
|
|
72
|
-
if (seqA !== seqB) {
|
|
73
|
-
return seqA - seqB;
|
|
74
|
-
}
|
|
75
|
-
return a.timestamp - b.timestamp;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Generate a display label for correlated events (e.g., "1/2" for first of two)
|
|
81
|
-
*/
|
|
82
|
-
function getCorrelationLabel(event, allEvents) {
|
|
83
|
-
if (!event.correlationId) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const group = getCorrelationGroup(event.correlationId, allEvents);
|
|
87
|
-
if (group.length <= 1) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
const index = group.findIndex(e => e.id === event.id);
|
|
91
|
-
if (index === -1) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return `${index + 1}/${group.length}`;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Color palette for correlation groups (cycles through for different groups)
|
|
99
|
-
*/
|
|
100
|
-
const CORRELATION_COLORS = ["#EC4899",
|
|
101
|
-
// Pink (React Query default)
|
|
102
|
-
"#8B5CF6",
|
|
103
|
-
// Purple
|
|
104
|
-
"#3B82F6",
|
|
105
|
-
// Blue
|
|
106
|
-
"#10B981",
|
|
107
|
-
// Green
|
|
108
|
-
"#F59E0B",
|
|
109
|
-
// Orange
|
|
110
|
-
"#EF4444",
|
|
111
|
-
// Red
|
|
112
|
-
"#06B6D4",
|
|
113
|
-
// Cyan
|
|
114
|
-
"#84CC16" // Lime
|
|
115
|
-
];
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Get a consistent color for a correlation group
|
|
119
|
-
*/
|
|
120
|
-
function getCorrelationColor(correlationId) {
|
|
121
|
-
// Use a simple hash to get a consistent color for each correlation ID
|
|
122
|
-
let hash = 0;
|
|
123
|
-
for (let i = 0; i < correlationId.length; i++) {
|
|
124
|
-
hash = (hash << 5) - hash + correlationId.charCodeAt(i);
|
|
125
|
-
hash |= 0; // Convert to 32bit integer
|
|
126
|
-
}
|
|
127
|
-
const index = Math.abs(hash) % CORRELATION_COLORS.length;
|
|
128
|
-
return CORRELATION_COLORS[index];
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=correlationUtils.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.buildCorrelationCountMap=buildCorrelationCountMap;exports.findRelatedEvents=findRelatedEvents;exports.getCorrelationColor=getCorrelationColor;exports.getCorrelationGroup=getCorrelationGroup;exports.getCorrelationLabel=getCorrelationLabel;exports.getRelatedEventsCount=getRelatedEventsCount;exports.hasRelatedEvents=hasRelatedEvents;function findRelatedEvents(r,e){if(!r.correlationId){return[]}return e.filter(t=>t.correlationId===r.correlationId&&t.id!==r.id).sort((t,o)=>t.timestamp-o.timestamp)}function hasRelatedEvents(r,e){if(!r.correlationId){return false}return e.some(t=>t.correlationId===r.correlationId&&t.id!==r.id)}function getRelatedEventsCount(r,e){if(!r.correlationId){return 1}return e.filter(t=>t.correlationId===r.correlationId).length}function buildCorrelationCountMap(r){const e=new Map;for(const t of r){if(t.correlationId){const o=e.get(t.correlationId)||0;e.set(t.correlationId,o+1)}}return e}function getCorrelationGroup(r,e){return e.filter(t=>t.correlationId===r).sort((t,o)=>{const n=t.sequenceInGroup??0;const i=o.sequenceInGroup??0;if(n!==i){return n-i}return t.timestamp-o.timestamp})}function getCorrelationLabel(r,e){if(!r.correlationId){return null}const t=getCorrelationGroup(r.correlationId,e);if(t.length<=1){return null}const o=t.findIndex(n=>n.id===r.id);if(o===-1){return null}return`${o+1}/${t.length}`}const CORRELATION_COLORS=["#EC4899","#8B5CF6","#3B82F6","#10B981","#F59E0B","#EF4444","#06B6D4","#84CC16"];function getCorrelationColor(r){let e=0;for(let o=0;o<r.length;o++){e=(e<<5)-e+r.charCodeAt(o);e|=0}const t=Math.abs(e)%CORRELATION_COLORS.length;return CORRELATION_COLORS[t]}
|