egos-transfer 0.1.3 → 0.1.6
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/constant.d.ts +1 -1
- package/dist/constant.js +1 -1
- package/dist/file-transfer.js +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +205 -192
- package/dist/router.js +1 -1
- package/package.json +1 -1
- package/src/constant.ts +1 -1
- package/src/file-transfer.ts +1 -0
- package/src/index.ts +221 -202
- package/src/router.ts +1 -3
package/dist/constant.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const REQUEST_TIMEOUT = 18000;
|
|
|
2
2
|
export declare const HEARTBEAT_INTERVAL = 12000;
|
|
3
3
|
export declare const TRANSFER_TIMEOUT = 300000;
|
|
4
4
|
export declare const PING_TIMEOUT = 5000;
|
|
5
|
-
export declare const CONNECTION_TIMEOUT =
|
|
5
|
+
export declare const CONNECTION_TIMEOUT = 6000;
|
|
6
6
|
export declare const LOCKER_TIMEOUT = 15000;
|
|
7
7
|
export declare const RECONNECT_TIMEOUT = 5000;
|
|
8
8
|
export declare const PEER_OPEN_TIMEOUT = 15000;
|
package/dist/constant.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.REQUEST_TIMEOUT = 18000;
|
|
|
5
5
|
exports.HEARTBEAT_INTERVAL = 12000;
|
|
6
6
|
exports.TRANSFER_TIMEOUT = 300000;
|
|
7
7
|
exports.PING_TIMEOUT = 5000;
|
|
8
|
-
exports.CONNECTION_TIMEOUT =
|
|
8
|
+
exports.CONNECTION_TIMEOUT = 6000;
|
|
9
9
|
exports.LOCKER_TIMEOUT = 15000;
|
|
10
10
|
exports.RECONNECT_TIMEOUT = 5000;
|
|
11
11
|
exports.PEER_OPEN_TIMEOUT = 15000;
|
package/dist/file-transfer.js
CHANGED
|
@@ -302,6 +302,7 @@ class FileTransfer {
|
|
|
302
302
|
}
|
|
303
303
|
if (processed.length === totalChunk) {
|
|
304
304
|
const checksum = yield this.taskService.verifyFile(task.transId);
|
|
305
|
+
console.log('file verify', checksum);
|
|
305
306
|
if (checksum) {
|
|
306
307
|
yield this.done(task);
|
|
307
308
|
yield this.updateTask(task.transId, {
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,6 @@ type PeerTransferOptions = PeerOptions & {
|
|
|
12
12
|
};
|
|
13
13
|
export declare abstract class PeerTransfer {
|
|
14
14
|
protected peer: Peer | undefined;
|
|
15
|
-
protected peerPool: Map<string, Peer>;
|
|
16
|
-
protected peerIdMap: Map<string, string>;
|
|
17
15
|
protected connectPool: Map<string, DataConnection>;
|
|
18
16
|
static connecting: Map<string, {
|
|
19
17
|
promise: Promise<any>;
|
|
@@ -26,11 +24,12 @@ export declare abstract class PeerTransfer {
|
|
|
26
24
|
protected requests: Map<string, ResponseCb>;
|
|
27
25
|
protected timeout: number;
|
|
28
26
|
protected router: PeerRouter;
|
|
29
|
-
protected booted: Promise<
|
|
27
|
+
protected booted: Promise<Peer | undefined>;
|
|
30
28
|
protected reconnectingPromise: Promise<Peer | undefined> | undefined;
|
|
31
29
|
protected checkerId: ReturnType<typeof setInterval>;
|
|
32
30
|
isPaused: boolean;
|
|
33
31
|
peerId: string;
|
|
32
|
+
private inRequest;
|
|
34
33
|
constructor(deviceId: string, config: PeerTransferOptions, isRadomPeerId?: boolean);
|
|
35
34
|
abstract getStore(): any;
|
|
36
35
|
abstract online(deviceId: string): void;
|
|
@@ -42,19 +41,21 @@ export declare abstract class PeerTransfer {
|
|
|
42
41
|
abstract requireAuth(): Promise<void>;
|
|
43
42
|
abstract onConnectLimit(): void;
|
|
44
43
|
abstract reloadConfig(config?: Record<string, any>): Promise<void>;
|
|
45
|
-
|
|
44
|
+
createPeer(force?: boolean): Promise<Peer | undefined>;
|
|
45
|
+
initialize(peer: Peer): Promise<void>;
|
|
46
46
|
handleSocketMessage(message: IMessage): void;
|
|
47
47
|
onHeartbeat(message: IMessage): void;
|
|
48
48
|
onError(message: IMessage): void;
|
|
49
49
|
onOpen(message: IMessage): void;
|
|
50
50
|
onDeviceOnline(message: IMessage): Promise<void>;
|
|
51
51
|
onDeviceOffline(message: IMessage): void;
|
|
52
|
-
removeConnection(peerId: string): void;
|
|
52
|
+
removeConnection(peerId: string, connectionId?: string): void;
|
|
53
53
|
addConnection(conn: DataConnection): void;
|
|
54
54
|
checkConnection(): void;
|
|
55
55
|
getApiHost(): string;
|
|
56
56
|
getDeviceStatus(peerId: string): Promise<IDeviceStatus | undefined>;
|
|
57
57
|
connectToPeer(deviceId: string): Promise<DataConnection | undefined>;
|
|
58
|
+
private createConnection;
|
|
58
59
|
ping(peerId: string): Promise<boolean>;
|
|
59
60
|
onConnect(conn: DataConnection): Promise<DataConnection | undefined>;
|
|
60
61
|
request(peerId: string, payload: PeerRequestPayload): Promise<PeerMessage>;
|
|
@@ -73,8 +74,8 @@ export declare abstract class PeerTransfer {
|
|
|
73
74
|
action: PeerAction;
|
|
74
75
|
};
|
|
75
76
|
reconnect(): Promise<Peer | undefined>;
|
|
77
|
+
isValidConnection(conn: DataConnection): boolean;
|
|
76
78
|
private doReconnect;
|
|
77
|
-
createPeer(force?: boolean): Promise<Peer | undefined>;
|
|
78
79
|
clearInstance(): void;
|
|
79
80
|
destroy(): void;
|
|
80
81
|
onRequest(conn: DataConnection, message: PeerMessage): Promise<void>;
|