File size: 904 Bytes
440cddf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"use strict";
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