@descryy/runtime-database-observation 0.0.0 → 0.1.0
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/query-line-parser.d.ts +1 -1
- package/dist/query-line-parser.d.ts.map +1 -1
- package/dist/query-line-parser.js +5 -1
- package/dist/query-line-parser.js.map +1 -1
- package/dist/query-marker.d.ts +34 -0
- package/dist/query-marker.d.ts.map +1 -0
- package/dist/query-marker.js +30 -0
- package/dist/query-marker.js.map +1 -0
- package/dist/sqlite-instrumentation.d.ts +1 -9
- package/dist/sqlite-instrumentation.d.ts.map +1 -1
- package/dist/sqlite-instrumentation.js +6 -1
- package/dist/sqlite-instrumentation.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* stdout/stderr — is not this parser's concern and is left alone; a
|
|
5
5
|
* database collector does not also try to be a log collector.
|
|
6
6
|
*/
|
|
7
|
-
import { QUERY_MARKER, type CapturedMethod, type CapturedQuery } from "./
|
|
7
|
+
import { QUERY_MARKER, type CapturedMethod, type CapturedQuery } from "./query-marker.ts";
|
|
8
8
|
/**
|
|
9
9
|
* `null` for a non-matching line (ordinary application output) AND for a
|
|
10
10
|
* line that starts with the marker but fails to parse as one of this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-line-parser.d.ts","sourceRoot":"","sources":["../src/query-line-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"query-line-parser.d.ts","sourceRoot":"","sources":["../src/query-line-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAc1F;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAUjE;AAED,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* stdout/stderr — is not this parser's concern and is left alone; a
|
|
5
5
|
* database collector does not also try to be a log collector.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
// From `query-marker.ts`, never from `sqlite-instrumentation.ts`. That import
|
|
8
|
+
// used to read as free — one string constant — and was not: it loaded a module
|
|
9
|
+
// that patches `DatabaseSync.prototype` and writes to stdout at module scope,
|
|
10
|
+
// into every consumer of this package's index.
|
|
11
|
+
import { QUERY_MARKER } from "./query-marker.js";
|
|
8
12
|
function isCapturedQuery(value) {
|
|
9
13
|
if (typeof value !== "object" || value === null)
|
|
10
14
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-line-parser.js","sourceRoot":"","sources":["../src/query-line-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAA2C,MAAM,
|
|
1
|
+
{"version":3,"file":"query-line-parser.js","sourceRoot":"","sources":["../src/query-line-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,+CAA+C;AAC/C,OAAO,EAAE,YAAY,EAA2C,MAAM,mBAAmB,CAAC;AAE1F,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,CACL,OAAO,CAAC,CAAC,GAAG,KAAK,QAAQ;QACzB,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ;QAC5B,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ;QAChC,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS;QAC9B,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAClD,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,YAAY,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire vocabulary shared by the two halves of database observation: the
|
|
3
|
+
* marker prefix and the shape that follows it.
|
|
4
|
+
*
|
|
5
|
+
* This module exists to be **free of side effects**, and that is its entire
|
|
6
|
+
* job. `sqlite-instrumentation.ts` — the other holder of these names until
|
|
7
|
+
* now — patches `DatabaseSync.prototype` at module scope and writes to
|
|
8
|
+
* stdout, which is right for a `--import` preload inside an observed process
|
|
9
|
+
* and wrong everywhere else. `query-line-parser.ts` needed nothing from it
|
|
10
|
+
* but the string `"DESCRY_DB_QUERY"`, and importing a string is still
|
|
11
|
+
* importing a module: the patch and the stdout writer came along, through the
|
|
12
|
+
* package index, into every consumer. Downstream that reached `@descryy/mcp`,
|
|
13
|
+
* whose stdout is a JSON-RPC transport — one `analyze` call put 14,906
|
|
14
|
+
* `DESCRY_DB_QUERY` lines into the protocol stream.
|
|
15
|
+
*
|
|
16
|
+
* So: the emitter imports the vocabulary, the parser imports the vocabulary,
|
|
17
|
+
* and neither imports the other. Anything added here must stay a constant or
|
|
18
|
+
* a type. A function with a module-scope effect would rebuild the same trap
|
|
19
|
+
* one file over.
|
|
20
|
+
*
|
|
21
|
+
* The prefix convention itself is the benchmark harness's `BENCH_RESULT
|
|
22
|
+
* {json}` (RT-072): one line of structured JSON, never prose, because
|
|
23
|
+
* scraping prose measures the prose.
|
|
24
|
+
*/
|
|
25
|
+
export declare const QUERY_MARKER = "DESCRY_DB_QUERY";
|
|
26
|
+
export type CapturedMethod = "exec" | "prepare" | "run" | "get" | "all";
|
|
27
|
+
export interface CapturedQuery {
|
|
28
|
+
readonly sql: string;
|
|
29
|
+
readonly method: CapturedMethod;
|
|
30
|
+
readonly durationMs: number;
|
|
31
|
+
readonly success: boolean;
|
|
32
|
+
readonly error: string | null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=query-marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-marker.d.ts","sourceRoot":"","sources":["../src/query-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,eAAO,MAAM,YAAY,oBAAsC,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAExE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire vocabulary shared by the two halves of database observation: the
|
|
3
|
+
* marker prefix and the shape that follows it.
|
|
4
|
+
*
|
|
5
|
+
* This module exists to be **free of side effects**, and that is its entire
|
|
6
|
+
* job. `sqlite-instrumentation.ts` — the other holder of these names until
|
|
7
|
+
* now — patches `DatabaseSync.prototype` at module scope and writes to
|
|
8
|
+
* stdout, which is right for a `--import` preload inside an observed process
|
|
9
|
+
* and wrong everywhere else. `query-line-parser.ts` needed nothing from it
|
|
10
|
+
* but the string `"DESCRY_DB_QUERY"`, and importing a string is still
|
|
11
|
+
* importing a module: the patch and the stdout writer came along, through the
|
|
12
|
+
* package index, into every consumer. Downstream that reached `@descryy/mcp`,
|
|
13
|
+
* whose stdout is a JSON-RPC transport — one `analyze` call put 14,906
|
|
14
|
+
* `DESCRY_DB_QUERY` lines into the protocol stream.
|
|
15
|
+
*
|
|
16
|
+
* So: the emitter imports the vocabulary, the parser imports the vocabulary,
|
|
17
|
+
* and neither imports the other. Anything added here must stay a constant or
|
|
18
|
+
* a type. A function with a module-scope effect would rebuild the same trap
|
|
19
|
+
* one file over.
|
|
20
|
+
*
|
|
21
|
+
* The prefix convention itself is the benchmark harness's `BENCH_RESULT
|
|
22
|
+
* {json}` (RT-072): one line of structured JSON, never prose, because
|
|
23
|
+
* scraping prose measures the prose.
|
|
24
|
+
*/
|
|
25
|
+
import { RESERVED_MARKER_PREFIX } from "@descryy/runtime-contracts";
|
|
26
|
+
// Derived, not spelled again: `RESERVED_MARKER_PREFIX` is what the
|
|
27
|
+
// backend log collector skips on, so a marker that did not use it would
|
|
28
|
+
// come back as the application's own log output.
|
|
29
|
+
export const QUERY_MARKER = `${RESERVED_MARKER_PREFIX}DB_QUERY`;
|
|
30
|
+
//# sourceMappingURL=query-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-marker.js","sourceRoot":"","sources":["../src/query-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,mEAAmE;AACnE,wEAAwE;AACxE,iDAAiD;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,sBAAsB,UAAU,CAAC"}
|
|
@@ -19,13 +19,5 @@
|
|
|
19
19
|
* benchmark harness's own `BENCH_RESULT {json}` convention (RT-072):
|
|
20
20
|
* scraping prose measures the prose, so nothing here is prose.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
23
|
-
export type CapturedMethod = "exec" | "prepare" | "run" | "get" | "all";
|
|
24
|
-
export interface CapturedQuery {
|
|
25
|
-
readonly sql: string;
|
|
26
|
-
readonly method: CapturedMethod;
|
|
27
|
-
readonly durationMs: number;
|
|
28
|
-
readonly success: boolean;
|
|
29
|
-
readonly error: string | null;
|
|
30
|
-
}
|
|
22
|
+
export {};
|
|
31
23
|
//# sourceMappingURL=sqlite-instrumentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-instrumentation.d.ts","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG
|
|
1
|
+
{"version":3,"file":"sqlite-instrumentation.d.ts","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -20,7 +20,12 @@
|
|
|
20
20
|
* scraping prose measures the prose, so nothing here is prose.
|
|
21
21
|
*/
|
|
22
22
|
import { DatabaseSync } from "node:sqlite";
|
|
23
|
-
|
|
23
|
+
// The vocabulary lives in a module with no side effects of its own, and the
|
|
24
|
+
// direction matters: this file imports it, nothing imports this file. The
|
|
25
|
+
// parser once reached in here for `QUERY_MARKER` alone and took the prototype
|
|
26
|
+
// patch and the stdout writer with it, all the way into a JSON-RPC transport.
|
|
27
|
+
// See `query-marker.ts` for the measurement.
|
|
28
|
+
import { QUERY_MARKER } from "./query-marker.js";
|
|
24
29
|
function emit(query) {
|
|
25
30
|
process.stdout.write(`${QUERY_MARKER} ${JSON.stringify(query)}\n`);
|
|
26
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-instrumentation.js","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,
|
|
1
|
+
{"version":3,"file":"sqlite-instrumentation.js","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,4EAA4E;AAC5E,0EAA0E;AAC1E,8EAA8E;AAC9E,8EAA8E;AAC9E,6CAA6C;AAC7C,OAAO,EAAE,YAAY,EAA2C,MAAM,mBAAmB,CAAC;AAE1F,SAAS,IAAI,CAAC,KAAoB;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,KAAK,CAAI,GAAW,EAAE,MAAsB,EAAE,GAAY;IACjE,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACzF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,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MAAM,CAAiC,CAAC;YACpE,UAAU,CAAC,MAAM,CAAC,GAAG,SAAS,sBAAsB,CAAC,GAAG,IAAe;gBACrE,OAAO,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC9D,CAAC,CAAC;QACJ,CAAC;QACD,wEAAwE;QACxE,mEAAmE;QACnE,sEAAsE;QACtE,mDAAmD;QACnD,OAAO,IAAI,CAAC;IACd,CAA0C,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descryy/runtime-database-observation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Database query observation (plan §18, checklist §14): real DATABASE_QUERY capture via driver instrumentation, never parsed application logs. Driver #1 is node:sqlite.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"build": "tsc -b"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@descryy/runtime-contracts": "
|
|
28
|
-
"@descryy/runtime-backend-observation": "
|
|
29
|
-
"@descryy/runtime-graph-correlator": "
|
|
27
|
+
"@descryy/runtime-contracts": "0.1.0",
|
|
28
|
+
"@descryy/runtime-backend-observation": "0.1.0",
|
|
29
|
+
"@descryy/runtime-graph-correlator": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@descryy/runtime-controller": "*",
|