zmp-cli 3.10.1 → 3.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var axios = require('axios')["default"];
|
|
4
|
+
|
|
5
|
+
var config = require('../../config');
|
|
6
|
+
|
|
7
|
+
var requestUpload = function requestUpload(url, appData, versionStatus, token) {
|
|
8
|
+
var appName, appDesc, appConfig, frameworkVersions, params, headers, res, resData;
|
|
9
|
+
return regeneratorRuntime.async(function requestUpload$(_context) {
|
|
10
|
+
while (1) {
|
|
11
|
+
switch (_context.prev = _context.next) {
|
|
12
|
+
case 0:
|
|
13
|
+
appName = appData.appName, appDesc = appData.appDesc, appConfig = appData.appConfig, frameworkVersions = appData.frameworkVersions;
|
|
14
|
+
params = {
|
|
15
|
+
name: appName,
|
|
16
|
+
desc: appDesc,
|
|
17
|
+
config: appConfig,
|
|
18
|
+
versionStatus: versionStatus,
|
|
19
|
+
frameworkVersions: frameworkVersions
|
|
20
|
+
};
|
|
21
|
+
headers = {
|
|
22
|
+
Authorization: "Bearer ".concat(token),
|
|
23
|
+
'cache-control': 'no-cache'
|
|
24
|
+
};
|
|
25
|
+
_context.next = 5;
|
|
26
|
+
return regeneratorRuntime.awrap(axios.get(url, {
|
|
27
|
+
params: params,
|
|
28
|
+
headers: headers,
|
|
29
|
+
withCredentials: true
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
case 5:
|
|
33
|
+
res = _context.sent;
|
|
34
|
+
resData = res.data;
|
|
35
|
+
|
|
36
|
+
if (!(!resData || resData.err < 0)) {
|
|
37
|
+
_context.next = 11;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!(resData && resData.err === config.error_code.permission_denied)) {
|
|
42
|
+
_context.next = 10;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
throw new Error(config.error_msg.permission_denied);
|
|
47
|
+
|
|
48
|
+
case 10:
|
|
49
|
+
throw new Error(JSON.stringify(resData));
|
|
50
|
+
|
|
51
|
+
case 11:
|
|
52
|
+
return _context.abrupt("return", resData.data);
|
|
53
|
+
|
|
54
|
+
case 12:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
module.exports = requestUpload;
|
|
@@ -2,13 +2,14 @@ const axios = require('axios').default;
|
|
|
2
2
|
const config = require('../../config');
|
|
3
3
|
|
|
4
4
|
const requestUpload = async (url, appData, versionStatus, token) => {
|
|
5
|
-
const { appName, appDesc, appConfig } = appData;
|
|
5
|
+
const { appName, appDesc, appConfig, frameworkVersions } = appData;
|
|
6
6
|
|
|
7
7
|
const params = {
|
|
8
8
|
name: appName,
|
|
9
9
|
desc: appDesc,
|
|
10
10
|
config: appConfig,
|
|
11
11
|
versionStatus,
|
|
12
|
+
frameworkVersions,
|
|
12
13
|
};
|
|
13
14
|
const headers = {
|
|
14
15
|
Authorization: `Bearer ${token}`,
|
|
@@ -19,6 +20,7 @@ const requestUpload = async (url, appData, versionStatus, token) => {
|
|
|
19
20
|
headers,
|
|
20
21
|
withCredentials: true,
|
|
21
22
|
});
|
|
23
|
+
|
|
22
24
|
const resData = res.data;
|
|
23
25
|
if (!resData || resData.err < 0) {
|
|
24
26
|
if (resData && resData.err === config.error_code.permission_denied) {
|