@bitfab/sdk 0.64.1 → 0.64.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.
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-ALXL4OQU.js";
10
+ } from "./chunk-YM4CEDSB.js";
11
11
  import "./chunk-MT36GJMW.js";
12
12
  export {
13
13
  BitfabError,
@@ -19,4 +19,4 @@ export {
19
19
  parseRetryAfterMs,
20
20
  serializePayloadBody
21
21
  };
22
- //# sourceMappingURL=http-4DI4LQCX.js.map
22
+ //# sourceMappingURL=http-7B5TPJ6F.js.map
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-MO4NIW4T.js";
10
+ } from "./chunk-O7BR6N3G.js";
11
11
  export {
12
12
  BitfabError,
13
13
  HttpClient,
@@ -18,4 +18,4 @@ export {
18
18
  parseRetryAfterMs,
19
19
  serializePayloadBody
20
20
  };
21
- //# sourceMappingURL=http-B632MJBF.js.map
21
+ //# sourceMappingURL=http-TVPWBP7C.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.64.1";
45
+ __version__ = "0.64.2";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -9277,6 +9277,22 @@ var BitfabVercelAiHandler = class {
9277
9277
 
9278
9278
  // src/client.ts
9279
9279
  init_warnOnce();
9280
+ function markTracedFunction(target, traceFunctionKey, original) {
9281
+ Object.defineProperty(target, "_bitfabTraceFunctionKey", {
9282
+ value: traceFunctionKey
9283
+ });
9284
+ Object.defineProperty(target, "_bitfabWrappedFn", { value: original });
9285
+ Object.defineProperty(target, "bind", {
9286
+ value(thisArg, ...boundArgs) {
9287
+ return markTracedFunction(
9288
+ Function.prototype.bind.call(this, thisArg, ...boundArgs),
9289
+ traceFunctionKey,
9290
+ original
9291
+ );
9292
+ }
9293
+ });
9294
+ return target;
9295
+ }
9280
9296
  function resolveSpanExperimentId(options) {
9281
9297
  const { experimentId, testRunId } = options;
9282
9298
  if (experimentId !== void 0 && testRunId !== void 0 && experimentId !== testRunId) {
@@ -10127,11 +10143,7 @@ var Bitfab = class {
10127
10143
  }
10128
10144
  );
10129
10145
  };
10130
- Object.defineProperty(autoTraceRoot, "_bitfabTraceFunctionKey", {
10131
- value: traceFunctionKey
10132
- });
10133
- Object.defineProperty(autoTraceRoot, "_bitfabWrappedFn", { value: fn });
10134
- return autoTraceRoot;
10146
+ return markTracedFunction(autoTraceRoot, traceFunctionKey, fn);
10135
10147
  }
10136
10148
  applySimulationPlan(payload, submit, drop) {
10137
10149
  this.simulationPlan.send(
@@ -11146,11 +11158,7 @@ var Bitfab = class {
11146
11158
  }
11147
11159
  return runWithSpanStack(newStack, executeWithContext);
11148
11160
  };
11149
- Object.defineProperty(wrappedFn, "_bitfabTraceFunctionKey", {
11150
- value: traceFunctionKey
11151
- });
11152
- Object.defineProperty(wrappedFn, "_bitfabWrappedFn", { value: fn });
11153
- return wrappedFn;
11161
+ return markTracedFunction(wrappedFn, traceFunctionKey, fn);
11154
11162
  }
11155
11163
  /**
11156
11164
  * Create a standard ECMAScript method decorator that records each invocation
@@ -11955,9 +11963,36 @@ init_replay();
11955
11963
  init_errors();
11956
11964
  init_replay();
11957
11965
  init_replayInterrupt();
11966
+ init_warnOnce();
11958
11967
  function defineReplayRegistry(registry) {
11968
+ validateReplayRegistry(registry);
11959
11969
  return registry;
11960
11970
  }
11971
+ var REGISTRATION_FIELDS = /* @__PURE__ */ new Set([
11972
+ "client",
11973
+ "fn",
11974
+ "traceFunctionKey",
11975
+ "options",
11976
+ "optionsFactory"
11977
+ ]);
11978
+ function validateReplayRegistry(registry) {
11979
+ for (const [pipeline, registration] of Object.entries(registry)) {
11980
+ if (typeof registration !== "object" || registration === null) {
11981
+ throw new BitfabError(
11982
+ `Replay registry entry '${pipeline}' must be an object with client and fn.`
11983
+ );
11984
+ }
11985
+ const unknownFields = Object.keys(registration).filter(
11986
+ (field) => !REGISTRATION_FIELDS.has(field)
11987
+ );
11988
+ if (unknownFields.length > 0) {
11989
+ warnOnce(
11990
+ `replay-registry-unknown-fields:${pipeline}:${unknownFields.join(",")}`,
11991
+ `Replay registry entry '${pipeline}' has unknown field(s): ${unknownFields.join(", ")}. They are ignored. An entry takes client, fn, traceFunctionKey, options, and optionsFactory. Put replay options such as adaptInputs, mock, and mockOverride inside options. A later SDK release will reject unknown fields.`
11992
+ );
11993
+ }
11994
+ }
11995
+ }
11961
11996
  async function reseedFromRegistry(registry, pipeline, traceIds) {
11962
11997
  const registration = registry[pipeline];
11963
11998
  if (registration === void 0) {