@culpritsql/plan-viewer 0.0.0 → 0.5.6

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 (199) hide show
  1. package/package.json +38 -3
  2. package/pkg/ActualSummary.d.ts +10 -0
  3. package/pkg/ActualSummary.js +72 -0
  4. package/pkg/DeadlockGraph.d.ts +9 -0
  5. package/pkg/DeadlockGraph.js +135 -0
  6. package/pkg/DeadlockViewer.d.ts +20 -0
  7. package/pkg/DeadlockViewer.js +62 -0
  8. package/pkg/DocdbWork.d.ts +7 -0
  9. package/pkg/DocdbWork.js +37 -0
  10. package/pkg/NodeDetails.d.ts +15 -0
  11. package/pkg/NodeDetails.js +161 -0
  12. package/pkg/OpIcon.d.ts +9 -0
  13. package/pkg/OpIcon.js +54 -0
  14. package/pkg/PlanAssessmentNotes.d.ts +3 -0
  15. package/pkg/PlanAssessmentNotes.js +8 -0
  16. package/pkg/PlanCanvas.d.ts +47 -0
  17. package/pkg/PlanCanvas.js +9 -0
  18. package/pkg/PlanDiagram.d.ts +47 -0
  19. package/pkg/PlanDiagram.js +534 -0
  20. package/pkg/PlanDiffViewer.d.ts +31 -0
  21. package/pkg/PlanDiffViewer.js +317 -0
  22. package/pkg/PlanInsights.d.ts +6 -0
  23. package/pkg/PlanInsights.js +100 -0
  24. package/pkg/PlanObjects.d.ts +7 -0
  25. package/pkg/PlanObjects.js +138 -0
  26. package/pkg/PlanOperations.d.ts +8 -0
  27. package/pkg/PlanOperations.js +114 -0
  28. package/pkg/PlanRaw.d.ts +4 -0
  29. package/pkg/PlanRaw.js +35 -0
  30. package/pkg/PlanSurface.d.ts +21 -0
  31. package/pkg/PlanSurface.js +66 -0
  32. package/pkg/PlanTypeSchema.d.ts +5 -0
  33. package/pkg/PlanTypeSchema.js +62 -0
  34. package/pkg/PlanView.d.ts +27 -0
  35. package/pkg/PlanView.js +160 -0
  36. package/pkg/PlanViewer.d.ts +30 -0
  37. package/pkg/PlanViewer.js +19 -0
  38. package/pkg/Prose.d.ts +4 -0
  39. package/pkg/Prose.js +6 -0
  40. package/pkg/Sql.d.ts +5 -0
  41. package/pkg/Sql.js +7 -0
  42. package/pkg/THIRD-PARTY-LICENSES.txt +9021 -0
  43. package/pkg/build-report.json +907 -0
  44. package/pkg/defaults.d.ts +29 -0
  45. package/pkg/defaults.js +438 -0
  46. package/pkg/host.d.ts +118 -0
  47. package/pkg/host.js +593 -0
  48. package/pkg/index.d.ts +22 -1
  49. package/pkg/index.js +21 -1
  50. package/pkg/models/Ability.d.ts +6 -0
  51. package/pkg/models/ActualSummary.d.ts +16 -0
  52. package/pkg/models/CachedStatementContext.d.ts +9 -0
  53. package/pkg/models/CachedStatementIdentity.d.ts +7 -0
  54. package/pkg/models/ChangeKind.d.ts +3 -0
  55. package/pkg/models/CleanupEvidence.d.ts +6 -0
  56. package/pkg/models/CollectionTarget.d.ts +5 -0
  57. package/pkg/models/CompilationMemory.d.ts +3 -0
  58. package/pkg/models/CompileHistory.d.ts +13 -0
  59. package/pkg/models/Connect.d.ts +22 -0
  60. package/pkg/models/ConnectionSecurityMode.d.ts +3 -0
  61. package/pkg/models/ConnectionSecuritySpec.d.ts +4 -0
  62. package/pkg/models/ConstraintValidation.d.ts +6 -0
  63. package/pkg/models/DatabaseIdentity.d.ts +5 -0
  64. package/pkg/models/DatabaseLocation.d.ts +3 -0
  65. package/pkg/models/DatabaseProduct.d.ts +6 -0
  66. package/pkg/models/Deadlock.d.ts +23 -0
  67. package/pkg/models/DeadlockFix.d.ts +16 -0
  68. package/pkg/models/DeadlockFixKind.d.ts +6 -0
  69. package/pkg/models/DeadlockPattern.d.ts +3 -0
  70. package/pkg/models/DeadlockProcess.d.ts +23 -0
  71. package/pkg/models/DeadlockResource.d.ts +12 -0
  72. package/pkg/models/DistributionPopulation.d.ts +3 -0
  73. package/pkg/models/DocdbMetrics.d.ts +7 -0
  74. package/pkg/models/Engine.d.ts +3 -0
  75. package/pkg/models/EngineAbilities.d.ts +46 -0
  76. package/pkg/models/EngineFacts.d.ts +28 -0
  77. package/pkg/models/EvidencePresentation.d.ts +4 -0
  78. package/pkg/models/ExecutionProtection.d.ts +3 -0
  79. package/pkg/models/Guess.d.ts +6 -0
  80. package/pkg/models/InsightArea.d.ts +6 -0
  81. package/pkg/models/LocalizedText.d.ts +4 -0
  82. package/pkg/models/LockHolder.d.ts +3 -0
  83. package/pkg/models/LogRateGovernanceReason.d.ts +7 -0
  84. package/pkg/models/Message.d.ts +4 -0
  85. package/pkg/models/MessageValue.d.ts +4 -0
  86. package/pkg/models/Metric.d.ts +10 -0
  87. package/pkg/models/MssqlCatalogIndexColumn.d.ts +3 -0
  88. package/pkg/models/MssqlCurrentTableType.d.ts +10 -0
  89. package/pkg/models/MssqlCurrentTypeColumn.d.ts +7 -0
  90. package/pkg/models/MssqlCurrentTypeIndex.d.ts +4 -0
  91. package/pkg/models/MssqlCurrentTypeModule.d.ts +4 -0
  92. package/pkg/models/MssqlCurrentTypeParameter.d.ts +3 -0
  93. package/pkg/models/MssqlCurrentTypeSchema.d.ts +11 -0
  94. package/pkg/models/MssqlCurrentTypeSchemaStatus.d.ts +3 -0
  95. package/pkg/models/MssqlIndexParentKind.d.ts +3 -0
  96. package/pkg/models/MssqlObjectIdentity.d.ts +7 -0
  97. package/pkg/models/NativeIdentity.d.ts +3 -0
  98. package/pkg/models/NativePlanIdentity.d.ts +4 -0
  99. package/pkg/models/NativeQueryIdentity.d.ts +3 -0
  100. package/pkg/models/NativeReadContext.d.ts +13 -0
  101. package/pkg/models/NodeKind.d.ts +3 -0
  102. package/pkg/models/NodeMatch.d.ts +3 -0
  103. package/pkg/models/NodeRuntime.d.ts +28 -0
  104. package/pkg/models/PageServerReadAvailability.d.ts +3 -0
  105. package/pkg/models/PageServerReadStatistics.d.ts +8 -0
  106. package/pkg/models/PageServerReadSummary.d.ts +19 -0
  107. package/pkg/models/PartitionTail.d.ts +6 -0
  108. package/pkg/models/Plan.d.ts +11 -0
  109. package/pkg/models/PlanAccessRows.d.ts +13 -0
  110. package/pkg/models/PlanAutomaticIndex.d.ts +3 -0
  111. package/pkg/models/PlanChange.d.ts +17 -0
  112. package/pkg/models/PlanChangedColumn.d.ts +3 -0
  113. package/pkg/models/PlanConversion.d.ts +4 -0
  114. package/pkg/models/PlanConversionIssue.d.ts +3 -0
  115. package/pkg/models/PlanCurrentTypeSchemaView.d.ts +6 -0
  116. package/pkg/models/PlanDiff.d.ts +13 -0
  117. package/pkg/models/PlanExecutionMode.d.ts +3 -0
  118. package/pkg/models/PlanFacts.d.ts +36 -0
  119. package/pkg/models/PlanHistory.d.ts +6 -0
  120. package/pkg/models/PlanHistoryKind.d.ts +3 -0
  121. package/pkg/models/PlanIndexColumns.d.ts +3 -0
  122. package/pkg/models/PlanIndexHint.d.ts +3 -0
  123. package/pkg/models/PlanInsight.d.ts +44 -0
  124. package/pkg/models/PlanInsightShare.d.ts +3 -0
  125. package/pkg/models/PlanInsights.d.ts +8 -0
  126. package/pkg/models/PlanKind.d.ts +3 -0
  127. package/pkg/models/PlanMeasurementRef.d.ts +3 -0
  128. package/pkg/models/PlanMemoryGrantFeedback.d.ts +15 -0
  129. package/pkg/models/PlanMemoryGrantFeedbackIssue.d.ts +3 -0
  130. package/pkg/models/PlanMemoryGrantFeedbackState.d.ts +3 -0
  131. package/pkg/models/PlanNode.d.ts +7 -0
  132. package/pkg/models/PlanNodeFacts.d.ts +63 -0
  133. package/pkg/models/PlanOperatorView.d.ts +5 -0
  134. package/pkg/models/PlanPageServerIo.d.ts +16 -0
  135. package/pkg/models/PlanPageServerIoIssue.d.ts +4 -0
  136. package/pkg/models/PlanPageServerIoView.d.ts +7 -0
  137. package/pkg/models/PlanPageServerMetric.d.ts +3 -0
  138. package/pkg/models/PlanParameter.d.ts +10 -0
  139. package/pkg/models/PlanParameterComparison.d.ts +3 -0
  140. package/pkg/models/PlanParameterContext.d.ts +15 -0
  141. package/pkg/models/PlanParameterIssue.d.ts +3 -0
  142. package/pkg/models/PlanParameterUse.d.ts +4 -0
  143. package/pkg/models/PlanParameterUseKind.d.ts +3 -0
  144. package/pkg/models/PlanParameterValueState.d.ts +3 -0
  145. package/pkg/models/PlanParentRelationship.d.ts +3 -0
  146. package/pkg/models/PlanRegion.d.ts +7 -0
  147. package/pkg/models/PlanSampleSource.d.ts +6 -0
  148. package/pkg/models/PlanScanCompletion.d.ts +8 -0
  149. package/pkg/models/PlanScanThread.d.ts +3 -0
  150. package/pkg/models/PlanTemporaryTableUse.d.ts +7 -0
  151. package/pkg/models/PlanVariant.d.ts +23 -0
  152. package/pkg/models/PlanView.d.ts +9 -0
  153. package/pkg/models/PlanWarning.d.ts +3 -0
  154. package/pkg/models/PlanningStep.d.ts +7 -0
  155. package/pkg/models/ProductFacts.d.ts +11 -0
  156. package/pkg/models/QueryCosts.d.ts +62 -0
  157. package/pkg/models/QueryStat.d.ts +69 -0
  158. package/pkg/models/QueryTrend.d.ts +7 -0
  159. package/pkg/models/QueryVariantFamily.d.ts +9 -0
  160. package/pkg/models/QueryWaitCoverage.d.ts +8 -0
  161. package/pkg/models/ReadUnit.d.ts +7 -0
  162. package/pkg/models/Refusal.d.ts +7 -0
  163. package/pkg/models/RelationalInput.d.ts +5 -0
  164. package/pkg/models/RelationalInputKind.d.ts +3 -0
  165. package/pkg/models/RelationalInputProvenance.d.ts +3 -0
  166. package/pkg/models/RequestEvidence.d.ts +7 -0
  167. package/pkg/models/RetainedPlanProvenance.d.ts +11 -0
  168. package/pkg/models/RuntimeDistribution.d.ts +16 -0
  169. package/pkg/models/RuntimeDistributionIssue.d.ts +3 -0
  170. package/pkg/models/RuntimeDistributionOrigin.d.ts +3 -0
  171. package/pkg/models/RuntimeDuration.d.ts +3 -0
  172. package/pkg/models/RuntimeHistogramBucket.d.ts +8 -0
  173. package/pkg/models/RuntimeQuantile.d.ts +4 -0
  174. package/pkg/models/Scenario.d.ts +11 -0
  175. package/pkg/models/ScenarioKind.d.ts +3 -0
  176. package/pkg/models/SessionAction.d.ts +6 -0
  177. package/pkg/models/SessionIdFormat.d.ts +6 -0
  178. package/pkg/models/Severity.d.ts +3 -0
  179. package/pkg/models/SharedResourceIdentity.d.ts +11 -0
  180. package/pkg/models/SharedResourceKind.d.ts +3 -0
  181. package/pkg/models/SourcePartition.d.ts +8 -0
  182. package/pkg/models/Spread.d.ts +18 -0
  183. package/pkg/models/SqlSyntax.d.ts +6 -0
  184. package/pkg/models/StatementMetrics.d.ts +32 -0
  185. package/pkg/models/StatementOrigin.d.ts +6 -0
  186. package/pkg/models/StatementTemporaryWork.d.ts +3 -0
  187. package/pkg/models/StatisticsFreshness.d.ts +3 -0
  188. package/pkg/models/TriggerTiming.d.ts +3 -0
  189. package/pkg/models/Unit.d.ts +3 -0
  190. package/pkg/models/WaitClass.d.ts +3 -0
  191. package/pkg/models/WaitMechanism.d.ts +4 -0
  192. package/pkg/models/WaitSampling.d.ts +3 -0
  193. package/pkg/models/WaitStat.d.ts +4 -0
  194. package/pkg/models/WorkerSkew.d.ts +3 -0
  195. package/pkg/models/WriteLog.d.ts +7 -0
  196. package/pkg/models/WriteRows.d.ts +7 -0
  197. package/pkg/styles.css +3273 -0
  198. package/pkg/types.d.ts +29 -0
  199. package/pkg/types.js +1 -0
