context.cjs 1.2 KB

123456789101112131415161718
  1. "use strict";
  2. /* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.registerConfigureHook = exports.setContextVariable = exports.getContextVariable = void 0;
  5. /**
  6. * This file exists as a convenient public entrypoint for functionality
  7. * related to context variables.
  8. *
  9. * Because it automatically initializes AsyncLocalStorage, internal
  10. * functionality SHOULD NEVER import from this file outside of tests.
  11. */
  12. const node_async_hooks_1 = require("node:async_hooks");
  13. const index_js_1 = require("./singletons/index.cjs");
  14. const context_js_1 = require("./singletons/async_local_storage/context.cjs");
  15. Object.defineProperty(exports, "getContextVariable", { enumerable: true, get: function () { return context_js_1.getContextVariable; } });
  16. Object.defineProperty(exports, "setContextVariable", { enumerable: true, get: function () { return context_js_1.setContextVariable; } });
  17. Object.defineProperty(exports, "registerConfigureHook", { enumerable: true, get: function () { return context_js_1.registerConfigureHook; } });
  18. index_js_1.AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new node_async_hooks_1.AsyncLocalStorage());