@bitfab/sdk 0.65.6 → 0.65.7

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.
@@ -58,7 +58,7 @@ var CategoriesClient = class {
58
58
  const AssertionCategoriesClient = CategoriesClient;
59
59
  //#endregion
60
60
  //#region src/version.generated.ts
61
- const __version__ = "0.65.6";
61
+ const __version__ = "0.65.7";
62
62
  const __packageName__ = "@bitfab/sdk";
63
63
  //#endregion
64
64
  //#region src/constants.ts
@@ -832,6 +832,7 @@ var SimulationPlan = class {
832
832
  this.rootWaitOver = false;
833
833
  this.held = [];
834
834
  this.stopped = false;
835
+ this.readStarted = false;
835
836
  this.loaded = new Promise((resolve) => {
836
837
  this.resolveLoaded = resolve;
837
838
  });
@@ -842,8 +843,16 @@ var SimulationPlan = class {
842
843
  disabled() {
843
844
  return !this.enabled || simulationPlanEnvDisabled();
844
845
  }
846
+ idle() {
847
+ return !this.readStarted && this.source.canRead?.() === false;
848
+ }
845
849
  refresh() {
850
+ if (this.idle()) return;
851
+ this.read();
852
+ }
853
+ read() {
846
854
  if (this.stopped || this.disabled()) return;
855
+ this.readStarted = true;
847
856
  this.policyRefresh.run(() => this.source.getSimulationPlan(), (body) => {
848
857
  const parsed = parseSimulationPlan(body);
849
858
  if (parsed === null) this.scheduleRetry("sim-plan-unreadable", "the sim plan response was not understood");
@@ -888,7 +897,7 @@ var SimulationPlan = class {
888
897
  }
889
898
  waitForFirstRead() {
890
899
  this.refresh();
891
- if (this.rootWaitOver || this.disabled() || !this.holdingForFirstRead()) return;
900
+ if (this.rootWaitOver || this.disabled() || this.idle() || !this.holdingForFirstRead()) return;
892
901
  if (this.rootWait === void 0) {
893
902
  this.rootWait = new Promise((resolve) => {
894
903
  this.resolveRootWait = resolve;
@@ -904,11 +913,11 @@ var SimulationPlan = class {
904
913
  return !this.disabled() && this.contentOffByKey === void 0 && this.firstReadOver;
905
914
  }
906
915
  firstLoad() {
907
- if (this.contentOffByKey !== void 0 || this.stopped || this.disabled()) return;
916
+ if (this.contentOffByKey !== void 0 || this.stopped || this.disabled() || this.idle()) return;
908
917
  return this.loaded;
909
918
  }
910
919
  send(payload, traceFunctionKey, submit, drop) {
911
- this.refresh();
920
+ this.read();
912
921
  if (this.disabled() || traceFunctionKey === void 0 || spanNameOf(payload) === void 0 || recordedByFramework(payload)) {
913
922
  submit(payload);
914
923
  return;
@@ -926,7 +935,7 @@ var SimulationPlan = class {
926
935
  this.submitEntry(entry);
927
936
  }
928
937
  sendTrace(payload, submit) {
929
- this.refresh();
938
+ this.read();
930
939
  if (this.disabled() || !this.holdingForFirstRead() || !this.holdsSpanOfTrace(traceIdOf(payload))) {
931
940
  submit(payload);
932
941
  return;
@@ -6881,7 +6890,10 @@ var Bitfab = class {
6881
6890
  serviceUrl: this.serviceUrl,
6882
6891
  timeout: this.timeout
6883
6892
  });
6884
- this.simulationPlan = new SimulationPlan(this.httpClient, config.simulationPlan ?? true);
6893
+ this.simulationPlan = new SimulationPlan({
6894
+ getSimulationPlan: () => this.httpClient.getSimulationPlan(),
6895
+ canRead: () => this.canReadSimulationPlan()
6896
+ }, config.simulationPlan ?? true);
6885
6897
  this.httpClient.externalSpanTransform = (payload, submit, drop) => this.applySimulationPlan(payload, submit, drop);
6886
6898
  this.httpClient.externalTraceTransform = (payload, submit) => this.simulationPlan.sendTrace(payload, submit);
6887
6899
  this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
@@ -7153,6 +7165,9 @@ var Bitfab = class {
7153
7165
  if (!this.isCaptureConfigured() && !getReplayContext() && !inSeedScope()) return false;
7154
7166
  return this.resolveApiKey() !== void 0;
7155
7167
  }
7168
+ canReadSimulationPlan() {
7169
+ return ((this.captureConfiguredInCode ?? this.captureConfiguredFromEnv ?? readBooleanEnv(CAPTURE_ENABLED_ENV) ?? true) || getReplayContext() !== null || inSeedScope()) && this.findApiKey(true) !== void 0;
7170
+ }
7156
7171
  prepareFrameworkIntegration() {
7157
7172
  if (this.isCaptureConfigured() && this.strict) this.resolveApiKey();
7158
7173
  }
@@ -8435,4 +8450,4 @@ Object.defineProperty(exports, "serializeReplayResult", {
8435
8450
  }
8436
8451
  });
8437
8452
 
8438
- //# sourceMappingURL=src-FFSCRXpz.cjs.map
8453
+ //# sourceMappingURL=src-DgkDt32g.cjs.map