@neat.is/types 0.6.3 → 0.7.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/index.cjs +111 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1051 -267
- package/dist/index.d.ts +1051 -267
- package/dist/index.js +103 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -53,6 +53,7 @@ __export(index_exports, {
|
|
|
53
53
|
EdgeType: () => EdgeType,
|
|
54
54
|
EdgeTypeSchema: () => EdgeTypeSchema,
|
|
55
55
|
ErrorEventSchema: () => ErrorEventSchema,
|
|
56
|
+
ExtractionCoverageSchema: () => ExtractionCoverageSchema,
|
|
56
57
|
FileNodeSchema: () => FileNodeSchema,
|
|
57
58
|
FrontierNodeSchema: () => FrontierNodeSchema,
|
|
58
59
|
GraphDiffResultSchema: () => GraphDiffResultSchema,
|
|
@@ -86,6 +87,8 @@ __export(index_exports, {
|
|
|
86
87
|
PolicySchema: () => PolicySchema,
|
|
87
88
|
PolicySeveritySchema: () => PolicySeveritySchema,
|
|
88
89
|
PolicyViolationSchema: () => PolicyViolationSchema,
|
|
90
|
+
ProjectListEntrySchema: () => ProjectListEntrySchema,
|
|
91
|
+
ProjectServedBySchema: () => ProjectServedBySchema,
|
|
89
92
|
Provenance: () => Provenance,
|
|
90
93
|
ProvenanceRuleSchema: () => ProvenanceRuleSchema,
|
|
91
94
|
ProvenanceSchema: () => ProvenanceSchema,
|
|
@@ -103,6 +106,9 @@ __export(index_exports, {
|
|
|
103
106
|
StaleEventSchema: () => StaleEventSchema,
|
|
104
107
|
StaleEventsResponseSchema: () => StaleEventsResponseSchema,
|
|
105
108
|
StructuralRuleSchema: () => StructuralRuleSchema,
|
|
109
|
+
SymbolKindSchema: () => SymbolKindSchema,
|
|
110
|
+
SymbolNodeSchema: () => SymbolNodeSchema,
|
|
111
|
+
SymbolSpanSchema: () => SymbolSpanSchema,
|
|
106
112
|
TransitiveDependenciesResultSchema: () => TransitiveDependenciesResultSchema,
|
|
107
113
|
TransitiveDependencySchema: () => TransitiveDependencySchema,
|
|
108
114
|
VersionMismatchDivergenceSchema: () => VersionMismatchDivergenceSchema,
|
|
@@ -131,10 +137,12 @@ __export(index_exports, {
|
|
|
131
137
|
parseInfraId: () => parseInfraId,
|
|
132
138
|
parseRouteId: () => parseRouteId,
|
|
133
139
|
parseServiceId: () => parseServiceId,
|
|
140
|
+
parseSymbolId: () => parseSymbolId,
|
|
134
141
|
parseWebsocketChannelId: () => parseWebsocketChannelId,
|
|
135
142
|
passesExtractedFloor: () => passesExtractedFloor,
|
|
136
143
|
routeId: () => routeId,
|
|
137
144
|
serviceId: () => serviceId,
|
|
145
|
+
symbolId: () => symbolId,
|
|
138
146
|
websocketChannelId: () => websocketChannelId
|
|
139
147
|
});
|
|
140
148
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -163,7 +171,16 @@ var EdgeType = {
|
|
|
163
171
|
// Static module dependency between two FileNodes within a service (ADR-092,
|
|
164
172
|
// file-awareness.md §10). Compile-time, not runtime — represents one file
|
|
165
173
|
// importing another. Distinct from CALLS which records runtime invocations.
|
|
166
|
-
IMPORTS: "IMPORTS"
|
|
174
|
+
IMPORTS: "IMPORTS",
|
|
175
|
+
// Static heritage between two SymbolNodes (ADR-158 §3). `INHERITS` records a
|
|
176
|
+
// class's `extends` clause (`class ──INHERITS──▶ superclass`); `IMPLEMENTS`
|
|
177
|
+
// records an `implements` clause (`class ──IMPLEMENTS──▶ implemented`). Both
|
|
178
|
+
// are symbol→symbol, EXTRACTED, minted only when the parent name resolves to
|
|
179
|
+
// exactly one known SymbolNode — same-file or through the import graph — never
|
|
180
|
+
// fuzzy-matched. A parent that resolves to nothing (external package,
|
|
181
|
+
// re-export chain, an interface, which is not a SymbolNode) emits no edge.
|
|
182
|
+
INHERITS: "INHERITS",
|
|
183
|
+
IMPLEMENTS: "IMPLEMENTS"
|
|
167
184
|
};
|
|
168
185
|
var NodeType = {
|
|
169
186
|
ServiceNode: "ServiceNode",
|
|
@@ -213,7 +230,18 @@ var NodeType = {
|
|
|
213
230
|
// edge that carries `lastObserved` and decays OBSERVED → STALE on CONNECTS_TO's
|
|
214
231
|
// own staleness threshold when the channel goes quiet. See
|
|
215
232
|
// docs/contracts/otel-ingest.md.
|
|
216
|
-
WebSocketChannelNode: "WebSocketChannelNode"
|
|
233
|
+
WebSocketChannelNode: "WebSocketChannelNode",
|
|
234
|
+
// A symbol under a file — a function, method, constructor, or class
|
|
235
|
+
// definition — at definition-span granularity (ADR-158). Static-first: the
|
|
236
|
+
// extractor mints one per definition and the file owns it through a
|
|
237
|
+
// `file ──CONTAINS──▶ symbol` edge, one containment level below
|
|
238
|
+
// `service ──CONTAINS──▶ file`. It carries its `{ startLine, endLine }`
|
|
239
|
+
// definition span, which is the fusion key ingest joins a span's `code.line`
|
|
240
|
+
// against to land an OBSERVED edge on the calling symbol rather than only its
|
|
241
|
+
// file (observed-first edges, one grain finer than §4 file grain). The node is
|
|
242
|
+
// language-neutral; the per-language tree-sitter extractor is the adapter. See
|
|
243
|
+
// docs/contracts/static-extraction.md and docs/contracts/file-awareness.md §1.
|
|
244
|
+
SymbolNode: "SymbolNode"
|
|
217
245
|
};
|
|
218
246
|
var NodeTypeSchema = import_zod.z.enum([
|
|
219
247
|
NodeType.ServiceNode,
|
|
@@ -225,7 +253,8 @@ var NodeTypeSchema = import_zod.z.enum([
|
|
|
225
253
|
NodeType.RouteNode,
|
|
226
254
|
NodeType.GraphQLOperationNode,
|
|
227
255
|
NodeType.GrpcMethodNode,
|
|
228
|
-
NodeType.WebSocketChannelNode
|
|
256
|
+
NodeType.WebSocketChannelNode,
|
|
257
|
+
NodeType.SymbolNode
|
|
229
258
|
]);
|
|
230
259
|
|
|
231
260
|
// src/nodes.ts
|
|
@@ -416,6 +445,21 @@ var WebSocketChannelNodeSchema = import_zod2.z.object({
|
|
|
416
445
|
line: import_zod2.z.number().int().nonnegative().optional(),
|
|
417
446
|
discoveredVia: DiscoveredViaSchema.optional()
|
|
418
447
|
});
|
|
448
|
+
var SymbolKindSchema = import_zod2.z.enum(["function", "method", "constructor", "class"]);
|
|
449
|
+
var SymbolSpanSchema = import_zod2.z.object({
|
|
450
|
+
startLine: import_zod2.z.number().int().nonnegative(),
|
|
451
|
+
endLine: import_zod2.z.number().int().nonnegative()
|
|
452
|
+
});
|
|
453
|
+
var SymbolNodeSchema = import_zod2.z.object({
|
|
454
|
+
id: import_zod2.z.string(),
|
|
455
|
+
type: import_zod2.z.literal(NodeType.SymbolNode),
|
|
456
|
+
kind: SymbolKindSchema,
|
|
457
|
+
qualname: import_zod2.z.string(),
|
|
458
|
+
span: SymbolSpanSchema,
|
|
459
|
+
service: import_zod2.z.string(),
|
|
460
|
+
relPath: import_zod2.z.string(),
|
|
461
|
+
discoveredVia: DiscoveredViaSchema.optional()
|
|
462
|
+
});
|
|
419
463
|
var GraphNodeSchema = import_zod2.z.discriminatedUnion("type", [
|
|
420
464
|
ServiceNodeSchema,
|
|
421
465
|
DatabaseNodeSchema,
|
|
@@ -426,7 +470,8 @@ var GraphNodeSchema = import_zod2.z.discriminatedUnion("type", [
|
|
|
426
470
|
RouteNodeSchema,
|
|
427
471
|
GraphQLOperationNodeSchema,
|
|
428
472
|
GrpcMethodNodeSchema,
|
|
429
|
-
WebSocketChannelNodeSchema
|
|
473
|
+
WebSocketChannelNodeSchema,
|
|
474
|
+
SymbolNodeSchema
|
|
430
475
|
]);
|
|
431
476
|
|
|
432
477
|
// src/edges.ts
|
|
@@ -446,7 +491,9 @@ var EdgeTypeSchema = import_zod3.z.enum([
|
|
|
446
491
|
EdgeType.CONSUMES_FROM,
|
|
447
492
|
EdgeType.RUNS_ON,
|
|
448
493
|
EdgeType.CONTAINS,
|
|
449
|
-
EdgeType.IMPORTS
|
|
494
|
+
EdgeType.IMPORTS,
|
|
495
|
+
EdgeType.INHERITS,
|
|
496
|
+
EdgeType.IMPLEMENTS
|
|
450
497
|
]);
|
|
451
498
|
var EdgeEvidenceSchema = import_zod3.z.object({
|
|
452
499
|
file: import_zod3.z.string(),
|
|
@@ -634,6 +681,7 @@ var ROUTE_PREFIX = "route:";
|
|
|
634
681
|
var GRAPHQL_OP_PREFIX = "graphql:";
|
|
635
682
|
var GRPC_METHOD_PREFIX = "grpc:";
|
|
636
683
|
var WEBSOCKET_CHANNEL_PREFIX = "ws:";
|
|
684
|
+
var SYMBOL_PREFIX = "symbol:";
|
|
637
685
|
var ENV_UNKNOWN = "unknown";
|
|
638
686
|
function serviceId(name, env) {
|
|
639
687
|
if (env === void 0 || env === ENV_UNKNOWN) return `${SERVICE_PREFIX}${name}`;
|
|
@@ -753,6 +801,34 @@ function parseWebsocketChannelId(id) {
|
|
|
753
801
|
if (service.length === 0 || channel.length === 0) return null;
|
|
754
802
|
return { service, channel };
|
|
755
803
|
}
|
|
804
|
+
function symbolId(service, relPath, qualname, disambiguator) {
|
|
805
|
+
const base = `${SYMBOL_PREFIX}${service}:${relPath}#${qualname}`;
|
|
806
|
+
return disambiguator === void 0 ? base : `${base}~${disambiguator}`;
|
|
807
|
+
}
|
|
808
|
+
function parseSymbolId(id) {
|
|
809
|
+
if (!id.startsWith(SYMBOL_PREFIX)) return null;
|
|
810
|
+
const rest = id.slice(SYMBOL_PREFIX.length);
|
|
811
|
+
const colon = rest.indexOf(":");
|
|
812
|
+
if (colon === -1) return null;
|
|
813
|
+
const service = rest.slice(0, colon);
|
|
814
|
+
const tail = rest.slice(colon + 1);
|
|
815
|
+
const hash = tail.lastIndexOf("#");
|
|
816
|
+
if (hash === -1) return null;
|
|
817
|
+
const relPath = tail.slice(0, hash);
|
|
818
|
+
let qualname = tail.slice(hash + 1);
|
|
819
|
+
if (service.length === 0 || relPath.length === 0 || qualname.length === 0) return null;
|
|
820
|
+
let disambiguator;
|
|
821
|
+
const tilde = qualname.lastIndexOf("~");
|
|
822
|
+
if (tilde !== -1) {
|
|
823
|
+
const suffix = qualname.slice(tilde + 1);
|
|
824
|
+
if (suffix.length > 0 && /^\d+$/.test(suffix)) {
|
|
825
|
+
disambiguator = Number(suffix);
|
|
826
|
+
qualname = qualname.slice(0, tilde);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
if (qualname.length === 0) return null;
|
|
830
|
+
return { service, relPath, qualname, ...disambiguator !== void 0 ? { disambiguator } : {} };
|
|
831
|
+
}
|
|
756
832
|
var EDGE_ARROW = "->";
|
|
757
833
|
function extractedEdgeId(source, target, type) {
|
|
758
834
|
return `${type}:${source}${EDGE_ARROW}${target}`;
|
|
@@ -1078,10 +1154,19 @@ var GraphEdgesResponseSchema = import_zod9.z.object({
|
|
|
1078
1154
|
inbound: import_zod9.z.array(GraphEdgeSchema),
|
|
1079
1155
|
outbound: import_zod9.z.array(GraphEdgeSchema)
|
|
1080
1156
|
});
|
|
1157
|
+
var ExtractionCoverageSchema = import_zod9.z.object({
|
|
1158
|
+
skippedFiles: import_zod9.z.number().int().nonnegative(),
|
|
1159
|
+
byProducer: import_zod9.z.record(import_zod9.z.number().int().nonnegative()),
|
|
1160
|
+
// Up to a bounded sample of the files that failed to parse this pass.
|
|
1161
|
+
files: import_zod9.z.array(import_zod9.z.string()),
|
|
1162
|
+
updatedAt: import_zod9.z.string()
|
|
1163
|
+
});
|
|
1081
1164
|
var HealthResponseSchema = import_zod9.z.object({
|
|
1082
1165
|
ok: import_zod9.z.boolean(),
|
|
1083
1166
|
project: import_zod9.z.string(),
|
|
1084
|
-
uptimeMs: import_zod9.z.number().int().nonnegative()
|
|
1167
|
+
uptimeMs: import_zod9.z.number().int().nonnegative(),
|
|
1168
|
+
// Present when the most recent extraction pass recorded its coverage (#883).
|
|
1169
|
+
coverage: ExtractionCoverageSchema.optional()
|
|
1085
1170
|
}).passthrough();
|
|
1086
1171
|
var DaemonHealthResponseSchema = import_zod9.z.object({
|
|
1087
1172
|
ok: import_zod9.z.boolean(),
|
|
@@ -1094,8 +1179,19 @@ var DaemonHealthResponseSchema = import_zod9.z.object({
|
|
|
1094
1179
|
}).passthrough()
|
|
1095
1180
|
)
|
|
1096
1181
|
}).passthrough();
|
|
1182
|
+
var ProjectListEntrySchema = RegistryEntrySchema.extend({
|
|
1183
|
+
hostedHere: import_zod9.z.boolean()
|
|
1184
|
+
});
|
|
1185
|
+
var ProjectServedBySchema = import_zod9.z.object({
|
|
1186
|
+
path: import_zod9.z.string(),
|
|
1187
|
+
restPort: import_zod9.z.number().int(),
|
|
1188
|
+
live: import_zod9.z.boolean()
|
|
1189
|
+
});
|
|
1097
1190
|
var SingleProjectResponseSchema = import_zod9.z.object({
|
|
1098
|
-
project:
|
|
1191
|
+
project: ProjectListEntrySchema,
|
|
1192
|
+
// Present only when this daemon does not host the project but another daemon
|
|
1193
|
+
// on the machine does — names where it actually lives (#884).
|
|
1194
|
+
servedBy: ProjectServedBySchema.optional()
|
|
1099
1195
|
});
|
|
1100
1196
|
var ConnectorPollStateSchema = import_zod9.z.enum(["idle", "healthy", "error", "stale"]);
|
|
1101
1197
|
var ConnectorStatusSchema = import_zod9.z.object({
|
|
@@ -1243,6 +1339,7 @@ function passesExtractedFloor(confidence) {
|
|
|
1243
1339
|
EdgeType,
|
|
1244
1340
|
EdgeTypeSchema,
|
|
1245
1341
|
ErrorEventSchema,
|
|
1342
|
+
ExtractionCoverageSchema,
|
|
1246
1343
|
FileNodeSchema,
|
|
1247
1344
|
FrontierNodeSchema,
|
|
1248
1345
|
GraphDiffResultSchema,
|
|
@@ -1276,6 +1373,8 @@ function passesExtractedFloor(confidence) {
|
|
|
1276
1373
|
PolicySchema,
|
|
1277
1374
|
PolicySeveritySchema,
|
|
1278
1375
|
PolicyViolationSchema,
|
|
1376
|
+
ProjectListEntrySchema,
|
|
1377
|
+
ProjectServedBySchema,
|
|
1279
1378
|
Provenance,
|
|
1280
1379
|
ProvenanceRuleSchema,
|
|
1281
1380
|
ProvenanceSchema,
|
|
@@ -1293,6 +1392,9 @@ function passesExtractedFloor(confidence) {
|
|
|
1293
1392
|
StaleEventSchema,
|
|
1294
1393
|
StaleEventsResponseSchema,
|
|
1295
1394
|
StructuralRuleSchema,
|
|
1395
|
+
SymbolKindSchema,
|
|
1396
|
+
SymbolNodeSchema,
|
|
1397
|
+
SymbolSpanSchema,
|
|
1296
1398
|
TransitiveDependenciesResultSchema,
|
|
1297
1399
|
TransitiveDependencySchema,
|
|
1298
1400
|
VersionMismatchDivergenceSchema,
|
|
@@ -1321,10 +1423,12 @@ function passesExtractedFloor(confidence) {
|
|
|
1321
1423
|
parseInfraId,
|
|
1322
1424
|
parseRouteId,
|
|
1323
1425
|
parseServiceId,
|
|
1426
|
+
parseSymbolId,
|
|
1324
1427
|
parseWebsocketChannelId,
|
|
1325
1428
|
passesExtractedFloor,
|
|
1326
1429
|
routeId,
|
|
1327
1430
|
serviceId,
|
|
1431
|
+
symbolId,
|
|
1328
1432
|
websocketChannelId
|
|
1329
1433
|
});
|
|
1330
1434
|
//# sourceMappingURL=index.cjs.map
|