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.
- package/dist/{chunk-BBBAQPIW.js → chunk-ENORQO5K.js} +50 -16
- package/dist/chunk-ENORQO5K.js.map +1 -0
- package/dist/{chunk-EQBRW3MC.js → chunk-FX4X7LOW.js} +52 -4
- package/dist/{chunk-EQBRW3MC.js.map → chunk-FX4X7LOW.js.map} +1 -1
- package/dist/{chunk-WX5DWEZM.js → chunk-GLWAET3G.js} +2 -2
- package/dist/{chunk-RQ7HWX2T.js → chunk-O632VPWV.js} +3 -2
- package/dist/{chunk-RQ7HWX2T.js.map → chunk-O632VPWV.js.map} +1 -1
- package/dist/{chunk-2Y4FK7ND.js → chunk-XHUW3NY6.js} +2 -2
- package/dist/{chunk-2Y4FK7ND.js.map → chunk-XHUW3NY6.js.map} +1 -1
- package/dist/{http-QJV2QWDF.js → http-IOT2GDD2.js} +2 -2
- package/dist/{http-5F6I4E2K.js → http-MFXRJ6RS.js} +2 -2
- package/dist/index.cjs +46 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/node.cjs +46 -11
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-DA2IX4KM.js → replay-QZQYRTAO.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-BBBAQPIW.js.map +0 -1
- /package/dist/{chunk-WX5DWEZM.js.map → chunk-GLWAET3G.js.map} +0 -0
- /package/dist/{http-5F6I4E2K.js.map → http-IOT2GDD2.js.map} +0 -0
- /package/dist/{http-QJV2QWDF.js.map → http-MFXRJ6RS.js.map} +0 -0
- /package/dist/{replay-DA2IX4KM.js.map → replay-QZQYRTAO.js.map} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BitfabError,
|
|
3
|
+
warnOnce,
|
|
3
4
|
writeOnce
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-O632VPWV.js";
|
|
5
6
|
|
|
6
7
|
// src/codeChange.ts
|
|
7
8
|
var NUL = String.fromCharCode(0);
|
|
@@ -84,6 +85,31 @@ function warnJudgeAssertionsDeprecated(write = console.warn) {
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
// src/replayRegistry.ts
|
|
88
|
+
var REGISTRATION_FIELDS = /* @__PURE__ */ new Set([
|
|
89
|
+
"client",
|
|
90
|
+
"fn",
|
|
91
|
+
"traceFunctionKey",
|
|
92
|
+
"options",
|
|
93
|
+
"optionsFactory"
|
|
94
|
+
]);
|
|
95
|
+
function validateReplayRegistry(registry) {
|
|
96
|
+
for (const [pipeline, registration] of Object.entries(registry)) {
|
|
97
|
+
if (typeof registration !== "object" || registration === null) {
|
|
98
|
+
throw new BitfabError(
|
|
99
|
+
`Replay registry entry '${pipeline}' must be an object with client and fn.`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
const unknownFields = Object.keys(registration).filter(
|
|
103
|
+
(field) => !REGISTRATION_FIELDS.has(field)
|
|
104
|
+
);
|
|
105
|
+
if (unknownFields.length > 0) {
|
|
106
|
+
warnOnce(
|
|
107
|
+
`replay-registry-unknown-fields:${pipeline}:${unknownFields.join(",")}`,
|
|
108
|
+
`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.`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
87
113
|
var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
88
114
|
"--limit",
|
|
89
115
|
"--attempts",
|
|
@@ -290,7 +316,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
290
316
|
sessionId: seedCase.sessionId
|
|
291
317
|
})
|
|
292
318
|
);
|
|
293
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
319
|
+
const { flushTraces: flushTraces2 } = await import("./http-IOT2GDD2.js");
|
|
294
320
|
await flushTraces2(3e4);
|
|
295
321
|
return { pipeline, traceFunctionKey, traceIds };
|
|
296
322
|
}
|
|
@@ -894,7 +920,28 @@ async function importRegistry(path) {
|
|
|
894
920
|
register();
|
|
895
921
|
isTypeScriptLoaderRegistered = true;
|
|
896
922
|
}
|
|
897
|
-
|
|
923
|
+
try {
|
|
924
|
+
return await import(pathToFileURL(path).href);
|
|
925
|
+
} catch (error) {
|
|
926
|
+
if (isModuleNotFoundError(error)) {
|
|
927
|
+
throw new BitfabError(`${error.message}
|
|
928
|
+
|
|
929
|
+
${registryImportHint(path)}`);
|
|
930
|
+
}
|
|
931
|
+
throw error;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function isModuleNotFoundError(error) {
|
|
935
|
+
const code = error?.code;
|
|
936
|
+
return error instanceof Error && (code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND");
|
|
937
|
+
}
|
|
938
|
+
function registryImportHint(path) {
|
|
939
|
+
return [
|
|
940
|
+
`The replay registry '${path}' could not load one of its imports.`,
|
|
941
|
+
"A registry belongs in the package that builds the traced function's call and already depends on everything it imports (its tools, clients, and config), and bitfab-replay runs from that package's directory.",
|
|
942
|
+
"When the traced function lives in a lower-level library that an app package calls, put the registry in the app package and add @bitfab/sdk to it. Copying the app's dependencies into the library is the wrong fix.",
|
|
943
|
+
`See "When the traced function needs the app's dependencies" at https://docs.bitfab.ai/typescript-sdk.`
|
|
944
|
+
].join("\n");
|
|
898
945
|
}
|
|
899
946
|
function resolveRegistry(moduleValue, path) {
|
|
900
947
|
if (typeof moduleValue !== "object" || moduleValue === null) {
|
|
@@ -908,6 +955,7 @@ function resolveRegistry(moduleValue, path) {
|
|
|
908
955
|
`Replay registry '${path}' must export a default registry.`
|
|
909
956
|
);
|
|
910
957
|
}
|
|
958
|
+
validateReplayRegistry(registry);
|
|
911
959
|
return registry;
|
|
912
960
|
}
|
|
913
961
|
async function runRegistryMain(run, io = {}) {
|
|
@@ -959,4 +1007,4 @@ export {
|
|
|
959
1007
|
runRegistryMain,
|
|
960
1008
|
runIfEntrypoint
|
|
961
1009
|
};
|
|
962
|
-
//# sourceMappingURL=chunk-
|
|
1010
|
+
//# sourceMappingURL=chunk-FX4X7LOW.js.map
|