@neat.is/core 0.5.0 → 0.5.1-dev.20260719

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.
@@ -31,7 +31,7 @@ import {
31
31
  touchLastSeen,
32
32
  upsertObservedEdge,
33
33
  writeAtomically
34
- } from "./chunk-QQDZSIY3.js";
34
+ } from "./chunk-BI3XKGVG.js";
35
35
  import {
36
36
  assertBindAuthority,
37
37
  buildOtelReceiver,
@@ -51,7 +51,30 @@ import path2 from "path";
51
51
  import { createRequire } from "module";
52
52
 
53
53
  // src/connectors/index.ts
54
+ import { NodeType, parseFileId, Provenance } from "@neat.is/types";
54
55
  var NO_ENV = "unknown";
56
+ function staticCallSiteFor(graph, serviceName, targetNodeId) {
57
+ if (!graph.hasNode(targetNodeId)) return void 0;
58
+ const sites = [];
59
+ for (const edgeId of graph.inboundEdges(targetNodeId)) {
60
+ const edge = graph.getEdgeAttributes(edgeId);
61
+ if (edge.provenance !== Provenance.EXTRACTED) continue;
62
+ const parsed = parseFileId(edge.source);
63
+ if (!parsed || parsed.service !== serviceName || !edge.evidence) continue;
64
+ const site = { relPath: edge.evidence.file };
65
+ if (edge.evidence.line !== void 0) site.line = edge.evidence.line;
66
+ sites.push(site);
67
+ }
68
+ return sites.length === 1 ? sites[0] : void 0;
69
+ }
70
+ function routeCallSiteFor(graph, targetNodeId) {
71
+ if (!graph.hasNode(targetNodeId)) return void 0;
72
+ const attrs = graph.getNodeAttributes(targetNodeId);
73
+ if (attrs.type !== NodeType.RouteNode || !attrs.path) return void 0;
74
+ const site = { relPath: attrs.path };
75
+ if (attrs.line !== void 0) site.line = attrs.line;
76
+ return site;
77
+ }
55
78
  async function runConnectorPoll(connector, ctx, graph, resolveTarget) {
56
79
  const signals = await connector.poll(ctx);
57
80
  let edgesCreated = 0;
@@ -68,7 +91,7 @@ async function runConnectorPoll(connector, ctx, graph, resolveTarget) {
68
91
  ensureInfraNode(graph, kind, name, provider);
69
92
  }
70
93
  const serviceNodeId = ensureServiceNode(graph, resolved.serviceName, NO_ENV);
71
- const callSite = signal.callSite ? { relPath: signal.callSite.file, line: signal.callSite.line } : void 0;
94
+ const callSite = signal.callSite ? { relPath: signal.callSite.file, line: signal.callSite.line } : routeCallSiteFor(graph, resolved.targetNodeId) ?? staticCallSiteFor(graph, resolved.serviceName, resolved.targetNodeId);
72
95
  const sourceId = callSite ? ensureObservedFileNode(graph, resolved.serviceName, serviceNodeId, callSite) : serviceNodeId;
73
96
  const evidence = callSite ? {
74
97
  file: reconcileObservedRelPath(graph, resolved.serviceName, callSite.relPath),
@@ -615,6 +638,10 @@ function createSupabaseResolveTarget(graph, config) {
615
638
  if (graph.hasNode(subResourceId)) {
616
639
  return { targetNodeId: subResourceId, serviceName: config.serviceName, edgeType: EdgeType.CALLS };
617
640
  }
641
+ const bareResourceId = infraId(signal.targetKind, signal.targetName);
642
+ if (graph.hasNode(bareResourceId)) {
643
+ return { targetNodeId: bareResourceId, serviceName: config.serviceName, edgeType: EdgeType.CALLS };
644
+ }
618
645
  const projectLevelId = infraId("supabase", config.nodeRef);
619
646
  if (graph.hasNode(projectLevelId)) {
620
647
  return { targetNodeId: projectLevelId, serviceName: config.serviceName, edgeType: EdgeType.CALLS };
@@ -709,7 +736,7 @@ function createSupabaseConnector(graph, config, deps = {}) {
709
736
  }
710
737
 
711
738
  // src/connectors/railway/index.ts
712
- import { EdgeType as EdgeType2, NodeType, serviceId } from "@neat.is/types";
739
+ import { EdgeType as EdgeType2, NodeType as NodeType2, serviceId } from "@neat.is/types";
713
740
 
714
741
  // src/connectors/railway/client.ts
715
742
  var DEFAULT_RAILWAY_API_URL = "https://backboard.railway.com/graphql/v2";
@@ -834,7 +861,7 @@ function buildRailwayRouteIndex(graph, serviceName) {
834
861
  const out = [];
835
862
  graph.forEachNode((_id, attrs) => {
836
863
  const node = attrs;
837
- if (node.type !== NodeType.RouteNode) return;
864
+ if (node.type !== NodeType2.RouteNode) return;
838
865
  const route = attrs;
839
866
  if (route.service !== serviceName) return;
840
867
  out.push({
@@ -1116,7 +1143,7 @@ function mapLogEntriesToSignals(entries) {
1116
1143
  }
1117
1144
 
1118
1145
  // src/connectors/firebase/resolve.ts
1119
- import { NodeType as NodeType2, EdgeType as EdgeType3 } from "@neat.is/types";
1146
+ import { NodeType as NodeType3, EdgeType as EdgeType3 } from "@neat.is/types";
1120
1147
  function neatServiceNameFor(resourceType, resourceName, serviceMap) {
1121
1148
  switch (resourceType) {
1122
1149
  case "cloud_function":
@@ -1131,7 +1158,7 @@ function routeEntriesFor(graph, serviceName) {
1131
1158
  const entries = [];
1132
1159
  graph.forEachNode((_id, attrs) => {
1133
1160
  const node = attrs;
1134
- if (node.type !== NodeType2.RouteNode) return;
1161
+ if (node.type !== NodeType3.RouteNode) return;
1135
1162
  const route = attrs;
1136
1163
  if (route.service !== serviceName) return;
1137
1164
  entries.push({
@@ -1186,7 +1213,7 @@ function createFirebaseConnector(graph, serviceMap) {
1186
1213
  }
1187
1214
 
1188
1215
  // src/connectors/cloudflare/connector.ts
1189
- import { EdgeType as EdgeType4, NodeType as NodeType3, fileId, infraId as infraId2 } from "@neat.is/types";
1216
+ import { EdgeType as EdgeType4, NodeType as NodeType4, fileId, infraId as infraId2 } from "@neat.is/types";
1190
1217
 
1191
1218
  // src/connectors/cloudflare/client.ts
1192
1219
  import { randomUUID } from "crypto";
@@ -1342,7 +1369,7 @@ function findTaggedWorkerFileNode(graph, workerName) {
1342
1369
  graph.forEachNode((id, attrs) => {
1343
1370
  if (found) return;
1344
1371
  const a = attrs;
1345
- if (a.type === NodeType3.FileNode && a.platform === "cloudflare" && a.platformName === workerName) {
1372
+ if (a.type === NodeType4.FileNode && a.platform === "cloudflare" && a.platformName === workerName) {
1346
1373
  found = id;
1347
1374
  }
1348
1375
  });
@@ -1354,7 +1381,7 @@ function findMatchingRouteNode(graph, serviceName, method, path3) {
1354
1381
  graph.forEachNode((id, attrs) => {
1355
1382
  if (found) return;
1356
1383
  const a = attrs;
1357
- if (a.type !== NodeType3.RouteNode || a.service !== serviceName) return;
1384
+ if (a.type !== NodeType4.RouteNode || a.service !== serviceName) return;
1358
1385
  if (!a.pathTemplate || normalizePathTemplate(a.pathTemplate) !== normalizedPath) return;
1359
1386
  const routeMethod = (a.method ?? "").toUpperCase();
1360
1387
  if (routeMethod !== "ALL" && routeMethod !== method) return;
@@ -1675,7 +1702,7 @@ function unroutedErrorsPath(neatHome) {
1675
1702
  }
1676
1703
 
1677
1704
  // src/daemon.ts
1678
- import { NodeType as NodeType4 } from "@neat.is/types";
1705
+ import { NodeType as NodeType5 } from "@neat.is/types";
1679
1706
  function daemonJsonPath(scanPath) {
1680
1707
  return path2.join(scanPath, "neat-out", "daemon.json");
1681
1708
  }
@@ -1822,7 +1849,7 @@ function spanBelongsToSingleProject(graph, project, serviceName) {
1822
1849
  if (!serviceName) return true;
1823
1850
  if (serviceNameMatchesProject(serviceName, project)) return true;
1824
1851
  return graph.someNode(
1825
- (_id, attrs) => attrs.type === NodeType4.ServiceNode && attrs.name === serviceName
1852
+ (_id, attrs) => attrs.type === NodeType5.ServiceNode && attrs.name === serviceName
1826
1853
  );
1827
1854
  }
1828
1855
  async function bootstrapProject(entry, connectors = [], neatHome) {
@@ -2461,4 +2488,4 @@ export {
2461
2488
  resolveHost,
2462
2489
  startDaemon
2463
2490
  };
2464
- //# sourceMappingURL=chunk-5MGHWP6R.js.map
2491
+ //# sourceMappingURL=chunk-O4PCNQFG.js.map