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.4 to 1.0.11-alpha.5

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"],APPX_VERSION_MAP={"1.0":{enableAppxNg:!1},"2.0":{enableAppxNg:!0},mixed:{enableAppxNg:!0,uniBuild:!0}},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,i,j;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.appxVersion,e=void 0===d?"mixed":d,f=a.file,g=(0,_objectWithoutProperties2["default"])(a,_excluded),h=getCloudBuildData(c),b.next=7,getFile({file:f,type:h.type,appxVersion:e});case 7:if(f=b.sent,i=_objectSpread(_objectSpread({},g),{},{file:f}),"private"!==h.type){b.next=14;break}return _.logger.info("cloudBuild: private"),b.next=13,cloudBuildPrivate(i);case 13:return b.abrupt("return",b.sent);case 14:return _.logger.info("cloudBuild: alipay"),b.next=17,cloudBuildAlipay(i);case 17:return j=b.sent,_.logger.info("cloudBuild res",j),console.log(_chalk["default"].green("cloudBuild done")),b.abrupt("return",j);case 23:return b.prev=23,b.t0=b["catch"](1),_.logger.error("cloudBuild error",b.t0.message),b.next=28,(0,_.delay)(0);case 28:throw new Error(b.t0.message);case 29:case"end":return b.stop();}},b,null,[[1,23]])}));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()})},setAppxVersion=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:if(c=a.path,d=a.appxVersion,e=void 0===d?"mixed":d,!1!==e&&APPX_VERSION_MAP[e]){b.next=3;break}return b.abrupt("return");case 3:console.log(_chalk["default"].cyan("appx\u6A21\u5F0F\uFF1A".concat(e))),f={},g=_path["default"].join(c,"mini.project.json");try{f=_fsExtra["default"].readJsonSync(g)}catch(a){}f=_objectSpread(_objectSpread({},f),APPX_VERSION_MAP[e]),b.prev=8,_fsExtra["default"].writeJSONSync(g,f),b.next=15;break;case 12:throw b.prev=12,b.t0=b["catch"](8),new Error(b.t0.message);case 15:case"end":return b.stop();}},b,null,[[8,12]])}));return function(){return a.apply(this,arguments)}}(),getFile=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:if(c=a.file,d=a.type,e=a.appxVersion,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=24;break}return f=(0,_.getTmpDir)(),g=(0,_.getTmpDir)(),_fsExtra["default"].copySync(c,f),b.next=14,setAppxVersion({path:f,appxVersion:e});case 14:return b.next=16,compressFile({resourceFile:f,targetFile:_path["default"].join(g,"dist.tar"),type:"directory"});case 16:if(h=b.sent,"alipay"!==d){b.next=19;break}return b.abrupt("return",h);case 19:return i=(0,_.getTmpDir)(),b.next=22,compressFile({resourceFile:_path["default"].join(g,"dist.tar"),targetFile:_path["default"].join(i,"dist.amr")});case 22:return j=b.sent,b.abrupt("return",j);case 24:return b.abrupt("return",c);case 27:throw b.prev=27,b.t0=b["catch"](1),new Error(b.t0.message);case 30:case"end":return b.stop();}},b,null,[[1,27]])}));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;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"}},b.next=8,_superagent["default"].post(k).field(m).attach("file",n.value,n.options);case 8:if(o=b.sent,p=o.body,q=void 0===p?{}:p,q.success){b.next=13;break}throw new Error(q.msg);case 13:return r=q.data.taskId,b.next=16,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:l,taskId:r});case 16:return s=b.sent,t=s.data,t=void 0===t?{}:t,u=t.zipFile,b.next=22,remoteFileToLocal({originFile:u,h5Id:h});case 22:return b.abrupt("return",b.sent);case 25:throw b.prev=25,b.t0=b["catch"](0),new Error(b.t0.message);case 28:case"end":return b.stop();}},b,null,[[0,25]])}));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,b.next=4,_superagent["default"].get(c).query({taskId:d});case 4:if(e=b.sent,f=e.body,g=void 0===f?{}:f,g.success){b.next=9;break}throw new Error(g.msg);case 9:if("COMPLETE"!==g.status){b.next=11;break}return b.abrupt("return",g);case 11:;return b.next=14,(0,_.delay)(POLL_DELAY_TIME);case 14:return b.next=16,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:c,taskId:d});case 16:return b.abrupt("return",b.sent);case 19:throw b.prev=19,b.t0=b["catch"](1),new Error(b.t0.message);case 22:case"end":return b.stop();}},b,null,[[1,19]])}));return function(){return a.apply(this,arguments)}}();exports.pollBuildStatusAlipay=pollBuildStatusAlipay;var cloudBuildPrivate=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;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.h5Id,g=e.appId,h=e.workspaceId,i=e.tenantId,j=getCloudBuildData(e),k=j.CLOUD_BUILD_EXEC_URL,l=j.CLOUD_BUILD_POLL_URL,m={value:_fsExtra["default"].readFileSync(c),options:{filename:"".concat(g,".tar"),contentType:"application/zip"}},b.next=7,_superagent["default"].post(k).field({appId:g,workspaceId:h,tenantId:i}).attach("file",m.value,m.options);case 7:if(n=b.sent,o=n.body,p=void 0===o?{}:o,p.success){b.next=12;break}throw new Error(p.message);case 12:return b.next=14,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:l,buildId:p.data});case 14:return q=b.sent,r=q.data.downloadUrl,b.next=18,remoteFileToLocal({originFile:r,h5Id:f});case 18:return b.abrupt("return",b.sent);case 21:throw b.prev=21,b.t0=b["catch"](0),new Error(b.t0.message);case 24:case"end":return b.stop();}},b,null,[[0,21]])}));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,b.next=4,_superagent["default"].get(c).query({buildId:d});case 4:if(g=b.sent,h=g.body,i=void 0===h?{}:h,i.success){b.next=9;break}throw new Error(i.message);case 9:if("FAILURE"!==(null===i||void 0===i||null===(e=i.data)||void 0===e?void 0:e.result)){b.next=11;break}throw new Error(null===i||void 0===i||null===(j=i.data)||void 0===j?void 0:j.logUrl);case 11:;if("SUCCESS"!==(null===i||void 0===i||null===(f=i.data)||void 0===f?void 0:f.result)){b.next=14;break}return b.abrupt("return",i);case 14:;return b.next=17,(0,_.delay)(POLL_DELAY_TIME);case 17:return b.next=19,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:c,buildId:d});case 19:return b.abrupt("return",b.sent);case 22:throw b.prev=22,b.t0=b["catch"](1),new Error(b.t0.message);case 25:case"end":return b.stop();}},b,null,[[1,22]])}));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",{data:{file:h,originFile:c},success:!0});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"],APPX_VERSION_MAP={"1.0":{enableAppxNg:!1},"2.0":{enableAppxNg:!0},mixed:{enableAppxNg:!0,uniBuild:!0}},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,i,j;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.appxVersion,e=void 0===d?"mixed":d,f=a.file,g=(0,_objectWithoutProperties2["default"])(a,_excluded),h=getCloudBuildData(c),b.next=7,getFile({file:f,type:h.type,appxVersion:e});case 7:if(f=b.sent,i=_objectSpread(_objectSpread({},g),{},{file:f}),"private"!==h.type){b.next=14;break}return _.logger.info("cloudBuild: private"),b.next=13,cloudBuildPrivate(i);case 13:return b.abrupt("return",b.sent);case 14:return _.logger.info("cloudBuild: alipay"),b.next=17,cloudBuildAlipay(i);case 17:return j=b.sent,_.logger.info("cloudBuild res",j),console.log(_chalk["default"].green("cloudBuild done")),b.abrupt("return",j);case 23:return b.prev=23,b.t0=b["catch"](1),_.logger.error("cloudBuild error",b.t0.message),b.next=28,(0,_.delay)(0);case 28:throw new Error(b.t0.message);case 29:case"end":return b.stop();}},b,null,[[1,23]])}));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()})},setAppxVersion=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:if(c=a.path,d=a.appxVersion,e=void 0===d?"mixed":d,!1!==e&&APPX_VERSION_MAP[e]){b.next=3;break}return b.abrupt("return");case 3:console.log(_chalk["default"].cyan("appx\u6A21\u5F0F\uFF1A".concat(e))),f={},g=_path["default"].join(c,"mini.project.json");try{f=_fsExtra["default"].readJsonSync(g)}catch(a){}f=_objectSpread(_objectSpread({},f),APPX_VERSION_MAP[e]),b.prev=8,_fsExtra["default"].writeJSONSync(g,f),b.next=15;break;case 12:throw b.prev=12,b.t0=b["catch"](8),new Error(b.t0.message);case 15:case"end":return b.stop();}},b,null,[[8,12]])}));return function(){return a.apply(this,arguments)}}(),getFile=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:if(c=a.file,d=a.type,e=a.appxVersion,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=24;break}return f=(0,_.getTmpDir)(),g=(0,_.getTmpDir)(),_fsExtra["default"].copySync(c,f),b.next=14,setAppxVersion({path:f,appxVersion:e});case 14:return b.next=16,compressFile({resourceFile:f,targetFile:_path["default"].join(g,"dist.tar"),type:"directory"});case 16:if(h=b.sent,"alipay"!==d){b.next=19;break}return b.abrupt("return",h);case 19:return i=(0,_.getTmpDir)(),b.next=22,compressFile({resourceFile:_path["default"].join(g,"dist.tar"),targetFile:_path["default"].join(i,"dist.amr")});case 22:return j=b.sent,b.abrupt("return",j);case 24:return b.abrupt("return",c);case 27:throw b.prev=27,b.t0=b["catch"](1),new Error(b.t0.message);case 30:case"end":return b.stop();}},b,null,[[1,27]])}));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;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"}},b.next=8,_superagent["default"].post(k).field(m).attach("file",n.value,n.options);case 8:if(o=b.sent,p=o.body,q=void 0===p?{}:p,q.success){b.next=13;break}throw new Error(q.msg);case 13:return r=q.data.taskId,b.next=16,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:l,taskId:r});case 16: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=w||u,b.next=25,remoteFileToLocal({originFile:x,h5Id:h});case 25:return b.abrupt("return",b.sent);case 28:throw b.prev=28,b.t0=b["catch"](0),new Error(b.t0.message);case 31:case"end":return b.stop();}},b,null,[[0,28]])}));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,b.next=4,_superagent["default"].get(c).query({taskId:d});case 4:if(e=b.sent,f=e.body,g=void 0===f?{}:f,g.success){b.next=9;break}throw new Error(g.msg);case 9:if("COMPLETE"!==g.status){b.next=11;break}return b.abrupt("return",g);case 11:;return b.next=14,(0,_.delay)(POLL_DELAY_TIME);case 14:return b.next=16,pollBuildStatusAlipay({CLOUD_BUILD_POLL_URL:c,taskId:d});case 16:return b.abrupt("return",b.sent);case 19:throw b.prev=19,b.t0=b["catch"](1),new Error(b.t0.message);case 22:case"end":return b.stop();}},b,null,[[1,19]])}));return function(){return a.apply(this,arguments)}}();exports.pollBuildStatusAlipay=pollBuildStatusAlipay;var cloudBuildPrivate=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;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.h5Id,g=e.appId,h=e.workspaceId,i=e.tenantId,j=getCloudBuildData(e),k=j.CLOUD_BUILD_EXEC_URL,l=j.CLOUD_BUILD_POLL_URL,m={value:_fsExtra["default"].readFileSync(c),options:{filename:"".concat(g,".tar"),contentType:"application/zip"}},b.next=7,_superagent["default"].post(k).field({appId:g,workspaceId:h,tenantId:i}).attach("file",m.value,m.options);case 7:if(n=b.sent,o=n.body,p=void 0===o?{}:o,p.success){b.next=12;break}throw new Error(p.message);case 12:return b.next=14,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:l,buildId:p.data});case 14:return q=b.sent,r=q.data,s=r.downloadUrl,t=r.pluginDownloadUrl,u=t||s,b.next=21,remoteFileToLocal({originFile:u,h5Id:f});case 21:return b.abrupt("return",b.sent);case 24:throw b.prev=24,b.t0=b["catch"](0),new Error(b.t0.message);case 27:case"end":return b.stop();}},b,null,[[0,24]])}));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,b.next=4,_superagent["default"].get(c).query({buildId:d});case 4:if(g=b.sent,h=g.body,i=void 0===h?{}:h,i.success){b.next=9;break}throw new Error(i.message);case 9:if("FAILURE"!==(null===i||void 0===i||null===(e=i.data)||void 0===e?void 0:e.result)){b.next=11;break}throw new Error(null===i||void 0===i||null===(j=i.data)||void 0===j?void 0:j.logUrl);case 11:;if("SUCCESS"!==(null===i||void 0===i||null===(f=i.data)||void 0===f?void 0:f.result)){b.next=14;break}return b.abrupt("return",i);case 14:;return b.next=17,(0,_.delay)(POLL_DELAY_TIME);case 17:return b.next=19,pollBuildStatusPrivate({CLOUD_BUILD_POLL_URL:c,buildId:d});case 19:return b.abrupt("return",b.sent);case 22:throw b.prev=22,b.t0=b["catch"](1),new Error(b.t0.message);case 25:case"end":return b.stop();}},b,null,[[1,22]])}));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",{data:{file:h,originFile:c},success:!0});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.4",
"version": "1.0.11-alpha.5",
"main": "dist/index.js",

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

},
"gitHead": "ffabc9840d174b2fe8572dadf23ef25202ab4dd4"
"gitHead": "a53bd421aa3185aa580a7b1605c9556a4f84b13f"
}
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