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
5
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.15-alpha.5 to 1.0.15-alpha.6

2

dist/getUploadData.js

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

"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUploadData=exports.getPluginFiles=exports.getPluginData=exports.getMiniFiles=exports.getMiniData=exports.getExtraData=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")),_index=require("./index.js"),_fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_excluded=["appInfo","packageType","resourceFile","iconFile","whiteListValue","sourceCodeFile","appxVersion","uuid","miniType","pluginFile","subpackageFlag"];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 getUploadSourceFileStatus=function(a){var b=a.sourceCodeFile,c=a.uploadResourceFile,d=a.packageType;_index.logger.info("getUpLoadSource:",b,c,d);try{if(!Array.isArray(c)&&c&&b)return!0;if(!Array.isArray(c)&&!c||!b)return!1;if(Array.isArray(c)&&c.includes("preview")&&"4"==d&&b)return!0;if(Array.isArray(c)&&c.includes("preview")&&"4"==d&&!b)return!1;if(Array.isArray(c)&&c.includes("debug")&&"3"==d&&b)return!0;if(Array.isArray(c)&&c.includes("debug")&&"3"==d&&!b)return!1;if(Array.isArray(c)&&c.includes("upload")&&("1"==d||"2"==d)&&b)return!0;if(Array.isArray(c)&&c.includes("upload")&&("1"==d||"2"==d)&&!b)return!1}catch(a){throw new Error(a.message)}},getUploadData=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;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,b.prev=1,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=e.subpackageFlag,u=void 0!==t&&t,v=(0,_objectWithoutProperties2["default"])(e,_excluded),w={},x=e.h5Version,x||(y=(0,_index.getVersion)(null===i||void 0===i?void 0:i.h5Version).data,x="production"===(0,_index.getPackageType)(j).data?y.nextProd:y.nextDev);;if("plugin"!==r){b.next=14;break}return b.next=10,getPluginData(a);case 10:w=b.sent,w.miniPluginVersion=x,b.next=18;break;case 14:return b.next=16,getMiniData(a);case 16:w=b.sent,w.h5Version=x;case 18:if(0!=j-3){b.next=22;break}if(q){b.next=21;break}throw new Error("\u771F\u673A\u8C03\u8BD5\u5305\u9700\u8981\u4F20\u5165uuid");case 21:w.uuid=q;case 22:if(w.packageType=j,w.subpackageFlag=u,0!=j-4||q||(w.uuid="mockuuid"),j){b.next=27;break}throw new Error("\u6CA1\u6709\u5305\u7C7B\u578B\uFF01");case 27:if("development"!==(0,_index.getPackageType)(j).data){b.next=39;break}if(m){b.next=30;break}throw new Error("\u975E\u6B63\u5F0F\u5305\u9700\u8981\u6709\u767D\u540D\u5355\uFF01");case 30:if(i.whitelistContent===m){b.next=38;break}return b.next=33,g();case 33:if(z=b.sent,z.success){b.next=36;break}throw new Error(z.resultMsg);case 36:b.next=39;break;case 38:console.log("whiteListValue from appInfo",i.whitelistContent);case 39:if("plugin"!==r){b.next=48;break}return b.t0=_objectSpread,b.t1=_objectSpread(_objectSpread({},v),w),b.next=44,getPluginFiles(a);case 44:b.t2=b.sent,w=(0,b.t0)(b.t1,b.t2),b.next=54;break;case 48:return b.t3=_objectSpread,b.t4=_objectSpread(_objectSpread({},v),w),b.next=52,getMiniFiles(a);case 52:b.t5=b.sent,w=(0,b.t3)(b.t4,b.t5);case 54:return b.abrupt("return",w);case 57:throw b.prev=57,b.t6=b["catch"](1),new Error(b.t6.message);case 60:case"end":return b.stop();}},b,null,[[1,57]])}));return function(){return a.apply(this,arguments)}}();exports.getUploadData=getUploadData;var getPluginData=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;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.pluginFile,k=(0,_index.transformPluginParams)(i),l=k.miniPluginName,m=k.miniPluginId,n={miniPluginName:l,miniPluginId:m},j){b.next=6;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u63D2\u4EF6\u8D44\u6E90\u6587\u4EF6\uFF01");case 6:return b.abrupt("return",n);case 7:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getPluginData=getPluginData;var getPluginFiles=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,B,C,D;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=i.h5Id,k||"production"===(0,_index.getPackageType)(j).data){b.next=5;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u5305\u8D44\u6E90\u6587\u4EF6\uFF01");case 5:if(s){b.next=7;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u63D2\u4EF6\u5305\u8D44\u6E90\u6587\u4EF6\uFF01");case 7:u={},b.t0=c,b.next="aliyun"===b.t0?11:26;break;case 11:if(!k){b.next=18;break}return b.next=14,h(k);case 14:if(v=b.sent,v.success){b.next=17;break}throw new Error(v.resultMsg);case 17:u.resourceFileUrl=v.data;case 18:if(!n){b.next=25;break}return b.next=21,h(n);case 21:if(w=b.sent,w.success){b.next=24;break}throw new Error(w.resultMsg);case 24:u.sourceCodeFileUrl=w.data;case 25:return b.abrupt("break",49);case 26:return x=[],b.next=29,(0,_index.getZipFromTar)({tarFilePath:s,h5Id:t});case 29:return y=b.sent,z=y.data,b.t1=_fsExtra["default"],b.t2=_path["default"],b.next=35,(0,_index.getTmpDir)();case 35:return b.t3=b.sent,b.t4=t,b.t5=b.t2.resolve.call(b.t2,b.t3,b.t4),A=b.t1.emptydirSync.call(b.t1,b.t5),B=_path["default"].resolve(A,"".concat(t,"-miniProgram.zip")),C=_path["default"].resolve(A,"".concat(t,"-plugin.zip")),_fsExtra["default"].copySync(k,B),_fsExtra["default"].copySync(z,C),b.next=45,(0,_index.getZipFile)({files:[B,C],h5Id:t});case 45:return D=b.sent,x.push({name:"resourceFile",file:D}),u.files=x,b.abrupt("break",49);case 49:return b.abrupt("return",u);case 50:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getPluginFiles=getPluginFiles;var getMiniData=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,B,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 c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=e.bindMiniPluginIds,u=d.appId,v=d.workspaceId,w=d.tenantId,x=d.userId,y=d.uuid_url,z=i||{},A=z.h5Id,B=z.h5Name,C=z.mainUrl,D=z.suburl,E=void 0===D?"":D,F=z.autoInstall,G=z.resourceType,H=z.installType,I=z.platform,J=z.clientVersionMin,K=z.clientVersionMax,L=getExtraData(i),M=L.extendInfo,N=void 0===M?{}:M,O=L.extraData,P=void 0===O?{}:O,Q=P.enableTabBar,R=void 0===Q?"1":Q,S=P.enableOptionMenu,T=void 0===S?"1":S,U=P.enableKeepAlive,V=void 0===U?"0":U,W={appId:u,workspaceId:v,tenantId:w,userId:x,h5Id:A,h5Name:B,mainUrl:C,suburl:E,extendInfo:N,autoInstall:F,resourceType:G,installType:H,platform:I,clientVersionMin:J,clientVersionMax:K,enableTabBar:R,enableOptionMenu:T,enableKeepAlive:V,packageType:1*j,appxVersion:p},t&&(W.bindMiniPluginIds=t),b.next=10,f();case 10:if(X=b.sent,X.success){b.next=13;break}throw new Error(X.resultMsg);case 13:if(X.data){b.next=15;break}throw new Error("\u65E0\u865A\u62DF\u57DF\u540D\uFF0C\u9700\u8981\u5148\u81F3\u63A7\u5236\u53F0\u8BBE\u7F6E\u865A\u62DF\u57DF\u540D");case 15:return console.log("qs.vhost",A,X.data),W.vhost="".concat(A,".").concat(X.data),b.abrupt("return",W);case 18:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getMiniData=getMiniData;var getMiniFiles=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,B,C,D;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=d.uploadResourceFile,u=void 0!==t&&t,k){b.next=5;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u5305\u8D44\u6E90\u6587\u4EF6\uFF01");case 5:v=getExtraData(i),w=v.extraData,x=void 0===w?{}:w,y=x.iconUrl,z={},b.t0=c,b.next="aliyun"===b.t0?11:37;break;case 11:if(!k){b.next=18;break}return b.next=14,h(k);case 14:if(A=b.sent,A.success){b.next=17;break}throw new Error(A.resultMsg);case 17:z.resourceFileUrl=A.data;case 18:if(!l){b.next=27;break}return b.next=21,h(l);case 21:if(B=b.sent,B.success){b.next=24;break}throw new Error(B.resultMsg);case 24:z.iconFileUrl=B.data,b.next=28;break;case 27:y&&(z.iconUrl=y);case 28:;if(!getUploadSourceFileStatus({sourceCodeFile:n,uploadResourceFile:u,packageType:j})){b.next=36;break}return b.next=32,h(n);case 32:if(C=b.sent,C.success){b.next=35;break}throw new Error(C.resultMsg);case 35:z.sourceCodeFileUrl=C.data;case 36:return b.abrupt("break",43);case 37:D=[{name:"resourceFile",file:k}],l?D.push({name:"iconFile",file:l}):y&&(z.iconUrl=y);;return getUploadSourceFileStatus({sourceCodeFile:n,uploadResourceFile:u,packageType:j})&&D.push({name:"sourceCodeFile",file:n}),z.files=D,b.abrupt("break",43);case 43:return b.abrupt("return",z);case 44:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getMiniFiles=getMiniFiles;var getExtraData=function(a){var b=a.extendInfo,c=void 0===b?"":b,d=a.extraData,e=void 0===d?"":d;try{var f=(0,_index.looseJsonParse)(e);e=f.data}catch(a){try{var g=(0,_index.looseJsonParse)(e);e=g.data}catch(a){throw new Error(a)}}var h=e,i=h.enableTabBar,j=void 0===i?"1":i,k=h.enableOptionMenu,l=void 0===k?"1":k,m=h.enableKeepAlive,n=void 0===m?"0":m,o=h.iconUrl;return c=c.replace(/&quot;|&amp;quot;/ig,"\""),{extraData:e,extendInfo:c}};exports.getExtraData=getExtraData;
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUploadData=exports.getPluginFiles=exports.getPluginData=exports.getMiniFiles=exports.getMiniData=exports.getExtraData=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")),_index=require("./index.js"),_fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_excluded=["appInfo","packageType","resourceFile","iconFile","whiteListValue","sourceCodeFile","appxVersion","uuid","miniType","pluginFile","subpackageFlag"];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 getUploadSourceFileStatus=function(a){var b=a.sourceCodeFile,c=a.uploadResourceFile,d=a.packageType;_index.logger.info("getUpLoadSource:",b,c,d);try{if(!Array.isArray(c)&&c&&b)return!0;if(!Array.isArray(c)&&!c||!b)return!1;if(Array.isArray(c)&&c.includes("preview")&&"4"==d&&b)return!0;if(Array.isArray(c)&&c.includes("preview")&&"4"==d&&!b)return!1;if(Array.isArray(c)&&c.includes("debug")&&"3"==d&&b)return!0;if(Array.isArray(c)&&c.includes("debug")&&"3"==d&&!b)return!1;if(Array.isArray(c)&&c.includes("upload")&&("1"==d||"2"==d)&&b)return!0;if(Array.isArray(c)&&c.includes("upload")&&("1"==d||"2"==d)&&!b)return!1}catch(a){throw new Error(a.message)}},getUploadData=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;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,b.prev=1,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=e.subpackageFlag,u=void 0!==t&&t,v=(0,_objectWithoutProperties2["default"])(e,_excluded),w={},x=e.h5Version,x||(y=(0,_index.getVersion)(null===i||void 0===i?void 0:i.h5Version).data,x="production"===(0,_index.getPackageType)(j).data?y.nextProd:y.nextDev);;if("plugin"!==r){b.next=14;break}return b.next=10,getPluginData(a);case 10:w=b.sent,w.miniPluginVersion=x,b.next=18;break;case 14:return b.next=16,getMiniData(a);case 16:w=b.sent,w.h5Version=x;case 18:if(0!=j-3){b.next=22;break}if(q){b.next=21;break}throw new Error("\u771F\u673A\u8C03\u8BD5\u5305\u9700\u8981\u4F20\u5165uuid");case 21:w.uuid=q;case 22:if(w.packageType=j,w.subpackageFlag=u,0!=j-4||q||(w.uuid="mockuuid"),j){b.next=27;break}throw new Error("\u6CA1\u6709\u5305\u7C7B\u578B\uFF01");case 27:if("development"!==(0,_index.getPackageType)(j).data){b.next=39;break}if(m){b.next=30;break}throw new Error("\u975E\u6B63\u5F0F\u5305\u9700\u8981\u6709\u767D\u540D\u5355\uFF01");case 30:if(i.whitelistContent===m){b.next=38;break}return b.next=33,g();case 33:if(z=b.sent,z.success){b.next=36;break}throw new Error(z.resultMsg);case 36:b.next=39;break;case 38:console.log("whiteListValue from appInfo",i.whitelistContent);case 39:if("plugin"!==r){b.next=48;break}return b.t0=_objectSpread,b.t1=_objectSpread(_objectSpread({},v),w),b.next=44,getPluginFiles(a);case 44:b.t2=b.sent,w=(0,b.t0)(b.t1,b.t2),b.next=54;break;case 48:return b.t3=_objectSpread,b.t4=_objectSpread(_objectSpread({},v),w),b.next=52,getMiniFiles(a);case 52:b.t5=b.sent,w=(0,b.t3)(b.t4,b.t5);case 54:return b.abrupt("return",w);case 57:throw b.prev=57,b.t6=b["catch"](1),new Error(b.t6.message);case 60:case"end":return b.stop();}},b,null,[[1,57]])}));return function(){return a.apply(this,arguments)}}();exports.getUploadData=getUploadData;var getPluginData=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;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.pluginFile,k=(0,_index.transformPluginParams)(i),l=k.miniPluginName,m=k.miniPluginId,n={miniPluginName:l,miniPluginId:m},j){b.next=6;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u63D2\u4EF6\u8D44\u6E90\u6587\u4EF6\uFF01");case 6:return b.abrupt("return",n);case 7:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getPluginData=getPluginData;var getPluginFiles=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,B,C,D;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=i.h5Id,k||"production"===(0,_index.getPackageType)(j).data){b.next=5;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u5305\u8D44\u6E90\u6587\u4EF6\uFF01");case 5:if(s){b.next=7;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u63D2\u4EF6\u5305\u8D44\u6E90\u6587\u4EF6\uFF01");case 7:u={},b.t0=c,b.next="aliyun"===b.t0?11:26;break;case 11:if(!k){b.next=18;break}return b.next=14,h(k);case 14:if(v=b.sent,v.success){b.next=17;break}throw new Error(v.resultMsg);case 17:u.resourceFileUrl=v.data;case 18:if(!n){b.next=25;break}return b.next=21,h(n);case 21:if(w=b.sent,w.success){b.next=24;break}throw new Error(w.resultMsg);case 24:u.sourceCodeFileUrl=w.data;case 25:return b.abrupt("break",49);case 26:return x=[],b.next=29,(0,_index.getZipFromTar)({tarFilePath:s,h5Id:t});case 29:return y=b.sent,z=y.data,b.t1=_fsExtra["default"],b.t2=_path["default"],b.next=35,(0,_index.getTmpDir)();case 35:return b.t3=b.sent,b.t4=t,b.t5=b.t2.resolve.call(b.t2,b.t3,b.t4),A=b.t1.emptydirSync.call(b.t1,b.t5),B=_path["default"].resolve(A,"".concat(t,"-miniProgram.zip")),C=_path["default"].resolve(A,"".concat(t,"-plugin.zip")),_fsExtra["default"].copySync(k,B),_fsExtra["default"].copySync(z,C),b.next=45,(0,_index.getZipFile)({files:[B,C],h5Id:t});case 45:return D=b.sent,x.push({name:"resourceFile",file:D}),u.files=x,b.abrupt("break",49);case 49:return b.abrupt("return",u);case 50:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getPluginFiles=getPluginFiles;var getMiniData=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,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=e.bindMiniPluginIds,u=d.appId,v=d.workspaceId,w=d.tenantId,x=d.userId,y=d.uuid_url,z=i||{},A=z.h5Id,B=z.h5Name,C=z.mainUrl,D=z.suburl,E=void 0===D?"":D,F=z.autoInstall,G=z.resourceType,H=void 0===G?"4":G,I=z.installType,J=z.platform,K=z.clientVersionMin,L=z.clientVersionMax,M=getExtraData(i),N=M.extendInfo,O=void 0===N?{}:N,P=M.extraData,Q=void 0===P?{}:P,R=Q.enableTabBar,S=void 0===R?"1":R,T=Q.enableOptionMenu,U=void 0===T?"1":T,V=Q.enableKeepAlive,W=void 0===V?"0":V,X={appId:u,workspaceId:v,tenantId:w,userId:x,h5Id:A,h5Name:B,mainUrl:C,suburl:E,extendInfo:O,autoInstall:F,resourceType:H,installType:I,platform:J,clientVersionMin:K,clientVersionMax:L,enableTabBar:S,enableOptionMenu:U,enableKeepAlive:W,packageType:1*j,appxVersion:p},t&&(X.bindMiniPluginIds=t),b.next=10,f();case 10:if(Y=b.sent,Y.success){b.next=13;break}throw new Error(Y.resultMsg);case 13:if(Y.data){b.next=15;break}throw new Error("\u65E0\u865A\u62DF\u57DF\u540D\uFF0C\u9700\u8981\u5148\u81F3\u63A7\u5236\u53F0\u8BBE\u7F6E\u865A\u62DF\u57DF\u540D");case 15:return console.log("qs.vhost",A,Y.data),X.vhost="".concat(A,".").concat(Y.data),b.abrupt("return",X);case 18:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getMiniData=getMiniData;var getMiniFiles=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,B,C,D;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c=a.type,d=a.config,e=a.req,f=a.getVhostByApi,g=a.createWhitelistByApi,h=a.uploadFile,i=e.appInfo,j=e.packageType,k=e.resourceFile,l=e.iconFile,m=e.whiteListValue,n=e.sourceCodeFile,o=e.appxVersion,p=void 0===o?"1.0":o,q=e.uuid,r=e.miniType,s=e.pluginFile,t=d.uploadResourceFile,u=void 0!==t&&t,k){b.next=5;break}throw new Error("\u6CA1\u6709\u5C0F\u7A0B\u5E8F\u5305\u8D44\u6E90\u6587\u4EF6\uFF01");case 5:v=getExtraData(i),w=v.extraData,x=void 0===w?{}:w,y=x.iconUrl,z={},b.t0=c,b.next="aliyun"===b.t0?11:37;break;case 11:if(!k){b.next=18;break}return b.next=14,h(k);case 14:if(A=b.sent,A.success){b.next=17;break}throw new Error(A.resultMsg);case 17:z.resourceFileUrl=A.data;case 18:if(!l){b.next=27;break}return b.next=21,h(l);case 21:if(B=b.sent,B.success){b.next=24;break}throw new Error(B.resultMsg);case 24:z.iconFileUrl=B.data,b.next=28;break;case 27:y&&(z.iconUrl=y);case 28:;if(!getUploadSourceFileStatus({sourceCodeFile:n,uploadResourceFile:u,packageType:j})){b.next=36;break}return b.next=32,h(n);case 32:if(C=b.sent,C.success){b.next=35;break}throw new Error(C.resultMsg);case 35:z.sourceCodeFileUrl=C.data;case 36:return b.abrupt("break",43);case 37:D=[{name:"resourceFile",file:k}],l?D.push({name:"iconFile",file:l}):y&&(z.iconUrl=y);;return getUploadSourceFileStatus({sourceCodeFile:n,uploadResourceFile:u,packageType:j})&&D.push({name:"sourceCodeFile",file:n}),z.files=D,b.abrupt("break",43);case 43:return b.abrupt("return",z);case 44:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getMiniFiles=getMiniFiles;var getExtraData=function(a){var b=a.extendInfo,c=void 0===b?"{}":b,d=a.extraData,e=void 0===d?"{}":d;try{var f=(0,_index.looseJsonParse)(e);e=f.data}catch(a){try{var g=(0,_index.looseJsonParse)(e);e=g.data}catch(a){throw new Error(a)}}var h=e,i=h.enableTabBar,j=void 0===i?"1":i,k=h.enableOptionMenu,l=void 0===k?"1":k,m=h.enableKeepAlive,n=void 0===m?"0":m,o=h.iconUrl;return c=c.replace(/&quot;|&amp;quot;/ig,"\""),{extraData:e,extendInfo:c}};exports.getExtraData=getExtraData;

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

