@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.
Files changed (328) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +202 -0
  3. package/bin/softprobe +15 -0
  4. package/dist/api/baggage.d.ts +13 -0
  5. package/dist/api/baggage.d.ts.map +1 -0
  6. package/dist/api/baggage.js +32 -0
  7. package/dist/api/baggage.js.map +1 -0
  8. package/dist/api/compare.d.ts +16 -0
  9. package/dist/api/compare.d.ts.map +1 -0
  10. package/dist/api/compare.js +77 -0
  11. package/dist/api/compare.js.map +1 -0
  12. package/dist/api.d.ts +63 -0
  13. package/dist/api.d.ts.map +1 -0
  14. package/dist/api.js +104 -0
  15. package/dist/api.js.map +1 -0
  16. package/dist/bindings/http-span.d.ts +6 -0
  17. package/dist/bindings/http-span.d.ts.map +1 -0
  18. package/dist/bindings/http-span.js +11 -0
  19. package/dist/bindings/http-span.js.map +1 -0
  20. package/dist/bindings/postgres-span.d.ts +6 -0
  21. package/dist/bindings/postgres-span.d.ts.map +1 -0
  22. package/dist/bindings/postgres-span.js +11 -0
  23. package/dist/bindings/postgres-span.js.map +1 -0
  24. package/dist/bindings/redis-span.d.ts +6 -0
  25. package/dist/bindings/redis-span.d.ts.map +1 -0
  26. package/dist/bindings/redis-span.js +11 -0
  27. package/dist/bindings/redis-span.js.map +1 -0
  28. package/dist/bindings/test-span.d.ts +6 -0
  29. package/dist/bindings/test-span.d.ts.map +1 -0
  30. package/dist/bindings/test-span.js +9 -0
  31. package/dist/bindings/test-span.js.map +1 -0
  32. package/dist/bootstrap/otel/framework-mutator.d.ts +20 -0
  33. package/dist/bootstrap/otel/framework-mutator.d.ts.map +1 -0
  34. package/dist/bootstrap/otel/framework-mutator.js +144 -0
  35. package/dist/bootstrap/otel/framework-mutator.js.map +1 -0
  36. package/dist/bootstrap/otel/inject.d.ts +17 -0
  37. package/dist/bootstrap/otel/inject.d.ts.map +1 -0
  38. package/dist/bootstrap/otel/inject.js +28 -0
  39. package/dist/bootstrap/otel/inject.js.map +1 -0
  40. package/dist/bootstrap/otel/mutator.d.ts +17 -0
  41. package/dist/bootstrap/otel/mutator.d.ts.map +1 -0
  42. package/dist/bootstrap/otel/mutator.js +51 -0
  43. package/dist/bootstrap/otel/mutator.js.map +1 -0
  44. package/dist/capture/express.d.ts +6 -0
  45. package/dist/capture/express.d.ts.map +1 -0
  46. package/dist/capture/express.js +11 -0
  47. package/dist/capture/express.js.map +1 -0
  48. package/dist/capture/fastify.d.ts +5 -0
  49. package/dist/capture/fastify.d.ts.map +1 -0
  50. package/dist/capture/fastify.js +9 -0
  51. package/dist/capture/fastify.js.map +1 -0
  52. package/dist/capture/framework-mutator.d.ts +20 -0
  53. package/dist/capture/framework-mutator.d.ts.map +1 -0
  54. package/dist/capture/framework-mutator.js +144 -0
  55. package/dist/capture/framework-mutator.js.map +1 -0
  56. package/dist/capture/http-inbound.d.ts +28 -0
  57. package/dist/capture/http-inbound.d.ts.map +1 -0
  58. package/dist/capture/http-inbound.js +40 -0
  59. package/dist/capture/http-inbound.js.map +1 -0
  60. package/dist/capture/inject.d.ts +17 -0
  61. package/dist/capture/inject.d.ts.map +1 -0
  62. package/dist/capture/inject.js +28 -0
  63. package/dist/capture/inject.js.map +1 -0
  64. package/dist/capture/mutator.d.ts +17 -0
  65. package/dist/capture/mutator.d.ts.map +1 -0
  66. package/dist/capture/mutator.js +51 -0
  67. package/dist/capture/mutator.js.map +1 -0
  68. package/dist/capture/postgres.d.ts +6 -0
  69. package/dist/capture/postgres.d.ts.map +1 -0
  70. package/dist/capture/postgres.js +11 -0
  71. package/dist/capture/postgres.js.map +1 -0
  72. package/dist/capture/redis.d.ts +5 -0
  73. package/dist/capture/redis.d.ts.map +1 -0
  74. package/dist/capture/redis.js +10 -0
  75. package/dist/capture/redis.js.map +1 -0
  76. package/dist/capture/store-accessor.d.ts +11 -0
  77. package/dist/capture/store-accessor.d.ts.map +1 -0
  78. package/dist/capture/store-accessor.js +19 -0
  79. package/dist/capture/store-accessor.js.map +1 -0
  80. package/dist/capture/stream-tap.d.ts +5 -0
  81. package/dist/capture/stream-tap.d.ts.map +1 -0
  82. package/dist/capture/stream-tap.js +9 -0
  83. package/dist/capture/stream-tap.js.map +1 -0
  84. package/dist/cli/diff-reporter.d.ts +26 -0
  85. package/dist/cli/diff-reporter.d.ts.map +1 -0
  86. package/dist/cli/diff-reporter.js +163 -0
  87. package/dist/cli/diff-reporter.js.map +1 -0
  88. package/dist/cli/diff.d.ts +18 -0
  89. package/dist/cli/diff.d.ts.map +1 -0
  90. package/dist/cli/diff.js +105 -0
  91. package/dist/cli/diff.js.map +1 -0
  92. package/dist/cli.d.ts +7 -0
  93. package/dist/cli.d.ts.map +1 -0
  94. package/dist/cli.js +84 -0
  95. package/dist/cli.js.map +1 -0
  96. package/dist/config/config-manager.d.ts +20 -0
  97. package/dist/config/config-manager.d.ts.map +1 -0
  98. package/dist/config/config-manager.js +46 -0
  99. package/dist/config/config-manager.js.map +1 -0
  100. package/dist/context.d.ts +98 -0
  101. package/dist/context.d.ts.map +1 -0
  102. package/dist/context.js +198 -0
  103. package/dist/context.js.map +1 -0
  104. package/dist/core/bindings/http-span.d.ts +39 -0
  105. package/dist/core/bindings/http-span.d.ts.map +1 -0
  106. package/dist/core/bindings/http-span.js +55 -0
  107. package/dist/core/bindings/http-span.js.map +1 -0
  108. package/dist/core/bindings/index.d.ts +12 -0
  109. package/dist/core/bindings/index.d.ts.map +1 -0
  110. package/dist/core/bindings/index.js +21 -0
  111. package/dist/core/bindings/index.js.map +1 -0
  112. package/dist/core/bindings/postgres-span.d.ts +41 -0
  113. package/dist/core/bindings/postgres-span.d.ts.map +1 -0
  114. package/dist/core/bindings/postgres-span.js +57 -0
  115. package/dist/core/bindings/postgres-span.js.map +1 -0
  116. package/dist/core/bindings/redis-span.d.ts +40 -0
  117. package/dist/core/bindings/redis-span.d.ts.map +1 -0
  118. package/dist/core/bindings/redis-span.js +65 -0
  119. package/dist/core/bindings/redis-span.js.map +1 -0
  120. package/dist/core/bindings/test-span.d.ts +15 -0
  121. package/dist/core/bindings/test-span.d.ts.map +1 -0
  122. package/dist/core/bindings/test-span.js +24 -0
  123. package/dist/core/bindings/test-span.js.map +1 -0
  124. package/dist/core/cassette/capture-store-accessor.d.ts +11 -0
  125. package/dist/core/cassette/capture-store-accessor.d.ts.map +1 -0
  126. package/dist/core/cassette/capture-store-accessor.js +19 -0
  127. package/dist/core/cassette/capture-store-accessor.js.map +1 -0
  128. package/dist/core/cassette/context-request-storage.d.ts +14 -0
  129. package/dist/core/cassette/context-request-storage.d.ts.map +1 -0
  130. package/dist/core/cassette/context-request-storage.js +24 -0
  131. package/dist/core/cassette/context-request-storage.js.map +1 -0
  132. package/dist/core/cassette/index.d.ts +8 -0
  133. package/dist/core/cassette/index.d.ts.map +1 -0
  134. package/dist/core/cassette/index.js +16 -0
  135. package/dist/core/cassette/index.js.map +1 -0
  136. package/dist/core/cassette/ndjson-cassette.d.ts +22 -0
  137. package/dist/core/cassette/ndjson-cassette.d.ts.map +1 -0
  138. package/dist/core/cassette/ndjson-cassette.js +56 -0
  139. package/dist/core/cassette/ndjson-cassette.js.map +1 -0
  140. package/dist/core/cassette/request-storage.d.ts +16 -0
  141. package/dist/core/cassette/request-storage.d.ts.map +1 -0
  142. package/dist/core/cassette/request-storage.js +22 -0
  143. package/dist/core/cassette/request-storage.js.map +1 -0
  144. package/dist/core/context/index.d.ts +5 -0
  145. package/dist/core/context/index.d.ts.map +1 -0
  146. package/dist/core/context/index.js +9 -0
  147. package/dist/core/context/index.js.map +1 -0
  148. package/dist/core/contracts/index.d.ts +5 -0
  149. package/dist/core/contracts/index.d.ts.map +1 -0
  150. package/dist/core/contracts/index.js +3 -0
  151. package/dist/core/contracts/index.js.map +1 -0
  152. package/dist/core/identifier.d.ts +20 -0
  153. package/dist/core/identifier.d.ts.map +1 -0
  154. package/dist/core/identifier.js +31 -0
  155. package/dist/core/identifier.js.map +1 -0
  156. package/dist/core/index.d.ts +11 -0
  157. package/dist/core/index.d.ts.map +1 -0
  158. package/dist/core/index.js +27 -0
  159. package/dist/core/index.js.map +1 -0
  160. package/dist/core/matcher/extract-key.d.ts +41 -0
  161. package/dist/core/matcher/extract-key.d.ts.map +1 -0
  162. package/dist/core/matcher/extract-key.js +80 -0
  163. package/dist/core/matcher/extract-key.js.map +1 -0
  164. package/dist/core/matcher/index.d.ts +9 -0
  165. package/dist/core/matcher/index.d.ts.map +1 -0
  166. package/dist/core/matcher/index.js +24 -0
  167. package/dist/core/matcher/index.js.map +1 -0
  168. package/dist/core/matcher/matcher.d.ts +25 -0
  169. package/dist/core/matcher/matcher.d.ts.map +1 -0
  170. package/dist/core/matcher/matcher.js +83 -0
  171. package/dist/core/matcher/matcher.js.map +1 -0
  172. package/dist/core/matcher/softprobe-matcher.d.ts +41 -0
  173. package/dist/core/matcher/softprobe-matcher.d.ts.map +1 -0
  174. package/dist/core/matcher/softprobe-matcher.js +92 -0
  175. package/dist/core/matcher/softprobe-matcher.js.map +1 -0
  176. package/dist/core/matcher/store-accessor.d.ts +14 -0
  177. package/dist/core/matcher/store-accessor.d.ts.map +1 -0
  178. package/dist/core/matcher/store-accessor.js +25 -0
  179. package/dist/core/matcher/store-accessor.js.map +1 -0
  180. package/dist/core/matcher/topology.d.ts +37 -0
  181. package/dist/core/matcher/topology.d.ts.map +1 -0
  182. package/dist/core/matcher/topology.js +72 -0
  183. package/dist/core/matcher/topology.js.map +1 -0
  184. package/dist/core/runtime/architecture-guard.d.ts +9 -0
  185. package/dist/core/runtime/architecture-guard.d.ts.map +1 -0
  186. package/dist/core/runtime/architecture-guard.js +131 -0
  187. package/dist/core/runtime/architecture-guard.js.map +1 -0
  188. package/dist/core/runtime/index.d.ts +6 -0
  189. package/dist/core/runtime/index.d.ts.map +1 -0
  190. package/dist/core/runtime/index.js +11 -0
  191. package/dist/core/runtime/index.js.map +1 -0
  192. package/dist/identifier.d.ts +5 -0
  193. package/dist/identifier.d.ts.map +1 -0
  194. package/dist/identifier.js +11 -0
  195. package/dist/identifier.js.map +1 -0
  196. package/dist/index.d.ts +5 -0
  197. package/dist/index.d.ts.map +1 -0
  198. package/dist/index.js +21 -0
  199. package/dist/index.js.map +1 -0
  200. package/dist/init.d.ts +21 -0
  201. package/dist/init.d.ts.map +1 -0
  202. package/dist/init.js +51 -0
  203. package/dist/init.js.map +1 -0
  204. package/dist/instrumentations/common/http/context-headers.d.ts +9 -0
  205. package/dist/instrumentations/common/http/context-headers.d.ts.map +1 -0
  206. package/dist/instrumentations/common/http/context-headers.js +16 -0
  207. package/dist/instrumentations/common/http/context-headers.js.map +1 -0
  208. package/dist/instrumentations/common/http/inbound-capture.d.ts +17 -0
  209. package/dist/instrumentations/common/http/inbound-capture.d.ts.map +1 -0
  210. package/dist/instrumentations/common/http/inbound-capture.js +41 -0
  211. package/dist/instrumentations/common/http/inbound-capture.js.map +1 -0
  212. package/dist/instrumentations/common/http/inbound-record.d.ts +28 -0
  213. package/dist/instrumentations/common/http/inbound-record.d.ts.map +1 -0
  214. package/dist/instrumentations/common/http/inbound-record.js +40 -0
  215. package/dist/instrumentations/common/http/inbound-record.js.map +1 -0
  216. package/dist/instrumentations/common/http/span-adapter.d.ts +6 -0
  217. package/dist/instrumentations/common/http/span-adapter.d.ts.map +1 -0
  218. package/dist/instrumentations/common/http/span-adapter.js +12 -0
  219. package/dist/instrumentations/common/http/span-adapter.js.map +1 -0
  220. package/dist/instrumentations/common/http/stream-tap.d.ts +28 -0
  221. package/dist/instrumentations/common/http/stream-tap.d.ts.map +1 -0
  222. package/dist/instrumentations/common/http/stream-tap.js +61 -0
  223. package/dist/instrumentations/common/http/stream-tap.js.map +1 -0
  224. package/dist/instrumentations/express/capture.d.ts +26 -0
  225. package/dist/instrumentations/express/capture.d.ts.map +1 -0
  226. package/dist/instrumentations/express/capture.js +80 -0
  227. package/dist/instrumentations/express/capture.js.map +1 -0
  228. package/dist/instrumentations/express/index.d.ts +7 -0
  229. package/dist/instrumentations/express/index.d.ts.map +1 -0
  230. package/dist/instrumentations/express/index.js +15 -0
  231. package/dist/instrumentations/express/index.js.map +1 -0
  232. package/dist/instrumentations/express/replay.d.ts +10 -0
  233. package/dist/instrumentations/express/replay.d.ts.map +1 -0
  234. package/dist/instrumentations/express/replay.js +16 -0
  235. package/dist/instrumentations/express/replay.js.map +1 -0
  236. package/dist/instrumentations/fastify/capture.d.ts +13 -0
  237. package/dist/instrumentations/fastify/capture.d.ts.map +1 -0
  238. package/dist/instrumentations/fastify/capture.js +65 -0
  239. package/dist/instrumentations/fastify/capture.js.map +1 -0
  240. package/dist/instrumentations/fastify/index.d.ts +7 -0
  241. package/dist/instrumentations/fastify/index.d.ts.map +1 -0
  242. package/dist/instrumentations/fastify/index.js +13 -0
  243. package/dist/instrumentations/fastify/index.js.map +1 -0
  244. package/dist/instrumentations/fastify/replay.d.ts +13 -0
  245. package/dist/instrumentations/fastify/replay.d.ts.map +1 -0
  246. package/dist/instrumentations/fastify/replay.js +24 -0
  247. package/dist/instrumentations/fastify/replay.js.map +1 -0
  248. package/dist/instrumentations/fetch/index.d.ts +5 -0
  249. package/dist/instrumentations/fetch/index.d.ts.map +1 -0
  250. package/dist/instrumentations/fetch/index.js +10 -0
  251. package/dist/instrumentations/fetch/index.js.map +1 -0
  252. package/dist/instrumentations/fetch/replay.d.ts +19 -0
  253. package/dist/instrumentations/fetch/replay.d.ts.map +1 -0
  254. package/dist/instrumentations/fetch/replay.js +259 -0
  255. package/dist/instrumentations/fetch/replay.js.map +1 -0
  256. package/dist/instrumentations/postgres/capture.d.ts +46 -0
  257. package/dist/instrumentations/postgres/capture.d.ts.map +1 -0
  258. package/dist/instrumentations/postgres/capture.js +68 -0
  259. package/dist/instrumentations/postgres/capture.js.map +1 -0
  260. package/dist/instrumentations/postgres/index.d.ts +6 -0
  261. package/dist/instrumentations/postgres/index.d.ts.map +1 -0
  262. package/dist/instrumentations/postgres/index.js +14 -0
  263. package/dist/instrumentations/postgres/index.js.map +1 -0
  264. package/dist/instrumentations/postgres/replay.d.ts +20 -0
  265. package/dist/instrumentations/postgres/replay.d.ts.map +1 -0
  266. package/dist/instrumentations/postgres/replay.js +163 -0
  267. package/dist/instrumentations/postgres/replay.js.map +1 -0
  268. package/dist/instrumentations/redis/capture.d.ts +20 -0
  269. package/dist/instrumentations/redis/capture.d.ts.map +1 -0
  270. package/dist/instrumentations/redis/capture.js +61 -0
  271. package/dist/instrumentations/redis/capture.js.map +1 -0
  272. package/dist/instrumentations/redis/index.d.ts +6 -0
  273. package/dist/instrumentations/redis/index.d.ts.map +1 -0
  274. package/dist/instrumentations/redis/index.js +13 -0
  275. package/dist/instrumentations/redis/index.js.map +1 -0
  276. package/dist/instrumentations/redis/replay.d.ts +24 -0
  277. package/dist/instrumentations/redis/replay.d.ts.map +1 -0
  278. package/dist/instrumentations/redis/replay.js +173 -0
  279. package/dist/instrumentations/redis/replay.js.map +1 -0
  280. package/dist/replay/express.d.ts +5 -0
  281. package/dist/replay/express.d.ts.map +1 -0
  282. package/dist/replay/express.js +9 -0
  283. package/dist/replay/express.js.map +1 -0
  284. package/dist/replay/extract-key.d.ts +41 -0
  285. package/dist/replay/extract-key.d.ts.map +1 -0
  286. package/dist/replay/extract-key.js +80 -0
  287. package/dist/replay/extract-key.js.map +1 -0
  288. package/dist/replay/fastify.d.ts +5 -0
  289. package/dist/replay/fastify.d.ts.map +1 -0
  290. package/dist/replay/fastify.js +9 -0
  291. package/dist/replay/fastify.js.map +1 -0
  292. package/dist/replay/http.d.ts +5 -0
  293. package/dist/replay/http.d.ts.map +1 -0
  294. package/dist/replay/http.js +10 -0
  295. package/dist/replay/http.js.map +1 -0
  296. package/dist/replay/matcher.d.ts +25 -0
  297. package/dist/replay/matcher.d.ts.map +1 -0
  298. package/dist/replay/matcher.js +83 -0
  299. package/dist/replay/matcher.js.map +1 -0
  300. package/dist/replay/postgres.d.ts +5 -0
  301. package/dist/replay/postgres.d.ts.map +1 -0
  302. package/dist/replay/postgres.js +10 -0
  303. package/dist/replay/postgres.js.map +1 -0
  304. package/dist/replay/redis.d.ts +5 -0
  305. package/dist/replay/redis.d.ts.map +1 -0
  306. package/dist/replay/redis.js +10 -0
  307. package/dist/replay/redis.js.map +1 -0
  308. package/dist/replay/softprobe-matcher.d.ts +41 -0
  309. package/dist/replay/softprobe-matcher.d.ts.map +1 -0
  310. package/dist/replay/softprobe-matcher.js +92 -0
  311. package/dist/replay/softprobe-matcher.js.map +1 -0
  312. package/dist/replay/store-accessor.d.ts +14 -0
  313. package/dist/replay/store-accessor.d.ts.map +1 -0
  314. package/dist/replay/store-accessor.js +26 -0
  315. package/dist/replay/store-accessor.js.map +1 -0
  316. package/dist/replay/topology.d.ts +37 -0
  317. package/dist/replay/topology.d.ts.map +1 -0
  318. package/dist/replay/topology.js +72 -0
  319. package/dist/replay/topology.js.map +1 -0
  320. package/dist/store/cassette-store.d.ts +36 -0
  321. package/dist/store/cassette-store.d.ts.map +1 -0
  322. package/dist/store/cassette-store.js +66 -0
  323. package/dist/store/cassette-store.js.map +1 -0
  324. package/dist/types/schema.d.ts +114 -0
  325. package/dist/types/schema.d.ts.map +1 -0
  326. package/dist/types/schema.js +13 -0
  327. package/dist/types/schema.js.map +1 -0
  328. package/package.json +88 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Topology-aware matching helpers (design §7.4).
