@giteeteam/apps-runtime-vm
Advanced tools
Comparing version 0.5.4 to 0.5.5
@@ -1,4 +0,11 @@ | ||
import { AxiosRequestConfig } from 'axios'; | ||
import type { Reference } from 'isolated-vm'; | ||
declare const _default: (opts?: Reference<AxiosRequestConfig>) => Promise<{ | ||
import type { AxiosConfig } from '@giteeteam/apps-team-api'; | ||
declare const _default: (opts: Reference<AxiosConfig>) => Promise<{ | ||
data?: undefined; | ||
_axiosError?: undefined; | ||
code?: undefined; | ||
name?: undefined; | ||
message?: undefined; | ||
response?: undefined; | ||
} | { | ||
data: any; | ||
@@ -5,0 +12,0 @@ _axiosError?: undefined; |
@@ -7,5 +7,19 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const http_1 = __importDefault(require("http")); | ||
const https_1 = __importDefault(require("https")); | ||
exports.default = async (opts) => { | ||
var _a; | ||
const config = opts ? { ...(await opts.copy()) } : {}; | ||
if (!opts) { | ||
return {}; | ||
} | ||
const config = await opts.copy(); | ||
const otherConfig = {}; | ||
// vm中不能直接使用http.Agent,只能传http.AgentOptions | ||
if (config.httpAgentOptions) { | ||
otherConfig.httpAgent = new http_1.default.Agent(config.httpAgentOptions); | ||
} | ||
// vm中不能直接使用https.Agent,只能传https.AgentOptions | ||
if (config.httpsAgentOptions) { | ||
otherConfig.httpsAgent = new https_1.default.Agent(config.httpsAgentOptions); | ||
} | ||
try { | ||
@@ -15,2 +29,3 @@ const { data } = await (0, axios_1.default)({ | ||
...config, | ||
...otherConfig, | ||
}); | ||
@@ -17,0 +32,0 @@ return { data }; |
{ | ||
"name": "@giteeteam/apps-runtime-vm", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "Giteeteam Apps Runtime VM", | ||
@@ -35,5 +35,6 @@ "keywords": [ | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.8.3" | ||
}, | ||
"devDependencies": { | ||
"@giteeteam/apps-team-api": "^0.4.5", | ||
"typescript": "^4.8.3" | ||
}, | ||
"dependencies": { | ||
@@ -40,0 +41,0 @@ "axios": "^0.27.2", |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
26755
696
2
2