@514labs/moose-lib 0.6.267-ci-2-g72faeb73 → 0.6.267-ci-2-g580f80e4

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/index.mjs CHANGED
@@ -699,33 +699,48 @@ var getMooseInternal = () => globalThis.moose_internal;
699
699
  if (getMooseInternal() === void 0) {
700
700
  globalThis.moose_internal = moose_internal;
701
701
  }
702
- var loadIndex = () => {
703
- const registry = getMooseInternal();
704
- registry.tables.clear();
705
- registry.streams.clear();
706
- registry.ingestApis.clear();
707
- registry.apis.clear();
708
- registry.sqlResources.clear();
709
- registry.workflows.clear();
710
- registry.webApps.clear();
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
+ if (indexLoadState === "loaded") {
706
+ return;
728
707
  }
708
+ if (indexLoadState === "loading" && indexLoadPromise) {
709
+ return indexLoadPromise;
710
+ }
711
+ indexLoadState = "loading";
712
+ indexLoadPromise = (async () => {
713
+ try {
714
+ const registry = getMooseInternal();
715
+ registry.tables.clear();
716
+ registry.streams.clear();
717
+ registry.ingestApis.clear();
718
+ registry.apis.clear();
719
+ registry.sqlResources.clear();
720
+ registry.workflows.clear();
721
+ registry.webApps.clear();
722
+ const appDir = `${process2.cwd()}/${getSourceDir()}`;
723
+ Object.keys(__require.cache).forEach((key) => {
724
+ if (key.startsWith(appDir)) {
725
+ delete __require.cache[key];
726
+ }
727
+ });
728
+ __require(`${process2.cwd()}/${getSourceDir()}/index.ts`);
729
+ indexLoadState = "loaded";
730
+ } catch (error) {
731
+ indexLoadState = "unloaded";
732
+ indexLoadPromise = null;
733
+ let hint;
734
+ const details = error instanceof Error ? error.message : String(error);
735
+ if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
736
+ 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";
737
+ }
738
+ const errorMsg = `${hint ?? ""}${details}`;
739
+ const cause = error instanceof Error ? error : void 0;
740
+ throw new Error(errorMsg, { cause });
741
+ }
742
+ })();
743
+ return indexLoadPromise;
729
744
  };
730
745
  var dlqSchema = {
731
746
  version: "3.1",
@@ -847,7 +862,7 @@ var dlqColumns = [
847
862
  }
848
863
  ];
849
864
  var getWorkflows = async () => {
850
- loadIndex();
865
+ await loadIndex();
851
866
  const registry = getMooseInternal();
852
867
  return registry.workflows;
853
868
  };
@@ -2954,7 +2969,6 @@ function expressMiddleware() {
2954
2969
 
2955
2970
  // src/consumption-apis/runner.ts
2956
2971
  init_commons();
2957
- import cluster2 from "cluster";
2958
2972
  import * as jose from "jose";
2959
2973
 
2960
2974
  // src/cluster-utils.ts