@neat.is/core 0.5.4-dev.20260721 → 0.6.0
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-VR73QNJD.js → chunk-5PVQJLPR.js} +12 -6
- package/dist/{chunk-VR73QNJD.js.map → chunk-5PVQJLPR.js.map} +1 -1
- package/dist/{chunk-I4NZ7PSN.js → chunk-BZ3AJVAC.js} +8 -3
- package/dist/chunk-BZ3AJVAC.js.map +1 -0
- package/dist/{chunk-PEFX3DBR.js → chunk-CS4GHQO3.js} +38 -2
- package/dist/{chunk-PEFX3DBR.js.map → chunk-CS4GHQO3.js.map} +1 -1
- package/dist/{chunk-4RU3AAOI.js → chunk-MVINCLQM.js} +2 -2
- package/dist/cli.cjs +96 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +49 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +51 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/neatd.cjs +51 -4
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +3 -3
- package/dist/{otel-grpc-TEGOXE6T.js → otel-grpc-XS45HBET.js} +3 -3
- package/dist/server.cjs +42 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-I4NZ7PSN.js.map +0 -1
- /package/dist/{chunk-4RU3AAOI.js.map → chunk-MVINCLQM.js.map} +0 -0
- /package/dist/{otel-grpc-TEGOXE6T.js.map → otel-grpc-XS45HBET.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-5PVQJLPR.js";
|
|
5
5
|
import {
|
|
6
6
|
ProjectNameCollisionError,
|
|
7
7
|
addProject,
|
|
@@ -37,15 +37,15 @@ import {
|
|
|
37
37
|
thresholdForEdgeType,
|
|
38
38
|
touchLastSeen,
|
|
39
39
|
writeAtomically
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-CS4GHQO3.js";
|
|
41
41
|
import {
|
|
42
42
|
startOtelGrpcReceiver
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-MVINCLQM.js";
|
|
44
44
|
import {
|
|
45
45
|
buildOtelReceiver,
|
|
46
46
|
logSpanHandler,
|
|
47
47
|
parseOtlpRequest
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-BZ3AJVAC.js";
|
|
49
49
|
export {
|
|
50
50
|
ProjectNameCollisionError,
|
|
51
51
|
addProject,
|
package/dist/neatd.cjs
CHANGED
|
@@ -342,6 +342,11 @@ function pickEnv(spanAttrs, resourceAttrs) {
|
|
|
342
342
|
}
|
|
343
343
|
return ENV_FALLBACK;
|
|
344
344
|
}
|
|
345
|
+
function normalizeDbSystem(attrs) {
|
|
346
|
+
const raw = attrs["db.system"];
|
|
347
|
+
if (typeof raw !== "string") return void 0;
|
|
348
|
+
return raw === "mongoose" ? "mongodb" : raw;
|
|
349
|
+
}
|
|
345
350
|
function messagingDestinationOf(attrs) {
|
|
346
351
|
for (const key of ["messaging.destination.name", "messaging.destination"]) {
|
|
347
352
|
const v = attrs[key];
|
|
@@ -396,7 +401,7 @@ function parseOtlpRequest(body) {
|
|
|
396
401
|
durationNanos: durationNanos(span.startTimeUnixNano, span.endTimeUnixNano),
|
|
397
402
|
env: pickEnv(attrs, resourceAttrs),
|
|
398
403
|
attributes: attrs,
|
|
399
|
-
dbSystem:
|
|
404
|
+
dbSystem: normalizeDbSystem(attrs),
|
|
400
405
|
dbName: typeof attrs["db.name"] === "string" ? attrs["db.name"] : void 0,
|
|
401
406
|
dbCollection: typeof attrs["db.collection.name"] === "string" ? attrs["db.collection.name"] : typeof attrs["db.mongodb.collection"] === "string" ? attrs["db.mongodb.collection"] : void 0,
|
|
402
407
|
messagingSystem: typeof attrs["messaging.system"] === "string" ? attrs["messaging.system"] : void 0,
|
|
@@ -9774,6 +9779,42 @@ function registerRoutes(scope, ctx) {
|
|
|
9774
9779
|
return reply.code(500).send({ error: err.message });
|
|
9775
9780
|
}
|
|
9776
9781
|
});
|
|
9782
|
+
scope.get("/instrumentation", async (req2, reply) => {
|
|
9783
|
+
const proj = resolveProject(registry, req2, reply, ctx.bootstrap, ctx.singleProject);
|
|
9784
|
+
if (!proj) return;
|
|
9785
|
+
if (!proj.scanPath) {
|
|
9786
|
+
return { engaged: null };
|
|
9787
|
+
}
|
|
9788
|
+
try {
|
|
9789
|
+
const state = await describeProjectInstrumentation({ project: proj.name, scanPath: proj.scanPath });
|
|
9790
|
+
const uninstrumented = await listUninstrumented({ project: proj.name, scanPath: proj.scanPath });
|
|
9791
|
+
if (state.hookFiles.length === 0) {
|
|
9792
|
+
return {
|
|
9793
|
+
engaged: false,
|
|
9794
|
+
diagnosis: {
|
|
9795
|
+
reason: "No instrumented entry point found \u2014 NEAT hasn't written an OTel init hook for this project.",
|
|
9796
|
+
fixCommand: "neat init",
|
|
9797
|
+
detail: "Run `neat init` so NEAT writes the instrumentation hook next to your entry point, then run your app."
|
|
9798
|
+
}
|
|
9799
|
+
};
|
|
9800
|
+
}
|
|
9801
|
+
if (uninstrumented.length > 0) {
|
|
9802
|
+
const names = uninstrumented.map((u) => u.library);
|
|
9803
|
+
const more = names.length > 1 ? ` (and ${names.length - 1} more)` : "";
|
|
9804
|
+
return {
|
|
9805
|
+
engaged: false,
|
|
9806
|
+
diagnosis: {
|
|
9807
|
+
reason: `\`${names[0]}\`${more} isn't in the auto-instrumentation set, so spans from it won't reach the graph.`,
|
|
9808
|
+
fixCommand: "neat extend",
|
|
9809
|
+
detail: `Uninstrumented on your hot path: ${names.join(", ")}. Run \`neat extend\` to wire the missing instrumentation.`
|
|
9810
|
+
}
|
|
9811
|
+
};
|
|
9812
|
+
}
|
|
9813
|
+
return { engaged: true };
|
|
9814
|
+
} catch {
|
|
9815
|
+
return { engaged: null };
|
|
9816
|
+
}
|
|
9817
|
+
});
|
|
9777
9818
|
scope.post("/extend/apply", async (req2, reply) => {
|
|
9778
9819
|
const proj = resolveProject(registry, req2, reply, ctx.bootstrap, ctx.singleProject);
|
|
9779
9820
|
if (!proj) return;
|
|
@@ -11636,15 +11677,21 @@ var PROVIDER_DISPATCH = {
|
|
|
11636
11677
|
resolveTarget: createCloudflareResolveTarget(config, graph)
|
|
11637
11678
|
};
|
|
11638
11679
|
},
|
|
11639
|
-
// GET /
|
|
11640
|
-
//
|
|
11680
|
+
// GET /accounts/{accountId}/tokens/verify — the *account-scoped* token-verify
|
|
11681
|
+
// endpoint. A Workers connector token is scoped to the account, and the
|
|
11682
|
+
// user-level `GET /user/tokens/verify` returns 401 "Invalid API Token" for
|
|
11683
|
+
// such a token even though it authenticates fine against the account's own
|
|
11684
|
+
// resources (confirmed live). Probing the account-scoped verify endpoint —
|
|
11685
|
+
// `accountId` is already required for this provider — returns 200
|
|
11686
|
+
// `{status:"active"}` for a working token and 401 for a bad one, so a valid
|
|
11687
|
+
// Workers token is no longer falsely rejected at `neat connector add`.
|
|
11641
11688
|
validate({ credentials, options, fetchImpl }) {
|
|
11642
11689
|
const cfg = options;
|
|
11643
11690
|
const baseUrl = cfg.baseUrl ?? CLOUDFLARE_API_BASE_URL;
|
|
11644
11691
|
return authProbe({
|
|
11645
11692
|
provider: "cloudflare",
|
|
11646
11693
|
accountKey: cfg.accountId ?? "validate",
|
|
11647
|
-
url: `${baseUrl}/
|
|
11694
|
+
url: `${baseUrl}/accounts/${cfg.accountId ?? ""}/tokens/verify`,
|
|
11648
11695
|
token: String(credentials.apiToken ?? ""),
|
|
11649
11696
|
...fetchImpl ? { fetchImpl } : {}
|
|
11650
11697
|
});
|