mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-12-02 11:47:57 +08:00
fix: ts error
This commit is contained in:
commit
0337cb7d01
10
package.json
10
package.json
@ -8,7 +8,8 @@
|
||||
"author": "eoapi",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"src/workbench/browser"
|
||||
"src/workbench/browser",
|
||||
"src/workbench/node/request"
|
||||
],
|
||||
"scripts": {
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
@ -34,20 +35,15 @@
|
||||
"@electron/remote": "2.0.8",
|
||||
"content-disposition": "^0.5.4",
|
||||
"copyfiles": "2.4.1",
|
||||
"crypto-js": "^4.1.1",
|
||||
"electron-log": "^4.4.8",
|
||||
"electron-store": "8.0.2",
|
||||
"electron-updater": "^5.0.5",
|
||||
"express": "4.18.1",
|
||||
"fix-path": "3.0.0",
|
||||
"form-data": "^4.0.0",
|
||||
"http-proxy-middleware": "3.0.0-beta.0",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"npm": "6.14.17",
|
||||
"portfinder": "1.0.28",
|
||||
"resolve": "^1.22.1",
|
||||
"rxjs": "7.5.5",
|
||||
"xml2js": "^0.4.23"
|
||||
"rxjs": "7.5.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.0.0",
|
||||
|
@ -6,6 +6,7 @@ let _LIB_WORKER_THREAD = require('./exec_worker_thread');
|
||||
let CryptoJS = require('crypto-js');
|
||||
let privateFun = {},
|
||||
_LibsCommon = require('./common'),
|
||||
_LibsZlib = require('./zlib'),
|
||||
_LibsEncrypt = require('./encrypt').core,
|
||||
_Xml_Class = new (require('./xml').core)();
|
||||
const DOMAIN_CONSTANT = require('../domain.json');
|
||||
@ -18,7 +19,12 @@ const TIMINGSUMMARY = {
|
||||
MS_PER_NS: 1e6,
|
||||
};
|
||||
const { NodeVM } = require('./vm2/index');
|
||||
let querystring = require('querystring');
|
||||
const querystring = require('querystring');
|
||||
|
||||
const { JSDOM } = require('jsdom');
|
||||
const { document } = new JSDOM('<!doctype html><html><body></body></html>').window;
|
||||
const window = document.defaultView,
|
||||
$ = require('jquery')(window);
|
||||
/**
|
||||
* @desc 重置env
|
||||
* @param {object} inputSanboxVar 沙箱中的env变量
|
||||
@ -41,6 +47,15 @@ privateFun.resetEnv = (inputBaiscEnv, inputSanboxVar) => {
|
||||
});
|
||||
return tmpResult;
|
||||
};
|
||||
privateFun.replaceRestParam = (inputParamKey, inputParamInfo, inputUrl) => {
|
||||
let tmpUrl = inputUrl.split(`{{${inputParamKey}}}`).join('eoGlobal#');
|
||||
if (inputParamInfo && (tmpUrl.indexOf(`:${inputParamKey}`) > -1 || tmpUrl.indexOf(`{${inputParamKey}}`) > -1)) {
|
||||
tmpUrl = _LibsCommon.replaceAll(`:${inputParamKey}`, inputParamInfo, tmpUrl);
|
||||
tmpUrl = _LibsCommon.replaceAll(`{${inputParamKey}}`, inputParamInfo, tmpUrl);
|
||||
}
|
||||
return _LibsCommon.replaceAll('eoGlobal#', `{{${inputParamKey}}}`, tmpUrl);
|
||||
};
|
||||
|
||||
privateFun.getMicrosToMs = (inputStartTime, inputEndTime) => {
|
||||
if (inputStartTime === undefined || inputEndTime === undefined) return 0.0;
|
||||
let tmpSecondDiff = inputEndTime[0] - inputStartTime[0];
|
||||
@ -69,12 +84,184 @@ privateFun.getHttpTiming = (timingSummary) => {
|
||||
};
|
||||
privateFun.getBaiscEoFn = (inputSanboxVar, inputEnv = {}) => {
|
||||
let tmpResult = {
|
||||
md5: _LibsEncrypt.md5,
|
||||
sha1: _LibsEncrypt.sha1,
|
||||
sha224: _LibsEncrypt.sha224,
|
||||
sha256: _LibsEncrypt.sha256,
|
||||
sha384: _LibsEncrypt.sha384,
|
||||
sha512: _LibsEncrypt.sha512,
|
||||
HmacSHA1: _LibsEncrypt.HmacSHA1,
|
||||
HmacSHA224: _LibsEncrypt.HmacSHA224,
|
||||
HmacSHA256: _LibsEncrypt.HmacSHA256,
|
||||
HmacSHA384: _LibsEncrypt.HmacSHA384,
|
||||
HmacSHA512: _LibsEncrypt.HmacSHA512,
|
||||
rsaSHA1: _LibsEncrypt.RS1,
|
||||
rsaSHA256: _LibsEncrypt.RS256,
|
||||
rsaPublicEncrypt: _LibsEncrypt.rsaPublicEncrypt,
|
||||
rsaPrivateDecrypt: _LibsEncrypt.rsaPrivateDecrypt,
|
||||
rsaPrivateEncrypt: _LibsEncrypt.rsaPrivateEncrypt,
|
||||
rsaPublicDecrypt: _LibsEncrypt.rsaPublicDecrypt,
|
||||
aesEncrypt: _LibsEncrypt.aesEncrypt,
|
||||
aesDecrypt: _LibsEncrypt.aesDecrypt,
|
||||
desEncrypt: _LibsEncrypt.desEncrypt,
|
||||
desDecrypt: _LibsEncrypt.desDecrypt,
|
||||
userFunction: {},
|
||||
typeof: _LibsCommon.getTypeOfVar,
|
||||
globalFunction: {},
|
||||
spaceFunction: {},
|
||||
jsonpath: _LibsCommon.jsonpath,
|
||||
xpath: _LibsCommon.xpath,
|
||||
xmlParse: _LibsCommon.xmlParse,
|
||||
jsonParse: _LibsCommon.jsonParse,
|
||||
infiniteLoopDetector: _LibsCommon.infiniteLoopDetector,
|
||||
/**
|
||||
* 输出错误信息并停止继续执行任何代码
|
||||
* @param {string} info 输出信息体
|
||||
*/
|
||||
throw_err: (tmpInputMsg) => {
|
||||
throw `codeError_${tmpInputMsg}`;
|
||||
},
|
||||
globals: {
|
||||
get: (inputKey) => {
|
||||
return global.eoTestGlobals[inputKey];
|
||||
},
|
||||
set: (inputKey, inputVal) => {
|
||||
let tmpType = _LibsCommon.getTypeOfVar(inputVal);
|
||||
switch (tmpType) {
|
||||
case 'String':
|
||||
case 'Boolean':
|
||||
case 'Number':
|
||||
case 'Int':
|
||||
case 'Float': {
|
||||
global.eoTestGlobals[inputKey] = inputVal;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw `codeError_自定义全局变量 ${inputKey} 仅支持储存 string、number、bool 类型数据,您试图为其赋值为 ${tmpType.toLowerCase()} 类型`;
|
||||
}
|
||||
}
|
||||
if (inputSanboxVar.eo.env.envParam.hasOwnProperty(inputKey)) {
|
||||
inputSanboxVar.eo.info(
|
||||
`温馨提示:当前已存在同名环境变量 ${inputKey},eo.globals.set 可能无法达到预期效果`,
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
},
|
||||
unset: (inputKey) => {
|
||||
delete global.eoTestGlobals[inputKey];
|
||||
},
|
||||
clear: () => {
|
||||
global.eoTestGlobals = {};
|
||||
},
|
||||
all: () => {
|
||||
return global.eoTestGlobals || '';
|
||||
},
|
||||
},
|
||||
env: {
|
||||
envParam: inputEnv.envParam,
|
||||
param: {
|
||||
get: (inputKey) => {
|
||||
return inputSanboxVar.eo.env.envParam[inputKey];
|
||||
},
|
||||
set: (inputKey, inputVal) => {
|
||||
inputSanboxVar.eo.env.envParam[inputKey] = inputVal;
|
||||
},
|
||||
unset: (inputKey) => {
|
||||
delete inputSanboxVar.eo.env.envParam[inputKey];
|
||||
},
|
||||
clear: () => {
|
||||
inputSanboxVar.eo.env.envParam = {};
|
||||
},
|
||||
},
|
||||
},
|
||||
crypt: {
|
||||
md5: _LibsEncrypt.md5,
|
||||
sha1: _LibsEncrypt.sha1,
|
||||
sha256: _LibsEncrypt.sha256,
|
||||
rsaSHA1: _LibsEncrypt.RS1,
|
||||
rsaSHA256: _LibsEncrypt.RS256,
|
||||
rsaPublicEncrypt: (tmpInputMsg, tmpInputKey, tmpInputEncoding) => {
|
||||
return _LibsEncrypt.rsaPublicEncrypt(tmpInputKey, tmpInputMsg, tmpInputEncoding);
|
||||
},
|
||||
rsaPrivateDecrypt: (tmpInputMsg, tmpInputKey, tmpInputEncoding) => {
|
||||
return _LibsEncrypt.rsaPrivateDecrypt(tmpInputKey, tmpInputMsg, tmpInputEncoding);
|
||||
},
|
||||
rsaPrivateEncrypt: (tmpInputMsg, tmpInputKey, tmpInputEncoding) => {
|
||||
return _LibsEncrypt.rsaPrivateEncrypt(tmpInputKey, tmpInputMsg, tmpInputEncoding);
|
||||
},
|
||||
rsaPublicDecrypt: (tmpInputMsg, tmpInputKey, tmpInputEncoding) => {
|
||||
return _LibsEncrypt.rsaPublicDecrypt(tmpInputKey, tmpInputMsg, tmpInputEncoding);
|
||||
},
|
||||
aesEncrypt: _LibsEncrypt.aesEncrypt,
|
||||
aesDecrypt: _LibsEncrypt.aesDecrypt,
|
||||
desEncrypt: _LibsEncrypt.desEncrypt,
|
||||
desDecrypt: _LibsEncrypt.desDecrypt,
|
||||
},
|
||||
json: {
|
||||
encode(inputObj) {
|
||||
return JSON.stringify(inputObj);
|
||||
},
|
||||
decode(inputStr) {
|
||||
try {
|
||||
return JSON.parse(inputStr);
|
||||
} catch (JSON_PARSE_ERR) {
|
||||
throw `codeError_${JSON_PARSE_ERR.stack}`;
|
||||
}
|
||||
},
|
||||
},
|
||||
xml: {
|
||||
encode(inputObj) {
|
||||
return new xml2json.Builder().buildObject(inputObj);
|
||||
},
|
||||
decode: _LibsCommon.xmlParse,
|
||||
},
|
||||
base64: {
|
||||
encode(inputData) {
|
||||
return Buffer.from(inputData).toString('base64');
|
||||
},
|
||||
decode(inputData) {
|
||||
return Buffer.from(inputData, 'base64').toString();
|
||||
},
|
||||
},
|
||||
urlEncode(inputData) {
|
||||
return encodeURIComponent(inputData);
|
||||
},
|
||||
urlDecode(inputData) {
|
||||
return decodeURIComponent(inputData);
|
||||
},
|
||||
filePath: (inputFilePath, inputFileName) => {
|
||||
let tmpLastIndex = inputFilePath.lastIndexOf('/'),
|
||||
tmpFileUUID;
|
||||
if (tmpLastIndex === -1) {
|
||||
tmpFileUUID = inputFilePath;
|
||||
} else {
|
||||
tmpFileUUID = inputFilePath.substr(tmpLastIndex + 1, inputFilePath.length);
|
||||
}
|
||||
try {
|
||||
inputFilePath = global._FILEOBJ[tmpFileUUID].filePath;
|
||||
inputFileName = global._FILEOBJ[tmpFileUUID].fileName || tmpFileUUID;
|
||||
} catch (PARSE_ERR) {}
|
||||
return privateFun.filePath(inputFilePath, inputFileName);
|
||||
},
|
||||
gzip: {
|
||||
zip: _LibsZlib.fnGzip,
|
||||
unzip: _LibsZlib.fnGunzip,
|
||||
},
|
||||
deflate: {
|
||||
zip: _LibsZlib.fnDeflate,
|
||||
unzip: _LibsZlib.fnInflate,
|
||||
},
|
||||
};
|
||||
['http', 'websocket', 'socket', 'rpc'].map((val) => {
|
||||
['http'].map((val) => {
|
||||
tmpResult.env[val] = _LibsCommon.deepCopy(inputEnv[val]) || {};
|
||||
tmpResult.env[val].baseUrl = {
|
||||
get: () => {
|
||||
return inputSanboxVar.eo.env[val].baseUrlParam;
|
||||
},
|
||||
set: (inputVal) => {
|
||||
inputSanboxVar.eo.env[val].baseUrlParam = inputVal;
|
||||
},
|
||||
};
|
||||
});
|
||||
return tmpResult;
|
||||
};
|
||||
@ -91,10 +278,43 @@ privateFun.setExecWorkerThread = (inputPostMsg, inputMsgCallback) => {
|
||||
privateFun.constructUiCodeBasicFn = (inputSanboxVar, inputEnv, inputOpts = {}) => {
|
||||
inputOpts = inputOpts || {};
|
||||
let tmpResult = Object.assign({}, inputSanboxVar.eo, privateFun.getBaiscEoFn(inputSanboxVar, inputEnv));
|
||||
tmpResult.env['http'] = _LibsCommon.deepCopy(inputEnv['http']) || {};
|
||||
tmpResult.execute = (tmpInputTestData) => {
|
||||
return privateFun.setExecWorkerThread({
|
||||
opr: 'exec_http',
|
||||
data: tmpInputTestData,
|
||||
env: Object.assign({}, inputSanboxVar.eo.env, {
|
||||
envAuth: inputEnv.envAuth,
|
||||
http: Object.assign({}, inputSanboxVar.eo.env.http, {
|
||||
requestScript: '',
|
||||
responseScript: '',
|
||||
}),
|
||||
}),
|
||||
opts: {
|
||||
globalHeader: inputOpts.globalHeader,
|
||||
},
|
||||
});
|
||||
};
|
||||
return tmpResult;
|
||||
};
|
||||
privateFun.parseRealSendUrl = (inputBasicData, inputEnv) => {
|
||||
let tmpQueryParam = JSON.stringify(Object.assign({}, inputEnv.queryParam, inputBasicData.queryParam));
|
||||
let tmpEnvGlobals = Object.assign({}, global.eoTestGlobals || {}, inputEnv.envParam || {}),
|
||||
tmpResult = inputBasicData.apiUrl;
|
||||
for (let key in tmpEnvGlobals) {
|
||||
let val = tmpEnvGlobals[key];
|
||||
tmpQueryParam = _LibsCommon.replaceAll('{{' + key + '}}', val, tmpQueryParam);
|
||||
tmpResult = _LibsCommon.replaceAll('{{' + key + '}}', val, tmpResult);
|
||||
}
|
||||
tmpQueryParam = querystring.stringify(JSON.parse(tmpQueryParam));
|
||||
tmpResult += tmpQueryParam ? '?' + tmpQueryParam : '';
|
||||
if (!new RegExp(_LibsCommon.DOMAIN_REGEX).test(tmpResult)) {
|
||||
tmpResult = (inputEnv.baseUrlParam || '') + tmpResult;
|
||||
}
|
||||
for (let key in inputBasicData.restParam) {
|
||||
tmpResult = privateFun.replaceRestParam(key, inputBasicData.restParam[key], tmpResult);
|
||||
}
|
||||
return tmpResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc 构造各种类型的sanbox结构
|
||||
* @param {object} inputSanboxVar 沙箱中的变量
|
||||
@ -102,7 +322,7 @@ privateFun.constructUiCodeBasicFn = (inputSanboxVar, inputEnv, inputOpts = {}) =
|
||||
* @param {boolean} inputIsResponse 是否为返回信息
|
||||
*/
|
||||
privateFun.setTypesRefFns = (inputSanboxVar, inputInitialData, inputIsResponse) => {
|
||||
let tmpTypes = ['http', 'socket', 'rpc', 'websocket'],
|
||||
let tmpTypes = ['http'],
|
||||
tmpBasicConf = {
|
||||
apiUrl: (inputInitialData.url || '').split('?')[0],
|
||||
bodyParam: inputInitialData.raw || '',
|
||||
@ -206,28 +426,6 @@ privateFun.setTypesRefFns = (inputSanboxVar, inputInitialData, inputIsResponse)
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @desc 构造各种类型的sanbox结构
|
||||
* @param {object} inputSanboxVar 沙箱中的变量
|
||||
* @param {object} inputInitialData 初始化的变量集合
|
||||
* @param {boolean} inputIsResponse 是否为返回信息
|
||||
*/
|
||||
privateFun.setTypesRefFns = (inputSanboxVar, inputInitialData, inputIsResponse) => {
|
||||
let tmpTypes = ['http'],
|
||||
tmpBasicConf = {
|
||||
apiUrl: (inputInitialData.url || '').split('?')[0],
|
||||
bodyParam: inputInitialData.raw || '',
|
||||
bodyParseParam: inputInitialData.params || {},
|
||||
queryParam: inputInitialData.query || {},
|
||||
headerParam: inputInitialData.headers || {},
|
||||
restParam: inputInitialData.rest || {},
|
||||
responseParam: inputInitialData.response || '',
|
||||
responseHeaderParam: inputInitialData.responseHeaders || {},
|
||||
};
|
||||
tmpTypes.map((val) => {
|
||||
inputSanboxVar[val] = _LibsCommon.deepCopy(tmpBasicConf);
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 前置脚本代码
|
||||
* @param {string} inputData 请求可分别赋值信息
|
||||
@ -241,6 +439,7 @@ privateFun.parseBeforeCode = function (inputData, inputScript, inputOpts = {}) {
|
||||
inputData = JSON.parse(JSON.stringify(inputData));
|
||||
//!Can't delete,for eval warning tips
|
||||
let tmpTitle = inputData.title || (inputData.isReturnSoonWhenExecCode ? '环境-API 前置脚本' : '前置脚本');
|
||||
let tmpErrorContent, tmpStatus;
|
||||
let tmpReportList = [],
|
||||
tmpBinary = inputData.binary,
|
||||
tmpSanboxObj = {
|
||||
@ -323,12 +522,14 @@ privateFun.parseBeforeCode = function (inputData, inputScript, inputOpts = {}) {
|
||||
tmpCodeEvalObj.eo = privateFun.constructUiCodeBasicFn(tmpCodeEvalObj, tmpBasicEnv, inputOpts);
|
||||
privateFun.setTypesRefFns(tmpCodeEvalObj.eo, inputData);
|
||||
let tmpTargetTypeData = tmpCodeEvalObj.eo[tmpApiType],
|
||||
tmpTargetTypeEnv = tmpCodeEvalObj.eo.env[tmpApiType];
|
||||
tmpTargetTypeEnv = tmpCodeEvalObj.eo.env[tmpApiType],
|
||||
tmpNeedToExecRequestScript = tmpTargetTypeEnv.requestScript && !inputData.ingnoreRequestScript;
|
||||
if (inputScript || tmpNeedToExecRequestScript) {
|
||||
try {
|
||||
if (inputOpts) {
|
||||
_LibsCommon.execFnDefine(inputOpts.functionCode || [], tmpVm, tmpCodeEvalObj.eo);
|
||||
}
|
||||
// // execute common function
|
||||
// if (inputOpts) {
|
||||
// _LibsCommon.execFnDefine(inputOpts.functionCode || [], tmpVm, tmpCodeEvalObj.eo);
|
||||
// }
|
||||
if (!inputData.isReturnSoonWhenExecCode && tmpNeedToExecRequestScript) {
|
||||
tmpNowIsExecuteEnvScript = true;
|
||||
tmpVm.run(
|
||||
@ -337,6 +538,7 @@ privateFun.parseBeforeCode = function (inputData, inputScript, inputOpts = {}) {
|
||||
}
|
||||
tmpVm.run(_LibsCommon.infiniteLoopDetector.wrap(inputScript || '', 'eo.infiniteLoopDetector'));
|
||||
} catch (Err) {
|
||||
console.log(Err);
|
||||
switch (Err) {
|
||||
case 'info':
|
||||
case 'interrupt':
|
||||
@ -381,7 +583,7 @@ privateFun.parseBeforeCode = function (inputData, inputScript, inputOpts = {}) {
|
||||
return {
|
||||
status: tmpStatus,
|
||||
content: tmpErrorContent,
|
||||
url: tmpTargetTypeData.url.parse(),
|
||||
url: tmpTargetTypeData.apiUrl,
|
||||
headers: tmpTargetTypeData.headerParam,
|
||||
params: tmpTargetTypeData.bodyParseParam || tmpTargetTypeData.bodyParam,
|
||||
env: privateFun.resetEnv(tmpBasicEnv, tmpCodeEvalObj.eo.env),
|
||||
|
@ -7,6 +7,118 @@ let _LibsDataConstructor = new (require('./data_constructor').core)();
|
||||
let xml2json = require('xml2js');
|
||||
let privateFun = {};
|
||||
const LOCAL_REGEXP_CONST = 'eoundefined$';
|
||||
/**
|
||||
* @desc 处理用户脚本允许错误时返回的内容
|
||||
* @param {object} input_err 错误对象
|
||||
*/
|
||||
privateFun.execCodeErrWarning = (input_err) => {
|
||||
let tmp_error_row, tmp_error_col, tmp_fn_name;
|
||||
if (/<anonymous>:(.*):(.*)\)/.test(input_err.stack)) {
|
||||
tmp_error_row = RegExp.$1;
|
||||
tmp_error_col = RegExp.$2;
|
||||
}
|
||||
if (!/ is not a function/.test(input_err.stack)) {
|
||||
if (/eo\.userFunction\.(.+) \(vm\.js:(.*):(.*)\)/.test(input_err.stack)) {
|
||||
let tmp_stack_text = input_err.stack.substr(input_err.stack.indexOf('eo.userFunction.'), input_err.stack.length);
|
||||
tmp_fn_name = tmp_stack_text.substr(0, tmp_stack_text.indexOf(' '));
|
||||
tmp_error_row = RegExp.$2;
|
||||
tmp_error_col = RegExp.$3;
|
||||
tmp_error_row--;
|
||||
} else if (/eo\.globalFunction\.(.+) \(vm\.js:(.*):(.*)\)/.test(input_err.stack)) {
|
||||
let tmp_stack_text = input_err.stack.substr(
|
||||
input_err.stack.indexOf('eo.globalFunction.'),
|
||||
input_err.stack.length
|
||||
);
|
||||
tmp_fn_name = tmp_stack_text.substr(0, tmp_stack_text.indexOf(' '));
|
||||
tmp_error_row = RegExp.$2;
|
||||
tmp_error_col = RegExp.$3;
|
||||
if (tmp_error_row === '1') {
|
||||
tmp_error_col = tmp_error_col - 101;
|
||||
}
|
||||
tmp_error_row--;
|
||||
} else if (/eo\.spaceFunction\.(.+) \(vm\.js:(.*):(.*)\)/.test(input_err.stack)) {
|
||||
let tmp_stack_text = input_err.stack.substr(input_err.stack.indexOf('eo.spaceFunction.'), input_err.stack.length);
|
||||
tmp_fn_name = tmp_stack_text.substr(0, tmp_stack_text.indexOf(' '));
|
||||
tmp_error_row = RegExp.$2;
|
||||
tmp_error_col = RegExp.$3;
|
||||
if (tmp_error_row === '1') {
|
||||
tmp_error_col = tmp_error_col - 101;
|
||||
}
|
||||
tmp_error_row--;
|
||||
} else {
|
||||
if (input_err.stack.indexOf('^') > -1) {
|
||||
if (/vm\.js:(.*)\n/.test(input_err.stack)) {
|
||||
tmp_error_row = RegExp.$1;
|
||||
tmp_error_col = RegExp.$2;
|
||||
}
|
||||
let tmp_last_index = input_err.stack.indexOf('^');
|
||||
let tmp_first_index = input_err.stack.substr(0, tmp_last_index).lastIndexOf('\n');
|
||||
tmp_error_col = tmp_last_index - tmp_first_index;
|
||||
} else {
|
||||
if (/vm\.js:(.*):(.*)\)/.test(input_err.stack)) {
|
||||
tmp_error_row = RegExp.$1;
|
||||
tmp_error_col = RegExp.$2;
|
||||
}
|
||||
}
|
||||
if (tmp_error_row === '1') {
|
||||
tmp_error_col = tmp_error_col - 62;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
row: tmp_error_row,
|
||||
col: tmp_error_col,
|
||||
fn: tmp_fn_name,
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 截断死循环
|
||||
* @return {class} 截断类
|
||||
*/
|
||||
privateFun.infiniteLoopDetector = function () {
|
||||
let map = {};
|
||||
// define an InfiniteLoopError class
|
||||
function InfiniteLoopError(msg, type) {
|
||||
Error.call(this, msg);
|
||||
this.type = "InfiniteLoopError";
|
||||
}
|
||||
|
||||
function infiniteLoopDetector(id) {
|
||||
if (id in map) {
|
||||
// 非首次执行,此处可以优化,性能太低
|
||||
if (Date.now() - map[id] > CONFIG.MAX_TIME_LOOP) {
|
||||
delete map[id];
|
||||
throw new Error("Loop runing too long!", "InfiniteLoopError");
|
||||
}
|
||||
} else {
|
||||
// 首次运行,记录循环开始的时间。之所有把非首次运行的判断写在前面的if里是因为上面会执行更多次
|
||||
map[id] = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
infiniteLoopDetector.wrap = function (codeStr, key) {
|
||||
if (typeof codeStr !== "string") {
|
||||
throw new Error(
|
||||
"Can only wrap code represented by string, not any other thing at the time! If you want to wrap a function, convert it to string first."
|
||||
);
|
||||
}
|
||||
if (codeStr.indexOf("eo.execBsh") > -1) return codeStr;
|
||||
// this is not a strong regex, but enough to use at the time
|
||||
return codeStr.replace(
|
||||
/for *\(.*\{|while *\(.*\{|do *\{/g,
|
||||
function (loopHead) {
|
||||
let id = parseInt(Math.random() * Number.MAX_SAFE_INTEGER);
|
||||
return (
|
||||
(key || `infiniteLoopDetector`) +
|
||||
`(${id});${loopHead}` +
|
||||
(key || `infiniteLoopDetector`) +
|
||||
`(${id});`
|
||||
);
|
||||
}
|
||||
);
|
||||
};
|
||||
return infiniteLoopDetector;
|
||||
};
|
||||
privateFun.deepCopy = (inputObject) => {
|
||||
try {
|
||||
return JSON.parse(JSON.stringify(inputObject));
|
||||
@ -70,23 +182,22 @@ privateFun.parseRequestDataToObj = (inputData) => {
|
||||
};
|
||||
privateFun.bodyQueryToJson = function (inputArray, inputOptions) {
|
||||
inputOptions = inputOptions || {
|
||||
apiRequestParamJsonType: 0
|
||||
}
|
||||
let tmpXmlAttrObj={};
|
||||
let tmpJsonObj=_LibsDataConstructor.eo_define_arr_to_json(inputArray, {},inputOptions,tmpXmlAttrObj);
|
||||
if(inputOptions.isXml){
|
||||
return {
|
||||
value:JSON.stringify(tmpJsonObj),
|
||||
attr:tmpXmlAttrObj
|
||||
}
|
||||
apiRequestParamJsonType: 0,
|
||||
};
|
||||
let tmpXmlAttrObj = {};
|
||||
let tmpJsonObj = _LibsDataConstructor.eo_define_arr_to_json(inputArray, {}, inputOptions, tmpXmlAttrObj);
|
||||
if (inputOptions.isXml) {
|
||||
return {
|
||||
value: JSON.stringify(tmpJsonObj),
|
||||
attr: tmpXmlAttrObj,
|
||||
};
|
||||
}
|
||||
if ((inputOptions.apiRequestParamJsonType || 0).toString() == '1') {
|
||||
return JSON.stringify([tmpJsonObj]).replace(/("eo_big_int_)(((?!").)*)(")/g,"$2");
|
||||
return JSON.stringify([tmpJsonObj]).replace(/("eo_big_int_)(((?!").)*)(")/g, '$2');
|
||||
} else {
|
||||
return JSON.stringify(tmpJsonObj).replace(/("eo_big_int_)(((?!").)*)(")/g,"$2");
|
||||
return JSON.stringify(tmpJsonObj).replace(/("eo_big_int_)(((?!").)*)(")/g, '$2');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 解析环境变量
|
||||
* @param {array} env 环境变量
|
||||
@ -181,7 +292,9 @@ exports.parseEnv = privateFun.parseEnv;
|
||||
exports.deepCopy = privateFun.deepCopy;
|
||||
exports.parseRequestDataToObj = privateFun.parseRequestDataToObj;
|
||||
exports.bodyQueryToJson = privateFun.bodyQueryToJson;
|
||||
exports.LOCAL_REGEXP_CONST=LOCAL_REGEXP_CONST;
|
||||
exports.LOCAL_REGEXP_CONST = LOCAL_REGEXP_CONST;
|
||||
exports.replaceAll = function () {
|
||||
return _LibsDataConstructor.text_replace_all(...arguments);
|
||||
};
|
||||
exports.execCodeErrWarning = privateFun.execCodeErrWarning;
|
||||
exports.infiniteLoopDetector = privateFun.infiniteLoopDetector();
|
||||
|
144
src/workbench/node/request/libs/zlib.js
Normal file
144
src/workbench/node/request/libs/zlib.js
Normal file
@ -0,0 +1,144 @@
|
||||
const zlib = require("zlib");
|
||||
const Fiber = require("fibers");
|
||||
|
||||
/**
|
||||
* zlib options 压缩
|
||||
*/
|
||||
const DEFAULT_ZLIB_OPT = {
|
||||
flush: zlib.constants.Z_NO_FLUSH,
|
||||
finishFlush: zlib.constants.Z_FINISH,
|
||||
chunkSize: 16 * 1024,
|
||||
windowBits: 15, // 值在8..15的范围内,这个参数的值越大,内存使用率越高,压缩效果越好。如果使用deflateInit,则默认值为15
|
||||
level: 6, // ( 压缩级别,值在0-9之间,1速度最快,9压缩比最大,各自折中取值6较为合适。仅压缩有效)
|
||||
memLevel: 8, // (指定多少内存应该内部压缩状态进行分配,1是最小内存速度慢压缩比低。9是最大内存,速度最快。默认值为8。仅压缩有效)
|
||||
strategy: zlib.constants.Z_DEFAULT_STRATEGY, // (用于调整压缩算法,仅压缩有效)
|
||||
info: true, //(如果true,返回一个buffer对象和engine)
|
||||
};
|
||||
|
||||
/**
|
||||
* zlib options 解压
|
||||
*/
|
||||
const DEFAULT_ZLIB_UN_OPT = {
|
||||
flush: zlib.constants.Z_NO_FLUSH,
|
||||
finishFlush: zlib.constants.Z_FINISH,
|
||||
chunkSize: 16 * 1024,
|
||||
windowBits: 15,
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc 将参数转为buffer数据
|
||||
* @param {*} inStr
|
||||
* @returns
|
||||
*/
|
||||
const fnToBuffer = (inStr = {}) => {
|
||||
let tmpStr;
|
||||
if (typeof inStr === "object") {
|
||||
try {
|
||||
tmpStr = JSON.stringify(inStr);
|
||||
} catch (e) {
|
||||
console.info("zlib.js fnToBuffer stringify error", inStr);
|
||||
tmpStr = inStr.toString();
|
||||
}
|
||||
} else {
|
||||
tmpStr = String(inStr);
|
||||
}
|
||||
|
||||
return Buffer.from(tmpStr);
|
||||
};
|
||||
|
||||
const fnIsBuffer = (inStr = "") => {
|
||||
return inStr && typeof inStr === "object" && Buffer.isBuffer(inStr);
|
||||
};
|
||||
|
||||
const fnGzip = (inData) => {
|
||||
let tmpInData = fnToBuffer(inData);
|
||||
let tmpResult = null;
|
||||
try {
|
||||
const tmpCurrentFiber = Fiber.current;
|
||||
zlib.gzip(tmpInData, DEFAULT_ZLIB_OPT, (err, tmpBuffer) => {
|
||||
if (err) {
|
||||
console.error("zlib.js fnGzip zlib.gzip error");
|
||||
console.error(err);
|
||||
} else {
|
||||
tmpResult = tmpBuffer.buffer;
|
||||
}
|
||||
tmpCurrentFiber.run();
|
||||
});
|
||||
Fiber.yield();
|
||||
} catch (e) {
|
||||
console.error("zlib.gzip Error: ", e);
|
||||
}
|
||||
return tmpResult;
|
||||
};
|
||||
|
||||
const fnGunzip = (inBufferData) => {
|
||||
let tmpInData = fnIsBuffer(inBufferData)
|
||||
? inBufferData
|
||||
: fnToBuffer(inBufferData);
|
||||
let tmpResult = null;
|
||||
try {
|
||||
const tmpCurrentFiber = Fiber.current;
|
||||
zlib.gunzip(tmpInData, DEFAULT_ZLIB_UN_OPT, (err, tmpBuffer) => {
|
||||
if (err) {
|
||||
console.error("zlib.js fnGunzip zlib.gunzip error");
|
||||
console.error(err);
|
||||
} else {
|
||||
tmpResult = tmpBuffer.toString("utf-8");
|
||||
}
|
||||
tmpCurrentFiber.run();
|
||||
});
|
||||
Fiber.yield();
|
||||
} catch (e) {
|
||||
console.error("zlib.gunzip Error: ", e);
|
||||
}
|
||||
return tmpResult;
|
||||
};
|
||||
|
||||
const fnDeflate = (inData) => {
|
||||
let tmpInData = fnToBuffer(inData);
|
||||
let tmpResult = null;
|
||||
try {
|
||||
const tmpCurrentFiber = Fiber.current;
|
||||
zlib.deflate(tmpInData, DEFAULT_ZLIB_OPT, (err, tmpBuffer) => {
|
||||
if (err) {
|
||||
console.error("zlib.js fnDeflate zlib.deflate error");
|
||||
console.error(err);
|
||||
} else {
|
||||
tmpResult = tmpBuffer.buffer;
|
||||
}
|
||||
tmpCurrentFiber.run();
|
||||
});
|
||||
Fiber.yield();
|
||||
} catch (e) {
|
||||
console.error("zlib.deflate Error: ", e);
|
||||
}
|
||||
return tmpResult;
|
||||
};
|
||||
|
||||
const fnInflate = (inBufferData) => {
|
||||
let tmpInData = fnIsBuffer(inBufferData)
|
||||
? inBufferData
|
||||
: fnToBuffer(inBufferData);
|
||||
let tmpResult = null;
|
||||
try {
|
||||
const tmpCurrentFiber = Fiber.current;
|
||||
zlib.inflate(tmpInData, DEFAULT_ZLIB_UN_OPT, (err, tmpBuffer) => {
|
||||
if (err) {
|
||||
console.error("zlib.js fnInflate zlib.inflate error");
|
||||
console.error(err);
|
||||
} else {
|
||||
tmpResult = tmpBuffer.toString("utf-8");
|
||||
}
|
||||
tmpCurrentFiber.run();
|
||||
});
|
||||
Fiber.yield();
|
||||
} catch (e) {
|
||||
console.error("zlib.inflate Error: ", e);
|
||||
}
|
||||
return tmpResult;
|
||||
};
|
||||
|
||||
exports.fnGzip = fnGzip;
|
||||
exports.fnGunzip = fnGunzip;
|
||||
exports.fnDeflate = fnDeflate;
|
||||
exports.fnInflate = fnInflate;
|
747
src/workbench/node/request/package-lock.json
generated
Normal file
747
src/workbench/node/request/package-lock.json
generated
Normal file
@ -0,0 +1,747 @@
|
||||
{
|
||||
"name": "eoapi-request-transfer",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"abab": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
|
||||
"integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA=="
|
||||
},
|
||||
"acorn": {
|
||||
"version": "5.7.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
|
||||
"integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg=="
|
||||
},
|
||||
"acorn-globals": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.3.4.tgz",
|
||||
"integrity": "sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A==",
|
||||
"requires": {
|
||||
"acorn": "^6.0.1",
|
||||
"acorn-walk": "^6.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"acorn": {
|
||||
"version": "6.4.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz",
|
||||
"integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz",
|
||||
"integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA=="
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"array-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
|
||||
"integrity": "sha512-H3LU5RLiSsGXPhN+Nipar0iR0IofH+8r89G2y1tBKxQ/agagKyAjhkAFDRBfodP2caPrNKHpAWNIM/c9yeL7uA=="
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.6",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
|
||||
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
|
||||
"requires": {
|
||||
"safer-buffer": "~2.1.0"
|
||||
}
|
||||
},
|
||||
"assert-plus": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||
"integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw=="
|
||||
},
|
||||
"async-limiter": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
|
||||
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||
},
|
||||
"aws-sign2": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||
"integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA=="
|
||||
},
|
||||
"aws4": {
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
|
||||
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
|
||||
},
|
||||
"bcrypt-pbkdf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
||||
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
|
||||
"requires": {
|
||||
"tweetnacl": "^0.14.3"
|
||||
}
|
||||
},
|
||||
"browser-process-hrtime": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
|
||||
"integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow=="
|
||||
},
|
||||
"caseless": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.2.1"
|
||||
}
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="
|
||||
},
|
||||
"crypto-js": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
|
||||
"integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
|
||||
},
|
||||
"cssom": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
|
||||
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="
|
||||
},
|
||||
"cssstyle": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz",
|
||||
"integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==",
|
||||
"requires": {
|
||||
"cssom": "0.3.x"
|
||||
}
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
"integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"data-urls": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.1.0.tgz",
|
||||
"integrity": "sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ==",
|
||||
"requires": {
|
||||
"abab": "^2.0.0",
|
||||
"whatwg-mimetype": "^2.2.0",
|
||||
"whatwg-url": "^7.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"whatwg-url": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz",
|
||||
"integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==",
|
||||
"requires": {
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"tr46": "^1.0.1",
|
||||
"webidl-conversions": "^4.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"deep-is": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||
},
|
||||
"detect-libc": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||
"integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="
|
||||
},
|
||||
"domexception": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
|
||||
"integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
|
||||
"requires": {
|
||||
"webidl-conversions": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
"integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
|
||||
"requires": {
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"escodegen": {
|
||||
"version": "1.14.3",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz",
|
||||
"integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==",
|
||||
"requires": {
|
||||
"esprima": "^4.0.1",
|
||||
"estraverse": "^4.2.0",
|
||||
"esutils": "^2.0.2",
|
||||
"optionator": "^0.8.1",
|
||||
"source-map": "~0.6.1"
|
||||
}
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
|
||||
},
|
||||
"estraverse": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
|
||||
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="
|
||||
},
|
||||
"esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
|
||||
},
|
||||
"extsprintf": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
||||
"integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g=="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
|
||||
},
|
||||
"fast-levenshtein": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
|
||||
},
|
||||
"fibers": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fibers/-/fibers-5.0.1.tgz",
|
||||
"integrity": "sha512-VMC7Frt87Oo0AOJ6EcPFbi+tZmkQ4tD85aatwyWL6I9cYMJmm2e+pXUJsfGZ36U7MffXtjou2XIiWJMtHriErw==",
|
||||
"requires": {
|
||||
"detect-libc": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
"integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw=="
|
||||
},
|
||||
"form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"getpass": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||
"integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"har-schema": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
|
||||
"integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q=="
|
||||
},
|
||||
"har-validator": {
|
||||
"version": "5.1.5",
|
||||
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
|
||||
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
|
||||
"requires": {
|
||||
"ajv": "^6.12.3",
|
||||
"har-schema": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"html-encoding-sniffer": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz",
|
||||
"integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==",
|
||||
"requires": {
|
||||
"whatwg-encoding": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
"integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"jsprim": "^1.2.2",
|
||||
"sshpk": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
}
|
||||
},
|
||||
"is-typedarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
|
||||
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA=="
|
||||
},
|
||||
"isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
|
||||
},
|
||||
"jquery": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
|
||||
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg=="
|
||||
},
|
||||
"jsdom": {
|
||||
"version": "11.12.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.12.0.tgz",
|
||||
"integrity": "sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw==",
|
||||
"requires": {
|
||||
"abab": "^2.0.0",
|
||||
"acorn": "^5.5.3",
|
||||
"acorn-globals": "^4.1.0",
|
||||
"array-equal": "^1.0.0",
|
||||
"cssom": ">= 0.3.2 < 0.4.0",
|
||||
"cssstyle": "^1.0.0",
|
||||
"data-urls": "^1.0.0",
|
||||
"domexception": "^1.0.1",
|
||||
"escodegen": "^1.9.1",
|
||||
"html-encoding-sniffer": "^1.0.2",
|
||||
"left-pad": "^1.3.0",
|
||||
"nwsapi": "^2.0.7",
|
||||
"parse5": "4.0.0",
|
||||
"pn": "^1.1.0",
|
||||
"request": "^2.87.0",
|
||||
"request-promise-native": "^1.0.5",
|
||||
"sax": "^1.2.4",
|
||||
"symbol-tree": "^3.2.2",
|
||||
"tough-cookie": "^2.3.4",
|
||||
"w3c-hr-time": "^1.0.1",
|
||||
"webidl-conversions": "^4.0.2",
|
||||
"whatwg-encoding": "^1.0.3",
|
||||
"whatwg-mimetype": "^2.1.0",
|
||||
"whatwg-url": "^6.4.1",
|
||||
"ws": "^5.2.0",
|
||||
"xml-name-validator": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"json-schema": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
|
||||
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
||||
},
|
||||
"json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
|
||||
},
|
||||
"jsprim": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
|
||||
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
|
||||
"requires": {
|
||||
"assert-plus": "1.0.0",
|
||||
"extsprintf": "1.3.0",
|
||||
"json-schema": "0.4.0",
|
||||
"verror": "1.10.0"
|
||||
}
|
||||
},
|
||||
"left-pad": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
|
||||
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA=="
|
||||
},
|
||||
"levn": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
|
||||
"integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==",
|
||||
"requires": {
|
||||
"prelude-ls": "~1.1.2",
|
||||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"lodash.sortby": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
||||
"integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"requires": {
|
||||
"mime-db": "1.52.0"
|
||||
}
|
||||
},
|
||||
"nwsapi": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.1.tgz",
|
||||
"integrity": "sha512-JYOWTeFoS0Z93587vRJgASD5Ut11fYl5NyihP3KrYBvMe1FRRs6RN7m20SA/16GM4P6hTnZjT+UmDOt38UeXNg=="
|
||||
},
|
||||
"oauth-sign": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
||||
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
|
||||
},
|
||||
"optionator": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
|
||||
"integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
|
||||
"requires": {
|
||||
"deep-is": "~0.1.3",
|
||||
"fast-levenshtein": "~2.0.6",
|
||||
"levn": "~0.3.0",
|
||||
"prelude-ls": "~1.1.2",
|
||||
"type-check": "~0.3.2",
|
||||
"word-wrap": "~1.2.3"
|
||||
}
|
||||
},
|
||||
"parse5": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz",
|
||||
"integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA=="
|
||||
},
|
||||
"performance-now": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="
|
||||
},
|
||||
"pn": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
|
||||
"integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA=="
|
||||
},
|
||||
"prelude-ls": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
|
||||
"integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w=="
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
|
||||
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA=="
|
||||
},
|
||||
"request": {
|
||||
"version": "2.88.2",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
|
||||
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
|
||||
"requires": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.8.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.6",
|
||||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.2",
|
||||
"har-validator": "~5.1.3",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.19",
|
||||
"oauth-sign": "~0.9.0",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.2",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"tough-cookie": "~2.5.0",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"form-data": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
|
||||
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"request-promise-core": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz",
|
||||
"integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.19"
|
||||
}
|
||||
},
|
||||
"request-promise-native": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz",
|
||||
"integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==",
|
||||
"requires": {
|
||||
"request-promise-core": "1.1.4",
|
||||
"stealthy-require": "^1.1.1",
|
||||
"tough-cookie": "^2.3.3"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"optional": true
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.17.0",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz",
|
||||
"integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==",
|
||||
"requires": {
|
||||
"asn1": "~0.2.3",
|
||||
"assert-plus": "^1.0.0",
|
||||
"bcrypt-pbkdf": "^1.0.0",
|
||||
"dashdash": "^1.12.0",
|
||||
"ecc-jsbn": "~0.1.1",
|
||||
"getpass": "^0.1.1",
|
||||
"jsbn": "~0.1.0",
|
||||
"safer-buffer": "^2.0.2",
|
||||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"stealthy-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||
"integrity": "sha512-ZnWpYnYugiOVEY5GkcuJK1io5V8QmNYChG62gSit9pQVGErXtrKuPC55ITaVSukmMta5qpMU7vqLt2Lnni4f/g=="
|
||||
},
|
||||
"symbol-tree": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"requires": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"tr46": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
|
||||
"integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
|
||||
},
|
||||
"type-check": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
|
||||
"integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==",
|
||||
"requires": {
|
||||
"prelude-ls": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"uuid": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
"integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
|
||||
"requires": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"core-util-is": "1.0.2",
|
||||
"extsprintf": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"w3c-hr-time": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
|
||||
"integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==",
|
||||
"requires": {
|
||||
"browser-process-hrtime": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
|
||||
"integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg=="
|
||||
},
|
||||
"whatwg-encoding": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz",
|
||||
"integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==",
|
||||
"requires": {
|
||||
"iconv-lite": "0.4.24"
|
||||
},
|
||||
"dependencies": {
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"whatwg-mimetype": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
|
||||
"integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g=="
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
|
||||
"integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
|
||||
"requires": {
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"tr46": "^1.0.1",
|
||||
"webidl-conversions": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"word-wrap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ=="
|
||||
},
|
||||
"ws": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz",
|
||||
"integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"xml-name-validator": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
|
||||
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw=="
|
||||
},
|
||||
"xml2js": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
|
||||
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
|
||||
"requires": {
|
||||
"sax": ">=0.6.0",
|
||||
"xmlbuilder": "~11.0.0"
|
||||
}
|
||||
},
|
||||
"xmlbuilder": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
||||
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
|
||||
}
|
||||
}
|
||||
}
|
22
src/workbench/node/request/package.json
Normal file
22
src/workbench/node/request/package.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "eoapi-request-transfer",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "unit.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"jquery": "^3.3.0",
|
||||
"jsdom": "^11.5.1",
|
||||
"content-disposition": "^0.5.4",
|
||||
"crypto-js": "^4.1.1",
|
||||
"form-data": "^4.0.0",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"xml2js": "^0.4.23",
|
||||
"fibers": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
@ -15,6 +15,7 @@ const { resolve } = require('path');
|
||||
_GetFileClass = new (require('./libs/getFile.package').core)(),
|
||||
_LibsMineType = require('./libs/mineType.package');
|
||||
let CONFIG = require('./config.json');
|
||||
|
||||
const _EO_LANG_OBJ = require('./lang.json');
|
||||
var iconv = require('iconv-lite');
|
||||
global.eoLang = _EO_LANG_OBJ['cn'];
|
||||
|
@ -1,6 +1,6 @@
|
||||
# eo-test-server
|
||||
|
||||
Recieve eoapi tes config and response http result
|
||||
Only deploy in web server.
|
||||
Recieve eoapi test config and response http result
|
||||
|
||||
> This service does not automatically install dependencies,please install it manually
|
||||
|
||||
|
@ -22,45 +22,7 @@ app.use(async (ctx, next) => {
|
||||
}
|
||||
switch (ctx.url) {
|
||||
case '/api/unit': {
|
||||
// let reqJSON = ctx.request.body.data;
|
||||
let reqJSON = {
|
||||
requestType: '0',
|
||||
headers: [
|
||||
{ headerName: '{{codeGlobalParams}}', headerValue: '{{codeGlobalParams}}', paramInfo: '', checkbox: true },
|
||||
],
|
||||
URL: 'https://eolinker.w.eolink.com/home/api_studio/inside/api/test?apiID=5622520&groupID=1369696&projectHashKey=ccsIhPl17503a6b2326f09fbc4e3a7c03874c7333002038&spaceKey=eolinker',
|
||||
beforeInject:
|
||||
'eo.http.url.get(); //获取原始的http协议eo.http.apiUrl,不包含环境的base eo.http.apiUrl,比如/user/login/{user_type}?user_name={{name}}\neo.http.url.parse(); //获取经过解析处理后的http协议eo.http.apiUrl,包含环境的base eo.http.apiUrl,比如www.eolinker.com/user/login/admin?user_name=jackliu\neo.http.url.set("47.95.203.198:8080/Web/Test/all/{name}"); //设置http协议eo.http.apiUrl,比如/user/login/admin?user_name={{name}}\neo.http.header.get("param_key"); //获取http协议请求头部参数值\neo.http.header.set("param_key","param_value"); //获取http协议请求头部参数值\neo.http.header.unset("param_key"); //删除http协议header参数\neo.http.header.clear; //清空http协议header参数\neo.http.query.get("param_key"); //获取http协议eo.http.queryParam参数\neo.http.query.set("param_key","param_value"); //设置http协议eo.http.queryParam参数\neo.http.query.unset("param_key"); //删除http协议eo.http.queryParam参数(删除后不会出现在地址栏中)\neo.http.query.clear; //清空http协议eo.http.queryParam参数\neo.http.rest.get("param_key"); //获取http协议rest参数\neo.http.rest.set("name","print"); //设置http协议eo.http.queryParam参数\neo.http.rest.set("param_key","print"); //设置http协议rest参数\neo.http.rest.unset("param_key"); //删除http协议rest参数\neo.http.rest.clear; //清空http协议rest参数\neo.env.http.baseUrl.get(); //获取环境http协议的base eo.http.apiUrl\neo.env.http.baseUrl.set("new_base_url"); //设置环境http协议的base eo.http.apiUrl\neo.env.http.header.get("param_key"); //获取环境http协议的头部参数\neo.env.http.header.set("param_key","param_value"); //获取环境http协议的头部参数\neo.env.http.header.unset("param_key"); //删除环境http协议的header参数\neo.env.http.header.clear; //清空环境http协议的header参数\neo.env.http.extraFormData.get("param_key"); //获取环境http协议的额外表单参数\neo.env.http.extraFormData.set("param_key","param_value"); //设置环境http协议的额外表单参数\neo.env.http.extraFormData.unset("param_key"); //删除环境http协议的额外表单参数\neo.env.http.query.get("param_key"); //获取环境http协议的eo.http.queryParam参数\neo.env.http.query.set("param_key","param_value"); //设置环境http协议的eo.http.queryParam参数\neo.env.http.query.unset("param_key"); //删除环境http协议的eo.http.queryParam参数(删除后不会出现在地址栏中)\neo.env.http.query.clear; //清空环境http协议的eo.http.queryParam参数\neo.env.param.get("param_key"); //获取环境变量\neo.env.param.set("codeGlobalParams","param_value"); //设置环境变量\neo.env.param.set("param_key","param_value"); //设置环境变量\neo.env.param.unset("param_key"); //删除环境变量\neo.info(eo.http.headerParam)\neo.info(eo.http.restParam)\neo.info(eo.http.queryParam)\neo.info(eo.http.apiUrl)',
|
||||
afterInject:
|
||||
'\neo.info(eo.http.response.get()); //获取http协议返回结果\neo.http.response.set("response_value"); //获取http协议返回结果\neo.env.http.extraFormData.clear(); //清空环境http协议的额外表单参数\neo.env.param.clear(); //清空环境变量',
|
||||
advancedSetting: { requestRedirect: 1, checkSSL: 0, sendEoToken: 1, sendNocacheToken: 0 },
|
||||
apiRequestParamJsonType: '0',
|
||||
methodType: '0',
|
||||
httpHeader: 0,
|
||||
method: 'POST',
|
||||
env: {
|
||||
envName: '',
|
||||
frontURI: '',
|
||||
headerList: [
|
||||
{
|
||||
headerName: 'Content-Type',
|
||||
headerValue: 'application/x-www-form-urlencoded',
|
||||
checkbox: true,
|
||||
isStaticTop: true,
|
||||
},
|
||||
],
|
||||
paramList: [],
|
||||
additionalParamList: [],
|
||||
envAuth: { status: '0' },
|
||||
urlParamList: [],
|
||||
},
|
||||
auth: { status: '0' },
|
||||
testTime: '2022-07-14 14:27:58',
|
||||
status: 'ajax',
|
||||
globals: {},
|
||||
globalHeader: {},
|
||||
params: [{ paramType: '0', paramKey: '{{codeGlobalParams}}', paramInfo: 'test', checkbox: true }],
|
||||
};
|
||||
let reqJSON = ctx.request.body.data;
|
||||
reqJSON.env = _LibsCommon.parseEnv(reqJSON.env);
|
||||
await new _LibsFlowCommon.core().main(reqJSON).then(({ report, history }) => {
|
||||
['general', 'requestInfo', 'resultInfo'].forEach((keyName) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "eoapi-node",
|
||||
"name": "eo-test-server",
|
||||
"version": "1.0.0",
|
||||
"description": "Recieve eoapi tes config and response http result",
|
||||
"main": "main.js",
|
||||
@ -13,6 +13,5 @@
|
||||
"@koa/cors": "3.3.0",
|
||||
"koa": "2.13.4",
|
||||
"koa-body": "5.0.0"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
}
|
||||
|
99
upload.js
99
upload.js
@ -1,99 +0,0 @@
|
||||
const qiniu = require('qiniu');
|
||||
const YAML = require('yaml');
|
||||
const fs = require('fs');
|
||||
const { AK, SK, bucket } = require('./qiniu_env.js');
|
||||
const package = require('./package.json');
|
||||
|
||||
qiniu.conf.ACCESS_KEY = AK;
|
||||
qiniu.conf.SECRET_KEY = SK;
|
||||
|
||||
// * 构建上传策略函数
|
||||
const uptoken = (bucket, key) => new qiniu.rs.PutPolicy(bucket + ':' + key).token();
|
||||
|
||||
const toLatest = (name) => name.replace(/\d+\.\d+\.\d+/, 'latest');
|
||||
const onlyName = (name) => name.replace(/release\//, '');
|
||||
|
||||
// * 构建客户端实例
|
||||
const client = new qiniu.rs.Client();
|
||||
|
||||
// * 上传单个文件
|
||||
const uploadFile = (token, file, localFile) =>
|
||||
new Promise((resolve) => {
|
||||
const extra = new qiniu.io.PutExtra();
|
||||
qiniu.io.putFile(token, file, localFile, extra, (err) => {
|
||||
console.log(err ? err : 'success');
|
||||
return err ? resolve(false) : resolve(true);
|
||||
});
|
||||
});
|
||||
|
||||
// * 删除单个文件
|
||||
const removeFile = (spaceName, file) =>
|
||||
new Promise((resolve) => {
|
||||
client.remove(spaceName, file, (err, ret) => {
|
||||
return err ? resolve(false) : resolve(true);
|
||||
});
|
||||
});
|
||||
|
||||
// * 拷贝单个文件
|
||||
const cpFile = (fromFile, toFile) =>
|
||||
new Promise((resolve) => {
|
||||
client.copy(bucket, fromFile, bucket, toFile, (err) => {
|
||||
return err ? resolve(false) : resolve(true);
|
||||
});
|
||||
});
|
||||
|
||||
const version = package.version;
|
||||
const fileList = [
|
||||
'release/eoapi Setup ?.exe',
|
||||
'release/eoapi-?.dmg',
|
||||
'release/eoapi-?-arm64.dmg',
|
||||
'release/eoapi-?-mac.zip',
|
||||
'release/latest.yml',
|
||||
'release/latest-mac.yml',
|
||||
].map((it) => it.replace(/\?/, `${version}`));
|
||||
// const fileList = ['releass/eoapi-Setup-?.png', 'releass/eoapi-?.png', 'releass/eoapi-?-arm64.png'].map((it) =>
|
||||
// it.replace(/\?/, `${version}`)
|
||||
// );
|
||||
|
||||
const app = async () => {
|
||||
const uploadResult = await Promise.all(
|
||||
fileList.map(async (it) => {
|
||||
let isOK;
|
||||
// * 生成上传 Token
|
||||
try {
|
||||
if (it.endsWith('.yml')) {
|
||||
const ymlObj = YAML.parse(fs.readFileSync(it, 'utf8'));
|
||||
ymlObj.files.forEach((n) => (n.url = `${ymlObj.version}/${n.url}`));
|
||||
ymlObj.path = `${ymlObj.version}/${ymlObj.path}`;
|
||||
fs.writeFileSync(it, YAML.stringify(ymlObj));
|
||||
await removeFile(bucket, onlyName(it));
|
||||
const token = uptoken(bucket, onlyName(it));
|
||||
isOK = await uploadFile(token, onlyName(it), it);
|
||||
} else {
|
||||
const token = uptoken(bucket, `${version}/${it.replace(/release\//, '')}`);
|
||||
isOK = await uploadFile(token, `${version}/${it.replace(/release\//, '')}`, it);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('error', error);
|
||||
}
|
||||
return Promise.resolve(isOK || false);
|
||||
})
|
||||
);
|
||||
console.log('上传结果:', uploadResult);
|
||||
const deleteResult = await Promise.all(
|
||||
fileList.map(async (it) => {
|
||||
const isOK = await removeFile(bucket, `latest/${toLatest(onlyName(it))}`);
|
||||
Promise.resolve(isOK || false);
|
||||
})
|
||||
);
|
||||
console.log('删除结果:', deleteResult);
|
||||
const copyResult = await Promise.all(
|
||||
fileList.map(async (it) => {
|
||||
const isOK = await cpFile(`${version}/${onlyName(it)}`, `latest/${toLatest(onlyName(it))}`);
|
||||
Promise.resolve(isOK || false);
|
||||
})
|
||||
);
|
||||
console.log('拷贝结果', copyResult);
|
||||
};
|
||||
|
||||
app();
|
13565
yarn-error.log
13565
yarn-error.log
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user