Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alipay-inc/mpaas-ide-openapi-common

Package Overview
Dependencies
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alipay-inc/mpaas-ide-openapi-common - npm Package Compare versions

Comparing version 1.0.11-alpha.7 to 1.0.11-alpha.8

2

dist/cloudBuild.js

@@ -1,1 +0,1 @@

"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.remoteFileToLocal=exports.pollBuildStatusPrivate=exports.pollBuildStatusAlipay=exports.getFile=exports.getCloudBuildData=exports.cloudBuildPrivate=exports.cloudBuildAlipay=exports.cloudBuild=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_superagent=_interopRequireDefault(require("superagent")),_path=_interopRequireDefault(require("path")),_fsExtra=_interopRequireDefault(require("fs-extra")),_=require("./"),_archiver=_interopRequireDefault(require("archiver")),_chalk=_interopRequireDefault(require("chalk")),_excluded=["file"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){(0,_defineProperty2["default"])(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var POLL_DELAY_TIME=4e3,IGNORE_DIR=[".idea",".vscode",".git",".DS_Store",".umi",".umi-production",".miniu",".node",".tea"],getCloudBuildData=function(a){var b=a.build_url,c=void 0===b?null:b;return c?{type:"private",CLOUD_BUILD_EXEC_URL:"".concat(c,"/miniApp/buildIdeMiniApp"),CLOUD_BUILD_POLL_URL:"".concat(c,"/miniApp/queryMiniAppBuildResult")}:{type:"alipay",CLOUD_BUILD_EXEC_URL:"https://hpmweb.alipay.com/tinyApp/cloudBuild/execute",CLOUD_BUILD_POLL_URL:"https://hpmweb.alipay.com/tinyApp/cloudBuild/result"}};exports.getCloudBuildData=getCloudBuildData;var cloudBuild=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return _.logger.info("cloudBuild req",a),b.prev=1,c=a.config,d=a.file,e=(0,_objectWithoutProperties2["default"])(a,_excluded),f=getCloudBuildData(c),b.next=7,getFile({file:d,type:f.type});case 7:if(d=b.sent,g=_objectSpread(_objectSpread({},e),{},{file:d}),h={},"private"!==f.type){b.next=17;break}return _.logger.info("cloudBuild: private"),b.next=14,cloudBuildPrivate(g,a);case 14:h=b.sent,b.next=21;break;case 17:return _.logger.info("cloudBuild: alipay"),b.next=20,cloudBuildAlipay(g);case 20:h=b.sent;case 21:return _.logger.info("cloudBuild res",h),console.log(_chalk["default"].green("cloudBuild done")),b.abrupt("return",h);case 26:return b.prev=26,b.t0=b["catch"](1),_.logger.error("cloudBuild error",b.t0.message),b.next=31,(0,_.delay)(0);case 31:throw new Error(b.t0.message);case 32:case"end":return b.stop();}},b,null,[[1,26]])}));return function(){return a.apply(this,arguments)}}();exports.cloudBuild=cloudBuild;var compressFile=function(a){var b=a.resourceFile,c=a.targetFile,d=a.type;return new Promise(function(a,e){var f=_fsExtra["default"].createWriteStream(c),g=(0,_archiver["default"])("zip",{zlib:{level:9}});g.pipe(f),f.on("close",function(){a(c)}),g.on("error",function(a){e(a)}),"directory"===d?g.directory("".concat(b),""):g.file("".concat(b),{name:_path["default"].basename(b)}),g.finalize()})},getFile=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h,i;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.file,d=a.type,b.prev=1,_fsExtra["default"].existsSync(c)){b.next=4;break}throw new Error("\u6587\u4EF6\u4E0D\u5B58\u5728\uFF01");case 4:if(!_fsExtra["default"].lstatSync(c).isFile()){b.next=8;break}if(".amr"===_path["default"].extname(c)){b.next=7;break}throw new Error("\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF\uFF01");case 7:return b.abrupt("return",c);case 8:if(!_fsExtra["default"].lstatSync(c).isDirectory()){b.next=22;break}return e=(0,_.getTmpDir)(),f=(0,_.getTmpDir)(),_fsExtra["default"].copySync(c,e),b.next=14,compressFile({resourceFile:e,targetFile:_path["default"].join(f,"dist.tar"),type:"directory"});case 14:if(g=b.sent,"alipay"!==d){b.next=17;break}return b.abrupt("return",g);case 17:return h=(0,_.getTmpDir)(),b.next=20,compressFile({resourceFile:_path["default"].join(f,"dist.tar"),targetFile:_path["default"].join(h,"dist.amr")});case 20:return i=b.sent,b.abrupt("return",i);case 22:return b.abrupt("return",c);case 25:throw b.prev=25,b.t0=b["catch"](1),new Error(b.t0.message);case 28:case"end":return b.stop();}},b,null,[[1,25]])}));return function(){return a.apply(this,arguments)}}();exports.getFile=getFile;var cloudBuildAlipay=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.prev=0,c=a.file,d=a.config,e=void 0===d?{}:d,f=a.adaptorId,g=void 0===f?"mPaaS":f,h=a.h5Id,i=e.appId,j=getCloudBuildData(e),k=j.CLOUD_BUILD_EXEC_URL,l=j.CLOUD_BUILD_POLL_URL,m={params:"[\"--scriptName\",\"buildpack\",\"--ADAPTOR_NAME\",\"adaptor-mpaas-".concat(g,"\",\"--limitation\",\"--debug\"]"),env:"{}",operationType:"build",extraInfo:JSON.stringify({appId:i,doneCommand:"pack",client:"IDE",scene:"IDE",fileFormat:"tar"})},n={value:_fsExtra["default"].readFileSync(c),options:{filename:"".concat(i,".tar"),contentType:"application/zip"}},_.logger.info("cloudBuild req",m),b.next=9,_superagent["default"].post(k).field(m).attach("file",n.value,n.options);case 9:if(o=b.sent,p=o.body,q=void 0===p?{}:p,_.logger.info("cloudBuild res",q),q.success){b.next=15;break}throw new Error(q.msg);case 15:return r=q.data.taskId,b.next=18,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:l,taskId:r});case 18:return s=b.sent,t=s.data,t=void 0===t?{}:t,u=t.zipFile,v=t.plugin,v=void 0===v?{}:v,w=v.artifactUrl,x=t.uploadParams,x=void 0===x?{}:x,y=x.extendInfo,z=w||u,b.next=29,remoteFileToLocal({originFile:z,h5Id:h});case 29:return A=b.sent,b.abrupt("return",{data:_objectSpread(_objectSpread({},A),{},{appxVersion:(0,_.getAppxVersion)({extendInfo:y})}),succes:!0});case 33:throw b.prev=33,b.t0=b["catch"](0),new Error(b.t0.message);case 36:case"end":return b.stop();}},b,null,[[0,33]])}));return function(){return a.apply(this,arguments)}}();exports.cloudBuildAlipay=cloudBuildAlipay;var pollBuildStatusAlipay=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.CLOUD_BUILD_POLL_URL,d=a.taskId,b.prev=1,_.logger.info("pollBuildStatus req",d),b.next=5,_superagent["default"].get(c).query({taskId:d});case 5:if(e=b.sent,f=e.body,g=void 0===f?{}:f,_.logger.info("pollBuildStatus res",g),g.success){b.next=11;break}throw new Error(g.msg);case 11:if("COMPLETE"!==g.status){b.next=13;break}return b.abrupt("return",g);case 13:;return b.next=16,(0,_.delay)(POLL_DELAY_TIME);case 16:return b.next=18,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:c,taskId:d});case 18:return b.abrupt("return",b.sent);case 21:throw b.prev=21,b.t0=b["catch"](1),new Error(b.t0.message);case 24:case"end":return b.stop();}},b,null,[[1,21]])}));return function(){return a.apply(this,arguments)}}();exports.pollBuildStatusAlipay=pollBuildStatusAlipay;var cloudBuildPrivate=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function c(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;return _regenerator["default"].wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,d=a.file,e=a.config,f=void 0===e?{}:e,g=a.h5Id,h=f.appId,i=f.workspaceId,j=f.tenantId,k=getCloudBuildData(f),l=k.CLOUD_BUILD_EXEC_URL,m=k.CLOUD_BUILD_POLL_URL,n={value:_fsExtra["default"].readFileSync(d),options:{filename:"".concat(h,".tar"),contentType:"application/zip"}},_.logger.info("cloudBuild req",{appId:h,workspaceId:i,tenantId:j}),c.next=8,_superagent["default"].post(l).field({appId:h,workspaceId:i,tenantId:j}).attach("file",n.value,n.options);case 8:if(o=c.sent,p=o.body,q=void 0===p?{}:p,_.logger.info("cloudBuild res",q),q.success){c.next=14;break}throw new Error(q.message);case 14:return c.next=16,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:m,buildId:q.data});case 16:return r=c.sent,s=r.data,t=s.downloadUrl,u=s.pluginDownloadUrl,v=u||t,c.next=23,remoteFileToLocal({originFile:v,h5Id:g});case 23:return w=c.sent,c.abrupt("return",{data:_objectSpread(_objectSpread({},w),{},{appxVersion:(0,_.getAppxVersion)({rootPath:b.file})}),succes:!0});case 27:throw c.prev=27,c.t0=c["catch"](0),new Error(c.t0.message);case 30:case"end":return c.stop();}},c,null,[[0,27]])}));return function(){return a.apply(this,arguments)}}();exports.cloudBuildPrivate=cloudBuildPrivate;var pollBuildStatusPrivate=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h,i,j;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.CLOUD_BUILD_POLL_URL,d=a.buildId,b.prev=1,_.logger.info("pollBuildStatus req",{buildId:d}),b.next=5,_superagent["default"].get(c).query({buildId:d});case 5:if(g=b.sent,h=g.body,i=void 0===h?{}:h,_.logger.info("pollBuildStatus res",{body:i}),i.success){b.next=11;break}throw new Error(i.message);case 11:if("FAILURE"!==(null===i||void 0===i||null===(e=i.data)||void 0===e?void 0:e.result)){b.next=13;break}throw new Error(null===i||void 0===i||null===(j=i.data)||void 0===j?void 0:j.logUrl);case 13:;if("SUCCESS"!==(null===i||void 0===i||null===(f=i.data)||void 0===f?void 0:f.result)){b.next=16;break}return b.abrupt("return",i);case 16:;return b.next=19,(0,_.delay)(POLL_DELAY_TIME);case 19:return b.next=21,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:c,buildId:d});case 21:return b.abrupt("return",b.sent);case 24:throw b.prev=24,b.t0=b["catch"](1),new Error(b.t0.message);case 27:case"end":return b.stop();}},b,null,[[1,24]])}));return function(){return a.apply(this,arguments)}}();exports.pollBuildStatusPrivate=pollBuildStatusPrivate;var remoteFileToLocal=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.originFile,d=a.h5Id,b.prev=1,b.next=4,(0,_.downloadFile)({url:c});case 4:return e=b.sent,f=e.data,b.next=8,(0,_.getZipFromTar)({tarFilePath:f,h5Id:d});case 8:return g=b.sent,h=g.data,b.abrupt("return",{file:h,originFile:c});case 13:throw b.prev=13,b.t0=b["catch"](1),new Error(b.t0.message);case 16:case"end":return b.stop();}},b,null,[[1,13]])}));return function(){return a.apply(this,arguments)}}();exports.remoteFileToLocal=remoteFileToLocal;
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.remoteFileToLocal=exports.pollBuildStatusPrivate=exports.pollBuildStatusAlipay=exports.getFile=exports.getCloudBuildData=exports.cloudBuildPrivate=exports.cloudBuildAlipay=exports.cloudBuild=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_superagent=_interopRequireDefault(require("superagent")),_path=_interopRequireDefault(require("path")),_fsExtra=_interopRequireDefault(require("fs-extra")),_=require("./"),_archiver=_interopRequireDefault(require("archiver")),_chalk=_interopRequireDefault(require("chalk")),_excluded=["file"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){(0,_defineProperty2["default"])(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var POLL_DELAY_TIME=4e3,IGNORE_DIR=[".idea",".vscode",".git",".DS_Store",".umi",".umi-production",".miniu",".node",".tea"],getCloudBuildData=function(a){var b=a.build_url,c=void 0===b?null:b;return c?{type:"private",CLOUD_BUILD_EXEC_URL:"".concat(c,"/miniApp/buildIdeMiniApp"),CLOUD_BUILD_POLL_URL:"".concat(c,"/miniApp/queryMiniAppBuildResult")}:{type:"alipay",CLOUD_BUILD_EXEC_URL:"https://hpmweb.alipay.com/tinyApp/cloudBuild/execute",CLOUD_BUILD_POLL_URL:"https://hpmweb.alipay.com/tinyApp/cloudBuild/result"}};exports.getCloudBuildData=getCloudBuildData;var cloudBuild=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return _.logger.info("cloudBuild req",a),b.prev=1,c=a.config,d=a.file,e=(0,_objectWithoutProperties2["default"])(a,_excluded),f=getCloudBuildData(c),b.next=7,getFile({file:d,type:f.type});case 7:if(d=b.sent,g=_objectSpread(_objectSpread({},e),{},{file:d}),h={},"private"!==f.type){b.next=17;break}return _.logger.info("cloudBuild: private"),b.next=14,cloudBuildPrivate(g,a);case 14:h=b.sent,b.next=21;break;case 17:return _.logger.info("cloudBuild: alipay"),b.next=20,cloudBuildAlipay(g);case 20:h=b.sent;case 21:return _.logger.info("cloudBuild res",h),console.log(_chalk["default"].green("cloudBuild done")),b.abrupt("return",h);case 26:return b.prev=26,b.t0=b["catch"](1),_.logger.error("cloudBuild error",b.t0.message),b.next=31,(0,_.delay)(0);case 31:throw new Error(b.t0.message);case 32:case"end":return b.stop();}},b,null,[[1,26]])}));return function(){return a.apply(this,arguments)}}();exports.cloudBuild=cloudBuild;var compressFile=function(a){var b=a.resourceFile,c=a.targetFile,d=a.type;return new Promise(function(a,e){var f=_fsExtra["default"].createWriteStream(c),g=(0,_archiver["default"])("zip",{zlib:{level:9}});g.pipe(f),f.on("close",function(){a(c)}),g.on("error",function(a){e(a)}),"directory"===d?g.directory("".concat(b),""):g.file("".concat(b),{name:_path["default"].basename(b)}),g.finalize()})},getFile=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h,i;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.file,d=a.type,b.prev=1,_fsExtra["default"].existsSync(c)){b.next=4;break}throw new Error("\u6587\u4EF6\u4E0D\u5B58\u5728\uFF01");case 4:if(!_fsExtra["default"].lstatSync(c).isFile()){b.next=8;break}if(".amr"===_path["default"].extname(c)){b.next=7;break}throw new Error("\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF\uFF01");case 7:return b.abrupt("return",c);case 8:if(!_fsExtra["default"].lstatSync(c).isDirectory()){b.next=22;break}return e=(0,_.getTmpDir)(),f=(0,_.getTmpDir)(),_fsExtra["default"].copySync(c,e),b.next=14,compressFile({resourceFile:e,targetFile:_path["default"].join(f,"dist.tar"),type:"directory"});case 14:if(g=b.sent,"alipay"!==d){b.next=17;break}return b.abrupt("return",g);case 17:return h=(0,_.getTmpDir)(),b.next=20,compressFile({resourceFile:_path["default"].join(f,"dist.tar"),targetFile:_path["default"].join(h,"dist.amr")});case 20:return i=b.sent,b.abrupt("return",i);case 22:return b.abrupt("return",c);case 25:throw b.prev=25,b.t0=b["catch"](1),new Error(b.t0.message);case 28:case"end":return b.stop();}},b,null,[[1,25]])}));return function(){return a.apply(this,arguments)}}();exports.getFile=getFile;var cloudBuildAlipay=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.prev=0,c=a.file,d=a.config,e=void 0===d?{}:d,f=a.adaptorId,g=void 0===f?"mPaaS":f,h=a.h5Id,i=e.appId,j=getCloudBuildData(e),k=j.CLOUD_BUILD_EXEC_URL,l=j.CLOUD_BUILD_POLL_URL,m={params:"[\"--scriptName\",\"buildpack\",\"--ADAPTOR_NAME\",\"adaptor-mpaas-".concat(g,"\",\"--limitation\",\"--debug\"]"),env:"{}",operationType:"build",extraInfo:JSON.stringify({appId:h,doneCommand:"pack",client:"IDE",scene:"IDE",fileFormat:"tar"})},n={value:_fsExtra["default"].readFileSync(c),options:{filename:"".concat(h,".tar"),contentType:"application/zip"}},_.logger.info("cloudBuild req",m),b.next=9,_superagent["default"].post(k).field(m).attach("file",n.value,n.options);case 9:if(o=b.sent,p=o.body,q=void 0===p?{}:p,_.logger.info("cloudBuild res",q),q.success){b.next=15;break}throw new Error(q.msg);case 15:return r=q.data.taskId,b.next=18,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:l,taskId:r});case 18:return s=b.sent,t=s.data,t=void 0===t?{}:t,u=t.zipFile,v=t.plugin,v=void 0===v?{}:v,w=v.artifactUrl,x=t.uploadParams,x=void 0===x?{}:x,y=x.extendInfo,z=w||u,b.next=29,remoteFileToLocal({originFile:z,h5Id:h});case 29:return A=b.sent,b.abrupt("return",{data:_objectSpread(_objectSpread({},A),{},{appxVersion:(0,_.getAppxVersion)({extendInfo:y})}),succes:!0});case 33:throw b.prev=33,b.t0=b["catch"](0),new Error(b.t0.message);case 36:case"end":return b.stop();}},b,null,[[0,33]])}));return function(){return a.apply(this,arguments)}}();exports.cloudBuildAlipay=cloudBuildAlipay;var pollBuildStatusAlipay=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.CLOUD_BUILD_POLL_URL,d=a.taskId,b.prev=1,_.logger.info("pollBuildStatus req",d),b.next=5,_superagent["default"].get(c).query({taskId:d});case 5:if(e=b.sent,f=e.body,g=void 0===f?{}:f,_.logger.info("pollBuildStatus res",g),g.success){b.next=11;break}throw new Error(g.msg);case 11:if("COMPLETE"!==g.status){b.next=13;break}return b.abrupt("return",g);case 13:;return b.next=16,(0,_.delay)(POLL_DELAY_TIME);case 16:return b.next=18,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:c,taskId:d});case 18:return b.abrupt("return",b.sent);case 21:throw b.prev=21,b.t0=b["catch"](1),new Error(b.t0.message);case 24:case"end":return b.stop();}},b,null,[[1,21]])}));return function(){return a.apply(this,arguments)}}();exports.pollBuildStatusAlipay=pollBuildStatusAlipay;var cloudBuildPrivate=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function c(a,b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;return _regenerator["default"].wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,d=a.file,e=a.config,f=void 0===e?{}:e,g=a.h5Id,h=f.appId,i=f.workspaceId,j=f.tenantId,k=getCloudBuildData(f),l=k.CLOUD_BUILD_EXEC_URL,m=k.CLOUD_BUILD_POLL_URL,n={value:_fsExtra["default"].readFileSync(d),options:{filename:"".concat(h,".tar"),contentType:"application/zip"}},_.logger.info("cloudBuild req",{appId:h,workspaceId:i,tenantId:j}),c.next=8,_superagent["default"].post(l).field({appId:h,workspaceId:i,tenantId:j}).attach("file",n.value,n.options);case 8:if(o=c.sent,p=o.body,q=void 0===p?{}:p,_.logger.info("cloudBuild res",q),q.success){c.next=14;break}throw new Error(q.message);case 14:return c.next=16,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:m,buildId:q.data});case 16:return r=c.sent,s=r.data,t=s.downloadUrl,u=s.pluginDownloadUrl,v=u||t,c.next=23,remoteFileToLocal({originFile:v,h5Id:g});case 23:return w=c.sent,c.abrupt("return",{data:_objectSpread(_objectSpread({},w),{},{appxVersion:(0,_.getAppxVersion)({rootPath:b.file})}),succes:!0});case 27:throw c.prev=27,c.t0=c["catch"](0),new Error(c.t0.message);case 30:case"end":return c.stop();}},c,null,[[0,27]])}));return function(){return a.apply(this,arguments)}}();exports.cloudBuildPrivate=cloudBuildPrivate;var pollBuildStatusPrivate=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h,i,j;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.CLOUD_BUILD_POLL_URL,d=a.buildId,b.prev=1,_.logger.info("pollBuildStatus req",{buildId:d}),b.next=5,_superagent["default"].get(c).query({buildId:d});case 5:if(g=b.sent,h=g.body,i=void 0===h?{}:h,_.logger.info("pollBuildStatus res",{body:i}),i.success){b.next=11;break}throw new Error(i.message);case 11:if("FAILURE"!==(null===i||void 0===i||null===(e=i.data)||void 0===e?void 0:e.result)){b.next=13;break}throw new Error(null===i||void 0===i||null===(j=i.data)||void 0===j?void 0:j.logUrl);case 13:;if("SUCCESS"!==(null===i||void 0===i||null===(f=i.data)||void 0===f?void 0:f.result)){b.next=16;break}return b.abrupt("return",i);case 16:;return b.next=19,(0,_.delay)(POLL_DELAY_TIME);case 19:return b.next=21,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:c,buildId:d});case 21:return b.abrupt("return",b.sent);case 24:throw b.prev=24,b.t0=b["catch"](1),new Error(b.t0.message);case 27:case"end":return b.stop();}},b,null,[[1,24]])}));return function(){return a.apply(this,arguments)}}();exports.pollBuildStatusPrivate=pollBuildStatusPrivate;var remoteFileToLocal=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f,g,h;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.originFile,d=a.h5Id,b.prev=1,b.next=4,(0,_.downloadFile)({url:c});case 4:return e=b.sent,f=e.data,b.next=8,(0,_.getZipFromTar)({tarFilePath:f,h5Id:d});case 8:return g=b.sent,h=g.data,b.abrupt("return",{file:h,originFile:c});case 13:throw b.prev=13,b.t0=b["catch"](1),new Error(b.t0.message);case 16:case"end":return b.stop();}},b,null,[[1,13]])}));return function(){return a.apply(this,arguments)}}();exports.remoteFileToLocal=remoteFileToLocal;
{
"name": "@alipay-inc/mpaas-ide-openapi-common",
"version": "1.0.11-alpha.7",
"version": "1.0.11-alpha.8",
"main": "dist/index.js",

@@ -34,3 +34,3 @@ "repository": "https://code.alipay.com/mPaaS-IDE-Adaptor/mPaaS-IDE-openAPI.git",

},
"gitHead": "ddf6b62b4c99e4de8a3dd193431d121e31ee1af1"
"gitHead": "3c9b29b27dc69728926d501fccd20731e2e0db65"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc