@getstrata/core 0.5.16 → 0.5.18

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.
@@ -644,9 +644,22 @@ function getBoundDatabaseConnection() {
644
644
  return boundConnectionHolder.connection;
645
645
  }
646
646
 
647
- // ../../src/core/database/connectionContext.ts
647
+ // ../../src/core/runtime/asyncContextStore.ts
648
648
  import { AsyncLocalStorage } from "async_hooks";
649
- var activeConnection = new AsyncLocalStorage;
649
+ function createAsyncContextStore(key) {
650
+ const symbol = Symbol.for(key);
651
+ const globalRecord = globalThis;
652
+ const existing = globalRecord[symbol];
653
+ if (existing) {
654
+ return existing;
655
+ }
656
+ const store = new AsyncLocalStorage;
657
+ globalRecord[symbol] = store;
658
+ return store;
659
+ }
660
+
661
+ // ../../src/core/database/connectionContext.ts
662
+ var activeConnection = createAsyncContextStore("@getstrata/databaseConnectionContext");
650
663
  function getActiveDatabaseConnection(fallback) {
651
664
  return activeConnection.getStore() ?? fallback;
652
665
  }