@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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testSpan = exports.parseRedisSpan = exports.tagRedisCommand = exports.RedisSpan = exports.parsePostgresSpan = exports.tagPostgresQuery = exports.PostgresSpan = exports.parseHttpSpan = exports.tagHttpRequest = exports.HttpSpan = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Shared span helper contracts and adapters.
|
|
6
|
+
*/
|
|
7
|
+
var http_span_1 = require("./http-span");
|
|
8
|
+
Object.defineProperty(exports, "HttpSpan", { enumerable: true, get: function () { return http_span_1.HttpSpan; } });
|
|
9
|
+
Object.defineProperty(exports, "tagHttpRequest", { enumerable: true, get: function () { return http_span_1.tagRequest; } });
|
|
10
|
+
Object.defineProperty(exports, "parseHttpSpan", { enumerable: true, get: function () { return http_span_1.fromSpan; } });
|
|
11
|
+
var postgres_span_1 = require("./postgres-span");
|
|
12
|
+
Object.defineProperty(exports, "PostgresSpan", { enumerable: true, get: function () { return postgres_span_1.PostgresSpan; } });
|
|
13
|
+
Object.defineProperty(exports, "tagPostgresQuery", { enumerable: true, get: function () { return postgres_span_1.tagQuery; } });
|
|
14
|
+
Object.defineProperty(exports, "parsePostgresSpan", { enumerable: true, get: function () { return postgres_span_1.fromSpan; } });
|
|
15
|
+
var redis_span_1 = require("./redis-span");
|
|
16
|
+
Object.defineProperty(exports, "RedisSpan", { enumerable: true, get: function () { return redis_span_1.RedisSpan; } });
|
|
17
|
+
Object.defineProperty(exports, "tagRedisCommand", { enumerable: true, get: function () { return redis_span_1.tagCommand; } });
|
|
18
|
+
Object.defineProperty(exports, "parseRedisSpan", { enumerable: true, get: function () { return redis_span_1.fromSpan; } });
|
|
19
|
+
var test_span_1 = require("./test-span");
|
|
20
|
+
Object.defineProperty(exports, "testSpan", { enumerable: true, get: function () { return test_span_1.testSpan; } });
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/bindings/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yCAAgG;AAAvF,qGAAA,QAAQ,OAAA;AAAE,2GAAA,UAAU,OAAkB;AAAE,0GAAA,QAAQ,OAAiB;AAE1E,iDAA4G;AAAnG,6GAAA,YAAY,OAAA;AAAE,iHAAA,QAAQ,OAAoB;AAAE,kHAAA,QAAQ,OAAqB;AAElF,2CAAoG;AAA3F,uGAAA,SAAS,OAAA;AAAE,6GAAA,UAAU,OAAmB;AAAE,4GAAA,QAAQ,OAAkB;AAE7E,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed binding for Postgres spans (design §7.2).
|
|
3
|
+
* Encapsulates attribute keys; tagQuery sets protocol and identifier for matching.
|
|
4
|
+
*/
|
|
5
|
+
/** Span-like type with setAttribute (OTel Span or test span). */
|
|
6
|
+
type SpanLike = {
|
|
7
|
+
setAttribute?(key: string, value: unknown): void;
|
|
8
|
+
} | undefined;
|
|
9
|
+
/** Span-like with readable attributes (OTel Span or test span). */
|
|
10
|
+
type ReadableSpan = {
|
|
11
|
+
attributes?: Record<string, unknown>;
|
|
12
|
+
} | undefined;
|
|
13
|
+
/** Data extracted from a postgres-tagged span by fromSpan. */
|
|
14
|
+
export type PostgresSpanData = {
|
|
15
|
+
protocol: 'postgres';
|
|
16
|
+
identifier: string;
|
|
17
|
+
sql: string;
|
|
18
|
+
values: unknown[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Tags the given span with postgres protocol and identifier from the SQL text.
|
|
22
|
+
* Identifier is built via pgIdentifier(sql) for capture/replay consistency.
|
|
23
|
+
*
|
|
24
|
+
* @param sql - Query text (used as identifier; normalization deferred).
|
|
25
|
+
* @param values - Optional query parameters (reserved for fromSpan in 3.2.2).
|
|
26
|
+
* @param span - Target span; when omitted, caller must pass active span for production use.
|
|
27
|
+
*/
|
|
28
|
+
export declare function tagQuery(sql: string, values?: unknown[], span?: SpanLike): void;
|
|
29
|
+
/**
|
|
30
|
+
* Reads protocol and identifier from a span. Returns postgres data when the span
|
|
31
|
+
* is tagged with softprobe.protocol === 'postgres', otherwise null.
|
|
32
|
+
* sql is taken from identifier (pgIdentifier is pass-through); values from optional request body or [].
|
|
33
|
+
*/
|
|
34
|
+
export declare function fromSpan(span: ReadableSpan): PostgresSpanData | null;
|
|
35
|
+
/** PostgresSpan namespace for tagQuery and fromSpan. */
|
|
36
|
+
export declare const PostgresSpan: {
|
|
37
|
+
tagQuery: typeof tagQuery;
|
|
38
|
+
fromSpan: typeof fromSpan;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=postgres-span.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-span.d.ts","sourceRoot":"","sources":["../../../src/core/bindings/postgres-span.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,iEAAiE;AACjE,KAAK,QAAQ,GAAG;IAAE,YAAY,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,CAAC;AAEjF,mEAAmE;AACnE,KAAK,YAAY,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,SAAS,CAAC;AAEzE,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,UAAU,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAAE,EAClB,IAAI,CAAC,EAAE,QAAQ,GACd,IAAI,CAIN;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,GAAG,IAAI,CA2BpE;AAED,wDAAwD;AACxD,eAAO,MAAM,YAAY;;;CAAyB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Typed binding for Postgres spans (design §7.2).
|
|
4
|
+
* Encapsulates attribute keys; tagQuery sets protocol and identifier for matching.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PostgresSpan = void 0;
|
|
8
|
+
exports.tagQuery = tagQuery;
|
|
9
|
+
exports.fromSpan = fromSpan;
|
|
10
|
+
const identifier_1 = require("../identifier");
|
|
11
|
+
/**
|
|
12
|
+
* Tags the given span with postgres protocol and identifier from the SQL text.
|
|
13
|
+
* Identifier is built via pgIdentifier(sql) for capture/replay consistency.
|
|
14
|
+
*
|
|
15
|
+
* @param sql - Query text (used as identifier; normalization deferred).
|
|
16
|
+
* @param values - Optional query parameters (reserved for fromSpan in 3.2.2).
|
|
17
|
+
* @param span - Target span; when omitted, caller must pass active span for production use.
|
|
18
|
+
*/
|
|
19
|
+
function tagQuery(sql, values, span) {
|
|
20
|
+
if (!span?.setAttribute)
|
|
21
|
+
return;
|
|
22
|
+
span.setAttribute('softprobe.protocol', 'postgres');
|
|
23
|
+
span.setAttribute('softprobe.identifier', (0, identifier_1.pgIdentifier)(sql));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads protocol and identifier from a span. Returns postgres data when the span
|
|
27
|
+
* is tagged with softprobe.protocol === 'postgres', otherwise null.
|
|
28
|
+
* sql is taken from identifier (pgIdentifier is pass-through); values from optional request body or [].
|
|
29
|
+
*/
|
|
30
|
+
function fromSpan(span) {
|
|
31
|
+
const protocol = span?.attributes?.['softprobe.protocol'];
|
|
32
|
+
if (protocol === 'postgres') {
|
|
33
|
+
const identifier = span?.attributes?.['softprobe.identifier'];
|
|
34
|
+
if (typeof identifier === 'string') {
|
|
35
|
+
return {
|
|
36
|
+
protocol: 'postgres',
|
|
37
|
+
identifier,
|
|
38
|
+
sql: identifier,
|
|
39
|
+
values: [],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// OTel db span fallback (no softprobe tagging required).
|
|
44
|
+
const attrs = span?.attributes ?? {};
|
|
45
|
+
const dbSystem = attrs['db.system'];
|
|
46
|
+
const statement = attrs['db.statement'];
|
|
47
|
+
if ((dbSystem === 'postgresql' || dbSystem === 'postgres') &&
|
|
48
|
+
typeof statement === 'string' &&
|
|
49
|
+
statement.length > 0) {
|
|
50
|
+
const identifier = (0, identifier_1.pgIdentifier)(statement);
|
|
51
|
+
return { protocol: 'postgres', identifier, sql: identifier, values: [] };
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/** PostgresSpan namespace for tagQuery and fromSpan. */
|
|
56
|
+
exports.PostgresSpan = { tagQuery, fromSpan };
|
|
57
|
+
//# sourceMappingURL=postgres-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-span.js","sourceRoot":"","sources":["../../../src/core/bindings/postgres-span.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0BH,4BAQC;AAOD,4BA2BC;AAlED,8CAA6C;AAgB7C;;;;;;;GAOG;AACH,SAAgB,QAAQ,CACtB,GAAW,EACX,MAAkB,EAClB,IAAe;IAEf,IAAI,CAAC,IAAI,EAAE,YAAY;QAAE,OAAO;IAChC,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,IAAA,yBAAY,EAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAkB;IACzC,MAAM,QAAQ,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,oBAAoB,CAAC,CAAC;IAC1D,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,sBAAsB,CAAC,CAAC;QAC9D,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO;gBACL,QAAQ,EAAE,UAAU;gBACpB,UAAU;gBACV,GAAG,EAAE,UAAU;gBACf,MAAM,EAAE,EAAE;aACX,CAAC;QACJ,CAAC;IACH,CAAC;IAED,yDAAyD;IACzD,MAAM,KAAK,GAAG,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;IACxC,IACE,CAAC,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,UAAU,CAAC;QACtD,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,CAAC,MAAM,GAAG,CAAC,EACpB,CAAC;QACD,MAAM,UAAU,GAAG,IAAA,yBAAY,EAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wDAAwD;AAC3C,QAAA,YAAY,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed binding for Redis spans (design §7.2).
|
|
3
|
+
* tagCommand sets protocol, identifier (via redisIdentifier), cmd, and args_json.
|
|
4
|
+
*/
|
|
5
|
+
/** Span-like with setAttribute (OTel Span or test span). */
|
|
6
|
+
type SpanLike = {
|
|
7
|
+
setAttribute?(key: string, value: unknown): void;
|
|
8
|
+
} | undefined;
|
|
9
|
+
/** Span-like with readable attributes. */
|
|
10
|
+
type ReadableSpan = {
|
|
11
|
+
attributes?: Record<string, unknown>;
|
|
12
|
+
} | undefined;
|
|
13
|
+
/** Data extracted from a redis-tagged span by fromSpan. */
|
|
14
|
+
export type RedisSpanData = {
|
|
15
|
+
protocol: 'redis';
|
|
16
|
+
identifier: string;
|
|
17
|
+
cmd: string;
|
|
18
|
+
args: string[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Tags the span with redis protocol, identifier (from redisIdentifier), and args as JSON.
|
|
22
|
+
*
|
|
23
|
+
* @param cmd - Command name (e.g. 'get').
|
|
24
|
+
* @param args - Command arguments (string array).
|
|
25
|
+
* @param span - Target span; pass test span in tests.
|
|
26
|
+
*/
|
|
27
|
+
export declare function tagCommand(cmd: string, args: string[], span?: SpanLike): void;
|
|
28
|
+
/**
|
|
29
|
+
* Reads protocol, identifier, cmd, and args from a span. Returns redis data when
|
|
30
|
+
* the span is tagged with redis protocol and has identifier and cmd; otherwise null.
|
|
31
|
+
* args_json is parsed as JSON; invalid or missing yields [].
|
|
32
|
+
*/
|
|
33
|
+
export declare function fromSpan(span: ReadableSpan): RedisSpanData | null;
|
|
34
|
+
/** RedisSpan namespace for tagCommand and fromSpan. */
|
|
35
|
+
export declare const RedisSpan: {
|
|
36
|
+
tagCommand: typeof tagCommand;
|
|
37
|
+
fromSpan: typeof fromSpan;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=redis-span.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-span.d.ts","sourceRoot":"","sources":["../../../src/core/bindings/redis-span.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,4DAA4D;AAC5D,KAAK,QAAQ,GAAG;IAAE,YAAY,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,GAAG,SAAS,CAAC;AAEjF,0CAA0C;AAC1C,KAAK,YAAY,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,SAAS,CAAC;AAEzE,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAM7E;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,IAAI,CAiCjE;AAED,uDAAuD;AACvD,eAAO,MAAM,SAAS;;;CAA2B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Typed binding for Redis spans (design §7.2).
|
|
4
|
+
* tagCommand sets protocol, identifier (via redisIdentifier), cmd, and args_json.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.RedisSpan = void 0;
|
|
8
|
+
exports.tagCommand = tagCommand;
|
|
9
|
+
exports.fromSpan = fromSpan;
|
|
10
|
+
const identifier_1 = require("../identifier");
|
|
11
|
+
/**
|
|
12
|
+
* Tags the span with redis protocol, identifier (from redisIdentifier), and args as JSON.
|
|
13
|
+
*
|
|
14
|
+
* @param cmd - Command name (e.g. 'get').
|
|
15
|
+
* @param args - Command arguments (string array).
|
|
16
|
+
* @param span - Target span; pass test span in tests.
|
|
17
|
+
*/
|
|
18
|
+
function tagCommand(cmd, args, span) {
|
|
19
|
+
if (!span?.setAttribute)
|
|
20
|
+
return;
|
|
21
|
+
span.setAttribute('softprobe.protocol', 'redis');
|
|
22
|
+
span.setAttribute('softprobe.identifier', (0, identifier_1.redisIdentifier)(cmd, args));
|
|
23
|
+
span.setAttribute('softprobe.redis.cmd', cmd.toUpperCase());
|
|
24
|
+
span.setAttribute('softprobe.redis.args_json', JSON.stringify(args));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Reads protocol, identifier, cmd, and args from a span. Returns redis data when
|
|
28
|
+
* the span is tagged with redis protocol and has identifier and cmd; otherwise null.
|
|
29
|
+
* args_json is parsed as JSON; invalid or missing yields [].
|
|
30
|
+
*/
|
|
31
|
+
function fromSpan(span) {
|
|
32
|
+
const protocol = span?.attributes?.['softprobe.protocol'];
|
|
33
|
+
if (protocol === 'redis') {
|
|
34
|
+
const identifier = span?.attributes?.['softprobe.identifier'];
|
|
35
|
+
const cmd = span?.attributes?.['softprobe.redis.cmd'];
|
|
36
|
+
if (typeof identifier === 'string' && cmd) {
|
|
37
|
+
const argsJson = span?.attributes?.['softprobe.redis.args_json'];
|
|
38
|
+
const args = typeof argsJson === 'string' ? (JSON.parse(argsJson) ?? []) : [];
|
|
39
|
+
return { protocol: 'redis', identifier, cmd: String(cmd), args };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// OTel db span fallback (no softprobe tagging required).
|
|
43
|
+
const attrs = span?.attributes ?? {};
|
|
44
|
+
const dbSystem = attrs['db.system'];
|
|
45
|
+
const statement = attrs['db.statement'];
|
|
46
|
+
if (dbSystem === 'redis' &&
|
|
47
|
+
typeof statement === 'string' &&
|
|
48
|
+
statement.trim().length > 0) {
|
|
49
|
+
const parts = statement.trim().split(/\s+/);
|
|
50
|
+
const cmd = (parts[0] ?? '').toUpperCase();
|
|
51
|
+
const args = parts.slice(1);
|
|
52
|
+
if (!cmd)
|
|
53
|
+
return null;
|
|
54
|
+
return {
|
|
55
|
+
protocol: 'redis',
|
|
56
|
+
identifier: (0, identifier_1.redisIdentifier)(cmd, args),
|
|
57
|
+
cmd,
|
|
58
|
+
args,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/** RedisSpan namespace for tagCommand and fromSpan. */
|
|
64
|
+
exports.RedisSpan = { tagCommand, fromSpan };
|
|
65
|
+
//# sourceMappingURL=redis-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-span.js","sourceRoot":"","sources":["../../../src/core/bindings/redis-span.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyBH,gCAMC;AAOD,4BAiCC;AArED,8CAAgD;AAgBhD;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,GAAW,EAAE,IAAc,EAAE,IAAe;IACrE,IAAI,CAAC,IAAI,EAAE,YAAY;QAAE,OAAO;IAChC,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,IAAA,4BAAe,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5D,IAAI,CAAC,YAAY,CAAC,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,IAAkB;IACzC,MAAM,QAAQ,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,oBAAoB,CAAC,CAAC;IAC1D,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,sBAAsB,CAAC,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,qBAAqB,CAAC,CAAC;QACtD,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,GAAG,EAAE,CAAC;YAC1C,MAAM,QAAQ,GAAG,IAAI,EAAE,UAAU,EAAE,CAAC,2BAA2B,CAAC,CAAC;YACjE,MAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;QACnE,CAAC;IACH,CAAC;IAED,yDAAyD;IACzD,MAAM,KAAK,GAAG,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;IACxC,IACE,QAAQ,KAAK,OAAO;QACpB,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAC3B,CAAC;QACD,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,OAAO;YACL,QAAQ,EAAE,OAAO;YACjB,UAAU,EAAE,IAAA,4BAAe,EAAC,GAAG,EAAE,IAAI,CAAC;YACtC,GAAG;YACH,IAAI;SACL,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uDAAuD;AAC1C,QAAA,SAAS,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test helper for binding tests (Task 3.1.1).
|
|
3
|
+
* Returns a mock span with setAttribute(k,v) and an attributes bag so that
|
|
4
|
+
* PostgresSpan, RedisSpan, and HttpSpan tests can assert tagged values without OTel.
|
|
5
|
+
*/
|
|
6
|
+
export type TestSpan = {
|
|
7
|
+
setAttribute(key: string, value: unknown): void;
|
|
8
|
+
attributes: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Creates a mock span for use in binding tests. Calling setAttribute(k, v)
|
|
12
|
+
* stores the value in the span's attributes bag.
|
|
13
|
+
*/
|
|
14
|
+
export declare function testSpan(): TestSpan;
|
|
15
|
+
//# sourceMappingURL=test-span.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-span.d.ts","sourceRoot":"","sources":["../../../src/core/bindings/test-span.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,QAAQ,CAUnC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared test helper for binding tests (Task 3.1.1).
|
|
4
|
+
* Returns a mock span with setAttribute(k,v) and an attributes bag so that
|
|
5
|
+
* PostgresSpan, RedisSpan, and HttpSpan tests can assert tagged values without OTel.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.testSpan = testSpan;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a mock span for use in binding tests. Calling setAttribute(k, v)
|
|
11
|
+
* stores the value in the span's attributes bag.
|
|
12
|
+
*/
|
|
13
|
+
function testSpan() {
|
|
14
|
+
const attributes = {};
|
|
15
|
+
return {
|
|
16
|
+
setAttribute(key, value) {
|
|
17
|
+
attributes[key] = value;
|
|
18
|
+
},
|
|
19
|
+
get attributes() {
|
|
20
|
+
return attributes;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=test-span.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-span.js","sourceRoot":"","sources":["../../../src/core/bindings/test-span.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAWH,4BAUC;AAdD;;;GAGG;AACH,SAAgB,QAAQ;IACtB,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,OAAO;QACL,YAAY,CAAC,GAAW,EAAE,KAAc;YACtC,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC1B,CAAC;QACD,IAAI,UAAU;YACZ,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture-mode cassette store accessor. Allows hooks to write NDJSON records
|
|
3
|
+
* without coupling them to init. Design §10: payloads written via single-threaded queue.
|
|
4
|
+
* HTTP outbound capture is done solely via the MSW interceptor (replay/http.ts).
|
|
5
|
+
*/
|
|
6
|
+
import type { CassetteStore } from '../../store/cassette-store';
|
|
7
|
+
/** Returns the current capture cassette store, if set (e.g. by init in capture mode). */
|
|
8
|
+
export declare function getCaptureStore(): CassetteStore | undefined;
|
|
9
|
+
/** Sets the capture cassette store (used by init or tests). */
|
|
10
|
+
export declare function setCaptureStore(store: CassetteStore | undefined): void;
|
|
11
|
+
//# sourceMappingURL=capture-store-accessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-store-accessor.d.ts","sourceRoot":"","sources":["../../../src/core/cassette/capture-store-accessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,yFAAyF;AACzF,wBAAgB,eAAe,IAAI,aAAa,GAAG,SAAS,CAE3D;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAEtE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capture-mode cassette store accessor. Allows hooks to write NDJSON records
|
|
4
|
+
* without coupling them to init. Design §10: payloads written via single-threaded queue.
|
|
5
|
+
* HTTP outbound capture is done solely via the MSW interceptor (replay/http.ts).
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.getCaptureStore = getCaptureStore;
|
|
9
|
+
exports.setCaptureStore = setCaptureStore;
|
|
10
|
+
let captureStore;
|
|
11
|
+
/** Returns the current capture cassette store, if set (e.g. by init in capture mode). */
|
|
12
|
+
function getCaptureStore() {
|
|
13
|
+
return captureStore;
|
|
14
|
+
}
|
|
15
|
+
/** Sets the capture cassette store (used by init or tests). */
|
|
16
|
+
function setCaptureStore(store) {
|
|
17
|
+
captureStore = store;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=capture-store-accessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-store-accessor.js","sourceRoot":"","sources":["../../../src/core/cassette/capture-store-accessor.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAOH,0CAEC;AAGD,0CAEC;AAVD,IAAI,YAAuC,CAAC;AAE5C,yFAAyF;AACzF,SAAgB,eAAe;IAC7B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,+DAA+D;AAC/D,SAAgB,eAAe,CAAC,KAAgC;IAC9D,YAAY,GAAG,KAAK,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context } from '@opentelemetry/api';
|
|
2
|
+
import { resolveRequestStorage } from './request-storage';
|
|
3
|
+
type HeaderMap = Record<string, string | string[] | undefined>;
|
|
4
|
+
/**
|
|
5
|
+
* Resolves request storage using shared priority:
|
|
6
|
+
* 1) existing scoped cassette on current OTel context
|
|
7
|
+
* 2) globally configured cassette on ROOT_CONTEXT
|
|
8
|
+
* 3) global cassetteDirectory + traceId (Task 13.11: per-trace files from config)
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveRequestStorageForContext(_headers: HeaderMap | undefined, otelContext?: Context,
|
|
11
|
+
/** Request traceId; when set with global cassetteDirectory, yields per-trace cassette. */
|
|
12
|
+
traceId?: string): ReturnType<typeof resolveRequestStorage>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=context-request-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-request-storage.d.ts","sourceRoot":"","sources":["../../../src/core/cassette/context-request-storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,SAAS,GAAG,SAAS,EAC/B,WAAW,GAAE,OAA0B;AACvC,0FAA0F;AAC1F,OAAO,CAAC,EAAE,MAAM,GACf,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAQ1C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRequestStorageForContext = resolveRequestStorageForContext;
|
|
4
|
+
const api_1 = require("@opentelemetry/api");
|
|
5
|
+
const context_1 = require("../../context");
|
|
6
|
+
const request_storage_1 = require("./request-storage");
|
|
7
|
+
/**
|
|
8
|
+
* Resolves request storage using shared priority:
|
|
9
|
+
* 1) existing scoped cassette on current OTel context
|
|
10
|
+
* 2) globally configured cassette on ROOT_CONTEXT
|
|
11
|
+
* 3) global cassetteDirectory + traceId (Task 13.11: per-trace files from config)
|
|
12
|
+
*/
|
|
13
|
+
function resolveRequestStorageForContext(_headers, otelContext = api_1.context.active(),
|
|
14
|
+
/** Request traceId; when set with global cassetteDirectory, yields per-trace cassette. */
|
|
15
|
+
traceId) {
|
|
16
|
+
const cassetteDirectory = context_1.SoftprobeContext.getCassetteDirectory(api_1.ROOT_CONTEXT);
|
|
17
|
+
return (0, request_storage_1.resolveRequestStorage)({
|
|
18
|
+
existingCassette: context_1.SoftprobeContext.getScopedCassette(otelContext),
|
|
19
|
+
configuredCassette: context_1.SoftprobeContext.getCassette(api_1.ROOT_CONTEXT),
|
|
20
|
+
cassetteDirectory,
|
|
21
|
+
traceId,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=context-request-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-request-storage.js","sourceRoot":"","sources":["../../../src/core/cassette/context-request-storage.ts"],"names":[],"mappings":";;AAaA,0EAaC;AA1BD,4CAA2D;AAE3D,2CAAiD;AACjD,uDAA0D;AAI1D;;;;;GAKG;AACH,SAAgB,+BAA+B,CAC7C,QAA+B,EAC/B,cAAuB,aAAO,CAAC,MAAM,EAAE;AACvC,0FAA0F;AAC1F,OAAgB;IAEhB,MAAM,iBAAiB,GAAG,0BAAgB,CAAC,oBAAoB,CAAC,kBAAY,CAAC,CAAC;IAC9E,OAAO,IAAA,uCAAqB,EAAC;QAC3B,gBAAgB,EAAE,0BAAgB,CAAC,iBAAiB,CAAC,WAAW,CAAC;QACjE,kBAAkB,EAAE,0BAAgB,CAAC,WAAW,CAAC,kBAAY,CAAC;QAC9D,iBAAiB;QACjB,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared cassette interfaces and adapters.
|
|
3
|
+
*/
|
|
4
|
+
export { NdjsonCassette } from './ndjson-cassette';
|
|
5
|
+
export { resolveRequestStorage } from './request-storage';
|
|
6
|
+
export { resolveRequestStorageForContext } from './context-request-storage';
|
|
7
|
+
export { getCaptureStore, setCaptureStore } from './capture-store-accessor';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/cassette/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setCaptureStore = exports.getCaptureStore = exports.resolveRequestStorageForContext = exports.resolveRequestStorage = exports.NdjsonCassette = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Shared cassette interfaces and adapters.
|
|
6
|
+
*/
|
|
7
|
+
var ndjson_cassette_1 = require("./ndjson-cassette");
|
|
8
|
+
Object.defineProperty(exports, "NdjsonCassette", { enumerable: true, get: function () { return ndjson_cassette_1.NdjsonCassette; } });
|
|
9
|
+
var request_storage_1 = require("./request-storage");
|
|
10
|
+
Object.defineProperty(exports, "resolveRequestStorage", { enumerable: true, get: function () { return request_storage_1.resolveRequestStorage; } });
|
|
11
|
+
var context_request_storage_1 = require("./context-request-storage");
|
|
12
|
+
Object.defineProperty(exports, "resolveRequestStorageForContext", { enumerable: true, get: function () { return context_request_storage_1.resolveRequestStorageForContext; } });
|
|
13
|
+
var capture_store_accessor_1 = require("./capture-store-accessor");
|
|
14
|
+
Object.defineProperty(exports, "getCaptureStore", { enumerable: true, get: function () { return capture_store_accessor_1.getCaptureStore; } });
|
|
15
|
+
Object.defineProperty(exports, "setCaptureStore", { enumerable: true, get: function () { return capture_store_accessor_1.setCaptureStore; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/cassette/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAA0D;AAAjD,wHAAA,qBAAqB,OAAA;AAC9B,qEAA4E;AAAnE,0IAAA,+BAA+B,OAAA;AACxC,mEAA4E;AAAnE,yHAAA,eAAe,OAAA;AAAE,yHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SoftprobeCassetteRecord } from '../../types/schema';
|
|
2
|
+
/**
|
|
3
|
+
* NDJSON-backed cassette adapter. One file per trace: path = {cassetteDirectory}/{traceId}.ndjson.
|
|
4
|
+
* Writes directly to disk (no buffer); flush() is a no-op. Optimizations (e.g. buffering) can be added later.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NdjsonCassette {
|
|
7
|
+
private readonly path;
|
|
8
|
+
constructor(cassetteDirectory: string, traceId: string);
|
|
9
|
+
/**
|
|
10
|
+
* Loads all records from this cassette file (cassette is bound to one trace; one file per trace).
|
|
11
|
+
*/
|
|
12
|
+
loadTrace(): Promise<SoftprobeCassetteRecord[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Appends a single record as one NDJSON line. Writes directly to the file.
|
|
15
|
+
*/
|
|
16
|
+
saveRecord(record: SoftprobeCassetteRecord): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* No-op for direct-write implementation. Optional flush hook for future buffered implementations.
|
|
19
|
+
*/
|
|
20
|
+
flush(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ndjson-cassette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndjson-cassette.d.ts","sourceRoot":"","sources":["../../../src/core/cassette/ndjson-cassette.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAkBlE;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAElB,iBAAiB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAItD;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAIrD;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhE;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NdjsonCassette = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
/** Task 13.10: Read logic lives in cassette layer; one file per trace so no traceId filter. */
|
|
10
|
+
async function readNdjsonFile(filePath) {
|
|
11
|
+
const out = [];
|
|
12
|
+
try {
|
|
13
|
+
const content = await promises_1.default.readFile(filePath, 'utf8');
|
|
14
|
+
for (const line of content.split(/\r?\n/)) {
|
|
15
|
+
if (!line.trim())
|
|
16
|
+
continue;
|
|
17
|
+
out.push(JSON.parse(line));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err.code === 'ENOENT')
|
|
22
|
+
return [];
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* NDJSON-backed cassette adapter. One file per trace: path = {cassetteDirectory}/{traceId}.ndjson.
|
|
29
|
+
* Writes directly to disk (no buffer); flush() is a no-op. Optimizations (e.g. buffering) can be added later.
|
|
30
|
+
*/
|
|
31
|
+
class NdjsonCassette {
|
|
32
|
+
constructor(cassetteDirectory, traceId) {
|
|
33
|
+
this.path = path_1.default.join(cassetteDirectory, `${traceId}.ndjson`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Loads all records from this cassette file (cassette is bound to one trace; one file per trace).
|
|
37
|
+
*/
|
|
38
|
+
async loadTrace() {
|
|
39
|
+
return readNdjsonFile(this.path);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Appends a single record as one NDJSON line. Writes directly to the file.
|
|
43
|
+
*/
|
|
44
|
+
async saveRecord(record) {
|
|
45
|
+
const serialized = JSON.stringify(record) + '\n';
|
|
46
|
+
await promises_1.default.appendFile(this.path, serialized, 'utf8');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* No-op for direct-write implementation. Optional flush hook for future buffered implementations.
|
|
50
|
+
*/
|
|
51
|
+
async flush() {
|
|
52
|
+
// Direct write; nothing to flush.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.NdjsonCassette = NdjsonCassette;
|
|
56
|
+
//# sourceMappingURL=ndjson-cassette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndjson-cassette.js","sourceRoot":"","sources":["../../../src/core/cassette/ndjson-cassette.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA6B;AAC7B,gDAAwB;AAGxB,+FAA+F;AAC/F,KAAK,UAAU,cAAc,CAAC,QAAgB;IAC5C,MAAM,GAAG,GAA8B,EAAE,CAAC;IAC1C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBAAE,SAAS;YAC3B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAA4B,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAC;QAChE,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAa,cAAc;IAGzB,YAAY,iBAAyB,EAAE,OAAe;QACpD,IAAI,CAAC,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,OAAO,SAAS,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,MAA+B;QAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACjD,MAAM,kBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,kCAAkC;IACpC,CAAC;CACF;AA5BD,wCA4BC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Cassette } from '../../types/schema';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves request-scoped cassette storage from existing storage, configured cassette,
|
|
4
|
+
* or global cassetteDirectory + traceId (Task 13.11). Cassette path is always
|
|
5
|
+
* {cassetteDirectory}/{traceId}.ndjson; no header is used.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveRequestStorage(input: {
|
|
8
|
+
existingCassette?: Cassette;
|
|
9
|
+
configuredCassette?: Cassette;
|
|
10
|
+
/** When set with traceId, get-or-create cassette for per-trace file. */
|
|
11
|
+
cassetteDirectory?: string;
|
|
12
|
+
traceId?: string;
|
|
13
|
+
}): {
|
|
14
|
+
storage: Cassette;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=request-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-storage.d.ts","sourceRoot":"","sources":["../../../src/core/cassette/request-storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,gBAAgB,CAAC,EAAE,QAAQ,CAAC;IAC5B,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAWxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRequestStorage = resolveRequestStorage;
|
|
4
|
+
const context_1 = require("../../context");
|
|
5
|
+
/**
|
|
6
|
+
* Resolves request-scoped cassette storage from existing storage, configured cassette,
|
|
7
|
+
* or global cassetteDirectory + traceId (Task 13.11). Cassette path is always
|
|
8
|
+
* {cassetteDirectory}/{traceId}.ndjson; no header is used.
|
|
9
|
+
*/
|
|
10
|
+
function resolveRequestStorage(input) {
|
|
11
|
+
if (input.existingCassette)
|
|
12
|
+
return { storage: input.existingCassette };
|
|
13
|
+
if (input.configuredCassette)
|
|
14
|
+
return { storage: input.configuredCassette };
|
|
15
|
+
if (input.cassetteDirectory && input.traceId) {
|
|
16
|
+
return {
|
|
17
|
+
storage: context_1.SoftprobeContext.getOrCreateCassette(input.cassetteDirectory, input.traceId),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
throw new Error('Softprobe cassette storage is not configured. Provide configured storage or cassetteDirectory + traceId.');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=request-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-storage.js","sourceRoot":"","sources":["../../../src/core/cassette/request-storage.ts"],"names":[],"mappings":";;AAQA,sDAiBC;AAzBD,2CAAiD;AAGjD;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,KAMrC;IACC,IAAI,KAAK,CAAC,gBAAgB;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC;IACvE,IAAI,KAAK,CAAC,kBAAkB;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC;IAC3E,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO;YACL,OAAO,EAAE,0BAAgB,CAAC,mBAAmB,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC;SACtF,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/context/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoftprobeContext = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Shared context contract for scoped softprobe execution.
|
|
6
|
+
*/
|
|
7
|
+
var context_1 = require("../../context");
|
|
8
|
+
Object.defineProperty(exports, "SoftprobeContext", { enumerable: true, get: function () { return context_1.SoftprobeContext; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/context/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yCAAiD;AAAxC,2GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared foundation contracts exposed to instrumentation packages.
|
|
3
|
+
*/
|
|
4
|
+
export type { Cassette, MatcherAction, MatcherFn, MatcherResult, MatchRequest, Protocol, RecordType, SoftprobeCassetteRecord, SoftprobeMode, SoftprobeRunOptions, } from '../../types/schema';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/contracts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,uBAAuB,EACvB,aAAa,EACb,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/contracts/index.ts"],"names":[],"mappings":""}
|