@soga/entities 1.0.0 → 1.3.1
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/dist/download-file.d.ts +49 -0
- package/dist/download-file.d.ts.map +1 -0
- package/dist/download-file.js +220 -0
- package/dist/fetch-url.d.ts +10 -0
- package/dist/fetch-url.d.ts.map +1 -0
- package/dist/fetch-url.js +60 -0
- package/dist/host-token.d.ts +20 -0
- package/dist/host-token.d.ts.map +1 -0
- package/dist/host-token.js +62 -0
- package/dist/index.d.ts +9 -223
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -1
- package/dist/media-subtitles.d.ts +35 -0
- package/dist/media-subtitles.d.ts.map +1 -0
- package/dist/media-subtitles.js +141 -0
- package/dist/upload-file.d.ts +49 -0
- package/dist/upload-file.d.ts.map +1 -0
- package/dist/upload-file.js +270 -0
- package/dist/upload-part.d.ts +30 -0
- package/dist/upload-part.d.ts.map +1 -0
- package/dist/upload-part.js +112 -0
- package/dist/upload-running.d.ts +14 -0
- package/dist/upload-running.d.ts.map +1 -0
- package/dist/upload-running.js +68 -0
- package/dist/upload-success.d.ts +21 -0
- package/dist/upload-success.d.ts.map +1 -0
- package/dist/upload-success.js +101 -0
- package/package.json +12 -12
- package/dist/index.d.mts +0 -223
- package/dist/index.mjs +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RecordFtype, RecordInfo, RecordType } from '@soga/types';
|
|
2
|
+
export declare enum DownloadFrom {
|
|
3
|
+
BAIDU = "baidu",
|
|
4
|
+
ALI = "ali",
|
|
5
|
+
ALL = "all"
|
|
6
|
+
}
|
|
7
|
+
export declare enum DownloadStatus {
|
|
8
|
+
NULL = 0,
|
|
9
|
+
PROCESS = 1,
|
|
10
|
+
SUCCESS = 2,
|
|
11
|
+
ERROR = 4
|
|
12
|
+
}
|
|
13
|
+
export declare class DownloadFile {
|
|
14
|
+
id: number;
|
|
15
|
+
cloud_id: number;
|
|
16
|
+
title: string;
|
|
17
|
+
has_attachment: boolean;
|
|
18
|
+
attachment_uuid: string;
|
|
19
|
+
download_from: DownloadFrom;
|
|
20
|
+
baidu_host_id: number;
|
|
21
|
+
ali_host_id: number;
|
|
22
|
+
is_paused: boolean;
|
|
23
|
+
is_ready: boolean;
|
|
24
|
+
type: RecordType;
|
|
25
|
+
ftype: RecordFtype;
|
|
26
|
+
routes: string[];
|
|
27
|
+
download_root: string;
|
|
28
|
+
pid: number;
|
|
29
|
+
root_id: number;
|
|
30
|
+
space_id: number;
|
|
31
|
+
space_name: string;
|
|
32
|
+
uid: number;
|
|
33
|
+
detail: RecordInfo;
|
|
34
|
+
order: number;
|
|
35
|
+
status: DownloadStatus;
|
|
36
|
+
file_total: number;
|
|
37
|
+
file_successed: number;
|
|
38
|
+
percent: number;
|
|
39
|
+
progress: DownloadProgressData;
|
|
40
|
+
error: Record<string, unknown>;
|
|
41
|
+
updated_at: Date;
|
|
42
|
+
created_at: Date;
|
|
43
|
+
}
|
|
44
|
+
export type DownloadProgressStep = 'PREPARE' | 'DOWNLOAD_CHUNK' | 'COMBINE_CHUNK' | 'UNPACK' | 'ENDING';
|
|
45
|
+
export type DownloadProgressData = Record<DownloadProgressStep, {
|
|
46
|
+
weight: number;
|
|
47
|
+
percent: number;
|
|
48
|
+
}>;
|
|
49
|
+
//# sourceMappingURL=download-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../src/download-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWlE,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAMD,oBAAY,cAAc;IACxB,IAAI,IAAI;IACR,OAAO,IAAI;IACX,OAAO,IAAI;IACX,KAAK,IAAI;CACV;AAED,qBACa,YAAY;IAEvB,EAAE,EAAE,MAAM,CAAC;IAGX,QAAQ,EAAE,MAAM,CAAC;IAGjB,KAAK,EAAE,MAAM,CAAC;IAMd,cAAc,EAAE,OAAO,CAAC;IAGxB,eAAe,EAAE,MAAM,CAAC;IASxB,aAAa,EAAE,YAAY,CAAC;IAG5B,aAAa,EAAE,MAAM,CAAC;IAGtB,WAAW,EAAE,MAAM,CAAC;IAKpB,SAAS,EAAE,OAAO,CAAC;IAGnB,QAAQ,EAAE,OAAO,CAAC;IAMlB,IAAI,EAAE,UAAU,CAAC;IAOjB,KAAK,EAAE,WAAW,CAAC;IAGnB,MAAM,EAAE,MAAM,EAAE,CAAC;IAGjB,aAAa,EAAE,MAAM,CAAC;IAWtB,GAAG,EAAE,MAAM,CAAC;IAIZ,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC;IAGjB,UAAU,EAAE,MAAM,CAAC;IAGnB,GAAG,EAAE,MAAM,CAAC;IAGZ,MAAM,EAAE,UAAU,CAAC;IAGnB,KAAK,EAAE,MAAM,CAAC;IAOd,MAAM,EAAE,cAAc,CAAC;IAGvB,UAAU,EAAE,MAAM,CAAC;IAGnB,cAAc,EAAE,MAAM,CAAC;IAavB,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,EAAE,oBAAoB,CAAC;IAG/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG/B,UAAU,EAAE,IAAI,CAAC;IAGjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAYD,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,gBAAgB,GAChB,eAAe,GACf,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,oBAAoB,GAAG,MAAM,CACvC,oBAAoB,EACpB;IACE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CACF,CAAC"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DownloadFile = exports.DownloadStatus = exports.DownloadFrom = void 0;
|
|
13
|
+
const types_1 = require("@soga/types");
|
|
14
|
+
// import { ErrorData } from 'src/libs/errors/code';
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
var DownloadFrom;
|
|
17
|
+
(function (DownloadFrom) {
|
|
18
|
+
DownloadFrom["BAIDU"] = "baidu";
|
|
19
|
+
DownloadFrom["ALI"] = "ali";
|
|
20
|
+
DownloadFrom["ALL"] = "all";
|
|
21
|
+
})(DownloadFrom || (exports.DownloadFrom = DownloadFrom = {}));
|
|
22
|
+
// export enum DownloadType {
|
|
23
|
+
// SOURCE = 'source',
|
|
24
|
+
// PREVIEW = 'preview',
|
|
25
|
+
// }
|
|
26
|
+
var DownloadStatus;
|
|
27
|
+
(function (DownloadStatus) {
|
|
28
|
+
DownloadStatus[DownloadStatus["NULL"] = 0] = "NULL";
|
|
29
|
+
DownloadStatus[DownloadStatus["PROCESS"] = 1] = "PROCESS";
|
|
30
|
+
DownloadStatus[DownloadStatus["SUCCESS"] = 2] = "SUCCESS";
|
|
31
|
+
DownloadStatus[DownloadStatus["ERROR"] = 4] = "ERROR";
|
|
32
|
+
})(DownloadStatus || (exports.DownloadStatus = DownloadStatus = {}));
|
|
33
|
+
let DownloadFile = class DownloadFile {
|
|
34
|
+
id;
|
|
35
|
+
cloud_id;
|
|
36
|
+
title;
|
|
37
|
+
// 是否含有附件
|
|
38
|
+
has_attachment;
|
|
39
|
+
attachment_uuid;
|
|
40
|
+
// @Column({
|
|
41
|
+
// type: 'simple-enum',
|
|
42
|
+
// enum: DownloadType,
|
|
43
|
+
// default: DownloadType.SOURCE,
|
|
44
|
+
// })
|
|
45
|
+
// download_type: DownloadType;
|
|
46
|
+
download_from;
|
|
47
|
+
baidu_host_id;
|
|
48
|
+
ali_host_id;
|
|
49
|
+
is_paused;
|
|
50
|
+
is_ready;
|
|
51
|
+
type;
|
|
52
|
+
ftype;
|
|
53
|
+
routes;
|
|
54
|
+
download_root;
|
|
55
|
+
// @Column({ default: '' })
|
|
56
|
+
// download_temp: string;
|
|
57
|
+
// @Column({ default: '' })
|
|
58
|
+
// download_name: string;
|
|
59
|
+
pid;
|
|
60
|
+
root_id;
|
|
61
|
+
space_id;
|
|
62
|
+
space_name;
|
|
63
|
+
uid;
|
|
64
|
+
detail;
|
|
65
|
+
order;
|
|
66
|
+
status;
|
|
67
|
+
file_total;
|
|
68
|
+
file_successed;
|
|
69
|
+
// @Column({
|
|
70
|
+
// type: 'simple-enum',
|
|
71
|
+
// enum: DownloadStage,
|
|
72
|
+
// default: DownloadStage.NULL,
|
|
73
|
+
// })
|
|
74
|
+
// stage: DownloadStage;
|
|
75
|
+
// @Column({ default: 0 })
|
|
76
|
+
// file_size: number;
|
|
77
|
+
percent;
|
|
78
|
+
progress;
|
|
79
|
+
error;
|
|
80
|
+
updated_at;
|
|
81
|
+
created_at;
|
|
82
|
+
};
|
|
83
|
+
exports.DownloadFile = DownloadFile;
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
|
+
], DownloadFile.prototype, "id", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.Column)(),
|
|
90
|
+
__metadata("design:type", Number)
|
|
91
|
+
], DownloadFile.prototype, "cloud_id", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)(),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], DownloadFile.prototype, "title", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.Column)({
|
|
98
|
+
default: false,
|
|
99
|
+
}),
|
|
100
|
+
__metadata("design:type", Boolean)
|
|
101
|
+
], DownloadFile.prototype, "has_attachment", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], DownloadFile.prototype, "attachment_uuid", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
108
|
+
__metadata("design:type", String)
|
|
109
|
+
], DownloadFile.prototype, "download_from", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
112
|
+
__metadata("design:type", Number)
|
|
113
|
+
], DownloadFile.prototype, "baidu_host_id", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
116
|
+
__metadata("design:type", Number)
|
|
117
|
+
], DownloadFile.prototype, "ali_host_id", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({
|
|
120
|
+
default: false,
|
|
121
|
+
}),
|
|
122
|
+
__metadata("design:type", Boolean)
|
|
123
|
+
], DownloadFile.prototype, "is_paused", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
126
|
+
__metadata("design:type", Boolean)
|
|
127
|
+
], DownloadFile.prototype, "is_ready", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, typeorm_1.Column)({
|
|
130
|
+
type: 'simple-enum',
|
|
131
|
+
enum: types_1.RecordType,
|
|
132
|
+
}),
|
|
133
|
+
__metadata("design:type", Number)
|
|
134
|
+
], DownloadFile.prototype, "type", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.Column)({
|
|
137
|
+
type: 'simple-enum',
|
|
138
|
+
enum: types_1.RecordFtype,
|
|
139
|
+
default: types_1.RecordFtype.NONE,
|
|
140
|
+
}),
|
|
141
|
+
__metadata("design:type", Number)
|
|
142
|
+
], DownloadFile.prototype, "ftype", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, typeorm_1.Column)({ type: 'json', default: '[]' }),
|
|
145
|
+
__metadata("design:type", Array)
|
|
146
|
+
], DownloadFile.prototype, "routes", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, typeorm_1.Column)({ default: '' }),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], DownloadFile.prototype, "download_root", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, typeorm_1.Column)({
|
|
153
|
+
default: 0,
|
|
154
|
+
}),
|
|
155
|
+
__metadata("design:type", Number)
|
|
156
|
+
], DownloadFile.prototype, "pid", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, typeorm_1.Index)(),
|
|
159
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
160
|
+
__metadata("design:type", Number)
|
|
161
|
+
], DownloadFile.prototype, "root_id", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.Column)(),
|
|
164
|
+
__metadata("design:type", Number)
|
|
165
|
+
], DownloadFile.prototype, "space_id", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, typeorm_1.Column)(),
|
|
168
|
+
__metadata("design:type", String)
|
|
169
|
+
], DownloadFile.prototype, "space_name", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, typeorm_1.Column)(),
|
|
172
|
+
__metadata("design:type", Number)
|
|
173
|
+
], DownloadFile.prototype, "uid", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, typeorm_1.Column)('json', { default: '{}' }),
|
|
176
|
+
__metadata("design:type", Object)
|
|
177
|
+
], DownloadFile.prototype, "detail", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
180
|
+
__metadata("design:type", Number)
|
|
181
|
+
], DownloadFile.prototype, "order", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
(0, typeorm_1.Column)({
|
|
184
|
+
type: 'simple-enum',
|
|
185
|
+
enum: DownloadStatus,
|
|
186
|
+
default: DownloadStatus.NULL,
|
|
187
|
+
}),
|
|
188
|
+
__metadata("design:type", Number)
|
|
189
|
+
], DownloadFile.prototype, "status", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
192
|
+
__metadata("design:type", Number)
|
|
193
|
+
], DownloadFile.prototype, "file_total", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
196
|
+
__metadata("design:type", Number)
|
|
197
|
+
], DownloadFile.prototype, "file_successed", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
(0, typeorm_1.Column)({ default: 0, type: 'decimal' }),
|
|
200
|
+
__metadata("design:type", Number)
|
|
201
|
+
], DownloadFile.prototype, "percent", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
(0, typeorm_1.Column)({ type: 'json', default: '{}' }),
|
|
204
|
+
__metadata("design:type", Object)
|
|
205
|
+
], DownloadFile.prototype, "progress", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
(0, typeorm_1.Column)({ type: 'json', default: '{}' }),
|
|
208
|
+
__metadata("design:type", Object)
|
|
209
|
+
], DownloadFile.prototype, "error", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
212
|
+
__metadata("design:type", Date)
|
|
213
|
+
], DownloadFile.prototype, "updated_at", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
216
|
+
__metadata("design:type", Date)
|
|
217
|
+
], DownloadFile.prototype, "created_at", void 0);
|
|
218
|
+
exports.DownloadFile = DownloadFile = __decorate([
|
|
219
|
+
(0, typeorm_1.Entity)()
|
|
220
|
+
], DownloadFile);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-url.d.ts","sourceRoot":"","sources":["../src/fetch-url.ts"],"names":[],"mappings":"AAQA,qBACa,QAAQ;IAEnB,EAAE,EAAE,MAAM,CAAC;IAKX,KAAK,EAAE,MAAM,CAAC;IAId,GAAG,EAAE,MAAM,CAAC;IAIZ,KAAK,EAAE,MAAM,CAAC;IAId,MAAM,EAAE,MAAM,CAAC;IAIf,IAAI,EAAE,MAAM,CAAC;IAGb,UAAU,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FetchUrl = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
let FetchUrl = class FetchUrl {
|
|
15
|
+
id;
|
|
16
|
+
// 下载速率 Bytes/秒
|
|
17
|
+
speed;
|
|
18
|
+
key;
|
|
19
|
+
dlink;
|
|
20
|
+
expire;
|
|
21
|
+
fail;
|
|
22
|
+
created_at;
|
|
23
|
+
};
|
|
24
|
+
exports.FetchUrl = FetchUrl;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], FetchUrl.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Index)(),
|
|
31
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
32
|
+
__metadata("design:type", Number)
|
|
33
|
+
], FetchUrl.prototype, "speed", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Index)(),
|
|
36
|
+
(0, typeorm_1.Column)(),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], FetchUrl.prototype, "key", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Index)(),
|
|
41
|
+
(0, typeorm_1.Column)(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], FetchUrl.prototype, "dlink", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Index)(),
|
|
46
|
+
(0, typeorm_1.Column)(),
|
|
47
|
+
__metadata("design:type", Number)
|
|
48
|
+
], FetchUrl.prototype, "expire", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Index)(),
|
|
51
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], FetchUrl.prototype, "fail", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], FetchUrl.prototype, "created_at", void 0);
|
|
58
|
+
exports.FetchUrl = FetchUrl = __decorate([
|
|
59
|
+
(0, typeorm_1.Entity)()
|
|
60
|
+
], FetchUrl);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HostType } from '@soga/types';
|
|
2
|
+
export type BaiduAuthData = {
|
|
3
|
+
token: string;
|
|
4
|
+
};
|
|
5
|
+
export type AliAuthData = {
|
|
6
|
+
token: string;
|
|
7
|
+
drive_id: string;
|
|
8
|
+
dpan_file_id: string;
|
|
9
|
+
cache_file_id: string;
|
|
10
|
+
space_file_id: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class HostToken {
|
|
13
|
+
id: number;
|
|
14
|
+
uid: number;
|
|
15
|
+
host_id: number;
|
|
16
|
+
auth_data: BaiduAuthData | AliAuthData;
|
|
17
|
+
type: HostType;
|
|
18
|
+
expired_at: number;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=host-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-token.d.ts","sourceRoot":"","sources":["../src/host-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AASF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CAKvB,CAAC;AAEF,qBAEa,SAAS;IAEpB,EAAE,EAAE,MAAM,CAAC;IAIX,GAAG,EAAE,MAAM,CAAC;IAIZ,OAAO,EAAE,MAAM,CAAC;IAMhB,SAAS,EAAE,aAAa,GAAG,WAAW,CAAC;IAOvC,IAAI,EAAE,QAAQ,CAAC;IAMf,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HostToken = void 0;
|
|
13
|
+
const types_1 = require("@soga/types");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
let HostToken = class HostToken {
|
|
16
|
+
id;
|
|
17
|
+
// 用户id
|
|
18
|
+
uid;
|
|
19
|
+
host_id;
|
|
20
|
+
auth_data;
|
|
21
|
+
type;
|
|
22
|
+
// @Column()
|
|
23
|
+
// token: string;
|
|
24
|
+
expired_at;
|
|
25
|
+
};
|
|
26
|
+
exports.HostToken = HostToken;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], HostToken.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)(),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], HostToken.prototype, "uid", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Index)(),
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
__metadata("design:type", Number)
|
|
39
|
+
], HostToken.prototype, "host_id", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({
|
|
42
|
+
type: 'json',
|
|
43
|
+
nullable: true,
|
|
44
|
+
}),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], HostToken.prototype, "auth_data", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({
|
|
49
|
+
type: 'simple-enum',
|
|
50
|
+
default: types_1.HostType.BAIDU,
|
|
51
|
+
enum: types_1.HostType,
|
|
52
|
+
}),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], HostToken.prototype, "type", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)(),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], HostToken.prototype, "expired_at", void 0);
|
|
59
|
+
exports.HostToken = HostToken = __decorate([
|
|
60
|
+
(0, typeorm_1.Index)(['uid', 'host_id']),
|
|
61
|
+
(0, typeorm_1.Entity)()
|
|
62
|
+
], HostToken);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,223 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
NULL = 0,
|
|
11
|
-
PROCESS = 1,
|
|
12
|
-
SUCCESS = 2,
|
|
13
|
-
ERROR = 4
|
|
14
|
-
}
|
|
15
|
-
declare class DownloadFile {
|
|
16
|
-
id: number;
|
|
17
|
-
cloud_id: number;
|
|
18
|
-
title: string;
|
|
19
|
-
has_attachment: boolean;
|
|
20
|
-
attachment_uuid: string;
|
|
21
|
-
download_from: DownloadFrom;
|
|
22
|
-
baidu_host_id: number;
|
|
23
|
-
ali_host_id: number;
|
|
24
|
-
is_paused: boolean;
|
|
25
|
-
is_ready: boolean;
|
|
26
|
-
type: RecordType;
|
|
27
|
-
ftype: RecordFtype;
|
|
28
|
-
routes: string[];
|
|
29
|
-
download_root: string;
|
|
30
|
-
pid: number;
|
|
31
|
-
root_id: number;
|
|
32
|
-
space_id: number;
|
|
33
|
-
space_name: string;
|
|
34
|
-
uid: number;
|
|
35
|
-
detail: RecordInfo;
|
|
36
|
-
order: number;
|
|
37
|
-
status: DownloadStatus;
|
|
38
|
-
file_total: number;
|
|
39
|
-
file_successed: number;
|
|
40
|
-
percent: number;
|
|
41
|
-
progress: DownloadProgressData;
|
|
42
|
-
error: Record<string, unknown>;
|
|
43
|
-
updated_at: Date;
|
|
44
|
-
created_at: Date;
|
|
45
|
-
}
|
|
46
|
-
type DownloadProgressStep = 'PREPARE' | 'DOWNLOAD_CHUNK' | 'COMBINE_CHUNK' | 'UNPACK' | 'ENDING';
|
|
47
|
-
type DownloadProgressData = Record<DownloadProgressStep, {
|
|
48
|
-
weight: number;
|
|
49
|
-
percent: number;
|
|
50
|
-
}>;
|
|
51
|
-
|
|
52
|
-
type BaiduAuthData = {
|
|
53
|
-
token: string;
|
|
54
|
-
};
|
|
55
|
-
type AliAuthData = {
|
|
56
|
-
token: string;
|
|
57
|
-
drive_id: string;
|
|
58
|
-
dpan_file_id: string;
|
|
59
|
-
cache_file_id: string;
|
|
60
|
-
space_file_id: string;
|
|
61
|
-
};
|
|
62
|
-
declare class HostToken {
|
|
63
|
-
id: number;
|
|
64
|
-
uid: number;
|
|
65
|
-
host_id: number;
|
|
66
|
-
auth_data: BaiduAuthData | AliAuthData;
|
|
67
|
-
type: HostType;
|
|
68
|
-
expired_at: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
declare class FetchUrl {
|
|
72
|
-
id: number;
|
|
73
|
-
speed: number;
|
|
74
|
-
key: string;
|
|
75
|
-
dlink: string;
|
|
76
|
-
expire: number;
|
|
77
|
-
fail: number;
|
|
78
|
-
created_at: Date;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
declare enum ActionType {
|
|
82
|
-
ADD = "add",
|
|
83
|
-
UPDATE = "update"
|
|
84
|
-
}
|
|
85
|
-
declare class MediaSubtitles {
|
|
86
|
-
id: number;
|
|
87
|
-
is_attachment: boolean;
|
|
88
|
-
uuid: string;
|
|
89
|
-
uid: number;
|
|
90
|
-
space_id: number;
|
|
91
|
-
space_name: string;
|
|
92
|
-
record_id: number;
|
|
93
|
-
record_name: string;
|
|
94
|
-
record_info: RecordDetail;
|
|
95
|
-
action_type: ActionType;
|
|
96
|
-
action_uuid: string;
|
|
97
|
-
inputs: string[];
|
|
98
|
-
baidu_upload_result: {
|
|
99
|
-
md5: string;
|
|
100
|
-
md4: string;
|
|
101
|
-
size: number;
|
|
102
|
-
fs_id: number;
|
|
103
|
-
};
|
|
104
|
-
ali_upload_result: {
|
|
105
|
-
md5: string;
|
|
106
|
-
sha1: string;
|
|
107
|
-
size: number;
|
|
108
|
-
file_id: string;
|
|
109
|
-
};
|
|
110
|
-
status: NormalStatus;
|
|
111
|
-
output_root: string;
|
|
112
|
-
created_at: Date;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
interface ErrorType {
|
|
116
|
-
type: 'encode' | 'upload';
|
|
117
|
-
message: string;
|
|
118
|
-
stack?: string;
|
|
119
|
-
details?: string[];
|
|
120
|
-
cause?: any;
|
|
121
|
-
}
|
|
122
|
-
declare class UploadFile {
|
|
123
|
-
id: number;
|
|
124
|
-
is_attachment: boolean;
|
|
125
|
-
total_count: number;
|
|
126
|
-
completed_count: number;
|
|
127
|
-
input: UploadInputItem;
|
|
128
|
-
filepath: string;
|
|
129
|
-
root_id: number;
|
|
130
|
-
root_status: NormalStatus;
|
|
131
|
-
space_id: number;
|
|
132
|
-
space_name: string;
|
|
133
|
-
is_ready: boolean;
|
|
134
|
-
config: RecordFolderConfig;
|
|
135
|
-
uid: number;
|
|
136
|
-
aid: number;
|
|
137
|
-
baidu_host_id: number;
|
|
138
|
-
baidu_upload_result: Record<string, {
|
|
139
|
-
md4: string;
|
|
140
|
-
fs_id: number;
|
|
141
|
-
}>;
|
|
142
|
-
ali_host_id: number;
|
|
143
|
-
ali_upload_result: Record<string, object>;
|
|
144
|
-
upload_status: UploadStatus;
|
|
145
|
-
is_paused: boolean;
|
|
146
|
-
pid: number;
|
|
147
|
-
type: RecordType;
|
|
148
|
-
ftype: RecordFtype;
|
|
149
|
-
task_record_id: number;
|
|
150
|
-
cloud_info: CloudInfoField;
|
|
151
|
-
output_root: string;
|
|
152
|
-
external_texts: string[];
|
|
153
|
-
progress: EncodePrepareResult;
|
|
154
|
-
percent: number;
|
|
155
|
-
encoded: EncodeResult;
|
|
156
|
-
error: ErrorType | null;
|
|
157
|
-
order: number;
|
|
158
|
-
updated_at: Date;
|
|
159
|
-
created_at: Date;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
declare class UploadPart {
|
|
163
|
-
id: number;
|
|
164
|
-
uid: number;
|
|
165
|
-
file_id: number;
|
|
166
|
-
root_id: number;
|
|
167
|
-
part_name: string;
|
|
168
|
-
is_paused: boolean;
|
|
169
|
-
output_root: string;
|
|
170
|
-
info: PartItem;
|
|
171
|
-
host_id: number;
|
|
172
|
-
host_type: HostType;
|
|
173
|
-
upload_status: NormalStatus;
|
|
174
|
-
upload_percent: number;
|
|
175
|
-
upload_result: UploadResult;
|
|
176
|
-
updated_at: Date;
|
|
177
|
-
created_at: Date;
|
|
178
|
-
}
|
|
179
|
-
type UploadResult = {
|
|
180
|
-
ali?: {
|
|
181
|
-
file_id: string;
|
|
182
|
-
drive_id: string;
|
|
183
|
-
};
|
|
184
|
-
baidu?: {
|
|
185
|
-
fs_id: number;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
declare enum UploadRunningType {
|
|
190
|
-
ENCODE = "encode",
|
|
191
|
-
UPLOAD = "upload"
|
|
192
|
-
}
|
|
193
|
-
declare class UploadRunning {
|
|
194
|
-
id: number;
|
|
195
|
-
uid: number;
|
|
196
|
-
type: UploadRunningType;
|
|
197
|
-
root_id: number;
|
|
198
|
-
file_id: number;
|
|
199
|
-
part_id: number;
|
|
200
|
-
created_at: Date;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
declare class UploadSuccess {
|
|
204
|
-
id: number;
|
|
205
|
-
is_attachment: boolean;
|
|
206
|
-
root_id: number;
|
|
207
|
-
pid: number;
|
|
208
|
-
space_id: number;
|
|
209
|
-
space_name: string;
|
|
210
|
-
uid: number;
|
|
211
|
-
input: {
|
|
212
|
-
filename: string;
|
|
213
|
-
filepath: string;
|
|
214
|
-
filesize: number;
|
|
215
|
-
};
|
|
216
|
-
cloud_id: number;
|
|
217
|
-
cloud_name: string;
|
|
218
|
-
type: RecordType;
|
|
219
|
-
updated_at: Date;
|
|
220
|
-
created_at: Date;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export { ActionType, type AliAuthData, type BaiduAuthData, DownloadFile, DownloadFrom, type DownloadProgressData, type DownloadProgressStep, DownloadStatus, type ErrorType, FetchUrl, HostToken, MediaSubtitles, UploadFile, UploadPart, UploadRunning, UploadRunningType, UploadSuccess };
|
|
1
|
+
export * from './download-file';
|
|
2
|
+
export * from './host-token';
|
|
3
|
+
export * from './fetch-url';
|
|
4
|
+
export * from './media-subtitles';
|
|
5
|
+
export * from './upload-file';
|
|
6
|
+
export * from './upload-part';
|
|
7
|
+
export * from './upload-running';
|
|
8
|
+
export * from './upload-success';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|