@alipay-inc/mpaas-ide-openapi-aliyun
Advanced tools
Comparing version 1.0.0-beta.19 to 1.0.0-beta.20
@@ -1,13 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_superagent=_interopRequireDefault(require("superagent")),_fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_mpaasIdeOpenapiCommon=require("@alipay-inc/mpaas-ide-openapi-common"),_utils=_interopRequireDefault(require("./utils"));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 OpenAPI=/*#__PURE__*/function(){function a(b){var c=this;(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"getPackageInfoByApi",/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b){var d,e,f,g,h;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=b.h5Id,e=b.h5Name,f=b.packageTypes,g=void 0===f?"1,2,3,4":f,a.prev=1,a.next=4,c.request({name:"listMcubeMiniPackages",resultKey:"listMiniPackageResult",dataKey:"miniPackageList",req:{h5Id:d,h5Name:e,packageTypes:g}});case 4:if(h=a.sent,h.success){a.next=7;break}throw new Error(h.resultMsg);case 7:;// 若success 并且 data有数据,则表示已发布过一次 | ||
if(!h.data[0]){a.next=10;break}return a.abrupt("return",c.request({name:"queryMcubeMiniPackage",resultKey:"queryMiniPackageResult",dataKey:"miniPackageInfo",req:{h5Id:d,id:h.data[0].id}}));case 10:return(0,_mpaasIdeOpenapiCommon.logger)("\u672A\u62C9\u53D6\u5230\u5C0F\u7A0B\u5E8F\u914D\u7F6E\uFF0C\u5C06\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E"),a.abrupt("return",{data:getDefaultTinyappConfig({h5Id:d,h5Name:e}).data,success:!0});case 14:throw a.prev=14,a.t0=a["catch"](1),new Error(a.t0.message);case 17:case"end":return a.stop();}},a,null,[[1,14]])}));return function(){return a.apply(this,arguments)}}()),(0,_defineProperty2["default"])(this,"uploadPackageByApi",/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b){var d,e,f;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,d=c.config.userId,e=b.whiteListValue,a.next=5,(0,_mpaasIdeOpenapiCommon.getUploadData)({// 类型,用来分别处理 | ||
type:"aliyun",config:c.config,req:b,// 拉取虚拟域名的接口 | ||
getVhostByApi:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return c.methods.queryMcubeVhost(_objectSpread({},a))},createWhitelistByApi:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return c.methods.createMcubeWhitelistForIde(_objectSpread(_objectSpread({},a),{},{whitelistValue:e,userId:d}))},// 上传文件的接口 目前看仅限aliyun | ||
uploadFile:function(a){return c.methods.uploadFile({filePath:a})}});case 5:return f=a.sent,f.onexFlag=!0,console.log(f),a.next=10,c.request({name:"uploadMcubeMiniPackage",resultKey:"uploadMiniPackageResult",dataKey:"returnPackageResult",req:f});case 10:return a.abrupt("return",a.sent);case 13:throw a.prev=13,a.t0=a["catch"](0),new Error(a.t0.message);case 16:case"end":return a.stop();}},a,null,[[0,13]])}));return function(){return a.apply(this,arguments)}}()),this.config=b;// 创建request方法 | ||
var d=new _utils["default"](this.config),e=d.request;this.request=e,this.createMethods()}// 内部方法 | ||
return(0,_createClass2["default"])(a,[{key:"createMethods",value:function createMethods(){var a=this;this.methods={// 创建小程序白名单 | ||
createMcubeWhitelistForIde:function createMcubeWhitelistForIde(b){var c=b.userId,d=b.whitelistValue;return a.request({name:"createMcubeWhitelistForIde",resultKey:"createWhitelistForIdeResult",dataKey:"whitelistId",req:{userId:c,whitelistValue:d}})},// 获取上传文件 token | ||
getMcubeFileToken:function getMcubeFileToken(){return a.request({name:"getMcubeFileToken",resultKey:"getFileTokenResult",dataKey:"fileToken",req:{onexFlag:!0}})},// 获取上传文件 token | ||
queryMcubeVhost:function queryMcubeVhost(){return a.request({name:"queryMcubeVhost",resultKey:"queryVhostResult",dataKey:"data"})},// 上传文件 | ||
uploadFile:function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(c){var 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 d=c.filePath,b.prev=1,e=_fsExtra["default"].readFileSync(d),f=_path["default"].basename(d).replace(/\s/g,"_"),b.next=6,a.methods.getMcubeFileToken();case 6:return g=b.sent,h=g.data,h=void 0===h?{}:h,i=h.host,j=h.accessid,k=h.policy,l=h.signature,m=h.dir,n=void 0===m?"":m,o="".concat(n,"/").concat(f),p="".concat(i,"/").concat(o),q={Key:o,Name:f,Policy:k,OSSAccessKeyId:j,success_action_status:"200",Signature:l,OnexFlag:!0,File:e},b.next=15,_superagent["default"].post(i).field(q);case 15:return r=b.sent,b.abrupt("return",{data:p,errorCode:"",success:!0});case 19:throw b.prev=19,b.t0=b["catch"](1),new Error(b.t0);case 22:case"end":return b.stop();}},b,null,[[1,19]])}));return function uploadFile(){return b.apply(this,arguments)}}()}}// 获取小程序列表 | ||
},{key:"getAppListByApi",value:function getAppListByApi(){return this.request({name:"listMcubeMiniApps",resultKey:"listMiniResult",dataKey:"miniProgramList"})}// 获取小程序包信息 | ||
}]),a}(),_default=OpenAPI;exports["default"]=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_superagent=_interopRequireDefault(require("superagent")),_fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_mpaasIdeOpenapiCommon=require("@alipay-inc/mpaas-ide-openapi-common"),_utils=_interopRequireDefault(require("./utils"));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 OpenAPI=function(){function a(b){var c=this;(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"getPackageInfoByApi",function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(b){var d,e,f,g,h;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return d=b.h5Id,e=b.h5Name,f=b.packageTypes,g=void 0===f?"1,2,3,4":f,a.prev=1,a.next=4,c.request({name:"listMcubeMiniPackages",resultKey:"listMiniPackageResult",dataKey:"miniPackageList",req:{h5Id:d,h5Name:e,packageTypes:g}});case 4:if(h=a.sent,h.success){a.next=7;break}throw new Error(h.resultMsg);case 7:;if(!h.data[0]){a.next=10;break}return a.abrupt("return",c.request({name:"queryMcubeMiniPackage",resultKey:"queryMiniPackageResult",dataKey:"miniPackageInfo",req:{h5Id:d,id:h.data[0].id}}));case 10:return(0,_mpaasIdeOpenapiCommon.logger)("\u672A\u62C9\u53D6\u5230\u5C0F\u7A0B\u5E8F\u914D\u7F6E\uFF0C\u5C06\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E"),a.abrupt("return",{data:getDefaultTinyappConfig({h5Id:d,h5Name:e}).data,success:!0});case 14:throw a.prev=14,a.t0=a["catch"](1),new Error(a.t0.message);case 17:case"end":return a.stop();}},a,null,[[1,14]])}));return function(){return a.apply(this,arguments)}}()),(0,_defineProperty2["default"])(this,"uploadPackageByApi",function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(b){var d,e,f;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,d=c.config.userId,e=b.whiteListValue,a.next=5,(0,_mpaasIdeOpenapiCommon.getUploadData)({type:"aliyun",config:c.config,req:b,getVhostByApi:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return c.methods.queryMcubeVhost(_objectSpread({},a))},createWhitelistByApi:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return c.methods.createMcubeWhitelistForIde(_objectSpread(_objectSpread({},a),{},{whitelistValue:e,userId:d}))},uploadFile:function(a){return c.methods.uploadFile({filePath:a})}});case 5:return f=a.sent,f.onexFlag=!0,console.log(f),a.next=10,c.request({name:"uploadMcubeMiniPackage",resultKey:"uploadMiniPackageResult",dataKey:"returnPackageResult",req:f});case 10:return a.abrupt("return",a.sent);case 13:throw a.prev=13,a.t0=a["catch"](0),new Error(a.t0.message);case 16:case"end":return a.stop();}},a,null,[[0,13]])}));return function(){return a.apply(this,arguments)}}()),this.config=b;var d=new _utils["default"](this.config),e=d.request;this.request=e,this.createMethods()}return(0,_createClass2["default"])(a,[{key:"createMethods",value:function createMethods(){var a=this;this.methods={createMcubeWhitelistForIde:function createMcubeWhitelistForIde(b){var c=b.userId,d=b.whitelistValue;return a.request({name:"createMcubeWhitelistForIde",resultKey:"createWhitelistForIdeResult",dataKey:"whitelistId",req:{userId:c,whitelistValue:d}})},getMcubeFileToken:function getMcubeFileToken(){return a.request({name:"getMcubeFileToken",resultKey:"getFileTokenResult",dataKey:"fileToken",req:{onexFlag:!0}})},queryMcubeVhost:function queryMcubeVhost(){return a.request({name:"queryMcubeVhost",resultKey:"queryVhostResult",dataKey:"data"})},uploadFile:function(){var b=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function b(c){var 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 d=c.filePath,b.prev=1,e=_fsExtra["default"].readFileSync(d),f=_path["default"].basename(d).replace(/\s/g,"_"),b.next=6,a.methods.getMcubeFileToken();case 6:return g=b.sent,h=g.data,h=void 0===h?{}:h,i=h.host,j=h.accessid,k=h.policy,l=h.signature,m=h.dir,n=void 0===m?"":m,o="".concat(n,"/").concat(f),p="".concat(i,"/").concat(o),q={Key:o,Name:f,Policy:k,OSSAccessKeyId:j,success_action_status:"200",Signature:l,OnexFlag:!0,File:e},b.next=15,_superagent["default"].post(i).field(q);case 15:return r=b.sent,b.abrupt("return",{data:p,errorCode:"",success:!0});case 19:throw b.prev=19,b.t0=b["catch"](1),new Error(b.t0);case 22:case"end":return b.stop();}},b,null,[[1,19]])}));return function uploadFile(){return b.apply(this,arguments)}}()}}},{key:"getAppListByApi",value:function getAppListByApi(){return this.request({name:"listMcubeMiniApps",resultKey:"listMiniResult",dataKey:"miniProgramList"})}}]),a}(),_default=OpenAPI;exports["default"]=_default; |
@@ -1,3 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_client=_interopRequireDefault(require("./client")),getFirstLetterUppercase=function(a){return a.replace(/^\S/,function(a){return a.toUpperCase()})},Request=/*#__PURE__*/function(){function a(b){var c=this;(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"request",/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,x,y,z,A;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:for(d=b.name,e=b.resultKey,f=b.dataKey,g=b.req,h=void 0===g?{}:g,a.prev=1,i={},(j=0,k=Object.entries(h));j<k.length;j++)l=(0,_slicedToArray2["default"])(k[j],2),m=l[0],n=l[1],i[getFirstLetterUppercase(m)]=n;for(o=0,p=Object.entries(c.restParams);o<p.length;o++)q=(0,_slicedToArray2["default"])(p[o],2),r=q[0],s=q[1],i[getFirstLetterUppercase(r)]=s;return a.next=7,c.client[d](i);case 7:return t=a.sent,u=t.resultCode,w=t.requestId,x=t[e],x=void 0===x?{}:x,y=x.resultMsg,z=x.success,A=x[f],a.abrupt("return",{data:A,errorCode:u,requestId:w,resultMsg:y,success:z});case 14:throw a.prev=14,a.t0=a["catch"](1),new Error(a.t0);case 17:case"end":return a.stop();}},a,null,[[1,14]])}));return function(){return a.apply(this,arguments)}}()),this.config=b,this.createClient()}return(0,_createClass2["default"])(a,[{key:"createClient",value:function createClient(){var a=this.config,b=a.accessKeyId,c=a.accessKeySecret,d=a.endpoint,e=a.appId,f=a.workspaceId,g=a.tenantId;// create client | ||
this.client=new _client["default"]({type:"access_key",accessKeyId:b,accessKeySecret:c,endpoint:d}),this.restParams={appId:e,workspaceId:f,tenantId:g}}// 统一处理请求 | ||
}]),a}(),_default=Request;exports["default"]=_default; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_client=_interopRequireDefault(require("./client")),getFirstLetterUppercase=function(a){return a.replace(/^\S/,function(a){return a.toUpperCase()})},Request=function(){function a(b){var c=this;(0,_classCallCheck2["default"])(this,a),(0,_defineProperty2["default"])(this,"request",function(){var a=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function a(b){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,x,y,z,A;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:for(d=b.name,e=b.resultKey,f=b.dataKey,g=b.req,h=void 0===g?{}:g,a.prev=1,i={},(j=0,k=Object.entries(h));j<k.length;j++)l=(0,_slicedToArray2["default"])(k[j],2),m=l[0],n=l[1],i[getFirstLetterUppercase(m)]=n;for(o=0,p=Object.entries(c.restParams);o<p.length;o++)q=(0,_slicedToArray2["default"])(p[o],2),r=q[0],s=q[1],i[getFirstLetterUppercase(r)]=s;return a.next=7,c.client[d](i);case 7:return t=a.sent,u=t.resultCode,w=t.requestId,x=t[e],x=void 0===x?{}:x,y=x.resultMsg,z=x.success,A=x[f],a.abrupt("return",{data:A,errorCode:u,requestId:w,resultMsg:y,success:z});case 14:throw a.prev=14,a.t0=a["catch"](1),new Error(a.t0);case 17:case"end":return a.stop();}},a,null,[[1,14]])}));return function(){return a.apply(this,arguments)}}()),this.config=b,this.createClient()}return(0,_createClass2["default"])(a,[{key:"createClient",value:function createClient(){var a=this.config,b=a.accessKeyId,c=a.accessKeySecret,d=a.endpoint,e=a.appId,f=a.workspaceId,g=a.tenantId;this.client=new _client["default"]({type:"access_key",accessKeyId:b,accessKeySecret:c,endpoint:d}),this.restParams={appId:e,workspaceId:f,tenantId:g}}}]),a}(),_default=Request;exports["default"]=_default; |
{ | ||
"name": "@alipay-inc/mpaas-ide-openapi-aliyun", | ||
"version": "1.0.0-beta.19", | ||
"version": "1.0.0-beta.20", | ||
"main": "dist/index.js", | ||
@@ -29,3 +29,3 @@ "repository": "https://code.alipay.com/mPaaS-IDE-Adaptor/mPaaS-IDE-openAPI.git", | ||
}, | ||
"gitHead": "513384ff393ed410083107f0ec212071a7ec17d7" | ||
"gitHead": "204464f36eed580fc0f1bf9dcef83b6daca272d8" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
379655
0
1