@bitfab/sdk 0.54.7 → 0.54.8

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
@@ -2763,7 +2763,8 @@ declare class Bitfab {
2763
2763
  private readonly serviceUrl;
2764
2764
  private readonly timeout;
2765
2765
  private readonly envVars;
2766
- private readonly captureConfigured;
2766
+ private readonly captureConfiguredInCode;
2767
+ private captureConfiguredFromEnv;
2767
2768
  private readonly strict;
2768
2769
  private readonly httpClient;
2769
2770
  /** Dataset operations for the authenticated organization. */
@@ -2884,6 +2885,7 @@ declare class Bitfab {
2884
2885
  * early resolve that found nothing never poisons a later one.
2885
2886
  */
2886
2887
  private resolveApiKey;
2888
+ private isCaptureConfigured;
2887
2889
  private isCaptureEnabled;
2888
2890
  private shouldRecord;
2889
2891
  private prepareFrameworkIntegration;
@@ -3429,7 +3431,7 @@ interface CommitRef {
3429
3431
  /**
3430
3432
  * SDK version from package.json (injected at build time)
3431
3433
  */
3432
- declare const __version__ = "0.54.7";
3434
+ declare const __version__ = "0.54.8";
3433
3435
 
3434
3436
  /**
3435
3437
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -2763,7 +2763,8 @@ declare class Bitfab {
2763
2763
  private readonly serviceUrl;
2764
2764
  private readonly timeout;
2765
2765
  private readonly envVars;
2766
- private readonly captureConfigured;
2766
+ private readonly captureConfiguredInCode;
2767
+ private captureConfiguredFromEnv;
2767
2768
  private readonly strict;
2768
2769
  private readonly httpClient;
2769
2770
  /** Dataset operations for the authenticated organization. */
@@ -2884,6 +2885,7 @@ declare class Bitfab {
2884
2885
  * early resolve that found nothing never poisons a later one.
2885
2886
  */
2886
2887
  private resolveApiKey;
2888
+ private isCaptureConfigured;
2887
2889
  private isCaptureEnabled;
2888
2890
  private shouldRecord;
2889
2891
  private prepareFrameworkIntegration;
@@ -3429,7 +3431,7 @@ interface CommitRef {
3429
3431
  /**
3430
3432
  * SDK version from package.json (injected at build time)
3431
3433
  */
3432
- declare const __version__ = "0.54.7";
3434
+ declare const __version__ = "0.54.8";
3433
3435
 
3434
3436
  /**
3435
3437
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  getCurrentTrace,
21
21
  reseedFromRegistry,
22
22
  seedFromRegistry
23
- } from "./chunk-X6AIRJJX.js";
23
+ } from "./chunk-L4SB4W3Z.js";
24
24
  import "./chunk-EGWJYCNT.js";
25
25
  import {
26
26
  BITFAB_PROGRESS_PREFIX,
@@ -29,7 +29,7 @@ import {
29
29
  ReplayError,
30
30
  reportReplayProgress,
31
31
  serializeReplayResult
32
- } from "./chunk-27WMHYUI.js";
32
+ } from "./chunk-M2AEKEZE.js";
33
33
  import {
34
34
  BitfabError,
35
35
  DEFAULT_SERVICE_URL,
@@ -37,7 +37,7 @@ import {
37
37
  MixedTracingError,
38
38
  __version__,
39
39
  flushTraces
40
- } from "./chunk-JF56DBPP.js";
40
+ } from "./chunk-4LMLPCYL.js";
41
41
  import "./chunk-VCRFFCLY.js";
42
42
  export {
43
43
  AssertionCategoriesClient,
package/dist/node.cjs CHANGED
@@ -88,7 +88,7 @@ var __version__, __packageName__;
88
88
  var init_version_generated = __esm({
89
89
  "src/version.generated.ts"() {
90
90
  "use strict";
91
- __version__ = "0.54.7";
91
+ __version__ = "0.54.8";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -7907,6 +7907,30 @@ function readEnv2(name) {
7907
7907
  }
7908
7908
  return void 0;
7909
7909
  }
7910
+ var CAPTURE_ENABLED_ENV = "BITFAB_CAPTURE_ENABLED";
7911
+ var TRUE_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes"]);
7912
+ var FALSE_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no"]);
7913
+ function readBooleanEnv(name) {
7914
+ const raw = readEnv2(name);
7915
+ if (raw === void 0) {
7916
+ return void 0;
7917
+ }
7918
+ const value = raw.trim().toLowerCase();
7919
+ if (value === "") {
7920
+ return void 0;
7921
+ }
7922
+ if (TRUE_ENV_VALUES.has(value)) {
7923
+ return true;
7924
+ }
7925
+ if (FALSE_ENV_VALUES.has(value)) {
7926
+ return false;
7927
+ }
7928
+ warnOnce(
7929
+ `unrecognized-boolean-env:${name}`,
7930
+ `${name}="${raw}" is not 0 or 1; ignoring it.`
7931
+ );
7932
+ return void 0;
7933
+ }
7910
7934
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
7911
7935
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
7912
7936
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
@@ -7961,7 +7985,7 @@ var Bitfab = class {
7961
7985
  "Bitfab({ enabled }) is deprecated; pass captureEnabled instead."
7962
7986
  );
7963
7987
  }
7964
- this.captureConfigured = (config.captureEnabled ?? true) && (config.enabled ?? true);
7988
+ this.captureConfiguredInCode = config.captureEnabled === void 0 && config.enabled === void 0 ? void 0 : (config.captureEnabled ?? true) && (config.enabled ?? true);
7965
7989
  this.strict = config.strict ?? false;
7966
7990
  this.bamlClient = config.bamlClient ?? null;
7967
7991
  if (config.dbSnapshot) {
@@ -8415,7 +8439,7 @@ var Bitfab = class {
8415
8439
  "Bitfab: no API key resolved. Set BITFAB_API_KEY or pass apiKey to new Bitfab(). If a script loads env with dotenv, load it before the module that constructs the client is imported (e.g. `node --env-file=.env script.ts`), or pass `apiKey: () => process.env.BITFAB_API_KEY`."
8416
8440
  );
8417
8441
  }
8418
- if (this.captureConfigured && !this.apiKeyWarned) {
8442
+ if (this.isCaptureConfigured() && !this.apiKeyWarned) {
8419
8443
  this.apiKeyWarned = true;
8420
8444
  console.warn(
8421
8445
  "Bitfab: apiKey is empty - tracing is disabled. Provide a valid API key to enable tracing."
@@ -8423,20 +8447,29 @@ var Bitfab = class {
8423
8447
  }
8424
8448
  return void 0;
8425
8449
  }
8450
+ isCaptureConfigured() {
8451
+ if (this.captureConfiguredInCode !== void 0) {
8452
+ return this.captureConfiguredInCode;
8453
+ }
8454
+ if (this.captureConfiguredFromEnv === void 0) {
8455
+ this.captureConfiguredFromEnv = readBooleanEnv(CAPTURE_ENABLED_ENV) ?? true;
8456
+ }
8457
+ return this.captureConfiguredFromEnv;
8458
+ }
8426
8459
  isCaptureEnabled() {
8427
- if (!this.captureConfigured) {
8460
+ if (!this.isCaptureConfigured()) {
8428
8461
  return false;
8429
8462
  }
8430
8463
  return this.resolveApiKey() !== void 0;
8431
8464
  }
8432
8465
  shouldRecord() {
8433
- if (!this.captureConfigured && !getReplayContext() && !inSeedScope()) {
8466
+ if (!this.isCaptureConfigured() && !getReplayContext() && !inSeedScope()) {
8434
8467
  return false;
8435
8468
  }
8436
8469
  return this.resolveApiKey() !== void 0;
8437
8470
  }
8438
8471
  prepareFrameworkIntegration() {
8439
- if (this.captureConfigured && this.strict) {
8472
+ if (this.isCaptureConfigured() && this.strict) {
8440
8473
  this.resolveApiKey();
8441
8474
  }
8442
8475
  }