@culpritsql/plan-viewer 0.0.0-stage → 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 (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -2
  3. package/package.json +57 -4
  4. package/pkg/ActualSummary.d.ts +10 -0
  5. package/pkg/ActualSummary.js +72 -0
  6. package/pkg/DeadlockGraph.d.ts +9 -0
  7. package/pkg/DeadlockGraph.js +135 -0
  8. package/pkg/DeadlockViewer.d.ts +20 -0
  9. package/pkg/DeadlockViewer.js +62 -0
  10. package/pkg/DocdbWork.d.ts +7 -0
  11. package/pkg/DocdbWork.js +37 -0
  12. package/pkg/NodeDetails.d.ts +15 -0
  13. package/pkg/NodeDetails.js +161 -0
  14. package/pkg/OpIcon.d.ts +9 -0
  15. package/pkg/OpIcon.js +54 -0
  16. package/pkg/PlanAssessmentNotes.d.ts +3 -0
  17. package/pkg/PlanAssessmentNotes.js +8 -0
  18. package/pkg/PlanCanvas.d.ts +47 -0
  19. package/pkg/PlanCanvas.js +9 -0
  20. package/pkg/PlanDiagram.d.ts +47 -0
  21. package/pkg/PlanDiagram.js +534 -0
  22. package/pkg/PlanDiffViewer.d.ts +31 -0
  23. package/pkg/PlanDiffViewer.js +317 -0
  24. package/pkg/PlanInsights.d.ts +6 -0
  25. package/pkg/PlanInsights.js +100 -0
  26. package/pkg/PlanObjects.d.ts +7 -0
  27. package/pkg/PlanObjects.js +138 -0
  28. package/pkg/PlanOperations.d.ts +8 -0
  29. package/pkg/PlanOperations.js +114 -0
  30. package/pkg/PlanRaw.d.ts +4 -0
  31. package/pkg/PlanRaw.js +35 -0
  32. package/pkg/PlanSurface.d.ts +21 -0
  33. package/pkg/PlanSurface.js +66 -0
  34. package/pkg/PlanTypeSchema.d.ts +5 -0
  35. package/pkg/PlanTypeSchema.js +62 -0
  36. package/pkg/PlanView.d.ts +27 -0
  37. package/pkg/PlanView.js +160 -0
  38. package/pkg/PlanViewer.d.ts +30 -0
  39. package/pkg/PlanViewer.js +19 -0
  40. package/pkg/Prose.d.ts +4 -0
  41. package/pkg/Prose.js +6 -0
  42. package/pkg/Sql.d.ts +5 -0
  43. package/pkg/Sql.js +7 -0
  44. package/pkg/THIRD-PARTY-LICENSES.txt +9021 -0
  45. package/pkg/build-report.json +907 -0
  46. package/pkg/defaults.d.ts +29 -0
  47. package/pkg/defaults.js +438 -0
  48. package/pkg/host.d.ts +118 -0
  49. package/pkg/host.js +593 -0
  50. package/pkg/index.d.ts +22 -0
  51. package/pkg/index.js +21 -0
  52. package/pkg/models/Ability.d.ts +6 -0
  53. package/pkg/models/ActualSummary.d.ts +16 -0
  54. package/pkg/models/CachedStatementContext.d.ts +9 -0
  55. package/pkg/models/CachedStatementIdentity.d.ts +7 -0
  56. package/pkg/models/ChangeKind.d.ts +3 -0
  57. package/pkg/models/CleanupEvidence.d.ts +6 -0
  58. package/pkg/models/CollectionTarget.d.ts +5 -0
  59. package/pkg/models/CompilationMemory.d.ts +3 -0
  60. package/pkg/models/CompileHistory.d.ts +13 -0
  61. package/pkg/models/Connect.d.ts +22 -0
  62. package/pkg/models/ConnectionSecurityMode.d.ts +3 -0
  63. package/pkg/models/ConnectionSecuritySpec.d.ts +4 -0
  64. package/pkg/models/ConstraintValidation.d.ts +6 -0
  65. package/pkg/models/DatabaseIdentity.d.ts +5 -0
  66. package/pkg/models/DatabaseLocation.d.ts +3 -0
  67. package/pkg/models/DatabaseProduct.d.ts +6 -0
  68. package/pkg/models/Deadlock.d.ts +23 -0
  69. package/pkg/models/DeadlockFix.d.ts +16 -0
  70. package/pkg/models/DeadlockFixKind.d.ts +6 -0
  71. package/pkg/models/DeadlockPattern.d.ts +3 -0
  72. package/pkg/models/DeadlockProcess.d.ts +23 -0
  73. package/pkg/models/DeadlockResource.d.ts +12 -0
  74. package/pkg/models/DistributionPopulation.d.ts +3 -0
  75. package/pkg/models/DocdbMetrics.d.ts +7 -0
  76. package/pkg/models/Engine.d.ts +3 -0
  77. package/pkg/models/EngineAbilities.d.ts +46 -0
  78. package/pkg/models/EngineFacts.d.ts +28 -0
  79. package/pkg/models/EvidencePresentation.d.ts +4 -0
  80. package/pkg/models/ExecutionProtection.d.ts +3 -0
  81. package/pkg/models/Guess.d.ts +6 -0
  82. package/pkg/models/InsightArea.d.ts +6 -0
  83. package/pkg/models/LocalizedText.d.ts +4 -0
  84. package/pkg/models/LockHolder.d.ts +3 -0
  85. package/pkg/models/LogRateGovernanceReason.d.ts +7 -0
  86. package/pkg/models/Message.d.ts +4 -0
  87. package/pkg/models/MessageValue.d.ts +4 -0
  88. package/pkg/models/Metric.d.ts +10 -0
  89. package/pkg/models/MssqlCatalogIndexColumn.d.ts +3 -0
  90. package/pkg/models/MssqlCurrentTableType.d.ts +10 -0
  91. package/pkg/models/MssqlCurrentTypeColumn.d.ts +7 -0
  92. package/pkg/models/MssqlCurrentTypeIndex.d.ts +4 -0
  93. package/pkg/models/MssqlCurrentTypeModule.d.ts +4 -0
  94. package/pkg/models/MssqlCurrentTypeParameter.d.ts +3 -0
  95. package/pkg/models/MssqlCurrentTypeSchema.d.ts +11 -0
  96. package/pkg/models/MssqlCurrentTypeSchemaStatus.d.ts +3 -0
  97. package/pkg/models/MssqlIndexParentKind.d.ts +3 -0
  98. package/pkg/models/MssqlObjectIdentity.d.ts +7 -0
  99. package/pkg/models/NativeIdentity.d.ts +3 -0
  100. package/pkg/models/NativePlanIdentity.d.ts +4 -0
  101. package/pkg/models/NativeQueryIdentity.d.ts +3 -0
  102. package/pkg/models/NativeReadContext.d.ts +13 -0
  103. package/pkg/models/NodeKind.d.ts +3 -0
  104. package/pkg/models/NodeMatch.d.ts +3 -0
  105. package/pkg/models/NodeRuntime.d.ts +28 -0
  106. package/pkg/models/PageServerReadAvailability.d.ts +3 -0
  107. package/pkg/models/PageServerReadStatistics.d.ts +8 -0
  108. package/pkg/models/PageServerReadSummary.d.ts +19 -0
  109. package/pkg/models/PartitionTail.d.ts +6 -0
  110. package/pkg/models/Plan.d.ts +11 -0
  111. package/pkg/models/PlanAccessRows.d.ts +13 -0
  112. package/pkg/models/PlanAutomaticIndex.d.ts +3 -0
  113. package/pkg/models/PlanChange.d.ts +17 -0
  114. package/pkg/models/PlanChangedColumn.d.ts +3 -0
  115. package/pkg/models/PlanConversion.d.ts +4 -0
  116. package/pkg/models/PlanConversionIssue.d.ts +3 -0
  117. package/pkg/models/PlanCurrentTypeSchemaView.d.ts +6 -0
  118. package/pkg/models/PlanDiff.d.ts +13 -0
  119. package/pkg/models/PlanExecutionMode.d.ts +3 -0
  120. package/pkg/models/PlanFacts.d.ts +36 -0
  121. package/pkg/models/PlanHistory.d.ts +6 -0
  122. package/pkg/models/PlanHistoryKind.d.ts +3 -0
  123. package/pkg/models/PlanIndexColumns.d.ts +3 -0
  124. package/pkg/models/PlanIndexHint.d.ts +3 -0
  125. package/pkg/models/PlanInsight.d.ts +44 -0
  126. package/pkg/models/PlanInsightShare.d.ts +3 -0
  127. package/pkg/models/PlanInsights.d.ts +8 -0
  128. package/pkg/models/PlanKind.d.ts +3 -0
  129. package/pkg/models/PlanMeasurementRef.d.ts +3 -0
  130. package/pkg/models/PlanMemoryGrantFeedback.d.ts +15 -0
  131. package/pkg/models/PlanMemoryGrantFeedbackIssue.d.ts +3 -0
  132. package/pkg/models/PlanMemoryGrantFeedbackState.d.ts +3 -0
  133. package/pkg/models/PlanNode.d.ts +7 -0
  134. package/pkg/models/PlanNodeFacts.d.ts +63 -0
  135. package/pkg/models/PlanOperatorView.d.ts +5 -0
  136. package/pkg/models/PlanPageServerIo.d.ts +16 -0
  137. package/pkg/models/PlanPageServerIoIssue.d.ts +4 -0
  138. package/pkg/models/PlanPageServerIoView.d.ts +7 -0
  139. package/pkg/models/PlanPageServerMetric.d.ts +3 -0
  140. package/pkg/models/PlanParameter.d.ts +10 -0
  141. package/pkg/models/PlanParameterComparison.d.ts +3 -0
  142. package/pkg/models/PlanParameterContext.d.ts +15 -0
  143. package/pkg/models/PlanParameterIssue.d.ts +3 -0
  144. package/pkg/models/PlanParameterUse.d.ts +4 -0
  145. package/pkg/models/PlanParameterUseKind.d.ts +3 -0
  146. package/pkg/models/PlanParameterValueState.d.ts +3 -0
  147. package/pkg/models/PlanParentRelationship.d.ts +3 -0
  148. package/pkg/models/PlanRegion.d.ts +7 -0
  149. package/pkg/models/PlanSampleSource.d.ts +6 -0
  150. package/pkg/models/PlanScanCompletion.d.ts +8 -0
  151. package/pkg/models/PlanScanThread.d.ts +3 -0
  152. package/pkg/models/PlanTemporaryTableUse.d.ts +7 -0
  153. package/pkg/models/PlanVariant.d.ts +23 -0
  154. package/pkg/models/PlanView.d.ts +9 -0
  155. package/pkg/models/PlanWarning.d.ts +3 -0
  156. package/pkg/models/PlanningStep.d.ts +7 -0
  157. package/pkg/models/ProductFacts.d.ts +11 -0
  158. package/pkg/models/QueryCosts.d.ts +62 -0
  159. package/pkg/models/QueryStat.d.ts +69 -0
  160. package/pkg/models/QueryTrend.d.ts +7 -0
  161. package/pkg/models/QueryVariantFamily.d.ts +9 -0
  162. package/pkg/models/QueryWaitCoverage.d.ts +8 -0
  163. package/pkg/models/ReadUnit.d.ts +7 -0
  164. package/pkg/models/Refusal.d.ts +7 -0
  165. package/pkg/models/RelationalInput.d.ts +5 -0
  166. package/pkg/models/RelationalInputKind.d.ts +3 -0
  167. package/pkg/models/RelationalInputProvenance.d.ts +3 -0
  168. package/pkg/models/RequestEvidence.d.ts +7 -0
  169. package/pkg/models/RetainedPlanProvenance.d.ts +11 -0
  170. package/pkg/models/RuntimeDistribution.d.ts +16 -0
  171. package/pkg/models/RuntimeDistributionIssue.d.ts +3 -0
  172. package/pkg/models/RuntimeDistributionOrigin.d.ts +3 -0
  173. package/pkg/models/RuntimeDuration.d.ts +3 -0
  174. package/pkg/models/RuntimeHistogramBucket.d.ts +8 -0
  175. package/pkg/models/RuntimeQuantile.d.ts +4 -0
  176. package/pkg/models/Scenario.d.ts +11 -0
  177. package/pkg/models/ScenarioKind.d.ts +3 -0
  178. package/pkg/models/SessionAction.d.ts +6 -0
  179. package/pkg/models/SessionIdFormat.d.ts +6 -0
  180. package/pkg/models/Severity.d.ts +3 -0
  181. package/pkg/models/SharedResourceIdentity.d.ts +11 -0
  182. package/pkg/models/SharedResourceKind.d.ts +3 -0
  183. package/pkg/models/SourcePartition.d.ts +8 -0
  184. package/pkg/models/Spread.d.ts +18 -0
  185. package/pkg/models/SqlSyntax.d.ts +6 -0
  186. package/pkg/models/StatementMetrics.d.ts +32 -0
  187. package/pkg/models/StatementOrigin.d.ts +6 -0
  188. package/pkg/models/StatementTemporaryWork.d.ts +3 -0
  189. package/pkg/models/StatisticsFreshness.d.ts +3 -0
  190. package/pkg/models/TriggerTiming.d.ts +3 -0
  191. package/pkg/models/Unit.d.ts +3 -0
  192. package/pkg/models/WaitClass.d.ts +3 -0
  193. package/pkg/models/WaitMechanism.d.ts +4 -0
  194. package/pkg/models/WaitSampling.d.ts +3 -0
  195. package/pkg/models/WaitStat.d.ts +4 -0
  196. package/pkg/models/WorkerSkew.d.ts +3 -0
  197. package/pkg/models/WriteLog.d.ts +7 -0
  198. package/pkg/models/WriteRows.d.ts +7 -0
  199. package/pkg/styles.css +3273 -0
  200. package/pkg/types.d.ts +29 -0
  201. package/pkg/types.js +1 -0
package/pkg/host.js ADDED
@@ -0,0 +1,593 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Fragment, useSyncExternalStore } from "react";
3
+ import { CARDINAL_LANGUAGES, CARDINAL_RULES, DEFAULT_ENGINES, DEFAULT_LOCALE, DEFAULT_MESSAGES, } from "./defaults.js";
4
+ let customI18n = null;
5
+ let customClipboard = null;
6
+ const noopUnsubscribe = () => () => { };
7
+ /** Plug in the host application's live localization store (used by Culprit's desktop UI). */
8
+ export function bindPlanViewerI18n(adapter) {
9
+ customI18n = adapter;
10
+ }
11
+ /** Plug in the host application's clipboard and toast notification handler. */
12
+ export function bindPlanViewerClipboard(handler) {
13
+ customClipboard = handler;
14
+ }
15
+ function pluralRuleIndex(code) {
16
+ let tag = code;
17
+ for (;;) {
18
+ const idx = CARDINAL_LANGUAGES[tag];
19
+ if (idx !== undefined)
20
+ return idx;
21
+ const dash = tag.lastIndexOf("-");
22
+ if (dash < 0)
23
+ return undefined;
24
+ tag = tag.slice(0, dash);
25
+ }
26
+ }
27
+ function pluralOperands(num) {
28
+ const [mantissa = "", exponent = "0"] = String(num).split("e");
29
+ const whole = mantissa.includes(".") ? mantissa.indexOf(".") : mantissa.length;
30
+ const rawDigits = mantissa.replace(".", "");
31
+ const decimal = whole + Number(exponent);
32
+ const length = Math.max(0, rawDigits.length - decimal);
33
+ const fraction = length === 0 ? 0 : Number(rawDigits.slice(Math.max(0, decimal)));
34
+ return { n: num, i: Math.floor(num), v: length, w: length, f: fraction, t: fraction, c: 0, e: 0 };
35
+ }
36
+ function cardinalCategory(num, code) {
37
+ const idx = pluralRuleIndex(code);
38
+ if (idx === undefined || !Number.isFinite(num))
39
+ return "other";
40
+ const values = pluralOperands(Math.abs(num));
41
+ const matches = ([operand, modulus, negate, ranges]) => {
42
+ const value = modulus ? values[operand] % modulus : values[operand];
43
+ return (Number.isInteger(value) && ranges.some(([start, end]) => value >= start && value <= end)) !== negate;
44
+ };
45
+ return CARDINAL_RULES[idx]?.find(([, alternatives]) => alternatives.some((terms) => terms.every(matches)))?.[0] ?? "other";
46
+ }
47
+ const parsedMessages = new Map();
48
+ function parseMessage(message) {
49
+ let i = 0;
50
+ const skipSpace = () => {
51
+ while (i < message.length && /\s/.test(message[i]))
52
+ i++;
53
+ };
54
+ const word = () => {
55
+ skipSpace();
56
+ const start = i;
57
+ while (i < message.length && /[A-Za-z0-9_=.-]/.test(message[i]))
58
+ i++;
59
+ return message.slice(start, i);
60
+ };
61
+ const readNodes = (inPlural, nested) => {
62
+ const out = [];
63
+ let text = "";
64
+ const flush = () => {
65
+ if (text)
66
+ out.push({ kind: "text", text });
67
+ text = "";
68
+ };
69
+ while (i < message.length) {
70
+ const c = message[i];
71
+ if (c === "}") {
72
+ if (nested)
73
+ break;
74
+ text += c;
75
+ i++;
76
+ continue;
77
+ }
78
+ if (c === "#" && inPlural) {
79
+ flush();
80
+ out.push({ kind: "pound" });
81
+ i++;
82
+ continue;
83
+ }
84
+ if (c !== "{") {
85
+ text += c;
86
+ i++;
87
+ continue;
88
+ }
89
+ flush();
90
+ i++;
91
+ const name = word();
92
+ skipSpace();
93
+ if (message[i] === "}") {
94
+ i++;
95
+ out.push({ kind: "arg", name });
96
+ continue;
97
+ }
98
+ i++;
99
+ const kind = word();
100
+ skipSpace();
101
+ i++;
102
+ const cases = {};
103
+ while (i < message.length) {
104
+ skipSpace();
105
+ if (message[i] === "}") {
106
+ i++;
107
+ break;
108
+ }
109
+ const caseKey = word();
110
+ skipSpace();
111
+ if (message[i] === "{")
112
+ i++;
113
+ cases[caseKey] = readNodes(kind === "plural", true);
114
+ if (message[i] === "}")
115
+ i++;
116
+ }
117
+ out.push({ kind: kind === "plural" ? "plural" : "select", name, cases });
118
+ }
119
+ flush();
120
+ return out;
121
+ };
122
+ return readNodes(false, false);
123
+ }
124
+ function formatNumber(n, loc) {
125
+ if (!Number.isFinite(n))
126
+ return String(n);
127
+ const neg = n < 0;
128
+ const [whole, fraction = ""] = Math.abs(n).toFixed(2).replace(/0+$/, "").replace(/\.$/, "").split(".");
129
+ const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, loc.group);
130
+ return `${neg ? "-" : ""}${grouped}${fraction ? loc.decimal + fraction : ""}`;
131
+ }
132
+ function renderMessage(nodes, args, loc, pound) {
133
+ let out = "";
134
+ for (const n of nodes) {
135
+ switch (n.kind) {
136
+ case "text":
137
+ out += n.text;
138
+ break;
139
+ case "pound":
140
+ out += pound === null ? "#" : formatNumber(pound, loc);
141
+ break;
142
+ case "arg": {
143
+ const v = args[n.name];
144
+ out += v === undefined ? `{${n.name}}` : typeof v === "number" ? formatNumber(v, loc) : v;
145
+ break;
146
+ }
147
+ case "plural": {
148
+ const v = Number(args[n.name]);
149
+ const chosen = n.cases[`=${v}`] ?? n.cases[cardinalCategory(v, loc.plural)] ?? n.cases.other ?? [];
150
+ out += renderMessage(chosen, args, loc, v);
151
+ break;
152
+ }
153
+ case "select": {
154
+ const v = String(args[n.name] ?? "");
155
+ out += renderMessage(n.cases[v] ?? n.cases.other ?? [], args, loc, pound);
156
+ break;
157
+ }
158
+ }
159
+ }
160
+ return out;
161
+ }
162
+ export function locale() {
163
+ return customI18n ? customI18n.locale() : DEFAULT_LOCALE;
164
+ }
165
+ export function language() {
166
+ return customI18n ? customI18n.language() : "en";
167
+ }
168
+ export function useLanguage() {
169
+ const sub = customI18n ? customI18n.subscribe : noopUnsubscribe;
170
+ const snap = customI18n ? customI18n.language : () => "en";
171
+ return useSyncExternalStore(sub, snap, snap);
172
+ }
173
+ export function t(key, args = {}) {
174
+ if (customI18n)
175
+ return customI18n.t(key, args);
176
+ const msg = DEFAULT_MESSAGES[key];
177
+ if (typeof msg !== "string")
178
+ return key;
179
+ let nodes = parsedMessages.get(msg);
180
+ if (!nodes) {
181
+ nodes = parseMessage(msg);
182
+ parsedMessages.set(msg, nodes);
183
+ }
184
+ return renderMessage(nodes, args, DEFAULT_LOCALE, null);
185
+ }
186
+ export async function copyAndTell(text, message) {
187
+ if (customClipboard) {
188
+ const res = await customClipboard(text, message);
189
+ return res !== false;
190
+ }
191
+ try {
192
+ await globalThis.navigator?.clipboard?.writeText(text);
193
+ return true;
194
+ }
195
+ catch {
196
+ return false;
197
+ }
198
+ }
199
+ const SLOT_MARK = "\u0001";
200
+ const SLOT_RE = new RegExp(`${SLOT_MARK}(\\d+)${SLOT_MARK}`);
201
+ export function slot(i) {
202
+ return `${SLOT_MARK}${i}${SLOT_MARK}`;
203
+ }
204
+ export function withElements(message, elements) {
205
+ const parts = message.split(SLOT_RE);
206
+ return (_jsx(_Fragment, { children: parts.map((part, i) => (i % 2 === 0 ? part : _jsx(Fragment, { children: elements[Number(part)] }, i))) }));
207
+ }
208
+ export function tx(key, args, elements) {
209
+ const names = Object.keys(elements);
210
+ const slots = Object.fromEntries(names.map((name, i) => [name, slot(i)]));
211
+ return withElements(t(key, { ...args, ...slots }), names.map((name) => elements[name]));
212
+ }
213
+ // ── Engine presentation facts ──
214
+ export function canPlanEstimates(engine) {
215
+ return Boolean(DEFAULT_ENGINES[engine]?.abilities.plan_estimates);
216
+ }
217
+ export function genericPlanContextKey(engine) {
218
+ return DEFAULT_ENGINES[engine]?.evidence_presentation.generic_plan_context ?? "";
219
+ }
220
+ export function serverName(engine, product) {
221
+ const spec = DEFAULT_ENGINES[engine];
222
+ if (!spec)
223
+ return engine;
224
+ const matched = spec.products.find((p) => p.prefix !== null && product?.startsWith(p.prefix)) ?? spec.products[0];
225
+ return matched?.label ?? spec.label;
226
+ }
227
+ export function planEngineName(plan) {
228
+ return serverName(plan.engine, plan.props?.flavor);
229
+ }
230
+ // ── Number and duration formatting ──
231
+ function fixed(x, places) {
232
+ const text = x.toFixed(places);
233
+ const halves = Math.abs(x) * 2 ** (places + 1);
234
+ if (!Number.isInteger(halves) || halves % 2 !== 1)
235
+ return text;
236
+ const scale = 10 ** places;
237
+ const up = Math.round(Math.abs(Number(text)) * scale);
238
+ if (up % 2 === 0)
239
+ return text;
240
+ return `${x < 0 ? "-" : ""}${((up - 1) / scale).toFixed(places)}`;
241
+ }
242
+ function roundHalfAway(x) {
243
+ return Math.sign(x) * Math.round(Math.abs(x));
244
+ }
245
+ export function digits(text) {
246
+ const { decimal, group } = locale();
247
+ if (decimal === "." && group === ",")
248
+ return text;
249
+ return text.replace(/[.,]/g, (c) => (c === "." ? decimal : group));
250
+ }
251
+ export function dateLocale() {
252
+ const code = language();
253
+ const base = code.split("-")[0];
254
+ const system = typeof navigator === "undefined" ? [] : (navigator.languages ?? [navigator.language]);
255
+ return system.find((tag) => tag && (tag === code || tag.split("-")[0] === base)) ?? code;
256
+ }
257
+ export function duration(ms) {
258
+ if (ms == null)
259
+ return "—";
260
+ const v = Math.max(0, ms);
261
+ if (v === 0)
262
+ return t("ui.format.duration.ms", { value: "0" });
263
+ if (v < 0.01)
264
+ return t("ui.format.duration.us", { value: digits(fixed(Math.max(1, v * 1000), 0)) });
265
+ if (v < 1)
266
+ return t("ui.format.duration.ms", { value: digits(fixed(v, 2)) });
267
+ if (v < 9.95) {
268
+ const tenths = fixed(v, 1);
269
+ return t("ui.format.duration.ms", { value: digits(tenths.endsWith(".0") ? tenths.slice(0, -2) : tenths) });
270
+ }
271
+ if (v < 1000)
272
+ return t("ui.format.duration.ms", { value: digits(fixed(v, 0)) });
273
+ const s = v / 1000;
274
+ if (s < 60)
275
+ return t("ui.format.duration.s", { value: digits(fixed(s, 1)) });
276
+ const m = s / 60;
277
+ if (m < 60)
278
+ return t("ui.format.duration.min", { value: digits(fixed(m, 0)) });
279
+ const h = m / 60;
280
+ if (h < 48) {
281
+ const whole = Math.floor(h);
282
+ const minutes = roundHalfAway((h - whole) * 60);
283
+ return minutes >= 1 ? t("ui.format.duration.h_min", { hours: whole, minutes }) : t("ui.format.duration.h", { hours: whole });
284
+ }
285
+ const dayStr = fixed(h / 24, 1);
286
+ return t("ui.format.days", { n: Number(dayStr), count: digits(dayStr) });
287
+ }
288
+ export function count(value) {
289
+ if (value == null)
290
+ return "—";
291
+ const n = value === 0 ? 0 : value;
292
+ const v = Math.abs(n);
293
+ if (v >= 1e9)
294
+ return t("ui.format.count.billions", { value: digits(fixed(n / 1e9, 1)) });
295
+ if (v >= 1e6)
296
+ return t("ui.format.count.millions", { value: digits(fixed(n / 1e6, 1)) });
297
+ if (v >= 1e4)
298
+ return t("ui.format.count.thousands", { value: digits(fixed(n / 1e3, 0)) });
299
+ if (v >= 1e3)
300
+ return t("ui.format.count.thousands", { value: digits(fixed(n / 1e3, 1)) });
301
+ if (v >= 100 || Number.isInteger(n))
302
+ return digits(fixed(n, 0));
303
+ return digits(fixed(n, 1));
304
+ }
305
+ export function rowCount(value) {
306
+ return t("ui.format.row_count", { n: value ?? Number.NaN, count: count(value) });
307
+ }
308
+ export function percent(ratio) {
309
+ if (ratio == null)
310
+ return "—";
311
+ const p = ratio * 100;
312
+ if (p > 0 && p < 1)
313
+ return t("ui.format.percent.under", { value: digits("1") });
314
+ return t("ui.format.percent.value", { value: digits(fixed(p, 0)) });
315
+ }
316
+ export function when(iso, now = new Date()) {
317
+ if (!iso)
318
+ return { short: "", full: "" };
319
+ const d = new Date(iso);
320
+ if (Number.isNaN(d.getTime()))
321
+ return { short: iso, full: iso };
322
+ const loc = dateLocale();
323
+ const time = d.toLocaleTimeString(loc, { hour: "numeric", minute: "2-digit" });
324
+ const day = (x) => new Date(x.getFullYear(), x.getMonth(), x.getDate()).getTime();
325
+ const diffDays = Math.round((day(now) - day(d)) / 86_400_000);
326
+ const short = diffDays === 0
327
+ ? t("ui.format.when.today", { time })
328
+ : diffDays === 1
329
+ ? t("ui.format.when.yesterday", { time })
330
+ : d.getFullYear() === now.getFullYear()
331
+ ? t("ui.format.when.this_year", { date: d.toLocaleDateString(loc, { month: "short", day: "numeric" }), time })
332
+ : d.toLocaleDateString(loc, { month: "short", day: "numeric", year: "numeric" });
333
+ return { short, full: d.toLocaleString(loc, { dateStyle: "full", timeStyle: "short" }) };
334
+ }
335
+ // ── SQL tokenization ──
336
+ const SQL_KEYWORDS = new Set("select from where and or not in is null as join inner left right full outer cross apply on group by order having union all distinct top limit offset fetch next rows only insert into values update set delete merge with case when then else end exists between like asc desc over partition count sum avg min max cast convert coalesce isnull returning create index nonclustered clustered unique include online concurrently table alter drop primary key foreign references begin commit rollback transaction declare exec execute option recompile nolock if".split(" "));
337
+ const SQL_PATTERN = /(--[^\n]*|\/\*[\s\S]*?\*\/)|('(?:[^']|'')*')|(\$\d+|@@?[A-Za-z_][\w]*|:[A-Za-z_]\w*|\?)|(\b\d+(?:\.\d+)?\b)|([A-Za-z_][\w$]*)|(\s+|::|[^\sA-Za-z_\d'$@:?-]+|-)|[\s\S]/gu;
338
+ export function tokenizeSql(sql) {
339
+ const out = [];
340
+ for (const m of sql.matchAll(SQL_PATTERN)) {
341
+ const [text, comment, str, param, num, word] = m;
342
+ if (comment)
343
+ out.push({ kind: "c", text });
344
+ else if (str)
345
+ out.push({ kind: "s", text });
346
+ else if (param)
347
+ out.push({ kind: "p", text });
348
+ else if (num)
349
+ out.push({ kind: "n", text });
350
+ else if (word && SQL_KEYWORDS.has(word.toLowerCase()))
351
+ out.push({ kind: "k", text });
352
+ else
353
+ out.push({ kind: "t", text });
354
+ }
355
+ return out;
356
+ }
357
+ const SQL_BREAK_BEFORE = /\s+(FROM|WHERE|GROUP BY|ORDER BY|HAVING|UNION ALL|UNION|LEFT JOIN|RIGHT JOIN|INNER JOIN|FULL JOIN|CROSS APPLY|OUTER APPLY|JOIN|LIMIT|OFFSET|VALUES|SET|RETURNING|OPTION)\b/gi;
358
+ export function prettySql(sql) {
359
+ const trimmed = sql.trim();
360
+ if (trimmed.includes("\n"))
361
+ return trimmed;
362
+ return trimmed
363
+ .replace(SQL_BREAK_BEFORE, (_, kw) => `\n${kw.toUpperCase()}`)
364
+ .replace(/\s+(AND|OR)\s+/gi, (_, op) => `\n ${op.toUpperCase()} `);
365
+ }
366
+ // ── Keyboard & local storage helpers ──
367
+ const TAB_MOVES = {
368
+ ArrowRight: (at, last) => (at === last ? 0 : at + 1),
369
+ ArrowLeft: (at, last) => (at === 0 ? last : at - 1),
370
+ Home: () => 0,
371
+ End: (_, last) => last,
372
+ };
373
+ export function tabListKeys(e) {
374
+ const tabs = [...e.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)')];
375
+ const at = tabs.findIndex((tab) => tab.contains(document.activeElement));
376
+ const move = TAB_MOVES[e.key];
377
+ if (at < 0 || !move)
378
+ return;
379
+ e.preventDefault();
380
+ e.stopPropagation();
381
+ const next = tabs[move(at, tabs.length - 1)];
382
+ next?.focus();
383
+ next?.click();
384
+ }
385
+ export function rememberedChoice(key, fallback, allowed) {
386
+ try {
387
+ const val = globalThis.localStorage?.getItem(key) ?? null;
388
+ return val !== null && allowed.includes(val) ? val : fallback;
389
+ }
390
+ catch {
391
+ return fallback;
392
+ }
393
+ }
394
+ export function remember(key, value) {
395
+ try {
396
+ if (value === null)
397
+ globalThis.localStorage?.removeItem(key);
398
+ else
399
+ globalThis.localStorage?.setItem(key, value);
400
+ }
401
+ catch { }
402
+ }
403
+ // ── Plan model projection helpers ──
404
+ export function allNodes(n, out = []) {
405
+ out.push(n);
406
+ n.children.forEach((c) => allNodes(c, out));
407
+ return out;
408
+ }
409
+ const nodesCache = new WeakMap();
410
+ export function operatorView(plan, node) {
411
+ if (!plan?.view)
412
+ return null;
413
+ let cached = nodesCache.get(plan);
414
+ if (!cached || cached.source !== plan.view) {
415
+ cached = { source: plan.view, nodes: new Map(plan.view.nodes.map((n) => [n.id, n])) };
416
+ nodesCache.set(plan, cached);
417
+ }
418
+ return cached.nodes.get(node.id) ?? null;
419
+ }
420
+ export const costBasis = (plan) => plan.view?.cost_basis ?? 1;
421
+ export const uncostedSteps = (plan) => allNodes(plan.root).filter((n) => operatorView(plan, n)?.uncosted);
422
+ export const stepShare = (plan, node) => operatorView(plan, node)?.cost_share ?? null;
423
+ export const guesses = (plan) => new Map((plan.view?.nodes ?? []).flatMap((n) => (n.guess ? [[n.id, n.guess]] : [])));
424
+ export function statedInsightShare(plan, insight) {
425
+ return (plan.view?.insights.find((i) => i.rule === insight.rule && i.nodes.length === insight.nodes.length && i.nodes.every((id, at) => id === insight.nodes[at]))?.share ?? null);
426
+ }
427
+ const matchesQuery = (plan, query) => !query ||
428
+ !plan.view?.query ||
429
+ (plan.view.query.query_id === query.id &&
430
+ (plan.view.query.plan_id == null || query.plan_id == null || plan.view.query.plan_id === query.plan_id));
431
+ export function noShareReason(plan, node, query) {
432
+ if (!plan.view)
433
+ return t("ui.plan_format.missing_view");
434
+ return matchesQuery(plan, query) ? operatorView(plan, node)?.no_share_reason ?? null : t("ui.plan_format.other_measurements");
435
+ }
436
+ export function findingNoShareReason(plan, node, query) {
437
+ if (!plan.view)
438
+ return t("ui.plan_format.missing_view");
439
+ return matchesQuery(plan, query) ? operatorView(plan, node)?.finding_no_share_reason ?? null : t("ui.plan_format.other_measurements");
440
+ }
441
+ export function sharesNote(plan, query) {
442
+ if (!plan.view)
443
+ return t("ui.plan_format.missing_view");
444
+ return matchesQuery(plan, query) ? plan.view.cost_note : t("ui.plan_format.other_measurements");
445
+ }
446
+ export const estRows = (plan, node) => {
447
+ const view = operatorView(plan, node);
448
+ return view ? view.estimated_rows : node.facts.estimated_rows_unavailable ? null : node.est_rows * Math.max(1, node.est_executions);
449
+ };
450
+ export const rowsOut = (plan, node) => {
451
+ const view = operatorView(plan, node);
452
+ return view ? view.rows_out : node.act_rows ?? estRows(plan, node);
453
+ };
454
+ export const estRowsForRuns = (plan, node) => {
455
+ const view = operatorView(plan, node);
456
+ return view ? view.estimated_rows_for_runs : node.act_executions == null ? estRows(plan, node) : null;
457
+ };
458
+ export const operatorRuns = (plan, node) => {
459
+ const view = operatorView(plan, node);
460
+ return view
461
+ ? view.runs
462
+ : node.facts.estimated_rows_unavailable
463
+ ? node.act_executions
464
+ : node.act_executions == null
465
+ ? Math.max(1, node.est_executions)
466
+ : null;
467
+ };
468
+ export const misestimate = (plan, node) => operatorView(plan, node)?.misestimate ?? null;
469
+ export function exact(value) {
470
+ if (value == null || !Number.isFinite(value))
471
+ return "—";
472
+ if (Math.abs(value) >= 100 || Number.isInteger(value))
473
+ return digits(Math.round(value).toLocaleString("en-US"));
474
+ return digits(value.toLocaleString("en-US", { maximumFractionDigits: 2 }));
475
+ }
476
+ export function cost(value) {
477
+ if (value === 0)
478
+ return "0";
479
+ if (Math.abs(value) >= 1000)
480
+ return count(value);
481
+ return digits(Number(value.toPrecision(3)).toLocaleString("en-US"));
482
+ }
483
+ export function rows(value) {
484
+ if (value == null)
485
+ return "—";
486
+ return value >= 10 ? count(Math.round(value)) : count(Math.round(value * 10) / 10);
487
+ }
488
+ export function propValue(value) {
489
+ const trimmed = value.trim();
490
+ if (/^-?\d+(\.\d+)?(e[+-]?\d+)?$/i.test(trimmed)) {
491
+ const n = Number(trimmed);
492
+ if (Number.isFinite(n))
493
+ return Math.abs(n) >= 1e4 || Number.isInteger(n) ? exact(n) : digits(Number(n.toPrecision(4)).toLocaleString("en-US"));
494
+ }
495
+ if (trimmed === "1" || trimmed.toLowerCase() === "true")
496
+ return t("ui.plan_format.true");
497
+ if (trimmed.toLowerCase() === "false")
498
+ return t("ui.plan_format.false");
499
+ return value;
500
+ }
501
+ const SEVERITY_RANK = { high: 3, medium: 2, low: 1 };
502
+ export function bySeverity(a, b) {
503
+ return SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity] || b.impact - a.impact;
504
+ }
505
+ export function insightsByNode(plan) {
506
+ const map = new Map();
507
+ (plan.insights?.items ?? []).forEach((i) => i.nodes.forEach((id) => {
508
+ const list = map.get(id) ?? [];
509
+ list.push(i);
510
+ list.sort(bySeverity);
511
+ map.set(id, list);
512
+ }));
513
+ return map;
514
+ }
515
+ export function isWrapper(n, total) {
516
+ if (n.children.length !== 1 || n.warnings.length > 0)
517
+ return false;
518
+ const free = n.self_cost / total < 0.001;
519
+ const op = n.op.toLowerCase();
520
+ return free && (op === "query block" || op === "compute scalar" || op === "query" || op === "result" || op === "stream results");
521
+ }
522
+ export function planKindLabel(plan) {
523
+ return plan.kind === "actual"
524
+ ? t("ui.common.plan_kind.actual")
525
+ : plan.kind === "generic"
526
+ ? t("ui.common.plan_kind.generic")
527
+ : t("ui.common.plan_kind.estimated");
528
+ }
529
+ export function shortPredicate(text) {
530
+ return text
531
+ .replace(/(\[[^\]]+\]\.)+(?=\[)/g, "")
532
+ .replace(/\b\w+\.\w+\.(?=\w)/g, "")
533
+ .replace(/[[\]]/g, "")
534
+ .replace(/\s*(>=|<=|<>|=|<|>)\s*/g, " $1 ")
535
+ .replace(/\s+/g, " ")
536
+ .trim();
537
+ }
538
+ export function predicateLabel(kind, predicate) {
539
+ return kind === "seek"
540
+ ? t("ui.common.plan_seek", { predicate: shortPredicate(predicate) })
541
+ : t("ui.common.plan_filter", { predicate: shortPredicate(predicate) });
542
+ }
543
+ export function planShares(plan, query) {
544
+ const view = plan.view;
545
+ const timed = plan.kind === "actual" && view?.kind === "actual" && view.timed_total_ms != null;
546
+ const entries = view?.nodes ?? [];
547
+ const nodes = allNodes(plan.root);
548
+ const own = new Map(entries.map((n) => [n.id, timed ? n.time_share ?? 0 : n.layout_own_share]));
549
+ const subtree = new Map(entries.map((n) => [n.id, timed ? n.subtree_time_share ?? 0 : n.layout_subtree_share]));
550
+ const stated = new Map(entries.map((n) => [n.id, timed ? n.time_share : n.cost_share]));
551
+ const statedSubtree = new Map(entries.map((n) => [n.id, timed ? n.subtree_time_share : n.subtree_cost_share]));
552
+ const hot = timed ? view?.hottest_time : view?.hottest_cost;
553
+ return {
554
+ basis: timed ? "time" : "cost",
555
+ own,
556
+ subtree,
557
+ stated,
558
+ statedSubtree,
559
+ hottest: nodes.find((n) => n.id === hot) ?? null,
560
+ ms: new Map(entries.flatMap((n) => (timed && n.own_ms != null ? [[n.id, n.own_ms]] : []))),
561
+ note: timed ? view?.time_note ?? null : sharesNote(plan, query),
562
+ total: (timed ? view?.timed_total_ms : view?.cost_basis) ?? 1,
563
+ };
564
+ }
565
+ export function actualFacts(plan) {
566
+ const actual = plan.kind === "actual" && plan.view?.kind === "actual" ? plan.view.actual : null;
567
+ if (!actual)
568
+ return null;
569
+ const nodes = allNodes(plan.root);
570
+ const node = (id) => nodes.find((n) => n.id === id) ?? null;
571
+ const slowest = node(actual.slowest_node);
572
+ const worst = node(actual.worst_estimate_node);
573
+ const skew = actual.skew ? node(actual.skew.node) : null;
574
+ const share = plan.view?.nodes.find((n) => n.id === actual.slowest_node)?.time_share;
575
+ return {
576
+ triggers: actual.triggers.map((tr) => ({ name: tr.name, relation: tr.relation, ms: tr.time_ms, calls: tr.calls })),
577
+ elapsedMs: actual.elapsed_ms,
578
+ cpuMs: actual.cpu_ms,
579
+ logicalReads: actual.logical_reads,
580
+ physicalReads: actual.physical_reads,
581
+ rows: actual.rows,
582
+ grantedKb: actual.memory_granted_kb,
583
+ usedKb: actual.memory_used_kb,
584
+ spilled: actual.spilled,
585
+ spillPages: actual.spill_pages ?? 0,
586
+ timed: actual.timed,
587
+ slowest: slowest && actual.slowest_ms != null && share != null ? { node: slowest, ms: actual.slowest_ms, share } : null,
588
+ worstEstimate: worst && actual.worst_estimate != null ? { node: worst, factor: actual.worst_estimate } : null,
589
+ skew: skew && actual.skew ? { node: skew, busiest: actual.skew.busiest, threads: actual.skew.threads } : null,
590
+ lastRunAt: actual.last_run_at,
591
+ workers: actual.workers,
592
+ };
593
+ }
package/pkg/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export { ActualSummary } from "./ActualSummary.js";
2
+ export { DeadlockGraph } from "./DeadlockGraph.js";
3
+ export { DeadlockViewer, deadlockPatternLabel, deadlockWhen, type DeadlockViewerProps } from "./DeadlockViewer.js";
4
+ export { DocdbWork } from "./DocdbWork.js";
5
+ export { bindPlanViewerClipboard, bindPlanViewerI18n, type MessageArgs, type PlanViewerClipboardHandler, type PlanViewerI18nAdapter, } from "./host.js";
6
+ export { NodeDetails } from "./NodeDetails.js";
7
+ export { OpIcon, opIcon } from "./OpIcon.js";
8
+ export { PlanAssessmentNotes } from "./PlanAssessmentNotes.js";
9
+ export { PlanCanvas, type PlanCanvasProps } from "./PlanCanvas.js";
10
+ export { compactOp, CostStrip, costBasis, PlanDiagram, type DiagramLens, type Mark } from "./PlanDiagram.js";
11
+ export { PlanDiffViewer, PropsCompare, type PlanDiffLook, type PlanDiffViewerProps } from "./PlanDiffViewer.js";
12
+ export { PlanInsights } from "./PlanInsights.js";
13
+ export { PlanObjects } from "./PlanObjects.js";
14
+ export { PlanOperations } from "./PlanOperations.js";
15
+ export { PlanRaw } from "./PlanRaw.js";
16
+ export { LookToggle, PlanSurface, rememberedLook, rememberLook, type PlanLook } from "./PlanSurface.js";
17
+ export { PlanTypeSchema } from "./PlanTypeSchema.js";
18
+ export { NodeProps, PlanTree, PlanView, planKindLabel, predicateLabel, shortPredicate } from "./PlanView.js";
19
+ export { PlanViewer, type PlanViewerProps, type PlanViewerTheme } from "./PlanViewer.js";
20
+ export { Prose } from "./Prose.js";
21
+ export { Sql } from "./Sql.js";
22
+ export type { ChangeKind, Deadlock, DeadlockFix, DeadlockPattern, DeadlockProcess, DeadlockResource, DocdbMetrics, Engine, InsightArea, NodeRuntime, Plan, PlanChange, PlanDiff, PlanInsight, PlanKind, PlanNode, PlanNodeFacts, PlanOperatorView, PlanViewModel, QueryStat, Scenario, ScenarioKind, Severity, } from "./types.js";
package/pkg/index.js ADDED
@@ -0,0 +1,21 @@
1
+ export { ActualSummary } from "./ActualSummary.js";
2
+ export { DeadlockGraph } from "./DeadlockGraph.js";
3
+ export { DeadlockViewer, deadlockPatternLabel, deadlockWhen } from "./DeadlockViewer.js";
4
+ export { DocdbWork } from "./DocdbWork.js";
5
+ export { bindPlanViewerClipboard, bindPlanViewerI18n, } from "./host.js";
6
+ export { NodeDetails } from "./NodeDetails.js";
7
+ export { OpIcon, opIcon } from "./OpIcon.js";
8
+ export { PlanAssessmentNotes } from "./PlanAssessmentNotes.js";
9
+ export { PlanCanvas } from "./PlanCanvas.js";
10
+ export { compactOp, CostStrip, costBasis, PlanDiagram } from "./PlanDiagram.js";
11
+ export { PlanDiffViewer, PropsCompare } from "./PlanDiffViewer.js";
12
+ export { PlanInsights } from "./PlanInsights.js";
13
+ export { PlanObjects } from "./PlanObjects.js";
14
+ export { PlanOperations } from "./PlanOperations.js";
15
+ export { PlanRaw } from "./PlanRaw.js";
16
+ export { LookToggle, PlanSurface, rememberedLook, rememberLook } from "./PlanSurface.js";
17
+ export { PlanTypeSchema } from "./PlanTypeSchema.js";
18
+ export { NodeProps, PlanTree, PlanView, planKindLabel, predicateLabel, shortPredicate } from "./PlanView.js";
19
+ export { PlanViewer } from "./PlanViewer.js";
20
+ export { Prose } from "./Prose.js";
21
+ export { Sql } from "./Sql.js";
@@ -0,0 +1,6 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ /**
4
+ * One of an engine's [`EngineAbilities`], to ask about it or for the reason it lacks it ([`crate::EngineSpec::refusal`]).
5
+ */
6
+ export type Ability = "sessions" | "wait_sample" | "deadlocks" | "measures_runs" | "plan_estimates" | "writes" | "periods" | "last_actual_plan" | "operator_progress" | "sign_in";
@@ -0,0 +1,16 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { TriggerTiming } from "./TriggerTiming.js";
3
+ import type { WorkerSkew } from "./WorkerSkew.js";
4
+
5
+ /**
6
+ * The headline numbers of an actual plan, for the CLI and agents.
7
+ */
8
+ export type ActualSummary = { triggers: Array<TriggerTiming>, elapsed_ms: number | null, cpu_ms: number | null, logical_reads: number | null, physical_reads: number | null, rows: number | null, memory_granted_kb: number | null, memory_used_kb: number | null, spilled: boolean,
9
+ /**
10
+ * The operator that spent the most time of its own, and that time.
11
+ */
12
+ slowest_node: number | null, slowest_ms: number | null,
13
+ /**
14
+ * The operator whose row count was furthest from the estimate (×, signed like `PlanNode::misestimate`).
15
+ */
16
+ worst_estimate_node: number | null, worst_estimate: number | null, timed: boolean, operator_time_ms: number | null, spill_pages: number | null, skew: WorkerSkew | null, last_run_at: string | null, workers: number | null, };
@@ -0,0 +1,9 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ import type { CachedStatementIdentity } from "./CachedStatementIdentity.js";
3
+ import type { StatementOrigin } from "./StatementOrigin.js";
4
+
5
+ export type CachedStatementContext = { identity: CachedStatementIdentity,
6
+ /**
7
+ * Native compilation database, not the batch text's nullable database or a session default.
8
+ */
9
+ database_id: number, query_hash: string | null, origin: StatementOrigin, monitoring_template_id: string | null, source_text_bytes: string | null, source_text_complete: boolean, };
@@ -0,0 +1,7 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+
3
+ export type CachedStatementIdentity = { plan_handle: string, sql_handle: string,
4
+ /**
5
+ * Native UTF-16 byte offsets, not Rust/JavaScript character offsets.
6
+ */
7
+ statement_start_bytes: number, statement_end_bytes: number, created_without_offset: string, plan_generation: string, };