@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.
@@ -1614,43 +1614,58 @@ if (getMooseInternal() === void 0) {
1614
1614
  globalThis.moose_internal = moose_internal;
1615
1615
  }
1616
1616
  var dumpMooseInternal = async () => {
1617
- loadIndex();
1617
+ await loadIndex();
1618
1618
  console.log(
1619
1619
  "___MOOSE_STUFF___start",
1620
1620
  JSON.stringify(toInfraMap(getMooseInternal())),
1621
1621
  "end___MOOSE_STUFF___"
1622
1622
  );
1623
1623
  };
1624
- var loadIndex = () => {
1625
- const registry = getMooseInternal();
1626
- registry.tables.clear();
1627
- registry.streams.clear();
1628
- registry.ingestApis.clear();
1629
- registry.apis.clear();
1630
- registry.sqlResources.clear();
1631
- registry.workflows.clear();
1632
- registry.webApps.clear();
1633
- const appDir = `${process2.cwd()}/${getSourceDir()}`;
1634
- Object.keys(__require.cache).forEach((key) => {
1635
- if (key.startsWith(appDir)) {
1636
- delete __require.cache[key];
1637
- }
1638
- });
1639
- try {
1640
- __require(`${process2.cwd()}/${getSourceDir()}/index.ts`);
1641
- } catch (error) {
1642
- let hint;
1643
- const details = error instanceof Error ? error.message : String(error);
1644
- if (details.includes("ERR_REQUIRE_ESM") || details.includes("ES Module")) {
1645
- 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";
1646
- }
1647
- const errorMsg = `${hint ?? ""}${details}`;
1648
- const cause = error instanceof Error ? error : void 0;
1649
- throw new Error(errorMsg, { cause });
1624
+ var indexLoadState = "unloaded";
1625
+ var indexLoadPromise = null;
1626
+ var loadIndex = async () => {
1627
+ if (indexLoadState === "loaded") {
1628
+ return;
1650
1629
  }
1630
+ if (indexLoadState === "loading" && indexLoadPromise) {
1631
+ return indexLoadPromise;
1632
+ }
1633
+ indexLoadState = "loading";
1634
+ indexLoadPromise = (async () => {
1635
+ try {
1636
+ const registry = getMooseInternal();
1637
+ registry.tables.clear();
1638
+ registry.streams.clear();
1639
+ registry.ingestApis.clear();
1640
+ registry.apis.clear();
1641
+ registry.sqlResources.clear();
1642
+ registry.workflows.clear();
1643
+ registry.webApps.clear();
1644
+ const appDir = `${process2.cwd()}/${getSourceDir()}`;
1645
+ Object.keys(__require.cache).forEach((key) => {
1646
+ if (key.startsWith(appDir)) {
1647
+ delete __require.cache[key];
1648
+ }
1649
+ });
1650
+ __require(`${process2.cwd()}/${getSourceDir()}/index.ts`);
1651
+ indexLoadState = "loaded";
1652
+ } catch (error) {
1653
+ indexLoadState = "unloaded";
1654
+ indexLoadPromise = null;
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 });
1663
+ }
1664
+ })();
1665
+ return indexLoadPromise;
1651
1666
  };
1652
1667
  var getStreamingFunctions = async () => {
1653
- loadIndex();
1668
+ await loadIndex();
1654
1669
  const registry = getMooseInternal();
1655
1670
  const transformFunctions = /* @__PURE__ */ new Map();
1656
1671
  registry.streams.forEach((stream) => {
@@ -1677,7 +1692,7 @@ var getStreamingFunctions = async () => {
1677
1692
  return transformFunctions;
1678
1693
  };
1679
1694
  var getApis2 = async () => {
1680
- loadIndex();
1695
+ await loadIndex();
1681
1696
  const apiFunctions = /* @__PURE__ */ new Map();
1682
1697
  const registry = getMooseInternal();
1683
1698
  const versionCountByName = /* @__PURE__ */ new Map();
@@ -1709,7 +1724,7 @@ var getApis2 = async () => {
1709
1724
  return apiFunctions;
1710
1725
  };
1711
1726
  var getWorkflows2 = async () => {
1712
- loadIndex();
1727
+ await loadIndex();
1713
1728
  const registry = getMooseInternal();
1714
1729
  return registry.workflows;
1715
1730
  };
@@ -1743,7 +1758,7 @@ var getTaskForWorkflow = async (workflowName, taskName) => {
1743
1758
  return task;
1744
1759
  };
1745
1760
  var getWebApps2 = async () => {
1746
- loadIndex();
1761
+ await loadIndex();
1747
1762
  return getMooseInternal().webApps;
1748
1763
  };
1749
1764