@514labs/moose-lib 0.6.290-ci-8-g57f77993 → 0.6.290-ci-10-gaf565d22

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
@@ -3474,30 +3474,42 @@ async function getMooseUtils(req) {
3474
3474
  if (runtimeContext) {
3475
3475
  return {
3476
3476
  client: runtimeContext.client,
3477
- sql
3477
+ sql,
3478
+ jwt: runtimeContext.jwt
3478
3479
  };
3479
3480
  }
3480
3481
  if (standaloneUtils) {
3481
3482
  return standaloneUtils;
3482
3483
  }
3483
- await Promise.resolve().then(() => (init_runtime(), runtime_exports));
3484
- const configRegistry = globalThis._mooseConfigRegistry;
3485
- if (!configRegistry) {
3486
- throw new Error(
3487
- "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)
3488
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;
3489
3512
  }
3490
- const clickhouseConfig = await configRegistry.getStandaloneClickhouseConfig();
3491
- const clickhouseClient = getClickhouseClient(
3492
- toClientConfig(clickhouseConfig)
3493
- );
3494
- const queryClient = new QueryClient(clickhouseClient, "standalone");
3495
- const mooseClient = new MooseClient(queryClient);
3496
- standaloneUtils = {
3497
- client: mooseClient,
3498
- sql
3499
- };
3500
- return standaloneUtils;
3501
3513
  }
3502
3514
  async function getMooseClients(config) {
3503
3515
  console.warn(
@@ -3522,7 +3534,7 @@ async function getMooseClients(config) {
3522
3534
  const utils = await getMooseUtils();
3523
3535
  return { client: utils.client };
3524
3536
  }
3525
- var standaloneUtils, toClientConfig;
3537
+ var standaloneUtils, initPromise2, toClientConfig;
3526
3538
  var init_standalone = __esm({
3527
3539
  "src/consumption-apis/standalone.ts"() {
3528
3540
  "use strict";
@@ -3530,6 +3542,7 @@ var init_standalone = __esm({
3530
3542
  init_commons();
3531
3543
  init_sqlHelpers();
3532
3544
  standaloneUtils = null;
3545
+ initPromise2 = null;
3533
3546
  toClientConfig = (config) => ({
3534
3547
  ...config,
3535
3548
  useSSL: config.useSSL ? "true" : "false"