zyjj-web-sdk 1.0.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/README.md +30 -0
- package/lib/api/api.d.ts +38 -0
- package/lib/api/entity.d.ts +59 -0
- package/lib/api/request.d.ts +1 -0
- package/lib/components/MaterialCard.d.ts +6 -0
- package/lib/components/PageTable.d.ts +10 -0
- package/lib/components/TokenInput.d.ts +5 -0
- package/lib/components/ToolCard.d.ts +7 -0
- package/lib/components/UserLogin.d.ts +10 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.js +24642 -0
- package/lib/index.umd.cjs +79 -0
- package/lib/pages/MaterialList.d.ts +6 -0
- package/lib/pages/TaskList.d.ts +12 -0
- package/lib/pages/ToolList.d.ts +7 -0
- package/lib/pages/UserInfoPage.d.ts +9 -0
- package/lib/style.css +1 -0
- package/lib/types/cloud.d.ts +72 -0
- package/lib/types/local-task.d.ts +114 -0
- package/lib/types/mqtt.d.ts +16 -0
- package/lib/types/tool-task.d.ts +48 -0
- package/lib/utils/render.d.ts +3 -0
- package/lib/utils/tool.d.ts +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import './css/task.css';
|
|
3
|
+
import { LocalTaskInfo } from "../types/local-task.ts";
|
|
4
|
+
export interface TaskListProps {
|
|
5
|
+
taskList: LocalTaskInfo[];
|
|
6
|
+
isWeb: boolean;
|
|
7
|
+
onOutput: (info: LocalTaskInfo) => void;
|
|
8
|
+
onCancel: (info: LocalTaskInfo) => void;
|
|
9
|
+
onDelete: (info: LocalTaskInfo) => void;
|
|
10
|
+
onRestore: (info: LocalTaskInfo) => void;
|
|
11
|
+
}
|
|
12
|
+
export default function TaskList(props: TaskListProps): ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ToolInfo } from "../types/cloud.ts";
|
|
2
|
+
export interface ToolListProps {
|
|
3
|
+
toolSize: number;
|
|
4
|
+
onTool: (info: ToolInfo) => void;
|
|
5
|
+
onHelp: (info: ToolInfo) => void;
|
|
6
|
+
}
|
|
7
|
+
export default function ToolList(props: ToolListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { UserInfo } from "../types/cloud.ts";
|
|
3
|
+
export interface UserInfoPageProps {
|
|
4
|
+
recordSize: number;
|
|
5
|
+
userInfo: UserInfo;
|
|
6
|
+
onUpdateUserInfo: () => void;
|
|
7
|
+
onExit: () => void;
|
|
8
|
+
}
|
|
9
|
+
export default function UserInfoPage(props: UserInfoPageProps): ReactElement;
|
package/lib/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.arco-image-img{width:100%}.arco-progress-line-outer,.arco-progress-line-inner{border-radius:2px!important}.arco-list-item-meta-content{width:100%}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export interface AppInfo {
|
|
2
|
+
version: string;
|
|
3
|
+
desc: string;
|
|
4
|
+
tip: string;
|
|
5
|
+
windows: string;
|
|
6
|
+
mac: string;
|
|
7
|
+
mac_arm: string;
|
|
8
|
+
linux: string;
|
|
9
|
+
qq: string;
|
|
10
|
+
wechat: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UserInfo {
|
|
13
|
+
uid: string;
|
|
14
|
+
email: string;
|
|
15
|
+
points: number;
|
|
16
|
+
role: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ToolInfo {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
desc: string;
|
|
22
|
+
help: string;
|
|
23
|
+
count: number;
|
|
24
|
+
point: string;
|
|
25
|
+
login: boolean;
|
|
26
|
+
web_support?: boolean;
|
|
27
|
+
tool_type: ToolType;
|
|
28
|
+
tags: string[];
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
url: string;
|
|
32
|
+
}
|
|
33
|
+
export declare enum ToolType {
|
|
34
|
+
Task = 0,// 任务类型
|
|
35
|
+
Lab = 1
|
|
36
|
+
}
|
|
37
|
+
export interface ToolDetailInfo {
|
|
38
|
+
tool_id?: string;
|
|
39
|
+
info?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface TaskInfo {
|
|
42
|
+
id: string;
|
|
43
|
+
uid: string;
|
|
44
|
+
cid: string;
|
|
45
|
+
task_type: number;
|
|
46
|
+
input: string;
|
|
47
|
+
status: number;
|
|
48
|
+
output: string;
|
|
49
|
+
extra?: string;
|
|
50
|
+
create_time: number;
|
|
51
|
+
update_time: number;
|
|
52
|
+
}
|
|
53
|
+
export interface MaterialInfo {
|
|
54
|
+
id?: string;
|
|
55
|
+
uid?: string;
|
|
56
|
+
name: string;
|
|
57
|
+
path: string;
|
|
58
|
+
preview?: string;
|
|
59
|
+
preview_data?: string;
|
|
60
|
+
tags: string[];
|
|
61
|
+
size: number;
|
|
62
|
+
point: number;
|
|
63
|
+
extra?: string;
|
|
64
|
+
create_time?: number;
|
|
65
|
+
}
|
|
66
|
+
export declare enum CloudTaskStatus {
|
|
67
|
+
Create = 0,// 创建
|
|
68
|
+
Progress = 1,// 进行
|
|
69
|
+
Success = 2,// 成功
|
|
70
|
+
Error = 3,// 错误
|
|
71
|
+
Cancel = 4
|
|
72
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { MqttRequest, MqttResponse } from "./mqtt.ts";
|
|
2
|
+
import { ToolTaskInfo } from "./tool-task.ts";
|
|
3
|
+
export type SendTaskActionRequest = (info: LocalActionRequest) => void;
|
|
4
|
+
export type TaskActionClose = () => void;
|
|
5
|
+
export type GetTaskActionRequest = (uid: string, info: LocalActionRequest) => void;
|
|
6
|
+
export type GetTaskActionResponse = (info: LocalActionResponse) => void;
|
|
7
|
+
export type SendTaskActionResponse = (uid: string, send: GetTaskActionResponse) => void;
|
|
8
|
+
export type TaskProgressCallback = (i: number) => void;
|
|
9
|
+
export type GlobalData = {
|
|
10
|
+
[key: string]: GlobalDataType;
|
|
11
|
+
};
|
|
12
|
+
export type GlobalDataType = ToolParamFile | ToolParamFile[] | ToolParamFileDownload | string | object;
|
|
13
|
+
export interface ToolParamFile {
|
|
14
|
+
path: string;
|
|
15
|
+
source?: FileSource;
|
|
16
|
+
duration?: number;
|
|
17
|
+
size?: number;
|
|
18
|
+
ext?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
uid?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare enum FileSource {
|
|
23
|
+
Local = 0,// 本地
|
|
24
|
+
Cos = 1
|
|
25
|
+
}
|
|
26
|
+
export interface ToolParamFileDownload {
|
|
27
|
+
url: string;
|
|
28
|
+
filename: string;
|
|
29
|
+
headers?: object;
|
|
30
|
+
}
|
|
31
|
+
export interface LocalActionRequest {
|
|
32
|
+
action_type: LocalActionReqType;
|
|
33
|
+
id: string;
|
|
34
|
+
data?: LocalActionReqDataCreatTask | LocalActionReqDataRestoreTask | MqttRequest | ToolParamFile | string;
|
|
35
|
+
}
|
|
36
|
+
export declare enum LocalActionReqType {
|
|
37
|
+
TaskCreate = 0,// 创建一个新任务
|
|
38
|
+
TaskStop = 1,// 停止任务
|
|
39
|
+
TaskRestore = 2,// 恢复任务
|
|
40
|
+
MqttSend = 3,// 发送MQTT
|
|
41
|
+
ActionClose = 4,// 关闭action链接
|
|
42
|
+
MqttReconnect = 5,// MQTT重连
|
|
43
|
+
TaskActionAdd = 6,// 添加一个action动作
|
|
44
|
+
NavigateTo = 7,// 跳转到指定页面
|
|
45
|
+
SetToken = 8,// 设置token信息(extension)
|
|
46
|
+
UploadFile = 9
|
|
47
|
+
}
|
|
48
|
+
export interface LocalActionReqDataCreatTask {
|
|
49
|
+
name: string;
|
|
50
|
+
desc: string;
|
|
51
|
+
replace_param?: string[];
|
|
52
|
+
global_param: GlobalData;
|
|
53
|
+
task_list: ToolTaskInfo[];
|
|
54
|
+
}
|
|
55
|
+
export interface LocalActionReqDataRestoreTask {
|
|
56
|
+
task_data: LocalActionReqDataCreatTask;
|
|
57
|
+
restore_info?: TaskRestoreInfo;
|
|
58
|
+
}
|
|
59
|
+
export interface TaskRestoreInfo {
|
|
60
|
+
idx: number;
|
|
61
|
+
info: {
|
|
62
|
+
[key: number]: any;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface LocalActionResponse {
|
|
66
|
+
id: string;
|
|
67
|
+
action_type: LocalActionResType;
|
|
68
|
+
data: TaskActionResDataUpdateTaskInfo | LocalActionReqDataCreatTask | MqttResponse | string;
|
|
69
|
+
}
|
|
70
|
+
export declare enum LocalActionResType {
|
|
71
|
+
TaskInfoUpdate = 0,// 任务信息更新
|
|
72
|
+
MqttBack = 1,// Mqtt数据回调
|
|
73
|
+
TaskActionAdd = 2,// 新增一个action
|
|
74
|
+
NavigateTo = 3,// 跳转到指定页面
|
|
75
|
+
FileUpload = 4
|
|
76
|
+
}
|
|
77
|
+
export interface TaskActionResDataUpdateTaskInfo {
|
|
78
|
+
progress?: number;
|
|
79
|
+
status?: LocalTaskStatus;
|
|
80
|
+
msg?: string;
|
|
81
|
+
restore_info?: any;
|
|
82
|
+
output?: string;
|
|
83
|
+
outputs?: GlobalData;
|
|
84
|
+
}
|
|
85
|
+
export interface LocalTaskInfo {
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
desc: string;
|
|
89
|
+
status: LocalTaskStatus;
|
|
90
|
+
progress: number;
|
|
91
|
+
msg?: string;
|
|
92
|
+
task_data: string;
|
|
93
|
+
restore_info?: string;
|
|
94
|
+
output: string;
|
|
95
|
+
create_time: number;
|
|
96
|
+
}
|
|
97
|
+
export declare enum LocalTaskStatus {
|
|
98
|
+
Waiting = "\u7B49\u5F85",
|
|
99
|
+
Running = "\u8FDB\u884C",
|
|
100
|
+
Fail = "\u5931\u8D25",
|
|
101
|
+
Success = "\u6210\u529F",
|
|
102
|
+
Canceled = "\u53D6\u6D88"
|
|
103
|
+
}
|
|
104
|
+
export interface TaskService {
|
|
105
|
+
taskActionBackHandle: (callback: GetTaskActionResponse) => Promise<{
|
|
106
|
+
send: SendTaskActionRequest;
|
|
107
|
+
close: TaskActionClose;
|
|
108
|
+
}>;
|
|
109
|
+
taskActionHandle: (callback: GetTaskActionRequest, addSend: SendTaskActionResponse) => void;
|
|
110
|
+
}
|
|
111
|
+
export interface IframeMsgData {
|
|
112
|
+
task_type: number;
|
|
113
|
+
data?: any;
|
|
114
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface MqttRequest {
|
|
2
|
+
task_id: string;
|
|
3
|
+
task_type: number;
|
|
4
|
+
data: any;
|
|
5
|
+
}
|
|
6
|
+
export interface MqttResponse {
|
|
7
|
+
task_id: string;
|
|
8
|
+
event_type: MQTTEventType;
|
|
9
|
+
data: any;
|
|
10
|
+
}
|
|
11
|
+
export declare enum MQTTEventType {
|
|
12
|
+
Start = 1,
|
|
13
|
+
Progress = 2,
|
|
14
|
+
Success = 3,
|
|
15
|
+
Error = 4
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface ToolTaskInfo {
|
|
2
|
+
task_type: ToolTaskType;
|
|
3
|
+
inputs: string[];
|
|
4
|
+
outputs: string[];
|
|
5
|
+
task_data: TaskDataFfmpeg | TaskDataCloud | TaskDataDownload;
|
|
6
|
+
}
|
|
7
|
+
export declare enum ToolTaskType {
|
|
8
|
+
Ffmpeg = 0,// 转码任务
|
|
9
|
+
Cloud = 1,// 云端任务
|
|
10
|
+
Download = 2
|
|
11
|
+
}
|
|
12
|
+
export interface TaskDataFfmpeg {
|
|
13
|
+
input: string[];
|
|
14
|
+
output: string[];
|
|
15
|
+
task_out: string;
|
|
16
|
+
actions: FfmpegTaskAction[];
|
|
17
|
+
}
|
|
18
|
+
export interface FfmpegTaskAction {
|
|
19
|
+
action_type: FfmpegActionType;
|
|
20
|
+
param: FfmpegTaskParam;
|
|
21
|
+
}
|
|
22
|
+
export declare enum FfmpegActionType {
|
|
23
|
+
SubtitleEmbed = 0,// 嵌入字幕
|
|
24
|
+
NoVideo = 1,// 移除视频信息
|
|
25
|
+
NoAudio = 2,// 移除音频信息
|
|
26
|
+
AudioEncode = 3,// 音频编码
|
|
27
|
+
VideoEncode = 4,// 视频编码
|
|
28
|
+
MergeFile = 5,// 文件合并
|
|
29
|
+
Format = 6,// 视频格式化
|
|
30
|
+
AddOption = 7,// 添加额外选项
|
|
31
|
+
OutputOption = 8,// 输出选项
|
|
32
|
+
InputOption = 9
|
|
33
|
+
}
|
|
34
|
+
export interface FfmpegTaskParam {
|
|
35
|
+
unique?: string;
|
|
36
|
+
data?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TaskDataCloud {
|
|
39
|
+
task_type: number;
|
|
40
|
+
output?: string;
|
|
41
|
+
upload_list?: string[];
|
|
42
|
+
upload_source?: number;
|
|
43
|
+
download_list?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface TaskDataDownload {
|
|
46
|
+
output?: string;
|
|
47
|
+
relation: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const convertFileSize: (bytes: number) => string;
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zyjj-web-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"lib"
|
|
7
|
+
],
|
|
8
|
+
"module": "./lib/index.js",
|
|
9
|
+
"main": "./lib/index.umd.cjs",
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "tsc && vite build",
|
|
14
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
15
|
+
"preview": "vite preview"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@arco-design/web-react": "^2.61.2",
|
|
20
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
21
|
+
"@types/node": "^20.12.6",
|
|
22
|
+
"@types/react": "^18.2.66",
|
|
23
|
+
"@types/react-dom": "^18.2.22",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
25
|
+
"@typescript-eslint/parser": "^7.2.0",
|
|
26
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
27
|
+
"axios": "^1.6.8",
|
|
28
|
+
"eslint": "^8.57.0",
|
|
29
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
30
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
31
|
+
"react": "^18.2.0",
|
|
32
|
+
"react-dom": "^18.2.0",
|
|
33
|
+
"tslib": "^2.6.2",
|
|
34
|
+
"typescript": "^5.4.4",
|
|
35
|
+
"vite": "^5.2.0",
|
|
36
|
+
"vite-plugin-svgr": "^4.2.0"
|
|
37
|
+
}
|
|
38
|
+
}
|