@softprobe/softprobe-js 2.0.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/LICENSE +21 -0
- package/README.md +202 -0
- package/bin/softprobe +15 -0
- package/dist/api/baggage.d.ts +13 -0
- package/dist/api/baggage.d.ts.map +1 -0
- package/dist/api/baggage.js +32 -0
- package/dist/api/baggage.js.map +1 -0
- package/dist/api/compare.d.ts +16 -0
- package/dist/api/compare.d.ts.map +1 -0
- package/dist/api/compare.js +77 -0
- package/dist/api/compare.js.map +1 -0
- package/dist/api.d.ts +63 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +104 -0
- package/dist/api.js.map +1 -0
- package/dist/bindings/http-span.d.ts +6 -0
- package/dist/bindings/http-span.d.ts.map +1 -0
- package/dist/bindings/http-span.js +11 -0
- package/dist/bindings/http-span.js.map +1 -0
- package/dist/bindings/postgres-span.d.ts +6 -0
- package/dist/bindings/postgres-span.d.ts.map +1 -0
- package/dist/bindings/postgres-span.js +11 -0
- package/dist/bindings/postgres-span.js.map +1 -0
- package/dist/bindings/redis-span.d.ts +6 -0
- package/dist/bindings/redis-span.d.ts.map +1 -0
- package/dist/bindings/redis-span.js +11 -0
- package/dist/bindings/redis-span.js.map +1 -0
- package/dist/bindings/test-span.d.ts +6 -0
- package/dist/bindings/test-span.d.ts.map +1 -0
- package/dist/bindings/test-span.js +9 -0
- package/dist/bindings/test-span.js.map +1 -0
- package/dist/bootstrap/otel/framework-mutator.d.ts +20 -0
- package/dist/bootstrap/otel/framework-mutator.d.ts.map +1 -0
- package/dist/bootstrap/otel/framework-mutator.js +144 -0
- package/dist/bootstrap/otel/framework-mutator.js.map +1 -0
- package/dist/bootstrap/otel/inject.d.ts +17 -0
- package/dist/bootstrap/otel/inject.d.ts.map +1 -0
- package/dist/bootstrap/otel/inject.js +28 -0
- package/dist/bootstrap/otel/inject.js.map +1 -0
- package/dist/bootstrap/otel/mutator.d.ts +17 -0
- package/dist/bootstrap/otel/mutator.d.ts.map +1 -0
- package/dist/bootstrap/otel/mutator.js +51 -0
- package/dist/bootstrap/otel/mutator.js.map +1 -0
- package/dist/capture/express.d.ts +6 -0
- package/dist/capture/express.d.ts.map +1 -0
- package/dist/capture/express.js +11 -0
- package/dist/capture/express.js.map +1 -0
- package/dist/capture/fastify.d.ts +5 -0
- package/dist/capture/fastify.d.ts.map +1 -0
- package/dist/capture/fastify.js +9 -0
- package/dist/capture/fastify.js.map +1 -0
- package/dist/capture/framework-mutator.d.ts +20 -0
- package/dist/capture/framework-mutator.d.ts.map +1 -0
- package/dist/capture/framework-mutator.js +144 -0
- package/dist/capture/framework-mutator.js.map +1 -0
- package/dist/capture/http-inbound.d.ts +28 -0
- package/dist/capture/http-inbound.d.ts.map +1 -0
- package/dist/capture/http-inbound.js +40 -0
- package/dist/capture/http-inbound.js.map +1 -0
- package/dist/capture/inject.d.ts +17 -0
- package/dist/capture/inject.d.ts.map +1 -0
- package/dist/capture/inject.js +28 -0
- package/dist/capture/inject.js.map +1 -0
- package/dist/capture/mutator.d.ts +17 -0
- package/dist/capture/mutator.d.ts.map +1 -0
- package/dist/capture/mutator.js +51 -0
- package/dist/capture/mutator.js.map +1 -0
- package/dist/capture/postgres.d.ts +6 -0
- package/dist/capture/postgres.d.ts.map +1 -0
- package/dist/capture/postgres.js +11 -0
- package/dist/capture/postgres.js.map +1 -0
- package/dist/capture/redis.d.ts +5 -0
- package/dist/capture/redis.d.ts.map +1 -0
- package/dist/capture/redis.js +10 -0
- package/dist/capture/redis.js.map +1 -0
- package/dist/capture/store-accessor.d.ts +11 -0
- package/dist/capture/store-accessor.d.ts.map +1 -0
- package/dist/capture/store-accessor.js +19 -0
- package/dist/capture/store-accessor.js.map +1 -0
- package/dist/capture/stream-tap.d.ts +5 -0
- package/dist/capture/stream-tap.d.ts.map +1 -0
- package/dist/capture/stream-tap.js +9 -0
- package/dist/capture/stream-tap.js.map +1 -0
- package/dist/cli/diff-reporter.d.ts +26 -0
- package/dist/cli/diff-reporter.d.ts.map +1 -0
- package/dist/cli/diff-reporter.js +163 -0
- package/dist/cli/diff-reporter.js.map +1 -0
- package/dist/cli/diff.d.ts +18 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +105 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +84 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/config-manager.d.ts +20 -0
- package/dist/config/config-manager.d.ts.map +1 -0
- package/dist/config/config-manager.js +46 -0
- package/dist/config/config-manager.js.map +1 -0
- package/dist/context.d.ts +98 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +198 -0
- package/dist/context.js.map +1 -0
- package/dist/core/bindings/http-span.d.ts +39 -0
- package/dist/core/bindings/http-span.d.ts.map +1 -0
- package/dist/core/bindings/http-span.js +55 -0
- package/dist/core/bindings/http-span.js.map +1 -0
- package/dist/core/bindings/index.d.ts +12 -0
- package/dist/core/bindings/index.d.ts.map +1 -0
- package/dist/core/bindings/index.js +21 -0
- package/dist/core/bindings/index.js.map +1 -0
- package/dist/core/bindings/postgres-span.d.ts +41 -0
- package/dist/core/bindings/postgres-span.d.ts.map +1 -0
- package/dist/core/bindings/postgres-span.js +57 -0
- package/dist/core/bindings/postgres-span.js.map +1 -0
- package/dist/core/bindings/redis-span.d.ts +40 -0
- package/dist/core/bindings/redis-span.d.ts.map +1 -0
- package/dist/core/bindings/redis-span.js +65 -0
- package/dist/core/bindings/redis-span.js.map +1 -0
- package/dist/core/bindings/test-span.d.ts +15 -0
- package/dist/core/bindings/test-span.d.ts.map +1 -0
- package/dist/core/bindings/test-span.js +24 -0
- package/dist/core/bindings/test-span.js.map +1 -0
- package/dist/core/cassette/capture-store-accessor.d.ts +11 -0
- package/dist/core/cassette/capture-store-accessor.d.ts.map +1 -0
- package/dist/core/cassette/capture-store-accessor.js +19 -0
- package/dist/core/cassette/capture-store-accessor.js.map +1 -0
- package/dist/core/cassette/context-request-storage.d.ts +14 -0
- package/dist/core/cassette/context-request-storage.d.ts.map +1 -0
- package/dist/core/cassette/context-request-storage.js +24 -0
- package/dist/core/cassette/context-request-storage.js.map +1 -0
- package/dist/core/cassette/index.d.ts +8 -0
- package/dist/core/cassette/index.d.ts.map +1 -0
- package/dist/core/cassette/index.js +16 -0
- package/dist/core/cassette/index.js.map +1 -0
- package/dist/core/cassette/ndjson-cassette.d.ts +22 -0
- package/dist/core/cassette/ndjson-cassette.d.ts.map +1 -0
- package/dist/core/cassette/ndjson-cassette.js +56 -0
- package/dist/core/cassette/ndjson-cassette.js.map +1 -0
- package/dist/core/cassette/request-storage.d.ts +16 -0
- package/dist/core/cassette/request-storage.d.ts.map +1 -0
- package/dist/core/cassette/request-storage.js +22 -0
- package/dist/core/cassette/request-storage.js.map +1 -0
- package/dist/core/context/index.d.ts +5 -0
- package/dist/core/context/index.d.ts.map +1 -0
- package/dist/core/context/index.js +9 -0
- package/dist/core/context/index.js.map +1 -0
- package/dist/core/contracts/index.d.ts +5 -0
- package/dist/core/contracts/index.d.ts.map +1 -0
- package/dist/core/contracts/index.js +3 -0
- package/dist/core/contracts/index.js.map +1 -0
- package/dist/core/identifier.d.ts +20 -0
- package/dist/core/identifier.d.ts.map +1 -0
- package/dist/core/identifier.js +31 -0
- package/dist/core/identifier.js.map +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +27 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/matcher/extract-key.d.ts +41 -0
- package/dist/core/matcher/extract-key.d.ts.map +1 -0
- package/dist/core/matcher/extract-key.js +80 -0
- package/dist/core/matcher/extract-key.js.map +1 -0
- package/dist/core/matcher/index.d.ts +9 -0
- package/dist/core/matcher/index.d.ts.map +1 -0
- package/dist/core/matcher/index.js +24 -0
- package/dist/core/matcher/index.js.map +1 -0
- package/dist/core/matcher/matcher.d.ts +25 -0
- package/dist/core/matcher/matcher.d.ts.map +1 -0
- package/dist/core/matcher/matcher.js +83 -0
- package/dist/core/matcher/matcher.js.map +1 -0
- package/dist/core/matcher/softprobe-matcher.d.ts +41 -0
- package/dist/core/matcher/softprobe-matcher.d.ts.map +1 -0
- package/dist/core/matcher/softprobe-matcher.js +92 -0
- package/dist/core/matcher/softprobe-matcher.js.map +1 -0
- package/dist/core/matcher/store-accessor.d.ts +14 -0
- package/dist/core/matcher/store-accessor.d.ts.map +1 -0
- package/dist/core/matcher/store-accessor.js +25 -0
- package/dist/core/matcher/store-accessor.js.map +1 -0
- package/dist/core/matcher/topology.d.ts +37 -0
- package/dist/core/matcher/topology.d.ts.map +1 -0
- package/dist/core/matcher/topology.js +72 -0
- package/dist/core/matcher/topology.js.map +1 -0
- package/dist/core/runtime/architecture-guard.d.ts +9 -0
- package/dist/core/runtime/architecture-guard.d.ts.map +1 -0
- package/dist/core/runtime/architecture-guard.js +131 -0
- package/dist/core/runtime/architecture-guard.js.map +1 -0
- package/dist/core/runtime/index.d.ts +6 -0
- package/dist/core/runtime/index.d.ts.map +1 -0
- package/dist/core/runtime/index.js +11 -0
- package/dist/core/runtime/index.js.map +1 -0
- package/dist/identifier.d.ts +5 -0
- package/dist/identifier.d.ts.map +1 -0
- package/dist/identifier.js +11 -0
- package/dist/identifier.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +21 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +51 -0
- package/dist/init.js.map +1 -0
- package/dist/instrumentations/common/http/context-headers.d.ts +9 -0
- package/dist/instrumentations/common/http/context-headers.d.ts.map +1 -0
- package/dist/instrumentations/common/http/context-headers.js +16 -0
- package/dist/instrumentations/common/http/context-headers.js.map +1 -0
- package/dist/instrumentations/common/http/inbound-capture.d.ts +17 -0
- package/dist/instrumentations/common/http/inbound-capture.d.ts.map +1 -0
- package/dist/instrumentations/common/http/inbound-capture.js +41 -0
- package/dist/instrumentations/common/http/inbound-capture.js.map +1 -0
- package/dist/instrumentations/common/http/inbound-record.d.ts +28 -0
- package/dist/instrumentations/common/http/inbound-record.d.ts.map +1 -0
- package/dist/instrumentations/common/http/inbound-record.js +40 -0
- package/dist/instrumentations/common/http/inbound-record.js.map +1 -0
- package/dist/instrumentations/common/http/span-adapter.d.ts +6 -0
- package/dist/instrumentations/common/http/span-adapter.d.ts.map +1 -0
- package/dist/instrumentations/common/http/span-adapter.js +12 -0
- package/dist/instrumentations/common/http/span-adapter.js.map +1 -0
- package/dist/instrumentations/common/http/stream-tap.d.ts +28 -0
- package/dist/instrumentations/common/http/stream-tap.d.ts.map +1 -0
- package/dist/instrumentations/common/http/stream-tap.js +61 -0
- package/dist/instrumentations/common/http/stream-tap.js.map +1 -0
- package/dist/instrumentations/express/capture.d.ts +26 -0
- package/dist/instrumentations/express/capture.d.ts.map +1 -0
- package/dist/instrumentations/express/capture.js +80 -0
- package/dist/instrumentations/express/capture.js.map +1 -0
- package/dist/instrumentations/express/index.d.ts +7 -0
- package/dist/instrumentations/express/index.d.ts.map +1 -0
- package/dist/instrumentations/express/index.js +15 -0
- package/dist/instrumentations/express/index.js.map +1 -0
- package/dist/instrumentations/express/replay.d.ts +10 -0
- package/dist/instrumentations/express/replay.d.ts.map +1 -0
- package/dist/instrumentations/express/replay.js +16 -0
- package/dist/instrumentations/express/replay.js.map +1 -0
- package/dist/instrumentations/fastify/capture.d.ts +13 -0
- package/dist/instrumentations/fastify/capture.d.ts.map +1 -0
- package/dist/instrumentations/fastify/capture.js +65 -0
- package/dist/instrumentations/fastify/capture.js.map +1 -0
- package/dist/instrumentations/fastify/index.d.ts +7 -0
- package/dist/instrumentations/fastify/index.d.ts.map +1 -0
- package/dist/instrumentations/fastify/index.js +13 -0
- package/dist/instrumentations/fastify/index.js.map +1 -0
- package/dist/instrumentations/fastify/replay.d.ts +13 -0
- package/dist/instrumentations/fastify/replay.d.ts.map +1 -0
- package/dist/instrumentations/fastify/replay.js +24 -0
- package/dist/instrumentations/fastify/replay.js.map +1 -0
- package/dist/instrumentations/fetch/index.d.ts +5 -0
- package/dist/instrumentations/fetch/index.d.ts.map +1 -0
- package/dist/instrumentations/fetch/index.js +10 -0
- package/dist/instrumentations/fetch/index.js.map +1 -0
- package/dist/instrumentations/fetch/replay.d.ts +19 -0
- package/dist/instrumentations/fetch/replay.d.ts.map +1 -0
- package/dist/instrumentations/fetch/replay.js +259 -0
- package/dist/instrumentations/fetch/replay.js.map +1 -0
- package/dist/instrumentations/postgres/capture.d.ts +46 -0
- package/dist/instrumentations/postgres/capture.d.ts.map +1 -0
- package/dist/instrumentations/postgres/capture.js +68 -0
- package/dist/instrumentations/postgres/capture.js.map +1 -0
- package/dist/instrumentations/postgres/index.d.ts +6 -0
- package/dist/instrumentations/postgres/index.d.ts.map +1 -0
- package/dist/instrumentations/postgres/index.js +14 -0
- package/dist/instrumentations/postgres/index.js.map +1 -0
- package/dist/instrumentations/postgres/replay.d.ts +20 -0
- package/dist/instrumentations/postgres/replay.d.ts.map +1 -0
- package/dist/instrumentations/postgres/replay.js +163 -0
- package/dist/instrumentations/postgres/replay.js.map +1 -0
- package/dist/instrumentations/redis/capture.d.ts +20 -0
- package/dist/instrumentations/redis/capture.d.ts.map +1 -0
- package/dist/instrumentations/redis/capture.js +61 -0
- package/dist/instrumentations/redis/capture.js.map +1 -0
- package/dist/instrumentations/redis/index.d.ts +6 -0
- package/dist/instrumentations/redis/index.d.ts.map +1 -0
- package/dist/instrumentations/redis/index.js +13 -0
- package/dist/instrumentations/redis/index.js.map +1 -0
- package/dist/instrumentations/redis/replay.d.ts +24 -0
- package/dist/instrumentations/redis/replay.d.ts.map +1 -0
- package/dist/instrumentations/redis/replay.js +173 -0
- package/dist/instrumentations/redis/replay.js.map +1 -0
- package/dist/replay/express.d.ts +5 -0
- package/dist/replay/express.d.ts.map +1 -0
- package/dist/replay/express.js +9 -0
- package/dist/replay/express.js.map +1 -0
- package/dist/replay/extract-key.d.ts +41 -0
- package/dist/replay/extract-key.d.ts.map +1 -0
- package/dist/replay/extract-key.js +80 -0
- package/dist/replay/extract-key.js.map +1 -0
- package/dist/replay/fastify.d.ts +5 -0
- package/dist/replay/fastify.d.ts.map +1 -0
- package/dist/replay/fastify.js +9 -0
- package/dist/replay/fastify.js.map +1 -0
- package/dist/replay/http.d.ts +5 -0
- package/dist/replay/http.d.ts.map +1 -0
- package/dist/replay/http.js +10 -0
- package/dist/replay/http.js.map +1 -0
- package/dist/replay/matcher.d.ts +25 -0
- package/dist/replay/matcher.d.ts.map +1 -0
- package/dist/replay/matcher.js +83 -0
- package/dist/replay/matcher.js.map +1 -0
- package/dist/replay/postgres.d.ts +5 -0
- package/dist/replay/postgres.d.ts.map +1 -0
- package/dist/replay/postgres.js +10 -0
- package/dist/replay/postgres.js.map +1 -0
- package/dist/replay/redis.d.ts +5 -0
- package/dist/replay/redis.d.ts.map +1 -0
- package/dist/replay/redis.js +10 -0
- package/dist/replay/redis.js.map +1 -0
- package/dist/replay/softprobe-matcher.d.ts +41 -0
- package/dist/replay/softprobe-matcher.d.ts.map +1 -0
- package/dist/replay/softprobe-matcher.js +92 -0
- package/dist/replay/softprobe-matcher.js.map +1 -0
- package/dist/replay/store-accessor.d.ts +14 -0
- package/dist/replay/store-accessor.d.ts.map +1 -0
- package/dist/replay/store-accessor.js +26 -0
- package/dist/replay/store-accessor.js.map +1 -0
- package/dist/replay/topology.d.ts +37 -0
- package/dist/replay/topology.d.ts.map +1 -0
- package/dist/replay/topology.js +72 -0
- package/dist/replay/topology.js.map +1 -0
- package/dist/store/cassette-store.d.ts +36 -0
- package/dist/store/cassette-store.d.ts.map +1 -0
- package/dist/store/cassette-store.js +66 -0
- package/dist/store/cassette-store.js.map +1 -0
- package/dist/types/schema.d.ts +114 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +13 -0
- package/dist/types/schema.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tagCommand = exports.fromSpan = exports.RedisSpan = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Legacy compatibility re-export for Redis span helpers.
|
|
6
|
+
*/
|
|
7
|
+
var redis_span_1 = require("../core/bindings/redis-span");
|
|
8
|
+
Object.defineProperty(exports, "RedisSpan", { enumerable: true, get: function () { return redis_span_1.RedisSpan; } });
|
|
9
|
+
Object.defineProperty(exports, "fromSpan", { enumerable: true, get: function () { return redis_span_1.fromSpan; } });
|
|
10
|
+
Object.defineProperty(exports, "tagCommand", { enumerable: true, get: function () { return redis_span_1.tagCommand; } });
|
|
11
|
+
//# sourceMappingURL=redis-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-span.js","sourceRoot":"","sources":["../../src/bindings/redis-span.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,0DAA8E;AAArE,uGAAA,SAAS,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-span.d.ts","sourceRoot":"","sources":["../../src/bindings/test-span.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testSpan = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Legacy compatibility re-export for test span helper.
|
|
6
|
+
*/
|
|
7
|
+
var test_span_1 = require("../core/bindings/test-span");
|
|
8
|
+
Object.defineProperty(exports, "testSpan", { enumerable: true, get: function () { return test_span_1.testSpan; } });
|
|
9
|
+
//# sourceMappingURL=test-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-span.js","sourceRoot":"","sources":["../../src/bindings/test-span.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,wDAAsD;AAA7C,qGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework mutators: patch Express and Fastify so Softprobe middleware/hooks
|
|
3
|
+
* are applied without user intervention. Design §16: patch Express app.use so
|
|
4
|
+
* first middleware/route addition triggers our middleware; patch Fastify factory
|
|
5
|
+
* so new instances get the plugin registered.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Patch Express so the first time a route is added (e.g. app.get), we call
|
|
9
|
+
* app.use(softprobeExpressMiddleware) so Softprobe middleware is injected.
|
|
10
|
+
* Express 5 uses app.route() for app.get/post/etc., and mixin(app, proto) copies
|
|
11
|
+
* proto onto each app, so we must patch the shared proto (express.application).
|
|
12
|
+
*/
|
|
13
|
+
export declare function patchExpress(express: (req?: unknown) => unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* Patches Node's require so that when 'express' or 'fastify' is required,
|
|
16
|
+
* the framework is patched to inject Softprobe middleware/hooks. Call from init
|
|
17
|
+
* so that user require('express') or require('fastify') gets the patched version.
|
|
18
|
+
*/
|
|
19
|
+
export declare function applyFrameworkMutators(): void;
|
|
20
|
+
//# sourceMappingURL=framework-mutator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-mutator.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/otel/framework-mutator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,CAiBtE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAgF7C"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Framework mutators: patch Express and Fastify so Softprobe middleware/hooks
|
|
4
|
+
* are applied without user intervention. Design §16: patch Express app.use so
|
|
5
|
+
* first middleware/route addition triggers our middleware; patch Fastify factory
|
|
6
|
+
* so new instances get the plugin registered.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.patchExpress = patchExpress;
|
|
13
|
+
exports.applyFrameworkMutators = applyFrameworkMutators;
|
|
14
|
+
const shimmer_1 = __importDefault(require("shimmer"));
|
|
15
|
+
const capture_1 = require("../../instrumentations/express/capture");
|
|
16
|
+
const capture_2 = require("../../instrumentations/fastify/capture");
|
|
17
|
+
const nodeRequire = (typeof require !== 'undefined' ? require : undefined);
|
|
18
|
+
/**
|
|
19
|
+
* Patch Express so the first time a route is added (e.g. app.get), we call
|
|
20
|
+
* app.use(softprobeExpressMiddleware) so Softprobe middleware is injected.
|
|
21
|
+
* Express 5 uses app.route() for app.get/post/etc., and mixin(app, proto) copies
|
|
22
|
+
* proto onto each app, so we must patch the shared proto (express.application).
|
|
23
|
+
*/
|
|
24
|
+
function patchExpress(express) {
|
|
25
|
+
if (typeof express !== 'function')
|
|
26
|
+
return;
|
|
27
|
+
const exp = express;
|
|
28
|
+
const proto = exp.application ?? Object.getPrototypeOf(express());
|
|
29
|
+
if (!proto || typeof proto.route !== 'function')
|
|
30
|
+
return;
|
|
31
|
+
if (proto._softprobeRoutePatched)
|
|
32
|
+
return;
|
|
33
|
+
proto._softprobeRoutePatched = true;
|
|
34
|
+
shimmer_1.default.wrap(proto, 'route', (original) => {
|
|
35
|
+
return function route(...args) {
|
|
36
|
+
if (!this._softprobeMiddlewareAdded) {
|
|
37
|
+
this._softprobeMiddlewareAdded = true;
|
|
38
|
+
this.use(capture_1.softprobeExpressMiddleware);
|
|
39
|
+
}
|
|
40
|
+
return original.apply(this, args);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Patches Node's require so that when 'express' or 'fastify' is required,
|
|
46
|
+
* the framework is patched to inject Softprobe middleware/hooks. Call from init
|
|
47
|
+
* so that user require('express') or require('fastify') gets the patched version.
|
|
48
|
+
*/
|
|
49
|
+
function applyFrameworkMutators() {
|
|
50
|
+
if (!nodeRequire)
|
|
51
|
+
return;
|
|
52
|
+
const Mod = (typeof module !== 'undefined' && module.constructor);
|
|
53
|
+
if (!Mod?.prototype?.require)
|
|
54
|
+
return;
|
|
55
|
+
const req = nodeRequire;
|
|
56
|
+
const originalRequire = Mod.prototype.require;
|
|
57
|
+
Mod.prototype.require = function (id) {
|
|
58
|
+
const result = originalRequire.apply(this, arguments);
|
|
59
|
+
try {
|
|
60
|
+
if (id === 'express')
|
|
61
|
+
patchExpress(result);
|
|
62
|
+
if (id === 'fastify') {
|
|
63
|
+
const ModLoad = nodeRequire('module');
|
|
64
|
+
const path = ModLoad._resolveFilename(id, this);
|
|
65
|
+
const mod = req.cache?.[path];
|
|
66
|
+
if (mod) {
|
|
67
|
+
const orig = mod.exports;
|
|
68
|
+
const origFactory = (typeof orig === 'function' ? orig : orig.fastify ?? orig.default);
|
|
69
|
+
if (typeof origFactory !== 'function')
|
|
70
|
+
return result;
|
|
71
|
+
const wrapped = fastifyWrapper(origFactory);
|
|
72
|
+
wrapped.fastify = wrapped;
|
|
73
|
+
wrapped.default = wrapped;
|
|
74
|
+
if (typeof orig === 'object' && orig !== null) {
|
|
75
|
+
const o = orig;
|
|
76
|
+
for (const k of Object.keys(o)) {
|
|
77
|
+
if (k !== 'fastify' && k !== 'default' && Object.prototype.hasOwnProperty.call(o, k)) {
|
|
78
|
+
wrapped[k] = o[k];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
mod.exports = typeof orig === 'object' && orig !== null
|
|
83
|
+
? Object.assign({}, orig, { fastify: wrapped, default: wrapped })
|
|
84
|
+
: wrapped;
|
|
85
|
+
return mod.exports;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (_) {
|
|
90
|
+
// ignore patch errors
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
// Patch already-cached express if present (so test can require after mutator runs)
|
|
95
|
+
const cache = (typeof require !== 'undefined' && require.cache) || {};
|
|
96
|
+
for (const key of Object.keys(cache)) {
|
|
97
|
+
if (key.endsWith('node_modules/express/index.js') || key.endsWith('node_modules/express/lib/express.js')) {
|
|
98
|
+
try {
|
|
99
|
+
const mod = cache[key];
|
|
100
|
+
if (mod?.exports)
|
|
101
|
+
patchExpress(mod.exports);
|
|
102
|
+
}
|
|
103
|
+
catch (_) { }
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const key of Object.keys(cache)) {
|
|
108
|
+
if (key.endsWith('node_modules/fastify/fastify.js') || key.endsWith('node_modules/fastify/build/fastify.js')) {
|
|
109
|
+
try {
|
|
110
|
+
const mod = cache[key];
|
|
111
|
+
const ex = mod?.exports;
|
|
112
|
+
const F = (typeof ex === 'function' ? ex : ex?.fastify ?? ex?.default);
|
|
113
|
+
if (typeof F === 'function') {
|
|
114
|
+
const wrapped = fastifyWrapper(F);
|
|
115
|
+
wrapped.fastify = wrapped;
|
|
116
|
+
wrapped.default = wrapped;
|
|
117
|
+
if (typeof ex === 'object' && ex !== null) {
|
|
118
|
+
const o = ex;
|
|
119
|
+
for (const k of Object.keys(o)) {
|
|
120
|
+
if (k !== 'fastify' && k !== 'default' && Object.prototype.hasOwnProperty.call(o, k)) {
|
|
121
|
+
wrapped[k] = o[k];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
mod.exports = typeof ex === 'object' && ex !== null
|
|
126
|
+
? Object.assign({}, ex, { fastify: wrapped, default: wrapped })
|
|
127
|
+
: wrapped;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (_) { }
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function fastifyWrapper(original) {
|
|
136
|
+
return function (options) {
|
|
137
|
+
return Promise.resolve(original.call(this, options)).then((app) => {
|
|
138
|
+
const fp = nodeRequire?.('fastify-plugin');
|
|
139
|
+
const plugin = typeof fp === 'function' ? fp(capture_2.softprobeFastifyPlugin) : capture_2.softprobeFastifyPlugin;
|
|
140
|
+
return app.register(plugin).then(() => app);
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=framework-mutator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-mutator.js","sourceRoot":"","sources":["../../../src/bootstrap/otel/framework-mutator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAeH,oCAiBC;AAOD,wDAgFC;AApHD,sDAA8B;AAC9B,oEAAoF;AACpF,oEAAgF;AAEhF,MAAM,WAAW,GAAG,CAAC,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAA4B,CAAC;AAEtG;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,OAAmC;IAC9D,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,OAAO;IAC1C,MAAM,GAAG,GAAG,OAA0G,CAAC;IACvH,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;QAAE,OAAO;IACxD,IAAI,KAAK,CAAC,sBAAsB;QAAE,OAAO;IACzC,KAAK,CAAC,sBAAsB,GAAG,IAAI,CAAC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Q,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers to inject hooks into the instrumentation config array
|
|
3
|
+
* returned by getNodeAutoInstrumentations. Used by mutator to apply each protocol's hook.
|
|
4
|
+
* Design §5.3: keeps injection logic DRY across capture/postgres, undici, redis.
|
|
5
|
+
*/
|
|
6
|
+
export type InstrumentationEntry = {
|
|
7
|
+
instrumentationName?: string;
|
|
8
|
+
[hookName: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Finds the entry in the config array whose instrumentationName matches, and sets
|
|
12
|
+
* the named hook property. Mutates the array in place and returns it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function injectHook(result: unknown[], instrumentationName: string, hookName: string, hookFn: (...args: unknown[]) => void): unknown[];
|
|
15
|
+
/** Convenience wrapper: injects a responseHook. */
|
|
16
|
+
export declare function injectResponseHook(result: unknown[], instrumentationName: string, responseHook: (span: unknown, result: unknown) => void): unknown[];
|
|
17
|
+
//# sourceMappingURL=inject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/otel/inject.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,OAAO,EAAE,EACjB,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACnC,OAAO,EAAE,CASX;AAED,mDAAmD;AACnD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,EAAE,EACjB,mBAAmB,EAAE,MAAM,EAC3B,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,GACrD,OAAO,EAAE,CAEX"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared helpers to inject hooks into the instrumentation config array
|
|
4
|
+
* returned by getNodeAutoInstrumentations. Used by mutator to apply each protocol's hook.
|
|
5
|
+
* Design §5.3: keeps injection logic DRY across capture/postgres, undici, redis.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.injectHook = injectHook;
|
|
9
|
+
exports.injectResponseHook = injectResponseHook;
|
|
10
|
+
/**
|
|
11
|
+
* Finds the entry in the config array whose instrumentationName matches, and sets
|
|
12
|
+
* the named hook property. Mutates the array in place and returns it.
|
|
13
|
+
*/
|
|
14
|
+
function injectHook(result, instrumentationName, hookName, hookFn) {
|
|
15
|
+
for (const item of result) {
|
|
16
|
+
const entry = item;
|
|
17
|
+
if (entry.instrumentationName === instrumentationName) {
|
|
18
|
+
entry[hookName] = hookFn;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
/** Convenience wrapper: injects a responseHook. */
|
|
25
|
+
function injectResponseHook(result, instrumentationName, responseHook) {
|
|
26
|
+
return injectHook(result, instrumentationName, 'responseHook', responseHook);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=inject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../src/bootstrap/otel/inject.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAWH,gCAcC;AAGD,gDAMC;AA3BD;;;GAGG;AACH,SAAgB,UAAU,CACxB,MAAiB,EACjB,mBAA2B,EAC3B,QAAgB,EAChB,MAAoC;IAEpC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,IAA4B,CAAC;QAC3C,IAAI,KAAK,CAAC,mBAAmB,KAAK,mBAAmB,EAAE,CAAC;YACtD,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;YACzB,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,mDAAmD;AACnD,SAAgB,kBAAkB,CAChC,MAAiB,EACjB,mBAA2B,EAC3B,YAAsD;IAEtD,OAAO,UAAU,CAAC,MAAM,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-instrumentation mutator: wraps getNodeAutoInstrumentations to inject
|
|
3
|
+
* Softprobe responseHooks per protocol (postgres, redis). HTTP capture/replay
|
|
4
|
+
* is done solely via the MSW interceptor (replay/http.ts), not undici instrumentation.
|
|
5
|
+
* Design §5.2, §5.3.
|
|
6
|
+
*/
|
|
7
|
+
/** Module-like object that exposes getNodeAutoInstrumentations (for real use or tests). */
|
|
8
|
+
export interface AutoInstrumentationsModule {
|
|
9
|
+
getNodeAutoInstrumentations: (options?: unknown) => unknown[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Wraps getNodeAutoInstrumentations so that the returned config includes our
|
|
13
|
+
* custom responseHook for each protocol. Pass a module object to mutate (e.g. for tests);
|
|
14
|
+
* if omitted, the real @opentelemetry/auto-instrumentations-node module is used.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyAutoInstrumentationMutator(target?: AutoInstrumentationsModule): void;
|
|
17
|
+
//# sourceMappingURL=mutator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutator.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/otel/mutator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,2FAA2F;AAC3F,MAAM,WAAW,0BAA0B;IACzC,2BAA2B,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,EAAE,CAAC;CAC/D;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,CAAC,EAAE,0BAA0B,GAClC,IAAI,CAuCN"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Auto-instrumentation mutator: wraps getNodeAutoInstrumentations to inject
|
|
4
|
+
* Softprobe responseHooks per protocol (postgres, redis). HTTP capture/replay
|
|
5
|
+
* is done solely via the MSW interceptor (replay/http.ts), not undici instrumentation.
|
|
6
|
+
* Design §5.2, §5.3.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.applyAutoInstrumentationMutator = applyAutoInstrumentationMutator;
|
|
13
|
+
const shimmer_1 = __importDefault(require("shimmer"));
|
|
14
|
+
const inject_1 = require("./inject");
|
|
15
|
+
const capture_1 = require("../../instrumentations/postgres/capture");
|
|
16
|
+
const capture_2 = require("../../instrumentations/redis/capture");
|
|
17
|
+
/**
|
|
18
|
+
* Wraps getNodeAutoInstrumentations so that the returned config includes our
|
|
19
|
+
* custom responseHook for each protocol. Pass a module object to mutate (e.g. for tests);
|
|
20
|
+
* if omitted, the real @opentelemetry/auto-instrumentations-node module is used.
|
|
21
|
+
*/
|
|
22
|
+
function applyAutoInstrumentationMutator(target) {
|
|
23
|
+
const moduleExport = target ?? require('@opentelemetry/auto-instrumentations-node');
|
|
24
|
+
shimmer_1.default.wrap(moduleExport, 'getNodeAutoInstrumentations', ((original) => {
|
|
25
|
+
return function wrappedGetNodeAutoInstrumentations(options) {
|
|
26
|
+
// Real getNodeAutoInstrumentations(inputConfigs) creates instances from config;
|
|
27
|
+
// merge our responseHooks into the input so instances get them (E2E).
|
|
28
|
+
const input = options != null && typeof options === 'object' && !Array.isArray(options)
|
|
29
|
+
? options
|
|
30
|
+
: {};
|
|
31
|
+
const merged = { ...input };
|
|
32
|
+
merged[capture_1.PG_INSTRUMENTATION_NAME] = {
|
|
33
|
+
...(input[capture_1.PG_INSTRUMENTATION_NAME] ?? {}),
|
|
34
|
+
requestHook: (0, capture_1.buildPostgresRequestHook)(),
|
|
35
|
+
responseHook: (0, capture_1.buildPostgresResponseHook)(),
|
|
36
|
+
};
|
|
37
|
+
merged[capture_2.REDIS_INSTRUMENTATION_NAME] = {
|
|
38
|
+
...(input[capture_2.REDIS_INSTRUMENTATION_NAME] ?? {}),
|
|
39
|
+
responseHook: (0, capture_2.buildRedisResponseHook)(),
|
|
40
|
+
};
|
|
41
|
+
const result = original.call(this, merged);
|
|
42
|
+
// Also mutate return value for mocks that return config-like entries (unit tests).
|
|
43
|
+
const arr = Array.isArray(result) ? result : [];
|
|
44
|
+
(0, inject_1.injectHook)(arr, capture_1.PG_INSTRUMENTATION_NAME, 'requestHook', (0, capture_1.buildPostgresRequestHook)());
|
|
45
|
+
(0, inject_1.injectResponseHook)(arr, capture_1.PG_INSTRUMENTATION_NAME, (0, capture_1.buildPostgresResponseHook)());
|
|
46
|
+
(0, inject_1.injectResponseHook)(arr, capture_2.REDIS_INSTRUMENTATION_NAME, (0, capture_2.buildRedisResponseHook)());
|
|
47
|
+
return arr;
|
|
48
|
+
};
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=mutator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutator.js","sourceRoot":"","sources":["../../../src/bootstrap/otel/mutator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAwBH,0EAyCC;AA/DD,sDA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2BAAkB,EAAC,GAAG,EAAE,iCAAuB,EAAE,IAAA,mCAAyB,GAAE,CAAC,CAAC;YAC9E,IAAA,2BAAkB,EAAC,GAAG,EAAE,oCAA0B,EAAE,IAAA,gCAAsB,GAAE,CAAC,CAAC;YAC9E,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;IACJ,CAAC,CAAmF,CACrF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy compatibility re-export for Express capture instrumentation.
|
|
3
|
+
*/
|
|
4
|
+
export { CaptureEngine, queueInboundResponse, softprobeExpressMiddleware, } from '../instrumentations/express/capture';
|
|
5
|
+
export type { QueueInboundResponsePayload } from '../instrumentations/express/capture';
|
|
6
|
+
//# sourceMappingURL=express.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/capture/express.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.softprobeExpressMiddleware = exports.queueInboundResponse = exports.CaptureEngine = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Legacy compatibility re-export for Express capture instrumentation.
|
|
6
|
+
*/
|
|
7
|
+
var capture_1 = require("../instrumentations/express/capture");
|
|
8
|
+
Object.defineProperty(exports, "CaptureEngine", { enumerable: true, get: function () { return capture_1.CaptureEngine; } });
|
|
9
|
+
Object.defineProperty(exports, "queueInboundResponse", { enumerable: true, get: function () { return capture_1.queueInboundResponse; } });
|
|
10
|
+
Object.defineProperty(exports, "softprobeExpressMiddleware", { enumerable: true, get: function () { return capture_1.softprobeExpressMiddleware; } });
|
|
11
|
+
//# sourceMappingURL=express.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express.js","sourceRoot":"","sources":["../../src/capture/express.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAI6C;AAH3C,wGAAA,aAAa,OAAA;AACb,+GAAA,oBAAoB,OAAA;AACpB,qHAAA,0BAA0B,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../../src/capture/fastify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.softprobeFastifyPlugin = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Legacy compatibility re-export for Fastify capture instrumentation.
|
|
6
|
+
*/
|
|
7
|
+
var capture_1 = require("../instrumentations/fastify/capture");
|
|
8
|
+
Object.defineProperty(exports, "softprobeFastifyPlugin", { enumerable: true, get: function () { return capture_1.softprobeFastifyPlugin; } });
|
|
9
|
+
//# sourceMappingURL=fastify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../../src/capture/fastify.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAA6E;AAApE,iHAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework mutators: patch Express and Fastify so Softprobe middleware/hooks
|
|
3
|
+
* are applied without user intervention. Design §16: patch Express app.use so
|
|
4
|
+
* first middleware/route addition triggers our middleware; patch Fastify factory
|
|
5
|
+
* so new instances get the plugin registered.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Patch Express so the first time a route is added (e.g. app.get), we call
|
|
9
|
+
* app.use(softprobeExpressMiddleware) so Softprobe middleware is injected.
|
|
10
|
+
* Express 5 uses app.route() for app.get/post/etc., and mixin(app, proto) copies
|
|
11
|
+
* proto onto each app, so we must patch the shared proto (express.application).
|
|
12
|
+
*/
|
|
13
|
+
export declare function patchExpress(express: (req?: unknown) => unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* Patches Node's require so that when 'express' or 'fastify' is required,
|
|
16
|
+
* the framework is patched to inject Softprobe middleware/hooks. Call from init
|
|
17
|
+
* so that user require('express') or require('fastify') gets the patched version.
|
|
18
|
+
*/
|
|
19
|
+
export declare function applyFrameworkMutators(): void;
|
|
20
|
+
//# sourceMappingURL=framework-mutator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-mutator.d.ts","sourceRoot":"","sources":["../../src/capture/framework-mutator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,CAiBtE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAgF7C"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Framework mutators: patch Express and Fastify so Softprobe middleware/hooks
|
|
4
|
+
* are applied without user intervention. Design §16: patch Express app.use so
|
|
5
|
+
* first middleware/route addition triggers our middleware; patch Fastify factory
|
|
6
|
+
* so new instances get the plugin registered.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.patchExpress = patchExpress;
|
|
13
|
+
exports.applyFrameworkMutators = applyFrameworkMutators;
|
|
14
|
+
const shimmer_1 = __importDefault(require("shimmer"));
|
|
15
|
+
const capture_1 = require("../instrumentations/express/capture");
|
|
16
|
+
const capture_2 = require("../instrumentations/fastify/capture");
|
|
17
|
+
const nodeRequire = (typeof require !== 'undefined' ? require : undefined);
|
|
18
|
+
/**
|
|
19
|
+
* Patch Express so the first time a route is added (e.g. app.get), we call
|
|
20
|
+
* app.use(softprobeExpressMiddleware) so Softprobe middleware is injected.
|
|
21
|
+
* Express 5 uses app.route() for app.get/post/etc., and mixin(app, proto) copies
|
|
22
|
+
* proto onto each app, so we must patch the shared proto (express.application).
|
|
23
|
+
*/
|
|
24
|
+
function patchExpress(express) {
|
|
25
|
+
if (typeof express !== 'function')
|
|
26
|
+
return;
|
|
27
|
+
const exp = express;
|
|
28
|
+
const proto = exp.application ?? Object.getPrototypeOf(express());
|
|
29
|
+
if (!proto || typeof proto.route !== 'function')
|
|
30
|
+
return;
|
|
31
|
+
if (proto._softprobeRoutePatched)
|
|
32
|
+
return;
|
|
33
|
+
proto._softprobeRoutePatched = true;
|
|
34
|
+
shimmer_1.default.wrap(proto, 'route', (original) => {
|
|
35
|
+
return function route(...args) {
|
|
36
|
+
if (!this._softprobeMiddlewareAdded) {
|
|
37
|
+
this._softprobeMiddlewareAdded = true;
|
|
38
|
+
this.use(capture_1.softprobeExpressMiddleware);
|
|
39
|
+
}
|
|
40
|
+
return original.apply(this, args);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Patches Node's require so that when 'express' or 'fastify' is required,
|
|
46
|
+
* the framework is patched to inject Softprobe middleware/hooks. Call from init
|
|
47
|
+
* so that user require('express') or require('fastify') gets the patched version.
|
|
48
|
+
*/
|
|
49
|
+
function applyFrameworkMutators() {
|
|
50
|
+
if (!nodeRequire)
|
|
51
|
+
return;
|
|
52
|
+
const Mod = (typeof module !== 'undefined' && module.constructor);
|
|
53
|
+
if (!Mod?.prototype?.require)
|
|
54
|
+
return;
|
|
55
|
+
const req = nodeRequire;
|
|
56
|
+
const originalRequire = Mod.prototype.require;
|
|
57
|
+
Mod.prototype.require = function (id) {
|
|
58
|
+
const result = originalRequire.apply(this, arguments);
|
|
59
|
+
try {
|
|
60
|
+
if (id === 'express')
|
|
61
|
+
patchExpress(result);
|
|
62
|
+
if (id === 'fastify') {
|
|
63
|
+
const ModLoad = nodeRequire('module');
|
|
64
|
+
const path = ModLoad._resolveFilename(id, this);
|
|
65
|
+
const mod = req.cache?.[path];
|
|
66
|
+
if (mod) {
|
|
67
|
+
const orig = mod.exports;
|
|
68
|
+
const origFactory = (typeof orig === 'function' ? orig : orig.fastify ?? orig.default);
|
|
69
|
+
if (typeof origFactory !== 'function')
|
|
70
|
+
return result;
|
|
71
|
+
const wrapped = fastifyWrapper(origFactory);
|
|
72
|
+
wrapped.fastify = wrapped;
|
|
73
|
+
wrapped.default = wrapped;
|
|
74
|
+
if (typeof orig === 'object' && orig !== null) {
|
|
75
|
+
const o = orig;
|
|
76
|
+
for (const k of Object.keys(o)) {
|
|
77
|
+
if (k !== 'fastify' && k !== 'default' && Object.prototype.hasOwnProperty.call(o, k)) {
|
|
78
|
+
wrapped[k] = o[k];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
mod.exports = typeof orig === 'object' && orig !== null
|
|
83
|
+
? Object.assign({}, orig, { fastify: wrapped, default: wrapped })
|
|
84
|
+
: wrapped;
|
|
85
|
+
return mod.exports;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (_) {
|
|
90
|
+
// ignore patch errors
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
// Patch already-cached express if present (so test can require after mutator runs)
|
|
95
|
+
const cache = (typeof require !== 'undefined' && require.cache) || {};
|
|
96
|
+
for (const key of Object.keys(cache)) {
|
|
97
|
+
if (key.endsWith('node_modules/express/index.js') || key.endsWith('node_modules/express/lib/express.js')) {
|
|
98
|
+
try {
|
|
99
|
+
const mod = cache[key];
|
|
100
|
+
if (mod?.exports)
|
|
101
|
+
patchExpress(mod.exports);
|
|
102
|
+
}
|
|
103
|
+
catch (_) { }
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const key of Object.keys(cache)) {
|
|
108
|
+
if (key.endsWith('node_modules/fastify/fastify.js') || key.endsWith('node_modules/fastify/build/fastify.js')) {
|
|
109
|
+
try {
|
|
110
|
+
const mod = cache[key];
|
|
111
|
+
const ex = mod?.exports;
|
|
112
|
+
const F = (typeof ex === 'function' ? ex : ex?.fastify ?? ex?.default);
|
|
113
|
+
if (typeof F === 'function') {
|
|
114
|
+
const wrapped = fastifyWrapper(F);
|
|
115
|
+
wrapped.fastify = wrapped;
|
|
116
|
+
wrapped.default = wrapped;
|
|
117
|
+
if (typeof ex === 'object' && ex !== null) {
|
|
118
|
+
const o = ex;
|
|
119
|
+
for (const k of Object.keys(o)) {
|
|
120
|
+
if (k !== 'fastify' && k !== 'default' && Object.prototype.hasOwnProperty.call(o, k)) {
|
|
121
|
+
wrapped[k] = o[k];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
mod.exports = typeof ex === 'object' && ex !== null
|
|
126
|
+
? Object.assign({}, ex, { fastify: wrapped, default: wrapped })
|
|
127
|
+
: wrapped;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (_) { }
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function fastifyWrapper(original) {
|
|
136
|
+
return function (options) {
|
|
137
|
+
return Promise.resolve(original.call(this, options)).then((app) => {
|
|
138
|
+
const fp = nodeRequire?.('fastify-plugin');
|
|
139
|
+
const plugin = typeof fp === 'function' ? fp(capture_2.softprobeFastifyPlugin) : capture_2.softprobeFastifyPlugin;
|
|
140
|
+
return app.register(plugin).then(() => app);
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=framework-mutator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-mutator.js","sourceRoot":"","sources":["../../src/capture/framework-mutator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;AAeH,oCAiBC;AAOD,wDAgFC;AApHD,sDAA8B;AAC9B,iEAAiF;AACjF,iEAA6E;AAE7E,MAAM,WAAW,GAAG,CAAC,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAA4B,CAAC;AAEtG;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,OAAmC;IAC9D,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,OAAO;IAC1C,MAAM,GAAG,GAAG,OAA0G,CAAC;IACvH,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;QAAE,OAAO;IACxD,IAAI,KAAK,CAAC,sBAAsB;QAAE,OAAO;IACzC,KAAK,CAAC,sBAAsB,GAAG,IAAI,CAAC;IAEpC,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,QAAyC,EAAE,EAAE;QACzE,OAAO,SAAS,KAAK,CAA+E,GAAG,IAAe;YACpH,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACpC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,oCAA0B,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB;IACpC,IAAI,CAAC,WAAW;QAAE,OAAO;IAEzB,M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AG,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,IAAI;wBACjD,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;wBACzE,CAAC,CAAC,OAAO,CAAC;gBACd,CAAC;YACH,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;YACd,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CACrB,QAAqF;IAErF,OAAO,UAAyB,OAAiB;QAC/C,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YAChE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC,gBAAgB,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,OAAO,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,gCAAsB,CAAC,CAAC,CAAC,CAAC,gCAAsB,CAAC;YAC9F,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP inbound capture: write one NDJSON record per inbound request/response.
|
|
3
|
+
* Design §10.4: Inbound HTTP — request body + response status/body.
|
|
4
|
+
* Single record embeds both requestPayload and responsePayload when available.
|
|
5
|
+
* Task 14.3.1: requestPayload.body is populated from req.body when Express
|
|
6
|
+
* middleware is placed after body-parser (via queueInboundResponse.requestBody).
|
|
7
|
+
*/
|
|
8
|
+
import type { CassetteStore } from '../store/cassette-store';
|
|
9
|
+
export type WriteInboundHttpOptions = {
|
|
10
|
+
traceId: string;
|
|
11
|
+
spanId: string;
|
|
12
|
+
parentSpanId?: string;
|
|
13
|
+
spanName?: string;
|
|
14
|
+
method: string;
|
|
15
|
+
url: string;
|
|
16
|
+
/** Request body (optional). */
|
|
17
|
+
requestBody?: unknown;
|
|
18
|
+
/** Response status code (optional). */
|
|
19
|
+
statusCode?: number;
|
|
20
|
+
/** Response body (optional). */
|
|
21
|
+
responseBody?: unknown;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Writes one inbound HTTP cassette record. Include requestBody for request capture,
|
|
25
|
+
* and statusCode/responseBody when the response is available (same record).
|
|
26
|
+
*/
|
|
27
|
+
export declare function writeInboundHttpRecord(store: CassetteStore, options: WriteInboundHttpOptions): void;
|
|
28
|
+
//# sourceMappingURL=http-inbound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-inbound.d.ts","sourceRoot":"","sources":["../../src/capture/http-inbound.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,uBAAuB,GAC/B,IAAI,CAoCN"}
|