bitfab 0.18.1 → 0.19.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/dist/{chunk-QT7HWOKU.js → chunk-EQI6ZJC3.js} +113 -57
- package/dist/chunk-EQI6ZJC3.js.map +1 -0
- package/dist/{chunk-ILIUTS5D.js → chunk-FA6DBCAT.js} +142 -99
- package/dist/chunk-FA6DBCAT.js.map +1 -0
- package/dist/index.cjs +253 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2 -2
- package/dist/node.cjs +217 -118
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-BIPIDXX6.js → replay-QAWGVRCZ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-ILIUTS5D.js.map +0 -1
- package/dist/chunk-QT7HWOKU.js.map +0 -1
- /package/dist/{replay-BIPIDXX6.js.map → replay-QAWGVRCZ.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -335,6 +335,14 @@ declare class ReplayEnvironment {
|
|
|
335
335
|
get active(): boolean;
|
|
336
336
|
/** Non-throwing variant for callers that handle the inactive case. */
|
|
337
337
|
snapshot(): ReplayEnvironmentSnapshot | null;
|
|
338
|
+
/**
|
|
339
|
+
* Record on the replay context that customer code obtained the branch
|
|
340
|
+
* URL. Only `databaseUrl` and `snapshot()` count — `active`, `readOnly`
|
|
341
|
+
* and friends inspect the lease without exposing the connection string,
|
|
342
|
+
* so they don't prove the replayed code could have connected to the
|
|
343
|
+
* branch.
|
|
344
|
+
*/
|
|
345
|
+
private markAccessed;
|
|
338
346
|
private read;
|
|
339
347
|
private require;
|
|
340
348
|
}
|
|
@@ -1055,7 +1063,7 @@ declare class BitfabFunction {
|
|
|
1055
1063
|
/**
|
|
1056
1064
|
* SDK version from package.json (injected at build time)
|
|
1057
1065
|
*/
|
|
1058
|
-
declare const __version__ = "0.
|
|
1066
|
+
declare const __version__ = "0.19.0";
|
|
1059
1067
|
|
|
1060
1068
|
/**
|
|
1061
1069
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -335,6 +335,14 @@ declare class ReplayEnvironment {
|
|
|
335
335
|
get active(): boolean;
|
|
336
336
|
/** Non-throwing variant for callers that handle the inactive case. */
|
|
337
337
|
snapshot(): ReplayEnvironmentSnapshot | null;
|
|
338
|
+
/**
|
|
339
|
+
* Record on the replay context that customer code obtained the branch
|
|
340
|
+
* URL. Only `databaseUrl` and `snapshot()` count — `active`, `readOnly`
|
|
341
|
+
* and friends inspect the lease without exposing the connection string,
|
|
342
|
+
* so they don't prove the replayed code could have connected to the
|
|
343
|
+
* branch.
|
|
344
|
+
*/
|
|
345
|
+
private markAccessed;
|
|
338
346
|
private read;
|
|
339
347
|
private require;
|
|
340
348
|
}
|
|
@@ -1055,7 +1063,7 @@ declare class BitfabFunction {
|
|
|
1055
1063
|
/**
|
|
1056
1064
|
* SDK version from package.json (injected at build time)
|
|
1057
1065
|
*/
|
|
1058
|
-
declare const __version__ = "0.
|
|
1066
|
+
declare const __version__ = "0.19.0";
|
|
1059
1067
|
|
|
1060
1068
|
/**
|
|
1061
1069
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
flushTraces,
|
|
21
21
|
getCurrentSpan,
|
|
22
22
|
getCurrentTrace
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-FA6DBCAT.js";
|
|
24
24
|
import {
|
|
25
25
|
BitfabError
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EQI6ZJC3.js";
|
|
27
27
|
export {
|
|
28
28
|
Bitfab,
|
|
29
29
|
BitfabClaudeAgentHandler,
|
package/dist/node.cjs
CHANGED
|
@@ -100,28 +100,6 @@ var init_errors = __esm({
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
// src/replayContext.ts
|
|
104
|
-
function getReplayContext() {
|
|
105
|
-
return replayContextStorage?.getStore() ?? null;
|
|
106
|
-
}
|
|
107
|
-
function runWithReplayContext(ctx, fn) {
|
|
108
|
-
if (replayContextStorage) {
|
|
109
|
-
return replayContextStorage.run(ctx, fn);
|
|
110
|
-
}
|
|
111
|
-
return fn();
|
|
112
|
-
}
|
|
113
|
-
var replayContextStorage, replayContextReady;
|
|
114
|
-
var init_replayContext = __esm({
|
|
115
|
-
"src/replayContext.ts"() {
|
|
116
|
-
"use strict";
|
|
117
|
-
init_asyncStorage();
|
|
118
|
-
replayContextStorage = null;
|
|
119
|
-
replayContextReady = asyncStorageReady.then(() => {
|
|
120
|
-
replayContextStorage = createAsyncLocalStorage();
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
103
|
// src/serialize.ts
|
|
126
104
|
function describeValue(value) {
|
|
127
105
|
try {
|
|
@@ -172,12 +150,89 @@ function deserializeValue(serialized) {
|
|
|
172
150
|
meta: serialized.meta
|
|
173
151
|
});
|
|
174
152
|
}
|
|
175
|
-
|
|
153
|
+
function toJsonSafe(value) {
|
|
154
|
+
return toJsonSafeInner(value, 0, /* @__PURE__ */ new WeakSet());
|
|
155
|
+
}
|
|
156
|
+
function toJsonSafeInner(value, depth, seen) {
|
|
157
|
+
if (value === null || value === void 0) {
|
|
158
|
+
return value;
|
|
159
|
+
}
|
|
160
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
const className = value?.constructor?.name ?? typeof value;
|
|
164
|
+
if (depth > MAX_SAFE_DEPTH) {
|
|
165
|
+
return `<${className}>`;
|
|
166
|
+
}
|
|
167
|
+
if (typeof value !== "object") {
|
|
168
|
+
try {
|
|
169
|
+
return String(value);
|
|
170
|
+
} catch {
|
|
171
|
+
return `<${className}>`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (seen.has(value)) {
|
|
175
|
+
return `<cycle ${className}>`;
|
|
176
|
+
}
|
|
177
|
+
seen.add(value);
|
|
178
|
+
let result;
|
|
179
|
+
if (Array.isArray(value)) {
|
|
180
|
+
result = value.map((item) => toJsonSafeInner(item, depth + 1, seen));
|
|
181
|
+
} else if (typeof value.toJSON === "function") {
|
|
182
|
+
try {
|
|
183
|
+
result = toJsonSafeInner(
|
|
184
|
+
value.toJSON(),
|
|
185
|
+
depth + 1,
|
|
186
|
+
seen
|
|
187
|
+
);
|
|
188
|
+
} catch {
|
|
189
|
+
result = `<${className}>`;
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
try {
|
|
193
|
+
const obj = {};
|
|
194
|
+
for (const [k, v] of Object.entries(value)) {
|
|
195
|
+
if (!k.startsWith("_")) {
|
|
196
|
+
obj[k] = toJsonSafeInner(v, depth + 1, seen);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
result = obj;
|
|
200
|
+
} catch {
|
|
201
|
+
result = `<${className}>`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
seen.delete(value);
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
var import_superjson, MAX_SERIALIZED_BYTES, MAX_SAFE_DEPTH;
|
|
176
208
|
var init_serialize = __esm({
|
|
177
209
|
"src/serialize.ts"() {
|
|
178
210
|
"use strict";
|
|
179
211
|
import_superjson = __toESM(require("superjson"), 1);
|
|
180
212
|
MAX_SERIALIZED_BYTES = 512e3;
|
|
213
|
+
MAX_SAFE_DEPTH = 6;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// src/replayContext.ts
|
|
218
|
+
function getReplayContext() {
|
|
219
|
+
return replayContextStorage?.getStore() ?? null;
|
|
220
|
+
}
|
|
221
|
+
function runWithReplayContext(ctx, fn) {
|
|
222
|
+
if (replayContextStorage) {
|
|
223
|
+
return replayContextStorage.run(ctx, fn);
|
|
224
|
+
}
|
|
225
|
+
return fn();
|
|
226
|
+
}
|
|
227
|
+
var replayContextStorage, replayContextReady;
|
|
228
|
+
var init_replayContext = __esm({
|
|
229
|
+
"src/replayContext.ts"() {
|
|
230
|
+
"use strict";
|
|
231
|
+
init_asyncStorage();
|
|
232
|
+
replayContextStorage = null;
|
|
233
|
+
replayContextReady = asyncStorageReady.then(() => {
|
|
234
|
+
replayContextStorage = createAsyncLocalStorage();
|
|
235
|
+
});
|
|
181
236
|
}
|
|
182
237
|
});
|
|
183
238
|
|
|
@@ -456,13 +511,93 @@ registerAsyncLocalStorageClass(
|
|
|
456
511
|
);
|
|
457
512
|
|
|
458
513
|
// src/version.generated.ts
|
|
459
|
-
var __version__ = "0.
|
|
514
|
+
var __version__ = "0.19.0";
|
|
460
515
|
|
|
461
516
|
// src/constants.ts
|
|
462
517
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
463
518
|
|
|
464
519
|
// src/http.ts
|
|
465
520
|
init_errors();
|
|
521
|
+
function serializePayloadBody(payload) {
|
|
522
|
+
try {
|
|
523
|
+
return { body: JSON.stringify(payload), dropped: [] };
|
|
524
|
+
} catch {
|
|
525
|
+
const dropped = [];
|
|
526
|
+
const sanitize = (value, seen) => {
|
|
527
|
+
const t = typeof value;
|
|
528
|
+
if (value === null || t === "string" || t === "number" || t === "boolean") {
|
|
529
|
+
return value;
|
|
530
|
+
}
|
|
531
|
+
if (t === "bigint") {
|
|
532
|
+
dropped.push("BigInt");
|
|
533
|
+
return "<unserializable: BigInt>";
|
|
534
|
+
}
|
|
535
|
+
if (t === "function") {
|
|
536
|
+
const name = value.name || "Function";
|
|
537
|
+
dropped.push(name);
|
|
538
|
+
return `<unserializable: ${name}>`;
|
|
539
|
+
}
|
|
540
|
+
if (t === "symbol") {
|
|
541
|
+
dropped.push("Symbol");
|
|
542
|
+
return "<unserializable: Symbol>";
|
|
543
|
+
}
|
|
544
|
+
if (t !== "object") {
|
|
545
|
+
return void 0;
|
|
546
|
+
}
|
|
547
|
+
const obj = value;
|
|
548
|
+
const className = obj.constructor?.name || "object";
|
|
549
|
+
if (seen.has(obj)) {
|
|
550
|
+
dropped.push(className);
|
|
551
|
+
return `<cycle: ${className}>`;
|
|
552
|
+
}
|
|
553
|
+
seen.add(obj);
|
|
554
|
+
let result;
|
|
555
|
+
if (Array.isArray(obj)) {
|
|
556
|
+
result = obj.map((item) => sanitize(item, seen));
|
|
557
|
+
} else if (typeof obj.toJSON === "function") {
|
|
558
|
+
try {
|
|
559
|
+
result = sanitize(obj.toJSON(), seen);
|
|
560
|
+
} catch {
|
|
561
|
+
dropped.push(className);
|
|
562
|
+
result = `<unserializable: ${className}>`;
|
|
563
|
+
}
|
|
564
|
+
} else {
|
|
565
|
+
const out = {};
|
|
566
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
567
|
+
out[k] = sanitize(v, seen);
|
|
568
|
+
}
|
|
569
|
+
result = out;
|
|
570
|
+
}
|
|
571
|
+
seen.delete(obj);
|
|
572
|
+
return result;
|
|
573
|
+
};
|
|
574
|
+
let sanitized;
|
|
575
|
+
try {
|
|
576
|
+
sanitized = sanitize(payload, /* @__PURE__ */ new WeakSet());
|
|
577
|
+
} catch (error) {
|
|
578
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
579
|
+
return {
|
|
580
|
+
body: JSON.stringify({ error: `payload_serialize_failed: ${message}` }),
|
|
581
|
+
dropped
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
if (dropped.length > 0 && typeof sanitized === "object" && sanitized !== null && !Array.isArray(sanitized)) {
|
|
585
|
+
const obj = sanitized;
|
|
586
|
+
const existing = Array.isArray(obj.errors) ? obj.errors : [];
|
|
587
|
+
obj.errors = [
|
|
588
|
+
...existing,
|
|
589
|
+
{
|
|
590
|
+
source: "sdk",
|
|
591
|
+
step: "json_serialize",
|
|
592
|
+
error: `stubbed non-serializable value(s): ${[
|
|
593
|
+
...new Set(dropped)
|
|
594
|
+
].join(", ")}`
|
|
595
|
+
}
|
|
596
|
+
];
|
|
597
|
+
}
|
|
598
|
+
return { body: JSON.stringify(sanitized), dropped };
|
|
599
|
+
}
|
|
600
|
+
}
|
|
466
601
|
var pendingTracePromises = /* @__PURE__ */ new Set();
|
|
467
602
|
function awaitOnExit(promise) {
|
|
468
603
|
pendingTracePromises.add(promise);
|
|
@@ -521,23 +656,14 @@ var HttpClient = class {
|
|
|
521
656
|
const method = options?.method ?? "POST";
|
|
522
657
|
const controller = new AbortController();
|
|
523
658
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
Object.entries(payload).filter(
|
|
533
|
-
([, v]) => typeof v === "string" || typeof v === "number"
|
|
534
|
-
)
|
|
535
|
-
),
|
|
536
|
-
rawSpan: {},
|
|
537
|
-
errors: [
|
|
538
|
-
{ source: "sdk", step: "json_serialize", error: serializationError }
|
|
539
|
-
]
|
|
540
|
-
});
|
|
659
|
+
const { body, dropped } = serializePayloadBody(payload);
|
|
660
|
+
if (dropped.length > 0) {
|
|
661
|
+
try {
|
|
662
|
+
console.warn(
|
|
663
|
+
`Bitfab: request body to ${endpoint} held ${dropped.length} non-serializable value(s) (${[...new Set(dropped)].join(", ")}); they were stubbed so the span still sends, but the trace may be incomplete or not replayable. Capture a JSON-safe projection of this input to make it replayable.`
|
|
664
|
+
);
|
|
665
|
+
} catch {
|
|
666
|
+
}
|
|
541
667
|
}
|
|
542
668
|
try {
|
|
543
669
|
const response = await fetch(url, {
|
|
@@ -795,33 +921,11 @@ var HttpClient = class {
|
|
|
795
921
|
};
|
|
796
922
|
|
|
797
923
|
// src/claudeAgentSdk.ts
|
|
924
|
+
init_serialize();
|
|
798
925
|
function nowIso() {
|
|
799
926
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
800
927
|
}
|
|
801
|
-
|
|
802
|
-
if (value === null || value === void 0) {
|
|
803
|
-
return value;
|
|
804
|
-
}
|
|
805
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
806
|
-
return value;
|
|
807
|
-
}
|
|
808
|
-
if (Array.isArray(value)) {
|
|
809
|
-
return value.map(safeSerialize);
|
|
810
|
-
}
|
|
811
|
-
if (typeof value === "object") {
|
|
812
|
-
if (typeof value.toJSON === "function") {
|
|
813
|
-
return value.toJSON();
|
|
814
|
-
}
|
|
815
|
-
const result = {};
|
|
816
|
-
for (const [k, v] of Object.entries(value)) {
|
|
817
|
-
if (!k.startsWith("_")) {
|
|
818
|
-
result[k] = safeSerialize(v);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
return result;
|
|
822
|
-
}
|
|
823
|
-
return String(value);
|
|
824
|
-
}
|
|
928
|
+
var safeSerialize = toJsonSafe;
|
|
825
929
|
function extractContentBlocks(content) {
|
|
826
930
|
if (!Array.isArray(content)) {
|
|
827
931
|
return [];
|
|
@@ -1577,6 +1681,7 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
|
|
|
1577
1681
|
}
|
|
1578
1682
|
|
|
1579
1683
|
// src/langgraph.ts
|
|
1684
|
+
init_serialize();
|
|
1580
1685
|
var LANGSMITH_HIDDEN_TAG = "langsmith:hidden";
|
|
1581
1686
|
var LANGGRAPH_METADATA_KEYS = [
|
|
1582
1687
|
"langgraph_step",
|
|
@@ -1588,56 +1693,7 @@ var LANGGRAPH_METADATA_KEYS = [
|
|
|
1588
1693
|
function nowIso2() {
|
|
1589
1694
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
1590
1695
|
}
|
|
1591
|
-
var
|
|
1592
|
-
function safeSerialize2(value) {
|
|
1593
|
-
return safeSerializeInner(value, 0, /* @__PURE__ */ new WeakSet());
|
|
1594
|
-
}
|
|
1595
|
-
function safeSerializeInner(value, depth, seen) {
|
|
1596
|
-
if (value === null || value === void 0) {
|
|
1597
|
-
return value;
|
|
1598
|
-
}
|
|
1599
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1600
|
-
return value;
|
|
1601
|
-
}
|
|
1602
|
-
const className = value?.constructor?.name ?? typeof value;
|
|
1603
|
-
if (depth > MAX_SERIALIZE_DEPTH) {
|
|
1604
|
-
return `<${className}>`;
|
|
1605
|
-
}
|
|
1606
|
-
if (typeof value === "object") {
|
|
1607
|
-
if (seen.has(value)) {
|
|
1608
|
-
return `<cycle ${className}>`;
|
|
1609
|
-
}
|
|
1610
|
-
seen.add(value);
|
|
1611
|
-
}
|
|
1612
|
-
if (Array.isArray(value)) {
|
|
1613
|
-
return value.map((item) => safeSerializeInner(item, depth + 1, seen));
|
|
1614
|
-
}
|
|
1615
|
-
if (typeof value === "object") {
|
|
1616
|
-
if (typeof value.toJSON === "function") {
|
|
1617
|
-
try {
|
|
1618
|
-
return value.toJSON();
|
|
1619
|
-
} catch {
|
|
1620
|
-
return `<${className}>`;
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
try {
|
|
1624
|
-
const result = {};
|
|
1625
|
-
for (const [k, v] of Object.entries(value)) {
|
|
1626
|
-
if (!k.startsWith("_")) {
|
|
1627
|
-
result[k] = safeSerializeInner(v, depth + 1, seen);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
return result;
|
|
1631
|
-
} catch {
|
|
1632
|
-
return `<${className}>`;
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
try {
|
|
1636
|
-
return String(value);
|
|
1637
|
-
} catch {
|
|
1638
|
-
return `<${className}>`;
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1696
|
+
var safeSerialize2 = toJsonSafe;
|
|
1641
1697
|
function convertMessage(message) {
|
|
1642
1698
|
if (typeof message !== "object" || message === null) {
|
|
1643
1699
|
return { role: "unknown", content: String(message) };
|
|
@@ -2171,7 +2227,9 @@ var ReplayEnvironment = class {
|
|
|
2171
2227
|
* Throws if read outside a replay item.
|
|
2172
2228
|
*/
|
|
2173
2229
|
get databaseUrl() {
|
|
2174
|
-
|
|
2230
|
+
const snapshot = this.require();
|
|
2231
|
+
this.markAccessed();
|
|
2232
|
+
return snapshot.databaseUrl;
|
|
2175
2233
|
}
|
|
2176
2234
|
/** When the per-trace branch URL stops being valid. ISO-8601. */
|
|
2177
2235
|
get expiresAt() {
|
|
@@ -2199,7 +2257,24 @@ var ReplayEnvironment = class {
|
|
|
2199
2257
|
}
|
|
2200
2258
|
/** Non-throwing variant for callers that handle the inactive case. */
|
|
2201
2259
|
snapshot() {
|
|
2202
|
-
|
|
2260
|
+
const snapshot = this.read();
|
|
2261
|
+
if (snapshot) {
|
|
2262
|
+
this.markAccessed();
|
|
2263
|
+
}
|
|
2264
|
+
return snapshot;
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Record on the replay context that customer code obtained the branch
|
|
2268
|
+
* URL. Only `databaseUrl` and `snapshot()` count — `active`, `readOnly`
|
|
2269
|
+
* and friends inspect the lease without exposing the connection string,
|
|
2270
|
+
* so they don't prove the replayed code could have connected to the
|
|
2271
|
+
* branch.
|
|
2272
|
+
*/
|
|
2273
|
+
markAccessed() {
|
|
2274
|
+
const ctx = getReplayContext();
|
|
2275
|
+
if (ctx?.dbBranchLease) {
|
|
2276
|
+
ctx.dbSnapshotAccessed = true;
|
|
2277
|
+
}
|
|
2203
2278
|
}
|
|
2204
2279
|
read() {
|
|
2205
2280
|
const ctx = getReplayContext();
|
|
@@ -3131,7 +3206,19 @@ var Bitfab = class {
|
|
|
3131
3206
|
contexts: traceState?.contexts ?? [],
|
|
3132
3207
|
testRunId: traceState?.testRunId,
|
|
3133
3208
|
inputSourceTraceId: traceState?.inputSourceTraceId,
|
|
3134
|
-
dbSnapshotRef: traceState?.dbSnapshotRef
|
|
3209
|
+
dbSnapshotRef: traceState?.dbSnapshotRef,
|
|
3210
|
+
// Built AFTER the wrapped fn finished, so `accessed` reflects
|
|
3211
|
+
// whether customer code obtained the branch URL during this
|
|
3212
|
+
// item. Omitted entirely when no lease was attached, so the
|
|
3213
|
+
// server can distinguish "no branch" from "branch ignored".
|
|
3214
|
+
...replayCtx?.dbBranchLease && {
|
|
3215
|
+
dbSnapshotUsage: {
|
|
3216
|
+
neonBranchId: replayCtx.dbBranchLease.neonBranchId,
|
|
3217
|
+
snapshotTimestamp: replayCtx.dbBranchLease.snapshotTimestamp,
|
|
3218
|
+
sourceTraceId: replayCtx.sourceBitfabTraceId,
|
|
3219
|
+
accessed: replayCtx.dbSnapshotAccessed === true
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3135
3222
|
});
|
|
3136
3223
|
activeTraceStates.delete(traceId);
|
|
3137
3224
|
if (persistenceCollector) {
|
|
@@ -3303,6 +3390,18 @@ var Bitfab = class {
|
|
|
3303
3390
|
if (params.dbSnapshotRef) {
|
|
3304
3391
|
rawTrace.db_snapshot_ref = params.dbSnapshotRef;
|
|
3305
3392
|
}
|
|
3393
|
+
if (params.dbSnapshotUsage) {
|
|
3394
|
+
rawTrace.db_snapshot_usage = {
|
|
3395
|
+
neon_branch_id: params.dbSnapshotUsage.neonBranchId,
|
|
3396
|
+
...params.dbSnapshotUsage.snapshotTimestamp && {
|
|
3397
|
+
snapshot_timestamp: params.dbSnapshotUsage.snapshotTimestamp
|
|
3398
|
+
},
|
|
3399
|
+
...params.dbSnapshotUsage.sourceTraceId && {
|
|
3400
|
+
source_trace_id: params.dbSnapshotUsage.sourceTraceId
|
|
3401
|
+
},
|
|
3402
|
+
accessed: params.dbSnapshotUsage.accessed
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
3306
3405
|
return this.httpClient.sendExternalTrace({
|
|
3307
3406
|
type: "sdk-function",
|
|
3308
3407
|
source: "typescript-sdk-function",
|