@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.mjs CHANGED
@@ -3481,25 +3481,35 @@ async function getMooseUtils(req) {
3481
3481
  if (standaloneUtils) {
3482
3482
  return standaloneUtils;
3483
3483
  }
3484
- await Promise.resolve().then(() => (init_runtime(), runtime_exports));
3485
- const configRegistry = globalThis._mooseConfigRegistry;
3486
- if (!configRegistry) {
3487
- throw new Error(
3488
- "Moose not initialized. Ensure you're running within a Moose app or have proper configuration set up."
3484
+ if (initPromise2) {
3485
+ return initPromise2;
3486
+ }
3487
+ initPromise2 = (async () => {
3488
+ await Promise.resolve().then(() => (init_runtime(), runtime_exports));
3489
+ const configRegistry = globalThis._mooseConfigRegistry;
3490
+ if (!configRegistry) {
3491
+ throw new Error(
3492
+ "Moose not initialized. Ensure you're running within a Moose app or have proper configuration set up."
3493
+ );
3494
+ }
3495
+ const clickhouseConfig = await configRegistry.getStandaloneClickhouseConfig();
3496
+ const clickhouseClient = getClickhouseClient(
3497
+ toClientConfig(clickhouseConfig)
3489
3498
  );
3499
+ const queryClient = new QueryClient(clickhouseClient, "standalone");
3500
+ const mooseClient = new MooseClient(queryClient);
3501
+ standaloneUtils = {
3502
+ client: mooseClient,
3503
+ sql,
3504
+ jwt: void 0
3505
+ };
3506
+ return standaloneUtils;
3507
+ })();
3508
+ try {
3509
+ return await initPromise2;
3510
+ } finally {
3511
+ initPromise2 = null;
3490
3512
  }
3491
- const clickhouseConfig = await configRegistry.getStandaloneClickhouseConfig();
3492
- const clickhouseClient = getClickhouseClient(
3493
- toClientConfig(clickhouseConfig)
3494
- );
3495
- const queryClient = new QueryClient(clickhouseClient, "standalone");
3496
- const mooseClient = new MooseClient(queryClient);
3497
- standaloneUtils = {
3498
- client: mooseClient,
3499
- sql,
3500
- jwt: void 0
3501
- };
3502
- return standaloneUtils;
3503
3513
  }
3504
3514
  async function getMooseClients(config) {
3505
3515
  console.warn(
@@ -3524,7 +3534,7 @@ async function getMooseClients(config) {
3524
3534
  const utils = await getMooseUtils();
3525
3535
  return { client: utils.client };
3526
3536
  }
3527
- var standaloneUtils, toClientConfig;
3537
+ var standaloneUtils, initPromise2, toClientConfig;
3528
3538
  var init_standalone = __esm({
3529
3539
  "src/consumption-apis/standalone.ts"() {
3530
3540
  "use strict";
@@ -3532,6 +3542,7 @@ var init_standalone = __esm({
3532
3542
  init_commons();
3533
3543
  init_sqlHelpers();
3534
3544
  standaloneUtils = null;
3545
+ initPromise2 = null;
3535
3546
  toClientConfig = (config) => ({
3536
3547
  ...config,
3537
3548
  useSSL: config.useSSL ? "true" : "false"