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.
package/dist/index.d.cts CHANGED
@@ -457,8 +457,11 @@ declare class HttpClient {
457
457
  /**
458
458
  * Fetch an external span by ID.
459
459
  * Blocking GET request.
460
+ * The replay view limits rawData to input/output serialization fields.
460
461
  */
461
- getExternalSpan(spanId: string): Promise<ExternalSpanResponse>;
462
+ getExternalSpan(spanId: string, options?: {
463
+ view?: "full" | "replay";
464
+ }): Promise<ExternalSpanResponse>;
462
465
  /**
463
466
  * Fetch the span tree for a root span.
464
467
  * Blocking GET request.
@@ -466,9 +469,11 @@ declare class HttpClient {
466
469
  * Pass `includeOutputs: false` for a payload-free tree (structure +
467
470
  * `externalSpanId` only), so recorded outputs are fetched lazily per mocked
468
471
  * span instead of all up front. Omit it (default eager) for `mock: "all"`.
472
+ * Pass `includeRootOutput: false` when the root was already fetched.
469
473
  */
470
474
  getSpanTree(externalSpanId: string, options?: {
471
475
  includeOutputs?: boolean;
476
+ includeRootOutput?: boolean;
472
477
  }): Promise<SpanTreeResponse>;
473
478
  /**
474
479
  * Read which of a replay run's traces the server has fully persisted.
@@ -2348,7 +2353,7 @@ declare class BitfabFunction {
2348
2353
  /**
2349
2354
  * SDK version from package.json (injected at build time)
2350
2355
  */
2351
- declare const __version__ = "0.36.1";
2356
+ declare const __version__ = "0.36.2";
2352
2357
 
2353
2358
  /**
2354
2359
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -457,8 +457,11 @@ declare class HttpClient {
457
457
  /**
458
458
  * Fetch an external span by ID.
459
459
  * Blocking GET request.
460
+ * The replay view limits rawData to input/output serialization fields.
460
461
  */
461
- getExternalSpan(spanId: string): Promise<ExternalSpanResponse>;
462
+ getExternalSpan(spanId: string, options?: {
463
+ view?: "full" | "replay";
464
+ }): Promise<ExternalSpanResponse>;
462
465
  /**
463
466
  * Fetch the span tree for a root span.
464
467
  * Blocking GET request.
@@ -466,9 +469,11 @@ declare class HttpClient {
466
469
  * Pass `includeOutputs: false` for a payload-free tree (structure +
467
470
  * `externalSpanId` only), so recorded outputs are fetched lazily per mocked
468
471
  * span instead of all up front. Omit it (default eager) for `mock: "all"`.
472
+ * Pass `includeRootOutput: false` when the root was already fetched.
469
473
  */
470
474
  getSpanTree(externalSpanId: string, options?: {
471
475
  includeOutputs?: boolean;
476
+ includeRootOutput?: boolean;
472
477
  }): Promise<SpanTreeResponse>;
473
478
  /**
474
479
  * Read which of a replay run's traces the server has fully persisted.
@@ -2348,7 +2353,7 @@ declare class BitfabFunction {
2348
2353
  /**
2349
2354
  * SDK version from package.json (injected at build time)
2350
2355
  */
2351
- declare const __version__ = "0.36.1";
2356
+ declare const __version__ = "0.36.2";
2352
2357
 
2353
2358
  /**
2354
2359
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  getCurrentReplayBranch,
21
21
  getCurrentSpan,
22
22
  getCurrentTrace
23
- } from "./chunk-HD4DRDRE.js";
23
+ } from "./chunk-XZKYSTWH.js";
24
24
  import {
25
25
  BITFAB_PROGRESS_PREFIX,
26
26
  BitfabError,
@@ -29,7 +29,7 @@ import {
29
29
  __version__,
30
30
  flushTraces,
31
31
  reportReplayProgress
32
- } from "./chunk-6ZBZBR5K.js";
32
+ } from "./chunk-4IY5SZYR.js";
33
33
  export {
34
34
  BITFAB_PROGRESS_PREFIX,
35
35
  Bitfab,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.36.1";
100
+ __version__ = "0.36.2";
101
101
  }
102
102
  });
103
103
 
@@ -1537,9 +1537,11 @@ var init_http = __esm({
1537
1537
  /**
1538
1538
  * Fetch an external span by ID.
1539
1539
  * Blocking GET request.
1540
+ * The replay view limits rawData to input/output serialization fields.
1540
1541
  */
1541
- async getExternalSpan(spanId) {
1542
- const url = `${this.serviceUrl}/api/sdk/externalSpans/${spanId}`;
1542
+ async getExternalSpan(spanId, options) {
1543
+ const query = options?.view === "replay" ? "?view=replay" : "";
1544
+ const url = `${this.serviceUrl}/api/sdk/externalSpans/${spanId}${query}`;
1543
1545
  const controller = new AbortController();
1544
1546
  const timeoutId = setTimeout(() => controller.abort(), 3e4);
1545
1547
  try {
@@ -1577,9 +1579,18 @@ var init_http = __esm({
1577
1579
  * Pass `includeOutputs: false` for a payload-free tree (structure +
1578
1580
  * `externalSpanId` only), so recorded outputs are fetched lazily per mocked
1579
1581
  * span instead of all up front. Omit it (default eager) for `mock: "all"`.
1582
+ * Pass `includeRootOutput: false` when the root was already fetched.
1580
1583
  */
1581
1584
  async getSpanTree(externalSpanId, options) {
1582
- const query = options?.includeOutputs === false ? "?includeOutputs=false" : "";
1585
+ const searchParams = new URLSearchParams();
1586
+ if (options?.includeOutputs === false) {
1587
+ searchParams.set("includeOutputs", "false");
1588
+ }
1589
+ if (options?.includeRootOutput === false) {
1590
+ searchParams.set("includeRootOutput", "false");
1591
+ }
1592
+ const encodedQuery = searchParams.toString();
1593
+ const query = encodedQuery ? `?${encodedQuery}` : "";
1583
1594
  const url = `${this.serviceUrl}/api/sdk/replay/spanTree/${externalSpanId}${query}`;
1584
1595
  const controller = new AbortController();
1585
1596
  const timeoutId = setTimeout(() => controller.abort(), 3e4);
@@ -2162,7 +2173,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2162
2173
  `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.`
2163
2174
  );
2164
2175
  }
2165
- const span = await httpClient.getExternalSpan(originalSpanId);
2176
+ const span = await httpClient.getExternalSpan(originalSpanId, {
2177
+ view: "replay"
2178
+ });
2166
2179
  const spanData = span.rawData?.span_data ?? {};
2167
2180
  inputs = deserializeInputs(spanData);
2168
2181
  originalOutput = deserializeOutput(spanData);
@@ -2182,7 +2195,8 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2182
2195
  if (needTree) {
2183
2196
  try {
2184
2197
  const treeResponse = await httpClient.getSpanTree(originalSpanId, {
2185
- includeOutputs
2198
+ includeOutputs,
2199
+ includeRootOutput: false
2186
2200
  });
2187
2201
  if (treeResponse.root) {
2188
2202
  mockTree = buildMockTree(treeResponse.root);
@@ -2204,7 +2218,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2204
2218
  const fetchSpanOutput = mockTree && !includeOutputs ? (externalSpanId) => {
2205
2219
  let pending = outputCache.get(externalSpanId);
2206
2220
  if (!pending) {
2207
- pending = httpClient.getExternalSpan(externalSpanId).then(
2221
+ pending = httpClient.getExternalSpan(externalSpanId, { view: "replay" }).then(
2208
2222
  (s) => deserializeOutput(
2209
2223
  s.rawData?.span_data ?? {}
2210
2224
  )