inputmore-executor
Advanced tools
Comparing version 1.0.44 to 1.0.45
@@ -1,1 +0,1 @@ | ||
global.dynamicRequire=function(e){return e=require("path").normalize(e),delete require.cache[e],require(e)},function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){const i=n(4),r=n(10),s=n(17),o=n(20),a=n(22),c=n(24);e.exports=class{constructor(){this.network=new i,this.file=new r,this.basic=new s,this.system=new a,this.sap=c,this.ssh=o}}},function(e,t){e.exports=require("path")},function(e,t,n){e.exports=n(3)},function(e,t,n){const i=n(0),r=new i,s=n(26);let o;const a={utils:new i,run:async({hostUrl:e,executorid:t,executorPassword:i,dirname:a})=>{a=a||__dirname;const c=n(29);console.log("正在连接服务器");const u=c(e,{path:"/executor"});o=u,u.on("login",function(e,n){n({executorid:t,executorPassword:i})}),u.on("connected",async(e,t)=>{console.log("连接服务器成功")}),u.on("call",async(e,t)=>{await s(a,e,u,t)}),u.on("backoffice",async(e,t)=>{let n,i;switch(e.type){case"searchSAPRFC":i=new r.sap.RFC(e.connection),n=await i.search(e.term);break;case"getSAPRFCMetadata":i=new r.sap.RFC(e.connection),n=await i.getRFCMetadata(e.name);break;case"callRFC":i=new r.sap.RFC(e.connection),n=await i.call({api:e.name,import:e.import})}t(n)})},getSocket:()=>({call:async(e,t)=>await new Promise(async n=>{o.emit(e,t,async e=>{n(e)})})})};global.inputmoreExecutor=a},function(e,t,n){const i=n(5),r=n(6);e.exports=class{async get(e,t){let r;t=t||{};let s=n(7).parse(e);r="http:"===s.protocol?n(8):n(9);let o=s;return o.headers={"cache-control":"no-cache"},await new Promise(function(e,n){r.request(o,function(n){let r;n.headers["content-type"].indexOf("charset=GBK")>=0&&(r="GBK");let s=[];n.on("data",function(e){s.push(e)}),n.on("end",function(){let n=Buffer.concat(s);t.encoding&&(r=t.encoding),n=r?i.decode(n,r):n.toString(),e(n)})}).end()})}async html(e){return r.load(e)}}},function(e,t){e.exports=require("iconv-lite")},function(e,t){e.exports=require("cheerio")},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t,n){const i=n(11),r=n(12),s=n(13),o=n(14),a=n(1),c=n(15);e.exports=class{constructor(){}async normalize(e){return a.normalize(e)}async download(e,t){await new Promise(function(n){c(e).pipe(i.createWriteStream(t)).on("close",function(){n()})})}async find(e,t){t=t||{};const i=n(16);return await new Promise(function(n){i(e,t,function(e,t){for(let e in t)t[e]=a.normalize(t[e]);n(t)})})}async zip(e,t,n){return await new Promise(function(r,o){let a=i.createWriteStream(t),c=s("zip",{zlib:{level:9}});a.on("close",function(){r()}),c.pipe(a),c.glob("**",{cwd:e,ignore:n||[]}),c.finalize()})}async unzip(e,t){return e=a.normalize(e),await new Promise(function(n,i){o(e,{dir:t},function(e){n()})})}async exist(e){return await new Promise(function(t){i.access(e,function(e){t(!e)})})}async isDirectory(e){return i.statSync(e).isDirectory()}async move(e,t){await r.move(e,t)}async delete(e){await r.remove(e)}async ensureFile(e){await r.ensureFile(e)}async ensureDir(e){await r.ensureDir(e)}async copy(e,t){await r.copy(e,t)}async writeFile(e,t,n){(n=n||{}).encoding?i.writeFileSync(e,t,n.encoding):i.writeFileSync(e,t)}async writeFileBase64(e,t){i.writeFileSync(e,new Buffer(t,"base64"))}async readFile(e,t){let n=null;if((t=t||{}).encoding||(n="utf-8"),t.encoding&&"buffer"!==t.encoding&&(n=t.encoding),await this.exist(e))return await new Promise(function(t){i.readFile(e,n,(e,n)=>{if(e)throw e;t(n)})})}async readFileBase64(e){if(await this.exist(e))return i.readFileSync(e).toString("base64")}async clearFile(e){await this.writeFile(e,"")}async getExt(e){return a.extname(e)}}},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("fs-extra")},function(e,t){e.exports=require("archiver")},function(e,t){e.exports=require("extract-zip")},function(e,t){e.exports=require("download")},function(e,t){e.exports=require("glob")},function(e,t,n){e.exports=class{constructor(){}async uuid(){return n(18).v4().replace(/-/g,"")}async delay(e){return e=e||1e3,await new Promise(function(t){setTimeout(function(){t()},e)})}formatTime(e,t,n){if("UTC"==n){var i=function(e){switch(e.getUTCDay()){case 0:return"日";case 1:return"一";case 2:return"二";case 3:return"三";case 4:return"四";case 5:return"五";case 6:return"六"}},r={"M+":e.getUTCMonth()+1,"d+":e.getUTCDate(),"W+":i(e),"h+":e.getUTCHours(),"m+":e.getUTCMinutes(),"s+":e.getUTCSeconds(),"q+":Math.floor((e.getUTCMonth()+3)/3),S:("00"+e.getUTCMilliseconds()).slice(-3)};for(var s in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getUTCFullYear()+"").substr(4-RegExp.$1.length))),r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t}for(var s in i=function(e){switch(e.getDay()){case 0:return"日";case 1:return"一";case 2:return"二";case 3:return"三";case 4:return"四";case 5:return"五";case 6:return"六"}},r={"M+":e.getMonth()+1,"d+":e.getDate(),"W+":i(e),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:("00"+e.getMilliseconds()).slice(-3)},/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t}convertTimestamp(e){if(void 0==e)return this.formatTime(new Date,"yyyyMMddhhmmssS","UTC");if("string"==typeof e){var t=new Date;return t.setUTCFullYear(e.substr(0,4)),t.setUTCMonth(parseInt(e.substr(4,2))-1),t.setUTCDate(e.substr(6,2)),t.setUTCHours(e.substr(8,2)),t.setUTCMinutes(e.substr(10,2)),t.setUTCSeconds(e.substr(12,2)),t.setUTCMilliseconds(e.substr(14,3)),t}return"object"==typeof e?this.formatTime(e,"yyyyMMddhhmmssS","UTC"):void 0}async qrcode(e){const t=n(19);let i={errorCorrectionLevel:"H",rendererOpts:{quality:.8},color:{light:"#f8f8f8"}};return{base64:await new Promise(function(n){t.toDataURL(e,i,function(e,t){n(t)})})}}}},function(e,t){e.exports=require("uuid")},function(e,t){e.exports=require("qrcode")},function(e,t,n){const i=n(21);e.exports=(async e=>{let t;return(await new Promise(function(n,r){(t=new i).connect(e).then(function(){n({})}).catch(e=>{n({err:e})})})).err&&console.log("ssh error"),new class{constructor(e){this.ssh=e}async exec(e,t){return t=t||"~",await this.ssh.execCommand(e,{cwd:t})}async putFile(e,t){const n=this;return await new Promise(function(i,r){n.ssh.putFile(e,t).then(function(e){i()},function(e){console.log(e),i(e)})})}async getFile(e,t){const n=this;return await new Promise(function(i,r){n.ssh.getFile(e,t).then(function(e){i()},function(e){console.log(e),i(e)})})}async unzip(e,t){await this.ssh.exec(`unzip -o ${e} -d ${t}`)}async delete(e){await this.ssh.exec(`rm -rf ${e}`)}}(t)})},function(e,t){e.exports=require("node-ssh")},function(e,t,n){e.exports=class{constructor(){}async cmd(e,t){return t||(t={}),await new Promise(function(i,r){n(23).exec(e,t,function(e,t,n){e?(i(n),console.log(n)):i(t)})})}async message(e){await this.cmd(`msg %username% /time:10 "${e}"`)}}},function(e,t){e.exports=require("child_process")},function(e,t,n){"use strict";e.exports={RFC:class{constructor(e){let t;t=global.dynamicRequire?global.dynamicRequire("/root/node_modules/node-rfc/index.js"):!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}(),this.client=new t.Client(e,!0),console.log("Client Version: ",this.client.getVersion()),this.connected=!1}async connect(){const e=this;if(!this.connected)return await new Promise(function(t){console.log("Connecting..."),(new Date).getTime(),e.client.connect(function(n){n?t(n):(console.log("Connected"),e.connected=!0,t())})})}async call(e){const t=this;let n=await this.connect();if(!n)return await new Promise(function(n){let i=(new Date).getTime();t.client.invoke(e.api,e.import,function(t,r){if(t)return console.error("RFC "+e.api+"Error:",t);let s=(new Date).getTime();console.log(`RFC ${e.api} ${s-i}ms`),n(r)})});console.error("could not connect to server",n)}async search(e){return await this.call({api:"RFC_FUNCTION_SEARCH",import:{FUNCNAME:e,LANGUAGE:"EN"}})}async getRFCMetadata(e){return await this.call({api:"RFC_GET_FUNCTION_INTERFACE",import:{FUNCNAME:e,LANGUAGE:"EN"}})}}}},function(e,t){function n(e){throw new Error("Cannot find module '"+e+"'.")}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=25},function(e,t,n){const i=n(1),r=new(n(0)),s=n(27);e.exports=(async(e,t,n,o)=>{let a,c,u=new s;if(t.versionid?("current"!==t.versionid&&await r.file.exist(`${e}/api/${t.versionid}`)||await new Promise(i=>{n.emit("downloadApiFile",{versionid:t.versionid},async n=>{if(n){let s=`${e}/api/${t.versionid}/api.zip`;await r.file.ensureFile(s),await r.file.writeFile(s,n),await r.file.unzip(s,`${e}/api/${t.versionid}`),console.log(`${t.versionid} api refreshed`),i()}else console.log("api file download failed")})}),a=`${e}/api/${t.versionid}/${t.apiName}/index.js`):a=`${e}/api/${t.apiName}/index.js`,a=i.normalize(a),!await r.file.exist(a))return u.setMessage("NO_API_INDEX","未找到接口程序"),void o(u.getResult());c=global.dynamicRequire?global.dynamicRequire(a):!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}(),"GET"===t.method?t.parameter=t.query:"application/json"===t.contentType?t.parameter=JSON.parse(t.body.toString()):t.parameter={error:"using application/json content type to get this attribute"},t.file&&(t.file.getData=(async()=>await new Promise(function(e){n.emit("downloadTmpFile",{id:t.file.id},async t=>{e(t)})})));await c({request:t,response:u,utils:r});o(u.getResult())})},function(e,t){e.exports=class{constructor(){this.finished=!1,this.result={code:"OK",message:"",type:"",data:""}}redirect(e){this.finished||(this.result.type="REDIRECT",this.result.data=e,this.finished=!0)}setCookie(e,t,n){n=n||{};let{maxAge:i}=n;this.result.cookie||(this.result.cookie={}),this.result.cookie[e]={value:t,maxAge:i}}setData(e){this.finished||(this.result.type="JSON",this.result.data=e,this.finished=!0)}setHeader(e,t){this.result.headers||(this.result.headers={}),this.result.headers[e]=t}setBody(e){this.finished||(this.result.type="BODY_REWRITE",this.result.data=e,this.finished=!0)}setMessage(e,t){this.result.code=e,this.result.message=t}getResult(){return this.result}}},function(e,t){function n(e){throw new Error("Cannot find module '"+e+"'.")}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=28},function(e,t){e.exports=require("socket.io-client")}]),module.exports=global.inputmoreExecutor; | ||
global.dynamicRequire=function(e){return e=require("path").normalize(e),delete require.cache[e],require(e)},function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){const i=n(4),r=n(10),s=n(17),o=n(20),a=n(22),c=n(24);e.exports=class{constructor(){this.network=new i,this.file=new r,this.basic=new s,this.system=new a,this.sap=c,this.ssh=o}}},function(e,t){e.exports=require("path")},function(e,t,n){e.exports=n(3)},function(e,t,n){const i=n(0),r=new i,s=n(26);let o;const a={utils:new i,run:async({hostUrl:e,executorid:t,executorPassword:i,dirname:a})=>{a=a||__dirname;const c=n(29);console.log("正在连接服务器");const u=c(e,{path:"/executor"});o=u,u.on("login",function(e,n){n({executorid:t,executorPassword:i})}),u.on("connected",async(e,t)=>{console.log("连接服务器成功")}),u.on("call",async(e,t)=>{await s(a,e,u,t)}),u.on("backoffice",async(e,t)=>{let n,i;switch(e.type){case"searchSAPRFC":i=new r.sap.RFC(e.connection),n=await i.search(e.term);break;case"getSAPRFCMetadata":i=new r.sap.RFC(e.connection),n=await i.getRFCMetadata(e.name);break;case"callRFC":i=new r.sap.RFC(e.connection),n=await i.call({api:e.name,import:e.import})}t(n)})},getSocket:()=>({call:async(e,t)=>await new Promise(async n=>{o.emit(e,t,async e=>{n(e)})})})};global.inputmoreExecutor=a},function(e,t,n){const i=n(5),r=n(6);e.exports=class{async get(e,t){let r;t=t||{};let s=n(7).parse(e);r="http:"===s.protocol?n(8):n(9);let o=s;return o.headers={"cache-control":"no-cache"},await new Promise(function(e,n){r.request(o,function(n){let r;n.headers["content-type"].indexOf("charset=GBK")>=0&&(r="GBK");let s=[];n.on("data",function(e){s.push(e)}),n.on("end",function(){let n=Buffer.concat(s);t.encoding&&(r=t.encoding),n=r?i.decode(n,r):n.toString(),e(n)})}).end()})}async html(e){return r.load(e)}}},function(e,t){e.exports=require("iconv-lite")},function(e,t){e.exports=require("cheerio")},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("https")},function(e,t,n){const i=n(11),r=n(12),s=n(13),o=n(14),a=n(1),c=n(15);e.exports=class{constructor(){}async normalize(e){return a.normalize(e)}async download(e,t){await new Promise(function(n){c(e).pipe(i.createWriteStream(t)).on("close",function(){n()})})}async find(e,t){t=t||{};const i=n(16);return await new Promise(function(n){i(e,t,function(e,t){for(let e in t)t[e]=a.normalize(t[e]);n(t)})})}async zip(e,t,n){return await new Promise(function(r,o){let a=i.createWriteStream(t),c=s("zip",{zlib:{level:9}});a.on("close",function(){r()}),c.pipe(a),c.glob("**",{cwd:e,ignore:n||[]}),c.finalize()})}async unzip(e,t){return e=a.normalize(e),await new Promise(function(n,i){o(e,{dir:t},function(e){n()})})}async exist(e){return await new Promise(function(t){i.access(e,function(e){t(!e)})})}async isDirectory(e){return i.statSync(e).isDirectory()}async move(e,t){await r.move(e,t)}async delete(e){await r.remove(e)}async ensureFile(e){await r.ensureFile(e)}async ensureDir(e){await r.ensureDir(e)}async copy(e,t){await r.copy(e,t)}async writeFile(e,t,n){(n=n||{}).encoding?i.writeFileSync(e,t,n.encoding):i.writeFileSync(e,t)}async writeFileBase64(e,t){i.writeFileSync(e,new Buffer(t,"base64"))}async readFile(e,t){let n=null;if((t=t||{}).encoding||(n="utf-8"),t.encoding&&"buffer"!==t.encoding&&(n=t.encoding),await this.exist(e))return await new Promise(function(t){i.readFile(e,n,(e,n)=>{if(e)throw e;t(n)})})}async readFileBase64(e){if(await this.exist(e))return i.readFileSync(e).toString("base64")}async clearFile(e){await this.writeFile(e,"")}async getExt(e){return a.extname(e)}}},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("fs-extra")},function(e,t){e.exports=require("archiver")},function(e,t){e.exports=require("extract-zip")},function(e,t){e.exports=require("download")},function(e,t){e.exports=require("glob")},function(e,t,n){e.exports=class{constructor(){}async uuid(){return n(18).v4().replace(/-/g,"")}async delay(e){return e=e||1e3,await new Promise(function(t){setTimeout(function(){t()},e)})}formatTime(e,t,n){if("UTC"==n){var i=function(e){switch(e.getUTCDay()){case 0:return"日";case 1:return"一";case 2:return"二";case 3:return"三";case 4:return"四";case 5:return"五";case 6:return"六"}},r={"M+":e.getUTCMonth()+1,"d+":e.getUTCDate(),"W+":i(e),"h+":e.getUTCHours(),"m+":e.getUTCMinutes(),"s+":e.getUTCSeconds(),"q+":Math.floor((e.getUTCMonth()+3)/3),S:("00"+e.getUTCMilliseconds()).slice(-3)};for(var s in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getUTCFullYear()+"").substr(4-RegExp.$1.length))),r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t}for(var s in i=function(e){switch(e.getDay()){case 0:return"日";case 1:return"一";case 2:return"二";case 3:return"三";case 4:return"四";case 5:return"五";case 6:return"六"}},r={"M+":e.getMonth()+1,"d+":e.getDate(),"W+":i(e),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:("00"+e.getMilliseconds()).slice(-3)},/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t}convertTimestamp(e){if(void 0==e)return this.formatTime(new Date,"yyyyMMddhhmmssS","UTC");if("string"==typeof e){var t=new Date;return t.setUTCFullYear(e.substr(0,4)),t.setUTCMonth(parseInt(e.substr(4,2))-1),t.setUTCDate(e.substr(6,2)),t.setUTCHours(e.substr(8,2)),t.setUTCMinutes(e.substr(10,2)),t.setUTCSeconds(e.substr(12,2)),t.setUTCMilliseconds(e.substr(14,3)),t}return"object"==typeof e?this.formatTime(e,"yyyyMMddhhmmssS","UTC"):void 0}async qrcode(e){const t=n(19);let i={errorCorrectionLevel:"H",rendererOpts:{quality:.8},color:{light:"#f8f8f8"}};return{base64:await new Promise(function(n){t.toDataURL(e,i,function(e,t){n(t)})})}}}},function(e,t){e.exports=require("uuid")},function(e,t){e.exports=require("qrcode")},function(e,t,n){const i=n(21);e.exports=(async e=>{let t;return(await new Promise(function(n,r){(t=new i).connect(e).then(function(){n({})}).catch(e=>{n({err:e})})})).err&&console.log("ssh error"),new class{constructor(e){this.ssh=e}async exec(e,t){return t=t||"~",await this.ssh.execCommand(e,{cwd:t})}async putFile(e,t){const n=this;return await new Promise(function(i,r){n.ssh.putFile(e,t).then(function(e){i()},function(e){console.log(e),i(e)})})}async getFile(e,t){const n=this;return await new Promise(function(i,r){n.ssh.getFile(e,t).then(function(e){i()},function(e){console.log(e),i(e)})})}async unzip(e,t){await this.ssh.exec(`unzip -o ${e} -d ${t}`)}async delete(e){await this.ssh.exec(`rm -rf ${e}`)}}(t)})},function(e,t){e.exports=require("node-ssh")},function(e,t,n){e.exports=class{constructor(){}async cmd(e,t){return t||(t={}),await new Promise(function(i,r){n(23).exec(e,t,function(e,t,n){e?(i(n),console.log(n)):i(t)})})}async message(e){await this.cmd(`msg %username% /time:10 "${e}"`)}}},function(e,t){e.exports=require("child_process")},function(e,t,n){"use strict";e.exports={RFC:class{constructor(e){let t;t=global.dynamicRequire?global.dynamicRequire("/root/node_modules/node-rfc/index.js"):!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}(),this.client=new t.Client(e,!0),console.log("Client Version: ",this.client.getVersion()),this.connected=!1}async connect(){const e=this;if(!this.connected)return await new Promise(function(t){console.log("Connecting..."),(new Date).getTime(),e.client.connect(function(n){n?t(n):(console.log("Connected"),e.connected=!0,t())})})}async call(e){const t=this;let n=await this.connect();if(!n)return await new Promise(function(n){let i=(new Date).getTime();t.client.invoke(e.api,e.import,function(t,r){if(t)return console.error("RFC "+e.api+"Error:",t);let s=(new Date).getTime();console.log(`RFC ${e.api} ${s-i}ms`),n(r)})});console.error("could not connect to server",n)}async search(e){return await this.call({api:"RFC_FUNCTION_SEARCH",import:{FUNCNAME:e,LANGUAGE:"EN"}})}async getRFCMetadata(e){return await this.call({api:"RFC_GET_FUNCTION_INTERFACE",import:{FUNCNAME:e,LANGUAGE:"EN"}})}}}},function(e,t){function n(e){throw new Error("Cannot find module '"+e+"'.")}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=25},function(e,t,n){const i=n(1),r=new(n(0)),s=n(27);let o={};e.exports=(async(e,t,n,a)=>{let c,u,l=new s;if(t.versionid){let i=t.versionid+"_"+t.apiName;o[i]||await new Promise(e=>{n.emit("getApiInfo",{versionid:t.versionid,apiName:t.apiName},async t=>{o[i]=t,e()})}),console.log(o[i]),"current"!==t.versionid&&await r.file.exist(`${e}/api/${t.versionid}`)||await new Promise(i=>{n.emit("downloadApiFile",{versionid:t.versionid},async n=>{if(n){let s=`${e}/api/${t.versionid}/api.zip`;await r.file.ensureFile(s),await r.file.writeFile(s,n),await r.file.unzip(s,`${e}/api/${t.versionid}`),console.log(`${t.versionid} api refreshed`),i()}else console.log("api file download failed")})}),c=`${e}/api/${t.versionid}/${t.apiName}/index.js`}else c=`${e}/api/${t.apiName}/index.js`;if(c=i.normalize(c),!await r.file.exist(c))return l.setMessage("NO_API_INDEX","未找到接口程序"),void a(l.getResult());u=global.dynamicRequire?global.dynamicRequire(c):!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}(),"GET"===t.method?t.parameter=t.query:"application/json"===t.contentType?t.parameter=JSON.parse(t.body.toString()):t.parameter={error:"using application/json content type to get this attribute"},t.file&&(t.file.getData=(async()=>await new Promise(function(e){n.emit("downloadTmpFile",{id:t.file.id},async t=>{e(t)})})));await u({request:t,response:l,utils:r});a(l.getResult())})},function(e,t){e.exports=class{constructor(){this.finished=!1,this.result={code:"OK",message:"",type:"",data:""}}redirect(e){this.finished||(this.result.type="REDIRECT",this.result.data=e,this.finished=!0)}setCookie(e,t,n){n=n||{};let{maxAge:i}=n;this.result.cookie||(this.result.cookie={}),this.result.cookie[e]={value:t,maxAge:i}}setData(e){this.finished||(this.result.type="JSON",this.result.data=e,this.finished=!0)}setHeader(e,t){this.result.headers||(this.result.headers={}),this.result.headers[e]=t}setBody(e){this.finished||(this.result.type="BODY_REWRITE",this.result.data=e,this.finished=!0)}setMessage(e,t){this.result.code=e,this.result.message=t}getResult(){return this.result}}},function(e,t){function n(e){throw new Error("Cannot find module '"+e+"'.")}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=28},function(e,t){e.exports=require("socket.io-client")}]),module.exports=global.inputmoreExecutor; |
{ | ||
"name": "inputmore-executor", | ||
"version": "1.0.44", | ||
"version": "1.0.45", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11642