@@ -0,0 +1,9 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ import type { PlanNode } from "./types.js";
3
+ /** The operator families people recognize at a glance: a seek, a scan, a lookup, a hash or loop join, a sort. */
4
+ export declare function opIcon(node: Pick<PlanNode, "op" | "kind">): LucideIcon;
5
+ export declare function OpIcon({ node, size, color }: {
6
+ node: Pick<PlanNode, "op" | "kind">;
7
+ size?: number;
8
+ color?: string;
9
+ }): import("react").JSX.Element;
package/pkg/OpIcon.js ADDED
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ArrowDownWideNarrow, Boxes, Calculator, Combine, CornerDownLeft, Funnel, GitMerge, Hash, Layers, ListOrdered, PencilLine, Repeat2, Rows3, ScanLine, ScanSearch, Shuffle, Sigma, Split, SquareFunction, Workflow, } from "lucide-react";
3
+ /** The operator families people recognize at a glance: a seek, a scan, a lookup, a hash or loop join, a sort. */
4
+ export function opIcon(node) {
5
+ const op = node.op.toLowerCase();
6
+ if (op.includes("lookup") && node.kind === "lookup")
7
+ return CornerDownLeft;
8
+ if (op.includes("nested loop"))
9
+ return Repeat2;
10
+ if (op.includes("hash"))
11
+ return Hash;
12
+ if (op.includes("merge join") || op === "merge")
13
+ return GitMerge;
14
+ if (op.includes("adaptive"))
15
+ return Shuffle;
16
+ if (op.startsWith("filter"))
17
+ return Funnel;
18
+ if (op === "top" || op === "limit" || op.startsWith("limit"))
19
+ return ListOrdered;
20
+ if (op.includes("constant") || op === "result" || op === "values scan")
21
+ return Rows3;
22
+ if (op === "query block" || op === "query" || op === "union")
23
+ return Boxes;
24
+ if (op.includes("compute scalar"))
25
+ return SquareFunction;
26
+ switch (node.kind) {
27
+ case "seek":
28
+ return ScanSearch;
29
+ case "scan":
30
+ return ScanLine;
31
+ case "lookup":
32
+ return CornerDownLeft;
33
+ case "join":
34
+ return Combine;
35
+ case "sort":
36
+ return ArrowDownWideNarrow;
37
+ case "aggregate":
38
+ return Sigma;
39
+ case "spool":
40
+ return Layers;
41
+ case "parallelism":
42
+ return Split;
43
+ case "modify":
44
+ return PencilLine;
45
+ case "compute":
46
+ return Calculator;
47
+ default:
48
+ return Workflow;
49
+ }
50
+ }
51
+ export function OpIcon({ node, size = 14, color }) {
52
+ const Icon = opIcon(node);
53
+ return _jsx(Icon, { size: size, strokeWidth: 1.75, color: color, "aria-hidden": "true" });
54
+ }
@@ -0,0 +1,3 @@
1
+ export declare function PlanAssessmentNotes({ note }: {
2
+ note: string | null;
3
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronDown, Info } from "lucide-react";
3
+ import { t } from "./host.js";
4
+ export function PlanAssessmentNotes({ note }) {
5
+ if (!note)
6
+ return null;
7
+ return (_jsxs("details", { className: "ins-context", children: [_jsxs("summary", { children: [_jsx(Info, { size: 13 }), t("ui.plan_insights.assessment_notes"), _jsx(ChevronDown, { size: 13, className: "ins-context-chevron" })] }), _jsx("p", { className: "ins-note", children: note })] }));
8
+ }
@@ -0,0 +1,47 @@
1
+ import type { ReactNode } from "react";
2
+ import { type DiagramLens, type Mark } from "./PlanDiagram.js";
3
+ import type { PlanViewerTheme } from "./PlanViewer.js";
4
+ import type { Plan, PlanNode, QueryStat } from "./types.js";
5
+ export type PlanCanvasProps = {
6
+ plan: Plan;
7
+ query?: QueryStat | null;
8
+ /** Controlled active metric lens ("time" | "cost" | "rows" | "reads"). */
9
+ lens?: DiagramLens;
10
+ /** Initial metric lens when uncontrolled. */
11
+ defaultLens?: DiagramLens;
12
+ /** Selected operator node id. */
13
+ selectedId?: number | null;
14
+ /** Callback fired when an operator card is clicked. */
15
+ onSelect?: (id: number) => void;
16
+ /** Initial zoom factor (0.25 to 1.8). Auto-fits when omitted. */
17
+ initialZoom?: number;
18
+ /** Controlled zoom factor. */
19
+ zoom?: number;
20
+ onZoomChange?: (zoom: number) => void;
21
+ /** Show insight count badges and severity borders on operator cards. Defaults to false for pure flow rendering. */
22
+ showInsights?: boolean;
23
+ /** Show floating zoom/fit/minimap controls in the top-right corner. Defaults to true. */
24
+ showControls?: boolean;
25
+ /** Show the corner minimap. Defaults to automatic when >= 6 operators are visible. */
26
+ showMinimap?: boolean;
27
+ /** Explicit canvas height (e.g. 480 or "100%"). */
28
+ height?: number | string;
29
+ /** Diff change markers when rendering custom comparison views. */
30
+ marks?: Map<number, Mark>;
31
+ /** Shared region color tints (0..5). */
32
+ tints?: Map<number, number>;
33
+ /** Custom node overlay renderer. */
34
+ overlay?: (node: PlanNode, box: {
35
+ x: number;
36
+ y: number;
37
+ w: number;
38
+ h: number;
39
+ }) => ReactNode;
40
+ theme?: PlanViewerTheme;
41
+ className?: string;
42
+ };
43
+ /**
44
+ * Pure interactive execution-plan flow canvas: drag-to-pan, Ctrl/Cmd + wheel zoom, and optional minimap,
45
+ * with zero insight banners, prose summaries, headers, or built-in property drawers.
46
+ */
47
+ export declare function PlanCanvas({ plan, query, lens, defaultLens, selectedId, onSelect, initialZoom, zoom, onZoomChange, showInsights, showControls, showMinimap, height, marks, tints, overlay, theme, className, }: PlanCanvasProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PlanDiagram } from "./PlanDiagram.js";
3
+ /**
4
+ * Pure interactive execution-plan flow canvas: drag-to-pan, Ctrl/Cmd + wheel zoom, and optional minimap,
5
+ * with zero insight banners, prose summaries, headers, or built-in property drawers.
6
+ */
7
+ export function PlanCanvas({ plan, query, lens, defaultLens, selectedId, onSelect, initialZoom, zoom, onZoomChange, showInsights = false, showControls = true, showMinimap, height, marks, tints, overlay, theme, className, }) {
8
+ return (_jsx(PlanDiagram, { plan: plan, query: query, bare: true, showProps: false, showInsights: showInsights, showControls: showControls, showMinimap: showMinimap ?? undefined, lens: lens, defaultLens: defaultLens, height: height, selectedId: selectedId, onSelect: onSelect, initialZoom: initialZoom, zoom: zoom, onZoomChange: onZoomChange, marks: marks, tints: tints, overlay: overlay, theme: theme, className: className }));
9
+ }
@@ -0,0 +1,47 @@
1
+ import { type ReactNode } from "react";
2
+ import { costBasis as basis } from "./host.js";
3
+ import type { PlanViewerTheme } from "./PlanViewer.js";
4
+ import type { Plan, PlanNode, QueryStat } from "./types.js";
5
+ export declare function compactOp(op: string): string;
6
+ export type Mark = "changed" | "added" | "removed";
7
+ export type DiagramLens = "time" | "cost" | "rows" | "reads";
8
+ export declare const costBasis: typeof basis;
9
+ export declare function CostStrip({ plan, query, focus, onPick }: {
10
+ plan: Plan;
11
+ query?: QueryStat | null;
12
+ focus?: number | null;
13
+ onPick: (id: number) => void;
14
+ }): import("react").JSX.Element;
15
+ export declare function PlanDiagram(props: {
16
+ plan: Plan;
17
+ query?: QueryStat | null;
18
+ focus?: number | null;
19
+ marks?: Map<number, Mark>;
20
+ selectedId?: number | null;
21
+ onSelect?: (id: number) => void;
22
+ initialZoom?: number;
23
+ badge?: string;
24
+ bare?: boolean;
25
+ tints?: Map<number, number>;
26
+ zoom?: number;
27
+ onZoomChange?: (zoom: number) => void;
28
+ showProps?: boolean;
29
+ showHeader?: boolean;
30
+ showActualSummary?: boolean;
31
+ showCostStrip?: boolean;
32
+ showInsights?: boolean;
33
+ showControls?: boolean;
34
+ showMinimap?: boolean;
35
+ lens?: DiagramLens;
36
+ defaultLens?: DiagramLens;
37
+ height?: number | string;
38
+ kindLabel?: string;
39
+ overlay?: (node: PlanNode, box: {
40
+ x: number;
41
+ y: number;
42
+ w: number;
43
+ h: number;
44
+ }) => ReactNode;
45
+ theme?: PlanViewerTheme;
46
+ className?: string;
47
+ }): import("react").JSX.Element;