@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.cjs
CHANGED
|
@@ -341,6 +341,11 @@ function pickEnv(spanAttrs, resourceAttrs) {
|
|
|
341
341
|
}
|
|
342
342
|
return ENV_FALLBACK;
|
|
343
343
|
}
|
|
344
|
+
function normalizeDbSystem(attrs) {
|
|
345
|
+
const raw = attrs["db.system"];
|
|
346
|
+
if (typeof raw !== "string") return void 0;
|
|
347
|
+
return raw === "mongoose" ? "mongodb" : raw;
|
|
348
|
+
}
|
|
344
349
|
function messagingDestinationOf(attrs) {
|
|
345
350
|
for (const key of ["messaging.destination.name", "messaging.destination"]) {
|
|
346
351
|
const v = attrs[key];
|
|
@@ -395,7 +400,7 @@ function parseOtlpRequest(body) {
|
|
|
395
400
|
durationNanos: durationNanos(span.startTimeUnixNano, span.endTimeUnixNano),
|
|
396
401
|
env: pickEnv(attrs, resourceAttrs),
|
|
397
402
|
attributes: attrs,
|
|
398
|
-
dbSystem:
|
|
403
|
+
dbSystem: normalizeDbSystem(attrs),
|
|
399
404
|
dbName: typeof attrs["db.name"] === "string" ? attrs["db.name"] : void 0,
|
|
400
405
|
dbCollection: typeof attrs["db.collection.name"] === "string" ? attrs["db.collection.name"] : typeof attrs["db.mongodb.collection"] === "string" ? attrs["db.mongodb.collection"] : void 0,
|
|
401
406
|
messagingSystem: typeof attrs["messaging.system"] === "string" ? attrs["messaging.system"] : void 0,
|
|
@@ -9872,6 +9877,42 @@ function registerRoutes(scope, ctx) {
|
|
|
9872
9877
|
return reply.code(500).send({ error: err.message });
|
|
9873
9878
|
}
|
|
9874
9879
|
});
|
|
9880
|
+
scope.get("/instrumentation", async (req, reply) => {
|
|
9881
|
+
const proj = resolveProject(registry, req, reply, ctx.bootstrap, ctx.singleProject);
|
|
9882
|
+
if (!proj) return;
|
|
9883
|
+
if (!proj.scanPath) {
|
|
9884
|
+
return { engaged: null };
|
|
9885
|
+
}
|
|
9886
|
+
try {
|
|
9887
|
+
const state = await describeProjectInstrumentation({ project: proj.name, scanPath: proj.scanPath });
|
|
9888
|
+
const uninstrumented = await listUninstrumented({ project: proj.name, scanPath: proj.scanPath });
|
|
9889
|
+
if (state.hookFiles.length === 0) {
|
|
9890
|
+
return {
|
|
9891
|
+
engaged: false,
|
|
9892
|
+
diagnosis: {
|
|
9893
|
+
reason: "No instrumented entry point found \u2014 NEAT hasn't written an OTel init hook for this project.",
|
|
9894
|
+
fixCommand: "neat init",
|
|
9895
|
+
detail: "Run `neat init` so NEAT writes the instrumentation hook next to your entry point, then run your app."
|
|
9896
|
+
}
|
|
9897
|
+
};
|
|
9898
|
+
}
|
|
9899
|
+
if (uninstrumented.length > 0) {
|
|
9900
|
+
const names = uninstrumented.map((u) => u.library);
|
|
9901
|
+
const more = names.length > 1 ? ` (and ${names.length - 1} more)` : "";
|
|
9902
|
+
return {
|
|
9903
|
+
engaged: false,
|
|
9904
|
+
diagnosis: {
|
|
9905
|
+
reason: `\`${names[0]}\`${more} isn't in the auto-instrumentation set, so spans from it won't reach the graph.`,
|
|
9906
|
+
fixCommand: "neat extend",
|
|
9907
|
+
detail: `Uninstrumented on your hot path: ${names.join(", ")}. Run \`neat extend\` to wire the missing instrumentation.`
|
|
9908
|
+
}
|
|
9909
|
+
};
|
|
9910
|
+
}
|
|
9911
|
+
return { engaged: true };
|
|
9912
|
+
} catch {
|
|
9913
|
+
return { engaged: null };
|
|
9914
|
+
}
|
|
9915
|
+
});
|
|
9875
9916
|
scope.post("/extend/apply", async (req, reply) => {
|
|
9876
9917
|
const proj = resolveProject(registry, req, reply, ctx.bootstrap, ctx.singleProject);
|
|
9877
9918
|
if (!proj) return;
|
|
@@ -11742,15 +11783,21 @@ var PROVIDER_DISPATCH = {
|
|
|
11742
11783
|
resolveTarget: createCloudflareResolveTarget(config, graph)
|
|
11743
11784
|
};
|
|
11744
11785
|
},
|
|
11745
|
-
// GET /
|
|
11746
|
-
//
|
|
11786
|
+
// GET /accounts/{accountId}/tokens/verify — the *account-scoped* token-verify
|
|
11787
|
+
// endpoint. A Workers connector token is scoped to the account, and the
|
|
11788
|
+
// user-level `GET /user/tokens/verify` returns 401 "Invalid API Token" for
|
|
11789
|
+
// such a token even though it authenticates fine against the account's own
|
|
11790
|
+
// resources (confirmed live). Probing the account-scoped verify endpoint —
|
|
11791
|
+
// `accountId` is already required for this provider — returns 200
|
|
11792
|
+
// `{status:"active"}` for a working token and 401 for a bad one, so a valid
|
|
11793
|
+
// Workers token is no longer falsely rejected at `neat connector add`.
|
|
11747
11794
|
validate({ credentials, options, fetchImpl }) {
|
|
11748
11795
|
const cfg = options;
|
|
11749
11796
|
const baseUrl = cfg.baseUrl ?? CLOUDFLARE_API_BASE_URL;
|
|
11750
11797
|
return authProbe({
|
|
11751
11798
|
provider: "cloudflare",
|
|
11752
11799
|
accountKey: cfg.accountId ?? "validate",
|
|
11753
|
-
url: `${baseUrl}/
|
|
11800
|
+
url: `${baseUrl}/accounts/${cfg.accountId ?? ""}/tokens/verify`,
|
|
11754
11801
|
token: String(credentials.apiToken ?? ""),
|
|
11755
11802
|
...fetchImpl ? { fetchImpl } : {}
|
|
11756
11803
|
});
|