@descryy/runtime-database-observation 0.3.0 → 0.4.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/LICENSE +6 -0
- package/dist/collector-version.d.ts +4 -6
- package/dist/collector-version.d.ts.map +1 -1
- package/dist/collector-version.js +4 -6
- package/dist/collector-version.js.map +1 -1
- package/dist/graph-mapping.d.ts +9 -12
- package/dist/graph-mapping.d.ts.map +1 -1
- package/dist/graph-mapping.js +9 -12
- package/dist/graph-mapping.js.map +1 -1
- package/dist/query-collector.d.ts +11 -15
- package/dist/query-collector.d.ts.map +1 -1
- package/dist/query-collector.js +15 -23
- package/dist/query-collector.js.map +1 -1
- package/dist/query-line-parser.d.ts +3 -5
- package/dist/query-line-parser.d.ts.map +1 -1
- package/dist/query-line-parser.js +6 -9
- package/dist/query-line-parser.js.map +1 -1
- package/dist/query-marker.d.ts +13 -17
- package/dist/query-marker.d.ts.map +1 -1
- package/dist/query-marker.js +15 -20
- package/dist/query-marker.js.map +1 -1
- package/dist/sqlite-instrumentation.d.ts +11 -16
- package/dist/sqlite-instrumentation.d.ts.map +1 -1
- package/dist/sqlite-instrumentation.js +18 -25
- package/dist/sqlite-instrumentation.js.map +1 -1
- package/dist/table-extraction.d.ts +12 -15
- package/dist/table-extraction.d.ts.map +1 -1
- package/dist/table-extraction.js +12 -15
- package/dist/table-extraction.js.map +1 -1
- package/package.json +9 -4
package/LICENSE
ADDED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `Evidence.collectorVersion`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* repo (`process.version`, always known, never probed) applied to a
|
|
7
|
-
* package instead of the Node runtime.
|
|
2
|
+
* `Evidence.collectorVersion` for every collector here: read from this
|
|
3
|
+
* package's own `package.json` "version" rather than hand-duplicated into
|
|
4
|
+
* a second string that can drift. Same idea as `nodeVersion`
|
|
5
|
+
* (`process.version`) applied to a package instead of the runtime.
|
|
8
6
|
*/
|
|
9
7
|
export declare const COLLECTOR_VERSION: string;
|
|
10
8
|
//# sourceMappingURL=collector-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector-version.d.ts","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"collector-version.d.ts","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,iBAAiB,EAAE,MAA6E,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `Evidence.collectorVersion`
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* repo (`process.version`, always known, never probed) applied to a
|
|
7
|
-
* package instead of the Node runtime.
|
|
2
|
+
* `Evidence.collectorVersion` for every collector here: read from this
|
|
3
|
+
* package's own `package.json` "version" rather than hand-duplicated into
|
|
4
|
+
* a second string that can drift. Same idea as `nodeVersion`
|
|
5
|
+
* (`process.version`) applied to a package instead of the runtime.
|
|
8
6
|
*/
|
|
9
7
|
import { createRequire } from "node:module";
|
|
10
8
|
const require = createRequire(import.meta.url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector-version.js","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"collector-version.js","sourceRoot":"","sources":["../src/collector-version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAY,OAAO,CAAC,iBAAiB,CAAkC,CAAC,OAAO,CAAC"}
|
package/dist/graph-mapping.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* §10/§18's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (`@descryy/runtime-graph-correlator`)
|
|
2
|
+
* §10/§18's graph correlation row (RT-141's disclosed gap, closed here):
|
|
3
|
+
* resolving an observed `DATABASE_QUERY`'s captured table name to the real
|
|
4
|
+
* `DATABASE_TABLE` graph node via `resolveDatabaseTableNode`
|
|
5
|
+
* (`@descryy/runtime-graph-correlator`).
|
|
6
6
|
*
|
|
7
|
-
* Same shape as `test-runner`'s
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* as every other collector's `graphNodeId: null`. The caller that already
|
|
13
|
-
* holds both the store and the graph `driver` attributes; this only
|
|
14
|
-
* resolves.
|
|
7
|
+
* Same shape as `test-runner`'s `resolveObservedTestCase`, deliberately: a
|
|
8
|
+
* thin per-package translation, not a new abstraction. Doesn't call
|
|
9
|
+
* `EvidenceStore.attribute()` itself — that needs the real `evidenceId`,
|
|
10
|
+
* which only exists after `store.write()` returns it. Caller attributes;
|
|
11
|
+
* this only resolves.
|
|
15
12
|
*/
|
|
16
13
|
import type { SqlDriver } from "@descryy/core";
|
|
17
14
|
import { type DatabaseTableResolution } from "@descryy/runtime-graph-correlator";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-mapping.d.ts","sourceRoot":"","sources":["../src/graph-mapping.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"graph-mapping.d.ts","sourceRoot":"","sources":["../src/graph-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAA4B,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC3G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,MAAM,+BAA+B,GACvC,uBAAuB,GACvB;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC,EACjD,OAAO,GAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACxC,+BAA+B,CAkBjC"}
|
package/dist/graph-mapping.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* §10/§18's
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (`@descryy/runtime-graph-correlator`)
|
|
2
|
+
* §10/§18's graph correlation row (RT-141's disclosed gap, closed here):
|
|
3
|
+
* resolving an observed `DATABASE_QUERY`'s captured table name to the real
|
|
4
|
+
* `DATABASE_TABLE` graph node via `resolveDatabaseTableNode`
|
|
5
|
+
* (`@descryy/runtime-graph-correlator`).
|
|
6
6
|
*
|
|
7
|
-
* Same shape as `test-runner`'s
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* as every other collector's `graphNodeId: null`. The caller that already
|
|
13
|
-
* holds both the store and the graph `driver` attributes; this only
|
|
14
|
-
* resolves.
|
|
7
|
+
* Same shape as `test-runner`'s `resolveObservedTestCase`, deliberately: a
|
|
8
|
+
* thin per-package translation, not a new abstraction. Doesn't call
|
|
9
|
+
* `EvidenceStore.attribute()` itself — that needs the real `evidenceId`,
|
|
10
|
+
* which only exists after `store.write()` returns it. Caller attributes;
|
|
11
|
+
* this only resolves.
|
|
15
12
|
*/
|
|
16
13
|
import { resolveDatabaseTableNode } from "@descryy/runtime-graph-correlator";
|
|
17
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-mapping.js","sourceRoot":"","sources":["../src/graph-mapping.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"graph-mapping.js","sourceRoot":"","sources":["../src/graph-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,wBAAwB,EAAgC,MAAM,mCAAmC,CAAC;AAO3G;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,MAAiB,EACjB,QAAiD,EACjD,UAAuC,EAAE;IAEzC,IAAI,QAAQ,CAAC,SAAS,KAAK,gBAAgB,EAAE,CAAC;QAC5C,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,0BAA0B,QAAQ,CAAC,SAAS,gHAAgH;SACrK,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAuC,CAAC;IACjE,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,MAAM,EACJ,wGAAwG;gBACxG,qEAAqE;SACxE,CAAC;IACJ,CAAC;IACD,OAAO,wBAAwB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `DatabaseQueryCollector` (plan §18 / checklist §14): translates
|
|
3
3
|
* `sqlite-instrumentation.ts`'s captured queries into `DATABASE_QUERY`
|
|
4
|
-
* Evidence. Same shape as `LogCollector`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* a different marker on the same stream.
|
|
4
|
+
* Evidence. Same shape as `LogCollector` deliberately — `ProcessOutputSource`
|
|
5
|
+
* in, `Evidence` out, streaming-first, a collector failure reported as
|
|
6
|
+
* evidence rather than swallowed — for a different marker on the same stream.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* ordinary queries, not grouped) — a real, still-open §14/§18 row.
|
|
8
|
+
* Does not do transaction-boundary tracking — BEGIN/COMMIT/ROLLBACK are
|
|
9
|
+
* captured as ordinary queries, not grouped (open §14/§18 row).
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* evidence type. The resolver itself (RT-146) is real; this collector
|
|
20
|
-
* simply isn't the one that calls it.
|
|
11
|
+
* `graphNodeId` on emitted evidence is always null here, same as every
|
|
12
|
+
* other collector (RT-076 precedent) — `graph-mapping.ts`'s
|
|
13
|
+
* `resolveObservedDatabaseQuery` is what a caller holding the store and
|
|
14
|
+
* driver uses to resolve the table and attribute it after `write()`, the
|
|
15
|
+
* way `vertical-slice` does for every evidence type. The resolver (RT-146)
|
|
16
|
+
* is real; this collector just isn't the one that calls it.
|
|
21
17
|
*/
|
|
22
18
|
import type { Collector } from "@descryy/runtime-contracts";
|
|
23
19
|
import { type ProcessOutputSource } from "@descryy/runtime-backend-observation";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-collector.d.ts","sourceRoot":"","sources":["../src/query-collector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query-collector.d.ts","sourceRoot":"","sources":["../src/query-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAmF,MAAM,4BAA4B,CAAC;AAC7I,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAMvG,iNAAiN;AACjN,eAAO,MAAM,0BAA0B,QAAyE,CAAC;AAEjH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,mHAAmH;IACnH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAyBD,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,6BAA6B,GAAG,SAAS,CAgG9F"}
|
package/dist/query-collector.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `DatabaseQueryCollector` (plan §18 / checklist §14): translates
|
|
3
3
|
* `sqlite-instrumentation.ts`'s captured queries into `DATABASE_QUERY`
|
|
4
|
-
* Evidence. Same shape as `LogCollector`
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* a different marker on the same stream.
|
|
4
|
+
* Evidence. Same shape as `LogCollector` deliberately — `ProcessOutputSource`
|
|
5
|
+
* in, `Evidence` out, streaming-first, a collector failure reported as
|
|
6
|
+
* evidence rather than swallowed — for a different marker on the same stream.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* ordinary queries, not grouped) — a real, still-open §14/§18 row.
|
|
8
|
+
* Does not do transaction-boundary tracking — BEGIN/COMMIT/ROLLBACK are
|
|
9
|
+
* captured as ordinary queries, not grouped (open §14/§18 row).
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* evidence type. The resolver itself (RT-146) is real; this collector
|
|
20
|
-
* simply isn't the one that calls it.
|
|
11
|
+
* `graphNodeId` on emitted evidence is always null here, same as every
|
|
12
|
+
* other collector (RT-076 precedent) — `graph-mapping.ts`'s
|
|
13
|
+
* `resolveObservedDatabaseQuery` is what a caller holding the store and
|
|
14
|
+
* driver uses to resolve the table and attribute it after `write()`, the
|
|
15
|
+
* way `vertical-slice` does for every evidence type. The resolver (RT-146)
|
|
16
|
+
* is real; this collector just isn't the one that calls it.
|
|
21
17
|
*/
|
|
22
18
|
import { fileURLToPath } from "node:url";
|
|
23
19
|
import { extractCorrelationIds } from "@descryy/runtime-backend-observation";
|
|
@@ -42,9 +38,7 @@ function computeCapabilities() {
|
|
|
42
38
|
sourceMapping: status,
|
|
43
39
|
stackCapture: status,
|
|
44
40
|
processLifecycle: status,
|
|
45
|
-
//
|
|
46
|
-
// deferred (RT-142) -- closed here (RT-146), alongside the field's
|
|
47
|
-
// own addition to the contract.
|
|
41
|
+
// RT-141 named this missing, deferred as RT-142 -- closed here (RT-146).
|
|
48
42
|
databaseObservation: { availability: "available", reason: null },
|
|
49
43
|
externalServiceObservation: { availability: "unavailable", reason: "DatabaseQueryCollector instruments node:sqlite only; outbound requests are ExternalRequestCollector's to observe (RT-146)." },
|
|
50
44
|
};
|
|
@@ -72,14 +66,12 @@ export function createDatabaseQueryCollector(options) {
|
|
|
72
66
|
traceId,
|
|
73
67
|
requestId,
|
|
74
68
|
correlationId: null,
|
|
75
|
-
// Resolved later
|
|
76
|
-
// resolveObservedDatabaseQuery (graph-mapping.ts), not here.
|
|
77
|
-
// split every other collector's graphNodeId already takes.
|
|
69
|
+
// Resolved later by a caller holding store+driver --
|
|
70
|
+
// resolveObservedDatabaseQuery (graph-mapping.ts), not here.
|
|
78
71
|
graphNodeId: null,
|
|
79
72
|
sourceLocation: null,
|
|
80
73
|
stackTrace: null,
|
|
81
|
-
//
|
|
82
|
-
// success/failure) is not probabilistic.
|
|
74
|
+
// Real captured call, real timing, real outcome -- not probabilistic.
|
|
83
75
|
confidence: 1,
|
|
84
76
|
redactionStatus: "pending-redaction",
|
|
85
77
|
collectorVersion: COLLECTOR_VERSION,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-collector.js","sourceRoot":"","sources":["../src/query-collector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query-collector.js","sourceRoot":"","sources":["../src/query-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAA4B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AAO,OAAO,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,IAAI;YACR,MAAM,eAAe,CAAC;QACxB,CAAC;QAED,YAAY;YACV,IAAI,kBAAkB,KAAK,IAAI;gBAAE,OAAO,YAAY,CAAC;YACrD,OAAO;gBACL,GAAG,YAAY;gBACf,gBAAgB,EAAE;oBAChB,YAAY,EAAE,aAAa;oBAC3B,MAAM,EAAE,6CAA6C,kBAAkB,gDAAgD;iBACxH;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,11 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { QUERY_MARKER, type CapturedMethod, type CapturedQuery } from "./query-marker.ts";
|
|
8
8
|
/**
|
|
9
|
-
* `null` for a non-matching line
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* never guessed at, the same "wrong shape, not a wrong value" distinction
|
|
13
|
-
* `test-runner`'s own `isNodeTestEvent` makes.
|
|
9
|
+
* `null` for a non-matching line AND for a line that starts with the
|
|
10
|
+
* marker but fails to parse -- a malformed marker line is refused, never
|
|
11
|
+
* guessed at (same distinction `test-runner`'s `isNodeTestEvent` makes).
|
|
14
12
|
*/
|
|
15
13
|
export declare function parseQueryLine(line: string): CapturedQuery | null;
|
|
16
14
|
export type { CapturedMethod, CapturedQuery };
|
|
@@ -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;AAKH,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAc1F;;;;GAIG;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,10 +4,9 @@
|
|
|
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
|
-
// From
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// into every consumer of this package's index.
|
|
7
|
+
// From query-marker.ts, never sqlite-instrumentation.ts: that module patches
|
|
8
|
+
// DatabaseSync.prototype and writes to stdout at module scope -- importing
|
|
9
|
+
// it here would leak into every consumer of this package's index.
|
|
11
10
|
import { QUERY_MARKER } from "./query-marker.js";
|
|
12
11
|
function isCapturedQuery(value) {
|
|
13
12
|
if (typeof value !== "object" || value === null)
|
|
@@ -20,11 +19,9 @@ function isCapturedQuery(value) {
|
|
|
20
19
|
(v.error === null || typeof v.error === "string"));
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
|
-
* `null` for a non-matching line
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* never guessed at, the same "wrong shape, not a wrong value" distinction
|
|
27
|
-
* `test-runner`'s own `isNodeTestEvent` makes.
|
|
22
|
+
* `null` for a non-matching line AND for a line that starts with the
|
|
23
|
+
* marker but fails to parse -- a malformed marker line is refused, never
|
|
24
|
+
* guessed at (same distinction `test-runner`'s `isNodeTestEvent` makes).
|
|
28
25
|
*/
|
|
29
26
|
export function parseQueryLine(line) {
|
|
30
27
|
if (!line.startsWith(`${QUERY_MARKER} `))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-line-parser.js","sourceRoot":"","sources":["../src/query-line-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"query-line-parser.js","sourceRoot":"","sources":["../src/query-line-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6EAA6E;AAC7E,2EAA2E;AAC3E,kEAAkE;AAClE,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;;;;GAIG;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"}
|
package/dist/query-marker.d.ts
CHANGED
|
@@ -2,25 +2,21 @@
|
|
|
2
2
|
* The wire vocabulary shared by the two halves of database observation: the
|
|
3
3
|
* marker prefix and the shape that follows it.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* whose stdout is a JSON-RPC transport — one `analyze` call put 14,906
|
|
14
|
-
* `DESCRY_DB_QUERY` lines into the protocol stream.
|
|
5
|
+
* Exists to be free of side effects -- that's its entire job.
|
|
6
|
+
* `sqlite-instrumentation.ts` patches `DatabaseSync.prototype` at module
|
|
7
|
+
* scope and writes to stdout, right for a `--import` preload in an
|
|
8
|
+
* observed process, wrong everywhere else. Importing just the string
|
|
9
|
+
* `"DESCRY_DB_QUERY"` from it still imports the module -- the patch and
|
|
10
|
+
* stdout writer came along through the package index into every consumer,
|
|
11
|
+
* reaching `@descryy/mcp`, whose stdout is a JSON-RPC transport: one
|
|
12
|
+
* `analyze` call put 14,906 `DESCRY_DB_QUERY` lines into the protocol stream.
|
|
15
13
|
*
|
|
16
|
-
* So:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* one file over.
|
|
14
|
+
* So: emitter and parser both import the vocabulary, neither imports the
|
|
15
|
+
* other. Anything added here must stay a constant or type -- a
|
|
16
|
+
* module-scope-effect function would rebuild the same trap.
|
|
20
17
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* scraping prose measures the prose.
|
|
18
|
+
* Prefix convention: the benchmark harness's `BENCH_RESULT {json}` (RT-072)
|
|
19
|
+
* -- one line of structured JSON, never prose.
|
|
24
20
|
*/
|
|
25
21
|
export declare const QUERY_MARKER = "DESCRY_DB_QUERY";
|
|
26
22
|
export type CapturedMethod = "exec" | "prepare" | "run" | "get" | "all";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-marker.d.ts","sourceRoot":"","sources":["../src/query-marker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query-marker.d.ts","sourceRoot":"","sources":["../src/query-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,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"}
|
package/dist/query-marker.js
CHANGED
|
@@ -2,29 +2,24 @@
|
|
|
2
2
|
* The wire vocabulary shared by the two halves of database observation: the
|
|
3
3
|
* marker prefix and the shape that follows it.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* whose stdout is a JSON-RPC transport — one `analyze` call put 14,906
|
|
14
|
-
* `DESCRY_DB_QUERY` lines into the protocol stream.
|
|
5
|
+
* Exists to be free of side effects -- that's its entire job.
|
|
6
|
+
* `sqlite-instrumentation.ts` patches `DatabaseSync.prototype` at module
|
|
7
|
+
* scope and writes to stdout, right for a `--import` preload in an
|
|
8
|
+
* observed process, wrong everywhere else. Importing just the string
|
|
9
|
+
* `"DESCRY_DB_QUERY"` from it still imports the module -- the patch and
|
|
10
|
+
* stdout writer came along through the package index into every consumer,
|
|
11
|
+
* reaching `@descryy/mcp`, whose stdout is a JSON-RPC transport: one
|
|
12
|
+
* `analyze` call put 14,906 `DESCRY_DB_QUERY` lines into the protocol stream.
|
|
15
13
|
*
|
|
16
|
-
* So:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* one file over.
|
|
14
|
+
* So: emitter and parser both import the vocabulary, neither imports the
|
|
15
|
+
* other. Anything added here must stay a constant or type -- a
|
|
16
|
+
* module-scope-effect function would rebuild the same trap.
|
|
20
17
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* scraping prose measures the prose.
|
|
18
|
+
* Prefix convention: the benchmark harness's `BENCH_RESULT {json}` (RT-072)
|
|
19
|
+
* -- one line of structured JSON, never prose.
|
|
24
20
|
*/
|
|
25
21
|
import { RESERVED_MARKER_PREFIX } from "@descryy/runtime-contracts";
|
|
26
|
-
// Derived, not spelled again
|
|
27
|
-
//
|
|
28
|
-
// come back as the application's own log output.
|
|
22
|
+
// Derived, not spelled again -- RESERVED_MARKER_PREFIX is what the backend
|
|
23
|
+
// log collector skips on; a marker without it reads as application output.
|
|
29
24
|
export const QUERY_MARKER = `${RESERVED_MARKER_PREFIX}DB_QUERY`;
|
|
30
25
|
//# sourceMappingURL=query-marker.js.map
|
package/dist/query-marker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-marker.js","sourceRoot":"","sources":["../src/query-marker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"query-marker.js","sourceRoot":"","sources":["../src/query-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,2EAA2E;AAC3E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,sBAAsB,UAAU,CAAC"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `--import`-loaded preload: patches `node:sqlite`'s `DatabaseSync`
|
|
3
|
-
* prototype before the target application's
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* application's completely separate `import` of the same built-in later
|
|
9
|
-
* see the same prototype object.
|
|
3
|
+
* prototype before the target application's code runs, so every real query
|
|
4
|
+
* through the app's own `import { DatabaseSync } from "node:sqlite"` is
|
|
5
|
+
* observed -- verified directly (probe script): Node's built-in modules
|
|
6
|
+
* are a process-wide singleton, so a `--import` preload and the app's own
|
|
7
|
+
* later import see the same prototype object.
|
|
10
8
|
*
|
|
11
|
-
* Deliberately minimal and import-free, like `test-runner`'s
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* table, correlation ids) happens on the collector side, in the observing
|
|
16
|
-
* process, not here — this only captures.
|
|
9
|
+
* Deliberately minimal and import-free, like `test-runner`'s `reporter.ts`
|
|
10
|
+
* -- runs inside the OBSERVED process, loaded by absolute path via
|
|
11
|
+
* `node --import`, never through this package's normal dependency graph.
|
|
12
|
+
* Interpretation happens on the collector side; this only captures.
|
|
17
13
|
*
|
|
18
|
-
* One line of structured JSON per query,
|
|
19
|
-
*
|
|
20
|
-
* scraping prose measures the prose, so nothing here is prose.
|
|
14
|
+
* One line of structured JSON per query, same convention as the benchmark
|
|
15
|
+
* harness's `BENCH_RESULT {json}` (RT-072).
|
|
21
16
|
*/
|
|
22
17
|
export {};
|
|
23
18
|
//# 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
|
|
1
|
+
{"version":3,"file":"sqlite-instrumentation.d.ts","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `--import`-loaded preload: patches `node:sqlite`'s `DatabaseSync`
|
|
3
|
-
* prototype before the target application's
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* application's completely separate `import` of the same built-in later
|
|
9
|
-
* see the same prototype object.
|
|
3
|
+
* prototype before the target application's code runs, so every real query
|
|
4
|
+
* through the app's own `import { DatabaseSync } from "node:sqlite"` is
|
|
5
|
+
* observed -- verified directly (probe script): Node's built-in modules
|
|
6
|
+
* are a process-wide singleton, so a `--import` preload and the app's own
|
|
7
|
+
* later import see the same prototype object.
|
|
10
8
|
*
|
|
11
|
-
* Deliberately minimal and import-free, like `test-runner`'s
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* table, correlation ids) happens on the collector side, in the observing
|
|
16
|
-
* process, not here — this only captures.
|
|
9
|
+
* Deliberately minimal and import-free, like `test-runner`'s `reporter.ts`
|
|
10
|
+
* -- runs inside the OBSERVED process, loaded by absolute path via
|
|
11
|
+
* `node --import`, never through this package's normal dependency graph.
|
|
12
|
+
* Interpretation happens on the collector side; this only captures.
|
|
17
13
|
*
|
|
18
|
-
* One line of structured JSON per query,
|
|
19
|
-
*
|
|
20
|
-
* scraping prose measures the prose, so nothing here is prose.
|
|
14
|
+
* One line of structured JSON per query, same convention as the benchmark
|
|
15
|
+
* harness's `BENCH_RESULT {json}` (RT-072).
|
|
21
16
|
*/
|
|
22
17
|
import { DatabaseSync } from "node:sqlite";
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// See `query-marker.ts` for the measurement.
|
|
18
|
+
// query-marker.ts has no side effects; direction matters -- this file
|
|
19
|
+
// imports it, nothing imports this file. Importing QUERY_MARKER alone from
|
|
20
|
+
// here once dragged the prototype patch and stdout writer into a JSON-RPC
|
|
21
|
+
// transport. See query-marker.ts for the measurement.
|
|
28
22
|
import { QUERY_MARKER } from "./query-marker.js";
|
|
29
23
|
function emit(query) {
|
|
30
24
|
process.stdout.write(`${QUERY_MARKER} ${JSON.stringify(query)}\n`);
|
|
@@ -63,10 +57,9 @@ if (target[PATCHED] !== true) {
|
|
|
63
57
|
return timed(sql, method, () => original.apply(stmt, args));
|
|
64
58
|
};
|
|
65
59
|
}
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// name. Disclosed here rather than measured wrong.
|
|
60
|
+
// iterate() deliberately unwrapped: it returns a lazy generator, so
|
|
61
|
+
// "duration" would measure building the iterator, not consuming it --
|
|
62
|
+
// disclosed rather than measured wrong.
|
|
70
63
|
return stmt;
|
|
71
64
|
};
|
|
72
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-instrumentation.js","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sqlite-instrumentation.js","sourceRoot":"","sources":["../src/sqlite-instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,sDAAsD;AACtD,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,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AAK,MAAM,MAAM,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,EAAE,CAAC;YACpD,MAAM,QAAQ,GAAG,UAAU,CAAC,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,oEAAoE;QACpE,sEAAsE;QACtE,wCAAwC;QACxC,OAAO,IAAI,CAAC;IACd,CAA0C,CAAC;AAC7C,CAAC"}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extracts the single target table a DML statement names — deliberately
|
|
3
|
-
* not a SQL parser, same reasoning `adapter-sql`'s `parse.ts` gives for
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* not a SQL parser, same reasoning `adapter-sql`'s `parse.ts` gives for its
|
|
4
|
+
* own DDL-only scope: a bounded reader that recognises a few shapes and
|
|
5
|
+
* refuses (`null`) on the rest is honest; guessing at a JOIN or subquery
|
|
6
|
+
* isn't.
|
|
7
7
|
*
|
|
8
|
-
* `adapter-sql`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* `adapter-sql` reads CREATE/ALTER (schema declaration); this reads
|
|
9
|
+
* INSERT/UPDATE/DELETE/SELECT (which table a query touched at RUNTIME) --
|
|
10
|
+
* a different question, its own small reader rather than a false shared
|
|
11
|
+
* abstraction.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* shape of at all. The wrong-table negative control this package's tests
|
|
18
|
-
* assert on is exactly this: a two-table JOIN must resolve to `null`, not
|
|
19
|
-
* to either table picked arbitrarily.
|
|
13
|
+
* Refused, not guessed: a JOIN anywhere, a comma-separated FROM list
|
|
14
|
+
* (old-style implicit join), a subquery in FROM, a CTE, or an unrecognised
|
|
15
|
+
* shape. Tested negative control: a two-table JOIN must resolve to `null`,
|
|
16
|
+
* not either table picked arbitrarily.
|
|
20
17
|
*/
|
|
21
18
|
/**
|
|
22
19
|
* `null` for anything not recognised as exactly one of INSERT/UPDATE/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-extraction.d.ts","sourceRoot":"","sources":["../src/table-extraction.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"table-extraction.d.ts","sourceRoot":"","sources":["../src/table-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA8BH;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB7D"}
|
package/dist/table-extraction.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extracts the single target table a DML statement names — deliberately
|
|
3
|
-
* not a SQL parser, same reasoning `adapter-sql`'s `parse.ts` gives for
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* not a SQL parser, same reasoning `adapter-sql`'s `parse.ts` gives for its
|
|
4
|
+
* own DDL-only scope: a bounded reader that recognises a few shapes and
|
|
5
|
+
* refuses (`null`) on the rest is honest; guessing at a JOIN or subquery
|
|
6
|
+
* isn't.
|
|
7
7
|
*
|
|
8
|
-
* `adapter-sql`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* `adapter-sql` reads CREATE/ALTER (schema declaration); this reads
|
|
9
|
+
* INSERT/UPDATE/DELETE/SELECT (which table a query touched at RUNTIME) --
|
|
10
|
+
* a different question, its own small reader rather than a false shared
|
|
11
|
+
* abstraction.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* shape of at all. The wrong-table negative control this package's tests
|
|
18
|
-
* assert on is exactly this: a two-table JOIN must resolve to `null`, not
|
|
19
|
-
* to either table picked arbitrarily.
|
|
13
|
+
* Refused, not guessed: a JOIN anywhere, a comma-separated FROM list
|
|
14
|
+
* (old-style implicit join), a subquery in FROM, a CTE, or an unrecognised
|
|
15
|
+
* shape. Tested negative control: a two-table JOIN must resolve to `null`,
|
|
16
|
+
* not either table picked arbitrarily.
|
|
20
17
|
*/
|
|
21
18
|
const IDENTIFIER = String.raw `(?:\[[^\]]+\]|"[^"]+"|` + "`[^`]+`" + String.raw `|[A-Za-z_][A-Za-z0-9_]*)`;
|
|
22
19
|
const QUALIFIED = `${IDENTIFIER}(?:\\.${IDENTIFIER})?`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-extraction.js","sourceRoot":"","sources":["../src/table-extraction.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"table-extraction.js","sourceRoot":"","sources":["../src/table-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA,wBAAwB,GAAG,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA,0BAA0B,CAAC;AACzG,MAAM,SAAS,GAAG,GAAG,UAAU,SAAS,UAAU,IAAI,CAAC;AAEvD,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,2BAA2B,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,mBAAmB,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC;AAChE,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,2BAA2B,SAAS,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7E,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,eAAe,SAAS,GAAG,EAAE,GAAG,CAA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AC,OAAO,CAAC,CAAC;IACtC,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QACpF,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descryy/runtime-database-observation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Database query observation (plan \u00a718, checklist \u00a714): real DATABASE_QUERY capture via driver instrumentation, never parsed application logs. Driver #1 is node:sqlite.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/descryhq-wq/descry-runtime.git",
|
|
10
|
+
"directory": "packages/database-observation"
|
|
11
|
+
},
|
|
7
12
|
"engines": {
|
|
8
13
|
"node": ">=22.5"
|
|
9
14
|
},
|
|
@@ -24,9 +29,9 @@
|
|
|
24
29
|
"build": "tsc -b"
|
|
25
30
|
},
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@descryy/runtime-contracts": "0.
|
|
28
|
-
"@descryy/runtime-backend-observation": "0.
|
|
29
|
-
"@descryy/runtime-graph-correlator": "0.
|
|
32
|
+
"@descryy/runtime-contracts": "0.3.0",
|
|
33
|
+
"@descryy/runtime-backend-observation": "0.3.0",
|
|
34
|
+
"@descryy/runtime-graph-correlator": "0.4.0"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
37
|
"@descryy/runtime-controller": "*",
|