@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.js CHANGED
@@ -803,33 +803,48 @@ var getMooseInternal = () => globalThis.moose_internal;
803
803
  if (getMooseInternal() === void 0) {
804
804
  globalThis.moose_internal = moose_internal;
805
805
  }
806
- var loadIndex = () => {
807
- const registry = getMooseInternal();
808
- registry.tables.clear();
809
- registry.streams.clear();
810
- registry.ingestApis.clear();
811
- registry.apis.clear();
812
- registry.sqlResources.clear();
813
- registry.workflows.clear();
814
- registry.webApps.clear();
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
+ if (indexLoadState === "loaded") {
810
+ return;
832
811
  }
812
+ if (indexLoadState === "loading" && indexLoadPromise) {
813
+ return indexLoadPromise;
814
+ }
815
+ indexLoadState = "loading";
816
+ indexLoadPromise = (async () => {
817
+ try {
818
+ const registry = getMooseInternal();
819
+ registry.tables.clear();
820
+ registry.streams.clear();
821
+ registry.ingestApis.clear();
822
+ registry.apis.clear();
823
+ registry.sqlResources.clear();
824
+ registry.workflows.clear();
825
+ registry.webApps.clear();
826
+ const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
827
+ Object.keys(require.cache).forEach((key) => {
828
+ if (key.startsWith(appDir)) {
829
+ delete require.cache[key];
830
+ }
831
+ });
832
+ require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);
833
+ indexLoadState = "loaded";
834
+ } catch (error) {
835
+ indexLoadState = "unloaded";
836
+ indexLoadPromise = null;
837
+ let hint;
838
+ const details = error instanceof Error ? error.message : String(error);
839
+ if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
840
+ 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";
841
+ }
842
+ const errorMsg = `${hint ?? ""}${details}`;
843
+ const cause = error instanceof Error ? error : void 0;
844
+ throw new Error(errorMsg, { cause });
845
+ }
846
+ })();
847
+ return indexLoadPromise;
833
848
  };
834
849
  var dlqSchema = {
835
850
  version: "3.1",
@@ -951,7 +966,7 @@ var dlqColumns = [
951
966
  }
952
967
  ];
953
968
  var getWorkflows = async () => {
954
- loadIndex();
969
+ await loadIndex();
955
970
  const registry = getMooseInternal();
956
971
  return registry.workflows;
957
972
  };
@@ -3054,7 +3069,6 @@ function expressMiddleware() {
3054
3069
  }
3055
3070
 
3056
3071
  // src/consumption-apis/runner.ts
3057
- var import_node_cluster2 = __toESM(require("cluster"));
3058
3072
  init_commons();
3059
3073
  var jose = __toESM(require("jose"));
3060
3074