react-native-kookit 0.2.3 → 0.2.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/ANDROID_FTP_UPDATE.md +161 -0
- package/ANDROID_PARAMETER_FIX.md +0 -0
- package/API_UNIFICATION.md +180 -0
- package/FTP_CLIENT_API.md +301 -0
- package/FTP_EXAMPLE_IMPLEMENTATION.md +0 -0
- package/FTP_FILE_LIST_ENHANCEMENT.md +186 -0
- package/FTP_FILE_OPERATIONS.md +0 -0
- package/android/src/main/java/expo/modules/kookit/FtpClient.kt +2 -0
- package/android/src/main/java/expo/modules/kookit/ReactNativeKookitModule.kt +252 -0
- package/build/FtpClient.d.ts +97 -0
- package/build/FtpClient.d.ts.map +1 -0
- package/build/FtpClient.js +199 -0
- package/build/FtpClient.js.map +1 -0
- package/build/ReactNativeKookit.types.d.ts +13 -5
- package/build/ReactNativeKookit.types.d.ts.map +1 -1
- package/build/ReactNativeKookit.types.js.map +1 -1
- package/build/ReactNativeKookitModule.d.ts +54 -12
- package/build/ReactNativeKookitModule.d.ts.map +1 -1
- package/build/ReactNativeKookitModule.js.map +1 -1
- package/build/index.d.ts +4 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/ios/ReactNativeKookitModule.swift +252 -44
- package/package.json +1 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import ReactNativeKookitModule from "./ReactNativeKookitModule";
|
|
2
|
+
export class FtpClient {
|
|
3
|
+
clientId;
|
|
4
|
+
isDisposed = false;
|
|
5
|
+
eventHandlers = {};
|
|
6
|
+
eventSubscriptions = [];
|
|
7
|
+
constructor(clientId) {
|
|
8
|
+
this.clientId =
|
|
9
|
+
clientId ||
|
|
10
|
+
`ftp_client_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
11
|
+
this.setupEventListeners();
|
|
12
|
+
}
|
|
13
|
+
setupEventListeners() {
|
|
14
|
+
// Listen to native events and filter by clientId
|
|
15
|
+
const progressSub = ReactNativeKookitModule.addListener("onFtpProgress", (event) => {
|
|
16
|
+
if (event.clientId === this.clientId && this.eventHandlers.onProgress) {
|
|
17
|
+
this.eventHandlers.onProgress({
|
|
18
|
+
transferred: event.transferred,
|
|
19
|
+
total: event.total,
|
|
20
|
+
percentage: event.percentage,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const completeSub = ReactNativeKookitModule.addListener("onFtpComplete", (event) => {
|
|
25
|
+
if (event.clientId === this.clientId && this.eventHandlers.onComplete) {
|
|
26
|
+
this.eventHandlers.onComplete();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const errorSub = ReactNativeKookitModule.addListener("onFtpError", (event) => {
|
|
30
|
+
if (event.clientId === this.clientId && this.eventHandlers.onError) {
|
|
31
|
+
this.eventHandlers.onError(new Error(event.error));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
this.eventSubscriptions = [progressSub, completeSub, errorSub];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set event handlers
|
|
38
|
+
*/
|
|
39
|
+
setEventHandlers(handlers) {
|
|
40
|
+
this.eventHandlers = { ...handlers };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Initialize the FTP client instance
|
|
44
|
+
*/
|
|
45
|
+
async initialize() {
|
|
46
|
+
if (this.isDisposed) {
|
|
47
|
+
throw new Error("FTP client has been disposed");
|
|
48
|
+
}
|
|
49
|
+
await ReactNativeKookitModule.createFtpClient(this.clientId);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Connect to the FTP server
|
|
53
|
+
*/
|
|
54
|
+
async connect(config) {
|
|
55
|
+
if (this.isDisposed) {
|
|
56
|
+
throw new Error("FTP client has been disposed");
|
|
57
|
+
}
|
|
58
|
+
console.log("Connecting with config:", this.clientId, config);
|
|
59
|
+
await ReactNativeKookitModule.ftpClientConnect(this.clientId, config);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Disconnect from the FTP server
|
|
63
|
+
*/
|
|
64
|
+
async disconnect() {
|
|
65
|
+
if (this.isDisposed) {
|
|
66
|
+
throw new Error("FTP client has been disposed");
|
|
67
|
+
}
|
|
68
|
+
await ReactNativeKookitModule.ftpClientDisconnect(this.clientId);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* List files in the specified directory
|
|
72
|
+
*/
|
|
73
|
+
async list(path) {
|
|
74
|
+
if (this.isDisposed) {
|
|
75
|
+
throw new Error("FTP client has been disposed");
|
|
76
|
+
}
|
|
77
|
+
return await ReactNativeKookitModule.ftpClientList(this.clientId, path);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Download a file from the remote server
|
|
81
|
+
*/
|
|
82
|
+
async download(remotePath, localPath) {
|
|
83
|
+
if (this.isDisposed) {
|
|
84
|
+
throw new Error("FTP client has been disposed");
|
|
85
|
+
}
|
|
86
|
+
await ReactNativeKookitModule.ftpClientDownload(this.clientId, remotePath, localPath);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Upload a file to the remote server
|
|
90
|
+
*/
|
|
91
|
+
async upload(localPath, remotePath) {
|
|
92
|
+
if (this.isDisposed) {
|
|
93
|
+
throw new Error("FTP client has been disposed");
|
|
94
|
+
}
|
|
95
|
+
await ReactNativeKookitModule.ftpClientUpload(this.clientId, localPath, remotePath);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Delete a file or directory on the remote server
|
|
99
|
+
*/
|
|
100
|
+
async delete(remotePath, isDirectory = false) {
|
|
101
|
+
if (this.isDisposed) {
|
|
102
|
+
throw new Error("FTP client has been disposed");
|
|
103
|
+
}
|
|
104
|
+
await ReactNativeKookitModule.ftpClientDelete(this.clientId, remotePath, isDirectory);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create a directory on the remote server
|
|
108
|
+
*/
|
|
109
|
+
async createDirectory(remotePath) {
|
|
110
|
+
if (this.isDisposed) {
|
|
111
|
+
throw new Error("FTP client has been disposed");
|
|
112
|
+
}
|
|
113
|
+
await ReactNativeKookitModule.ftpClientCreateDirectory(this.clientId, remotePath);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Change the current working directory on the remote server
|
|
117
|
+
*/
|
|
118
|
+
async changeDirectory(remotePath) {
|
|
119
|
+
if (this.isDisposed) {
|
|
120
|
+
throw new Error("FTP client has been disposed");
|
|
121
|
+
}
|
|
122
|
+
await ReactNativeKookitModule.ftpClientChangeDirectory(this.clientId, remotePath);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the current working directory on the remote server
|
|
126
|
+
*/
|
|
127
|
+
async getCurrentDirectory() {
|
|
128
|
+
if (this.isDisposed) {
|
|
129
|
+
throw new Error("FTP client has been disposed");
|
|
130
|
+
}
|
|
131
|
+
const result = await ReactNativeKookitModule.ftpClientGetCurrentDirectory(this.clientId);
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get client status information
|
|
136
|
+
* @returns Client status including existence and connection state
|
|
137
|
+
*/
|
|
138
|
+
async getStatus() {
|
|
139
|
+
const status = await ReactNativeKookitModule.getFtpClientStatus(this.clientId);
|
|
140
|
+
return {
|
|
141
|
+
clientId: this.clientId,
|
|
142
|
+
...status,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get the client ID
|
|
147
|
+
*/
|
|
148
|
+
getClientId() {
|
|
149
|
+
return this.clientId;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if the client is connected
|
|
153
|
+
*/
|
|
154
|
+
async isConnected() {
|
|
155
|
+
if (this.isDisposed) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const status = await this.getStatus();
|
|
160
|
+
return status.exists && status.connected;
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Dispose the FTP client and clean up resources
|
|
168
|
+
*/
|
|
169
|
+
async dispose() {
|
|
170
|
+
if (this.isDisposed) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
await ReactNativeKookitModule.disposeFtpClient(this.clientId);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
// Ignore errors during disposal
|
|
178
|
+
}
|
|
179
|
+
// Remove event listeners
|
|
180
|
+
this.eventSubscriptions.forEach((sub) => sub.remove());
|
|
181
|
+
this.eventSubscriptions = [];
|
|
182
|
+
this.isDisposed = true;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Static method to list all FTP clients
|
|
186
|
+
*/
|
|
187
|
+
static async listClients() {
|
|
188
|
+
return ReactNativeKookitModule.listFtpClients();
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Static method to create and initialize a new FTP client
|
|
192
|
+
*/
|
|
193
|
+
static async create(clientId) {
|
|
194
|
+
const client = new FtpClient(clientId);
|
|
195
|
+
await client.initialize();
|
|
196
|
+
return client;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=FtpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FtpClient.js","sourceRoot":"","sources":["../src/FtpClient.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAmBhE,MAAM,OAAO,SAAS;IACZ,QAAQ,CAAS;IACjB,UAAU,GAAY,KAAK,CAAC;IAC5B,aAAa,GAA2B,EAAE,CAAC;IAC3C,kBAAkB,GAAkC,EAAE,CAAC;IAE/D,YAAY,QAAiB;QAC3B,IAAI,CAAC,QAAQ;YACX,QAAQ;gBACR,cAAc,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAA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,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW;QAItB,OAAO,uBAAuB,CAAC,cAAc,EAAE,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAiB;QACnC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import ReactNativeKookitModule from \"./ReactNativeKookitModule\";\nimport type {\n FtpConnectionConfig,\n FtpFileInfo,\n FtpProgressEvent,\n FtpCompleteEvent,\n FtpErrorEvent,\n} from \"./ReactNativeKookit.types\";\n\nexport interface FtpClientEventHandlers {\n onProgress?: (progress: {\n transferred: number;\n total: number;\n percentage: number;\n }) => void;\n onComplete?: () => void;\n onError?: (error: Error) => void;\n}\n\nexport class FtpClient {\n private clientId: string;\n private isDisposed: boolean = false;\n private eventHandlers: FtpClientEventHandlers = {};\n private eventSubscriptions: Array<{ remove: () => void }> = [];\n\n constructor(clientId?: string) {\n this.clientId =\n clientId ||\n `ftp_client_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n this.setupEventListeners();\n }\n\n private setupEventListeners() {\n // Listen to native events and filter by clientId\n const progressSub = ReactNativeKookitModule.addListener(\n \"onFtpProgress\",\n (event: FtpProgressEvent) => {\n if (event.clientId === this.clientId && this.eventHandlers.onProgress) {\n this.eventHandlers.onProgress({\n transferred: event.transferred,\n total: event.total,\n percentage: event.percentage,\n });\n }\n }\n );\n\n const completeSub = ReactNativeKookitModule.addListener(\n \"onFtpComplete\",\n (event: FtpCompleteEvent) => {\n if (event.clientId === this.clientId && this.eventHandlers.onComplete) {\n this.eventHandlers.onComplete();\n }\n }\n );\n\n const errorSub = ReactNativeKookitModule.addListener(\n \"onFtpError\",\n (event: FtpErrorEvent) => {\n if (event.clientId === this.clientId && this.eventHandlers.onError) {\n this.eventHandlers.onError(new Error(event.error));\n }\n }\n );\n\n this.eventSubscriptions = [progressSub, completeSub, errorSub];\n }\n\n /**\n * Set event handlers\n */\n setEventHandlers(handlers: FtpClientEventHandlers): void {\n this.eventHandlers = { ...handlers };\n }\n\n /**\n * Initialize the FTP client instance\n */\n async initialize(): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.createFtpClient(this.clientId);\n }\n\n /**\n * Connect to the FTP server\n */\n async connect(config: FtpConnectionConfig): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n console.log(\"Connecting with config:\", this.clientId, config);\n\n await ReactNativeKookitModule.ftpClientConnect(this.clientId, config);\n }\n\n /**\n * Disconnect from the FTP server\n */\n async disconnect(): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.ftpClientDisconnect(this.clientId);\n }\n\n /**\n * List files in the specified directory\n */\n async list(path?: string): Promise<FtpFileInfo[]> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n return await ReactNativeKookitModule.ftpClientList(this.clientId, path);\n }\n\n /**\n * Download a file from the remote server\n */\n async download(remotePath: string, localPath: string): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.ftpClientDownload(\n this.clientId,\n remotePath,\n localPath\n );\n }\n\n /**\n * Upload a file to the remote server\n */\n async upload(localPath: string, remotePath: string): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.ftpClientUpload(\n this.clientId,\n localPath,\n remotePath\n );\n }\n\n /**\n * Delete a file or directory on the remote server\n */\n async delete(\n remotePath: string,\n isDirectory: boolean = false\n ): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.ftpClientDelete(\n this.clientId,\n remotePath,\n isDirectory\n );\n }\n\n /**\n * Create a directory on the remote server\n */\n async createDirectory(remotePath: string): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.ftpClientCreateDirectory(\n this.clientId,\n remotePath\n );\n }\n\n /**\n * Change the current working directory on the remote server\n */\n async changeDirectory(remotePath: string): Promise<void> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n await ReactNativeKookitModule.ftpClientChangeDirectory(\n this.clientId,\n remotePath\n );\n }\n\n /**\n * Get the current working directory on the remote server\n */\n async getCurrentDirectory(): Promise<string> {\n if (this.isDisposed) {\n throw new Error(\"FTP client has been disposed\");\n }\n\n const result = await ReactNativeKookitModule.ftpClientGetCurrentDirectory(\n this.clientId\n );\n return result;\n }\n\n /**\n * Get client status information\n * @returns Client status including existence and connection state\n */\n async getStatus(): Promise<{\n clientId: string;\n exists: boolean;\n connected: boolean;\n }> {\n const status = await ReactNativeKookitModule.getFtpClientStatus(\n this.clientId\n );\n return {\n clientId: this.clientId,\n ...status,\n };\n }\n\n /**\n * Get the client ID\n */\n getClientId(): string {\n return this.clientId;\n }\n\n /**\n * Check if the client is connected\n */\n async isConnected(): Promise<boolean> {\n if (this.isDisposed) {\n return false;\n }\n\n try {\n const status = await this.getStatus();\n return status.exists && status.connected;\n } catch {\n return false;\n }\n }\n\n /**\n * Dispose the FTP client and clean up resources\n */\n async dispose(): Promise<void> {\n if (this.isDisposed) {\n return;\n }\n\n try {\n await ReactNativeKookitModule.disposeFtpClient(this.clientId);\n } catch (error) {\n // Ignore errors during disposal\n }\n\n // Remove event listeners\n this.eventSubscriptions.forEach((sub) => sub.remove());\n this.eventSubscriptions = [];\n\n this.isDisposed = true;\n }\n\n /**\n * Static method to list all FTP clients\n */\n static async listClients(): Promise<{\n clients: Record<string, { connected: boolean }>;\n count: number;\n }> {\n return ReactNativeKookitModule.listFtpClients();\n }\n\n /**\n * Static method to create and initialize a new FTP client\n */\n static async create(clientId?: string): Promise<FtpClient> {\n const client = new FtpClient(clientId);\n await client.initialize();\n return client;\n }\n}\n"]}
|
|
@@ -25,6 +25,16 @@ export type FtpProgressInfo = {
|
|
|
25
25
|
total: number;
|
|
26
26
|
percentage: number;
|
|
27
27
|
};
|
|
28
|
+
export type FtpProgressEvent = FtpProgressInfo & {
|
|
29
|
+
clientId: string;
|
|
30
|
+
};
|
|
31
|
+
export type FtpCompleteEvent = {
|
|
32
|
+
clientId: string;
|
|
33
|
+
};
|
|
34
|
+
export type FtpErrorEvent = {
|
|
35
|
+
clientId: string;
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
28
38
|
export type FtpEventPayload = {
|
|
29
39
|
onProgress?: (progress: FtpProgressInfo) => void;
|
|
30
40
|
onComplete?: () => void;
|
|
@@ -33,11 +43,9 @@ export type FtpEventPayload = {
|
|
|
33
43
|
export type ReactNativeKookitModuleEvents = {
|
|
34
44
|
onChange: (params: ChangeEventPayload) => void;
|
|
35
45
|
onVolumeButtonPressed: (params: VolumeKeyEventPayload) => void;
|
|
36
|
-
onFtpProgress: (params:
|
|
37
|
-
onFtpComplete: () => void;
|
|
38
|
-
onFtpError: (params:
|
|
39
|
-
error: string;
|
|
40
|
-
}) => void;
|
|
46
|
+
onFtpProgress: (params: FtpProgressEvent) => void;
|
|
47
|
+
onFtpComplete: (params: FtpCompleteEvent) => void;
|
|
48
|
+
onFtpError: (params: FtpErrorEvent) => void;
|
|
41
49
|
};
|
|
42
50
|
export type ChangeEventPayload = {
|
|
43
51
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeKookit.types.d.ts","sourceRoot":"","sources":["../src/ReactNativeKookit.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE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AAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC/C,qBAAqB,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC/D,aAAa,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,aAAa,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,UAAU,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,kBAAkB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeKookit.types.js","sourceRoot":"","sources":["../src/ReactNativeKookit.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle } from \"react-native\";\n\nexport type OnLoadEventPayload = {\n url: string;\n};\n\nexport type VolumeKeyEventPayload = {\n key: \"up\" | \"down\";\n};\n\nexport type FtpConnectionConfig = {\n host: string;\n port?: number;\n username: string;\n password: string;\n passive?: boolean;\n timeout?: number;\n};\n\nexport type FtpFileInfo = {\n name: string;\n isDirectory: boolean;\n size: number;\n lastModified: string;\n permissions?: string;\n};\n\nexport type FtpProgressInfo = {\n transferred: number;\n total: number;\n percentage: number;\n};\n\nexport type FtpEventPayload = {\n onProgress?: (progress: FtpProgressInfo) => void;\n onComplete?: () => void;\n onError?: (error: string) => void;\n};\n\nexport type ReactNativeKookitModuleEvents = {\n onChange: (params: ChangeEventPayload) => void;\n onVolumeButtonPressed: (params: VolumeKeyEventPayload) => void;\n onFtpProgress: (params:
|
|
1
|
+
{"version":3,"file":"ReactNativeKookit.types.js","sourceRoot":"","sources":["../src/ReactNativeKookit.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StyleProp, ViewStyle } from \"react-native\";\n\nexport type OnLoadEventPayload = {\n url: string;\n};\n\nexport type VolumeKeyEventPayload = {\n key: \"up\" | \"down\";\n};\n\nexport type FtpConnectionConfig = {\n host: string;\n port?: number;\n username: string;\n password: string;\n passive?: boolean;\n timeout?: number;\n};\n\nexport type FtpFileInfo = {\n name: string;\n isDirectory: boolean;\n size: number;\n lastModified: string;\n permissions?: string;\n};\n\nexport type FtpProgressInfo = {\n transferred: number;\n total: number;\n percentage: number;\n};\n\nexport type FtpProgressEvent = FtpProgressInfo & {\n clientId: string;\n};\n\nexport type FtpCompleteEvent = {\n clientId: string;\n};\n\nexport type FtpErrorEvent = {\n clientId: string;\n error: string;\n};\n\nexport type FtpEventPayload = {\n onProgress?: (progress: FtpProgressInfo) => void;\n onComplete?: () => void;\n onError?: (error: string) => void;\n};\n\nexport type ReactNativeKookitModuleEvents = {\n onChange: (params: ChangeEventPayload) => void;\n onVolumeButtonPressed: (params: VolumeKeyEventPayload) => void;\n onFtpProgress: (params: FtpProgressEvent) => void;\n onFtpComplete: (params: FtpCompleteEvent) => void;\n onFtpError: (params: FtpErrorEvent) => void;\n};\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ReactNativeKookitViewProps = {\n url: string;\n onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;\n style?: StyleProp<ViewStyle>;\n};\n"]}
|
|
@@ -23,60 +23,102 @@ declare class ReactNativeKookitModule extends NativeModule<ReactNativeKookitModu
|
|
|
23
23
|
*/
|
|
24
24
|
disableVolumeKeyInterception(): void;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Create a new FTP client instance
|
|
27
|
+
* @param clientId Unique identifier for the FTP client
|
|
28
|
+
* @returns Promise that resolves with client creation result
|
|
29
|
+
*/
|
|
30
|
+
createFtpClient(clientId: string): Promise<{
|
|
31
|
+
clientId: string;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Connect FTP client to server
|
|
35
|
+
* @param clientId FTP client identifier
|
|
27
36
|
* @param config FTP connection configuration
|
|
28
37
|
* @returns Promise that resolves when connected
|
|
29
38
|
*/
|
|
30
|
-
|
|
39
|
+
ftpClientConnect(clientId: string, config: FtpConnectionConfig): Promise<void>;
|
|
31
40
|
/**
|
|
32
|
-
* Disconnect from
|
|
41
|
+
* Disconnect FTP client from server
|
|
42
|
+
* @param clientId FTP client identifier
|
|
33
43
|
* @returns Promise that resolves when disconnected
|
|
34
44
|
*/
|
|
35
|
-
|
|
45
|
+
ftpClientDisconnect(clientId: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Dispose FTP client and clean up resources
|
|
48
|
+
* @param clientId FTP client identifier
|
|
49
|
+
* @returns Promise that resolves when disposed
|
|
50
|
+
*/
|
|
51
|
+
disposeFtpClient(clientId: string): Promise<void>;
|
|
36
52
|
/**
|
|
37
|
-
* List files and directories
|
|
53
|
+
* List files and directories
|
|
54
|
+
* @param clientId FTP client identifier
|
|
38
55
|
* @param path Optional path to list (defaults to current directory)
|
|
39
56
|
* @returns Promise that resolves with array of file information
|
|
40
57
|
*/
|
|
41
|
-
|
|
58
|
+
ftpClientList(clientId: string, path?: string): Promise<FtpFileInfo[]>;
|
|
42
59
|
/**
|
|
43
60
|
* Download a file from FTP server
|
|
61
|
+
* @param clientId FTP client identifier
|
|
44
62
|
* @param remotePath Remote file path on FTP server
|
|
45
63
|
* @param localPath Local file path to save the downloaded file
|
|
46
64
|
* @returns Promise that resolves when download is complete
|
|
47
65
|
*/
|
|
48
|
-
|
|
66
|
+
ftpClientDownload(clientId: string, remotePath: string, localPath: string): Promise<void>;
|
|
49
67
|
/**
|
|
50
68
|
* Upload a file to FTP server
|
|
69
|
+
* @param clientId FTP client identifier
|
|
51
70
|
* @param localPath Local file path to upload
|
|
52
71
|
* @param remotePath Remote file path on FTP server
|
|
53
72
|
* @returns Promise that resolves when upload is complete
|
|
54
73
|
*/
|
|
55
|
-
|
|
74
|
+
ftpClientUpload(clientId: string, localPath: string, remotePath: string): Promise<void>;
|
|
56
75
|
/**
|
|
57
76
|
* Delete a file or directory on FTP server
|
|
77
|
+
* @param clientId FTP client identifier
|
|
58
78
|
* @param remotePath Remote file or directory path to delete
|
|
59
79
|
* @param isDirectory Whether the path is a directory (default: false)
|
|
60
80
|
* @returns Promise that resolves when deletion is complete
|
|
61
81
|
*/
|
|
62
|
-
|
|
82
|
+
ftpClientDelete(clientId: string, remotePath: string, isDirectory?: boolean): Promise<void>;
|
|
63
83
|
/**
|
|
64
84
|
* Create a directory on FTP server
|
|
85
|
+
* @param clientId FTP client identifier
|
|
65
86
|
* @param remotePath Remote directory path to create
|
|
66
87
|
* @returns Promise that resolves when directory is created
|
|
67
88
|
*/
|
|
68
|
-
|
|
89
|
+
ftpClientCreateDirectory(clientId: string, remotePath: string): Promise<void>;
|
|
69
90
|
/**
|
|
70
91
|
* Change current working directory on FTP server
|
|
92
|
+
* @param clientId FTP client identifier
|
|
71
93
|
* @param remotePath Remote directory path to change to
|
|
72
94
|
* @returns Promise that resolves when directory is changed
|
|
73
95
|
*/
|
|
74
|
-
|
|
96
|
+
ftpClientChangeDirectory(clientId: string, remotePath: string): Promise<void>;
|
|
75
97
|
/**
|
|
76
98
|
* Get current working directory on FTP server
|
|
99
|
+
* @param clientId FTP client identifier
|
|
77
100
|
* @returns Promise that resolves with current directory path
|
|
78
101
|
*/
|
|
79
|
-
|
|
102
|
+
ftpClientGetCurrentDirectory(clientId: string): Promise<string>;
|
|
103
|
+
/**
|
|
104
|
+
* Get FTP client status
|
|
105
|
+
* @param clientId FTP client identifier
|
|
106
|
+
* @returns Client status information
|
|
107
|
+
*/
|
|
108
|
+
getFtpClientStatus(clientId: string): Promise<{
|
|
109
|
+
exists: boolean;
|
|
110
|
+
connected: boolean;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* List all FTP clients
|
|
114
|
+
* @returns Object containing all clients and their status
|
|
115
|
+
*/
|
|
116
|
+
listFtpClients(): Promise<{
|
|
117
|
+
clients: Record<string, {
|
|
118
|
+
connected: boolean;
|
|
119
|
+
}>;
|
|
120
|
+
count: number;
|
|
121
|
+
}>;
|
|
80
122
|
}
|
|
81
123
|
declare const _default: ReactNativeKookitModule;
|
|
82
124
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeKookitModule.d.ts","sourceRoot":"","sources":["../src/ReactNativeKookitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAEnC,OAAO,OAAO,uBAAwB,SAAQ,YAAY,CAAC,6BAA6B,CAAC;IACvF,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,IAAI,MAAM;IAEf;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3C;;;;;;OAMG;IACH,2BAA2B,IAAI,IAAI;IAEnC;;OAEG;IACH,4BAA4B,IAAI,IAAI;IAIpC;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"ReactNativeKookitModule.d.ts","sourceRoot":"","sources":["../src/ReactNativeKookitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,EACnB,WAAW,EACZ,MAAM,2BAA2B,CA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KG;IACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7E;;;;;OAKG;IACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7E;;;;OAIG;IACH,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE/D;;;;OAIG;IACH,kBAAkB,CAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAEnD;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,SAAS,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;QAChD,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;;AAGD,wBAEE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeKookitModule.js","sourceRoot":"","sources":["../src/ReactNativeKookitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactNativeKookitModule.js","sourceRoot":"","sources":["../src/ReactNativeKookitModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AA8JzD,yDAAyD;AACzD,eAAe,mBAAmB,CAChC,mBAAmB,CACpB,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\";\n\nimport {\n ReactNativeKookitModuleEvents,\n FtpConnectionConfig,\n FtpFileInfo,\n} from \"./ReactNativeKookit.types\";\n\ndeclare class ReactNativeKookitModule extends NativeModule<ReactNativeKookitModuleEvents> {\n PI: number;\n\n /**\n * Returns a hello world string\n */\n hello(): string;\n\n /**\n * Test async function that sends a change event\n */\n setValueAsync(value: string): Promise<void>;\n\n /**\n * Enables volume key interception.\n * On Android, your MainActivity must implement VolumeKeyInterceptActivity interface.\n * On iOS, this works automatically.\n *\n * @throws Error if MainActivity doesn't implement VolumeKeyInterceptActivity on Android\n */\n enableVolumeKeyInterception(): void;\n\n /**\n * Disables volume key interception\n */\n disableVolumeKeyInterception(): void;\n\n // New FTP Client API Methods\n\n /**\n * Create a new FTP client instance\n * @param clientId Unique identifier for the FTP client\n * @returns Promise that resolves with client creation result\n */\n createFtpClient(clientId: string): Promise<{ clientId: string }>;\n\n /**\n * Connect FTP client to server\n * @param clientId FTP client identifier\n * @param config FTP connection configuration\n * @returns Promise that resolves when connected\n */\n ftpClientConnect(\n clientId: string,\n config: FtpConnectionConfig\n ): Promise<void>;\n\n /**\n * Disconnect FTP client from server\n * @param clientId FTP client identifier\n * @returns Promise that resolves when disconnected\n */\n ftpClientDisconnect(clientId: string): Promise<void>;\n\n /**\n * Dispose FTP client and clean up resources\n * @param clientId FTP client identifier\n * @returns Promise that resolves when disposed\n */\n disposeFtpClient(clientId: string): Promise<void>;\n\n /**\n * List files and directories\n * @param clientId FTP client identifier\n * @param path Optional path to list (defaults to current directory)\n * @returns Promise that resolves with array of file information\n */\n ftpClientList(clientId: string, path?: string): Promise<FtpFileInfo[]>;\n\n /**\n * Download a file from FTP server\n * @param clientId FTP client identifier\n * @param remotePath Remote file path on FTP server\n * @param localPath Local file path to save the downloaded file\n * @returns Promise that resolves when download is complete\n */\n ftpClientDownload(\n clientId: string,\n remotePath: string,\n localPath: string\n ): Promise<void>;\n\n /**\n * Upload a file to FTP server\n * @param clientId FTP client identifier\n * @param localPath Local file path to upload\n * @param remotePath Remote file path on FTP server\n * @returns Promise that resolves when upload is complete\n */\n ftpClientUpload(\n clientId: string,\n localPath: string,\n remotePath: string\n ): Promise<void>;\n\n /**\n * Delete a file or directory on FTP server\n * @param clientId FTP client identifier\n * @param remotePath Remote file or directory path to delete\n * @param isDirectory Whether the path is a directory (default: false)\n * @returns Promise that resolves when deletion is complete\n */\n ftpClientDelete(\n clientId: string,\n remotePath: string,\n isDirectory?: boolean\n ): Promise<void>;\n\n /**\n * Create a directory on FTP server\n * @param clientId FTP client identifier\n * @param remotePath Remote directory path to create\n * @returns Promise that resolves when directory is created\n */\n ftpClientCreateDirectory(clientId: string, remotePath: string): Promise<void>;\n\n /**\n * Change current working directory on FTP server\n * @param clientId FTP client identifier\n * @param remotePath Remote directory path to change to\n * @returns Promise that resolves when directory is changed\n */\n ftpClientChangeDirectory(clientId: string, remotePath: string): Promise<void>;\n\n /**\n * Get current working directory on FTP server\n * @param clientId FTP client identifier\n * @returns Promise that resolves with current directory path\n */\n ftpClientGetCurrentDirectory(clientId: string): Promise<string>;\n\n /**\n * Get FTP client status\n * @param clientId FTP client identifier\n * @returns Client status information\n */\n getFtpClientStatus(\n clientId: string\n ): Promise<{ exists: boolean; connected: boolean }>;\n\n /**\n * List all FTP clients\n * @returns Object containing all clients and their status\n */\n listFtpClients(): Promise<{\n clients: Record<string, { connected: boolean }>;\n count: number;\n }>;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<ReactNativeKookitModule>(\n \"ReactNativeKookit\"\n);\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default } from
|
|
2
|
-
export { default as ReactNativeKookitView } from
|
|
3
|
-
export * from
|
|
1
|
+
export { default } from "./ReactNativeKookitModule";
|
|
2
|
+
export { default as ReactNativeKookitView } from "./ReactNativeKookitView";
|
|
3
|
+
export * from "./ReactNativeKookit.types";
|
|
4
|
+
export { FtpClient } from "./FtpClient";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Reexport the native module. On web, it will be resolved to ReactNativeKookitModule.web.ts
|
|
2
2
|
// and on native platforms to ReactNativeKookitModule.ts
|
|
3
|
-
export { default } from
|
|
4
|
-
export { default as ReactNativeKookitView } from
|
|
5
|
-
export * from
|
|
3
|
+
export { default } from "./ReactNativeKookitModule";
|
|
4
|
+
export { default as ReactNativeKookitView } from "./ReactNativeKookitView";
|
|
5
|
+
export * from "./ReactNativeKookit.types";
|
|
6
|
+
export { FtpClient } from "./FtpClient";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC","sourcesContent":["// Reexport the native module. On web, it will be resolved to ReactNativeKookitModule.web.ts\n// and on native platforms to ReactNativeKookitModule.ts\nexport { default } from \"./ReactNativeKookitModule\";\nexport { default as ReactNativeKookitView } from \"./ReactNativeKookitView\";\nexport * from \"./ReactNativeKookit.types\";\nexport { FtpClient } from \"./FtpClient\";\n"]}
|