bitfab 0.36.1 → 0.36.2

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.
@@ -16,7 +16,7 @@ import {
16
16
  toJsonSafe,
17
17
  toJsonSafeReport,
18
18
  warnOnce
19
- } from "./chunk-6ZBZBR5K.js";
19
+ } from "./chunk-4IY5SZYR.js";
20
20
 
21
21
  // src/processorPayload.ts
22
22
  var SERIALIZATION_DEGRADED_STEP = "serialization_degraded";
@@ -3337,7 +3337,7 @@ var Bitfab = class {
3337
3337
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
3338
3338
  );
3339
3339
  }
3340
- const { replay: doReplay } = await import("./replay-ZR4KIZIB.js");
3340
+ const { replay: doReplay } = await import("./replay-UGABWDPP.js");
3341
3341
  return doReplay(
3342
3342
  this.httpClient,
3343
3343
  this.serviceUrl,
@@ -3554,4 +3554,4 @@ export {
3554
3554
  BitfabFunction,
3555
3555
  finalizers
3556
3556
  };
3557
- //# sourceMappingURL=chunk-HD4DRDRE.js.map
3557
+ //# sourceMappingURL=chunk-XZKYSTWH.js.map
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ var __version__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.36.1";
54
+ __version__ = "0.36.2";
55
55
  }
56
56
  });
57
57
 
@@ -1530,9 +1530,11 @@ var init_http = __esm({
1530
1530
  /**
1531
1531
  * Fetch an external span by ID.
1532
1532
  * Blocking GET request.
1533
+ * The replay view limits rawData to input/output serialization fields.
1533
1534
  */
1534
- async getExternalSpan(spanId) {
1535
- const url = `${this.serviceUrl}/api/sdk/externalSpans/${spanId}`;
1535
+ async getExternalSpan(spanId, options) {
1536
+ const query = options?.view === "replay" ? "?view=replay" : "";
1537
+ const url = `${this.serviceUrl}/api/sdk/externalSpans/${spanId}${query}`;
1536
1538
  const controller = new AbortController();
1537
1539
  const timeoutId = setTimeout(() => controller.abort(), 3e4);
1538
1540
  try {
@@ -1570,9 +1572,18 @@ var init_http = __esm({
1570
1572
  * Pass `includeOutputs: false` for a payload-free tree (structure +
1571
1573
  * `externalSpanId` only), so recorded outputs are fetched lazily per mocked
1572
1574
  * span instead of all up front. Omit it (default eager) for `mock: "all"`.
1575
+ * Pass `includeRootOutput: false` when the root was already fetched.
1573
1576
  */
1574
1577
  async getSpanTree(externalSpanId, options) {
1575
- const query = options?.includeOutputs === false ? "?includeOutputs=false" : "";
1578
+ const searchParams = new URLSearchParams();
1579
+ if (options?.includeOutputs === false) {
1580
+ searchParams.set("includeOutputs", "false");
1581
+ }
1582
+ if (options?.includeRootOutput === false) {
1583
+ searchParams.set("includeRootOutput", "false");
1584
+ }
1585
+ const encodedQuery = searchParams.toString();
1586
+ const query = encodedQuery ? `?${encodedQuery}` : "";
1576
1587
  const url = `${this.serviceUrl}/api/sdk/replay/spanTree/${externalSpanId}${query}`;
1577
1588
  const controller = new AbortController();
1578
1589
  const timeoutId = setTimeout(() => controller.abort(), 3e4);
@@ -2155,7 +2166,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2155
2166
  `Replay requested a database branch for trace ${originalTraceId} but it could not be resolved (${leaseError.code}): ${leaseError.message}. The function was not run, because replaying it against the live database would produce a result that looks valid but did not use the historical data you asked for.`
2156
2167
  );
2157
2168
  }
2158
- const span = await httpClient.getExternalSpan(originalSpanId);
2169
+ const span = await httpClient.getExternalSpan(originalSpanId, {
2170
+ view: "replay"
2171
+ });
2159
2172
  const spanData = span.rawData?.span_data ?? {};
2160
2173
  inputs = deserializeInputs(spanData);
2161
2174
  originalOutput = deserializeOutput(spanData);
@@ -2175,7 +2188,8 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2175
2188
  if (needTree) {
2176
2189
  try {
2177
2190
  const treeResponse = await httpClient.getSpanTree(originalSpanId, {
2178
- includeOutputs
2191
+ includeOutputs,
2192
+ includeRootOutput: false
2179
2193
  });
2180
2194
  if (treeResponse.root) {
2181
2195
  mockTree = buildMockTree(treeResponse.root);
@@ -2197,7 +2211,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2197
2211
  const fetchSpanOutput = mockTree && !includeOutputs ? (externalSpanId) => {
2198
2212
  let pending = outputCache.get(externalSpanId);
2199
2213
  if (!pending) {
2200
- pending = httpClient.getExternalSpan(externalSpanId).then(
2214
+ pending = httpClient.getExternalSpan(externalSpanId, { view: "replay" }).then(
2201
2215
  (s) => deserializeOutput(
2202
2216
  s.rawData?.span_data ?? {}
2203
2217
  )