@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/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveHost,
|
|
7
7
|
resolveNeatVersion,
|
|
8
8
|
writeDaemonRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ICO37D3H.js";
|
|
10
10
|
import {
|
|
11
11
|
buildSearchIndex
|
|
12
12
|
} from "./chunk-BC53SCT7.js";
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
startStalenessLoop,
|
|
75
75
|
upsertConnectorEntry,
|
|
76
76
|
validateConnectorEntry
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-JUVJBH23.js";
|
|
78
78
|
import {
|
|
79
79
|
startOtelGrpcReceiver
|
|
80
80
|
} from "./chunk-FCO5Z3RW.js";
|
package/dist/index.cjs
CHANGED
|
@@ -10233,6 +10233,11 @@ var import_node_path38 = __toESM(require("path"), 1);
|
|
|
10233
10233
|
var import_types28 = require("@neat.is/types");
|
|
10234
10234
|
var PRODUCER_TOPIC_RE = /(?:producer|kafkaProducer)[\s\S]{0,40}?\.send\s*\(\s*\{[\s\S]{0,200}?topic\s*:\s*['"`]([^'"`]+)['"`]/g;
|
|
10235
10235
|
var CONSUMER_TOPIC_RE = /(?:consumer|kafkaConsumer)[\s\S]{0,40}?\.(?:subscribe|run)\s*\(\s*\{[\s\S]{0,200}?topic[s]?\s*:\s*(?:\[\s*)?['"`]([^'"`]+)['"`]/g;
|
|
10236
|
+
var SARAMA_IMPORT_RE = /"[^"]*\/sarama"/;
|
|
10237
|
+
var GO_PRODUCER_RE = /ProducerMessage\s*\{[\s\S]{0,300}?\bTopic\s*:\s*(?:"([^"]+)"|`([^`]+)`|([A-Za-z_]\w*))/g;
|
|
10238
|
+
var GO_CONSUMER_RE = /\.Consume\s*\([\s\S]{0,120}?\[\]string\s*\{([^}]*)\}/g;
|
|
10239
|
+
var GO_STRING_LITERAL_RE = /"([^"]+)"|`([^`]+)`/g;
|
|
10240
|
+
var GO_IDENT_RE = /[A-Za-z_]\w*/g;
|
|
10236
10241
|
function findAll(re, text) {
|
|
10237
10242
|
re.lastIndex = 0;
|
|
10238
10243
|
const out = [];
|
|
@@ -10242,22 +10247,74 @@ function findAll(re, text) {
|
|
|
10242
10247
|
}
|
|
10243
10248
|
return out;
|
|
10244
10249
|
}
|
|
10250
|
+
function resolveGoLiteral(ident, text) {
|
|
10251
|
+
const esc = ident.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10252
|
+
const re = new RegExp(
|
|
10253
|
+
`\\b${esc}(?:\\s+\\w[\\w.\\[\\]*]*)?\\s*(?::=|=)\\s*(?:"([^"]+)"|\`([^\`]+)\`)`
|
|
10254
|
+
);
|
|
10255
|
+
const m = re.exec(text);
|
|
10256
|
+
if (!m) return void 0;
|
|
10257
|
+
return m[1] ?? m[2];
|
|
10258
|
+
}
|
|
10259
|
+
function producerTopicAnchor(match) {
|
|
10260
|
+
const [full] = match;
|
|
10261
|
+
const tokenLen = match[1] ? match[1].length + 2 : match[2] ? match[2].length + 2 : match[3]?.length ?? 0;
|
|
10262
|
+
return match.index + full.length - tokenLen;
|
|
10263
|
+
}
|
|
10264
|
+
function goSaramaEndpoints(text, emit) {
|
|
10265
|
+
if (!SARAMA_IMPORT_RE.test(text)) return;
|
|
10266
|
+
GO_PRODUCER_RE.lastIndex = 0;
|
|
10267
|
+
let m;
|
|
10268
|
+
while ((m = GO_PRODUCER_RE.exec(text)) !== null) {
|
|
10269
|
+
const literal = m[1] ?? m[2];
|
|
10270
|
+
const anchor = producerTopicAnchor(m);
|
|
10271
|
+
if (literal) {
|
|
10272
|
+
emit(literal, "PUBLISHES_TO", anchor);
|
|
10273
|
+
} else if (m[3]) {
|
|
10274
|
+
const resolved = resolveGoLiteral(m[3], text);
|
|
10275
|
+
if (resolved) emit(resolved, "PUBLISHES_TO", anchor);
|
|
10276
|
+
}
|
|
10277
|
+
}
|
|
10278
|
+
GO_CONSUMER_RE.lastIndex = 0;
|
|
10279
|
+
while ((m = GO_CONSUMER_RE.exec(text)) !== null) {
|
|
10280
|
+
const inside = m[1] ?? "";
|
|
10281
|
+
const anchor = m.index + Math.max(0, m[0].indexOf("[]string"));
|
|
10282
|
+
let sawLiteral = false;
|
|
10283
|
+
GO_STRING_LITERAL_RE.lastIndex = 0;
|
|
10284
|
+
let s;
|
|
10285
|
+
while ((s = GO_STRING_LITERAL_RE.exec(inside)) !== null) {
|
|
10286
|
+
const topic = s[1] ?? s[2];
|
|
10287
|
+
if (topic) {
|
|
10288
|
+
emit(topic, "CONSUMES_FROM", anchor);
|
|
10289
|
+
sawLiteral = true;
|
|
10290
|
+
}
|
|
10291
|
+
}
|
|
10292
|
+
if (sawLiteral) continue;
|
|
10293
|
+
GO_IDENT_RE.lastIndex = 0;
|
|
10294
|
+
let id;
|
|
10295
|
+
while ((id = GO_IDENT_RE.exec(inside)) !== null) {
|
|
10296
|
+
const resolved = resolveGoLiteral(id[0], text);
|
|
10297
|
+
if (resolved) emit(resolved, "CONSUMES_FROM", anchor);
|
|
10298
|
+
}
|
|
10299
|
+
}
|
|
10300
|
+
}
|
|
10245
10301
|
function kafkaEndpointsFromFile(file, serviceDir) {
|
|
10246
10302
|
const out = [];
|
|
10247
10303
|
const seen = /* @__PURE__ */ new Set();
|
|
10248
|
-
const make = (topic, edgeType) => {
|
|
10304
|
+
const make = (topic, edgeType, anchor) => {
|
|
10249
10305
|
const key = `${edgeType}|${topic}`;
|
|
10250
10306
|
if (seen.has(key)) return;
|
|
10251
10307
|
seen.add(key);
|
|
10252
|
-
const line = lineOf(file.content, topic);
|
|
10308
|
+
const line = anchor !== void 0 ? file.content.slice(0, anchor).split("\n").length : lineOf(file.content, topic);
|
|
10253
10309
|
out.push({
|
|
10254
10310
|
infraId: (0, import_types28.infraId)("kafka-topic", topic),
|
|
10255
10311
|
name: topic,
|
|
10256
10312
|
kind: "kafka-topic",
|
|
10257
10313
|
edgeType,
|
|
10258
|
-
// `producer.send({topic: 'x'})` / `consumer.subscribe({topic: 'x'})`
|
|
10259
|
-
//
|
|
10260
|
-
//
|
|
10314
|
+
// JS: `producer.send({topic: 'x'})` / `consumer.subscribe({topic: 'x'})`
|
|
10315
|
+
// (kafkajs / node-rdkafka). Go: `sarama.ProducerMessage{Topic: 'x'}` /
|
|
10316
|
+
// `consumerGroup.Consume(ctx, []string{'x'}, …)`. Both are framework-aware
|
|
10317
|
+
// call sites — verified-call-site tier (ADR-066).
|
|
10261
10318
|
confidenceKind: "verified-call-site",
|
|
10262
10319
|
evidence: {
|
|
10263
10320
|
file: import_node_path38.default.relative(serviceDir, file.path),
|
|
@@ -10266,8 +10323,12 @@ function kafkaEndpointsFromFile(file, serviceDir) {
|
|
|
10266
10323
|
}
|
|
10267
10324
|
});
|
|
10268
10325
|
};
|
|
10269
|
-
|
|
10270
|
-
|
|
10326
|
+
if (import_node_path38.default.extname(file.path) === ".go") {
|
|
10327
|
+
goSaramaEndpoints(file.content, make);
|
|
10328
|
+
} else {
|
|
10329
|
+
for (const { topic } of findAll(PRODUCER_TOPIC_RE, file.content)) make(topic, "PUBLISHES_TO");
|
|
10330
|
+
for (const { topic } of findAll(CONSUMER_TOPIC_RE, file.content)) make(topic, "CONSUMES_FROM");
|
|
10331
|
+
}
|
|
10271
10332
|
return out;
|
|
10272
10333
|
}
|
|
10273
10334
|
|