3
+ * Read live parent name; build bySpanId index; filter candidates; createTopologyMatcher.
4
+ */
5
+ import type { MatcherFn, SoftprobeCassetteRecord } from '../../types/schema';
6
+ import { type SpanKey } from './extract-key';
7
+ /** Span-like with optional internal _parentSpanName (test or OTel plumbing). */
8
+ type SpanWithParent = {
9
+ _parentSpanName?: string;
10
+ } | undefined;
11
+ /**
12
+ * Returns the live parent span name for topology matching.
13
+ * If the span has _parentSpanName (set by instrumentation or tests), returns it; otherwise "root".
14
+ */
15
+ export declare function getLiveParentName(span: SpanWithParent): string;
16
+ /**
17
+ * Builds a map from spanId to record for lineage lookup (design §7.4).
18
+ * Enables looking up a record's parent via bySpanId.get(record.parentSpanId).
19
+ */
20
+ export declare function buildBySpanIdIndex(records: SoftprobeCassetteRecord[]): Map<string, SoftprobeCassetteRecord>;
21
+ /**
22
+ * Filters records to outbound candidates matching protocol+identifier (design §7.4).
23
+ * Same semantics as flat matcher's filterOutboundCandidates.
24
+ */
25
+ export declare function filterCandidatesByKey(records: SoftprobeCassetteRecord[], key: SpanKey): SoftprobeCassetteRecord[];
26
+ /**
27
+ * Prefers candidates whose recorded parent spanName matches live parent (design §7.4).
28
+ * Returns lineageMatches when non-empty, otherwise returns all candidates (fallback pool).
29
+ */
30
+ export declare function selectLineagePool(candidates: SoftprobeCassetteRecord[], bySpanId: Map<string, SoftprobeCassetteRecord>, liveParentName: string): SoftprobeCassetteRecord[];
31
+ /**
32
+ * Returns a MatcherFn that prefers candidates whose recorded parent spanName matches
33
+ * the live parent, with per-(protocol, identifier, liveParentName) call sequencing (design §7.4).
34
+ */
35
+ export declare function createTopologyMatcher(): MatcherFn;
36
+ export {};
37
+ //# sourceMappingURL=topology.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../../src/core/matcher/topology.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAiB,SAAS,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AAEvB,gFAAgF;AAChF,KAAK,cAAc,GAAG;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAE9D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,uBAAuB,EAAE,GACjC,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAEtC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,uBAAuB,EAAE,EAClC,GAAG,EAAE,OAAO,GACX,uBAAuB,EAAE,CAE3B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,uBAAuB,EAAE,EACrC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC9C,cAAc,EAAE,MAAM,GACrB,uBAAuB,EAAE,CAO3B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,CAsBjD"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * Topology-aware matching helpers (design §7.4).
4
+ * Read live parent name; build bySpanId index; filter candidates; createTopologyMatcher.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getLiveParentName = getLiveParentName;
8
+ exports.buildBySpanIdIndex = buildBySpanIdIndex;
9
+ exports.filterCandidatesByKey = filterCandidatesByKey;
10
+ exports.selectLineagePool = selectLineagePool;
11
+ exports.createTopologyMatcher = createTopologyMatcher;
12
+ const extract_key_1 = require("./extract-key");
13
+ /**
14
+ * Returns the live parent span name for topology matching.
15
+ * If the span has _parentSpanName (set by instrumentation or tests), returns it; otherwise "root".
16
+ */
17
+ function getLiveParentName(span) {
18
+ return span?._parentSpanName ?? 'root';
19
+ }
20
+ /**
21
+ * Builds a map from spanId to record for lineage lookup (design §7.4).
22
+ * Enables looking up a record's parent via bySpanId.get(record.parentSpanId).
23
+ */
24
+ function buildBySpanIdIndex(records) {
25
+ return new Map(records.map((r) => [r.spanId, r]));
26
+ }
27
+ /**
28
+ * Filters records to outbound candidates matching protocol+identifier (design §7.4).
29
+ * Same semantics as flat matcher's filterOutboundCandidates.
30
+ */
31
+ function filterCandidatesByKey(records, key) {
32
+ return (0, extract_key_1.filterOutboundCandidates)(records, key);
33
+ }
34
+ /**
35
+ * Prefers candidates whose recorded parent spanName matches live parent (design §7.4).
36
+ * Returns lineageMatches when non-empty, otherwise returns all candidates (fallback pool).
37
+ */
38
+ function selectLineagePool(candidates, bySpanId, liveParentName) {
39
+ const lineageMatches = candidates.filter((c) => {
40
+ if (!c.parentSpanId)
41
+ return liveParentName === 'root';
42
+ const parent = bySpanId.get(c.parentSpanId);
43
+ return (parent?.spanName ?? 'root') === liveParentName;
44
+ });
45
+ return lineageMatches.length > 0 ? lineageMatches : candidates;
46
+ }
47
+ /**
48
+ * Returns a MatcherFn that prefers candidates whose recorded parent spanName matches
49
+ * the live parent, with per-(protocol, identifier, liveParentName) call sequencing (design §7.4).
50
+ */
51
+ function createTopologyMatcher() {
52
+ const callSeq = new Map();
53
+ return (span, records) => {
54
+ const key = (0, extract_key_1.extractKeyFromSpan)(span);
55
+ if (!key)
56
+ return { action: 'CONTINUE' };
57
+ const liveParentName = getLiveParentName(span);
58
+ const candidates = filterCandidatesByKey(records, key);
59
+ if (candidates.length === 0)
60
+ return { action: 'CONTINUE' };
61
+ const bySpanId = buildBySpanIdIndex(records);
62
+ const pool = selectLineagePool(candidates, bySpanId, liveParentName);
63
+ const seqKey = `${key.protocol}::${key.identifier}::${liveParentName}`;
64
+ const n = callSeq.get(seqKey) ?? 0;
65
+ const picked = pool[n];
66
+ callSeq.set(seqKey, n + 1);
67
+ if (!picked)
68
+ return { action: 'CONTINUE' };
69
+ return { action: 'MOCK', payload: picked.responsePayload };
70
+ };
71
+ }
72
+ //# sourceMappingURL=topology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topology.js","sourceRoot":"","sources":["../../../src/core/matcher/topology.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAgBH,8CAEC;AAMD,gDAIC;AAMD,sDAKC;AAMD,8CAWC;AAMD,sDAsBC;AAjFD,+CAIuB;AAKvB;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,IAAoB;IACpD,OAAQ,IAAY,EAAE,eAAe,IAAI,MAAM,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAChC,OAAkC;IAElC,OAAO,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AAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAE3D,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,iBAAiB,CAAC,UAAU,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;QAErE,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,UAAU,KAAK,cAAc,EAAE,CAAC;QACvE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;QAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns true when source text contains a forbidden instrumentation import for the given scope.
3
+ */
4
+ export declare function hasForbiddenImport(source: string, scope: 'core' | 'instrumentation'): boolean;
5
+ /**
6
+ * Scans repository source layout for architecture violations described by Task 2.10.
7
+ */
8
+ export declare function collectArchitectureViolations(): string[];
9
+ //# sourceMappingURL=architecture-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architecture-guard.d.ts","sourceRoot":"","sources":["../../../src/core/runtime/architecture-guard.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,OAAO,CAK7F;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,EAAE,CA+DxD"}
@@ -0,0 +1,131 @@
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.hasForbiddenImport = hasForbiddenImport;
7
+ exports.collectArchitectureViolations = collectArchitectureViolations;
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const SRC_ROOT = node_path_1.default.resolve(__dirname, '..', '..');
11
+ const INSTRUMENTATIONS_ROOT = node_path_1.default.join(SRC_ROOT, 'instrumentations');
12
+ const CORE_ROOT = node_path_1.default.join(SRC_ROOT, 'core');
13
+ const LEGACY_RETIREMENT_DIRS = [
14
+ node_path_1.default.join(SRC_ROOT, 'bindings'),
15
+ node_path_1.default.join(SRC_ROOT, 'capture'),
16
+ node_path_1.default.join(SRC_ROOT, 'replay'),
17
+ ];
18
+ /**
19
+ * Returns true when source text contains a forbidden instrumentation import for the given scope.
20
+ */
21
+ function hasForbiddenImport(source, scope) {
22
+ if (scope === 'core') {
23
+ return /from\s+['\"][^'\"]*(instrumentations\/|capture\/|replay\/|bindings\/)/.test(source);
24
+ }
25
+ return /from\s+['\"][^'\"]*instrumentations\/(?!common\/)/.test(source);
26
+ }
27
+ /**
28
+ * Scans repository source layout for architecture violations described by Task 2.10.
29
+ */
30
+ function collectArchitectureViolations() {
31
+ const violations = [];
32
+ const coreFiles = collectTsFiles(CORE_ROOT);
33
+ for (const file of coreFiles) {
34
+ const imports = collectImportSpecifiers(node_fs_1.default.readFileSync(file, 'utf8'));
35
+ for (const specifier of imports) {
36
+ if (!specifier.startsWith('.'))
37
+ continue;
38
+ const resolved = resolveToTsPath(file, specifier);
39
+ if (resolved) {
40
+ const normalizedPath = normalized(resolved);
41
+ if (normalizedPath.includes('/src/instrumentations/')) {
42
+ violations.push(`core-imports-instrumentation: ${relative(file)} -> ${specifier}`);
43
+ }
44
+ else if (normalizedPath.includes('/src/capture/')
45
+ || normalizedPath.includes('/src/replay/')
46
+ || normalizedPath.includes('/src/bindings/')) {
47
+ violations.push(`core-imports-legacy: ${relative(file)} -> ${specifier}`);
48
+ }
49
+ }
50
+ }
51
+ }
52
+ const packageDirs = node_fs_1.default
53
+ .readdirSync(INSTRUMENTATIONS_ROOT, { withFileTypes: true })
54
+ .filter((entry) => entry.isDirectory() && entry.name !== 'common')
55
+ .map((entry) => node_path_1.default.join(INSTRUMENTATIONS_ROOT, entry.name));
56
+ for (const packageDir of packageDirs) {
57
+ const packageName = node_path_1.default.basename(packageDir);
58
+ const files = collectTsFiles(packageDir);
59
+ for (const file of files) {
60
+ const imports = collectImportSpecifiers(node_fs_1.default.readFileSync(file, 'utf8'));
61
+ for (const specifier of imports) {
62
+ if (!specifier.startsWith('.'))
63
+ continue;
64
+ const resolved = resolveToTsPath(file, specifier);
65
+ if (!resolved)
66
+ continue;
67
+ const normalizedPath = normalized(resolved);
68
+ if (normalizedPath.includes('/src/bindings/')
69
+ || normalizedPath.includes('/src/capture/')
70
+ || normalizedPath.includes('/src/replay/')) {
71
+ violations.push(`instrumentation-imports-legacy-helper: ${relative(file)} -> ${specifier}`);
72
+ continue;
73
+ }
74
+ if (!normalizedPath.includes('/src/instrumentations/'))
75
+ continue;
76
+ if (normalizedPath.includes('/src/instrumentations/common/'))
77
+ continue;
78
+ if (normalizedPath.includes(`/src/instrumentations/${packageName}/`))
79
+ continue;
80
+ violations.push(`instrumentation-cross-package-import: ${relative(file)} -> ${specifier}`);
81
+ }
82
+ }
83
+ }
84
+ for (const legacyDir of LEGACY_RETIREMENT_DIRS) {
85
+ const files = collectTsFiles(legacyDir);
86
+ for (const file of files) {
87
+ violations.push(`legacy-path-retired: ${relative(file)}`);
88
+ }
89
+ }
90
+ return violations;
91
+ }
92
+ function collectTsFiles(dir) {
93
+ if (!node_fs_1.default.existsSync(dir))
94
+ return [];
95
+ const out = [];
96
+ for (const entry of node_fs_1.default.readdirSync(dir, { withFileTypes: true })) {
97
+ const absolutePath = node_path_1.default.join(dir, entry.name);
98
+ if (entry.isDirectory()) {
99
+ out.push(...collectTsFiles(absolutePath));
100
+ continue;
101
+ }
102
+ if (entry.isFile() && absolutePath.endsWith('.ts') && !absolutePath.includes('/__tests__/')) {
103
+ out.push(absolutePath);
104
+ }
105
+ }
106
+ return out;
107
+ }
108
+ function collectImportSpecifiers(source) {
109
+ const out = [];
110
+ const regex = /from\s+['\"]([^'\"]+)['\"]/g;
111
+ for (const match of source.matchAll(regex)) {
112
+ out.push(match[1]);
113
+ }
114
+ return out;
115
+ }
116
+ function resolveToTsPath(fromFile, specifier) {
117
+ const candidate = node_path_1.default.resolve(node_path_1.default.dirname(fromFile), specifier);
118
+ const candidates = [candidate, `${candidate}.ts`, node_path_1.default.join(candidate, 'index.ts')];
119
+ for (const file of candidates) {
120
+ if (node_fs_1.default.existsSync(file))
121
+ return file;
122
+ }
123
+ return null;
124
+ }
125
+ function normalized(filePath) {
126
+ return filePath.replace(/\\/g, '/');
127
+ }
128
+ function relative(filePath) {
129
+ return normalized(node_path_1.default.relative(SRC_ROOT, filePath));
130
+ }
131
+ //# sourceMappingURL=architecture-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architecture-guard.js","sourceRoot":"","sources":["../../../src/core/runtime/architecture-guard.ts"],"names":[],"mappings":";;;;;AAgBA,gDAKC;AAKD,sEA+DC;AAzFD,sDAAyB;AACzB,0DAA6B;AAE7B,MAAM,QAAQ,GAAG,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACrD,MAAM,qBAAqB,GAAG,mBAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACtE,MAAM,SAAS,GAAG,mBAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAE9C,MAAM,sBAAsB,GAAG;IAC7B,mBAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC/B,mBAAI,CAAC,IAA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C,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared runtime helpers used by instrumentation packages.
3
+ */
4
+ export { resolveRequestStorage } from '../cassette/request-storage';
5
+ export { resolveRequestStorageForContext } from '../cassette/context-request-storage';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/runtime/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRequestStorageForContext = exports.resolveRequestStorage = void 0;
4
+ /**
5
+ * Shared runtime helpers used by instrumentation packages.
6
+ */
7
+ var request_storage_1 = require("../cassette/request-storage");
8
+ Object.defineProperty(exports, "resolveRequestStorage", { enumerable: true, get: function () { return request_storage_1.resolveRequestStorage; } });
9
+ var context_request_storage_1 = require("../cassette/context-request-storage");
10
+ Object.defineProperty(exports, "resolveRequestStorageForContext", { enumerable: true, get: function () { return context_request_storage_1.resolveRequestStorageForContext; } });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/runtime/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAAoE;AAA3D,wHAAA,qBAAqB,OAAA;AAC9B,+EAAsF;AAA7E,0IAAA,+BAA+B,OAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Legacy compatibility re-export for identifier helpers.
3
+ */
4
+ export { httpIdentifier, redisIdentifier, pgIdentifier } from './core/identifier';
5
+ //# sourceMappingURL=identifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../src/identifier.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pgIdentifier = exports.redisIdentifier = exports.httpIdentifier = void 0;
4
+ /**
5
+ * Legacy compatibility re-export for identifier helpers.
6
+ */
7
+ var identifier_1 = require("./core/identifier");
8
+ Object.defineProperty(exports, "httpIdentifier", { enumerable: true, get: function () { return identifier_1.httpIdentifier; } });
9
+ Object.defineProperty(exports, "redisIdentifier", { enumerable: true, get: function () { return identifier_1.redisIdentifier; } });
10
+ Object.defineProperty(exports, "pgIdentifier", { enumerable: true, get: function () { return identifier_1.pgIdentifier; } });
11
+ //# sourceMappingURL=identifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier.js","sourceRoot":"","sources":["../src/identifier.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,gDAAkF;AAAzE,4GAAA,cAAc,OAAA;AAAE,6GAAA,eAAe,OAAA;AAAE,0GAAA,YAAY,OAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Public API for the Softprobe package. Design §4.2.
3
+ */
4
+ export * from './api';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,OAAO,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Public API for the Softprobe package. Design §4.2.
19
+ */
20
+ __exportStar(require("./api"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,wCAAsB"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Boot entry: softprobe/init.
3
+ * Must be imported first (before OTel). Reads config from .softprobe/config.yml
4
+ * (or SOFTPROBE_CONFIG_PATH) and seeds global state. Design §4.1, §11.
5
+ * Mode and cassette location come from config only (cassetteDirectory or cassettePath; no env fallback).
6
+ * Task 13.1: when cassetteDirectory is set, init does not create or pass a single-file cassette.
7
+ *
8
+ * Instrumentation is always the same for all modes: mutators and replay patches are applied once.
9
+ * Wrappers (pg, redis, http via MSW) take action at runtime based on SoftprobeContext.getMode().
10
+ * All replay patches are applied here so the app only needs to load init before OTel (one-line init; design §4.1).
11
+ */
12
+ declare const pathModule: any;
13
+ declare const ConfigManager: any;
14
+ declare const SoftprobeContext: any;
15
+ declare const configPath: string;
16
+ declare const applyAutoInstrumentationMutator: any;
17
+ declare const applyFrameworkMutators: any;
18
+ declare const setupHttpReplayInterceptor: any;
19
+ declare const setupPostgresReplay: any;
20
+ declare const setupRedisReplay: any, applyRedisReplay: any;
21
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,QAAA,MAAM,UAAU,KAAkB,CAAC;AACnC,QAAA,MAAQ,aAAa,KAAuC,CAAC;AAC7D,QAAA,MAAQ,gBAAgB,KAAyB,CAAC;AAElD,QAAA,MAAM,UAAU,QAAiE,CAAC;AA6BlF,QAAA,MAAQ,+BAA+B,KAAwC,CAAC;AAChF,QAAA,MAAQ,sBAAsB,KAAkD,CAAC;AACjF,QAAA,MAAQ,0BAA0B,KAAwC,CAAC;AAC3E,QAAA,MAAQ,mBAAmB,KAA2C,CAAC;AACvE,QAAA,MAAQ,gBAAgB,OAAE,gBAAgB,KAAwC,CAAC"}
package/dist/init.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * Boot entry: softprobe/init.
4
+ * Must be imported first (before OTel). Reads config from .softprobe/config.yml
5
+ * (or SOFTPROBE_CONFIG_PATH) and seeds global state. Design §4.1, §11.
6
+ * Mode and cassette location come from config only (cassetteDirectory or cassettePath; no env fallback).
7
+ * Task 13.1: when cassetteDirectory is set, init does not create or pass a single-file cassette.
8
+ *
9
+ * Instrumentation is always the same for all modes: mutators and replay patches are applied once.
10
+ * Wrappers (pg, redis, http via MSW) take action at runtime based on SoftprobeContext.getMode().
11
+ * All replay patches are applied here so the app only needs to load init before OTel (one-line init; design §4.1).
12
+ */
13
+ const pathModule = require('path');
14
+ const { ConfigManager } = require('./config/config-manager');
15
+ const { SoftprobeContext } = require('./context');
16
+ const configPath = process.env.SOFTPROBE_CONFIG_PATH ?? './.softprobe/config.yml';
17
+ try {
18
+ const mgr = new ConfigManager(configPath);
19
+ const g = mgr.get();
20
+ const cassetteDirectory = g.cassetteDirectory ??
21
+ (typeof g.cassettePath === 'string' && g.cassettePath ? pathModule.dirname(g.cassettePath) : undefined);
22
+ SoftprobeContext.initGlobal({
23
+ mode: g.mode,
24
+ cassetteDirectory,
25
+ storage: undefined,
26
+ strictReplay: g.replay?.strictReplay,
27
+ strictComparison: g.replay?.strictComparison,
28
+ });
29
+ }
30
+ catch {
31
+ SoftprobeContext.initGlobal({
32
+ mode: 'PASSTHROUGH',
33
+ cassetteDirectory: undefined,
34
+ storage: undefined,
35
+ strictReplay: false,
36
+ strictComparison: false,
37
+ });
38
+ }
39
+ const { applyAutoInstrumentationMutator } = require('./bootstrap/otel/mutator');
40
+ const { applyFrameworkMutators } = require('./bootstrap/otel/framework-mutator');
41
+ const { setupHttpReplayInterceptor } = require('./instrumentations/fetch');
42
+ const { setupPostgresReplay } = require('./instrumentations/postgres');
43
+ const { setupRedisReplay, applyRedisReplay } = require('./instrumentations/redis');
44
+ applyAutoInstrumentationMutator();
45
+ applyFrameworkMutators();
46
+ // Redis: wrap attachCommands before redis is ever loaded (e.g. by OTel during sdk.start()).
47
+ setupRedisReplay();
48
+ setupHttpReplayInterceptor();
49
+ setupPostgresReplay();
50
+ applyRedisReplay(require('redis'));
51
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AAEH,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACnC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAC7D,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAElD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,yBAAyB,CAAC;AAClF,IAAI,CAAC;IACH,MAAM,GAAG,GAAG,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,EAKhB,CAAC;IACF,MAAM,iBAAiB,GACrB,CAAC,CAAC,iBAAiB;QACnB,CAAC,OAAO,CAAC,CAAC,YAAY,KAAK,QAAQ,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1G,gBAAgB,CAAC,UAAU,CAAC;QAC1B,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,iBAAiB;QACjB,OAAO,EAAE,SAAS;QAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,YAAY;QACpC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,gBAAgB;KAC7C,CAAC,CAAC;AACL,CAAC;AAAC,MAAM,CAAC;IACP,gBAAgB,CAAC,UAAU,CAAC;QAC1B,IAAI,EAAE,aAAa;QACnB,iBAAiB,EAAE,SAAS;QAC5B,OAAO,EAAE,SAAS;QAClB,YAAY,EAAE,KAAK;QACnB,gBAAgB,EAAE,KAAK;KACxB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,EAAE,+BAA+B,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAChF,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACjF,MAAM,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC3E,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AACvE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEnF,+BAA+B,EAAE,CAAC;AAClC,sBAAsB,EAAE,CAAC;AACzB,4FAA4F;AAC5F,gBAAgB,EAAE,CAAC;AACnB,0BAA0B,EAAE,CAAC;AAC7B,mBAAmB,EAAE,CAAC;AACtB,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shared HTTP header helpers for instrumentation packages.
3
+ */
4
+ export type HeaderMap = Record<string, string | string[] | undefined>;
5
+ /**
6
+ * Returns a normalized lower-case header map from mixed-case input keys.
7
+ */
8
+ export declare function normalizeHeaderMap(headers: HeaderMap | undefined): HeaderMap;
9
+ //# sourceMappingURL=context-headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-headers.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/common/http/context-headers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAEtE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAS5E"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeHeaderMap = normalizeHeaderMap;
4
+ /**
5
+ * Returns a normalized lower-case header map from mixed-case input keys.
6
+ */
7
+ function normalizeHeaderMap(headers) {
8
+ if (!headers)
9
+ return {};
10
+ const normalized = {};
11
+ for (const [key, value] of Object.entries(headers)) {
12
+ normalized[key.toLowerCase()] = value;
13
+ }
14
+ return normalized;
15
+ }
16
+ //# sourceMappingURL=context-headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-headers.js","sourceRoot":"","sources":["../../../../src/instrumentations/common/http/context-headers.ts"],"names":[],"mappings":";;AAQA,gDASC;AAZD;;GAEG;AACH,SAAgB,kBAAkB,CAAC,OAA8B;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,UAAU,GAAc,EAAE,CAAC;IAEjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;IACxC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,17 @@
1
+ export type QueueInboundResponsePayload = {
2
+ status: number;
3
+ body: unknown;
4
+ identifier: string;
5
+ /** Parsed request body when middleware is placed after body-parser (Task 14.3.1). */
6
+ requestBody?: unknown;
7
+ };
8
+ /**
9
+ * Queues an inbound HTTP response for capture. Writes one NDJSON record via the capture store.
10
+ * Uses active span context for traceId/spanId when not provided in payload.
11
+ */
12
+ export declare function queueInboundResponse(traceId: string, payload: QueueInboundResponsePayload): void;
13
+ /** Engine object for design alignment; used by Express and Fastify. */
14
+ export declare const CaptureEngine: {
15
+ queueInboundResponse: typeof queueInboundResponse;
16
+ };
17
+ //# sourceMappingURL=inbound-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-capture.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/common/http/inbound-capture.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAwBN;AAED,uEAAuE;AACvE,eAAO,MAAM,aAAa;;CAEzB,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CaptureEngine = void 0;
4
+ exports.queueInboundResponse = queueInboundResponse;
5
+ const api_1 = require("@opentelemetry/api");
6
+ const context_1 = require("../../../context");
7
+ const identifier_1 = require("../../../core/identifier");
8
+ /**
9
+ * Queues an inbound HTTP response for capture. Writes one NDJSON record via the capture store.
10
+ * Uses active span context for traceId/spanId when not provided in payload.
11
+ */
12
+ function queueInboundResponse(traceId, payload) {
13
+ const span = api_1.trace.getActiveSpan();
14
+ const spanId = span?.spanContext().spanId ?? '';
15
+ const [method, ...urlParts] = payload.identifier.split(' ');
16
+ const url = urlParts.join(' ') || '/';
17
+ const cassette = context_1.SoftprobeContext.getCassette();
18
+ if (context_1.SoftprobeContext.getMode() !== 'CAPTURE' || !cassette)
19
+ return;
20
+ const record = {
21
+ version: '4.1',
22
+ traceId,
23
+ spanId,
24
+ timestamp: new Date().toISOString(),
25
+ type: 'inbound',
26
+ protocol: 'http',
27
+ identifier: (0, identifier_1.httpIdentifier)(method, url),
28
+ responsePayload: {
29
+ statusCode: payload.status,
30
+ body: payload.body,
31
+ },
32
+ ...(payload.requestBody !== undefined && { requestPayload: { body: payload.requestBody } }),
33
+ };
34
+ const tid = context_1.SoftprobeContext.getTraceId();
35
+ void cassette.saveRecord(tid ? { ...record, traceId: tid } : record).catch(() => { });
36
+ }
37
+ /** Engine object for design alignment; used by Express and Fastify. */
38
+ exports.CaptureEngine = {
39
+ queueInboundResponse,
40
+ };
41
+ //# sourceMappingURL=inbound-capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-capture.js","sourceRoot":"","sources":["../../../../src/instrumentations/common/http/inbound-capture.ts"],"names":[],"mappings":";;;AAiBA,oDA2BC;AA5CD,4CAA2C;AAE3C,8CAAoD;AACpD,yDAA0D;AAU1D;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,OAAe,EACf,OAAoC;IAEpC,MAAM,IAAI,GAAG,WAAK,CAAC,aAAa,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,IAAI,EAAE,WAAW,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC;IAEhD,MAAM,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;IACtC,MAAM,QAAQ,GAAG,0BAAgB,CAAC,WAAW,EAAE,CAAC;IAChD,IAAI,0BAAgB,CAAC,OAAO,EAAE,KAAK,SAAS,IAAI,CAAC,QAAQ;QAAE,OAAO;IAClE,MAAM,MAAM,GAA4B;QACtC,OAAO,EAAE,KAAK;QACd,OAAO;QACP,MAAM;QACN,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,IAAA,2BAAc,EAAC,MAAM,EAAE,GAAG,CAAC;QACvC,eAAe,EAAE;YACf,UAAU,EAAE,OAAO,CAAC,MAAM;YAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB;QACD,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;KAC5F,CAAC;IACF,MAAM,GAAG,GAAG,0BAAgB,CAAC,UAAU,EAAE,CAAC;IAC1C,KAAK,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,uEAAuE;AAC1D,QAAA,aAAa,GAAG;IAC3B,oBAAoB;CACrB,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=inbound-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-record.d.ts","sourceRoot":"","sources":["../../../../src/instrumentations/common/http/inbound-record.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAInE,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"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * HTTP inbound capture: write one NDJSON record per inbound request/response.
4
+ * Design §10.4: Inbound HTTP — request body + response status/body.
5
+ * Single record embeds both requestPayload and responsePayload when available.
6
+ * Task 14.3.1: requestPayload.body is populated from req.body when Express
7
+ * middleware is placed after body-parser (via queueInboundResponse.requestBody).
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.writeInboundHttpRecord = writeInboundHttpRecord;
11
+ const identifier_1 = require("../../../core/identifier");
12
+ /**
13
+ * Writes one inbound HTTP cassette record. Include requestBody for request capture,
14
+ * and statusCode/responseBody when the response is available (same record).
15
+ */
16
+ function writeInboundHttpRecord(store, options) {
17
+ const { traceId, spanId, parentSpanId, spanName, method, url, requestBody, statusCode, responseBody, } = options;
18
+ const record = {
19
+ version: '4.1',
20
+ traceId,
21
+ spanId,
22
+ parentSpanId,
23
+ spanName,
24
+ timestamp: new Date().toISOString(),
25
+ type: 'inbound',
26
+ protocol: 'http',
27
+ identifier: (0, identifier_1.httpIdentifier)(method, url),
28
+ };
29
+ if (requestBody !== undefined) {
30
+ record.requestPayload = { body: requestBody };
31
+ }
32
+ if (statusCode !== undefined) {
33
+ record.responsePayload = {
34
+ statusCode,
35
+ body: responseBody,
36
+ };
37
+ }
38
+ store.saveRecord(record);
39
+ }
40
+ //# sourceMappingURL=inbound-record.js.map