"use strict";var _exportNames={logger:!0,uuid:!0,delay:!0,getConfigType:!0,getUserInfo:!0,setUserInfo:!0,login:!0,logout:!0,defaultTinyappConfig:!0,getDefaultTinyappConfig:!0,getDefaultPluginConfig:!0,getTmpDirRoot:!0,getTmpDir:!0,cleanCache:!0,getVersion:!0,getUUID:!0,getZipFile:!0,getZipFromTar:!0,getPackageType:!0,looseJsonParse:!0,downloadFile:!0,appInfoToVariables:!0,variablesToappInfo:!0,parseDebugURL:!0,getUploadResult:!0,transformPluginParams:!0,isValidatedJsonString:!0,getAppxVersion:!0,localStore:!0};var _getUploadData=require("./getUploadData");var _detect=require("./detect");var _localStore=_interopRequireWildcard(require("./localStorage"));var _excluded=["config"],_excluded2=["data"];var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_typeof3=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:!0});exports.variablesToappInfo=exports.uuid=exports.transformPluginParams=exports.setUserInfo=exports.parseDebugURL=exports.looseJsonParse=exports.logout=exports.login=exports.logger=exports.localStore=exports.isValidatedJsonString=exports.getZipFromTar=exports.getZipFile=exports.getVersion=exports.getUserInfo=exports.getUploadResult=exports.getUUID=exports.getTmpDirRoot=exports.getTmpDir=exports.getPackageType=exports.getDefaultTinyappConfig=exports.getDefaultPluginConfig=exports.getConfigType=exports.getAppxVersion=exports.downloadFile=exports.delay=exports.defaultTinyappConfig=exports.cleanCache=exports.appInfoToVariables=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_archiver=_interopRequireDefault(require("archiver")),_isElectron=_interopRequireDefault(require("is-electron")),_os=require("os"),_path=_interopRequireDefault(require("path")),_superagent=_interopRequireDefault(require("superagent")),_tar=_interopRequireDefault(require("tar")),_fsExtra=_interopRequireWildcard(require("fs-extra")),_log4js=_interopRequireDefault(require("log4js")),_queryString=_interopRequireDefault(require("query-string")),_cloudBuild=require("./cloudBuild");Object.keys(_cloudBuild).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_cloudBuild[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _cloudBuild[a]}})});Object.keys(_getUploadData).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_getUploadData[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _getUploadData[a]}})});Object.keys(_detect).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_detect[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _detect[a]}})});exports.localStore=_localStore;function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof3(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d["default"]=a,c&&c.set(a,d),d}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 uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=0|16*Math.random(),c="x"==a?b:8|3&b;return c.toString(16)})};exports.uuid=uuid;var tmpdirRoot="".concat((0,_os.tmpdir)(),"/.mpaas_ide_openapi"),delay=function(a){return new Promise(function(b){return setTimeout(b,a)})};exports.delay=delay;var getConfigType=function(a){var b="",c=a.openapi;if(!c)b="classic";else{var d=c.type;"aliyun"===d?b="aliyun":"antfin"===d&&(b="antfin")}return{data:b,success:!0}};exports.getConfigType=getConfigType;var userInfo={},getUserInfo=function(){return userInfo};exports.getUserInfo=getUserInfo;var setUserInfo=function(a){var b=a.id;a.userId=b,userInfo=a};exports.setUserInfo=setUserInfo;var login=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;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:c=a.config,d=(0,_objectWithoutProperties2["default"])(a,_excluded),b.prev=1,e=getConfigType(c),f=e.data,g={},b.t0=f,b.next="classic"===b.t0?7:23;break;case 7:return h=c.login_url,i=d.username,j=d.password,k=c.sign,l={loginName:i.toLowerCase(),password:j,sign:k,config:JSON.stringify(c)},b.next=13,_superagent["default"].post(h).field(l).accept("json");case 13:if(m=b.sent,n=m.body,o=void 0===n?{}:n,g=o.data,p=g,q=p.success,r=p.data,s=p.message,q){b.next=20;break}throw new Error(s);case 20:return r.userId=r.userId||r.id,setUserInfo(r),b.abrupt("break",27);case 23:return t=c.openapi,u=void 0===t?{}:t,v=u.userId,g={data:{id:v,loginName:v,nickName:v,realName:v,userId:v},success:!0},setUserInfo(g.data),b.abrupt("break",27);case 27:return b.abrupt("return",g);case 30:throw b.prev=30,b.t1=b["catch"](1),new Error(b.t1.message);case 33:case"end":return b.stop();}},b,null,[[1,30]])}));return function(){return a.apply(this,arguments)}}();exports.login=login;var logout=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,localStore.removeUserInfo();case 3:return a.next=5,localStore.removeAppInfo();case 5:return a.abrupt("return",{success:!0});case 8:throw a.prev=8,a.t0=a["catch"](0),new Error(a.t0.message);case 11:case"end":return a.stop();}},a,null,[[0,8]])}));return function(){return a.apply(this,arguments)}}();exports.logout=logout;var defaultTinyappConfig={appCode:"",autoInstall:1,clientVersionMax:"",clientVersionMin:"0.0.0.0;0.0.0.0",downloadUrl:"",debugUrl:"",extendInfo:"",extraData:"{\"enableKeepAlive\":\"0\",\"enableOptionMenu\":\"1\",\"enableTabBar\":\"0\",\"iconUrl\":\"\",\"resourceType\":\"4\"}",fallbackBaseUrl:"",fileSize:"",gmtCreate:"",gmtModified:"",h5Version:"1.0.0.0",installType:1,lazyLoad:0,mainUrl:"/index.html#pages/index/index",md5:"",memo:"",modifier:"success",platform:"all",publishPeriod:5,releaseVersion:"",resourceType:"4",status:1};exports.defaultTinyappConfig=defaultTinyappConfig;var getDefaultTinyappConfig=function(a){return{data:_objectSpread(_objectSpread({},defaultTinyappConfig),a),success:!0}};exports.getDefaultTinyappConfig=getDefaultTinyappConfig;var getDefaultPluginConfig=function(a){var b=a.data,c=a.req;return{data:_objectSpread(_objectSpread({h5Version:"1.0.0.0"},c),b),success:!0}};exports.getDefaultPluginConfig=getDefaultPluginConfig;var getTmpDirRoot=function(){var a=(0,_fsExtra.existsSync)(tmpdirRoot);return a||(0,_fsExtra.mkdirSync)(tmpdirRoot),tmpdirRoot};exports.getTmpDirRoot=getTmpDirRoot;var getTmpDir=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"appid",b=getTmpDirRoot(),c="".concat(b,"/").concat(a,"_").concat(new Date().valueOf(),"_").concat(uuid()),d=(0,_fsExtra.existsSync)(c);return d||(0,_fsExtra.mkdirSync)(c),c};exports.getTmpDir=getTmpDir;var cleanCache=function(){try{var a=getTmpDirRoot();return(0,_fsExtra.emptydirSync)(a),{data:"OK",success:!0}}catch(a){throw new Error(a.message)}};exports.cleanCache=cleanCache;var getVersion=function(a){try{var b=a.split("."),c=(0,_slicedToArray2["default"])(b,4),d=c[0],e=c[1],f=c[2],g=c[3],h=void 0===g?0:g,i=[d,e,f,h].join("."),j=[d,e,1*f+1,0].join("."),k=[d,e,f,1*h+1].join(".");return{data:{current:i,nextProd:j,nextDev:k},success:!0}}catch(a){throw new Error(a)}};exports.getVersion=getVersion;var getUUID=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.uuid_url,b.prev=1,b.next=4,_superagent["default"].get(c);case 4:return b.next=6,b.sent;case 6:return d=b.sent,e=d.text,b.abrupt("return",{data:e,success:!0});case 11:throw b.prev=11,b.t0=b["catch"](1),new Error(b.t0);case 14:case"end":return b.stop();}},b,null,[[1,11]])}));return function(){return a.apply(this,arguments)}}();exports.getUUID=getUUID;var getZipFile=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.pathname,d=a.version,e=a.h5Id,f=a.files,b.abrupt("return",new Promise(function(a,b){var g=getTmpDir();(0,_fsExtra.ensureDirSync)(g);try{var h="".concat(g,"/").concat(e,".zip");d&&(h="".concat(g,"/").concat(e,"_").concat(d.replace(/\./ig,"_"),".zip"));var i=(0,_fsExtra.createWriteStream)(h),j=(0,_archiver["default"])("zip",{zlib:{level:9}});j.pipe(i),i.on("close",function(){a(h)}),j.on("error",function(a){b(a)}),c?j.directory("".concat(c),e):f.forEach(function(a){j.append(_fsExtra["default"].createReadStream(a),{name:_path["default"].basename(a)})}),j.finalize()}catch(a){(0,_fsExtra.removeSync)(g),b(a)}}));case 2:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getZipFile=getZipFile;var getZipFromTar=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(){var b,c,d,e,f,g,h=arguments;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=0<h.length&&void 0!==h[0]?h[0]:{},c=b.tarFilePath,d=b.h5Id,e=getTmpDir(),f=_path["default"].join(e,d),(0,_fsExtra.ensureDirSync)(f),a.prev=4,a.next=7,_tar["default"].x({file:_path["default"].resolve(c),cwd:f});case 7:return a.next=9,getZipFile({pathname:f,h5Id:d});case 9:return g=a.sent,a.abrupt("return",{data:g,success:!0});case 13:throw a.prev=13,a.t0=a["catch"](4),new Error(a.t0.message);case 16:return a.prev=16,(0,_fsExtra.removeSync)(e),a.finish(16);case 19:case"end":return a.stop();}},a,null,[[4,13,16,19]])}));return function(){return a.apply(this,arguments)}}();exports.getZipFromTar=getZipFromTar;var printLog=function(){for(var a,b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=c,f=["%c[mpaas_ide_openapi]","color: blue;"];if(Array.isArray(c))try{f[0]="".concat(f[0]," %c").concat(c[0]),f.push("color: red;"),e=c.slice(1)}catch(a){console.log(a)}(a=console).log.apply(a,f.concat((0,_toConsumableArray2["default"])(e)))},showLog=function(a,b,c){if(c){var d=(0,_isElectron["default"])(),e=null!==c&&void 0!==c&&c.root?_path["default"].resolve(c.root):_path["default"].resolve((0,_os.homedir)(),".mpaas_log");(0,_fsExtra.ensureDirSync)(e);var f=d?"mpaas_ide":"mpaas_ide_openapi",g=_path["default"].resolve(e,f);_log4js["default"].configure({appenders:{"[mpaas_ide_openapi]":{type:"dateFile",filename:g,pattern:"yyyy-MM-dd.log",alwaysIncludePattern:!0,category:"normal"}},categories:{default:{appenders:["[mpaas_ide_openapi]"],level:"trace"}}}),_log4js["default"].getLogger("[mpaas_ide_openapi]")[a](JSON.stringify(b)),printLog.apply(void 0,(0,_toConsumableArray2["default"])(b))}},logger={trace:function trace(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("trace",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},info:function info(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("info",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},warn:function warn(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("warn",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},error:function error(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("error",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},debug:function debug(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("debug",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)}};exports.logger=logger;var getPackageType=function(a){return{data:["1","2",1,2].includes(a)?"production":"development",success:!0}};exports.getPackageType=getPackageType;var looseJsonParse=function(a){try{return{data:Function("\"use strict\";return (".concat(a,")"))(),success:!0}}catch(b){return{data:JSON.parse(a.replace(/&quot;/ig,"\"")),success:!0}}};exports.looseJsonParse=looseJsonParse;var downloadFile=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:if(c=a.url,d=a.target,b.prev=1,b.t0=d,b.t0){b.next=7;break}return b.next=6,getTmpDir();case 6:b.t0=b.sent;case 7:return e=b.t0,f="".concat(uuid()).concat(_path["default"].extname(new URL(c).pathname)),g=_path["default"].join(e,f),b.next=12,_superagent["default"].get(c);case 12:return h=b.sent,b.next=15,(0,_fsExtra.writeFileSync)(g,h.body,"binary");case 15:return b.abrupt("return",{data:g,success:!0});case 18:throw b.prev=18,b.t1=b["catch"](1),new Error(b.t1.message);case 21:case"end":return b.stop();}},b,null,[[1,18]])}));return function(){return a.apply(this,arguments)}}();exports.downloadFile=downloadFile;var appInfoToVariables=function(a){var b,c,d,e,f,g,h=a.h5Id,i=a.platform,j=a.clientVersionMin,k=a.clientVersionMax,l=a.mainUrl,m=void 0===l?"/index.html#pages/index/index":l,n=a.extraData,o=a.extendInfo,p=a.autoInstall,q=void 0===p?"0":p,r=a.installType,s=void 0===r?"0":r,t=a.iconFile,u=n&&looseJsonParse(n.replace(/&quot;|&amp;quot;/gi,"\"")),v=u.data,w=void 0===v?{}:v,x=w.iconUrl,y=void 0===x?"":x,z=w.enableTabBar,A=void 0===z?"1":z,B=w.enableOptionMenu,C=void 0===B?"1":B,D=j&&j.split(";"),E=k&&k.split(";");switch(i){case"all":b=!0,c=!0,d=D&&D[0],e=E&&E[0],f=D&&D[1],g=E&&E[1];break;case"iOS":b=!0,c=!1,d=D&&D[0],e=E&&E[0];break;case"android":b=!1,c=!0,f=D&&D[1],g=E&&E[1];break;default:b=!1,c=!1;}return{h5Id:h,mainUrl:m,autoInstall:q,installType:s,iconFile:t,extendInfo:o.replace(/&quot;|&amp;quot;/gi,"\""),iconUrl:y,enableTabBar:A,enableOptionMenu:C,enableKeepAlive:"0",platformIOS:b,platformAndroid:c,iosMinVersion:d,iosMaxVersion:e,androidMinVersion:f,androidMaxVersion:g}};exports.appInfoToVariables=appInfoToVariables;var variablesToappInfo=function(a){var b,c,d,e=a.h5Id,f=a.h5Name,g=a.mainUrl,h=a.subUrl,i=void 0===h?"":h,j=a.iconFile,k=void 0===j?"":j,l=a.resourceType,m=a.platformIOS,n=a.platformAndroid,o=a.iosMinVersion,p=void 0===o?"":o,q=a.iosMaxVersion,r=void 0===q?"":q,s=a.androidMinVersion,t=void 0===s?"":s,u=a.androidMaxVersion,v=void 0===u?"":u,w=a.autoInstall,x=a.installType,y=a.enableKeepAlive,z=a.enableOptionMenu,A=a.enableTabBar,B=a.extendInfo,C=a.iconUrl,D=a.vhost;return m&&n?(b="all",c="".concat(p).concat(t?";".concat(t):""),d="".concat(r).concat(v?";".concat(v):"")):m?(b="iOS",c="".concat(p),d="".concat(r)):n&&(b="android",c="".concat(t?";".concat(t):""),d="".concat(v?";".concat(v):"")),{h5Id:e,h5Name:f,mainUrl:g,iconFile:k,subUrl:i,vhost:D,enableKeepAlive:y,enableOptionMenu:z,enableTabBar:A,iconUrl:C,resourceType:l,autoInstall:w,installType:x,extendInfo:B,platform:b,clientVersionMin:c,clientVersionMax:d}};exports.variablesToappInfo=variablesToappInfo;var parseDebugURL=function(a){var b;try{b=a.data.replace(/&amp;/ig,"&"),b=looseJsonParse(b)}catch(c){b=a}return b};exports.parseDebugURL=parseDebugURL;var getUploadResult=function(a){var b=a.res,c=a.h5Version,d=a.req;try{var e=parseDebugURL(b),f=e.data,g=(0,_objectWithoutProperties2["default"])(e,_excluded2);"object"!==(0,_typeof2["default"])(f)&&(f={projectId:f}),f=_objectSpread(_objectSpread({},f),{},{h5Version:c,gmtCreate:new Date().valueOf()});var h=d.packageType,i=d.buildTarget;if(0==h-3&&("RemoteBoatman"===i||i.startsWith("RemoteX"))){var j=f,k=j.debugUrl;k=decodeURIComponent(k);var l=k.match(/mpaas.*?scheme=mpaas:\/\/platformapi\/startapp\?/gi)[0],m=k.replace(l,"");m=_queryString["default"].parse(m),delete m.enablePolyfillWorker,delete m.isRemoteDebug,m.tyroId=m.channelId,m.isRemoteX=!0,m=_queryString["default"].stringify(m),m=encodeURIComponent(m),k=l+m,f.debugUrl=k}return _objectSpread(_objectSpread({},g),{},{data:f,originData:e})}catch(a){throw new Error(a.message)}};exports.getUploadResult=getUploadResult;var transformPluginParams=function(a){var b=a.h5Id,c=a.h5Name,d=a.h5Version,e=a.miniPluginName,f=a.miniPluginId,g=a.miniPluginVersion,h=_objectSpread({},a);return b&&(h.miniPluginId=b),c&&(h.miniPluginName=c),d&&(h.miniPluginVersion=d),f&&(h.h5Id=f),e&&(h.h5Name=e),g&&(h.h5Version=g),h};exports.transformPluginParams=transformPluginParams;var isValidatedJsonString=function(a){if("string"==typeof a)try{var b=JSON.parse(a);return!!("object"==(0,_typeof2["default"])(b)&&b)}catch(a){return!1}};exports.isValidatedJsonString=isValidatedJsonString;var getAppxVersion=function(a){var b=a.extendInfo,c=void 0===b?"{}":b,d=a.rootPath,e="1.0";if(d){var f=_path["default"].join(d,"mini.project.json");if(_fsExtra["default"].existsSync(f)){var g=_fsExtra["default"].readJsonSync(f);e=g.enableAppxNg?"2.0":"1.0"}}else if(c){var h,i;e=isValidatedJsonString(c)&&"YES"===(null===(h=JSON.parse(c))||void 0===h||null===(i=h.launchParams)||void 0===i?void 0:i.appxRouteFramework)?"2.0":"1.0"}return e};exports.getAppxVersion=getAppxVersion;
"use strict";var _exportNames={logger:!0,uuid:!0,delay:!0,isValidatedJsonString:!0,getConfigType:!0,getUserInfo:!0,setUserInfo:!0,login:!0,logout:!0,defaultTinyappConfig:!0,getDefaultTinyappConfig:!0,getDefaultPluginConfig:!0,getTmpDirRoot:!0,getTmpDir:!0,cleanCache:!0,getVersion:!0,getUUID:!0,getZipFile:!0,getZipFromTar:!0,getPackageType:!0,looseJsonParse:!0,downloadFile:!0,appInfoToVariables:!0,variablesToappInfo:!0,parseDebugURL:!0,getUploadResult:!0,transformPluginParams:!0,getAppxVersion:!0,localStore:!0};var _getUploadData=require("./getUploadData");var _detect=require("./detect");var _localStore=_interopRequireWildcard(require("./localStorage"));var _excluded=["config"],_excluded2=["data"];var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_typeof3=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:!0});exports.variablesToappInfo=exports.uuid=exports.transformPluginParams=exports.setUserInfo=exports.parseDebugURL=exports.looseJsonParse=exports.logout=exports.login=exports.logger=exports.localStore=exports.isValidatedJsonString=exports.getZipFromTar=exports.getZipFile=exports.getVersion=exports.getUserInfo=exports.getUploadResult=exports.getUUID=exports.getTmpDirRoot=exports.getTmpDir=exports.getPackageType=exports.getDefaultTinyappConfig=exports.getDefaultPluginConfig=exports.getConfigType=exports.getAppxVersion=exports.downloadFile=exports.delay=exports.defaultTinyappConfig=exports.cleanCache=exports.appInfoToVariables=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_archiver=_interopRequireDefault(require("archiver")),_isElectron=_interopRequireDefault(require("is-electron")),_os=require("os"),_path=_interopRequireDefault(require("path")),_superagent=_interopRequireDefault(require("superagent")),_tar=_interopRequireDefault(require("tar")),_fsExtra=_interopRequireWildcard(require("fs-extra")),_log4js=_interopRequireDefault(require("log4js")),_queryString=_interopRequireDefault(require("query-string")),_cloudBuild=require("./cloudBuild");Object.keys(_cloudBuild).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_cloudBuild[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _cloudBuild[a]}})});Object.keys(_getUploadData).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_getUploadData[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _getUploadData[a]}})});Object.keys(_detect).forEach(function(a){"default"===a||"__esModule"===a||Object.prototype.hasOwnProperty.call(_exportNames,a)||a in exports&&exports[a]===_detect[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _detect[a]}})});exports.localStore=_localStore;function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof3(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d["default"]=a,c&&c.set(a,d),d}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 uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=0|16*Math.random(),c="x"==a?b:8|3&b;return c.toString(16)})};exports.uuid=uuid;var tmpdirRoot="".concat((0,_os.tmpdir)(),"/.mpaas_ide_openapi"),delay=function(a){return new Promise(function(b){return setTimeout(b,a)})};exports.delay=delay;var isValidatedJsonString=function(a){if("string"==typeof a)try{var b=JSON.parse(a);return!!("object"==(0,_typeof2["default"])(b)&&b)}catch(a){return!1}};exports.isValidatedJsonString=isValidatedJsonString;var getConfigType=function(a){var b="",c=a.openapi;if(!c)b="classic";else{var d=c.type;"aliyun"===d?b="aliyun":"antfin"===d&&(b="antfin")}return{data:b,success:!0}};exports.getConfigType=getConfigType;var userInfo={},getUserInfo=function(){return userInfo};exports.getUserInfo=getUserInfo;var setUserInfo=function(a){var b=a.id;a.userId=b,userInfo=a};exports.setUserInfo=setUserInfo;var login=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;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:c=a.config,d=(0,_objectWithoutProperties2["default"])(a,_excluded),b.prev=1,e=getConfigType(c),f=e.data,g={},b.t0=f,b.next="classic"===b.t0?7:23;break;case 7:return h=c.login_url,i=d.username,j=d.password,k=c.sign,l={loginName:i.toLowerCase(),password:j,sign:k,config:JSON.stringify(c)},b.next=13,_superagent["default"].post(h).field(l).accept("json");case 13:if(m=b.sent,n=m.body,o=void 0===n?{}:n,g=o.data,p=g,q=p.success,r=p.data,s=p.message,q){b.next=20;break}throw new Error(s);case 20:return r.userId=r.userId||r.id,setUserInfo(r),b.abrupt("break",27);case 23:return t=c.openapi,u=void 0===t?{}:t,v=u.userId,g={data:{id:v,loginName:v,nickName:v,realName:v,userId:v},success:!0},setUserInfo(g.data),b.abrupt("break",27);case 27:return b.abrupt("return",g);case 30:throw b.prev=30,b.t1=b["catch"](1),new Error(b.t1.message);case 33:case"end":return b.stop();}},b,null,[[1,30]])}));return function(){return a.apply(this,arguments)}}();exports.login=login;var logout=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,localStore.removeUserInfo();case 3:return a.next=5,localStore.removeAppInfo();case 5:return a.abrupt("return",{success:!0});case 8:throw a.prev=8,a.t0=a["catch"](0),new Error(a.t0.message);case 11:case"end":return a.stop();}},a,null,[[0,8]])}));return function(){return a.apply(this,arguments)}}();exports.logout=logout;var defaultTinyappConfig={appCode:"",autoInstall:1,clientVersionMax:"",clientVersionMin:"0.0.0.0;0.0.0.0",downloadUrl:"",debugUrl:"",extendInfo:"",extraData:"{\"enableKeepAlive\":\"0\",\"enableOptionMenu\":\"1\",\"enableTabBar\":\"0\",\"iconUrl\":\"\",\"resourceType\":\"4\"}",fallbackBaseUrl:"",fileSize:"",gmtCreate:"",gmtModified:"",h5Version:"1.0.0.0",installType:1,lazyLoad:0,mainUrl:"/index.html#pages/index/index",md5:"",memo:"",modifier:"success",platform:"all",publishPeriod:5,releaseVersion:"",resourceType:"4",status:1};exports.defaultTinyappConfig=defaultTinyappConfig;var getDefaultTinyappConfig=function(a){return{data:_objectSpread(_objectSpread({},defaultTinyappConfig),a),success:!0}};exports.getDefaultTinyappConfig=getDefaultTinyappConfig;var getDefaultPluginConfig=function(a){var b=a.data,c=a.req;return{data:_objectSpread(_objectSpread({h5Version:"1.0.0.0"},c),b),success:!0}};exports.getDefaultPluginConfig=getDefaultPluginConfig;var getTmpDirRoot=function(){var a=(0,_fsExtra.existsSync)(tmpdirRoot);return a||(0,_fsExtra.mkdirSync)(tmpdirRoot),tmpdirRoot};exports.getTmpDirRoot=getTmpDirRoot;var getTmpDir=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"appid",b=getTmpDirRoot(),c="".concat(b,"/").concat(a,"_").concat(new Date().valueOf(),"_").concat(uuid()),d=(0,_fsExtra.existsSync)(c);return d||(0,_fsExtra.mkdirSync)(c),c};exports.getTmpDir=getTmpDir;var cleanCache=function(){try{var a=getTmpDirRoot();return(0,_fsExtra.emptydirSync)(a),{data:"OK",success:!0}}catch(a){throw new Error(a.message)}};exports.cleanCache=cleanCache;var getVersion=function(a){try{var b=a.split("."),c=(0,_slicedToArray2["default"])(b,4),d=c[0],e=c[1],f=c[2],g=c[3],h=void 0===g?0:g,i=[d,e,f,h].join("."),j=[d,e,1*f+1,0].join("."),k=[d,e,f,1*h+1].join(".");return{data:{current:i,nextProd:j,nextDev:k},success:!0}}catch(a){throw new Error(a)}};exports.getVersion=getVersion;var getUUID=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.uuid_url,b.prev=1,b.next=4,_superagent["default"].get(c);case 4:return b.next=6,b.sent;case 6:return d=b.sent,e=d.text,b.abrupt("return",{data:e,success:!0});case 11:throw b.prev=11,b.t0=b["catch"](1),new Error(b.t0);case 14:case"end":return b.stop();}},b,null,[[1,11]])}));return function(){return a.apply(this,arguments)}}();exports.getUUID=getUUID;var getZipFile=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(a){var c,d,e,f;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return c=a.pathname,d=a.version,e=a.h5Id,f=a.files,b.abrupt("return",new Promise(function(a,b){var g=getTmpDir();(0,_fsExtra.ensureDirSync)(g);try{var h="".concat(g,"/").concat(e,".zip");d&&(h="".concat(g,"/").concat(e,"_").concat(d.replace(/\./ig,"_"),".zip"));var i=(0,_fsExtra.createWriteStream)(h),j=(0,_archiver["default"])("zip",{zlib:{level:9}});j.pipe(i),i.on("close",function(){a(h)}),j.on("error",function(a){b(a)}),c?j.directory("".concat(c),e):f.forEach(function(a){j.append(_fsExtra["default"].createReadStream(a),{name:_path["default"].basename(a)})}),j.finalize()}catch(a){(0,_fsExtra.removeSync)(g),b(a)}}));case 2:case"end":return b.stop();}},b)}));return function(){return a.apply(this,arguments)}}();exports.getZipFile=getZipFile;var getZipFromTar=function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(){var b,c,d,e,f,g,h=arguments;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return b=0<h.length&&void 0!==h[0]?h[0]:{},c=b.tarFilePath,d=b.h5Id,e=getTmpDir(),f=_path["default"].join(e,d),(0,_fsExtra.ensureDirSync)(f),a.prev=4,a.next=7,_tar["default"].x({file:_path["default"].resolve(c),cwd:f});case 7:return a.next=9,getZipFile({pathname:f,h5Id:d});case 9:return g=a.sent,a.abrupt("return",{data:g,success:!0});case 13:throw a.prev=13,a.t0=a["catch"](4),new Error(a.t0.message);case 16:return a.prev=16,(0,_fsExtra.removeSync)(e),a.finish(16);case 19:case"end":return a.stop();}},a,null,[[4,13,16,19]])}));return function(){return a.apply(this,arguments)}}();exports.getZipFromTar=getZipFromTar;var printLog=function(){for(var a,b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];var e=c,f=["%c[mpaas_ide_openapi]","color: blue;"];if(Array.isArray(c))try{f[0]="".concat(f[0]," %c").concat(c[0]),f.push("color: red;"),e=c.slice(1)}catch(a){console.log(a)}(a=console).log.apply(a,f.concat((0,_toConsumableArray2["default"])(e)))},showLog=function(a,b,c){if(c){var d=(0,_isElectron["default"])(),e=null!==c&&void 0!==c&&c.root?_path["default"].resolve(c.root):_path["default"].resolve((0,_os.homedir)(),".mpaas_log");(0,_fsExtra.ensureDirSync)(e);var f=d?"mpaas_ide":"mpaas_ide_openapi",g=_path["default"].resolve(e,f);_log4js["default"].configure({appenders:{"[mpaas_ide_openapi]":{type:"dateFile",filename:g,pattern:"yyyy-MM-dd.log",alwaysIncludePattern:!0,category:"normal"}},categories:{default:{appenders:["[mpaas_ide_openapi]"],level:"trace"}}}),_log4js["default"].getLogger("[mpaas_ide_openapi]")[a](JSON.stringify(b)),printLog.apply(void 0,(0,_toConsumableArray2["default"])(b))}},logger={trace:function trace(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("trace",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},info:function info(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("info",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},warn:function warn(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("warn",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},error:function error(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("error",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)},debug:function debug(){for(var a,b,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];return showLog("debug",d,null===(a=global)||void 0===a||null===(b=a.mpaasOpenApi)||void 0===b?void 0:b.log)}};exports.logger=logger;var getPackageType=function(a){return{data:["1","2",1,2].includes(a)?"production":"development",success:!0}};exports.getPackageType=getPackageType;var looseJsonParse=function(a){try{return{data:Function("\"use strict\";return (".concat(a,")"))(),success:!0}}catch(d){var b=a.replace(/&quot;/ig,"\"");if(!b)return{data:"{}",success:!0};var c=isValidatedJsonString(b)?JSON.parse(b):b;return{data:c,success:!0}}};exports.looseJsonParse=looseJsonParse;var downloadFile=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:if(c=a.url,d=a.target,b.prev=1,b.t0=d,b.t0){b.next=7;break}return b.next=6,getTmpDir();case 6:b.t0=b.sent;case 7:return e=b.t0,f="".concat(uuid()).concat(_path["default"].extname(new URL(c).pathname)),g=_path["default"].join(e,f),b.next=12,_superagent["default"].get(c);case 12:return h=b.sent,b.next=15,(0,_fsExtra.writeFileSync)(g,h.body,"binary");case 15:return b.abrupt("return",{data:g,success:!0});case 18:throw b.prev=18,b.t1=b["catch"](1),new Error(b.t1.message);case 21:case"end":return b.stop();}},b,null,[[1,18]])}));return function(){return a.apply(this,arguments)}}();exports.downloadFile=downloadFile;var appInfoToVariables=function(a){var b,c,d,e,f,g,h=a.h5Id,i=a.platform,j=a.clientVersionMin,k=a.clientVersionMax,l=a.mainUrl,m=void 0===l?"/index.html#pages/index/index":l,n=a.extraData,o=a.extendInfo,p=a.autoInstall,q=void 0===p?"0":p,r=a.installType,s=void 0===r?"0":r,t=a.iconFile,u=n&&looseJsonParse(n.replace(/&quot;|&amp;quot;/gi,"\"")),v=u.data,w=void 0===v?{}:v,x=w.iconUrl,y=void 0===x?"":x,z=w.enableTabBar,A=void 0===z?"1":z,B=w.enableOptionMenu,C=void 0===B?"1":B,D=j&&j.split(";"),E=k&&k.split(";");switch(i){case"all":b=!0,c=!0,d=D&&D[0],e=E&&E[0],f=D&&D[1],g=E&&E[1];break;case"iOS":b=!0,c=!1,d=D&&D[0],e=E&&E[0];break;case"android":b=!1,c=!0,f=D&&D[1],g=E&&E[1];break;default:b=!1,c=!1;}return{h5Id:h,mainUrl:m,autoInstall:q,installType:s,iconFile:t,extendInfo:o.replace(/&quot;|&amp;quot;/gi,"\""),iconUrl:y,enableTabBar:A,enableOptionMenu:C,enableKeepAlive:"0",platformIOS:b,platformAndroid:c,iosMinVersion:d,iosMaxVersion:e,androidMinVersion:f,androidMaxVersion:g}};exports.appInfoToVariables=appInfoToVariables;var variablesToappInfo=function(a){var b,c,d,e=a.h5Id,f=a.h5Name,g=a.mainUrl,h=a.subUrl,i=void 0===h?"":h,j=a.iconFile,k=void 0===j?"":j,l=a.resourceType,m=a.platformIOS,n=a.platformAndroid,o=a.iosMinVersion,p=void 0===o?"":o,q=a.iosMaxVersion,r=void 0===q?"":q,s=a.androidMinVersion,t=void 0===s?"":s,u=a.androidMaxVersion,v=void 0===u?"":u,w=a.autoInstall,x=a.installType,y=a.enableKeepAlive,z=a.enableOptionMenu,A=a.enableTabBar,B=a.extendInfo,C=a.iconUrl,D=a.vhost;return m&&n?(b="all",c="".concat(p).concat(t?";".concat(t):""),d="".concat(r).concat(v?";".concat(v):"")):m?(b="iOS",c="".concat(p),d="".concat(r)):n&&(b="android",c="".concat(t?";".concat(t):""),d="".concat(v?";".concat(v):"")),{h5Id:e,h5Name:f,mainUrl:g,iconFile:k,subUrl:i,vhost:D,enableKeepAlive:y,enableOptionMenu:z,enableTabBar:A,iconUrl:C,resourceType:l,autoInstall:w,installType:x,extendInfo:B,platform:b,clientVersionMin:c,clientVersionMax:d}};exports.variablesToappInfo=variablesToappInfo;var parseDebugURL=function(a){var b;try{b=a.data.replace(/&amp;/ig,"&"),b=looseJsonParse(b)}catch(c){b=a}return b};exports.parseDebugURL=parseDebugURL;var getUploadResult=function(a){var b=a.res,c=a.h5Version,d=a.req;try{var e=parseDebugURL(b),f=e.data,g=(0,_objectWithoutProperties2["default"])(e,_excluded2);"object"!==(0,_typeof2["default"])(f)&&(f={projectId:f}),f=_objectSpread(_objectSpread({},f),{},{h5Version:c,gmtCreate:new Date().valueOf()});var h=d.packageType,i=d.buildTarget;if(0==h-3&&("RemoteBoatman"===i||i.startsWith("RemoteX"))){var j=f,k=j.debugUrl;k=decodeURIComponent(k);var l=k.match(/mpaas.*?scheme=mpaas:\/\/platformapi\/startapp\?/gi)[0],m=k.replace(l,"");m=_queryString["default"].parse(m),delete m.enablePolyfillWorker,delete m.isRemoteDebug,m.tyroId=m.channelId,m.isRemoteX=!0,m=_queryString["default"].stringify(m),m=encodeURIComponent(m),k=l+m,f.debugUrl=k}return _objectSpread(_objectSpread({},g),{},{data:f,originData:e})}catch(a){throw new Error(a.message)}};exports.getUploadResult=getUploadResult;var transformPluginParams=function(a){var b=a.h5Id,c=a.h5Name,d=a.h5Version,e=a.miniPluginName,f=a.miniPluginId,g=a.miniPluginVersion,h=_objectSpread({},a);return b&&(h.miniPluginId=b),c&&(h.miniPluginName=c),d&&(h.miniPluginVersion=d),f&&(h.h5Id=f),e&&(h.h5Name=e),g&&(h.h5Version=g),h};exports.transformPluginParams=transformPluginParams;var getAppxVersion=function(a){var b=a.extendInfo,c=void 0===b?"{}":b,d=a.rootPath,e="1.0";if(d){var f=_path["default"].join(d,"mini.project.json");if(_fsExtra["default"].existsSync(f)){var g=_fsExtra["default"].readJsonSync(f);e=g.enableAppxNg?"2.0":"1.0"}}else if(c){var h,i;e=isValidatedJsonString(c)&&"YES"===(null===(h=JSON.parse(c))||void 0===h||null===(i=h.launchParams)||void 0===i?void 0:i.appxRouteFramework)?"2.0":"1.0"}return e};exports.getAppxVersion=getAppxVersion;
{
"name": "@alipay-inc/mpaas-ide-openapi-common",
"version": "1.0.15-alpha.5",
"version": "1.0.15-alpha.6",
"main": "dist/index.js",

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

},
"gitHead": "a627e6aa11417f8c1d2fa5dd299edd5ff4da60f8"
"gitHead": "b0af27d880066d64d44ab26fec045d488a56a889"
}
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