@neat.is/core 0.9.0 → 0.9.1-dev.20260819
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/{chunk-WMYVJXUF.js → chunk-ICO37D3H.js} +2 -2
- package/dist/{chunk-RDLDSIEY.js → chunk-JUVJBH23.js} +69 -8
- package/dist/chunk-JUVJBH23.js.map +1 -0
- package/dist/cli.cjs +68 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/index.cjs +68 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +68 -7
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +2 -2
- package/dist/server.cjs +68 -7
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-RDLDSIEY.js.map +0 -1
- /package/dist/{chunk-WMYVJXUF.js.map → chunk-ICO37D3H.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
routeSpanToProject,
|
|
3
3
|
startDaemon
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ICO37D3H.js";
|
|
5
5
|
import {
|
|
6
6
|
ProjectNameCollisionError,
|
|
7
7
|
addProject,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
thresholdForEdgeType,
|
|
38
38
|
touchLastSeen,
|
|
39
39
|
writeAtomically
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-JUVJBH23.js";
|
|
41
41
|
import {
|
|
42
42
|
startOtelGrpcReceiver
|
|
43
43
|
} from "./chunk-FCO5Z3RW.js";
|
package/dist/neatd.cjs
CHANGED
|
@@ -10193,6 +10193,11 @@ var import_node_path38 = __toESM(require("path"), 1);
|
|
|
10193
10193
|
var import_types28 = require("@neat.is/types");
|
|
10194
10194
|
var PRODUCER_TOPIC_RE = /(?:producer|kafkaProducer)[\s\S]{0,40}?\.send\s*\(\s*\{[\s\S]{0,200}?topic\s*:\s*['"`]([^'"`]+)['"`]/g;
|
|
10195
10195
|
var CONSUMER_TOPIC_RE = /(?:consumer|kafkaConsumer)[\s\S]{0,40}?\.(?:subscribe|run)\s*\(\s*\{[\s\S]{0,200}?topic[s]?\s*:\s*(?:\[\s*)?['"`]([^'"`]+)['"`]/g;
|
|
10196
|
+
var SARAMA_IMPORT_RE = /"[^"]*\/sarama"/;
|
|
10197
|
+
var GO_PRODUCER_RE = /ProducerMessage\s*\{[\s\S]{0,300}?\bTopic\s*:\s*(?:"([^"]+)"|`([^`]+)`|([A-Za-z_]\w*))/g;
|
|
10198
|
+
var GO_CONSUMER_RE = /\.Consume\s*\([\s\S]{0,120}?\[\]string\s*\{([^}]*)\}/g;
|
|
10199
|
+
var GO_STRING_LITERAL_RE = /"([^"]+)"|`([^`]+)`/g;
|
|
10200
|
+
var GO_IDENT_RE = /[A-Za-z_]\w*/g;
|
|
10196
10201
|
function findAll(re, text) {
|
|
10197
10202
|
re.lastIndex = 0;
|
|
10198
10203
|
const out = [];
|
|
@@ -10202,22 +10207,74 @@ function findAll(re, text) {
|
|
|
10202
10207
|
}
|
|
10203
10208
|
return out;
|
|
10204
10209
|
}
|
|
10210
|
+
function resolveGoLiteral(ident, text) {
|
|
10211
|
+
const esc = ident.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10212
|
+
const re = new RegExp(
|
|
10213
|
+
`\\b${esc}(?:\\s+\\w[\\w.\\[\\]*]*)?\\s*(?::=|=)\\s*(?:"([^"]+)"|\`([^\`]+)\`)`
|
|
10214
|
+
);
|
|
10215
|
+
const m = re.exec(text);
|
|
10216
|
+
if (!m) return void 0;
|
|
10217
|
+
return m[1] ?? m[2];
|
|
10218
|
+
}
|
|
10219
|
+
function producerTopicAnchor(match) {
|
|
10220
|
+
const [full] = match;
|
|
10221
|
+
const tokenLen = match[1] ? match[1].length + 2 : match[2] ? match[2].length + 2 : match[3]?.length ?? 0;
|
|
10222
|
+
return match.index + full.length - tokenLen;
|
|
10223
|
+
}
|
|
10224
|
+
function goSaramaEndpoints(text, emit) {
|
|
10225
|
+
if (!SARAMA_IMPORT_RE.test(text)) return;
|
|
10226
|
+
GO_PRODUCER_RE.lastIndex = 0;
|
|
10227
|
+
let m;
|
|
10228
|
+
while ((m = GO_PRODUCER_RE.exec(text)) !== null) {
|
|
10229
|
+
const literal = m[1] ?? m[2];
|
|
10230
|
+
const anchor = producerTopicAnchor(m);
|
|
10231
|
+
if (literal) {
|
|
10232
|
+
emit(literal, "PUBLISHES_TO", anchor);
|
|
10233
|
+
} else if (m[3]) {
|
|
10234
|
+
const resolved = resolveGoLiteral(m[3], text);
|
|
10235
|
+
if (resolved) emit(resolved, "PUBLISHES_TO", anchor);
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
GO_CONSUMER_RE.lastIndex = 0;
|
|
10239
|
+
while ((m = GO_CONSUMER_RE.exec(text)) !== null) {
|
|
10240
|
+
const inside = m[1] ?? "";
|
|
10241
|
+
const anchor = m.index + Math.max(0, m[0].indexOf("[]string"));
|
|
10242
|
+
let sawLiteral = false;
|
|
10243
|
+
GO_STRING_LITERAL_RE.lastIndex = 0;
|
|
10244
|
+
let s;
|
|
10245
|
+
while ((s = GO_STRING_LITERAL_RE.exec(inside)) !== null) {
|
|
10246
|
+
const topic = s[1] ?? s[2];
|
|
10247
|
+
if (topic) {
|
|
10248
|
+
emit(topic, "CONSUMES_FROM", anchor);
|
|
10249
|
+
sawLiteral = true;
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
if (sawLiteral) continue;
|
|
10253
|
+
GO_IDENT_RE.lastIndex = 0;
|
|
10254
|
+
let id;
|
|
10255
|
+
while ((id = GO_IDENT_RE.exec(inside)) !== null) {
|
|
10256
|
+
const resolved = resolveGoLiteral(id[0], text);
|
|
10257
|
+
if (resolved) emit(resolved, "CONSUMES_FROM", anchor);
|
|
10258
|
+
}
|
|
10259
|
+
}
|
|
10260
|
+
}
|
|
10205
10261
|
function kafkaEndpointsFromFile(file, serviceDir) {
|
|
10206
10262
|
const out = [];
|
|
10207
10263
|
const seen = /* @__PURE__ */ new Set();
|
|
10208
|
-
const make = (topic, edgeType) => {
|
|
10264
|
+
const make = (topic, edgeType, anchor) => {
|
|
10209
10265
|
const key = `${edgeType}|${topic}`;
|
|
10210
10266
|
if (seen.has(key)) return;
|
|
10211
10267
|
seen.add(key);
|
|
10212
|
-
const line = lineOf(file.content, topic);
|
|
10268
|
+
const line = anchor !== void 0 ? file.content.slice(0, anchor).split("\n").length : lineOf(file.content, topic);
|
|
10213
10269
|
out.push({
|
|
10214
10270
|
infraId: (0, import_types28.infraId)("kafka-topic", topic),
|
|
10215
10271
|
name: topic,
|
|
10216
10272
|
kind: "kafka-topic",
|
|
10217
10273
|
edgeType,
|
|
10218
|
-
// `producer.send({topic: 'x'})` / `consumer.subscribe({topic: 'x'})`
|
|
10219
|
-
//
|
|
10220
|
-
//
|
|
10274
|
+
// JS: `producer.send({topic: 'x'})` / `consumer.subscribe({topic: 'x'})`
|
|
10275
|
+
// (kafkajs / node-rdkafka). Go: `sarama.ProducerMessage{Topic: 'x'}` /
|
|
10276
|
+
// `consumerGroup.Consume(ctx, []string{'x'}, …)`. Both are framework-aware
|
|
10277
|
+
// call sites — verified-call-site tier (ADR-066).
|
|
10221
10278
|
confidenceKind: "verified-call-site",
|
|
10222
10279
|
evidence: {
|
|
10223
10280
|
file: import_node_path38.default.relative(serviceDir, file.path),
|
|
@@ -10226,8 +10283,12 @@ function kafkaEndpointsFromFile(file, serviceDir) {
|
|
|
10226
10283
|
}
|
|
10227
10284
|
});
|
|
10228
10285
|
};
|
|
10229
|
-
|
|
10230
|
-
|
|
10286
|
+
if (import_node_path38.default.extname(file.path) === ".go") {
|
|
10287
|
+
goSaramaEndpoints(file.content, make);
|
|
10288
|
+
} else {
|
|
10289
|
+
for (const { topic } of findAll(PRODUCER_TOPIC_RE, file.content)) make(topic, "PUBLISHES_TO");
|
|
10290
|
+
for (const { topic } of findAll(CONSUMER_TOPIC_RE, file.content)) make(topic, "CONSUMES_FROM");
|
|
10291
|
+
}
|
|
10231
10292
|
return out;
|
|
10232
10293
|
}
|
|
10233
10294
|
|