Spaces:
Paused
Paused
Download lib/src/context.js from Rachit-Tw/PRIX: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/spaces/Rachit-Tw/PRIX/resolve/refs%2Fpr%2F2/lib/src/context.js
- Command line
-
hf download hf://spaces/Rachit-Tw/PRIX@refs/pr/2/lib/src/context.js
-
curl -L -o context.js https://huggingface.co/spaces/Rachit-Tw/PRIX/resolve/refs%2Fpr%2F2/lib/src/context.js
904 Bytes
| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.getSafeRepo = exports.getSafeOctokit = exports.getCurrentContext = exports.als = void 0; | |
| const async_hooks_1 = require("async_hooks"); | |
| // Global context storage for current execution thread | |
| exports.als = new async_hooks_1.AsyncLocalStorage(); | |
| /** | |
| * Access the current execution context safely from anywhere in the codebase. | |
| */ | |
| const getCurrentContext = () => { | |
| return exports.als.getStore(); | |
| }; | |
| exports.getCurrentContext = getCurrentContext; | |
| /** | |
| * Helper to get octokit from current context | |
| */ | |
| const getSafeOctokit = () => { | |
| return exports.als.getStore()?.octokit; | |
| }; | |
| exports.getSafeOctokit = getSafeOctokit; | |
| /** | |
| * Helper to get repo info from current context | |
| */ | |
| const getSafeRepo = () => { | |
| return exports.als.getStore()?.repo; | |
| }; | |
| exports.getSafeRepo = getSafeRepo; | |
| //# sourceMappingURL=context.js.map |