@514labs/moose-lib 0.6.267-ci-2-g3cd14684 → 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.
@@ -1627,43 +1627,58 @@ if (getMooseInternal() === void 0) {
1627
1627
  globalThis.moose_internal = moose_internal;
1628
1628
  }
1629
1629
  var dumpMooseInternal = async () => {
1630
- loadIndex();
1630
+ await loadIndex();
1631
1631
  console.log(
1632
1632
  "___MOOSE_STUFF___start",
1633
1633
  JSON.stringify(toInfraMap(getMooseInternal())),
1634
1634
  "end___MOOSE_STUFF___"
1635
1635
  );
1636
1636
  };
1637
- var loadIndex = () => {
1638
- const registry = getMooseInternal();
1639
- registry.tables.clear();
1640
- registry.streams.clear();
1641
- registry.ingestApis.clear();
1642
- registry.apis.clear();
1643
- registry.sqlResources.clear();
1644
- registry.workflows.clear();
1645
- registry.webApps.clear();
1646
- const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
1647
- Object.keys(require.cache).forEach((key) => {
1648
- if (key.startsWith(appDir)) {
1649
- delete require.cache[key];
1650
- }
1651
- });
1652
- try {
1653
- require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);
1654
- } catch (error) {
1655
- let hint;
1656
- const details = error instanceof Error ? error.message : String(error);
1657
- if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
1658
- 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";
1659
- }
1660
- const errorMsg = `${hint ?? ""}${details}`;
1661
- const cause = error instanceof Error ? error : void 0;
1662
- throw new Error(errorMsg, { cause });
1637
+ var indexLoadState = "unloaded";
1638
+ var indexLoadPromise = null;
1639
+ var loadIndex = async () => {
1640
+ if (indexLoadState === "loaded") {
1641
+ return;
1663
1642
  }
1643
+ if (indexLoadState === "loading" && indexLoadPromise) {
1644
+ return indexLoadPromise;
1645
+ }
1646
+ indexLoadState = "loading";
1647
+ indexLoadPromise = (async () => {
1648
+ try {
1649
+ const registry = getMooseInternal();
1650
+ registry.tables.clear();
1651
+ registry.streams.clear();
1652
+ registry.ingestApis.clear();
1653
+ registry.apis.clear();
1654
+ registry.sqlResources.clear();
1655
+ registry.workflows.clear();
1656
+ registry.webApps.clear();
1657
+ const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
1658
+ Object.keys(require.cache).forEach((key) => {
1659
+ if (key.startsWith(appDir)) {
1660
+ delete require.cache[key];
1661
+ }
1662
+ });
1663
+ require(`${import_process.default.cwd()}/${getSourceDir()}/index.ts`);
1664
+ indexLoadState = "loaded";
1665
+ } catch (error) {
1666
+ indexLoadState = "unloaded";
1667
+ indexLoadPromise = null;
1668
+ let hint;
1669
+ const details = error instanceof Error ? error.message : String(error);
1670
+ if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
1671
+ 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";
1672
+ }
1673
+ const errorMsg = `${hint ?? ""}${details}`;
1674
+ const cause = error instanceof Error ? error : void 0;
1675
+ throw new Error(errorMsg, { cause });
1676
+ }
1677
+ })();
1678
+ return indexLoadPromise;
1664
1679
  };
1665
1680
  var getStreamingFunctions = async () => {
1666
- loadIndex();
1681
+ await loadIndex();
1667
1682
  const registry = getMooseInternal();
1668
1683
  const transformFunctions = /* @__PURE__ */ new Map();
1669
1684
  registry.streams.forEach((stream) => {
@@ -1690,7 +1705,7 @@ var getStreamingFunctions = async () => {
1690
1705
  return transformFunctions;
1691
1706
  };
1692
1707
  var getApis2 = async () => {
1693
- loadIndex();
1708
+ await loadIndex();
1694
1709
  const apiFunctions = /* @__PURE__ */ new Map();
1695
1710
  const registry = getMooseInternal();
1696
1711
  const versionCountByName = /* @__PURE__ */ new Map();
@@ -1722,7 +1737,7 @@ var getApis2 = async () => {
1722
1737
  return apiFunctions;
1723
1738
  };
1724
1739
  var getWorkflows2 = async () => {
1725
- loadIndex();
1740
+ await loadIndex();
1726
1741
  const registry = getMooseInternal();
1727
1742
  return registry.workflows;
1728
1743
  };
@@ -1756,7 +1771,7 @@ var getTaskForWorkflow = async (workflowName, taskName) => {
1756
1771
  return task;
1757
1772
  };
1758
1773
  var getWebApps2 = async () => {
1759
- loadIndex();
1774
+ await loadIndex();
1760
1775
  return getMooseInternal().webApps;
1761
1776
  };
1762
1777