@zintrust/trace 0.4.94 → 0.4.96
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/dist/build-manifest.json +40 -28
- package/dist/config.js +83 -6
- package/dist/dashboard/ui.js +40 -13
- package/dist/storage/DebuggerStorage.d.ts +13 -0
- package/dist/storage/DebuggerStorage.js +195 -0
- package/dist/storage/TraceContentBudget.js +67 -15
- package/dist/types.d.ts +13 -1
- package/dist/utils/entryFilter.js +20 -0
- package/dist/watchers/HttpClientWatcher.d.ts +1 -1
- package/dist/watchers/HttpClientWatcher.js +95 -18
- package/dist/watchers/HttpWatcher.js +7 -1
- package/dist/watchers/MiddlewareWatcher.js +5 -0
- package/dist/watchers/ModelWatcher.js +5 -0
- package/package.json +2 -2
- package/src/config.ts +136 -6
- package/src/dashboard/ui.ts +40 -13
- package/src/storage/TraceContentBudget.ts +98 -17
- package/src/types.ts +15 -1
- package/src/utils/entryFilter.ts +23 -0
- package/src/watchers/HttpClientWatcher.ts +125 -19
- package/src/watchers/HttpWatcher.ts +8 -1
- package/src/watchers/MiddlewareWatcher.ts +9 -0
- package/src/watchers/ModelWatcher.ts +9 -0
|
@@ -6,6 +6,10 @@ import { RequestFilter } from '../utils/requestFilter';
|
|
|
6
6
|
let _storage: ITraceWatcherConfig['storage'] | null = null;
|
|
7
7
|
let _ignoreRoutes: string[] = [];
|
|
8
8
|
|
|
9
|
+
type GlobalModelTraceState = {
|
|
10
|
+
__zintrust_trace_model_emit__?: typeof emit;
|
|
11
|
+
};
|
|
12
|
+
|
|
9
13
|
const emit = (
|
|
10
14
|
action: ModelContent['action'],
|
|
11
15
|
model: string,
|
|
@@ -40,7 +44,12 @@ export const ModelWatcher: ITraceWatcher & { emit: typeof emit } = Object.freeze
|
|
|
40
44
|
if (config.watchers.model === false) return () => undefined;
|
|
41
45
|
_storage = storage;
|
|
42
46
|
_ignoreRoutes = config.ignoreRoutes;
|
|
47
|
+
(globalThis as unknown as GlobalModelTraceState).__zintrust_trace_model_emit__ = emit;
|
|
43
48
|
return () => {
|
|
49
|
+
const globalState = globalThis as unknown as GlobalModelTraceState;
|
|
50
|
+
if (globalState.__zintrust_trace_model_emit__ === emit) {
|
|
51
|
+
delete globalState.__zintrust_trace_model_emit__;
|
|
52
|
+
}
|
|
44
53
|
_storage = null;
|
|
45
54
|
_ignoreRoutes = [];
|
|
46
55
|
};
|