filepizza-client 0.1.0 → 2.0.0-alpha.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/src/types.ts ADDED
@@ -0,0 +1,83 @@
1
+ // src/core/types.ts
2
+ export interface EventEmitter {
3
+ on(event: string, listener: (...args: any[]) => void): this;
4
+ off(event: string, listener: (...args: any[]) => void): this;
5
+ emit(event: string, ...args: any[]): boolean;
6
+ }
7
+
8
+ /**
9
+ * Connection status
10
+ */
11
+ export enum ConnectionStatus {
12
+ Pending = 'PENDING',
13
+ Ready = 'READY',
14
+ Paused = 'PAUSED',
15
+ Uploading = 'UPLOADING',
16
+ Downloading = 'DOWNLOADING',
17
+ Done = 'DONE',
18
+ Authenticating = 'AUTHENTICATING',
19
+ InvalidPassword = 'INVALID_PASSWORD',
20
+ Closed = 'CLOSED',
21
+ Error = 'ERROR'
22
+ }
23
+
24
+ /**
25
+ * File information
26
+ */
27
+ export interface FileInfo {
28
+ fileName: string;
29
+ size: number;
30
+ type: string;
31
+ }
32
+
33
+ /**
34
+ * Interface for a completed file ready to download
35
+ */
36
+ export interface CompletedFile extends FileInfo {
37
+ data: Uint8Array;
38
+ downloadUrl?: string;
39
+ }
40
+
41
+ /**
42
+ * Progress information
43
+ */
44
+ export interface ProgressInfo {
45
+ fileIndex: number;
46
+ fileName: string;
47
+ totalFiles: number;
48
+ currentFileProgress: number;
49
+ overallProgress: number;
50
+ bytesTransferred: number;
51
+ totalBytes: number;
52
+ }
53
+
54
+ /**
55
+ * Connection information
56
+ */
57
+ export interface ConnectionInfo {
58
+ id: string;
59
+ status: ConnectionStatus;
60
+ browserName?: string;
61
+ browserVersion?: string;
62
+ osName?: string;
63
+ osVersion?: string;
64
+ mobileVendor?: string;
65
+ mobileModel?: string;
66
+ }
67
+
68
+ /**
69
+ * Message types for peer-to-peer communication
70
+ */
71
+ export enum MessageType {
72
+ RequestInfo = 'RequestInfo',
73
+ Info = 'Info',
74
+ Start = 'Start',
75
+ Chunk = 'Chunk',
76
+ Pause = 'Pause',
77
+ Resume = 'Resume',
78
+ Done = 'Done',
79
+ Error = 'Error',
80
+ PasswordRequired = 'PasswordRequired',
81
+ UsePassword = 'UsePassword',
82
+ Report = 'Report',
83
+ }