causal-inspector 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +71 -0
  2. package/dist/CausalInspector.css +20 -447
  3. package/dist/CausalInspector.d.ts +8 -1
  4. package/dist/CausalInspector.js +32 -9
  5. package/dist/causal-inspector.css +2899 -0
  6. package/dist/components/CopyablePayload.js +8 -8
  7. package/dist/components/EffectList.d.ts +4 -0
  8. package/dist/components/EffectList.js +15 -0
  9. package/dist/components/FilterBar.js +7 -10
  10. package/dist/components/GlobalScrubber.js +6 -6
  11. package/dist/components/JsonSyntax.js +8 -8
  12. package/dist/engines/query.js +131 -52
  13. package/dist/engines/scrubber.js +1 -1
  14. package/dist/engines/url.d.ts +5 -2
  15. package/dist/engines/url.js +50 -22
  16. package/dist/events.d.ts +39 -13
  17. package/dist/index.d.ts +5 -3
  18. package/dist/index.js +4 -2
  19. package/dist/panes/AggregateTimelinePane.js +4 -4
  20. package/dist/panes/CausalFlowPane.js +39 -27
  21. package/dist/panes/CausalTreePane.js +43 -34
  22. package/dist/panes/LogsPane.js +9 -17
  23. package/dist/panes/SubjectChainPane.d.ts +1 -0
  24. package/dist/panes/SubjectChainPane.js +50 -0
  25. package/dist/panes/TimelinePane.js +33 -19
  26. package/dist/panes/WaterfallPane.js +5 -5
  27. package/dist/panes/WorkflowExplorerPane.d.ts +2 -0
  28. package/dist/panes/WorkflowExplorerPane.js +49 -0
  29. package/dist/queries.d.ts +16 -12
  30. package/dist/queries.js +103 -27
  31. package/dist/reducer.js +134 -38
  32. package/dist/state.d.ts +18 -5
  33. package/dist/state.js +17 -8
  34. package/dist/theme.js +4 -4
  35. package/dist/types.d.ts +52 -12
  36. package/dist/utils.js +1 -1
  37. package/package.json +18 -3
  38. package/dist/panes/CorrelationExplorerPane.d.ts +0 -2
  39. package/dist/panes/CorrelationExplorerPane.js +0 -51
@@ -8,11 +8,12 @@ import { createInspectorEngine } from "./engines";
8
8
  import { useSelector, useDispatch } from "./machine";
9
9
  import { TimelinePane } from "./panes/TimelinePane";
10
10
  import { CausalTreePane } from "./panes/CausalTreePane";
11
+ import { SubjectChainPane } from "./panes/SubjectChainPane";
11
12
  import { CausalFlowPane } from "./panes/CausalFlowPane";
12
13
  import { LogsPane } from "./panes/LogsPane";
13
14
  import { AggregateTimelinePane } from "./panes/AggregateTimelinePane";
14
15
  import { WaterfallPane } from "./panes/WaterfallPane";
15
- import { CorrelationExplorerPane } from "./panes/CorrelationExplorerPane";
16
+ import { WorkflowExplorerPane } from "./panes/WorkflowExplorerPane";
16
17
  import { GlobalScrubber } from "./components/GlobalScrubber";
17
18
  import "./CausalInspector.css";
18
19
  // ── Transport ─────────────────────────────────────────────────
@@ -139,9 +140,14 @@ const PANE_REGISTRY = [
139
140
  render: () => _jsx(WaterfallPane, {}),
140
141
  },
141
142
  {
142
- name: "Correlations",
143
- component: "correlations",
144
- render: () => _jsx(CorrelationExplorerPane, {}),
143
+ name: "Workflows",
144
+ component: "workflows",
145
+ render: () => _jsx(WorkflowExplorerPane, {}),
146
+ },
147
+ {
148
+ name: "Subject Chain",
149
+ component: "subject-chain",
150
+ render: () => _jsx(SubjectChainPane, {}),
145
151
  },
146
152
  ];
147
153
  // ── Helpers ───────────────────────────────────────────────────
@@ -158,8 +164,9 @@ function findTab(model, component) {
158
164
  // ── InspectorLayout (inner component) ─────────────────────────
159
165
  function InspectorLayout() {
160
166
  const paneLayout = useSelector((s) => s.paneLayout);
161
- const flowCorrelationId = useSelector((s) => s.flowCorrelationId);
167
+ const flowWorkflowId = useSelector((s) => s.flowWorkflowId);
162
168
  const selectedSeq = useSelector((s) => s.selectedSeq);
169
+ const subjectType = useSelector((s) => s.subjectType);
163
170
  const dispatch = useDispatch();
164
171
  const modelRef = useRef(null);
165
172
  if (!modelRef.current) {
@@ -189,9 +196,13 @@ function InspectorLayout() {
189
196
  addTab("causal-tree", "Causal Tree");
190
197
  }, [selectedSeq, addTab]);
191
198
  useEffect(() => {
192
- if (flowCorrelationId)
199
+ if (flowWorkflowId)
193
200
  addTab("causal-flow", "Flow");
194
- }, [flowCorrelationId, addTab]);
201
+ }, [flowWorkflowId, addTab]);
202
+ useEffect(() => {
203
+ if (subjectType)
204
+ addTab("subject-chain", "Subject Chain");
205
+ }, [subjectType, addTab]);
195
206
  const factory = useCallback((node) => {
196
207
  const component = node.getComponent();
197
208
  const pane = PANE_REGISTRY.find((p) => p.component === component);
@@ -249,10 +260,22 @@ function InspectorLayout() {
249
260
  }
250
261
  // ── CausalInspector (public API) ──────────────────────────────
251
262
  const savedLayout = loadSavedLayout();
252
- export function CausalInspector({ endpoint, fetchOptions, className, }) {
263
+ export function CausalInspector({ endpoint, fetchOptions, className, initialSubject, }) {
253
264
  const transport = useMemo(() => createTransport(endpoint, fetchOptions),
254
265
  // eslint-disable-next-line react-hooks/exhaustive-deps
255
266
  [endpoint]);
256
267
  const createEngine = useMemo(() => createInspectorEngine(transport, storage), [transport]);
257
- return (_jsx("div", { className: `causal-inspector${className ? ` ${className}` : ""}`, children: _jsx(CausalInspectorProvider, { createEngine: createEngine, initialState: savedLayout ? { paneLayout: savedLayout } : undefined, children: _jsx(InspectorLayout, {}) }) }));
268
+ const initialState = useMemo(() => {
269
+ const base = savedLayout ? { paneLayout: savedLayout } : undefined;
270
+ if (!initialSubject)
271
+ return base;
272
+ return {
273
+ ...base,
274
+ subjectType: initialSubject.aggregateType,
275
+ subjectId: initialSubject.aggregateId,
276
+ subjectMode: initialSubject.mode ?? "both",
277
+ subjectChainLoading: true,
278
+ };
279
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
280
+ return (_jsx("div", { className: `causal-inspector${className ? ` ${className}` : ""}`, children: _jsx(CausalInspectorProvider, { createEngine: createEngine, initialState: initialState, children: _jsx(InspectorLayout, {}) }) }));
258
281
  }