@xezzon/zeroweb-sdk 0.9.0 → 0.10.0
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.
- package/LICENSE +127 -0
- package/README.md +1 -1
- package/dist/{typings/admin → admin}/app.d.ts +1 -1
- package/dist/{typings/admin → admin}/authn.d.ts +1 -1
- package/dist/{typings/admin → admin}/authz.d.ts +3 -3
- package/dist/{typings/admin → admin}/crypto.d.ts +1 -1
- package/dist/{typings/admin → admin}/dict.d.ts +1 -1
- package/dist/{typings/admin → admin}/index.d.ts +1 -1
- package/dist/{typings/admin → admin}/role.d.ts +1 -1
- package/dist/{typings/admin → admin}/setting.d.ts +1 -1
- package/dist/{typings/admin → admin}/user.d.ts +27 -3
- package/dist/{typings/dev → dev}/index.d.ts +1 -1
- package/dist/{typings/dev → dev}/locale.d.ts +3 -3
- package/dist/{typings/file → file}/attachment.d.ts +18 -2
- package/dist/{typings/file → file}/index.d.ts +9 -4
- package/dist/{typings/file → file}/upload.d.ts +6 -2
- package/dist/index.cjs +731 -0
- package/dist/{typings/index.d.ts → index.d.ts} +3 -3
- package/dist/index.mjs +644 -0
- package/dist/{typings/interceptors.d.ts → interceptors.d.ts} +2 -2
- package/dist/{typings/metadata → metadata}/index.d.ts +1 -1
- package/dist/{typings/open → open}/index.d.ts +1 -1
- package/dist/{typings/open → open}/openapi.d.ts +1 -1
- package/dist/{typings/open → open}/subscription.d.ts +13 -7
- package/dist/{typings/open → open}/third_party_app.d.ts +13 -1
- package/dist/{typings/types.d.ts → types.d.ts} +1 -1
- package/package.json +20 -21
- package/dist/cjs/admin/app.js +0 -26
- package/dist/cjs/admin/authn.js +0 -25
- package/dist/cjs/admin/authz.js +0 -41
- package/dist/cjs/admin/crypto.js +0 -9
- package/dist/cjs/admin/dict.js +0 -36
- package/dist/cjs/admin/index.js +0 -58
- package/dist/cjs/admin/role.js +0 -21
- package/dist/cjs/admin/setting.js +0 -31
- package/dist/cjs/admin/user.js +0 -14
- package/dist/cjs/dev/index.js +0 -23
- package/dist/cjs/dev/locale.js +0 -58
- package/dist/cjs/file/attachment.js +0 -69
- package/dist/cjs/file/index.js +0 -40
- package/dist/cjs/file/upload.js +0 -111
- package/dist/cjs/index.js +0 -27
- package/dist/cjs/interceptors.js +0 -44
- package/dist/cjs/metadata/index.js +0 -83
- package/dist/cjs/open/index.js +0 -38
- package/dist/cjs/open/openapi.js +0 -42
- package/dist/cjs/open/subscription.js +0 -39
- package/dist/cjs/open/third_party_app.js +0 -49
- package/dist/cjs/types.js +0 -10
- package/dist/esm/admin/app.js +0 -24
- package/dist/esm/admin/authn.js +0 -23
- package/dist/esm/admin/authz.js +0 -39
- package/dist/esm/admin/crypto.js +0 -7
- package/dist/esm/admin/dict.js +0 -34
- package/dist/esm/admin/index.js +0 -53
- package/dist/esm/admin/role.js +0 -19
- package/dist/esm/admin/setting.js +0 -29
- package/dist/esm/admin/user.js +0 -12
- package/dist/esm/dev/index.js +0 -18
- package/dist/esm/dev/locale.js +0 -56
- package/dist/esm/file/attachment.js +0 -66
- package/dist/esm/file/index.js +0 -33
- package/dist/esm/file/upload.js +0 -104
- package/dist/esm/index.js +0 -7
- package/dist/esm/interceptors.js +0 -40
- package/dist/esm/metadata/index.js +0 -77
- package/dist/esm/open/index.js +0 -30
- package/dist/esm/open/openapi.js +0 -39
- package/dist/esm/open/subscription.js +0 -36
- package/dist/esm/open/third_party_app.js +0 -46
- package/dist/esm/types.js +0 -7
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export default (client) => ({
|
|
2
|
-
addSetting: (setting) => client.request({
|
|
3
|
-
url: '/setting',
|
|
4
|
-
method: 'POST',
|
|
5
|
-
data: setting,
|
|
6
|
-
}),
|
|
7
|
-
listSetting: () => client.request({
|
|
8
|
-
url: '/setting',
|
|
9
|
-
method: 'GET',
|
|
10
|
-
}),
|
|
11
|
-
querySettingByCode: (code) => client.request({
|
|
12
|
-
url: `/setting/${code}`,
|
|
13
|
-
method: 'GET',
|
|
14
|
-
}),
|
|
15
|
-
updateSchema: (setting) => client.request({
|
|
16
|
-
url: '/setting/schema',
|
|
17
|
-
method: 'PUT',
|
|
18
|
-
data: setting,
|
|
19
|
-
}),
|
|
20
|
-
updateValue: (setting) => client.request({
|
|
21
|
-
url: '/setting/value',
|
|
22
|
-
method: 'PUT',
|
|
23
|
-
data: setting,
|
|
24
|
-
}),
|
|
25
|
-
deleteSetting: (id) => client.request({
|
|
26
|
-
url: `/setting/${id}`,
|
|
27
|
-
method: 'DELETE',
|
|
28
|
-
}),
|
|
29
|
-
});
|
package/dist/esm/admin/user.js
DELETED
package/dist/esm/dev/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { zerowebErrorHandler } from "../interceptors";
|
|
3
|
-
import locale from "./locale";
|
|
4
|
-
export default (config) => {
|
|
5
|
-
const instance = axios.create(config);
|
|
6
|
-
const interceptors = instance.interceptors;
|
|
7
|
-
interceptors.response.use(null, zerowebErrorHandler);
|
|
8
|
-
return {
|
|
9
|
-
/**
|
|
10
|
-
* 拦截器方法
|
|
11
|
-
*/
|
|
12
|
-
interceptors,
|
|
13
|
-
/**
|
|
14
|
-
* 国际化相关接口
|
|
15
|
-
*/
|
|
16
|
-
locale: locale(instance),
|
|
17
|
-
};
|
|
18
|
-
};
|
package/dist/esm/dev/locale.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export default (client) => ({
|
|
2
|
-
addLanguage: (language) => client.request({
|
|
3
|
-
url: '/language',
|
|
4
|
-
method: 'POST',
|
|
5
|
-
data: language,
|
|
6
|
-
}),
|
|
7
|
-
queryLanguageList: () => client.request({
|
|
8
|
-
url: '/language',
|
|
9
|
-
method: 'GET',
|
|
10
|
-
}),
|
|
11
|
-
updateLanguage: (language) => client.request({
|
|
12
|
-
url: '/language',
|
|
13
|
-
method: 'PUT',
|
|
14
|
-
data: language,
|
|
15
|
-
}),
|
|
16
|
-
deleteLanguage: (id) => client.request({
|
|
17
|
-
url: `/language/${id}`,
|
|
18
|
-
method: 'DELETE',
|
|
19
|
-
}),
|
|
20
|
-
addI18nMessage: (i18nMessage) => client.request({
|
|
21
|
-
url: '/i18n',
|
|
22
|
-
method: 'POST',
|
|
23
|
-
data: i18nMessage,
|
|
24
|
-
}),
|
|
25
|
-
listI18nNamespace: () => client.request({
|
|
26
|
-
url: '/i18n',
|
|
27
|
-
method: 'GET',
|
|
28
|
-
}),
|
|
29
|
-
queryI18nMessageList: (namespace, odata) => client.request({
|
|
30
|
-
url: `/i18n/${namespace}`,
|
|
31
|
-
method: 'GET',
|
|
32
|
-
params: odata,
|
|
33
|
-
}),
|
|
34
|
-
updateI18nMessage: (i18nMessage) => client.request({
|
|
35
|
-
url: '/i18n',
|
|
36
|
-
method: 'PUT',
|
|
37
|
-
data: i18nMessage,
|
|
38
|
-
}),
|
|
39
|
-
deleteI18nMessage: (id) => client.request({
|
|
40
|
-
url: `/i18n/${id}`,
|
|
41
|
-
method: 'DELETE',
|
|
42
|
-
}),
|
|
43
|
-
queryTranslation: (namespace, messageKey) => client.request({
|
|
44
|
-
url: `/i18n/${namespace}/${messageKey}`,
|
|
45
|
-
method: 'GET',
|
|
46
|
-
}),
|
|
47
|
-
upsertTranslation: (translation) => client.request({
|
|
48
|
-
url: '/locale',
|
|
49
|
-
method: 'PUT',
|
|
50
|
-
data: translation,
|
|
51
|
-
}),
|
|
52
|
-
loadTranslation: (language, namespace) => client.request({
|
|
53
|
-
url: `/locale/${language}/${namespace}`,
|
|
54
|
-
method: 'GET',
|
|
55
|
-
})
|
|
56
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { checksum } from "./upload";
|
|
11
|
-
export var AttachmentStatus;
|
|
12
|
-
(function (AttachmentStatus) {
|
|
13
|
-
AttachmentStatus["UPLOADING"] = "UPLOADING";
|
|
14
|
-
AttachmentStatus["DONE"] = "DONE";
|
|
15
|
-
})(AttachmentStatus || (AttachmentStatus = {}));
|
|
16
|
-
export default (client) => ({
|
|
17
|
-
addAttachment: (file, bizType, bizId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
yield checksum(file);
|
|
19
|
-
const req = {
|
|
20
|
-
name: file.name,
|
|
21
|
-
checksum: file.checksum,
|
|
22
|
-
size: file.size,
|
|
23
|
-
type: file.type,
|
|
24
|
-
bizType,
|
|
25
|
-
bizId,
|
|
26
|
-
};
|
|
27
|
-
return client.request({
|
|
28
|
-
url: '/attachment',
|
|
29
|
-
method: 'POST',
|
|
30
|
-
data: req,
|
|
31
|
-
params: { crc: file.crc },
|
|
32
|
-
});
|
|
33
|
-
}),
|
|
34
|
-
getUploadInfo: (id, checksum, fileSize) => client.request({
|
|
35
|
-
url: `/attachment/${id}/resume`,
|
|
36
|
-
method: 'GET',
|
|
37
|
-
params: { checksum, fileSize },
|
|
38
|
-
}),
|
|
39
|
-
getUploadEndpoint: (id) => client.request({
|
|
40
|
-
url: `/attachment/${id}/endpoint/upload`,
|
|
41
|
-
method: 'GET',
|
|
42
|
-
params: { partNumber: 0 },
|
|
43
|
-
}),
|
|
44
|
-
getMultipartUploadEndpoint: (id, partNumber, crc) => client.request({
|
|
45
|
-
url: `/attachment/${id}/endpoint/upload`,
|
|
46
|
-
method: 'GET',
|
|
47
|
-
params: { partNumber, crc },
|
|
48
|
-
}),
|
|
49
|
-
finishUpload: (id) => client.request({
|
|
50
|
-
url: `/attachment/${id}/status/done`,
|
|
51
|
-
method: 'PUT',
|
|
52
|
-
}),
|
|
53
|
-
queryAttachmentByBiz: (bizType, bizId) => client.request({
|
|
54
|
-
url: `/attachment/list`,
|
|
55
|
-
method: 'GET',
|
|
56
|
-
params: { bizType, bizId, },
|
|
57
|
-
}),
|
|
58
|
-
getDownloadEndpoint: (id) => client.request({
|
|
59
|
-
url: `/attachment/${id}/endpoint/download`,
|
|
60
|
-
method: 'GET',
|
|
61
|
-
}),
|
|
62
|
-
deleteAttachment: (id) => client.request({
|
|
63
|
-
url: `/attachment/${id}`,
|
|
64
|
-
method: 'DELETE',
|
|
65
|
-
}),
|
|
66
|
-
});
|
package/dist/esm/file/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { zerowebErrorHandler } from "../interceptors";
|
|
3
|
-
import attachment from "./attachment";
|
|
4
|
-
import { upload } from "./upload";
|
|
5
|
-
export default (config) => {
|
|
6
|
-
const instance = axios.create(config);
|
|
7
|
-
const interceptors = instance.interceptors;
|
|
8
|
-
interceptors.response.use(null, zerowebErrorHandler);
|
|
9
|
-
const attachmentApi = attachment(instance);
|
|
10
|
-
return {
|
|
11
|
-
/**
|
|
12
|
-
* 拦截器方法
|
|
13
|
-
*/
|
|
14
|
-
interceptors,
|
|
15
|
-
/**
|
|
16
|
-
* 附件管理接口
|
|
17
|
-
*/
|
|
18
|
-
attachment: attachmentApi,
|
|
19
|
-
/**
|
|
20
|
-
* 文件上传
|
|
21
|
-
* @param file 文件
|
|
22
|
-
* @param bizType 业务类型
|
|
23
|
-
* @param bizId 业务编码
|
|
24
|
-
*/
|
|
25
|
-
upload: upload(instance, attachmentApi),
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export var FileProvider;
|
|
29
|
-
(function (FileProvider) {
|
|
30
|
-
FileProvider["FS"] = "FS";
|
|
31
|
-
FileProvider["S3"] = "S3";
|
|
32
|
-
})(FileProvider || (FileProvider = {}));
|
|
33
|
-
export { AttachmentStatus } from './attachment';
|
package/dist/esm/file/upload.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import CryptoJS from "crypto-js";
|
|
11
|
-
import { crc32 } from "js-crc";
|
|
12
|
-
/**
|
|
13
|
-
* 计算文件的校验和
|
|
14
|
-
* @param file 文件
|
|
15
|
-
* @returns 文件的SHA256值
|
|
16
|
-
*/
|
|
17
|
-
export function checksum(file) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
if (file.checksum && file.crc) {
|
|
20
|
-
return file;
|
|
21
|
-
}
|
|
22
|
-
return file.arrayBuffer()
|
|
23
|
-
.then(arrayBuffer => Promise.all([
|
|
24
|
-
Promise.resolve()
|
|
25
|
-
.then(() => CryptoJS
|
|
26
|
-
.SHA256(CryptoJS.lib.WordArray.create(arrayBuffer))
|
|
27
|
-
.toString(CryptoJS.enc.Base64))
|
|
28
|
-
.then(checksum => {
|
|
29
|
-
file.checksum = checksum;
|
|
30
|
-
}),
|
|
31
|
-
Promise.resolve()
|
|
32
|
-
.then(() => CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(crc32.hex(arrayBuffer))))
|
|
33
|
-
.then(crc => {
|
|
34
|
-
file.crc = crc;
|
|
35
|
-
}),
|
|
36
|
-
]))
|
|
37
|
-
.then(() => file);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export function upload(client, attachmentApi) {
|
|
41
|
-
return (file, uploadInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
return file.arrayBuffer()
|
|
43
|
-
.then(arrayBuffer => {
|
|
44
|
-
const partCount = uploadInfo.partCount;
|
|
45
|
-
const partSize = uploadInfo.partSize;
|
|
46
|
-
const parts = [];
|
|
47
|
-
for (let index = 0; index < partCount - 1; index++) {
|
|
48
|
-
const content = arrayBuffer.slice(index * partSize, (index + 1) * partSize);
|
|
49
|
-
const crc = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(crc32.hex(content)));
|
|
50
|
-
parts.push({ content, crc });
|
|
51
|
-
}
|
|
52
|
-
const content = arrayBuffer.slice((partCount - 1) * partSize, file.size);
|
|
53
|
-
const crc = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(crc32.hex(content)));
|
|
54
|
-
parts.push({ content, crc });
|
|
55
|
-
return parts;
|
|
56
|
-
})
|
|
57
|
-
.then(parts => Promise.all(parts
|
|
58
|
-
.map((part, index) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return Promise.resolve()
|
|
60
|
-
.then(() => {
|
|
61
|
-
if (uploadInfo.partCount > 1) {
|
|
62
|
-
return attachmentApi.getMultipartUploadEndpoint(uploadInfo.id, index + 1, part.crc);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return attachmentApi.getUploadEndpoint(uploadInfo.id);
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
.then(response => response.data)
|
|
69
|
-
.then((_a) => __awaiter(this, [_a], void 0, function* ({ endpoint }) {
|
|
70
|
-
if (!endpoint) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const partChecksum = CryptoJS
|
|
74
|
-
.SHA256(CryptoJS.lib.WordArray.create(part.content))
|
|
75
|
-
.toString(CryptoJS.enc.Base64);
|
|
76
|
-
let headers;
|
|
77
|
-
if (uploadInfo.partCount > 1) {
|
|
78
|
-
// 分片上传的请求头
|
|
79
|
-
headers = {
|
|
80
|
-
'x-amz-sdk-checksum-algorithm': 'CRC32',
|
|
81
|
-
'x-amz-checksum-crc32': part.crc,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
headers = {
|
|
86
|
-
'x-amz-sdk-checksum-algorithm': 'SHA256',
|
|
87
|
-
'x-amz-checksum-sha256': partChecksum,
|
|
88
|
-
'x-amz-meta-id': uploadInfo.id,
|
|
89
|
-
'x-amz-meta-filename': file.name,
|
|
90
|
-
'Content-Type': file.type,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return client
|
|
94
|
-
.request({
|
|
95
|
-
url: endpoint,
|
|
96
|
-
method: 'PUT',
|
|
97
|
-
data: part.content,
|
|
98
|
-
headers: headers,
|
|
99
|
-
});
|
|
100
|
-
}));
|
|
101
|
-
}))))
|
|
102
|
-
.then(() => attachmentApi.finishUpload(uploadInfo.id));
|
|
103
|
-
});
|
|
104
|
-
}
|
package/dist/esm/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as ZerowebMetadataClient, MenuType, ServiceType, } from './metadata';
|
|
2
|
-
export { default as ZerowebAdminClient } from './admin';
|
|
3
|
-
export { default as ZerowebOpenClient, OpenapiStatus, SubscriptionStatus, } from './open';
|
|
4
|
-
export { default as ZerowebFileClient, FileProvider, AttachmentStatus, } from './file';
|
|
5
|
-
export { default as ZerowebDevClient } from './dev';
|
|
6
|
-
export { ErrorSource } from './types';
|
|
7
|
-
export { zerowebErrorHandler, ErrorCodeEnum } from './interceptors';
|
package/dist/esm/interceptors.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ErrorSource } from "./types";
|
|
2
|
-
const ERROR_CODE_HEADER = 'x-error-code';
|
|
3
|
-
export const ErrorCodeEnum = {
|
|
4
|
-
'ARGUMENT_INVALID': 'C0005',
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* 错误处理链:
|
|
8
|
-
* 1. 如果没有响应,则是网络问题。
|
|
9
|
-
* 2. 如果响应头不包含 x-error-code,是后端基础设施问题。
|
|
10
|
-
* 3. 如果响应状态为 5xx,是后端问题。
|
|
11
|
-
* 4. 如果响应状态为 401 或 403。分别跳转到登录页和 404 页。
|
|
12
|
-
* 5. 如果错误码不是 C0005,是内容触发了校验机制。用消息框提示用户。
|
|
13
|
-
* 6. 如果错误码是 C0005,是用户输入问题。将内容回显到表单。
|
|
14
|
-
*/
|
|
15
|
-
export function zerowebErrorHandler(error) {
|
|
16
|
-
const response = error.response;
|
|
17
|
-
if (!response) {
|
|
18
|
-
error.source = ErrorSource.NETWORK;
|
|
19
|
-
return Promise.reject(error);
|
|
20
|
-
}
|
|
21
|
-
const errorCode = response.headers[ERROR_CODE_HEADER];
|
|
22
|
-
if (!errorCode) {
|
|
23
|
-
error.source = ErrorSource.INFRA;
|
|
24
|
-
return Promise.reject(error);
|
|
25
|
-
}
|
|
26
|
-
error.errorCode = errorCode;
|
|
27
|
-
const responseBody = response.data;
|
|
28
|
-
if (response.status >= 500) {
|
|
29
|
-
error.source = ErrorSource.INTERNAL;
|
|
30
|
-
error.message = responseBody.message;
|
|
31
|
-
return Promise.reject(error);
|
|
32
|
-
}
|
|
33
|
-
error.source = ErrorSource.BAD_REQUEST;
|
|
34
|
-
if (errorCode !== ErrorCodeEnum.ARGUMENT_INVALID) {
|
|
35
|
-
error.notification = responseBody.message;
|
|
36
|
-
}
|
|
37
|
-
error.parameters = responseBody.parameters;
|
|
38
|
-
error.details = responseBody.details;
|
|
39
|
-
return Promise.reject(error);
|
|
40
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { zerowebErrorHandler } from "../interceptors";
|
|
3
|
-
/**
|
|
4
|
-
* 服务类型
|
|
5
|
-
*/
|
|
6
|
-
export var ServiceType;
|
|
7
|
-
(function (ServiceType) {
|
|
8
|
-
/**
|
|
9
|
-
* 前端
|
|
10
|
-
*/
|
|
11
|
-
ServiceType["CLIENT"] = "CLIENT";
|
|
12
|
-
/**
|
|
13
|
-
* 后端
|
|
14
|
-
*/
|
|
15
|
-
ServiceType["SERVER"] = "SERVER";
|
|
16
|
-
})(ServiceType || (ServiceType = {}));
|
|
17
|
-
/**
|
|
18
|
-
* 菜单类型
|
|
19
|
-
*/
|
|
20
|
-
export var MenuType;
|
|
21
|
-
(function (MenuType) {
|
|
22
|
-
/**
|
|
23
|
-
* 路由
|
|
24
|
-
*/
|
|
25
|
-
MenuType["ROUTE"] = "ROUTE";
|
|
26
|
-
/**
|
|
27
|
-
* 外部链接。
|
|
28
|
-
* 点击后会打开一个新的标签页
|
|
29
|
-
*/
|
|
30
|
-
MenuType["EXTERNAL_LINK"] = "EXTERNAL_LINK";
|
|
31
|
-
/**
|
|
32
|
-
* 嵌入页面。
|
|
33
|
-
* 会在当前页面嵌入一个外部网页。
|
|
34
|
-
*/
|
|
35
|
-
MenuType["EMBEDDED"] = "EMBEDDED";
|
|
36
|
-
/**
|
|
37
|
-
* 接口权限
|
|
38
|
-
* 路径格式为 `resource:operation`,operation 通常为 `read`(可省略)、`write` 等。
|
|
39
|
-
*/
|
|
40
|
-
MenuType["PERMISSION"] = "PERMISSION";
|
|
41
|
-
/**
|
|
42
|
-
* 资源权限
|
|
43
|
-
* 路径格式为 `resource:#:operation`,operation 通常为 `read`(可省略)、`write` 等。
|
|
44
|
-
*/
|
|
45
|
-
MenuType["GROUP_PERMISSION"] = "GROUP_PERMISSION";
|
|
46
|
-
})(MenuType || (MenuType = {}));
|
|
47
|
-
export default (config) => {
|
|
48
|
-
const instance = axios.create(config);
|
|
49
|
-
const interceptors = instance.interceptors;
|
|
50
|
-
interceptors.response.use(null, zerowebErrorHandler);
|
|
51
|
-
return {
|
|
52
|
-
/**
|
|
53
|
-
* 拦截器方法
|
|
54
|
-
*/
|
|
55
|
-
interceptors,
|
|
56
|
-
/**
|
|
57
|
-
* 获取服务信息
|
|
58
|
-
* @returns 服务信息
|
|
59
|
-
*/
|
|
60
|
-
loadServiceInfo() {
|
|
61
|
-
return instance.request({
|
|
62
|
-
url: '/metadata/info.json',
|
|
63
|
-
method: 'GET',
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* 获取菜单信息
|
|
68
|
-
* @returns 菜单信息
|
|
69
|
-
*/
|
|
70
|
-
loadResourceInfo() {
|
|
71
|
-
return instance.request({
|
|
72
|
-
url: '/metadata/menu.json',
|
|
73
|
-
method: 'GET',
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
};
|
package/dist/esm/open/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { zerowebErrorHandler } from "../interceptors";
|
|
3
|
-
import openapi from "./openapi";
|
|
4
|
-
import subscription from "./subscription";
|
|
5
|
-
import thirdPartyApp from "./third_party_app";
|
|
6
|
-
export default (config) => {
|
|
7
|
-
const instance = axios.create(config);
|
|
8
|
-
const interceptors = instance.interceptors;
|
|
9
|
-
interceptors.response.use(null, zerowebErrorHandler);
|
|
10
|
-
return {
|
|
11
|
-
/**
|
|
12
|
-
* 拦截器方法
|
|
13
|
-
*/
|
|
14
|
-
interceptors: instance.interceptors,
|
|
15
|
-
/**
|
|
16
|
-
* 对外接口相关接口
|
|
17
|
-
*/
|
|
18
|
-
openapi: openapi(instance),
|
|
19
|
-
/**
|
|
20
|
-
* 第三方应用订阅相关接口
|
|
21
|
-
*/
|
|
22
|
-
subscription: subscription(instance),
|
|
23
|
-
/**
|
|
24
|
-
* 第三方应用相关接口
|
|
25
|
-
*/
|
|
26
|
-
thirdPartyApp: thirdPartyApp(instance),
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export { OpenapiStatus } from './openapi';
|
|
30
|
-
export { SubscriptionStatus } from './subscription';
|
package/dist/esm/open/openapi.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 对外接口状态
|
|
3
|
-
*/
|
|
4
|
-
export var OpenapiStatus;
|
|
5
|
-
(function (OpenapiStatus) {
|
|
6
|
-
/**
|
|
7
|
-
* 草稿
|
|
8
|
-
*/
|
|
9
|
-
OpenapiStatus["DRAFT"] = "DRAFT";
|
|
10
|
-
/**
|
|
11
|
-
* 已发布
|
|
12
|
-
*/
|
|
13
|
-
OpenapiStatus["PUBLISHED"] = "PUBLISHED";
|
|
14
|
-
})(OpenapiStatus || (OpenapiStatus = {}));
|
|
15
|
-
export default (client) => ({
|
|
16
|
-
addOpenapi: (openapi) => client.request({
|
|
17
|
-
url: '/openapi',
|
|
18
|
-
method: 'POST',
|
|
19
|
-
data: openapi,
|
|
20
|
-
}),
|
|
21
|
-
getOpenapiList: (odata) => client.request({
|
|
22
|
-
url: '/openapi',
|
|
23
|
-
method: 'GET',
|
|
24
|
-
params: odata,
|
|
25
|
-
}),
|
|
26
|
-
modifyOpenapi: (openapi) => client.request({
|
|
27
|
-
url: '/openapi',
|
|
28
|
-
method: 'PUT',
|
|
29
|
-
data: openapi,
|
|
30
|
-
}),
|
|
31
|
-
publishOpenapi: (id) => client.request({
|
|
32
|
-
url: `/openapi/${id}/publish`,
|
|
33
|
-
method: 'PUT',
|
|
34
|
-
}),
|
|
35
|
-
deleteOpenapi: (id) => client.request({
|
|
36
|
-
url: `/openapi/${id}`,
|
|
37
|
-
method: 'DELETE',
|
|
38
|
-
}),
|
|
39
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BASE_URL as THIRD_PARTY_APP_URL } from './third_party_app';
|
|
2
|
-
const BASE_URL = '/subscription';
|
|
3
|
-
/**
|
|
4
|
-
* 订阅状态
|
|
5
|
-
*/
|
|
6
|
-
export var SubscriptionStatus;
|
|
7
|
-
(function (SubscriptionStatus) {
|
|
8
|
-
/**
|
|
9
|
-
* 未订阅
|
|
10
|
-
*/
|
|
11
|
-
SubscriptionStatus["NONE"] = "NONE";
|
|
12
|
-
/**
|
|
13
|
-
* 审核中
|
|
14
|
-
*/
|
|
15
|
-
SubscriptionStatus["AUDITING"] = "AUDITING";
|
|
16
|
-
/**
|
|
17
|
-
* 已订阅
|
|
18
|
-
*/
|
|
19
|
-
SubscriptionStatus["SUBSCRIBED"] = "SUBSCRIBED";
|
|
20
|
-
})(SubscriptionStatus || (SubscriptionStatus = {}));
|
|
21
|
-
export default (client) => ({
|
|
22
|
-
subscribe: (subscription) => client.request({
|
|
23
|
-
url: `${BASE_URL}`,
|
|
24
|
-
method: 'POST',
|
|
25
|
-
data: subscription,
|
|
26
|
-
}),
|
|
27
|
-
listSubscription: (appId, odata) => client.request({
|
|
28
|
-
url: `${THIRD_PARTY_APP_URL}/${appId}/subscription`,
|
|
29
|
-
method: 'GET',
|
|
30
|
-
params: odata,
|
|
31
|
-
}),
|
|
32
|
-
auditSubscription: (id) => client.request({
|
|
33
|
-
url: `${BASE_URL}/${id}/audit`,
|
|
34
|
-
method: 'PUT',
|
|
35
|
-
}),
|
|
36
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export const BASE_URL = '/third-party-app';
|
|
2
|
-
export default (client) => ({
|
|
3
|
-
addThirdPartyApp: (thirdPartyApp) => client.request({
|
|
4
|
-
url: `${BASE_URL}`,
|
|
5
|
-
method: 'POST',
|
|
6
|
-
data: thirdPartyApp,
|
|
7
|
-
}),
|
|
8
|
-
listMyThirdPartyApp: (odata) => client.request({
|
|
9
|
-
url: `${BASE_URL}/mine`,
|
|
10
|
-
method: 'GET',
|
|
11
|
-
params: odata,
|
|
12
|
-
}),
|
|
13
|
-
listThirdPartyApp: (odata) => client.request({
|
|
14
|
-
url: `${BASE_URL}`,
|
|
15
|
-
method: 'GET',
|
|
16
|
-
params: odata,
|
|
17
|
-
}),
|
|
18
|
-
rollAccessSecret: (id) => client.request({
|
|
19
|
-
url: `${BASE_URL}/${id}/roll`,
|
|
20
|
-
method: 'PATCH',
|
|
21
|
-
}),
|
|
22
|
-
inviteMember: (appId, timeout) => client.request({
|
|
23
|
-
url: `/third-party-app/${appId}/member`,
|
|
24
|
-
method: 'POST',
|
|
25
|
-
params: { timeout, },
|
|
26
|
-
}),
|
|
27
|
-
inviteParticularMember: (appId, userId, timeout) => client.request({
|
|
28
|
-
url: `/third-party-app/${appId}/member`,
|
|
29
|
-
method: 'POST',
|
|
30
|
-
params: { userId, timeout, },
|
|
31
|
-
}),
|
|
32
|
-
addThirdPartyAppMember: (token) => client.request({
|
|
33
|
-
url: `/third-party-app/-/member`,
|
|
34
|
-
method: 'PUT',
|
|
35
|
-
params: { token, },
|
|
36
|
-
}),
|
|
37
|
-
listThirdPartyAppMember: (appId) => client.request({
|
|
38
|
-
url: `/third-party-app/${appId}/member`,
|
|
39
|
-
method: 'GET',
|
|
40
|
-
}),
|
|
41
|
-
moveOwnerShip: (appId, userId) => client.request({
|
|
42
|
-
url: `/third-party-app/${appId}/owner`,
|
|
43
|
-
method: 'PATCH',
|
|
44
|
-
params: { userId, },
|
|
45
|
-
}),
|
|
46
|
-
});
|
package/dist/esm/types.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export var ErrorSource;
|
|
2
|
-
(function (ErrorSource) {
|
|
3
|
-
ErrorSource[ErrorSource["NETWORK"] = 1] = "NETWORK";
|
|
4
|
-
ErrorSource[ErrorSource["INFRA"] = 2] = "INFRA";
|
|
5
|
-
ErrorSource[ErrorSource["INTERNAL"] = 3] = "INTERNAL";
|
|
6
|
-
ErrorSource[ErrorSource["BAD_REQUEST"] = 4] = "BAD_REQUEST";
|
|
7
|
-
})(ErrorSource || (ErrorSource = {}));
|