@514labs/moose-lib 0.6.290-ci-9-ge4e27fd3 → 0.6.290-ci-11-gedbe6a3f

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
@@ -3495,25 +3495,35 @@ async function getMooseUtils(req) {
3495
3495
  if (standaloneUtils) {
3496
3496
  return standaloneUtils;
3497
3497
  }
3498
- await Promise.resolve().then(() => (init_runtime(), runtime_exports));
3499
- const configRegistry = globalThis._mooseConfigRegistry;
3500
- if (!configRegistry) {
3501
- throw new Error(
3502
- "Moose not initialized. Ensure you're running within a Moose app or have proper configuration set up."
3498
+ if (initPromise2) {
3499
+ return initPromise2;
3500
+ }
3501
+ initPromise2 = (async () => {
3502
+ await Promise.resolve().then(() => (init_runtime(), runtime_exports));
3503
+ const configRegistry = globalThis._mooseConfigRegistry;
3504
+ if (!configRegistry) {
3505
+ throw new Error(
3506
+ "Moose not initialized. Ensure you're running within a Moose app or have proper configuration set up."
3507
+ );
3508
+ }
3509
+ const clickhouseConfig = await configRegistry.getStandaloneClickhouseConfig();
3510
+ const clickhouseClient = getClickhouseClient(
3511
+ toClientConfig(clickhouseConfig)
3503
3512
  );
3513
+ const queryClient = new QueryClient(clickhouseClient, "standalone");
3514
+ const mooseClient = new MooseClient(queryClient);
3515
+ standaloneUtils = {
3516
+ client: mooseClient,
3517
+ sql,
3518
+ jwt: void 0
3519
+ };
3520
+ return standaloneUtils;
3521
+ })();
3522
+ try {
3523
+ return await initPromise2;
3524
+ } finally {
3525
+ initPromise2 = null;
3504
3526
  }
3505
- const clickhouseConfig = await configRegistry.getStandaloneClickhouseConfig();
3506
- const clickhouseClient = getClickhouseClient(
3507
- toClientConfig(clickhouseConfig)
3508
- );
3509
- const queryClient = new QueryClient(clickhouseClient, "standalone");
3510
- const mooseClient = new MooseClient(queryClient);
3511
- standaloneUtils = {
3512
- client: mooseClient,
3513
- sql,
3514
- jwt: void 0
3515
- };
3516
- return standaloneUtils;
3517
3527
  }
3518
3528
  async function getMooseClients(config) {
3519
3529
  console.warn(
@@ -3538,7 +3548,7 @@ async function getMooseClients(config) {
3538
3548
  const utils = await getMooseUtils();
3539
3549
  return { client: utils.client };
3540
3550
  }
3541
- var standaloneUtils, toClientConfig;
3551
+ var standaloneUtils, initPromise2, toClientConfig;
3542
3552
  var init_standalone = __esm({
3543
3553
  "src/consumption-apis/standalone.ts"() {
3544
3554
  "use strict";
@@ -3546,6 +3556,7 @@ var init_standalone = __esm({
3546
3556
  init_commons();
3547
3557
  init_sqlHelpers();
3548
3558
  standaloneUtils = null;
3559
+ initPromise2 = null;
3549
3560
  toClientConfig = (config) => ({
3550
3561
  ...config,
3551
3562
  useSSL: config.useSSL ? "true" : "false"