@neat.is/types 0.4.25 → 0.4.26-dev.20260703
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 +107 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1426 -109
- package/dist/index.d.ts +1426 -109
- package/dist/index.js +100 -4
- 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
|
GraphEdgesResponseSchema: () => GraphEdgesResponseSchema,
|
|
54
54
|
GraphNodeResponseSchema: () => GraphNodeResponseSchema,
|
|
55
55
|
GraphNodeSchema: () => GraphNodeSchema,
|
|
56
|
+
GraphQLOperationNodeSchema: () => GraphQLOperationNodeSchema,
|
|
56
57
|
HealthResponseSchema: () => HealthResponseSchema,
|
|
57
58
|
HostMismatchDivergenceSchema: () => HostMismatchDivergenceSchema,
|
|
58
59
|
HypotheticalActionSchema: () => HypotheticalActionSchema,
|
|
@@ -81,6 +82,7 @@ __export(index_exports, {
|
|
|
81
82
|
RegistryFileSchema: () => RegistryFileSchema,
|
|
82
83
|
RegistryStatusSchema: () => RegistryStatusSchema,
|
|
83
84
|
RootCauseResultSchema: () => RootCauseResultSchema,
|
|
85
|
+
RouteNodeSchema: () => RouteNodeSchema,
|
|
84
86
|
SearchMatchSchema: () => SearchMatchSchema,
|
|
85
87
|
SearchResponseSchema: () => SearchResponseSchema,
|
|
86
88
|
SerializedGraphSchema: () => SerializedGraphSchema,
|
|
@@ -101,17 +103,22 @@ __export(index_exports, {
|
|
|
101
103
|
extractedPrecisionFloor: () => extractedPrecisionFloor,
|
|
102
104
|
fileId: () => fileId,
|
|
103
105
|
frontierId: () => frontierId,
|
|
106
|
+
graphqlOperationId: () => graphqlOperationId,
|
|
104
107
|
inferredEdgeId: () => inferredEdgeId,
|
|
105
108
|
infraId: () => infraId,
|
|
109
|
+
localDatabaseId: () => localDatabaseId,
|
|
106
110
|
observedEdgeId: () => observedEdgeId,
|
|
107
111
|
parseConfigId: () => parseConfigId,
|
|
108
112
|
parseDatabaseId: () => parseDatabaseId,
|
|
109
113
|
parseEdgeId: () => parseEdgeId,
|
|
110
114
|
parseFileId: () => parseFileId,
|
|
111
115
|
parseFrontierId: () => parseFrontierId,
|
|
116
|
+
parseGraphqlOperationId: () => parseGraphqlOperationId,
|
|
112
117
|
parseInfraId: () => parseInfraId,
|
|
118
|
+
parseRouteId: () => parseRouteId,
|
|
113
119
|
parseServiceId: () => parseServiceId,
|
|
114
120
|
passesExtractedFloor: () => passesExtractedFloor,
|
|
121
|
+
routeId: () => routeId,
|
|
115
122
|
serviceId: () => serviceId
|
|
116
123
|
});
|
|
117
124
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -151,7 +158,22 @@ var NodeType = {
|
|
|
151
158
|
// The primary node of the file-first graph (ADR-089). A source file owned
|
|
152
159
|
// by a service; relationships originate from it. See
|
|
153
160
|
// docs/contracts/file-awareness.md §1.
|
|
154
|
-
FileNode: "FileNode"
|
|
161
|
+
FileNode: "FileNode",
|
|
162
|
+
// A server route at (method, path-template) granularity (ADR-119). Extracted
|
|
163
|
+
// from a mainstream router (Express / Fastify / Next.js) so a client call
|
|
164
|
+
// site can be matched to the exact route it names, rather than only to the
|
|
165
|
+
// owning service. The node an OBSERVED server span lands on too, which is
|
|
166
|
+
// what makes a two-sided divergence possible at route grain. See
|
|
167
|
+
// docs/contracts/static-extraction.md.
|
|
168
|
+
RouteNode: "RouteNode",
|
|
169
|
+
// A named GraphQL operation — one query, mutation, or subscription — at
|
|
170
|
+
// (service, operationType, operationName) granularity (ADR-122). Every
|
|
171
|
+
// GraphQL request rides one HTTP endpoint (POST /graphql), so at HTTP grain
|
|
172
|
+
// the whole API collapses to a single edge; this node recovers the
|
|
173
|
+
// operation-level topology from the execution span's `graphql.operation.*`
|
|
174
|
+
// semconv. Minted observed-first from OTel; a future static GraphQL extractor
|
|
175
|
+
// fuses onto the same id. See docs/contracts/otel-ingest.md.
|
|
176
|
+
GraphQLOperationNode: "GraphQLOperationNode"
|
|
155
177
|
};
|
|
156
178
|
var NodeTypeSchema = import_zod.z.enum([
|
|
157
179
|
NodeType.ServiceNode,
|
|
@@ -159,7 +181,9 @@ var NodeTypeSchema = import_zod.z.enum([
|
|
|
159
181
|
NodeType.ConfigNode,
|
|
160
182
|
NodeType.InfraNode,
|
|
161
183
|
NodeType.FrontierNode,
|
|
162
|
-
NodeType.FileNode
|
|
184
|
+
NodeType.FileNode,
|
|
185
|
+
NodeType.RouteNode,
|
|
186
|
+
NodeType.GraphQLOperationNode
|
|
163
187
|
]);
|
|
164
188
|
|
|
165
189
|
// src/nodes.ts
|
|
@@ -289,13 +313,38 @@ var FileNodeSchema = import_zod2.z.object({
|
|
|
289
313
|
// Absent when the call site was already source-grained.
|
|
290
314
|
originalPath: import_zod2.z.string().optional()
|
|
291
315
|
});
|
|
316
|
+
var RouteNodeSchema = import_zod2.z.object({
|
|
317
|
+
id: import_zod2.z.string(),
|
|
318
|
+
type: import_zod2.z.literal(NodeType.RouteNode),
|
|
319
|
+
name: import_zod2.z.string(),
|
|
320
|
+
service: import_zod2.z.string(),
|
|
321
|
+
method: import_zod2.z.string(),
|
|
322
|
+
pathTemplate: import_zod2.z.string(),
|
|
323
|
+
path: import_zod2.z.string(),
|
|
324
|
+
line: import_zod2.z.number().int().nonnegative().optional(),
|
|
325
|
+
framework: import_zod2.z.string().optional(),
|
|
326
|
+
discoveredVia: DiscoveredViaSchema.optional()
|
|
327
|
+
});
|
|
328
|
+
var GraphQLOperationNodeSchema = import_zod2.z.object({
|
|
329
|
+
id: import_zod2.z.string(),
|
|
330
|
+
type: import_zod2.z.literal(NodeType.GraphQLOperationNode),
|
|
331
|
+
name: import_zod2.z.string(),
|
|
332
|
+
service: import_zod2.z.string(),
|
|
333
|
+
operationType: import_zod2.z.string(),
|
|
334
|
+
operationName: import_zod2.z.string(),
|
|
335
|
+
path: import_zod2.z.string().optional(),
|
|
336
|
+
line: import_zod2.z.number().int().nonnegative().optional(),
|
|
337
|
+
discoveredVia: DiscoveredViaSchema.optional()
|
|
338
|
+
});
|
|
292
339
|
var GraphNodeSchema = import_zod2.z.discriminatedUnion("type", [
|
|
293
340
|
ServiceNodeSchema,
|
|
294
341
|
DatabaseNodeSchema,
|
|
295
342
|
ConfigNodeSchema,
|
|
296
343
|
InfraNodeSchema,
|
|
297
344
|
FrontierNodeSchema,
|
|
298
|
-
FileNodeSchema
|
|
345
|
+
FileNodeSchema,
|
|
346
|
+
RouteNodeSchema,
|
|
347
|
+
GraphQLOperationNodeSchema
|
|
299
348
|
]);
|
|
300
349
|
|
|
301
350
|
// src/edges.ts
|
|
@@ -320,7 +369,13 @@ var EdgeTypeSchema = import_zod3.z.enum([
|
|
|
320
369
|
var EdgeEvidenceSchema = import_zod3.z.object({
|
|
321
370
|
file: import_zod3.z.string(),
|
|
322
371
|
line: import_zod3.z.number().int().nonnegative().optional(),
|
|
323
|
-
snippet: import_zod3.z.string().optional()
|
|
372
|
+
snippet: import_zod3.z.string().optional(),
|
|
373
|
+
// HTTP shape of a recognised client call site (ADR-119). Present on a
|
|
374
|
+
// client↔route CALLS edge so the edge records the method + path-template the
|
|
375
|
+
// client named, alongside the file:line it named them at. Absent on every
|
|
376
|
+
// other edge — a config or infra edge has no HTTP method.
|
|
377
|
+
method: import_zod3.z.string().optional(),
|
|
378
|
+
pathTemplate: import_zod3.z.string().optional()
|
|
324
379
|
});
|
|
325
380
|
var EdgeSignalSchema = import_zod3.z.object({
|
|
326
381
|
spanCount: import_zod3.z.number().int().nonnegative(),
|
|
@@ -461,6 +516,8 @@ var CONFIG_PREFIX = "config:";
|
|
|
461
516
|
var INFRA_PREFIX = "infra:";
|
|
462
517
|
var FRONTIER_PREFIX = "frontier:";
|
|
463
518
|
var FILE_PREFIX = "file:";
|
|
519
|
+
var ROUTE_PREFIX = "route:";
|
|
520
|
+
var GRAPHQL_OP_PREFIX = "graphql:";
|
|
464
521
|
var ENV_UNKNOWN = "unknown";
|
|
465
522
|
function serviceId(name, env) {
|
|
466
523
|
if (env === void 0 || env === ENV_UNKNOWN) return `${SERVICE_PREFIX}${name}`;
|
|
@@ -480,6 +537,9 @@ function databaseId(host) {
|
|
|
480
537
|
function parseDatabaseId(id) {
|
|
481
538
|
return id.startsWith(DATABASE_PREFIX) ? id.slice(DATABASE_PREFIX.length) : null;
|
|
482
539
|
}
|
|
540
|
+
function localDatabaseId(service, name) {
|
|
541
|
+
return `${DATABASE_PREFIX}${service}/${name}`;
|
|
542
|
+
}
|
|
483
543
|
function configId(relPath) {
|
|
484
544
|
return `${CONFIG_PREFIX}${relPath}`;
|
|
485
545
|
}
|
|
@@ -515,6 +575,42 @@ function parseFileId(id) {
|
|
|
515
575
|
if (service.length === 0 || relPath.length === 0) return null;
|
|
516
576
|
return { service, relPath };
|
|
517
577
|
}
|
|
578
|
+
function routeId(service, method, pathTemplate) {
|
|
579
|
+
return `${ROUTE_PREFIX}${service}:${method.toUpperCase()} ${pathTemplate}`;
|
|
580
|
+
}
|
|
581
|
+
function parseRouteId(id) {
|
|
582
|
+
if (!id.startsWith(ROUTE_PREFIX)) return null;
|
|
583
|
+
const rest = id.slice(ROUTE_PREFIX.length);
|
|
584
|
+
const colon = rest.indexOf(":");
|
|
585
|
+
if (colon === -1) return null;
|
|
586
|
+
const service = rest.slice(0, colon);
|
|
587
|
+
const tail = rest.slice(colon + 1);
|
|
588
|
+
const space = tail.indexOf(" ");
|
|
589
|
+
if (space === -1) return null;
|
|
590
|
+
const method = tail.slice(0, space);
|
|
591
|
+
const pathTemplate = tail.slice(space + 1);
|
|
592
|
+
if (service.length === 0 || method.length === 0 || pathTemplate.length === 0) return null;
|
|
593
|
+
return { service, method, pathTemplate };
|
|
594
|
+
}
|
|
595
|
+
function graphqlOperationId(service, operationType, operationName) {
|
|
596
|
+
return `${GRAPHQL_OP_PREFIX}${service}:${operationType.toLowerCase()} ${operationName}`;
|
|
597
|
+
}
|
|
598
|
+
function parseGraphqlOperationId(id) {
|
|
599
|
+
if (!id.startsWith(GRAPHQL_OP_PREFIX)) return null;
|
|
600
|
+
const rest = id.slice(GRAPHQL_OP_PREFIX.length);
|
|
601
|
+
const colon = rest.indexOf(":");
|
|
602
|
+
if (colon === -1) return null;
|
|
603
|
+
const service = rest.slice(0, colon);
|
|
604
|
+
const tail = rest.slice(colon + 1);
|
|
605
|
+
const space = tail.indexOf(" ");
|
|
606
|
+
if (space === -1) return null;
|
|
607
|
+
const operationType = tail.slice(0, space);
|
|
608
|
+
const operationName = tail.slice(space + 1);
|
|
609
|
+
if (service.length === 0 || operationType.length === 0 || operationName.length === 0) {
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
return { service, operationType, operationName };
|
|
613
|
+
}
|
|
518
614
|
var EDGE_ARROW = "->";
|
|
519
615
|
function extractedEdgeId(source, target, type) {
|
|
520
616
|
return `${type}:${source}${EDGE_ARROW}${target}`;
|
|
@@ -983,6 +1079,7 @@ function passesExtractedFloor(confidence) {
|
|
|
983
1079
|
GraphEdgesResponseSchema,
|
|
984
1080
|
GraphNodeResponseSchema,
|
|
985
1081
|
GraphNodeSchema,
|
|
1082
|
+
GraphQLOperationNodeSchema,
|
|
986
1083
|
HealthResponseSchema,
|
|
987
1084
|
HostMismatchDivergenceSchema,
|
|
988
1085
|
HypotheticalActionSchema,
|
|
@@ -1011,6 +1108,7 @@ function passesExtractedFloor(confidence) {
|
|
|
1011
1108
|
RegistryFileSchema,
|
|
1012
1109
|
RegistryStatusSchema,
|
|
1013
1110
|
RootCauseResultSchema,
|
|
1111
|
+
RouteNodeSchema,
|
|
1014
1112
|
SearchMatchSchema,
|
|
1015
1113
|
SearchResponseSchema,
|
|
1016
1114
|
SerializedGraphSchema,
|
|
@@ -1031,17 +1129,22 @@ function passesExtractedFloor(confidence) {
|
|
|
1031
1129
|
extractedPrecisionFloor,
|
|
1032
1130
|
fileId,
|
|
1033
1131
|
frontierId,
|
|
1132
|
+
graphqlOperationId,
|
|
1034
1133
|
inferredEdgeId,
|
|
1035
1134
|
infraId,
|
|
1135
|
+
localDatabaseId,
|
|
1036
1136
|
observedEdgeId,
|
|
1037
1137
|
parseConfigId,
|
|
1038
1138
|
parseDatabaseId,
|
|
1039
1139
|
parseEdgeId,
|
|
1040
1140
|
parseFileId,
|
|
1041
1141
|
parseFrontierId,
|
|
1142
|
+
parseGraphqlOperationId,
|
|
1042
1143
|
parseInfraId,
|
|
1144
|
+
parseRouteId,
|
|
1043
1145
|
parseServiceId,
|
|
1044
1146
|
passesExtractedFloor,
|
|
1147
|
+
routeId,
|
|
1045
1148
|
serviceId
|
|
1046
1149
|
});
|
|
1047
1150
|
//# sourceMappingURL=index.cjs.map
|