@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.mjs
CHANGED
|
@@ -699,33 +699,96 @@ var getMooseInternal = () => globalThis.moose_internal;
|
|
|
699
699
|
if (getMooseInternal() === void 0) {
|
|
700
700
|
globalThis.moose_internal = moose_internal;
|
|
701
701
|
}
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
712
|
-
Object.keys(__require.cache).forEach((key) => {
|
|
713
|
-
if (key.startsWith(appDir)) {
|
|
714
|
-
delete __require.cache[key];
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
try {
|
|
718
|
-
__require(`${process2.cwd()}/${getSourceDir()}/index.ts`);
|
|
719
|
-
} catch (error) {
|
|
720
|
-
let hint;
|
|
721
|
-
const details = error instanceof Error ? error.message : String(error);
|
|
722
|
-
if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
|
|
723
|
-
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";
|
|
724
|
-
}
|
|
725
|
-
const errorMsg = `${hint ?? ""}${details}`;
|
|
726
|
-
const cause = error instanceof Error ? error : void 0;
|
|
727
|
-
throw new Error(errorMsg, { cause });
|
|
702
|
+
var indexLoadState = "unloaded";
|
|
703
|
+
var indexLoadPromise = null;
|
|
704
|
+
var loadIndex = async () => {
|
|
705
|
+
const workerInfo = `[Worker ${process2.pid}]`;
|
|
706
|
+
if (indexLoadState === "loaded") {
|
|
707
|
+
console.log(
|
|
708
|
+
`${workerInfo} loadIndex: already loaded, returning immediately`
|
|
709
|
+
);
|
|
710
|
+
return;
|
|
728
711
|
}
|
|
712
|
+
if (indexLoadState === "loading" && indexLoadPromise) {
|
|
713
|
+
console.log(
|
|
714
|
+
`${workerInfo} loadIndex: already loading, waiting for completion`
|
|
715
|
+
);
|
|
716
|
+
return indexLoadPromise;
|
|
717
|
+
}
|
|
718
|
+
console.log(`${workerInfo} loadIndex: starting load process`);
|
|
719
|
+
const startTime = Date.now();
|
|
720
|
+
const delay = Math.random() * 500;
|
|
721
|
+
console.log(
|
|
722
|
+
`${workerInfo} loadIndex: waiting ${delay.toFixed(0)}ms to stagger load`
|
|
723
|
+
);
|
|
724
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
725
|
+
if (indexLoadState === "loading" && indexLoadPromise) {
|
|
726
|
+
console.log(
|
|
727
|
+
`${workerInfo} loadIndex: another worker started loading during delay, waiting`
|
|
728
|
+
);
|
|
729
|
+
return indexLoadPromise;
|
|
730
|
+
}
|
|
731
|
+
if (indexLoadState === "loaded") {
|
|
732
|
+
console.log(
|
|
733
|
+
`${workerInfo} loadIndex: loaded by another worker during delay`
|
|
734
|
+
);
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
indexLoadState = "loading";
|
|
738
|
+
indexLoadPromise = (async () => {
|
|
739
|
+
try {
|
|
740
|
+
console.log(`${workerInfo} loadIndex: clearing registry...`);
|
|
741
|
+
const clearStart = Date.now();
|
|
742
|
+
const registry = getMooseInternal();
|
|
743
|
+
registry.tables.clear();
|
|
744
|
+
registry.streams.clear();
|
|
745
|
+
registry.ingestApis.clear();
|
|
746
|
+
registry.apis.clear();
|
|
747
|
+
registry.sqlResources.clear();
|
|
748
|
+
registry.workflows.clear();
|
|
749
|
+
registry.webApps.clear();
|
|
750
|
+
console.log(
|
|
751
|
+
`${workerInfo} loadIndex: registry cleared in ${Date.now() - clearStart}ms`
|
|
752
|
+
);
|
|
753
|
+
console.log(`${workerInfo} loadIndex: clearing require cache...`);
|
|
754
|
+
const cacheStart = Date.now();
|
|
755
|
+
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
756
|
+
Object.keys(__require.cache).forEach((key) => {
|
|
757
|
+
if (key.startsWith(appDir)) {
|
|
758
|
+
delete __require.cache[key];
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
console.log(
|
|
762
|
+
`${workerInfo} loadIndex: require cache cleared in ${Date.now() - cacheStart}ms`
|
|
763
|
+
);
|
|
764
|
+
console.log(`${workerInfo} loadIndex: requiring index.ts...`);
|
|
765
|
+
const requireStart = Date.now();
|
|
766
|
+
__require(`${process2.cwd()}/${getSourceDir()}/index.ts`);
|
|
767
|
+
console.log(
|
|
768
|
+
`${workerInfo} loadIndex: require completed in ${Date.now() - requireStart}ms`
|
|
769
|
+
);
|
|
770
|
+
indexLoadState = "loaded";
|
|
771
|
+
console.log(
|
|
772
|
+
`${workerInfo} loadIndex: total load time ${Date.now() - startTime}ms`
|
|
773
|
+
);
|
|
774
|
+
} catch (error) {
|
|
775
|
+
console.error(
|
|
776
|
+
`${workerInfo} loadIndex: FAILED after ${Date.now() - startTime}ms`,
|
|
777
|
+
error
|
|
778
|
+
);
|
|
779
|
+
indexLoadState = "unloaded";
|
|
780
|
+
indexLoadPromise = null;
|
|
781
|
+
let hint;
|
|
782
|
+
const details = error instanceof Error ? error.message : String(error);
|
|
783
|
+
if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
|
|
784
|
+
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";
|
|
785
|
+
}
|
|
786
|
+
const errorMsg = `${hint ?? ""}${details}`;
|
|
787
|
+
const cause = error instanceof Error ? error : void 0;
|
|
788
|
+
throw new Error(errorMsg, { cause });
|
|
789
|
+
}
|
|
790
|
+
})();
|
|
791
|
+
return indexLoadPromise;
|
|
729
792
|
};
|
|
730
793
|
var dlqSchema = {
|
|
731
794
|
version: "3.1",
|
|
@@ -847,7 +910,7 @@ var dlqColumns = [
|
|
|
847
910
|
}
|
|
848
911
|
];
|
|
849
912
|
var getWorkflows = async () => {
|
|
850
|
-
loadIndex();
|
|
913
|
+
await loadIndex();
|
|
851
914
|
const registry = getMooseInternal();
|
|
852
915
|
return registry.workflows;
|
|
853
916
|
};
|