@neat.is/types 0.4.26-dev.20260703 → 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.js CHANGED
@@ -48,7 +48,31 @@ var NodeType = {
48
48
  // operation-level topology from the execution span's `graphql.operation.*`
49
49
  // semconv. Minted observed-first from OTel; a future static GraphQL extractor
50
50
  // fuses onto the same id. See docs/contracts/otel-ingest.md.
51
- GraphQLOperationNode: "GraphQLOperationNode"
51
+ GraphQLOperationNode: "GraphQLOperationNode",
52
+ // A single gRPC method — one `rpc` in a `.proto` service — at
53
+ // (rpcService, rpcMethod) granularity (ADR-123). gRPC used to engage only at
54
+ // service grain: every method collapsed onto one service→service edge, so the
55
+ // per-method topology was invisible and one-sided. This node recovers the
56
+ // method-level shape from both sides: the OBSERVED execution span's
57
+ // `rpc.service` / `rpc.method` semconv and the static `.proto` service/method
58
+ // definitions. It keys on the fully-qualified `rpc.service` — the wire
59
+ // contract both sides carry verbatim — so a declared method and an observed
60
+ // one fuse onto the same node into a two-sided divergence. See
61
+ // docs/contracts/otel-ingest.md and docs/contracts/static-extraction.md.
62
+ GrpcMethodNode: "GrpcMethodNode",
63
+ // A live WebSocket channel — the path/channel a client connects to — at
64
+ // (service, channel) granularity (ADR-125). A WebSocket app used to produce no
65
+ // OBSERVED topology at all: only message-handler errors surfaced, as incidents,
66
+ // and the channels themselves stayed invisible. This node recovers the
67
+ // channel-level topology from the HTTP upgrade span that opens the connection —
68
+ // a SERVER `GET` carrying the WebSocket path. It is minted OBSERVED-only: a
69
+ // WebSocket channel is known from observation, never from static extraction, so
70
+ // there is no declared twin to fuse with. The edge onto it reuses the existing
71
+ // `CONNECTS_TO` (`service ──CONNECTS_TO──▶ ws-channel`) as an observed-liveness
72
+ // edge that carries `lastObserved` and decays OBSERVED → STALE on CONNECTS_TO's
73
+ // own staleness threshold when the channel goes quiet. See
74
+ // docs/contracts/otel-ingest.md.
75
+ WebSocketChannelNode: "WebSocketChannelNode"
52
76
  };
