Skip to content

Commit e238d16

Browse files
author
dbopt
committed
npm: publish 0.4.0 and expose ObjectRef in the type surface
npm/package.json carries its own version, independent of the workspace Cargo.toml, so a release bump does not reach it. Bumped by hand to 0.4.0 — worth wiring to the workspace version before the next release, since the failure mode is silently republishing under the previous number. types.d.ts gains ObjectRef and Finding.object, re-exported from both the node and web entrypoints, so the published typings match what the WASM now returns: a plan finding names its table, a token finding does not.
1 parent f470b96 commit e238d16

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

npm/node.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type {
1313
Engine,
1414
Location,
1515
Finding,
16+
ObjectRef,
1617
Recommendation,
1718
AnalysisReport,
1819
AnalyzeOptions,

npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dbopt-core",
3-
"version": "0.3.9",
3+
"version": "0.4.0",
44
"description": "Find and fix slow SQL before it reaches production. A local-first database performance analyzer compiled from Rust to WebAssembly \u2014 runs in Node and the browser and sends nothing anywhere. SQL Server rules today; engine-agnostic by design.",
55
"license": "Apache-2.0",
66
"homepage": "https://dbopt.org",

npm/types.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ export interface Location {
2525
col: number;
2626
}
2727

28+
/**
29+
* The database object a finding is about.
30+
*
31+
* Present only when the rule genuinely knows the object — a plan's `<Object>`
32+
* or a DMV row. Absent for token rules, which match *text*: a rule that saw
33+
* `SELECT *` has no table identity, and one is never inferred from the message.
34+
*
35+
* `row_count` / `reserved_kb` appear only when they were measured (from
36+
* `sys.dm_db_partition_stats`). Absent means unknown — never read it as zero.
37+
*/
38+
export interface ObjectRef {
39+
schema: string;
40+
table: string;
41+
/** Set when the finding is about one index rather than the whole table. */
42+
index?: string;
43+
row_count?: number;
44+
reserved_kb?: number;
45+
}
46+
2847
export interface Finding {
2948
/** Stable rule id, e.g. `"sarg.function_on_column"`. Safe to match on. */
3049
rule: string;
@@ -35,6 +54,8 @@ export interface Finding {
3554
location: Location | null;
3655
/** The concrete fix, usually copy-paste ready T-SQL. */
3756
recommendation: string | null;
57+
/** The object this finding concerns, when the rule knows it. */
58+
object?: ObjectRef;
3859
}
3960

4061
export interface Recommendation {

npm/web.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type {
1111
Engine,
1212
Location,
1313
Finding,
14+
ObjectRef,
1415
Recommendation,
1516
AnalysisReport,
1617
AnalyzeOptions,

0 commit comments

Comments
 (0)