@functionland/react-native-fula 1.55.0 → 1.55.2
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/LICENSE +20 -20
- package/android/build.gradle +114 -115
- package/android/gradle.properties +8 -8
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/AndroidManifestNew.xml +2 -2
- package/android/src/main/java/land/fx/fula/ConfigRef.java +7 -7
- package/android/src/main/java/land/fx/fula/Cryptography.java +62 -62
- package/android/src/main/java/land/fx/fula/FulaModule.java +1991 -1868
- package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
- package/android/src/main/java/land/fx/fula/SharedPreferenceHelper.java +65 -65
- package/android/src/main/java/land/fx/fula/StaticHelper.java +13 -13
- package/android/src/main/java/land/fx/fula/ThreadUtils.java +42 -42
- package/ios/Cryptography.swift +59 -59
- package/ios/Fula-Bridging-Header.h +3 -3
- package/ios/UserDataHelper.swift +143 -143
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-consts.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-errors.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-events.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-query.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-rpc.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-runtime.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api-tx.js.map +1 -1
- package/lib/commonjs/interfaces/augment-api.js.map +1 -1
- package/lib/commonjs/interfaces/augment-types.js.map +1 -1
- package/lib/commonjs/interfaces/definitions.js.map +1 -1
- package/lib/commonjs/interfaces/defintions.js.map +1 -1
- package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/commonjs/interfaces/lookup.js +300 -300
- package/lib/commonjs/interfaces/lookup.js.map +1 -1
- package/lib/commonjs/interfaces/registry.js.map +1 -1
- package/lib/commonjs/interfaces/types-lookup.js.map +1 -1
- package/lib/commonjs/interfaces/types.js.map +1 -1
- package/lib/commonjs/protocols/blockchain.js +66 -66
- package/lib/commonjs/protocols/blockchain.js.map +1 -1
- package/lib/commonjs/protocols/chain-api.js.map +1 -1
- package/lib/commonjs/protocols/fula.js.map +1 -1
- package/lib/commonjs/protocols/fx-ai.js +161 -0
- package/lib/commonjs/protocols/fx-ai.js.map +1 -0
- package/lib/commonjs/protocols/fxblox.js +3 -3
- package/lib/commonjs/protocols/fxblox.js.map +1 -1
- package/lib/commonjs/types/blockchain.js.map +1 -1
- package/lib/commonjs/types/fxblox.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/augment-api-consts.js.map +1 -1
- package/lib/module/interfaces/augment-api-errors.js.map +1 -1
- package/lib/module/interfaces/augment-api-events.js.map +1 -1
- package/lib/module/interfaces/augment-api-query.js.map +1 -1
- package/lib/module/interfaces/augment-api-rpc.js.map +1 -1
- package/lib/module/interfaces/augment-api-runtime.js.map +1 -1
- package/lib/module/interfaces/augment-api-tx.js.map +1 -1
- package/lib/module/interfaces/augment-api.js.map +1 -1
- package/lib/module/interfaces/augment-types.js.map +1 -1
- package/lib/module/interfaces/definitions.js.map +1 -1
- package/lib/module/interfaces/defintions.js.map +1 -1
- package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/module/interfaces/lookup.js +300 -300
- package/lib/module/interfaces/lookup.js.map +1 -1
- package/lib/module/interfaces/registry.js.map +1 -1
- package/lib/module/interfaces/types-lookup.js.map +1 -1
- package/lib/module/interfaces/types.js.map +1 -1
- package/lib/module/protocols/blockchain.js +66 -66
- package/lib/module/protocols/blockchain.js.map +1 -1
- package/lib/module/protocols/chain-api.js.map +1 -1
- package/lib/module/protocols/fula.js.map +1 -1
- package/lib/module/protocols/fx-ai.js +150 -0
- package/lib/module/protocols/fx-ai.js.map +1 -0
- package/lib/module/protocols/fxblox.js +3 -3
- package/lib/module/protocols/fxblox.js.map +1 -1
- package/lib/module/types/blockchain.js.map +1 -1
- package/lib/module/types/fxblox.js.map +1 -1
- package/package.json +176 -176
- package/react-native-fula.podspec +47 -47
- package/src/index.tsx +5 -4
- package/src/interfaces/augment-api-consts.ts +273 -273
- package/src/interfaces/augment-api-errors.ts +474 -474
- package/src/interfaces/augment-api-events.ts +448 -448
- package/src/interfaces/augment-api-query.ts +466 -466
- package/src/interfaces/augment-api-rpc.ts +617 -617
- package/src/interfaces/augment-api-runtime.ts +223 -223
- package/src/interfaces/augment-api-tx.ts +709 -709
- package/src/interfaces/augment-api.ts +9 -9
- package/src/interfaces/augment-types.ts +1322 -1322
- package/src/interfaces/definitions.ts +1 -1
- package/src/interfaces/defintions.ts +1 -1
- package/src/interfaces/fulaNativeModule.ts +175 -168
- package/src/interfaces/index.ts +3 -3
- package/src/interfaces/lookup.ts +2011 -2011
- package/src/interfaces/registry.ts +163 -163
- package/src/interfaces/types-lookup.ts +2165 -2165
- package/src/interfaces/types.ts +2 -2
- package/src/protocols/blockchain.ts +644 -644
- package/src/protocols/fx-ai.ts +182 -0
- package/src/protocols/fxblox.ts +443 -443
package/src/protocols/fxblox.ts
CHANGED
|
@@ -1,443 +1,443 @@
|
|
|
1
|
-
import Fula from '../interfaces/fulaNativeModule';
|
|
2
|
-
import type * as BType from '../types/fxblox';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* send a command to Blox hardware to remove all save wifis.
|
|
6
|
-
* @returns json{status:true if success, false if fails; msg: error message or success log}
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const wifiRemoveall = (): Promise<BType.wifiRemoveallResponse> => {
|
|
10
|
-
console.log('wifiRemoveall in react-native started');
|
|
11
|
-
let res2 = Fula.wifiRemoveall()
|
|
12
|
-
.then((res) => {
|
|
13
|
-
try {
|
|
14
|
-
let jsonRes: BType.wifiRemoveallResponse = JSON.parse(res);
|
|
15
|
-
return jsonRes;
|
|
16
|
-
} catch (e) {
|
|
17
|
-
try {
|
|
18
|
-
return JSON.parse(res);
|
|
19
|
-
} catch (e2) {
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
.catch((err) => {
|
|
25
|
-
return err;
|
|
26
|
-
});
|
|
27
|
-
return res2;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const reboot = (): Promise<BType.rebootResponse> => {
|
|
31
|
-
console.log('reboot in react-native started');
|
|
32
|
-
let res2 = Fula.reboot()
|
|
33
|
-
.then((res) => {
|
|
34
|
-
try {
|
|
35
|
-
let jsonRes: BType.rebootResponse = JSON.parse(res);
|
|
36
|
-
return jsonRes;
|
|
37
|
-
} catch (e) {
|
|
38
|
-
try {
|
|
39
|
-
return JSON.parse(res);
|
|
40
|
-
} catch (e2) {
|
|
41
|
-
return res;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
.catch((err) => {
|
|
46
|
-
return err;
|
|
47
|
-
});
|
|
48
|
-
return res2;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const partition = (): Promise<BType.partitionResponse> => {
|
|
52
|
-
console.log('partition in react-native started');
|
|
53
|
-
let res2 = Fula.partition()
|
|
54
|
-
.then((res) => {
|
|
55
|
-
try {
|
|
56
|
-
let jsonRes: BType.partitionResponse = JSON.parse(res);
|
|
57
|
-
return jsonRes;
|
|
58
|
-
} catch (e) {
|
|
59
|
-
try {
|
|
60
|
-
return JSON.parse(res);
|
|
61
|
-
} catch (e2) {
|
|
62
|
-
return res;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
.catch((err) => {
|
|
67
|
-
return err;
|
|
68
|
-
});
|
|
69
|
-
return res2;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const eraseBlData = (): Promise<BType.rebootResponse> => {
|
|
73
|
-
console.log('eraseBlData in react-native started');
|
|
74
|
-
let res2 = Fula.eraseBlData()
|
|
75
|
-
.then((res) => {
|
|
76
|
-
try {
|
|
77
|
-
let jsonRes: BType.eraseBlDataResponse = JSON.parse(res);
|
|
78
|
-
return jsonRes;
|
|
79
|
-
} catch (e) {
|
|
80
|
-
try {
|
|
81
|
-
return JSON.parse(res);
|
|
82
|
-
} catch (e2) {
|
|
83
|
-
return res;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
.catch((err) => {
|
|
88
|
-
return err;
|
|
89
|
-
});
|
|
90
|
-
return res2;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const fetchContainerLogs = (
|
|
94
|
-
containerName: string,
|
|
95
|
-
tailCount: string
|
|
96
|
-
): Promise<BType.FetchContainerLogsResponse> => {
|
|
97
|
-
console.log('fetchContainerLogs in react-native started');
|
|
98
|
-
let res = Fula.fetchContainerLogs(containerName, tailCount)
|
|
99
|
-
.then((res1) => {
|
|
100
|
-
try {
|
|
101
|
-
console.log('res1 received');
|
|
102
|
-
console.log(res1);
|
|
103
|
-
let jsonRes: BType.FetchContainerLogsResponse = JSON.parse(res1);
|
|
104
|
-
return jsonRes;
|
|
105
|
-
} catch (e) {
|
|
106
|
-
try {
|
|
107
|
-
return JSON.parse(res1);
|
|
108
|
-
} catch (e1) {
|
|
109
|
-
console.error('Error parsing res in fetchContainerLogs:', e1);
|
|
110
|
-
throw e1; // Rethrow the error to maintain the rejection state
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
})
|
|
114
|
-
.catch((err) => {
|
|
115
|
-
console.error('Error fetchContainerLogs:', err);
|
|
116
|
-
throw err; // Rethrow the error to maintain the rejection state
|
|
117
|
-
});
|
|
118
|
-
return res;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const findBestAndTargetInLogs = (
|
|
122
|
-
containerName: string,
|
|
123
|
-
tailCount: string
|
|
124
|
-
): Promise<BType.FindBestAndTargetInLogsResponse> => {
|
|
125
|
-
console.log('findBestAndTargetInLogs in react-native started');
|
|
126
|
-
let res = Fula.findBestAndTargetInLogs(containerName, tailCount)
|
|
127
|
-
.then((res1) => {
|
|
128
|
-
try {
|
|
129
|
-
console.log('res1 received');
|
|
130
|
-
console.log(res1);
|
|
131
|
-
let jsonRes: BType.FindBestAndTargetInLogsResponse = JSON.parse(res1);
|
|
132
|
-
return jsonRes;
|
|
133
|
-
} catch (e) {
|
|
134
|
-
try {
|
|
135
|
-
return JSON.parse(res1);
|
|
136
|
-
} catch (e1) {
|
|
137
|
-
console.error('Error parsing res in findBestAndTargetInLogs:', e1);
|
|
138
|
-
throw e1; // Rethrow the error to maintain the rejection state
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
})
|
|
142
|
-
.catch((err) => {
|
|
143
|
-
console.error('Error findBestAndTargetInLogs:', err);
|
|
144
|
-
throw err; // Rethrow the error to maintain the rejection state
|
|
145
|
-
});
|
|
146
|
-
return res;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const getFolderSize = (
|
|
150
|
-
folderPath: string
|
|
151
|
-
): Promise<BType.GetFolderPathResponse> => {
|
|
152
|
-
console.log('getFolderSize in react-native started');
|
|
153
|
-
let res = Fula.getFolderSize(folderPath)
|
|
154
|
-
.then((res1) => {
|
|
155
|
-
try {
|
|
156
|
-
console.log('res1 received');
|
|
157
|
-
console.log(res1);
|
|
158
|
-
let jsonRes: BType.GetFolderPathResponse = JSON.parse(res1);
|
|
159
|
-
return jsonRes;
|
|
160
|
-
} catch (e) {
|
|
161
|
-
try {
|
|
162
|
-
return JSON.parse(res1);
|
|
163
|
-
} catch (e1) {
|
|
164
|
-
console.error('Error parsing res in getFolderSize:', e1);
|
|
165
|
-
throw e1; // Rethrow the error to maintain the rejection state
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
.catch((err) => {
|
|
170
|
-
console.error('Error getFolderSize:', err);
|
|
171
|
-
throw err; // Rethrow the error to maintain the rejection state
|
|
172
|
-
});
|
|
173
|
-
return res;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export const getDatastoreSize = (): Promise<BType.GetDatastoreSizeResponse> => {
|
|
177
|
-
console.log('getDatastoreSize in react-native started');
|
|
178
|
-
let res = Fula.getDatastoreSize()
|
|
179
|
-
.then((res1) => {
|
|
180
|
-
try {
|
|
181
|
-
console.log('res1 received');
|
|
182
|
-
console.log(res1);
|
|
183
|
-
let jsonRes: BType.GetDatastoreSizeResponse = JSON.parse(res1);
|
|
184
|
-
return jsonRes;
|
|
185
|
-
} catch (e) {
|
|
186
|
-
try {
|
|
187
|
-
return JSON.parse(res1);
|
|
188
|
-
} catch (e1) {
|
|
189
|
-
console.error('Error parsing res in getDatastoreSize:', e1);
|
|
190
|
-
throw e1; // Rethrow the error to maintain the rejection state
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
.catch((err) => {
|
|
195
|
-
console.error('Error getDatastoreSize:', err);
|
|
196
|
-
throw err; // Rethrow the error to maintain the rejection state
|
|
197
|
-
});
|
|
198
|
-
return res;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export const listPlugins = (): Promise<BType.ListPluginsResponse> => {
|
|
202
|
-
console.log('listPlugins in react-native started');
|
|
203
|
-
let res = Fula.listPlugins()
|
|
204
|
-
.then((res1) => {
|
|
205
|
-
try {
|
|
206
|
-
console.log('res1 received');
|
|
207
|
-
console.log(res1);
|
|
208
|
-
let jsonRes: BType.ListPluginsResponse = JSON.parse(res1);
|
|
209
|
-
return jsonRes;
|
|
210
|
-
} catch (e) {
|
|
211
|
-
try {
|
|
212
|
-
return JSON.parse(res1);
|
|
213
|
-
} catch (e1) {
|
|
214
|
-
console.error('Error parsing res in listPlugins:', e1);
|
|
215
|
-
throw e1;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
})
|
|
219
|
-
.catch((err) => {
|
|
220
|
-
console.error('Error listPlugins:', err);
|
|
221
|
-
throw err;
|
|
222
|
-
});
|
|
223
|
-
return res;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
export const listActivePlugins =
|
|
227
|
-
(): Promise<BType.ListActivePluginsResponse> => {
|
|
228
|
-
console.log('listActivePlugins in react-native started');
|
|
229
|
-
let res = Fula.listActivePlugins()
|
|
230
|
-
.then((res1) => {
|
|
231
|
-
try {
|
|
232
|
-
console.log('res1 received');
|
|
233
|
-
console.log(res1);
|
|
234
|
-
let jsonRes: BType.ListActivePluginsResponse = JSON.parse(res1);
|
|
235
|
-
if (jsonRes.status) {
|
|
236
|
-
return jsonRes;
|
|
237
|
-
} else {
|
|
238
|
-
console.error('Error getting listActivePlugins:', jsonRes.msg);
|
|
239
|
-
throw jsonRes;
|
|
240
|
-
}
|
|
241
|
-
} catch (e) {
|
|
242
|
-
try {
|
|
243
|
-
return JSON.parse(res1);
|
|
244
|
-
} catch (e1) {
|
|
245
|
-
console.error('Error parsing res in listActivePlugins:', e1);
|
|
246
|
-
throw e1;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
})
|
|
250
|
-
.catch((err) => {
|
|
251
|
-
console.error('Error listActivePlugins:', err);
|
|
252
|
-
throw err;
|
|
253
|
-
});
|
|
254
|
-
return res;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
export const installPlugin = (
|
|
258
|
-
pluginName: string,
|
|
259
|
-
params: string
|
|
260
|
-
): Promise<BType.InstallPluginResponse> => {
|
|
261
|
-
console.log('installPlugin in react-native started');
|
|
262
|
-
let res = Fula.installPlugin(pluginName, params)
|
|
263
|
-
.then((res1) => {
|
|
264
|
-
try {
|
|
265
|
-
console.log('res1 received');
|
|
266
|
-
console.log(res1);
|
|
267
|
-
let jsonRes: BType.InstallPluginResponse = JSON.parse(res1);
|
|
268
|
-
if (jsonRes.status) {
|
|
269
|
-
return jsonRes;
|
|
270
|
-
} else {
|
|
271
|
-
throw jsonRes;
|
|
272
|
-
}
|
|
273
|
-
} catch (e) {
|
|
274
|
-
try {
|
|
275
|
-
return JSON.parse(res1);
|
|
276
|
-
} catch (e1) {
|
|
277
|
-
console.error('Error parsing res in installPlugin:', e1);
|
|
278
|
-
throw e1;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
})
|
|
282
|
-
.catch((err) => {
|
|
283
|
-
console.error('Error installPlugin:', err);
|
|
284
|
-
throw err;
|
|
285
|
-
});
|
|
286
|
-
return res;
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
export const uninstallPlugin = (
|
|
290
|
-
pluginName: string
|
|
291
|
-
): Promise<BType.UninstallPluginResponse> => {
|
|
292
|
-
console.log('uninstallPlugin in react-native started');
|
|
293
|
-
let res = Fula.uninstallPlugin(pluginName)
|
|
294
|
-
.then((res1) => {
|
|
295
|
-
try {
|
|
296
|
-
console.log('res1 received');
|
|
297
|
-
console.log(res1);
|
|
298
|
-
let jsonRes: BType.UninstallPluginResponse = JSON.parse(res1);
|
|
299
|
-
if (jsonRes.status) {
|
|
300
|
-
return jsonRes;
|
|
301
|
-
} else {
|
|
302
|
-
throw jsonRes;
|
|
303
|
-
}
|
|
304
|
-
} catch (e) {
|
|
305
|
-
try {
|
|
306
|
-
return JSON.parse(res1);
|
|
307
|
-
} catch (e1) {
|
|
308
|
-
console.error('Error parsing res in uninstallPlugin:', e1);
|
|
309
|
-
throw e1;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
})
|
|
313
|
-
.catch((err) => {
|
|
314
|
-
console.error('Error uninstallPlugin:', err);
|
|
315
|
-
throw err;
|
|
316
|
-
});
|
|
317
|
-
return res;
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
export const showPluginStatus = (
|
|
321
|
-
pluginName: string,
|
|
322
|
-
lines: number
|
|
323
|
-
): Promise<BType.ShowPluginStatusResponse> => {
|
|
324
|
-
console.log('showPluginStatus in react-native started');
|
|
325
|
-
let res = Fula.showPluginStatus(pluginName, lines)
|
|
326
|
-
.then((res1) => {
|
|
327
|
-
try {
|
|
328
|
-
console.log('res1 received');
|
|
329
|
-
console.log(res1);
|
|
330
|
-
let jsonRes: BType.ShowPluginStatusResponse = JSON.parse(res1);
|
|
331
|
-
return jsonRes;
|
|
332
|
-
} catch (e) {
|
|
333
|
-
try {
|
|
334
|
-
return JSON.parse(res1);
|
|
335
|
-
} catch (e1) {
|
|
336
|
-
console.error('Error parsing res in showPluginStatus:', e1);
|
|
337
|
-
throw e1;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
})
|
|
341
|
-
.catch((err) => {
|
|
342
|
-
console.error('Error showPluginStatus:', err);
|
|
343
|
-
throw err;
|
|
344
|
-
});
|
|
345
|
-
return res;
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
export const getInstallStatus = (
|
|
349
|
-
pluginName: string
|
|
350
|
-
): Promise<BType.GetInstallStatusResponse> => {
|
|
351
|
-
console.log('getInstallStatus in react-native started');
|
|
352
|
-
let res = Fula.getInstallStatus(pluginName)
|
|
353
|
-
.then((res1) => {
|
|
354
|
-
try {
|
|
355
|
-
console.log('res1 received');
|
|
356
|
-
console.log(res1);
|
|
357
|
-
let jsonRes: BType.GetInstallStatusResponse = JSON.parse(res1);
|
|
358
|
-
if (jsonRes.status) {
|
|
359
|
-
return jsonRes;
|
|
360
|
-
} else {
|
|
361
|
-
console.error('Error getting install status:', jsonRes.msg);
|
|
362
|
-
throw jsonRes;
|
|
363
|
-
}
|
|
364
|
-
} catch (e) {
|
|
365
|
-
try {
|
|
366
|
-
return JSON.parse(res1);
|
|
367
|
-
} catch (e1) {
|
|
368
|
-
console.error('Error parsing res in getInstallStatus:', e1);
|
|
369
|
-
throw e1;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
})
|
|
373
|
-
.catch((err) => {
|
|
374
|
-
console.error('Error getInstallStatus:', err);
|
|
375
|
-
throw err;
|
|
376
|
-
});
|
|
377
|
-
return res;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
export const getInstallOutput = (
|
|
381
|
-
pluginName: string,
|
|
382
|
-
params: string
|
|
383
|
-
): Promise<BType.GetInstallOutputResponse> => {
|
|
384
|
-
console.log('getInstallOutput in react-native started');
|
|
385
|
-
let res = Fula.getInstallOutput(pluginName, params)
|
|
386
|
-
.then((res1) => {
|
|
387
|
-
try {
|
|
388
|
-
console.log('res1 received');
|
|
389
|
-
console.log(res1);
|
|
390
|
-
let jsonRes: BType.GetInstallOutputResponse = JSON.parse(res1);
|
|
391
|
-
if (jsonRes.status) {
|
|
392
|
-
return jsonRes;
|
|
393
|
-
} else {
|
|
394
|
-
console.error('Error getting install output:', jsonRes.msg);
|
|
395
|
-
throw jsonRes;
|
|
396
|
-
}
|
|
397
|
-
} catch (e) {
|
|
398
|
-
try {
|
|
399
|
-
return JSON.parse(res1);
|
|
400
|
-
} catch (e1) {
|
|
401
|
-
console.error('Error parsing res in getInstallOutput:', e1);
|
|
402
|
-
throw e1;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
})
|
|
406
|
-
.catch((err) => {
|
|
407
|
-
console.error('Error getInstallOutput:', err);
|
|
408
|
-
throw err;
|
|
409
|
-
});
|
|
410
|
-
return res;
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
export const updatePlugin = (
|
|
414
|
-
pluginName: string
|
|
415
|
-
): Promise<BType.UpdatePluginResponse> => {
|
|
416
|
-
console.log('updatePlugin in react-native started');
|
|
417
|
-
let res = Fula.updatePlugin(pluginName)
|
|
418
|
-
.then((res1) => {
|
|
419
|
-
try {
|
|
420
|
-
console.log('res1 received');
|
|
421
|
-
console.log(res1);
|
|
422
|
-
let jsonRes: BType.UpdatePluginResponse = JSON.parse(res1);
|
|
423
|
-
if (jsonRes.status) {
|
|
424
|
-
return jsonRes;
|
|
425
|
-
} else {
|
|
426
|
-
console.error('Error updating plugin:', jsonRes.msg);
|
|
427
|
-
throw jsonRes;
|
|
428
|
-
}
|
|
429
|
-
} catch (e) {
|
|
430
|
-
try {
|
|
431
|
-
return JSON.parse(res1);
|
|
432
|
-
} catch (e1) {
|
|
433
|
-
console.error('Error parsing res in updatePlugin:', e1);
|
|
434
|
-
throw e1;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
})
|
|
438
|
-
.catch((err) => {
|
|
439
|
-
console.error('Error updatePlugin:', err);
|
|
440
|
-
throw err;
|
|
441
|
-
});
|
|
442
|
-
return res;
|
|
443
|
-
};
|
|
1
|
+
import Fula from '../interfaces/fulaNativeModule';
|
|
2
|
+
import type * as BType from '../types/fxblox';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* send a command to Blox hardware to remove all save wifis.
|
|
6
|
+
* @returns json{status:true if success, false if fails; msg: error message or success log}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const wifiRemoveall = (): Promise<BType.wifiRemoveallResponse> => {
|
|
10
|
+
console.log('wifiRemoveall in react-native started');
|
|
11
|
+
let res2 = Fula.wifiRemoveall()
|
|
12
|
+
.then((res) => {
|
|
13
|
+
try {
|
|
14
|
+
let jsonRes: BType.wifiRemoveallResponse = JSON.parse(res);
|
|
15
|
+
return jsonRes;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(res);
|
|
19
|
+
} catch (e2) {
|
|
20
|
+
return res;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
.catch((err) => {
|
|
25
|
+
return err;
|
|
26
|
+
});
|
|
27
|
+
return res2;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const reboot = (): Promise<BType.rebootResponse> => {
|
|
31
|
+
console.log('reboot in react-native started');
|
|
32
|
+
let res2 = Fula.reboot()
|
|
33
|
+
.then((res) => {
|
|
34
|
+
try {
|
|
35
|
+
let jsonRes: BType.rebootResponse = JSON.parse(res);
|
|
36
|
+
return jsonRes;
|
|
37
|
+
} catch (e) {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(res);
|
|
40
|
+
} catch (e2) {
|
|
41
|
+
return res;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
return err;
|
|
47
|
+
});
|
|
48
|
+
return res2;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const partition = (): Promise<BType.partitionResponse> => {
|
|
52
|
+
console.log('partition in react-native started');
|
|
53
|
+
let res2 = Fula.partition()
|
|
54
|
+
.then((res) => {
|
|
55
|
+
try {
|
|
56
|
+
let jsonRes: BType.partitionResponse = JSON.parse(res);
|
|
57
|
+
return jsonRes;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
try {
|
|
60
|
+
return JSON.parse(res);
|
|
61
|
+
} catch (e2) {
|
|
62
|
+
return res;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
.catch((err) => {
|
|
67
|
+
return err;
|
|
68
|
+
});
|
|
69
|
+
return res2;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const eraseBlData = (): Promise<BType.rebootResponse> => {
|
|
73
|
+
console.log('eraseBlData in react-native started');
|
|
74
|
+
let res2 = Fula.eraseBlData()
|
|
75
|
+
.then((res) => {
|
|
76
|
+
try {
|
|
77
|
+
let jsonRes: BType.eraseBlDataResponse = JSON.parse(res);
|
|
78
|
+
return jsonRes;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
try {
|
|
81
|
+
return JSON.parse(res);
|
|
82
|
+
} catch (e2) {
|
|
83
|
+
return res;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
return err;
|
|
89
|
+
});
|
|
90
|
+
return res2;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const fetchContainerLogs = (
|
|
94
|
+
containerName: string,
|
|
95
|
+
tailCount: string
|
|
96
|
+
): Promise<BType.FetchContainerLogsResponse> => {
|
|
97
|
+
console.log('fetchContainerLogs in react-native started');
|
|
98
|
+
let res = Fula.fetchContainerLogs(containerName, tailCount)
|
|
99
|
+
.then((res1) => {
|
|
100
|
+
try {
|
|
101
|
+
console.log('res1 received');
|
|
102
|
+
console.log(res1);
|
|
103
|
+
let jsonRes: BType.FetchContainerLogsResponse = JSON.parse(res1);
|
|
104
|
+
return jsonRes;
|
|
105
|
+
} catch (e) {
|
|
106
|
+
try {
|
|
107
|
+
return JSON.parse(res1);
|
|
108
|
+
} catch (e1) {
|
|
109
|
+
console.error('Error parsing res in fetchContainerLogs:', e1);
|
|
110
|
+
throw e1; // Rethrow the error to maintain the rejection state
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
.catch((err) => {
|
|
115
|
+
console.error('Error fetchContainerLogs:', err);
|
|
116
|
+
throw err; // Rethrow the error to maintain the rejection state
|
|
117
|
+
});
|
|
118
|
+
return res;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const findBestAndTargetInLogs = (
|
|
122
|
+
containerName: string,
|
|
123
|
+
tailCount: string
|
|
124
|
+
): Promise<BType.FindBestAndTargetInLogsResponse> => {
|
|
125
|
+
console.log('findBestAndTargetInLogs in react-native started');
|
|
126
|
+
let res = Fula.findBestAndTargetInLogs(containerName, tailCount)
|
|
127
|
+
.then((res1) => {
|
|
128
|
+
try {
|
|
129
|
+
console.log('res1 received');
|
|
130
|
+
console.log(res1);
|
|
131
|
+
let jsonRes: BType.FindBestAndTargetInLogsResponse = JSON.parse(res1);
|
|
132
|
+
return jsonRes;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(res1);
|
|
136
|
+
} catch (e1) {
|
|
137
|
+
console.error('Error parsing res in findBestAndTargetInLogs:', e1);
|
|
138
|
+
throw e1; // Rethrow the error to maintain the rejection state
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
.catch((err) => {
|
|
143
|
+
console.error('Error findBestAndTargetInLogs:', err);
|
|
144
|
+
throw err; // Rethrow the error to maintain the rejection state
|
|
145
|
+
});
|
|
146
|
+
return res;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const getFolderSize = (
|
|
150
|
+
folderPath: string
|
|
151
|
+
): Promise<BType.GetFolderPathResponse> => {
|
|
152
|
+
console.log('getFolderSize in react-native started');
|
|
153
|
+
let res = Fula.getFolderSize(folderPath)
|
|
154
|
+
.then((res1) => {
|
|
155
|
+
try {
|
|
156
|
+
console.log('res1 received');
|
|
157
|
+
console.log(res1);
|
|
158
|
+
let jsonRes: BType.GetFolderPathResponse = JSON.parse(res1);
|
|
159
|
+
return jsonRes;
|
|
160
|
+
} catch (e) {
|
|
161
|
+
try {
|
|
162
|
+
return JSON.parse(res1);
|
|
163
|
+
} catch (e1) {
|
|
164
|
+
console.error('Error parsing res in getFolderSize:', e1);
|
|
165
|
+
throw e1; // Rethrow the error to maintain the rejection state
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
.catch((err) => {
|
|
170
|
+
console.error('Error getFolderSize:', err);
|
|
171
|
+
throw err; // Rethrow the error to maintain the rejection state
|
|
172
|
+
});
|
|
173
|
+
return res;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const getDatastoreSize = (): Promise<BType.GetDatastoreSizeResponse> => {
|
|
177
|
+
console.log('getDatastoreSize in react-native started');
|
|
178
|
+
let res = Fula.getDatastoreSize()
|
|
179
|
+
.then((res1) => {
|
|
180
|
+
try {
|
|
181
|
+
console.log('res1 received');
|
|
182
|
+
console.log(res1);
|
|
183
|
+
let jsonRes: BType.GetDatastoreSizeResponse = JSON.parse(res1);
|
|
184
|
+
return jsonRes;
|
|
185
|
+
} catch (e) {
|
|
186
|
+
try {
|
|
187
|
+
return JSON.parse(res1);
|
|
188
|
+
} catch (e1) {
|
|
189
|
+
console.error('Error parsing res in getDatastoreSize:', e1);
|
|
190
|
+
throw e1; // Rethrow the error to maintain the rejection state
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
.catch((err) => {
|
|
195
|
+
console.error('Error getDatastoreSize:', err);
|
|
196
|
+
throw err; // Rethrow the error to maintain the rejection state
|
|
197
|
+
});
|
|
198
|
+
return res;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const listPlugins = (): Promise<BType.ListPluginsResponse> => {
|
|
202
|
+
console.log('listPlugins in react-native started');
|
|
203
|
+
let res = Fula.listPlugins()
|
|
204
|
+
.then((res1) => {
|
|
205
|
+
try {
|
|
206
|
+
console.log('res1 received');
|
|
207
|
+
console.log(res1);
|
|
208
|
+
let jsonRes: BType.ListPluginsResponse = JSON.parse(res1);
|
|
209
|
+
return jsonRes;
|
|
210
|
+
} catch (e) {
|
|
211
|
+
try {
|
|
212
|
+
return JSON.parse(res1);
|
|
213
|
+
} catch (e1) {
|
|
214
|
+
console.error('Error parsing res in listPlugins:', e1);
|
|
215
|
+
throw e1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
.catch((err) => {
|
|
220
|
+
console.error('Error listPlugins:', err);
|
|
221
|
+
throw err;
|
|
222
|
+
});
|
|
223
|
+
return res;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const listActivePlugins =
|
|
227
|
+
(): Promise<BType.ListActivePluginsResponse> => {
|
|
228
|
+
console.log('listActivePlugins in react-native started');
|
|
229
|
+
let res = Fula.listActivePlugins()
|
|
230
|
+
.then((res1) => {
|
|
231
|
+
try {
|
|
232
|
+
console.log('res1 received');
|
|
233
|
+
console.log(res1);
|
|
234
|
+
let jsonRes: BType.ListActivePluginsResponse = JSON.parse(res1);
|
|
235
|
+
if (jsonRes.status) {
|
|
236
|
+
return jsonRes;
|
|
237
|
+
} else {
|
|
238
|
+
console.error('Error getting listActivePlugins:', jsonRes.msg);
|
|
239
|
+
throw jsonRes;
|
|
240
|
+
}
|
|
241
|
+
} catch (e) {
|
|
242
|
+
try {
|
|
243
|
+
return JSON.parse(res1);
|
|
244
|
+
} catch (e1) {
|
|
245
|
+
console.error('Error parsing res in listActivePlugins:', e1);
|
|
246
|
+
throw e1;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
.catch((err) => {
|
|
251
|
+
console.error('Error listActivePlugins:', err);
|
|
252
|
+
throw err;
|
|
253
|
+
});
|
|
254
|
+
return res;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export const installPlugin = (
|
|
258
|
+
pluginName: string,
|
|
259
|
+
params: string
|
|
260
|
+
): Promise<BType.InstallPluginResponse> => {
|
|
261
|
+
console.log('installPlugin in react-native started');
|
|
262
|
+
let res = Fula.installPlugin(pluginName, params)
|
|
263
|
+
.then((res1) => {
|
|
264
|
+
try {
|
|
265
|
+
console.log('res1 received');
|
|
266
|
+
console.log(res1);
|
|
267
|
+
let jsonRes: BType.InstallPluginResponse = JSON.parse(res1);
|
|
268
|
+
if (jsonRes.status) {
|
|
269
|
+
return jsonRes;
|
|
270
|
+
} else {
|
|
271
|
+
throw jsonRes;
|
|
272
|
+
}
|
|
273
|
+
} catch (e) {
|
|
274
|
+
try {
|
|
275
|
+
return JSON.parse(res1);
|
|
276
|
+
} catch (e1) {
|
|
277
|
+
console.error('Error parsing res in installPlugin:', e1);
|
|
278
|
+
throw e1;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
.catch((err) => {
|
|
283
|
+
console.error('Error installPlugin:', err);
|
|
284
|
+
throw err;
|
|
285
|
+
});
|
|
286
|
+
return res;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export const uninstallPlugin = (
|
|
290
|
+
pluginName: string
|
|
291
|
+
): Promise<BType.UninstallPluginResponse> => {
|
|
292
|
+
console.log('uninstallPlugin in react-native started');
|
|
293
|
+
let res = Fula.uninstallPlugin(pluginName)
|
|
294
|
+
.then((res1) => {
|
|
295
|
+
try {
|
|
296
|
+
console.log('res1 received');
|
|
297
|
+
console.log(res1);
|
|
298
|
+
let jsonRes: BType.UninstallPluginResponse = JSON.parse(res1);
|
|
299
|
+
if (jsonRes.status) {
|
|
300
|
+
return jsonRes;
|
|
301
|
+
} else {
|
|
302
|
+
throw jsonRes;
|
|
303
|
+
}
|
|
304
|
+
} catch (e) {
|
|
305
|
+
try {
|
|
306
|
+
return JSON.parse(res1);
|
|
307
|
+
} catch (e1) {
|
|
308
|
+
console.error('Error parsing res in uninstallPlugin:', e1);
|
|
309
|
+
throw e1;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
.catch((err) => {
|
|
314
|
+
console.error('Error uninstallPlugin:', err);
|
|
315
|
+
throw err;
|
|
316
|
+
});
|
|
317
|
+
return res;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const showPluginStatus = (
|
|
321
|
+
pluginName: string,
|
|
322
|
+
lines: number
|
|
323
|
+
): Promise<BType.ShowPluginStatusResponse> => {
|
|
324
|
+
console.log('showPluginStatus in react-native started');
|
|
325
|
+
let res = Fula.showPluginStatus(pluginName, lines)
|
|
326
|
+
.then((res1) => {
|
|
327
|
+
try {
|
|
328
|
+
console.log('res1 received');
|
|
329
|
+
console.log(res1);
|
|
330
|
+
let jsonRes: BType.ShowPluginStatusResponse = JSON.parse(res1);
|
|
331
|
+
return jsonRes;
|
|
332
|
+
} catch (e) {
|
|
333
|
+
try {
|
|
334
|
+
return JSON.parse(res1);
|
|
335
|
+
} catch (e1) {
|
|
336
|
+
console.error('Error parsing res in showPluginStatus:', e1);
|
|
337
|
+
throw e1;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
})
|
|
341
|
+
.catch((err) => {
|
|
342
|
+
console.error('Error showPluginStatus:', err);
|
|
343
|
+
throw err;
|
|
344
|
+
});
|
|
345
|
+
return res;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export const getInstallStatus = (
|
|
349
|
+
pluginName: string
|
|
350
|
+
): Promise<BType.GetInstallStatusResponse> => {
|
|
351
|
+
console.log('getInstallStatus in react-native started');
|
|
352
|
+
let res = Fula.getInstallStatus(pluginName)
|
|
353
|
+
.then((res1) => {
|
|
354
|
+
try {
|
|
355
|
+
console.log('res1 received');
|
|
356
|
+
console.log(res1);
|
|
357
|
+
let jsonRes: BType.GetInstallStatusResponse = JSON.parse(res1);
|
|
358
|
+
if (jsonRes.status) {
|
|
359
|
+
return jsonRes;
|
|
360
|
+
} else {
|
|
361
|
+
console.error('Error getting install status:', jsonRes.msg);
|
|
362
|
+
throw jsonRes;
|
|
363
|
+
}
|
|
364
|
+
} catch (e) {
|
|
365
|
+
try {
|
|
366
|
+
return JSON.parse(res1);
|
|
367
|
+
} catch (e1) {
|
|
368
|
+
console.error('Error parsing res in getInstallStatus:', e1);
|
|
369
|
+
throw e1;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
})
|
|
373
|
+
.catch((err) => {
|
|
374
|
+
console.error('Error getInstallStatus:', err);
|
|
375
|
+
throw err;
|
|
376
|
+
});
|
|
377
|
+
return res;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
export const getInstallOutput = (
|
|
381
|
+
pluginName: string,
|
|
382
|
+
params: string
|
|
383
|
+
): Promise<BType.GetInstallOutputResponse> => {
|
|
384
|
+
console.log('getInstallOutput in react-native started');
|
|
385
|
+
let res = Fula.getInstallOutput(pluginName, params)
|
|
386
|
+
.then((res1) => {
|
|
387
|
+
try {
|
|
388
|
+
console.log('res1 received');
|
|
389
|
+
console.log(res1);
|
|
390
|
+
let jsonRes: BType.GetInstallOutputResponse = JSON.parse(res1);
|
|
391
|
+
if (jsonRes.status) {
|
|
392
|
+
return jsonRes;
|
|
393
|
+
} else {
|
|
394
|
+
console.error('Error getting install output:', jsonRes.msg);
|
|
395
|
+
throw jsonRes;
|
|
396
|
+
}
|
|
397
|
+
} catch (e) {
|
|
398
|
+
try {
|
|
399
|
+
return JSON.parse(res1);
|
|
400
|
+
} catch (e1) {
|
|
401
|
+
console.error('Error parsing res in getInstallOutput:', e1);
|
|
402
|
+
throw e1;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
.catch((err) => {
|
|
407
|
+
console.error('Error getInstallOutput:', err);
|
|
408
|
+
throw err;
|
|
409
|
+
});
|
|
410
|
+
return res;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export const updatePlugin = (
|
|
414
|
+
pluginName: string
|
|
415
|
+
): Promise<BType.UpdatePluginResponse> => {
|
|
416
|
+
console.log('updatePlugin in react-native started');
|
|
417
|
+
let res = Fula.updatePlugin(pluginName)
|
|
418
|
+
.then((res1) => {
|
|
419
|
+
try {
|
|
420
|
+
console.log('res1 received');
|
|
421
|
+
console.log(res1);
|
|
422
|
+
let jsonRes: BType.UpdatePluginResponse = JSON.parse(res1);
|
|
423
|
+
if (jsonRes.status) {
|
|
424
|
+
return jsonRes;
|
|
425
|
+
} else {
|
|
426
|
+
console.error('Error updating plugin:', jsonRes.msg);
|
|
427
|
+
throw jsonRes;
|
|
428
|
+
}
|
|
429
|
+
} catch (e) {
|
|
430
|
+
try {
|
|
431
|
+
return JSON.parse(res1);
|
|
432
|
+
} catch (e1) {
|
|
433
|
+
console.error('Error parsing res in updatePlugin:', e1);
|
|
434
|
+
throw e1;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
})
|
|
438
|
+
.catch((err) => {
|
|
439
|
+
console.error('Error updatePlugin:', err);
|
|
440
|
+
throw err;
|
|
441
|
+
});
|
|
442
|
+
return res;
|
|
443
|
+
};
|