@bitfab/sdk 0.18.1 → 0.18.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-QT7HWOKU.js → chunk-PY6V4FE3.js} +1 -1
- package/dist/chunk-PY6V4FE3.js.map +1 -0
- package/dist/{chunk-ILIUTS5D.js → chunk-UTVFKV2Z.js} +50 -7
- package/dist/chunk-UTVFKV2Z.js.map +1 -0
- package/dist/index.cjs +47 -4
- 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 +47 -4
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-BIPIDXX6.js → replay-P3QXRLOC.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-P3QXRLOC.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.18.
|
|
1066
|
+
declare const __version__ = "0.18.2";
|
|
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.18.
|
|
1066
|
+
declare const __version__ = "0.18.2";
|
|
1059
1067
|
|
|
1060
1068
|
/**
|
|
1061
1069
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
flushTraces,
|
|
12
12
|
getCurrentSpan,
|
|
13
13
|
getCurrentTrace
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UTVFKV2Z.js";
|
|
15
15
|
import {
|
|
16
16
|
BitfabError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-PY6V4FE3.js";
|
|
18
18
|
export {
|
|
19
19
|
Bitfab,
|
|
20
20
|
BitfabClaudeAgentHandler,
|
package/dist/node.cjs
CHANGED
|
@@ -447,7 +447,7 @@ registerAsyncLocalStorageClass(
|
|
|
447
447
|
);
|
|
448
448
|
|
|
449
449
|
// src/version.generated.ts
|
|
450
|
-
var __version__ = "0.18.
|
|
450
|
+
var __version__ = "0.18.2";
|
|
451
451
|
|
|
452
452
|
// src/constants.ts
|
|
453
453
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -2162,7 +2162,9 @@ var ReplayEnvironment = class {
|
|
|
2162
2162
|
* Throws if read outside a replay item.
|
|
2163
2163
|
*/
|
|
2164
2164
|
get databaseUrl() {
|
|
2165
|
-
|
|
2165
|
+
const snapshot = this.require();
|
|
2166
|
+
this.markAccessed();
|
|
2167
|
+
return snapshot.databaseUrl;
|
|
2166
2168
|
}
|
|
2167
2169
|
/** When the per-trace branch URL stops being valid. ISO-8601. */
|
|
2168
2170
|
get expiresAt() {
|
|
@@ -2190,7 +2192,24 @@ var ReplayEnvironment = class {
|
|
|
2190
2192
|
}
|
|
2191
2193
|
/** Non-throwing variant for callers that handle the inactive case. */
|
|
2192
2194
|
snapshot() {
|
|
2193
|
-
|
|
2195
|
+
const snapshot = this.read();
|
|
2196
|
+
if (snapshot) {
|
|
2197
|
+
this.markAccessed();
|
|
2198
|
+
}
|
|
2199
|
+
return snapshot;
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Record on the replay context that customer code obtained the branch
|
|
2203
|
+
* URL. Only `databaseUrl` and `snapshot()` count — `active`, `readOnly`
|
|
2204
|
+
* and friends inspect the lease without exposing the connection string,
|
|
2205
|
+
* so they don't prove the replayed code could have connected to the
|
|
2206
|
+
* branch.
|
|
2207
|
+
*/
|
|
2208
|
+
markAccessed() {
|
|
2209
|
+
const ctx = getReplayContext();
|
|
2210
|
+
if (ctx?.dbBranchLease) {
|
|
2211
|
+
ctx.dbSnapshotAccessed = true;
|
|
2212
|
+
}
|
|
2194
2213
|
}
|
|
2195
2214
|
read() {
|
|
2196
2215
|
const ctx = getReplayContext();
|
|
@@ -3122,7 +3141,19 @@ var Bitfab = class {
|
|
|
3122
3141
|
contexts: traceState?.contexts ?? [],
|
|
3123
3142
|
testRunId: traceState?.testRunId,
|
|
3124
3143
|
inputSourceTraceId: traceState?.inputSourceTraceId,
|
|
3125
|
-
dbSnapshotRef: traceState?.dbSnapshotRef
|
|
3144
|
+
dbSnapshotRef: traceState?.dbSnapshotRef,
|
|
3145
|
+
// Built AFTER the wrapped fn finished, so `accessed` reflects
|
|
3146
|
+
// whether customer code obtained the branch URL during this
|
|
3147
|
+
// item. Omitted entirely when no lease was attached, so the
|
|
3148
|
+
// server can distinguish "no branch" from "branch ignored".
|
|
3149
|
+
...replayCtx?.dbBranchLease && {
|
|
3150
|
+
dbSnapshotUsage: {
|
|
3151
|
+
neonBranchId: replayCtx.dbBranchLease.neonBranchId,
|
|
3152
|
+
snapshotTimestamp: replayCtx.dbBranchLease.snapshotTimestamp,
|
|
3153
|
+
sourceTraceId: replayCtx.sourceBitfabTraceId,
|
|
3154
|
+
accessed: replayCtx.dbSnapshotAccessed === true
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3126
3157
|
});
|
|
3127
3158
|
activeTraceStates.delete(traceId);
|
|
3128
3159
|
if (persistenceCollector) {
|
|
@@ -3294,6 +3325,18 @@ var Bitfab = class {
|
|
|
3294
3325
|
if (params.dbSnapshotRef) {
|
|
3295
3326
|
rawTrace.db_snapshot_ref = params.dbSnapshotRef;
|
|
3296
3327
|
}
|
|
3328
|
+
if (params.dbSnapshotUsage) {
|
|
3329
|
+
rawTrace.db_snapshot_usage = {
|
|
3330
|
+
neon_branch_id: params.dbSnapshotUsage.neonBranchId,
|
|
3331
|
+
...params.dbSnapshotUsage.snapshotTimestamp && {
|
|
3332
|
+
snapshot_timestamp: params.dbSnapshotUsage.snapshotTimestamp
|
|
3333
|
+
},
|
|
3334
|
+
...params.dbSnapshotUsage.sourceTraceId && {
|
|
3335
|
+
source_trace_id: params.dbSnapshotUsage.sourceTraceId
|
|
3336
|
+
},
|
|
3337
|
+
accessed: params.dbSnapshotUsage.accessed
|
|
3338
|
+
};
|
|
3339
|
+
}
|
|
3297
3340
|
return this.httpClient.sendExternalTrace({
|
|
3298
3341
|
type: "sdk-function",
|
|
3299
3342
|
source: "typescript-sdk-function",
|