egos-transfer 0.2.15 → 0.2.17
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/handler.js +2 -2
- package/dist/interfaces.d.ts +2 -0
- package/dist/peer-transfer.js +4 -1
- package/package.json +1 -1
- package/src/handler.ts +2 -2
- package/src/interfaces.ts +2 -0
- package/src/peer-transfer.ts +4 -1
package/dist/handler.js
CHANGED
|
@@ -85,8 +85,7 @@ class Handler {
|
|
|
85
85
|
method: 'get',
|
|
86
86
|
callback: (conn, message) => __awaiter(this, void 0, void 0, function* () {
|
|
87
87
|
const { body } = message;
|
|
88
|
-
const
|
|
89
|
-
const meta = yield handler.process({ transId, fileId, filePath });
|
|
88
|
+
const meta = yield handler.process(body);
|
|
90
89
|
if (!meta) {
|
|
91
90
|
return transfer.responseFail(conn, message, 'meta not found');
|
|
92
91
|
}
|
|
@@ -110,6 +109,7 @@ class Handler {
|
|
|
110
109
|
chunkNumber: body.chunkNumber,
|
|
111
110
|
chunkSize: body.chunkSize,
|
|
112
111
|
totalChunk: body.totalChunk,
|
|
112
|
+
preview: !!body.preview,
|
|
113
113
|
};
|
|
114
114
|
const chunk = yield handler.process(params);
|
|
115
115
|
if (!chunk) {
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -282,6 +282,7 @@ export interface FileMetaParams {
|
|
|
282
282
|
transId: string;
|
|
283
283
|
fileId: string;
|
|
284
284
|
filePath: string;
|
|
285
|
+
preview?: boolean;
|
|
285
286
|
}
|
|
286
287
|
export interface FileChunkParams {
|
|
287
288
|
fileId: string | number;
|
|
@@ -290,6 +291,7 @@ export interface FileChunkParams {
|
|
|
290
291
|
chunkNumber: number;
|
|
291
292
|
chunkSize: number;
|
|
292
293
|
totalChunk: number;
|
|
294
|
+
preview?: boolean;
|
|
293
295
|
}
|
|
294
296
|
export interface FileStartParams {
|
|
295
297
|
transId: string;
|
package/dist/peer-transfer.js
CHANGED
|
@@ -327,7 +327,10 @@ class PeerTransfer {
|
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
329
|
removeConnection(peerId, connectionId) {
|
|
330
|
-
|
|
330
|
+
var _a;
|
|
331
|
+
if (((_a = this.peerConfig) === null || _a === void 0 ? void 0 : _a.debug) >= 2) {
|
|
332
|
+
console.log('removeConnection', peerId, connectionId);
|
|
333
|
+
}
|
|
331
334
|
this.connectionManager.remove(peerId, connectionId);
|
|
332
335
|
}
|
|
333
336
|
isValidConnection(conn) {
|
package/package.json
CHANGED
package/src/handler.ts
CHANGED
|
@@ -110,8 +110,7 @@ export class Handler {
|
|
|
110
110
|
method: 'get',
|
|
111
111
|
callback: async (conn: DataConnection, message: PeerMessage) => {
|
|
112
112
|
const { body } = message;
|
|
113
|
-
const
|
|
114
|
-
const meta = await handler.process({ transId, fileId, filePath });
|
|
113
|
+
const meta = await handler.process(body as FileMetaParams);
|
|
115
114
|
if (!meta) {
|
|
116
115
|
return transfer.responseFail(conn, message, 'meta not found');
|
|
117
116
|
}
|
|
@@ -134,6 +133,7 @@ export class Handler {
|
|
|
134
133
|
chunkNumber: body.chunkNumber,
|
|
135
134
|
chunkSize: body.chunkSize,
|
|
136
135
|
totalChunk: body.totalChunk,
|
|
136
|
+
preview: !!body.preview,
|
|
137
137
|
};
|
|
138
138
|
const chunk = await handler.process(params);
|
|
139
139
|
if (!chunk) {
|
package/src/interfaces.ts
CHANGED
|
@@ -327,6 +327,7 @@ export interface FileMetaParams {
|
|
|
327
327
|
transId: string;
|
|
328
328
|
fileId: string;
|
|
329
329
|
filePath: string;
|
|
330
|
+
preview?: boolean;
|
|
330
331
|
}
|
|
331
332
|
|
|
332
333
|
export interface FileChunkParams {
|
|
@@ -336,6 +337,7 @@ export interface FileChunkParams {
|
|
|
336
337
|
chunkNumber: number;
|
|
337
338
|
chunkSize: number;
|
|
338
339
|
totalChunk: number;
|
|
340
|
+
preview?: boolean;
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
export interface FileStartParams {
|
package/src/peer-transfer.ts
CHANGED
|
@@ -379,7 +379,10 @@ export abstract class PeerTransfer {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
removeConnection(peerId: string, connectionId?: string) {
|
|
382
|
-
|
|
382
|
+
if (this.peerConfig?.debug >= 2) {
|
|
383
|
+
console.log('removeConnection', peerId, connectionId);
|
|
384
|
+
}
|
|
385
|
+
|
|
383
386
|
this.connectionManager.remove(peerId, connectionId);
|
|
384
387
|
}
|
|
385
388
|
|