@514labs/moose-lib 0.6.267-ci-2-g3cd14684 → 0.6.267-ci-3-g2d546d7e
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/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/index.js +90 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -27
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +135 -43
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +135 -43
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -803,33 +803,96 @@ var getMooseInternal = () => globalThis.moose_internal;
|
|
|
803
803
|
if (getMooseInternal() === void 0) {
|
|
804
804
|
globalThis.moose_internal = moose_internal;
|
|
805
805
|
}
|
|
806
|
-
var
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
816
|
-
Object.keys(require.cache).forEach((key) => {
|
|
817
|
-
if (key.startsWith(appDir)) {
|
|
818
|
-
delete require.cache[key];
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
try {
|
|
822
|
-
require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);
|
|
823
|
-
} catch (error) {
|
|
824
|
-
let hint;
|
|
825
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
826
|
-
if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
|
|
827
|
-
hint = "The file or its dependencies are ESM-only. Switch to packages that dual-support CJS & ESM, or upgrade to Node 22.12+. If you must use Node 20, you may try Node 20.19\n\n";
|
|
828
|
-
}
|
|
829
|
-
const errorMsg = `${hint ?? ""}${details}`;
|
|
830
|
-
const cause = error instanceof Error ? error : void 0;
|
|
831
|
-
throw new Error(errorMsg, { cause });
|
|
806
|
+
var indexLoadState = "unloaded";
|
|
807
|
+
var indexLoadPromise = null;
|
|
808
|
+
var loadIndex = async () => {
|
|
809
|
+
const workerInfo = `[Worker ${import_process.default.pid}]`;
|
|
810
|
+
if (indexLoadState === "loaded") {
|
|
811
|
+
console.log(
|
|
812
|
+
`${workerInfo} loadIndex: already loaded, returning immediately`
|
|
813
|
+
);
|
|
814
|
+
return;
|
|
832
815
|
}
|
|
816
|
+
if (indexLoadState === "loading" && indexLoadPromise) {
|
|
817
|
+
console.log(
|
|
818
|
+
`${workerInfo} loadIndex: already loading, waiting for completion`
|
|
819
|
+
);
|
|
820
|
+
return indexLoadPromise;
|
|
821
|
+
}
|
|
822
|
+
console.log(`${workerInfo} loadIndex: starting load process`);
|
|
823
|
+
const startTime = Date.now();
|
|
824
|
+
const delay = Math.random() * 500;
|
|
825
|
+
console.log(
|
|
826
|
+
`${workerInfo} loadIndex: waiting ${delay.toFixed(0)}ms to stagger load`
|
|
827
|
+
);
|
|
828
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
829
|
+
if (indexLoadState === "loading" && indexLoadPromise) {
|
|
830
|
+
console.log(
|
|
831
|
+
`${workerInfo} loadIndex: another worker started loading during delay, waiting`
|
|
832
|
+
);
|
|
833
|
+
return indexLoadPromise;
|
|
834
|
+
}
|
|
835
|
+
if (indexLoadState === "loaded") {
|
|
836
|
+
console.log(
|
|
837
|
+
`${workerInfo} loadIndex: loaded by another worker during delay`
|
|
838
|
+
);
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
indexLoadState = "loading";
|
|
842
|
+
indexLoadPromise = (async () => {
|
|
843
|
+
try {
|
|
844
|
+
console.log(`${workerInfo} loadIndex: clearing registry...`);
|
|
845
|
+
const clearStart = Date.now();
|
|
846
|
+
const registry = getMooseInternal();
|
|
847
|
+
registry.tables.clear();
|
|
848
|
+
registry.streams.clear();
|
|
849
|
+
registry.ingestApis.clear();
|
|
850
|
+
registry.apis.clear();
|
|
851
|
+
registry.sqlResources.clear();
|
|
852
|
+
registry.workflows.clear();
|
|
853
|
+
registry.webApps.clear();
|
|
854
|
+
console.log(
|
|
855
|
+
`${workerInfo} loadIndex: registry cleared in ${Date.now() - clearStart}ms`
|
|
856
|
+
);
|
|
857
|
+
console.log(`${workerInfo} loadIndex: clearing require cache...`);
|
|
858
|
+
const cacheStart = Date.now();
|
|
859
|
+
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
860
|
+
Object.keys(require.cache).forEach((key) => {
|
|
861
|
+
if (key.startsWith(appDir)) {
|
|
862
|
+
delete require.cache[key];
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
console.log(
|
|
866
|
+
`${workerInfo} loadIndex: require cache cleared in ${Date.now() - cacheStart}ms`
|
|
867
|
+
);
|
|
868
|
+
console.log(`${workerInfo} loadIndex: requiring index.ts...`);
|
|
869
|
+
const requireStart = Date.now();
|
|
870
|
+
require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);
|
|
871
|
+
console.log(
|
|
872
|
+
`${workerInfo} loadIndex: require completed in ${Date.now() - requireStart}ms`
|
|
873
|
+
);
|
|
874
|
+
indexLoadState = "loaded";
|
|
875
|
+
console.log(
|
|
876
|
+
`${workerInfo} loadIndex: total load time ${Date.now() - startTime}ms`
|
|
877
|
+
);
|
|
878
|
+
} catch (error) {
|
|
879
|
+
console.error(
|
|
880
|
+
`${workerInfo} loadIndex: FAILED after ${Date.now() - startTime}ms`,
|
|
881
|
+
error
|
|
882
|
+
);
|
|
883
|
+
indexLoadState = "unloaded";
|
|
884
|
+
indexLoadPromise = null;
|
|
885
|
+
let hint;
|
|
886
|
+
const details = error instanceof Error ? error.message : String(error);
|
|
887
|
+
if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
|
|
888
|
+
hint = "The file or its dependencies are ESM-only. Switch to packages that dual-support CJS & ESM, or upgrade to Node 22.12+. If you must use Node 20, you may try Node 20.19\n\n";
|
|
889
|
+
}
|
|
890
|
+
const errorMsg = `${hint ?? ""}${details}`;
|
|
891
|
+
const cause = error instanceof Error ? error : void 0;
|
|
892
|
+
throw new Error(errorMsg, { cause });
|
|
893
|
+
}
|
|
894
|
+
})();
|
|
895
|
+
return indexLoadPromise;
|
|
833
896
|
};
|
|
834
897
|
var dlqSchema = {
|
|
835
898
|
version: "3.1",
|
|
@@ -951,7 +1014,7 @@ var dlqColumns = [
|
|
|
951
1014
|
}
|
|
952
1015
|
];
|
|
953
1016
|
var getWorkflows = async () => {
|
|
954
|
-
loadIndex();
|
|
1017
|
+
await loadIndex();
|
|
955
1018
|
const registry = getMooseInternal();
|
|
956
1019
|
return registry.workflows;
|
|
957
1020
|
};
|