bitfab 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
@@ -29,7 +29,7 @@ import {
29
29
  getCurrentTrace,
30
30
  reseedFromRegistry,
31
31
  seedFromRegistry
32
- } from "./chunk-MFMTLYDW.js";
32
+ } from "./chunk-XPCVDQDS.js";
33
33
  import "./chunk-EGWJYCNT.js";
34
34
  import {
35
35
  BITFAB_PROGRESS_PREFIX,
@@ -38,7 +38,7 @@ import {
38
38
  ReplayError,
39
39
  reportReplayProgress,
40
40
  serializeReplayResult
41
- } from "./chunk-ONMN7WXS.js";
41
+ } from "./chunk-RUCVJQBI.js";
42
42
  import {
43
43
  BitfabError,
44
44
  DEFAULT_SERVICE_URL,
@@ -46,7 +46,7 @@ import {
46
46
  MixedTracingError,
47
47
  __version__,
48
48
  flushTraces
49
- } from "./chunk-GGMFD2ZE.js";
49
+ } from "./chunk-5H3D7J4K.js";
50
50
  import "./chunk-VCRFFCLY.js";
51
51
  export {
52
52
  AssertionCategoriesClient,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.54.7";
100
+ __version__ = "0.54.8";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -7916,6 +7916,30 @@ function readEnv2(name) {
7916
7916
  }
7917
7917
  return void 0;
7918
7918
  }
7919
+ var CAPTURE_ENABLED_ENV = "BITFAB_CAPTURE_ENABLED";
7920
+ var TRUE_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes"]);
7921
+ var FALSE_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no"]);
7922
+ function readBooleanEnv(name) {
7923
+ const raw = readEnv2(name);
7924
+ if (raw === void 0) {
7925
+ return void 0;
7926
+ }
7927
+ const value = raw.trim().toLowerCase();
7928
+ if (value === "") {
7929
+ return void 0;
7930
+ }
7931
+ if (TRUE_ENV_VALUES.has(value)) {
7932
+ return true;
7933
+ }
7934
+ if (FALSE_ENV_VALUES.has(value)) {
7935
+ return false;
7936
+ }
7937
+ warnOnce(
7938
+ `unrecognized-boolean-env:${name}`,
7939
+ `${name}="${raw}" is not 0 or 1; ignoring it.`
7940
+ );
7941
+ return void 0;
7942
+ }
7919
7943
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
7920
7944
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
7921
7945
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
@@ -7970,7 +7994,7 @@ var Bitfab = class {
7970
7994
  "Bitfab({ enabled }) is deprecated; pass captureEnabled instead."
7971
7995
  );
7972
7996
  }
7973
- this.captureConfigured = (config.captureEnabled ?? true) && (config.enabled ?? true);
7997
+ this.captureConfiguredInCode = config.captureEnabled === void 0 && config.enabled === void 0 ? void 0 : (config.captureEnabled ?? true) && (config.enabled ?? true);
7974
7998
  this.strict = config.strict ?? false;
7975
7999
  this.bamlClient = config.bamlClient ?? null;
7976
8000
  if (config.dbSnapshot) {
@@ -8424,7 +8448,7 @@ var Bitfab = class {
8424
8448
  "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`."
8425
8449
  );
8426
8450
  }
8427
- if (this.captureConfigured && !this.apiKeyWarned) {
8451
+ if (this.isCaptureConfigured() && !this.apiKeyWarned) {
8428
8452
  this.apiKeyWarned = true;
8429
8453
  console.warn(
8430
8454
  "Bitfab: apiKey is empty - tracing is disabled. Provide a valid API key to enable tracing."
@@ -8432,20 +8456,29 @@ var Bitfab = class {
8432
8456
  }
8433
8457
  return void 0;
8434
8458
  }
8459
+ isCaptureConfigured() {
8460
+ if (this.captureConfiguredInCode !== void 0) {
8461
+ return this.captureConfiguredInCode;
8462
+ }
8463
+ if (this.captureConfiguredFromEnv === void 0) {
8464
+ this.captureConfiguredFromEnv = readBooleanEnv(CAPTURE_ENABLED_ENV) ?? true;
8465
+ }
8466
+ return this.captureConfiguredFromEnv;
8467
+ }
8435
8468
  isCaptureEnabled() {
8436
- if (!this.captureConfigured) {
8469
+ if (!this.isCaptureConfigured()) {
8437
8470
  return false;
8438
8471
  }
8439
8472
  return this.resolveApiKey() !== void 0;
8440
8473
  }
8441
8474
  shouldRecord() {
8442
- if (!this.captureConfigured && !getReplayContext() && !inSeedScope()) {
8475
+ if (!this.isCaptureConfigured() && !getReplayContext() && !inSeedScope()) {
8443
8476
  return false;
8444
8477
  }
8445
8478
  return this.resolveApiKey() !== void 0;
8446
8479
  }
8447
8480
  prepareFrameworkIntegration() {
8448
- if (this.captureConfigured && this.strict) {
8481
+ if (this.isCaptureConfigured() && this.strict) {
8449
8482
  this.resolveApiKey();
8450
8483
  }
8451
8484
  }