@neat.is/types 0.4.26-dev.20260702 → 0.4.26

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 CHANGED
@@ -53,6 +53,8 @@ __export(index_exports, {
53
53
  GraphEdgesResponseSchema: () => GraphEdgesResponseSchema,
54
54
  GraphNodeResponseSchema: () => GraphNodeResponseSchema,
55
55
  GraphNodeSchema: () => GraphNodeSchema,
56
+ GraphQLOperationNodeSchema: () => GraphQLOperationNodeSchema,
57
+ GrpcMethodNodeSchema: () => GrpcMethodNodeSchema,
56
58
  HealthResponseSchema: () => HealthResponseSchema,
57
59
  HostMismatchDivergenceSchema: () => HostMismatchDivergenceSchema,
58
60
  HypotheticalActionSchema: () => HypotheticalActionSchema,
@@ -81,6 +83,7 @@ __export(index_exports, {
81
83
  RegistryFileSchema: () => RegistryFileSchema,
82
84
  RegistryStatusSchema: () => RegistryStatusSchema,
83
85
  RootCauseResultSchema: () => RootCauseResultSchema,
86
+ RouteNodeSchema: () => RouteNodeSchema,
84
87
  SearchMatchSchema: () => SearchMatchSchema,
85
88
  SearchResponseSchema: () => SearchResponseSchema,
86
89
  SerializedGraphSchema: () => SerializedGraphSchema,
@@ -93,6 +96,7 @@ __export(index_exports, {
93
96
  TransitiveDependenciesResultSchema: () => TransitiveDependenciesResultSchema,
94
97
  TransitiveDependencySchema: () => TransitiveDependencySchema,
95
98
  VersionMismatchDivergenceSchema: () => VersionMismatchDivergenceSchema,
99
+ WebSocketChannelNodeSchema: () => WebSocketChannelNodeSchema,
96
100
  confidenceForExtracted: () => confidenceForExtracted,
97
101
  confidenceForObservedSignal: () => confidenceForObservedSignal,
98
102
  configId: () => configId,
@@ -101,18 +105,27 @@ __export(index_exports, {
101
105
  extractedPrecisionFloor: () => extractedPrecisionFloor,
102
106
  fileId: () => fileId,
103
107
  frontierId: () => frontierId,
108
+ graphqlOperationId: () => graphqlOperationId,
109
+ grpcMethodId: () => grpcMethodId,
104
110
  inferredEdgeId: () => inferredEdgeId,
105
111
  infraId: () => infraId,
112
+ localDatabaseId: () => localDatabaseId,
106
113
  observedEdgeId: () => observedEdgeId,
107
114
  parseConfigId: () => parseConfigId,
108
115
  parseDatabaseId: () => parseDatabaseId,
109
116
  parseEdgeId: () => parseEdgeId,
110
117
  parseFileId: () => parseFileId,
111
118
  parseFrontierId: () => parseFrontierId,
119
+ parseGraphqlOperationId: () => parseGraphqlOperationId,
120
+ parseGrpcMethodId: () => parseGrpcMethodId,
112
121
  parseInfraId: () => parseInfraId,
122
+ parseRouteId: () => parseRouteId,
113
123
  parseServiceId: () => parseServiceId,
124
+ parseWebsocketChannelId: () => parseWebsocketChannelId,
114
125
  passesExtractedFloor: () => passesExtractedFloor,
115
- serviceId: () => serviceId
126
+ routeId: () => routeId,
127
+ serviceId: () => serviceId,
128
+ websocketChannelId: () => websocketChannelId
116
129
  });
117
130
  module.exports = __toCommonJS(index_exports);
118
131
 
@@ -151,7 +164,46 @@ var NodeType = {
151
164
  // The primary node of the file-first graph (ADR-089). A source file owned
152
165
  // by a service; relationships originate from it. See
153
166
  // docs/contracts/file-awareness.md §1.
154
- FileNode: "FileNode"
167
+ FileNode: "FileNode",
168
+ // A server route at (method, path-template) granularity (ADR-119). Extracted
169
+ // from a mainstream router (Express / Fastify / Next.js) so a client call
170
+ // site can be matched to the exact route it names, rather than only to the
171
+ // owning service. The node an OBSERVED server span lands on too, which is
172
+ // what makes a two-sided divergence possible at route grain. See
173
+ // docs/contracts/static-extraction.md.
174
+ RouteNode: "RouteNode",
175
+ // A named GraphQL operation — one query, mutation, or subscription — at
176
+ // (service, operationType, operationName) granularity (ADR-122). Every
177
+ // GraphQL request rides one HTTP endpoint (POST /graphql), so at HTTP grain
178
+ // the whole API collapses to a single edge; this node recovers the
179
+ // operation-level topology from the execution span's `graphql.operation.*`
180
+ // semconv. Minted observed-first from OTel; a future static GraphQL extractor
181
+ // fuses onto the same id. See docs/contracts/otel-ingest.md.
182
+ GraphQLOperationNode: "GraphQLOperationNode",
183
+ // A single gRPC method — one `rpc` in a `.proto` service — at
184
+ // (rpcService, rpcMethod) granularity (ADR-123). gRPC used to engage only at
185
+ // service grain: every method collapsed onto one service→service edge, so the
186
+ // per-method topology was invisible and one-sided. This node recovers the
187
+ // method-level shape from both sides: the OBSERVED execution span's
188
+ // `rpc.service` / `rpc.method` semconv and the static `.proto` service/method
189
+ // definitions. It keys on the fully-qualified `rpc.service` — the wire
190
+ // contract both sides carry verbatim — so a declared method and an observed
191
+ // one fuse onto the same node into a two-sided divergence. See
192
+ // docs/contracts/otel-ingest.md and docs/contracts/static-extraction.md.
193
+ GrpcMethodNode: "GrpcMethodNode",
194
+ // A live WebSocket channel — the path/channel a client connects to — at
195
+ // (service, channel) granularity (ADR-125). A WebSocket app used to produce no
196
+ // OBSERVED topology at all: only message-handler errors surfaced, as incidents,
197
+ // and the channels themselves stayed invisible. This node recovers the
198
+ // channel-level topology from the HTTP upgrade span that opens the connection —
199
+ // a SERVER `GET` carrying the WebSocket path. It is minted OBSERVED-only: a
200
+ // WebSocket channel is known from observation, never from static extraction, so
201
+ // there is no declared twin to fuse with. The edge onto it reuses the existing
202
+ // `CONNECTS_TO` (`service ──CONNECTS_TO──▶ ws-channel`) as an observed-liveness
203
+ // edge that carries `lastObserved` and decays OBSERVED → STALE on CONNECTS_TO's
204
+ // own staleness threshold when the channel goes quiet. See
205
+ // docs/contracts/otel-ingest.md.
206
+ WebSocketChannelNode: "WebSocketChannelNode"
155
207
  };
156
208
  var NodeTypeSchema = import_zod.z.enum([
157
209
  NodeType.ServiceNode,
@@ -159,7 +211,11 @@ var NodeTypeSchema = import_zod.z.enum([
159
211
  NodeType.ConfigNode,
160
212
  NodeType.InfraNode,
161
213
  NodeType.FrontierNode,
162
- NodeType.FileNode
214
+ NodeType.FileNode,
215
+ NodeType.RouteNode,
216
+ NodeType.GraphQLOperationNode,
217
+ NodeType.GrpcMethodNode,
218
+ NodeType.WebSocketChannelNode
163
219
  ]);
164
220
 
165
221
  // src/nodes.ts
@@ -289,13 +345,60 @@ var FileNodeSchema = import_zod2.z.object({
289
345
  // Absent when the call site was already source-grained.
290
346
  originalPath: import_zod2.z.string().optional()
291
347
  });
348
+ var RouteNodeSchema = import_zod2.z.object({
349
+ id: import_zod2.z.string(),
350
+ type: import_zod2.z.literal(NodeType.RouteNode),
351
+ name: import_zod2.z.string(),
352
+ service: import_zod2.z.string(),
353
+ method: import_zod2.z.string(),
354
+ pathTemplate: import_zod2.z.string(),
355
+ path: import_zod2.z.string(),
356
+ line: import_zod2.z.number().int().nonnegative().optional(),
357
+ framework: import_zod2.z.string().optional(),
358
+ discoveredVia: DiscoveredViaSchema.optional()
359
+ });
360
+ var GraphQLOperationNodeSchema = import_zod2.z.object({
361
+ id: import_zod2.z.string(),
362
+ type: import_zod2.z.literal(NodeType.GraphQLOperationNode),
363
+ name: import_zod2.z.string(),
364
+ service: import_zod2.z.string(),
365
+ operationType: import_zod2.z.string(),
366
+ operationName: import_zod2.z.string(),
367
+ path: import_zod2.z.string().optional(),
368
+ line: import_zod2.z.number().int().nonnegative().optional(),
369
+ discoveredVia: DiscoveredViaSchema.optional()
370
+ });
371
+ var GrpcMethodNodeSchema = import_zod2.z.object({
372
+ id: import_zod2.z.string(),
373
+ type: import_zod2.z.literal(NodeType.GrpcMethodNode),
374
+ name: import_zod2.z.string(),
375
+ rpcService: import_zod2.z.string(),
376
+ rpcMethod: import_zod2.z.string(),
377
+ path: import_zod2.z.string().optional(),
378
+ line: import_zod2.z.number().int().nonnegative().optional(),
379
+ discoveredVia: DiscoveredViaSchema.optional()
380
+ });
381
+ var WebSocketChannelNodeSchema = import_zod2.z.object({
382
+ id: import_zod2.z.string(),
383
+ type: import_zod2.z.literal(NodeType.WebSocketChannelNode),
384
+ name: import_zod2.z.string(),
385
+ service: import_zod2.z.string(),
386
+ channel: import_zod2.z.string(),
387
+ path: import_zod2.z.string().optional(),
388
+ line: import_zod2.z.number().int().nonnegative().optional(),
389
+ discoveredVia: DiscoveredViaSchema.optional()
390
+ });
292
391
  var GraphNodeSchema = import_zod2.z.discriminatedUnion("type", [
293
392
  ServiceNodeSchema,
294
393
  DatabaseNodeSchema,
295
394
  ConfigNodeSchema,
296
395
  InfraNodeSchema,
297
396
  FrontierNodeSchema,
298
- FileNodeSchema
397
+ FileNodeSchema,
398
+ RouteNodeSchema,
399
+ GraphQLOperationNodeSchema,
400
+ GrpcMethodNodeSchema,
401
+ WebSocketChannelNodeSchema
299
402
  ]);
300
403
 
301
404
  // src/edges.ts
@@ -320,7 +423,13 @@ var EdgeTypeSchema = import_zod3.z.enum([
320
423
  var EdgeEvidenceSchema = import_zod3.z.object({
321
424
  file: import_zod3.z.string(),
322
425
  line: import_zod3.z.number().int().nonnegative().optional(),
323
- snippet: import_zod3.z.string().optional()
426
+ snippet: import_zod3.z.string().optional(),
427
+ // HTTP shape of a recognised client call site (ADR-119). Present on a
428
+ // client↔route CALLS edge so the edge records the method + path-template the
429
+ // client named, alongside the file:line it named them at. Absent on every
430
+ // other edge — a config or infra edge has no HTTP method.
431
+ method: import_zod3.z.string().optional(),
432
+ pathTemplate: import_zod3.z.string().optional()
324
433
  });
325
434
  var EdgeSignalSchema = import_zod3.z.object({
326
435
  spanCount: import_zod3.z.number().int().nonnegative(),
@@ -461,6 +570,10 @@ var CONFIG_PREFIX = "config:";
461
570
  var INFRA_PREFIX = "infra:";
462
571
  var FRONTIER_PREFIX = "frontier:";
463
572
  var FILE_PREFIX = "file:";
573
+ var ROUTE_PREFIX = "route:";
574
+ var GRAPHQL_OP_PREFIX = "graphql:";
575
+ var GRPC_METHOD_PREFIX = "grpc:";
576
+ var WEBSOCKET_CHANNEL_PREFIX = "ws:";
464
577
  var ENV_UNKNOWN = "unknown";
465
578
  function serviceId(name, env) {
466
579
  if (env === void 0 || env === ENV_UNKNOWN) return `${SERVICE_PREFIX}${name}`;
@@ -480,6 +593,9 @@ function databaseId(host) {
480
593
  function parseDatabaseId(id) {
481
594
  return id.startsWith(DATABASE_PREFIX) ? id.slice(DATABASE_PREFIX.length) : null;
482
595
  }
596
+ function localDatabaseId(service, name) {
597
+ return `${DATABASE_PREFIX}${service}/${name}`;
598
+ }
483
599
  function configId(relPath) {
484
600
  return `${CONFIG_PREFIX}${relPath}`;
485
601
  }
@@ -515,6 +631,68 @@ function parseFileId(id) {
515
631
  if (service.length === 0 || relPath.length === 0) return null;
516
632
  return { service, relPath };
517
633
  }
634
+ function routeId(service, method, pathTemplate) {
635
+ return `${ROUTE_PREFIX}${service}:${method.toUpperCase()} ${pathTemplate}`;
636
+ }
637
+ function parseRouteId(id) {
638
+ if (!id.startsWith(ROUTE_PREFIX)) return null;
639
+ const rest = id.slice(ROUTE_PREFIX.length);
640
+ const colon = rest.indexOf(":");
641
+ if (colon === -1) return null;
642
+ const service = rest.slice(0, colon);
643
+ const tail = rest.slice(colon + 1);
644
+ const space = tail.indexOf(" ");
645
+ if (space === -1) return null;
646
+ const method = tail.slice(0, space);
647
+ const pathTemplate = tail.slice(space + 1);
648
+ if (service.length === 0 || method.length === 0 || pathTemplate.length === 0) return null;
649
+ return { service, method, pathTemplate };
650
+ }
651
+ function graphqlOperationId(service, operationType, operationName) {
652
+ return `${GRAPHQL_OP_PREFIX}${service}:${operationType.toLowerCase()} ${operationName}`;
653
+ }
654
+ function parseGraphqlOperationId(id) {
655
+ if (!id.startsWith(GRAPHQL_OP_PREFIX)) return null;
656
+ const rest = id.slice(GRAPHQL_OP_PREFIX.length);
657
+ const colon = rest.indexOf(":");
658
+ if (colon === -1) return null;
659
+ const service = rest.slice(0, colon);
660
+ const tail = rest.slice(colon + 1);
661
+ const space = tail.indexOf(" ");
662
+ if (space === -1) return null;
663
+ const operationType = tail.slice(0, space);
664
+ const operationName = tail.slice(space + 1);
665
+ if (service.length === 0 || operationType.length === 0 || operationName.length === 0) {
666
+ return null;
667
+ }
668
+ return { service, operationType, operationName };
669
+ }
670
+ function grpcMethodId(rpcService, rpcMethod) {
671
+ return `${GRPC_METHOD_PREFIX}${rpcService}/${rpcMethod}`;
672
+ }
673
+ function parseGrpcMethodId(id) {
674
+ if (!id.startsWith(GRPC_METHOD_PREFIX)) return null;
675
+ const rest = id.slice(GRPC_METHOD_PREFIX.length);
676
+ const slash = rest.indexOf("/");
677
+ if (slash === -1) return null;
678
+ const rpcService = rest.slice(0, slash);
679
+ const rpcMethod = rest.slice(slash + 1);
680
+ if (rpcService.length === 0 || rpcMethod.length === 0) return null;
681
+ return { rpcService, rpcMethod };
682
+ }
683
+ function websocketChannelId(service, channel) {
684
+ return `${WEBSOCKET_CHANNEL_PREFIX}${service}:${channel}`;
685
+ }
686
+ function parseWebsocketChannelId(id) {
687
+ if (!id.startsWith(WEBSOCKET_CHANNEL_PREFIX)) return null;
688
+ const rest = id.slice(WEBSOCKET_CHANNEL_PREFIX.length);
689
+ const colon = rest.indexOf(":");
690
+ if (colon === -1) return null;
691
+ const service = rest.slice(0, colon);
692
+ const channel = rest.slice(colon + 1);
693
+ if (service.length === 0 || channel.length === 0) return null;
694
+ return { service, channel };
695
+ }
518
696
  var EDGE_ARROW = "->";
519
697
  function extractedEdgeId(source, target, type) {
520
698
  return `${type}:${source}${EDGE_ARROW}${target}`;
@@ -983,6 +1161,8 @@ function passesExtractedFloor(confidence) {
983
1161
  GraphEdgesResponseSchema,
984
1162
  GraphNodeResponseSchema,
985
1163
  GraphNodeSchema,
1164
+ GraphQLOperationNodeSchema,
1165
+ GrpcMethodNodeSchema,
986
1166
  HealthResponseSchema,
987
1167
  HostMismatchDivergenceSchema,
988
1168
  HypotheticalActionSchema,
@@ -1011,6 +1191,7 @@ function passesExtractedFloor(confidence) {
1011
1191
  RegistryFileSchema,
1012
1192
  RegistryStatusSchema,
1013
1193
  RootCauseResultSchema,
1194
+ RouteNodeSchema,
1014
1195
  SearchMatchSchema,
1015
1196
  SearchResponseSchema,
1016
1197
  SerializedGraphSchema,
@@ -1023,6 +1204,7 @@ function passesExtractedFloor(confidence) {
1023
1204
  TransitiveDependenciesResultSchema,
1024
1205
  TransitiveDependencySchema,
1025
1206
  VersionMismatchDivergenceSchema,
1207
+ WebSocketChannelNodeSchema,
1026
1208
  confidenceForExtracted,
1027
1209
  confidenceForObservedSignal,
1028
1210
  configId,
@@ -1031,17 +1213,26 @@ function passesExtractedFloor(confidence) {
1031
1213
  extractedPrecisionFloor,
1032
1214
  fileId,
1033
1215
  frontierId,
1216
+ graphqlOperationId,
1217
+ grpcMethodId,
1034
1218
  inferredEdgeId,
1035
1219
  infraId,
1220
+ localDatabaseId,
1036
1221
  observedEdgeId,
1037
1222
  parseConfigId,
1038
1223
  parseDatabaseId,
1039
1224
  parseEdgeId,
1040
1225
  parseFileId,
1041
1226
  parseFrontierId,
1227
+ parseGraphqlOperationId,
1228
+ parseGrpcMethodId,
1042
1229
  parseInfraId,
1230
+ parseRouteId,
1043
1231
  parseServiceId,
1232
+ parseWebsocketChannelId,
1044
1233
  passesExtractedFloor,
1045
- serviceId
1234
+ routeId,
1235
+ serviceId,
1236
+ websocketChannelId
1046
1237
  });
1047
1238
  //# sourceMappingURL=index.cjs.map