@bitfab/sdk 0.36.0 → 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/{chunk-4YTIVUYX.js → chunk-4IY5SZYR.js} +22 -8
- package/dist/chunk-4IY5SZYR.js.map +1 -0
- package/dist/{chunk-JECWMVJG.js → chunk-XZKYSTWH.js} +21 -9
- package/dist/chunk-XZKYSTWH.js.map +1 -0
- package/dist/index.cjs +39 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -6
- package/dist/index.d.ts +23 -6
- package/dist/index.js +2 -2
- package/dist/node.cjs +39 -13
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-CVMULH7T.js → replay-UGABWDPP.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-4YTIVUYX.js.map +0 -1
- package/dist/chunk-JECWMVJG.js.map +0 -1
- /package/dist/{replay-CVMULH7T.js.map → replay-UGABWDPP.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var __version__;
|
|
|
42
42
|
var init_version_generated = __esm({
|
|
43
43
|
"src/version.generated.ts"() {
|
|
44
44
|
"use strict";
|
|
45
|
-
__version__ = "0.36.
|
|
45
|
+
__version__ = "0.36.2";
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -1521,9 +1521,11 @@ var init_http = __esm({
|
|
|
1521
1521
|
/**
|
|
1522
1522
|
* Fetch an external span by ID.
|
|
1523
1523
|
* Blocking GET request.
|
|
1524
|
+
* The replay view limits rawData to input/output serialization fields.
|
|
1524
1525
|
*/
|
|
1525
|
-
async getExternalSpan(spanId) {
|
|
1526
|
-
const
|
|
1526
|
+
async getExternalSpan(spanId, options) {
|
|
1527
|
+
const query = options?.view === "replay" ? "?view=replay" : "";
|
|
1528
|
+
const url = `${this.serviceUrl}/api/sdk/externalSpans/${spanId}${query}`;
|
|
1527
1529
|
const controller = new AbortController();
|
|
1528
1530
|
const timeoutId = setTimeout(() => controller.abort(), 3e4);
|
|
1529
1531
|
try {
|
|
@@ -1561,9 +1563,18 @@ var init_http = __esm({
|
|
|
1561
1563
|
* Pass `includeOutputs: false` for a payload-free tree (structure +
|
|
1562
1564
|
* `externalSpanId` only), so recorded outputs are fetched lazily per mocked
|
|
1563
1565
|
* span instead of all up front. Omit it (default eager) for `mock: "all"`.
|
|
1566
|
+
* Pass `includeRootOutput: false` when the root was already fetched.
|
|
1564
1567
|
*/
|
|
1565
1568
|
async getSpanTree(externalSpanId, options) {
|
|
1566
|
-
const
|
|
1569
|
+
const searchParams = new URLSearchParams();
|
|
1570
|
+
if (options?.includeOutputs === false) {
|
|
1571
|
+
searchParams.set("includeOutputs", "false");
|
|
1572
|
+
}
|
|
1573
|
+
if (options?.includeRootOutput === false) {
|
|
1574
|
+
searchParams.set("includeRootOutput", "false");
|
|
1575
|
+
}
|
|
1576
|
+
const encodedQuery = searchParams.toString();
|
|
1577
|
+
const query = encodedQuery ? `?${encodedQuery}` : "";
|
|
1567
1578
|
const url = `${this.serviceUrl}/api/sdk/replay/spanTree/${externalSpanId}${query}`;
|
|
1568
1579
|
const controller = new AbortController();
|
|
1569
1580
|
const timeoutId = setTimeout(() => controller.abort(), 3e4);
|
|
@@ -2146,7 +2157,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
2146
2157
|
`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.`
|
|
2147
2158
|
);
|
|
2148
2159
|
}
|
|
2149
|
-
const span = await httpClient.getExternalSpan(originalSpanId
|
|
2160
|
+
const span = await httpClient.getExternalSpan(originalSpanId, {
|
|
2161
|
+
view: "replay"
|
|
2162
|
+
});
|
|
2150
2163
|
const spanData = span.rawData?.span_data ?? {};
|
|
2151
2164
|
inputs = deserializeInputs(spanData);
|
|
2152
2165
|
originalOutput = deserializeOutput(spanData);
|
|
@@ -2166,7 +2179,8 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
2166
2179
|
if (needTree) {
|
|
2167
2180
|
try {
|
|
2168
2181
|
const treeResponse = await httpClient.getSpanTree(originalSpanId, {
|
|
2169
|
-
includeOutputs
|
|
2182
|
+
includeOutputs,
|
|
2183
|
+
includeRootOutput: false
|
|
2170
2184
|
});
|
|
2171
2185
|
if (treeResponse.root) {
|
|
2172
2186
|
mockTree = buildMockTree(treeResponse.root);
|
|
@@ -2188,7 +2202,7 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
2188
2202
|
const fetchSpanOutput = mockTree && !includeOutputs ? (externalSpanId) => {
|
|
2189
2203
|
let pending = outputCache.get(externalSpanId);
|
|
2190
2204
|
if (!pending) {
|
|
2191
|
-
pending = httpClient.getExternalSpan(externalSpanId).then(
|
|
2205
|
+
pending = httpClient.getExternalSpan(externalSpanId, { view: "replay" }).then(
|
|
2192
2206
|
(s) => deserializeOutput(
|
|
2193
2207
|
s.rawData?.span_data ?? {}
|
|
2194
2208
|
)
|
|
@@ -4181,12 +4195,20 @@ var ReplayBranch = class {
|
|
|
4181
4195
|
// context can ride along into a log line or a serialized payload.
|
|
4182
4196
|
__privateAdd(this, _url);
|
|
4183
4197
|
__privateAdd(this, _context);
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4198
|
+
const { databaseUrl, ...exposed } = lease;
|
|
4199
|
+
for (const [key, value] of Object.entries(exposed)) {
|
|
4200
|
+
Object.defineProperty(this, key, {
|
|
4201
|
+
value,
|
|
4202
|
+
enumerable: true,
|
|
4203
|
+
configurable: true
|
|
4204
|
+
});
|
|
4205
|
+
}
|
|
4206
|
+
Object.defineProperty(this, "traceId", {
|
|
4207
|
+
value: traceId,
|
|
4208
|
+
enumerable: true,
|
|
4209
|
+
configurable: true
|
|
4210
|
+
});
|
|
4211
|
+
__privateSet(this, _url, databaseUrl);
|
|
4190
4212
|
__privateSet(this, _context, context);
|
|
4191
4213
|
}
|
|
4192
4214
|
/**
|
|
@@ -5526,6 +5548,7 @@ var Bitfab = class {
|
|
|
5526
5548
|
dbSnapshotUsage: {
|
|
5527
5549
|
neonBranchId: replayCtx.dbBranchLease.neonBranchId,
|
|
5528
5550
|
snapshotTimestamp: replayCtx.dbBranchLease.snapshotTimestamp,
|
|
5551
|
+
region: replayCtx.dbBranchLease.region,
|
|
5529
5552
|
originalTraceId: replayCtx.sourceBitfabTraceId,
|
|
5530
5553
|
accessed: replayCtx.dbSnapshotAccessed === true
|
|
5531
5554
|
}
|
|
@@ -5801,6 +5824,9 @@ var Bitfab = class {
|
|
|
5801
5824
|
...params.dbSnapshotUsage.snapshotTimestamp && {
|
|
5802
5825
|
snapshot_timestamp: params.dbSnapshotUsage.snapshotTimestamp
|
|
5803
5826
|
},
|
|
5827
|
+
...params.dbSnapshotUsage.region && {
|
|
5828
|
+
region: params.dbSnapshotUsage.region
|
|
5829
|
+
},
|
|
5804
5830
|
...params.dbSnapshotUsage.originalTraceId && {
|
|
5805
5831
|
original_trace_id: params.dbSnapshotUsage.originalTraceId,
|
|
5806
5832
|
// Deprecated wire alias, kept so this SDK still reports usage
|