@neat.is/core 0.4.7 → 0.4.9

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.
@@ -1,5 +1,6 @@
1
1
  import {
2
- mountBearerAuth
2
+ mountBearerAuth,
3
+ readAuthEnv
3
4
  } from "./chunk-HVF4S7J3.js";
4
5
 
5
6
  // src/graph.ts
@@ -341,6 +342,7 @@ function deprecatedApis() {
341
342
  // src/traverse.ts
342
343
  import {
343
344
  BlastRadiusResultSchema,
345
+ EdgeType,
344
346
  NodeType,
345
347
  PROV_RANK,
346
348
  RootCauseResultSchema,
@@ -353,6 +355,24 @@ function isFrontierNode(graph, nodeId) {
353
355
  const attrs = graph.getNodeAttributes(nodeId);
354
356
  return attrs.type === NodeType.FrontierNode;
355
357
  }
358
+ function resolveOwningService(graph, nodeId) {
359
+ if (!graph.hasNode(nodeId)) return null;
360
+ const attrs = graph.getNodeAttributes(nodeId);
361
+ if (attrs.type === NodeType.ServiceNode) {
362
+ return { id: nodeId, svc: attrs };
363
+ }
364
+ if (attrs.type === NodeType.FileNode) {
365
+ for (const edgeId of graph.inboundEdges(nodeId)) {
366
+ const e = graph.getEdgeAttributes(edgeId);
367
+ if (e.type !== EdgeType.CONTAINS) continue;
368
+ const owner = graph.getNodeAttributes(e.source);
369
+ if (owner.type === NodeType.ServiceNode) {
370
+ return { id: e.source, svc: owner };
371
+ }
372
+ }
373
+ }
374
+ return null;
375
+ }
356
376
  function bestEdgeBySource(graph, edgeIds) {
357
377
  const best = /* @__PURE__ */ new Map();
358
378
  for (const id of edgeIds) {
@@ -459,9 +479,9 @@ function databaseRootCauseShape(graph, origin, walk) {
459
479
  const candidatePairs = compatPairs().filter((p) => p.engine === targetDb.engine);
460
480
  if (candidatePairs.length === 0) return null;
461
481
  for (const id of walk.path) {
462
- const attrs = graph.getNodeAttributes(id);
463
- if (attrs.type !== NodeType.ServiceNode) continue;
464
- const svc = attrs;
482
+ const owner = resolveOwningService(graph, id);
483
+ if (!owner) continue;
484
+ const { id: serviceId3, svc } = owner;
465
485
  const deps = svc.dependencies ?? {};
466
486
  for (const pair of candidatePairs) {
467
487
  const declared = deps[pair.driver];
@@ -474,7 +494,7 @@ function databaseRootCauseShape(graph, origin, walk) {
474
494
  );
475
495
  if (!result.compatible) {
476
496
  return {
477
- rootCauseNode: id,
497
+ rootCauseNode: serviceId3,
478
498
  rootCauseReason: result.reason ?? "incompatible driver",
479
499
  ...result.minDriverVersion ? {
480
500
  fixRecommendation: `Upgrade ${svc.name} ${pair.driver} driver to >= ${result.minDriverVersion}`
@@ -487,9 +507,9 @@ function databaseRootCauseShape(graph, origin, walk) {
487
507
  }
488
508
  function serviceRootCauseShape(graph, _origin, walk) {
489
509
  for (const id of walk.path) {
490
- const attrs = graph.getNodeAttributes(id);
491
- if (attrs.type !== NodeType.ServiceNode) continue;
492
- const svc = attrs;
510
+ const owner = resolveOwningService(graph, id);
511
+ if (!owner) continue;
512
+ const { id: serviceId3, svc } = owner;
493
513
  const deps = svc.dependencies ?? {};
494
514
  const serviceNodeEngine = svc.nodeEngine;
495
515
  for (const constraint of nodeEngineConstraints()) {
@@ -498,7 +518,7 @@ function serviceRootCauseShape(graph, _origin, walk) {
498
518
  const result = checkNodeEngineConstraint(constraint, declared, serviceNodeEngine);
499
519
  if (!result.compatible && result.reason) {
500
520
  return {
501
- rootCauseNode: id,
521
+ rootCauseNode: serviceId3,
502
522
  rootCauseReason: result.reason,
503
523
  ...result.requiredNodeVersion ? {
504
524
  fixRecommendation: `Bump ${svc.name}'s engines.node to >= ${result.requiredNodeVersion}`
@@ -513,7 +533,7 @@ function serviceRootCauseShape(graph, _origin, walk) {
513
533
  const result = checkPackageConflict(conflict, declared, requiredDeclared);
514
534
  if (!result.compatible && result.reason) {
515
535
  return {
516
- rootCauseNode: id,
536
+ rootCauseNode: serviceId3,
517
537
  rootCauseReason: result.reason,
518
538
  fixRecommendation: `Upgrade ${svc.name}'s ${conflict.requires.name} to >= ${conflict.requires.minVersion}`
519
539
  };
@@ -522,9 +542,15 @@ function serviceRootCauseShape(graph, _origin, walk) {
522
542
  }
523
543
  return null;
524
544
  }
545
+ function fileRootCauseShape(graph, origin, walk) {
546
+ const owner = resolveOwningService(graph, origin.id);
547
+ if (!owner) return null;
548
+ return serviceRootCauseShape(graph, owner.svc, walk);
549
+ }
525
550
  var rootCauseShapes = {
526
551
  [NodeType.DatabaseNode]: databaseRootCauseShape,
527
- [NodeType.ServiceNode]: serviceRootCauseShape
552
+ [NodeType.ServiceNode]: serviceRootCauseShape,
553
+ [NodeType.FileNode]: fileRootCauseShape
528
554
  };
529
555
  function getRootCause(graph, errorNodeId, errorEvent) {
530
556
  if (!graph.hasNode(errorNodeId)) return null;
@@ -636,7 +662,7 @@ import path3 from "path";
636
662
  import { promises as fs2 } from "fs";
637
663
  import path2 from "path";
638
664
  import {
639
- EdgeType,
665
+ EdgeType as EdgeType2,
640
666
  NodeType as NodeType2,
641
667
  PolicyFileSchema
642
668
  } from "@neat.is/types";
@@ -858,7 +884,7 @@ var evaluateCompatibility = ({
858
884
  if (wantsKind("driver-engine")) {
859
885
  for (const edgeId of graph.outboundEdges(svcId)) {
860
886
  const e = graph.getEdgeAttributes(edgeId);
861
- if (e.type !== EdgeType.CONNECTS_TO) continue;
887
+ if (e.type !== EdgeType2.CONNECTS_TO) continue;
862
888
  const dbAttrs = graph.getNodeAttributes(e.target);
863
889
  if (dbAttrs.type === NodeType2.FrontierNode) continue;
864
890
  if (dbAttrs.type !== NodeType2.DatabaseNode) continue;
@@ -1021,7 +1047,7 @@ var PolicyViolationsLog = class {
1021
1047
 
1022
1048
  // src/ingest.ts
1023
1049
  import {
1024
- EdgeType as EdgeType2,
1050
+ EdgeType as EdgeType3,
1025
1051
  NodeType as NodeType3,
1026
1052
  Provenance,
1027
1053
  confidenceForObservedSignal,
@@ -1162,13 +1188,13 @@ function ensureObservedFileNode(graph, serviceName, serviceNodeId, callSite) {
1162
1188
  };
1163
1189
  graph.addNode(fileNodeId, node);
1164
1190
  }
1165
- const containsId = makeObservedEdgeId(EdgeType2.CONTAINS, serviceNodeId, fileNodeId);
1191
+ const containsId = makeObservedEdgeId(EdgeType3.CONTAINS, serviceNodeId, fileNodeId);
1166
1192
  if (!graph.hasEdge(containsId)) {
1167
1193
  const edge = {
1168
1194
  id: containsId,
1169
1195
  source: serviceNodeId,
1170
1196
  target: fileNodeId,
1171
- type: EdgeType2.CONTAINS,
1197
+ type: EdgeType3.CONTAINS,
1172
1198
  provenance: Provenance.OBSERVED
1173
1199
  };
1174
1200
  graph.addEdgeWithKey(containsId, serviceNodeId, fileNodeId, edge);
@@ -1428,7 +1454,7 @@ async function handleSpan(ctx, span) {
1428
1454
  const targetId = databaseId(host);
1429
1455
  const result = upsertObservedEdge(
1430
1456
  ctx.graph,
1431
- EdgeType2.CONNECTS_TO,
1457
+ EdgeType3.CONNECTS_TO,
1432
1458
  observedSource(),
1433
1459
  targetId,
1434
1460
  ts,
@@ -1444,7 +1470,7 @@ async function handleSpan(ctx, span) {
1444
1470
  if (targetId && targetId !== sourceId) {
1445
1471
  upsertObservedEdge(
1446
1472
  ctx.graph,
1447
- EdgeType2.CALLS,
1473
+ EdgeType3.CALLS,
1448
1474
  observedSource(),
1449
1475
  targetId,
1450
1476
  ts,
@@ -1456,7 +1482,7 @@ async function handleSpan(ctx, span) {
1456
1482
  const frontierNodeId = ensureFrontierNode(ctx.graph, host, ts);
1457
1483
  upsertObservedEdge(
1458
1484
  ctx.graph,
1459
- EdgeType2.CALLS,
1485
+ EdgeType3.CALLS,
1460
1486
  observedSource(),
1461
1487
  frontierNodeId,
1462
1488
  ts,
@@ -1472,7 +1498,7 @@ async function handleSpan(ctx, span) {
1472
1498
  const parentId = ensureServiceNode(ctx.graph, parent.service, parent.env);
1473
1499
  upsertObservedEdge(
1474
1500
  ctx.graph,
1475
- EdgeType2.CALLS,
1501
+ EdgeType3.CALLS,
1476
1502
  parentId,
1477
1503
  sourceId,
1478
1504
  ts,
@@ -2418,7 +2444,7 @@ async function addServiceAliases(graph, scanPath, services) {
2418
2444
  // src/extract/databases/index.ts
2419
2445
  import path17 from "path";
2420
2446
  import {
2421
- EdgeType as EdgeType3,
2447
+ EdgeType as EdgeType4,
2422
2448
  NodeType as NodeType6,
2423
2449
  Provenance as Provenance2,
2424
2450
  databaseId as databaseId2,
@@ -2993,10 +3019,10 @@ async function addDatabasesAndCompat(graph, services, scanPath) {
2993
3019
  });
2994
3020
  }
2995
3021
  const edge = {
2996
- id: extractedEdgeId2(service.node.id, dbNode.id, EdgeType3.CONNECTS_TO),
3022
+ id: extractedEdgeId2(service.node.id, dbNode.id, EdgeType4.CONNECTS_TO),
2997
3023
  source: service.node.id,
2998
3024
  target: dbNode.id,
2999
- type: EdgeType3.CONNECTS_TO,
3025
+ type: EdgeType4.CONNECTS_TO,
3000
3026
  provenance: Provenance2.EXTRACTED,
3001
3027
  confidence: confidenceForExtracted("structural"),
3002
3028
  // ADR-032 / #140 — every EXTRACTED edge carries evidence.file.
@@ -3032,7 +3058,7 @@ async function addDatabasesAndCompat(graph, services, scanPath) {
3032
3058
  import { promises as fs12 } from "fs";
3033
3059
  import path18 from "path";
3034
3060
  import {
3035
- EdgeType as EdgeType4,
3061
+ EdgeType as EdgeType5,
3036
3062
  NodeType as NodeType7,
3037
3063
  Provenance as Provenance3,
3038
3064
  configId,
@@ -3075,10 +3101,10 @@ async function addConfigNodes(graph, services, scanPath) {
3075
3101
  nodesAdded++;
3076
3102
  }
3077
3103
  const edge = {
3078
- id: extractedEdgeId2(service.node.id, node.id, EdgeType4.CONFIGURED_BY),
3104
+ id: extractedEdgeId2(service.node.id, node.id, EdgeType5.CONFIGURED_BY),
3079
3105
  source: service.node.id,
3080
3106
  target: node.id,
3081
- type: EdgeType4.CONFIGURED_BY,
3107
+ type: EdgeType5.CONFIGURED_BY,
3082
3108
  provenance: Provenance3.EXTRACTED,
3083
3109
  confidence: confidenceForExtracted2("structural"),
3084
3110
  evidence: { file: relPath.split(path18.sep).join("/") }
@@ -3094,7 +3120,7 @@ async function addConfigNodes(graph, services, scanPath) {
3094
3120
 
3095
3121
  // src/extract/calls/index.ts
3096
3122
  import {
3097
- EdgeType as EdgeType7,
3123
+ EdgeType as EdgeType8,
3098
3124
  NodeType as NodeType9,
3099
3125
  Provenance as Provenance6,
3100
3126
  confidenceForExtracted as confidenceForExtracted5,
@@ -3107,7 +3133,7 @@ import Parser from "tree-sitter";
3107
3133
  import JavaScript from "tree-sitter-javascript";
3108
3134
  import Python from "tree-sitter-python";
3109
3135
  import {
3110
- EdgeType as EdgeType6,
3136
+ EdgeType as EdgeType7,
3111
3137
  Provenance as Provenance5,
3112
3138
  confidenceForExtracted as confidenceForExtracted4,
3113
3139
  passesExtractedFloor
@@ -3117,7 +3143,7 @@ import {
3117
3143
  import { promises as fs13 } from "fs";
3118
3144
  import path19 from "path";
3119
3145
  import {
3120
- EdgeType as EdgeType5,
3146
+ EdgeType as EdgeType6,
3121
3147
  NodeType as NodeType8,
3122
3148
  Provenance as Provenance4,
3123
3149
  confidenceForExtracted as confidenceForExtracted3,
@@ -3199,13 +3225,13 @@ function ensureFileNode(graph, serviceName, serviceNodeId, relPath) {
3199
3225
  graph.addNode(fileNodeId, node);
3200
3226
  nodesAdded++;
3201
3227
  }
3202
- const containsId = extractedEdgeId3(serviceNodeId, fileNodeId, EdgeType5.CONTAINS);
3228
+ const containsId = extractedEdgeId3(serviceNodeId, fileNodeId, EdgeType6.CONTAINS);
3203
3229
  if (!graph.hasEdge(containsId)) {
3204
3230
  const edge = {
3205
3231
  id: containsId,
3206
3232
  source: serviceNodeId,
3207
3233
  target: fileNodeId,
3208
- type: EdgeType5.CONTAINS,
3234
+ type: EdgeType6.CONTAINS,
3209
3235
  provenance: Provenance4.EXTRACTED,
3210
3236
  confidence: confidenceForExtracted3("structural"),
3211
3237
  evidence: { file: relPath }
@@ -3309,32 +3335,32 @@ async function addHttpCallEdges(graph, services) {
3309
3335
  line: site.line,
3310
3336
  snippet: snippet(file.content, site.line)
3311
3337
  };
3338
+ const { fileNodeId, nodesAdded: n, edgesAdded: e } = ensureFileNode(
3339
+ graph,
3340
+ service.pkg.name,
3341
+ service.node.id,
3342
+ relFile
3343
+ );
3344
+ nodesAdded += n;
3345
+ edgesAdded += e;
3312
3346
  if (!passesExtractedFloor(confidence)) {
3313
3347
  noteExtractedDropped({
3314
- source: service.node.id,
3348
+ source: fileNodeId,
3315
3349
  target: targetId,
3316
- type: EdgeType6.CALLS,
3350
+ type: EdgeType7.CALLS,
3317
3351
  confidence,
3318
3352
  confidenceKind: "hostname-shape-match",
3319
3353
  evidence: ev
3320
3354
  });
3321
3355
  continue;
3322
3356
  }
3323
- const { fileNodeId, nodesAdded: n, edgesAdded: e } = ensureFileNode(
3324
- graph,
3325
- service.pkg.name,
3326
- service.node.id,
3327
- relFile
3328
- );
3329
- nodesAdded += n;
3330
- edgesAdded += e;
3331
- const edgeId = extractedEdgeId2(fileNodeId, targetId, EdgeType6.CALLS);
3357
+ const edgeId = extractedEdgeId2(fileNodeId, targetId, EdgeType7.CALLS);
3332
3358
  if (!graph.hasEdge(edgeId)) {
3333
3359
  const edge = {
3334
3360
  id: edgeId,
3335
3361
  source: fileNodeId,
3336
3362
  target: targetId,
3337
- type: EdgeType6.CALLS,
3363
+ type: EdgeType7.CALLS,
3338
3364
  provenance: Provenance5.EXTRACTED,
3339
3365
  confidence,
3340
3366
  evidence: ev
@@ -3554,11 +3580,11 @@ function grpcEndpointsFromFile(file, serviceDir) {
3554
3580
  function edgeTypeFromEndpoint(ep) {
3555
3581
  switch (ep.edgeType) {
3556
3582
  case "PUBLISHES_TO":
3557
- return EdgeType7.PUBLISHES_TO;
3583
+ return EdgeType8.PUBLISHES_TO;
3558
3584
  case "CONSUMES_FROM":
3559
- return EdgeType7.CONSUMES_FROM;
3585
+ return EdgeType8.CONSUMES_FROM;
3560
3586
  default:
3561
- return EdgeType7.CALLS;
3587
+ return EdgeType8.CALLS;
3562
3588
  }
3563
3589
  }
3564
3590
  function isAwsKind(kind) {
@@ -3598,9 +3624,18 @@ async function addExternalEndpointEdges(graph, services) {
3598
3624
  }
3599
3625
  const edgeType = edgeTypeFromEndpoint(ep);
3600
3626
  const confidence = confidenceForExtracted5(ep.confidenceKind);
3627
+ const relFile = toPosix2(ep.evidence.file);
3628
+ const { fileNodeId, nodesAdded: n, edgesAdded: e } = ensureFileNode(
3629
+ graph,
3630
+ service.pkg.name,
3631
+ service.node.id,
3632
+ relFile
3633
+ );
3634
+ nodesAdded += n;
3635
+ edgesAdded += e;
3601
3636
  if (!passesExtractedFloor2(confidence)) {
3602
3637
  noteExtractedDropped({
3603
- source: service.node.id,
3638
+ source: fileNodeId,
3604
3639
  target: ep.infraId,
3605
3640
  type: edgeType,
3606
3641
  confidence,
@@ -3609,15 +3644,6 @@ async function addExternalEndpointEdges(graph, services) {
3609
3644
  });
3610
3645
  continue;
3611
3646
  }
3612
- const relFile = toPosix2(ep.evidence.file);
3613
- const { fileNodeId, nodesAdded: n, edgesAdded: e } = ensureFileNode(
3614
- graph,
3615
- service.pkg.name,
3616
- service.node.id,
3617
- relFile
3618
- );
3619
- nodesAdded += n;
3620
- edgesAdded += e;
3621
3647
  const edgeId = extractedEdgeId2(fileNodeId, ep.infraId, edgeType);
3622
3648
  if (seenEdges.has(edgeId)) continue;
3623
3649
  seenEdges.add(edgeId);
@@ -3649,7 +3675,7 @@ async function addCallEdges(graph, services) {
3649
3675
 
3650
3676
  // src/extract/infra/docker-compose.ts
3651
3677
  import path25 from "path";
3652
- import { EdgeType as EdgeType8, Provenance as Provenance7, confidenceForExtracted as confidenceForExtracted6 } from "@neat.is/types";
3678
+ import { EdgeType as EdgeType9, Provenance as Provenance7, confidenceForExtracted as confidenceForExtracted6 } from "@neat.is/types";
3653
3679
 
3654
3680
  // src/extract/infra/shared.ts
3655
3681
  import { NodeType as NodeType10, infraId as infraId5 } from "@neat.is/types";
@@ -3735,13 +3761,13 @@ async function addComposeInfra(graph, scanPath, services) {
3735
3761
  for (const dep of dependsOnList(svc.depends_on)) {
3736
3762
  const targetId = composeNameToNodeId.get(dep);
3737
3763
  if (!targetId) continue;
3738
- const edgeId = extractedEdgeId2(sourceId, targetId, EdgeType8.DEPENDS_ON);
3764
+ const edgeId = extractedEdgeId2(sourceId, targetId, EdgeType9.DEPENDS_ON);
3739
3765
  if (graph.hasEdge(edgeId)) continue;
3740
3766
  const edge = {
3741
3767
  id: edgeId,
3742
3768
  source: sourceId,
3743
3769
  target: targetId,
3744
- type: EdgeType8.DEPENDS_ON,
3770
+ type: EdgeType9.DEPENDS_ON,
3745
3771
  provenance: Provenance7.EXTRACTED,
3746
3772
  confidence: confidenceForExtracted6("structural"),
3747
3773
  evidence: { file: evidenceFile }
@@ -3756,7 +3782,7 @@ async function addComposeInfra(graph, scanPath, services) {
3756
3782
  // src/extract/infra/dockerfile.ts
3757
3783
  import path26 from "path";
3758
3784
  import { promises as fs14 } from "fs";
3759
- import { EdgeType as EdgeType9, Provenance as Provenance8, confidenceForExtracted as confidenceForExtracted7 } from "@neat.is/types";
3785
+ import { EdgeType as EdgeType10, Provenance as Provenance8, confidenceForExtracted as confidenceForExtracted7 } from "@neat.is/types";
3760
3786
  function runtimeImage(content) {
3761
3787
  const lines = content.split("\n");
3762
3788
  let last = null;
@@ -3795,13 +3821,13 @@ async function addDockerfileRuntimes(graph, services, scanPath) {
3795
3821
  graph.addNode(node.id, node);
3796
3822
  nodesAdded++;
3797
3823
  }
3798
- const edgeId = extractedEdgeId2(service.node.id, node.id, EdgeType9.RUNS_ON);
3824
+ const edgeId = extractedEdgeId2(service.node.id, node.id, EdgeType10.RUNS_ON);
3799
3825
  if (!graph.hasEdge(edgeId)) {
3800
3826
  const edge = {
3801
3827
  id: edgeId,
3802
3828
  source: service.node.id,
3803
3829
  target: node.id,
3804
- type: EdgeType9.RUNS_ON,
3830
+ type: EdgeType10.RUNS_ON,
3805
3831
  provenance: Provenance8.EXTRACTED,
3806
3832
  confidence: confidenceForExtracted7("structural"),
3807
3833
  evidence: {
@@ -4038,7 +4064,7 @@ async function extractFromDirectory(graph, scanPath, opts = {}) {
4038
4064
  // src/divergences.ts
4039
4065
  import {
4040
4066
  DivergenceResultSchema,
4041
- EdgeType as EdgeType10,
4067
+ EdgeType as EdgeType11,
4042
4068
  NodeType as NodeType12,
4043
4069
  parseEdgeId,
4044
4070
  Provenance as Provenance10
@@ -4095,7 +4121,7 @@ function gradedConfidence(edge) {
4095
4121
  }
4096
4122
  function detectMissingDivergences(graph, bucket) {
4097
4123
  const out = [];
4098
- if (bucket.type === EdgeType10.CONTAINS) return out;
4124
+ if (bucket.type === EdgeType11.CONTAINS) return out;
4099
4125
  if (bucket.extracted && !bucket.observed) {
4100
4126
  if (!nodeIsFrontier(graph, bucket.target)) {
4101
4127
  out.push({
@@ -4136,7 +4162,7 @@ function declaredHostFor(svc) {
4136
4162
  function hasExtractedConfiguredBy(graph, svcId) {
4137
4163
  for (const edgeId of graph.outboundEdges(svcId)) {
4138
4164
  const e = graph.getEdgeAttributes(edgeId);
4139
- if (e.type === EdgeType10.CONFIGURED_BY && e.provenance === Provenance10.EXTRACTED) {
4165
+ if (e.type === EdgeType11.CONFIGURED_BY && e.provenance === Provenance10.EXTRACTED) {
4140
4166
  return true;
4141
4167
  }
4142
4168
  }
@@ -4149,7 +4175,7 @@ function detectHostMismatch(graph, svcId, svc) {
4149
4175
  const out = [];
4150
4176
  for (const edgeId of graph.outboundEdges(svcId)) {
4151
4177
  const edge = graph.getEdgeAttributes(edgeId);
4152
- if (edge.type !== EdgeType10.CONNECTS_TO) continue;
4178
+ if (edge.type !== EdgeType11.CONNECTS_TO) continue;
4153
4179
  if (edge.provenance !== Provenance10.OBSERVED) continue;
4154
4180
  const target = graph.getNodeAttributes(edge.target);
4155
4181
  if (target.type !== NodeType12.DatabaseNode) continue;
@@ -4174,7 +4200,7 @@ function detectCompatDivergences(graph, svcId, svc) {
4174
4200
  const deps = svc.dependencies ?? {};
4175
4201
  for (const edgeId of graph.outboundEdges(svcId)) {
4176
4202
  const edge = graph.getEdgeAttributes(edgeId);
4177
- if (edge.type !== EdgeType10.CONNECTS_TO) continue;
4203
+ if (edge.type !== EdgeType11.CONNECTS_TO) continue;
4178
4204
  if (edge.provenance !== Provenance10.OBSERVED) continue;
4179
4205
  const target = graph.getNodeAttributes(edge.target);
4180
4206
  if (target.type !== NodeType12.DatabaseNode) continue;
@@ -5155,14 +5181,18 @@ function registerRoutes(scope, ctx) {
5155
5181
  async function buildApi(opts) {
5156
5182
  const app = Fastify({ logger: false });
5157
5183
  await app.register(cors, { origin: true });
5184
+ const env = readAuthEnv();
5185
+ const authToken = opts.authToken ?? env.authToken;
5186
+ const trustProxy = opts.trustProxy ?? env.trustProxy;
5187
+ const publicRead = opts.publicRead ?? env.publicRead;
5158
5188
  mountBearerAuth(app, {
5159
- token: opts.authToken,
5160
- trustProxy: opts.trustProxy,
5161
- publicRead: opts.publicRead
5189
+ token: authToken,
5190
+ trustProxy,
5191
+ publicRead
5162
5192
  });
5163
5193
  app.get("/api/config", async () => ({
5164
- publicRead: opts.publicRead === true,
5165
- authProxy: opts.trustProxy === true
5194
+ publicRead: publicRead === true,
5195
+ authProxy: trustProxy === true
5166
5196
  }));
5167
5197
  const startedAt = opts.startedAt ?? Date.now();
5168
5198
  const registry = buildLegacyRegistry(opts);
@@ -5311,4 +5341,4 @@ export {
5311
5341
  removeProject,
5312
5342
  buildApi
5313
5343
  };
5314
- //# sourceMappingURL=chunk-7FTK47JQ.js.map
5344
+ //# sourceMappingURL=chunk-J5CEKCTR.js.map