@bitfab/sdk 0.54.7 → 0.54.9

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.
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-OIIMVPTH.js";
9
+ } from "./chunk-UL4D3J5B.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-I5VDJLSJ.js.map
19
+ //# sourceMappingURL=http-ARMDS4NC.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-JF56DBPP.js";
9
+ } from "./chunk-B7CO654C.js";
10
10
  import "./chunk-VCRFFCLY.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-RGNLMMZQ.js.map
20
+ //# sourceMappingURL=http-FQNKAPY2.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.54.7";
45
+ __version__ = "0.54.9";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -7893,6 +7893,30 @@ function readEnv2(name) {
7893
7893
  }
7894
7894
  return void 0;
7895
7895
  }
7896
+ var CAPTURE_ENABLED_ENV = "BITFAB_CAPTURE_ENABLED";
7897
+ var TRUE_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes"]);
7898
+ var FALSE_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no"]);
7899
+ function readBooleanEnv(name) {
7900
+ const raw = readEnv2(name);
7901
+ if (raw === void 0) {
7902
+ return void 0;
7903
+ }
7904
+ const value = raw.trim().toLowerCase();
7905
+ if (value === "") {
7906
+ return void 0;
7907
+ }
7908
+ if (TRUE_ENV_VALUES.has(value)) {
7909
+ return true;
7910
+ }
7911
+ if (FALSE_ENV_VALUES.has(value)) {
7912
+ return false;
7913
+ }
7914
+ warnOnce(
7915
+ `unrecognized-boolean-env:${name}`,
7916
+ `${name}="${raw}" is not 0 or 1; ignoring it.`
7917
+ );
7918
+ return void 0;
7919
+ }
7896
7920
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
7897
7921
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
7898
7922
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
@@ -7947,7 +7971,7 @@ var Bitfab = class {
7947
7971
  "Bitfab({ enabled }) is deprecated; pass captureEnabled instead."
7948
7972
  );
7949
7973
  }
7950
- this.captureConfigured = (config.captureEnabled ?? true) && (config.enabled ?? true);
7974
+ this.captureConfiguredInCode = config.captureEnabled === void 0 && config.enabled === void 0 ? void 0 : (config.captureEnabled ?? true) && (config.enabled ?? true);
7951
7975
  this.strict = config.strict ?? false;
7952
7976
  this.bamlClient = config.bamlClient ?? null;
7953
7977
  if (config.dbSnapshot) {
@@ -8401,7 +8425,7 @@ var Bitfab = class {
8401
8425
  "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`."
8402
8426
  );
8403
8427
  }
8404
- if (this.captureConfigured && !this.apiKeyWarned) {
8428
+ if (this.isCaptureConfigured() && !this.apiKeyWarned) {
8405
8429
  this.apiKeyWarned = true;
8406
8430
  console.warn(
8407
8431
  "Bitfab: apiKey is empty - tracing is disabled. Provide a valid API key to enable tracing."
@@ -8409,20 +8433,29 @@ var Bitfab = class {
8409
8433
  }
8410
8434
  return void 0;
8411
8435
  }
8436
+ isCaptureConfigured() {
8437
+ if (this.captureConfiguredInCode !== void 0) {
8438
+ return this.captureConfiguredInCode;
8439
+ }
8440
+ if (this.captureConfiguredFromEnv === void 0) {
8441
+ this.captureConfiguredFromEnv = readBooleanEnv(CAPTURE_ENABLED_ENV) ?? true;
8442
+ }
8443
+ return this.captureConfiguredFromEnv;
8444
+ }
8412
8445
  isCaptureEnabled() {
8413
- if (!this.captureConfigured) {
8446
+ if (!this.isCaptureConfigured()) {
8414
8447
  return false;
8415
8448
  }
8416
8449
  return this.resolveApiKey() !== void 0;
8417
8450
  }
8418
8451
  shouldRecord() {
8419
- if (!this.captureConfigured && !getReplayContext() && !inSeedScope()) {
8452
+ if (!this.isCaptureConfigured() && !getReplayContext() && !inSeedScope()) {
8420
8453
  return false;
8421
8454
  }
8422
8455
  return this.resolveApiKey() !== void 0;
8423
8456
  }
8424
8457
  prepareFrameworkIntegration() {
8425
- if (this.captureConfigured && this.strict) {
8458
+ if (this.isCaptureConfigured() && this.strict) {
8426
8459
  this.resolveApiKey();
8427
8460
  }
8428
8461
  }