53
77
  var NodeTypeSchema = z.enum([
54
78
  NodeType.ServiceNode,
@@ -58,7 +82,9 @@ var NodeTypeSchema = z.enum([
58
82
  NodeType.FrontierNode,
59
83
  NodeType.FileNode,
60
84
  NodeType.RouteNode,
61
- NodeType.GraphQLOperationNode
85
+ NodeType.GraphQLOperationNode,
86
+ NodeType.GrpcMethodNode,
87
+ NodeType.WebSocketChannelNode
62
88
  ]);
63
89
 
64
90
  // src/nodes.ts
@@ -211,6 +237,26 @@ var GraphQLOperationNodeSchema = z2.object({
211
237
  line: z2.number().int().nonnegative().optional(),
212
238
  discoveredVia: DiscoveredViaSchema.optional()
213
239
  });
240
+ var GrpcMethodNodeSchema = z2.object({
241
+ id: z2.string(),
242
+ type: z2.literal(NodeType.GrpcMethodNode),
243
+ name: z2.string(),
244
+ rpcService: z2.string(),
245
+ rpcMethod: z2.string(),
246
+ path: z2.string().optional(),
247
+ line: z2.number().int().nonnegative().optional(),
248
+ discoveredVia: DiscoveredViaSchema.optional()
249
+ });
250
+ var WebSocketChannelNodeSchema = z2.object({
251
+ id: z2.string(),
252
+ type: z2.literal(NodeType.WebSocketChannelNode),
253
+ name: z2.string(),
254
+ service: z2.string(),
255
+ channel: z2.string(),
256
+ path: z2.string().optional(),
257
+ line: z2.number().int().nonnegative().optional(),
258
+ discoveredVia: DiscoveredViaSchema.optional()
259
+ });
214
260
  var GraphNodeSchema = z2.discriminatedUnion("type", [
215
261
  ServiceNodeSchema,
216
262
  DatabaseNodeSchema,
@@ -219,7 +265,9 @@ var GraphNodeSchema = z2.discriminatedUnion("type", [
219
265
  FrontierNodeSchema,
220
266
  FileNodeSchema,
221
267
  RouteNodeSchema,
222
- GraphQLOperationNodeSchema
268
+ GraphQLOperationNodeSchema,
269
+ GrpcMethodNodeSchema,
270
+ WebSocketChannelNodeSchema
223
271
  ]);
224
272
 
225
273
  // src/edges.ts
@@ -393,6 +441,8 @@ var FRONTIER_PREFIX = "frontier:";
393
441
  var FILE_PREFIX = "file:";
394
442
  var ROUTE_PREFIX = "route:";
395
443
  var GRAPHQL_OP_PREFIX = "graphql:";
444
+ var GRPC_METHOD_PREFIX = "grpc:";
445
+ var WEBSOCKET_CHANNEL_PREFIX = "ws:";
396
446
  var ENV_UNKNOWN = "unknown";
397
447
  function serviceId(name, env) {
398
448
  if (env === void 0 || env === ENV_UNKNOWN) return `${SERVICE_PREFIX}${name}`;
@@ -486,6 +536,32 @@ function parseGraphqlOperationId(id) {
486
536
  }
487
537
  return { service, operationType, operationName };
488
538
  }
539
+ function grpcMethodId(rpcService, rpcMethod) {
540
+ return `${GRPC_METHOD_PREFIX}${rpcService}/${rpcMethod}`;
541
+ }
542
+ function parseGrpcMethodId(id) {
543
+ if (!id.startsWith(GRPC_METHOD_PREFIX)) return null;
544
+ const rest = id.slice(GRPC_METHOD_PREFIX.length);
545
+ const slash = rest.indexOf("/");
546
+ if (slash === -1) return null;
547
+ const rpcService = rest.slice(0, slash);
548
+ const rpcMethod = rest.slice(slash + 1);
549
+ if (rpcService.length === 0 || rpcMethod.length === 0) return null;
550
+ return { rpcService, rpcMethod };
551
+ }
552
+ function websocketChannelId(service, channel) {
553
+ return `${WEBSOCKET_CHANNEL_PREFIX}${service}:${channel}`;
554
+ }
555
+ function parseWebsocketChannelId(id) {
556
+ if (!id.startsWith(WEBSOCKET_CHANNEL_PREFIX)) return null;
557
+ const rest = id.slice(WEBSOCKET_CHANNEL_PREFIX.length);
558
+ const colon = rest.indexOf(":");
559
+ if (colon === -1) return null;
560
+ const service = rest.slice(0, colon);
561
+ const channel = rest.slice(colon + 1);
562
+ if (service.length === 0 || channel.length === 0) return null;
563
+ return { service, channel };
564
+ }
489
565
  var EDGE_ARROW = "->";
490
566
  function extractedEdgeId(source, target, type) {
491
567
  return `${type}:${source}${EDGE_ARROW}${target}`;
@@ -954,6 +1030,7 @@ export {
954
1030
  GraphNodeResponseSchema,
955
1031
  GraphNodeSchema,
956
1032
  GraphQLOperationNodeSchema,
1033
+ GrpcMethodNodeSchema,
957
1034
  HealthResponseSchema,
958
1035
  HostMismatchDivergenceSchema,
959
1036
  HypotheticalActionSchema,
@@ -995,6 +1072,7 @@ export {
995
1072
  TransitiveDependenciesResultSchema,
996
1073
  TransitiveDependencySchema,
997
1074
  VersionMismatchDivergenceSchema,
1075
+ WebSocketChannelNodeSchema,
998
1076
  confidenceForExtracted,
999
1077
  confidenceForObservedSignal,
1000
1078
  configId,
@@ -1004,6 +1082,7 @@ export {
1004
1082
  fileId,
1005
1083
  frontierId,
1006
1084
  graphqlOperationId,
1085
+ grpcMethodId,
1007
1086
  inferredEdgeId,
1008
1087
  infraId,
1009
1088
  localDatabaseId,
@@ -1014,11 +1093,14 @@ export {
1014
1093
  parseFileId,
1015
1094
  parseFrontierId,
1016
1095
  parseGraphqlOperationId,
1096
+ parseGrpcMethodId,
1017
1097
  parseInfraId,
1018
1098
  parseRouteId,
1019
1099
  parseServiceId,
1100
+ parseWebsocketChannelId,
1020
1101
  passesExtractedFloor,
1021
1102
  routeId,
1022
- serviceId
1103
+ serviceId,
1104
+ websocketChannelId
1023
1105
  };
1024
1106
  //# sourceMappingURL=index.js.map