bitfab 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-RQ7HWX2T.js";
10
+ } from "./chunk-O632VPWV.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-QJV2QWDF.js.map
21
+ //# sourceMappingURL=http-IOT2GDD2.js.map
@@ -7,7 +7,7 @@ import {
7
7
  flushTraces,
8
8
  parseRetryAfterMs,
9
9
  serializePayloadBody
10
- } from "./chunk-2Y4FK7ND.js";
10
+ } from "./chunk-XHUW3NY6.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-5F6I4E2K.js.map
22
+ //# sourceMappingURL=http-MFXRJ6RS.js.map
package/dist/index.cjs CHANGED
@@ -51,7 +51,7 @@ var __version__, __packageName__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.64.1";
54
+ __version__ = "0.64.2";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -9286,6 +9286,22 @@ var BitfabVercelAiHandler = class {
9286
9286
 
9287
9287
  // src/client.ts
9288
9288
  init_warnOnce();
9289
+ function markTracedFunction(target, traceFunctionKey, original) {
9290
+ Object.defineProperty(target, "_bitfabTraceFunctionKey", {
9291
+ value: traceFunctionKey
9292
+ });
9293
+ Object.defineProperty(target, "_bitfabWrappedFn", { value: original });
9294
+ Object.defineProperty(target, "bind", {
9295
+ value(thisArg, ...boundArgs) {
9296
+ return markTracedFunction(
9297
+ Function.prototype.bind.call(this, thisArg, ...boundArgs),
9298
+ traceFunctionKey,
9299
+ original
9300
+ );
9301
+ }
9302
+ });
9303
+ return target;
9304
+ }
9289
9305
  function resolveSpanExperimentId(options) {
9290
9306
  const { experimentId, testRunId } = options;
9291
9307
  if (experimentId !== void 0 && testRunId !== void 0 && experimentId !== testRunId) {
@@ -10136,11 +10152,7 @@ var Bitfab = class {
10136
10152
  }
10137
10153
  );
10138
10154
  };
10139
- Object.defineProperty(autoTraceRoot, "_bitfabTraceFunctionKey", {
10140
- value: traceFunctionKey
10141
- });
10142
- Object.defineProperty(autoTraceRoot, "_bitfabWrappedFn", { value: fn });
10143
- return autoTraceRoot;
10155
+ return markTracedFunction(autoTraceRoot, traceFunctionKey, fn);
10144
10156
  }
10145
10157
  applySimulationPlan(payload, submit, drop) {
10146
10158
  this.simulationPlan.send(
@@ -11155,11 +11167,7 @@ var Bitfab = class {
11155
11167
  }
11156
11168
  return runWithSpanStack(newStack, executeWithContext);
11157
11169
  };
11158
- Object.defineProperty(wrappedFn, "_bitfabTraceFunctionKey", {
11159
- value: traceFunctionKey
11160
- });
11161
- Object.defineProperty(wrappedFn, "_bitfabWrappedFn", { value: fn });
11162
- return wrappedFn;
11170
+ return markTracedFunction(wrappedFn, traceFunctionKey, fn);
11163
11171
  }
11164
11172
  /**
11165
11173
  * Create a standard ECMAScript method decorator that records each invocation
@@ -11964,9 +11972,36 @@ init_replay();
11964
11972
  init_errors();
11965
11973
  init_replay();
11966
11974
  init_replayInterrupt();
11975
+ init_warnOnce();
11967
11976
  function defineReplayRegistry(registry) {
11977
+ validateReplayRegistry(registry);
11968
11978
  return registry;
11969
11979
  }
11980
+ var REGISTRATION_FIELDS = /* @__PURE__ */ new Set([
11981
+ "client",
11982
+ "fn",
11983
+ "traceFunctionKey",
11984
+ "options",
11985
+ "optionsFactory"
11986
+ ]);
11987
+ function validateReplayRegistry(registry) {
11988
+ for (const [pipeline, registration] of Object.entries(registry)) {
11989
+ if (typeof registration !== "object" || registration === null) {
11990
+ throw new BitfabError(
11991
+ `Replay registry entry '${pipeline}' must be an object with client and fn.`
11992
+ );
11993
+ }
11994
+ const unknownFields = Object.keys(registration).filter(
11995
+ (field) => !REGISTRATION_FIELDS.has(field)
11996
+ );
11997
+ if (unknownFields.length > 0) {
11998
+ warnOnce(
11999
+ `replay-registry-unknown-fields:${pipeline}:${unknownFields.join(",")}`,
12000
+ `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.`
12001
+ );
12002
+ }
12003
+ }
12004
+ }
11970
12005
  async function reseedFromRegistry(registry, pipeline, traceIds) {
11971
12006
  const registration = registry[pipeline];
11972
12007
  if (registration === void 0) {