@functionland/react-native-fula 1.9.0 → 1.12.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.
@@ -1,32 +1,32 @@
1
- package land.fx.fula;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.ReactPackage;
6
- import com.facebook.react.bridge.NativeModule;
7
- import com.facebook.react.bridge.ReactApplicationContext;
8
- import com.facebook.react.uimanager.ViewManager;
9
-
10
- import java.util.ArrayList;
11
- import java.util.Collections;
12
- import java.util.List;
13
-
14
- public class FulaPackage implements ReactPackage {
15
- @NonNull
16
- @Override
17
- public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
- List<NativeModule> modules = new ArrayList<>();
19
- try {
20
- modules.add(new FulaModule(reactContext));
21
- } catch (Exception e) {
22
- e.printStackTrace();
23
- }
24
- return modules;
25
- }
26
-
27
- @NonNull
28
- @Override
29
- public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
30
- return Collections.emptyList();
31
- }
32
- }
1
+ package land.fx.fula;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class FulaPackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ try {
20
+ modules.add(new FulaModule(reactContext));
21
+ } catch (Exception e) {
22
+ e.printStackTrace();
23
+ }
24
+ return modules;
25
+ }
26
+
27
+ @NonNull
28
+ @Override
29
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
30
+ return Collections.emptyList();
31
+ }
32
+ }
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Fula","NativeModules","FulaModule","Proxy","get","Error"],"sources":["fulaNativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\r\n\r\ninterface FulaNativeModule {\r\n init: (\r\n identity: string, //Private key of did identity\r\n storePath: string, //You can leave empty\r\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\r\n exchange: string, //set to 'noope' for testing\r\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\r\n rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem\r\n useRelay: boolean | null, // if true it forces the use of relay\r\n refresh: boolean // if true it forces to refresh the fula object\r\n ) => Promise<{ peerId: string; rootCid: string; private_ref: string }>;\r\n newClient: (\r\n identity: string, //Private key of did identity\r\n storePath: string, //You can leave empty\r\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\r\n exchange: string, //set to 'noope' for testing\r\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\r\n useRelay: boolean | null, // if true it forces the use of relay\r\n refresh: boolean // if true it forces to refresh the fula object\r\n ) => Promise<string>;\r\n isReady: (filesystemCheck: boolean) => Promise<boolean>;\r\n logout: (identity: string, storePath: string) => Promise<boolean>;\r\n checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;\r\n checkConnection: (timeout: number) => Promise<boolean>;\r\n get: (key: string) => Promise<string>;\r\n has: (key: Uint8Array) => Promise<boolean>;\r\n push: () => Promise<string>;\r\n put: (content: string, codec: string) => Promise<string>;\r\n mkdir: (path: string) => Promise<string>;\r\n writeFileContent: (path: string, content: string) => Promise<string>;\r\n writeFile: (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n ) => Promise<string>;\r\n ls: (path: string) => Promise<string>;\r\n rm: (path: string) => Promise<string>;\r\n cp: (sourcePath: string, targetPath: string) => Promise<string>;\r\n mv: (sourcePath: string, targetPath: string) => Promise<string>;\r\n readFile: (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n ) => Promise<string>;\r\n readFileContent: (path: string) => Promise<string>;\r\n setAuth: (peerId: string, allow: boolean) => Promise<boolean>;\r\n\r\n shutdown: () => Promise<void>;\r\n\r\n //Blockchain related functions\r\n createAccount: (seed: string) => Promise<string>;\r\n checkAccountExists: (account: string) => Promise<string>;\r\n createPool: (seed: string, poolName: string) => Promise<string>;\r\n listPools: () => Promise<string>;\r\n joinPool: (seed: string, poolID: number) => Promise<string>;\r\n leavePool: (seed: string, poolID: number) => Promise<string>;\r\n cancelPoolJoin: (seed: string, poolID: number) => Promise<string>;\r\n listPoolJoinRequests: (poolID: number) => Promise<string>;\r\n votePoolJoinRequest: (\r\n seed: string,\r\n poolID: number,\r\n account: string,\r\n accept: boolean\r\n ) => Promise<string>;\r\n newReplicationRequest: (\r\n seed: string,\r\n poolID: number,\r\n replicationFactor: number,\r\n cid: string\r\n ) => Promise<string>;\r\n newStoreRequest: (\r\n seed: string,\r\n poolID: number,\r\n uploader: string,\r\n cid: string\r\n ) => Promise<string>;\r\n listAvailableReplicationRequests: (poolID: number) => Promise<string>;\r\n removeReplicationRequest: (\r\n seed: string,\r\n poolID: number,\r\n cid: string\r\n ) => Promise<string>;\r\n removeStorer: (\r\n seed: string,\r\n storer: string,\r\n poolID: number,\r\n cid: string\r\n ) => Promise<string>;\r\n removeStoredReplication: (\r\n seed: string,\r\n uploader: string,\r\n poolID: number,\r\n cid: string\r\n ) => Promise<string>;\r\n\r\n //Hardware\r\n bloxFreeSpace: () => Promise<string>;\r\n wifiRemoveall: () => Promise<string>;\r\n reboot: () => Promise<string>;\r\n}\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-fula/Fula' doesn't seem to be linked. Make sure: \\n\\n` +\r\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\r\n '- You rebuilt the app after installing the package\\n' +\r\n '- You are not using Expo managed workflow\\n';\r\n\r\nconst Fula = NativeModules.FulaModule\r\n ? NativeModules.FulaModule\r\n : new Proxy(\r\n {},\r\n {\r\n get() {\r\n throw new Error(LINKING_ERROR);\r\n },\r\n }\r\n );\r\n\r\nexport default Fula as FulaNativeModule;\r\n"],"mappings":";;;;;;AAAA;AAqGA,MAAMA,aAAa,GAChB,iFAAgF,GACjFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,IAAI,GAAGC,0BAAa,CAACC,UAAU,GACjCD,0BAAa,CAACC,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAAC,eAESK,IAAI;AAAA"}
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Fula","NativeModules","FulaModule","Proxy","get","Error"],"sources":["fulaNativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\ninterface FulaNativeModule {\n init: (\n identity: string, //Private key of did identity\n storePath: string, //You can leave empty\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\n exchange: string, //set to 'noope' for testing\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\n rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem\n useRelay: boolean | null, // if true it forces the use of relay\n refresh: boolean // if true it forces to refresh the fula object\n ) => Promise<{ peerId: string; rootCid: string; private_ref: string }>;\n newClient: (\n identity: string, //Private key of did identity\n storePath: string, //You can leave empty\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\n exchange: string, //set to 'noope' for testing\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\n useRelay: boolean | null, // if true it forces the use of relay\n refresh: boolean // if true it forces to refresh the fula object\n ) => Promise<string>;\n isReady: (filesystemCheck: boolean) => Promise<boolean>;\n logout: (identity: string, storePath: string) => Promise<boolean>;\n checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;\n listFailedActions: (cids: string[]) => Promise<string[]>;\n checkConnection: (timeout: number) => Promise<boolean>;\n get: (key: string) => Promise<string>;\n has: (key: Uint8Array) => Promise<boolean>;\n push: () => Promise<string>;\n put: (content: string, codec: string) => Promise<string>;\n mkdir: (path: string) => Promise<string>;\n writeFileContent: (path: string, content: string) => Promise<string>;\n writeFile: (\n fulaTargetFilename: string,\n localFilename: string\n ) => Promise<string>;\n ls: (path: string) => Promise<string>;\n rm: (path: string) => Promise<string>;\n cp: (sourcePath: string, targetPath: string) => Promise<string>;\n mv: (sourcePath: string, targetPath: string) => Promise<string>;\n readFile: (\n fulaTargetFilename: string,\n localFilename: string\n ) => Promise<string>;\n readFileContent: (path: string) => Promise<string>;\n setAuth: (peerId: string, allow: boolean) => Promise<boolean>;\n\n shutdown: () => Promise<void>;\n\n testData: (identity: string, bloxAddr: string) => Promise<string>;\n\n //Blockchain related functions\n createAccount: (seed: string) => Promise<string>;\n checkAccountExists: (account: string) => Promise<string>;\n createPool: (seed: string, poolName: string) => Promise<string>;\n listPools: () => Promise<string>;\n joinPool: (seed: string, poolID: number) => Promise<string>;\n leavePool: (seed: string, poolID: number) => Promise<string>;\n cancelPoolJoin: (seed: string, poolID: number) => Promise<string>;\n listPoolJoinRequests: (poolID: number) => Promise<string>;\n votePoolJoinRequest: (\n seed: string,\n poolID: number,\n account: string,\n accept: boolean\n ) => Promise<string>;\n newReplicationRequest: (\n seed: string,\n poolID: number,\n replicationFactor: number,\n cid: string\n ) => Promise<string>;\n newStoreRequest: (\n seed: string,\n poolID: number,\n uploader: string,\n cid: string\n ) => Promise<string>;\n listAvailableReplicationRequests: (poolID: number) => Promise<string>;\n removeReplicationRequest: (\n seed: string,\n poolID: number,\n cid: string\n ) => Promise<string>;\n removeStorer: (\n seed: string,\n storer: string,\n poolID: number,\n cid: string\n ) => Promise<string>;\n removeStoredReplication: (\n seed: string,\n uploader: string,\n poolID: number,\n cid: string\n ) => Promise<string>;\n\n //Hardware\n bloxFreeSpace: () => Promise<string>;\n wifiRemoveall: () => Promise<string>;\n reboot: () => Promise<string>;\n}\n\nconst LINKING_ERROR =\n `The package 'react-native-fula/Fula' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Fula = NativeModules.FulaModule\n ? NativeModules.FulaModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport default Fula as FulaNativeModule;\n"],"mappings":";;;;;;AAAA;AAwGA,MAAMA,aAAa,GAChB,iFAAgF,GACjFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,IAAI,GAAGC,0BAAa,CAACC,UAAU,GACjCD,0BAAa,CAACC,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAAC,eAESK,IAAI;AAAA"}
@@ -3,14 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.writeFileContent = exports.writeFile = exports.shutdown = exports.setAuth = exports.rm = exports.readFileContent = exports.readFile = exports.put = exports.push = exports.newClient = exports.mv = exports.mkdir = exports.ls = exports.logout = exports.isReady = exports.init = exports.has = exports.get = exports.cp = exports.checkFailedActions = exports.checkConnection = void 0;
6
+ exports.writeFileContent = exports.writeFile = exports.testData = exports.shutdown = exports.setAuth = exports.rm = exports.readFileContent = exports.readFile = exports.put = exports.push = exports.newClient = exports.mv = exports.mkdir = exports.ls = exports.logout = exports.listFailedActions = exports.isReady = exports.init = exports.has = exports.get = exports.cp = exports.checkFailedActions = exports.checkConnection = void 0;
7
7
  var _fulaNativeModule = _interopRequireDefault(require("../interfaces/fulaNativeModule"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- /**
10
- * Get gets the value corresponding to the given key from the local datastore.
11
- // The key must be a valid ipld.Link.
12
- * @param config
13
- * @returns boolean
9
+ /**
10
+ * Get gets the value corresponding to the given key from the local datastore.
11
+ // The key must be a valid ipld.Link.
12
+ * @param config
13
+ * @returns boolean
14
14
  */
15
15
 
16
16
  const init = function (identity, storePath, bloxAddr, exchange) {
@@ -22,11 +22,11 @@ const init = function (identity, storePath, bloxAddr, exchange) {
22
22
  return _fulaNativeModule.default.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);
23
23
  };
24
24
 
25
- /**
26
- * Get gets the value corresponding to the given key from the local datastore.
27
- // The key must be a valid ipld.Link.
28
- * @param config
29
- * @returns boolean
25
+ /**
26
+ * Get gets the value corresponding to the given key from the local datastore.
27
+ // The key must be a valid ipld.Link.
28
+ * @param config
29
+ * @returns boolean
30
30
  */
31
31
  exports.init = init;
32
32
  const newClient = function (identity, storePath, bloxAddr, exchange) {
@@ -37,18 +37,18 @@ const newClient = function (identity, storePath, bloxAddr, exchange) {
37
37
  return _fulaNativeModule.default.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);
38
38
  };
39
39
 
40
- /**
41
- * rm removes all data
42
- * @param path
43
- * @returns string: new cid of the root
40
+ /**
41
+ * rm removes all data
42
+ * @param path
43
+ * @returns string: new cid of the root
44
44
  */
45
45
  exports.newClient = newClient;
46
46
  const logout = (identity, storePath) => {
47
47
  return _fulaNativeModule.default.logout(identity, storePath);
48
48
  };
49
49
 
50
- /**
51
- * Checks if there are any un-synced changes on the device
50
+ /**
51
+ * Checks if there are any un-synced changes on the device
52
52
  */
53
53
  exports.logout = logout;
54
54
  const checkFailedActions = function () {
@@ -57,99 +57,114 @@ const checkFailedActions = function () {
57
57
  return _fulaNativeModule.default.checkFailedActions(retry, timeout);
58
58
  };
59
59
 
60
- /**
61
- * Checks if there are any un-synced changes on the device
60
+ /**
61
+ * Lists the cids that failed to be sent to backend and are kept only locally
62
62
  */
63
63
  exports.checkFailedActions = checkFailedActions;
64
+ const listFailedActions = function () {
65
+ let cids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
66
+ return _fulaNativeModule.default.listFailedActions(cids);
67
+ };
68
+
69
+ /**
70
+ * Checks if there are any un-synced changes on the device
71
+ */
72
+ exports.listFailedActions = listFailedActions;
64
73
  const checkConnection = function () {
65
74
  let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
66
75
  return _fulaNativeModule.default.checkConnection(timeout);
67
76
  };
68
77
 
69
- /**
70
- * Get gets the value corresponding to the given key from the local datastore.
71
- // The key must be a valid ipld.Link.
72
- * @param key
73
- * @returns value
78
+ /**
79
+ * Get gets the value corresponding to the given key from the local datastore.
80
+ // The key must be a valid ipld.Link.
81
+ * @param key
82
+ * @returns value
74
83
  */
75
84
  exports.checkConnection = checkConnection;
76
85
  const get = key => {
77
86
  return _fulaNativeModule.default.get(key);
78
87
  };
79
88
 
80
- /**
81
- * Has checks whether the value corresponding to the given key is present in the local datastore.
82
- // The key must be a valid ipld.Link.
83
- * @param key
84
- * @returns boolean
89
+ /**
90
+ * Has checks whether the value corresponding to the given key is present in the local datastore.
91
+ // The key must be a valid ipld.Link.
92
+ * @param key
93
+ * @returns boolean
85
94
  */
86
95
  exports.get = get;
87
96
  const has = key => {
88
97
  return _fulaNativeModule.default.has(key);
89
98
  };
90
99
 
91
- /**
92
- * Push requests the given addr to download the root cid from this node.
93
- // The addr must be a valid multiaddr that includes peer ID.
94
- // this function.
95
- * @param addr
96
- * @returns null or error
100
+ /**
101
+ * Push requests the given addr to download the root cid from this node.
102
+ // The addr must be a valid multiaddr that includes peer ID.
103
+ // this function.
104
+ * @param addr
105
+ * @returns null or error
97
106
  */
98
107
  exports.has = has;
99
108
  const push = () => {
100
109
  return _fulaNativeModule.default.push();
101
110
  };
102
111
 
103
- /**
104
- * Put stores the given key value onto the local datastore.
105
- // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
106
- // to the given key.
107
- * @param key, value
108
- * @returns null or string
109
- */
112
+ //This method sends some test data to backedn
110
113
  exports.push = push;
114
+ const testData = (identity, bloxAddr) => {
115
+ return _fulaNativeModule.default.testData(identity, bloxAddr);
116
+ };
117
+
118
+ /**
119
+ * Put stores the given key value onto the local datastore.
120
+ // The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
121
+ // to the given key.
122
+ * @param key, value
123
+ * @returns null or string
124
+ */
125
+ exports.testData = testData;
111
126
  const put = (value, codec) => {
112
127
  return _fulaNativeModule.default.put(value, codec);
113
128
  };
114
129
 
115
- /**
116
- * mkdir creates a directory at the given path.
117
- * @param path
118
- * @returns string: new cid of the root
130
+ /**
131
+ * mkdir creates a directory at the given path.
132
+ * @param path
133
+ * @returns string: new cid of the root
119
134
  */
120
135
  exports.put = put;
121
136
  const mkdir = path => {
122
137
  return _fulaNativeModule.default.mkdir(path);
123
138
  };
124
139
 
125
- /**
126
- * writeFileContent writes content at a given path
127
- * @param path
128
- * @returns string: new cid of the root
140
+ /**
141
+ * writeFileContent writes content at a given path
142
+ * @param path
143
+ * @returns string: new cid of the root
129
144
  */
130
145
  exports.mkdir = mkdir;
131
146
  const writeFileContent = (path, content) => {
132
147
  return _fulaNativeModule.default.writeFileContent(path, content);
133
148
  };
134
149
 
135
- /*
136
- // reads content of the file form localFilename (should include full absolute path to local file with read permission
137
- // writes content to the specified location by fulaTargetFilename in Fula filesystem
138
- // It keeps the original file modiifcation date
139
- // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
140
- // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
141
- // Returns: new cid of the root after this file is placed in the tree
150
+ /*
151
+ // reads content of the file form localFilename (should include full absolute path to local file with read permission
152
+ // writes content to the specified location by fulaTargetFilename in Fula filesystem
153
+ // It keeps the original file modiifcation date
154
+ // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
155
+ // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
156
+ // Returns: new cid of the root after this file is placed in the tree
142
157
  */
143
158
  exports.writeFileContent = writeFileContent;
144
159
  const writeFile = (fulaTargetFilename, localFilename) => {
145
160
  return _fulaNativeModule.default.writeFile(fulaTargetFilename, localFilename);
146
161
  };
147
162
 
148
- /**
149
- * ls lists the name of files and folders at a given path
150
- * @param path
151
- * @returns string: list of items
152
- * TODO: Findout how is the string and convert to array
163
+ /**
164
+ * ls lists the name of files and folders at a given path
165
+ * @param path
166
+ * @returns string: list of items
167
+ * TODO: Findout how is the string and convert to array
153
168
  */
154
169
  exports.writeFile = writeFile;
155
170
  const ls = path => {
@@ -181,84 +196,84 @@ const ls = path => {
181
196
  });
182
197
  };
183
198
 
184
- /**
185
- * rm removes all files and folders at a given path
186
- * @param path
187
- * @returns string: new cid of the root
199
+ /**
200
+ * rm removes all files and folders at a given path
201
+ * @param path
202
+ * @returns string: new cid of the root
188
203
  */
189
204
  exports.ls = ls;
190
205
  const rm = path => {
191
206
  return _fulaNativeModule.default.rm(path);
192
207
  };
193
208
 
194
- /**
195
- * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
196
- * @param sourcePath, targetPath
197
- * @returns string: new cid of the root
209
+ /**
210
+ * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
211
+ * @param sourcePath, targetPath
212
+ * @returns string: new cid of the root
198
213
  */
199
214
  exports.rm = rm;
200
215
  const cp = (sourcePath, targetPath) => {
201
216
  return _fulaNativeModule.default.cp(sourcePath, targetPath);
202
217
  };
203
218
 
204
- /**
205
- * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
206
- * @param sourcePath, targetPath
207
- * @returns string: new cid of the root
219
+ /**
220
+ * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
221
+ * @param sourcePath, targetPath
222
+ * @returns string: new cid of the root
208
223
  */
209
224
  exports.cp = cp;
210
225
  const mv = (sourcePath, targetPath) => {
211
226
  return _fulaNativeModule.default.mv(sourcePath, targetPath);
212
227
  };
213
228
 
214
- /*
215
- // reads content of the file form localFilename (should include full absolute path to local file with read permission
216
- // writes content to the specified location by fulaTargetFilename in Fula filesystem
217
- // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
218
- // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
219
- // Returns: new cid of the root after this file is placed in the tree
229
+ /*
230
+ // reads content of the file form localFilename (should include full absolute path to local file with read permission
231
+ // writes content to the specified location by fulaTargetFilename in Fula filesystem
232
+ // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
233
+ // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
234
+ // Returns: new cid of the root after this file is placed in the tree
220
235
  */
221
236
  exports.mv = mv;
222
237
  const readFile = (fulaTargetFilename, localFilename) => {
223
238
  return _fulaNativeModule.default.readFile(fulaTargetFilename, localFilename);
224
239
  };
225
240
 
226
- /**
227
- * readFile reads content of a given path
228
- * @param path
229
- * @returns string: cotent
241
+ /**
242
+ * readFile reads content of a given path
243
+ * @param path
244
+ * @returns string: cotent
230
245
  */
231
246
  exports.readFile = readFile;
232
247
  const readFileContent = path => {
233
248
  return _fulaNativeModule.default.readFileContent(path);
234
249
  };
235
250
 
236
- /**
237
- * Shutdown closes all resources used by Client.
238
- // After calling this function Client must be discarded.
239
- * @param
240
- * @returns
251
+ /**
252
+ * Shutdown closes all resources used by Client.
253
+ // After calling this function Client must be discarded.
254
+ * @param
255
+ * @returns
241
256
  */
242
257
  exports.readFileContent = readFileContent;
243
258
  const shutdown = () => {
244
259
  return _fulaNativeModule.default.shutdown();
245
260
  };
246
261
 
247
- /**
248
- * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.
249
- * This can only be called on a peer that is added as an owner of blox by --authorizer parameter
250
- * @param peerId, allow
251
- * @returns boolean: true if successful or false if not
262
+ /**
263
+ * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.
264
+ * This can only be called on a peer that is added as an owner of blox by --authorizer parameter
265
+ * @param peerId, allow
266
+ * @returns boolean: true if successful or false if not
252
267
  */
253
268
  exports.shutdown = shutdown;
254
269
  const setAuth = (peerId, allow) => {
255
270
  return _fulaNativeModule.default.setAuth(peerId, allow);
256
271
  };
257
272
 
258
- /**
259
- * isReady checks if the connection is ready to be used.
260
- * @param filesystemCheck: also check if the wnfs is ready
261
- * @returns boolean: true if ready or false if not
273
+ /**
274
+ * isReady checks if the connection is ready to be used.
275
+ * @param filesystemCheck: also check if the wnfs is ready
276
+ * @returns boolean: true if ready or false if not
262
277
  */
263
278
  exports.setAuth = setAuth;
264
279
  const isReady = function () {
@@ -1 +1 @@
1
- {"version":3,"names":["init","identity","storePath","bloxAddr","exchange","autoFlush","rootCid","useRelay","refresh","console","log","Fula","newClient","logout","checkFailedActions","retry","timeout","checkConnection","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","then","res","lsResult","lsRows","split","element","rowItems","item","name","created","modified","jsonRes","JSON","parse","stringify","catch","e","rm","cp","sourcePath","targetPath","mv","readFile","readFileContent","shutdown","setAuth","peerId","allow","isReady","filesystemCheck"],"sources":["fula.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\n\r\n/**\r\n * Get gets the value corresponding to the given key from the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param config\r\n * @returns boolean\r\n */\r\n\r\nexport const init = (\r\n identity: string, //privateKey of did identity\r\n storePath: string,\r\n bloxAddr: string,\r\n exchange: string,\r\n autoFlush: boolean = false,\r\n rootCid: string | null = null,\r\n useRelay: boolean = true,\r\n refresh: boolean = false\r\n): Promise<{ peerId: string; rootCid: string; private_ref: string }> => {\r\n console.log(\r\n 'init in react-native started',\r\n identity,\r\n storePath,\r\n bloxAddr,\r\n exchange,\r\n autoFlush,\r\n useRelay\r\n );\r\n return Fula.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);\r\n};\r\n\r\n/**\r\n * Get gets the value corresponding to the given key from the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param config\r\n * @returns boolean\r\n */\r\n\r\nexport const newClient = (\r\n identity: string, //privateKey of did identity\r\n storePath: string,\r\n bloxAddr: string,\r\n exchange: string,\r\n autoFlush: boolean = false,\r\n useRelay: boolean = true,\r\n refresh: boolean = false\r\n): Promise<string> => {\r\n console.log(\r\n 'newClient in react-native started',\r\n identity,\r\n storePath,\r\n bloxAddr,\r\n exchange,\r\n autoFlush,\r\n useRelay,\r\n refresh\r\n );\r\n return Fula.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);\r\n};\r\n\r\n/**\r\n * rm removes all data\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const logout = (\r\n identity: string,\r\n storePath: string\r\n): Promise<boolean> => {\r\n return Fula.logout(identity, storePath);\r\n};\r\n\r\n/**\r\n * Checks if there are any un-synced changes on the device\r\n */\r\nexport const checkFailedActions = (\r\n retry: boolean = false,\r\n timeout: number = 20\r\n): Promise<boolean> => {\r\n return Fula.checkFailedActions(retry, timeout);\r\n};\r\n\r\n/**\r\n * Checks if there are any un-synced changes on the device\r\n */\r\nexport const checkConnection = (timeout: number = 20): Promise<boolean> => {\r\n return Fula.checkConnection(timeout);\r\n};\r\n\r\n/**\r\n * Get gets the value corresponding to the given key from the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param key\r\n * @returns value\r\n */\r\nexport const get = (key: string): Promise<string> => {\r\n return Fula.get(key);\r\n};\r\n\r\n/**\r\n * Has checks whether the value corresponding to the given key is present in the local datastore.\r\n// The key must be a valid ipld.Link.\r\n * @param key\r\n * @returns boolean\r\n */\r\nexport const has = (key: Uint8Array): Promise<boolean> => {\r\n return Fula.has(key);\r\n};\r\n\r\n/**\r\n * Push requests the given addr to download the root cid from this node.\r\n// The addr must be a valid multiaddr that includes peer ID.\r\n// this function.\r\n * @param addr\r\n * @returns null or error\r\n */\r\nexport const push = (): Promise<string> => {\r\n return Fula.push();\r\n};\r\n\r\n/**\r\n * Put stores the given key value onto the local datastore.\r\n// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding\r\n// to the given key.\r\n * @param key, value\r\n * @returns null or string\r\n */\r\nexport const put = (value: string, codec: string): Promise<string> => {\r\n return Fula.put(value, codec);\r\n};\r\n\r\n/**\r\n * mkdir creates a directory at the given path.\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const mkdir = (path: string): Promise<string> => {\r\n return Fula.mkdir(path);\r\n};\r\n\r\n/**\r\n * writeFileContent writes content at a given path\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const writeFileContent = (\r\n path: string,\r\n content: string\r\n): Promise<string> => {\r\n return Fula.writeFileContent(path, content);\r\n};\r\n\r\n/*\r\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\r\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\r\n // It keeps the original file modiifcation date\r\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\r\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\r\n // Returns: new cid of the root after this file is placed in the tree\r\n */\r\nexport const writeFile = (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n): Promise<string> => {\r\n return Fula.writeFile(fulaTargetFilename, localFilename);\r\n};\r\n\r\n/**\r\n * ls lists the name of files and folders at a given path\r\n * @param path\r\n * @returns string: list of items\r\n * TODO: Findout how is the string and convert to array\r\n */\r\nexport const ls = (path: string): Promise<void | JSON> => {\r\n return Fula.ls(path)\r\n .then((res) => {\r\n let lsResult = [];\r\n let lsRows = res.split('!!!');\r\n for (const element of lsRows) {\r\n let rowItems = element.split('???');\r\n if (rowItems && rowItems[0]) {\r\n let item = {\r\n name: '',\r\n created: '',\r\n modified: '',\r\n };\r\n item.name = rowItems[0];\r\n if (rowItems[1]) {\r\n item.created = rowItems[1];\r\n }\r\n if (rowItems[2]) {\r\n item.modified = rowItems[2];\r\n }\r\n lsResult.push(item);\r\n }\r\n }\r\n let jsonRes = JSON.parse(JSON.stringify(lsResult));\r\n return jsonRes;\r\n })\r\n .catch((e) => {\r\n return e;\r\n });\r\n};\r\n\r\n/**\r\n * rm removes all files and folders at a given path\r\n * @param path\r\n * @returns string: new cid of the root\r\n */\r\nexport const rm = (path: string): Promise<string> => {\r\n return Fula.rm(path);\r\n};\r\n\r\n/**\r\n * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\r\n * @param sourcePath, targetPath\r\n * @returns string: new cid of the root\r\n */\r\nexport const cp = (sourcePath: string, targetPath: string): Promise<string> => {\r\n return Fula.cp(sourcePath, targetPath);\r\n};\r\n\r\n/**\r\n * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\r\n * @param sourcePath, targetPath\r\n * @returns string: new cid of the root\r\n */\r\nexport const mv = (sourcePath: string, targetPath: string): Promise<string> => {\r\n return Fula.mv(sourcePath, targetPath);\r\n};\r\n\r\n/*\r\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\r\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\r\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\r\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\r\n // Returns: new cid of the root after this file is placed in the tree\r\n */\r\nexport const readFile = (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n): Promise<string> => {\r\n return Fula.readFile(fulaTargetFilename, localFilename);\r\n};\r\n\r\n/**\r\n * readFile reads content of a given path\r\n * @param path\r\n * @returns string: cotent\r\n */\r\nexport const readFileContent = (path: string): Promise<string> => {\r\n return Fula.readFileContent(path);\r\n};\r\n\r\n/**\r\n * Shutdown closes all resources used by Client.\r\n// After calling this function Client must be discarded.\r\n * @param\r\n * @returns\r\n */\r\nexport const shutdown = (): Promise<void> => {\r\n return Fula.shutdown();\r\n};\r\n\r\n/**\r\n * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.\r\n * This can only be called on a peer that is added as an owner of blox by --authorizer parameter\r\n * @param peerId, allow\r\n * @returns boolean: true if successful or false if not\r\n */\r\nexport const setAuth = (\r\n peerId: string,\r\n allow: boolean\r\n): Promise<boolean> => {\r\n return Fula.setAuth(peerId, allow);\r\n};\r\n\r\n\r\n/**\r\n * isReady checks if the connection is ready to be used.\r\n * @param filesystemCheck: also check if the wnfs is ready\r\n * @returns boolean: true if ready or false if not\r\n */\r\nexport const isReady = (filesystemCheck: boolean = true): Promise<boolean> => {\r\n return Fula.isReady(filesystemCheck);\r\n};\r\n"],"mappings":";;;;;;AAAA;AAAkD;AAElD;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,IAAI,GAAG,UAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAKsD;EAAA,IAJtEC,SAAkB,uEAAG,KAAK;EAAA,IAC1BC,OAAsB,uEAAG,IAAI;EAAA,IAC7BC,QAAiB,uEAAG,IAAI;EAAA,IACxBC,OAAgB,uEAAG,KAAK;EAExBC,OAAO,CAACC,GAAG,CACT,8BAA8B,EAC9BT,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTE,QAAQ,CACT;EACD,OAAOI,yBAAI,CAACX,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AAClG,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAOO,MAAMI,SAAS,GAAG,UACvBX,QAAgB,EAChBC,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CAACzB,kBAAkB,EAAEC,aAAa,CAAC;AACzD,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMyB,eAAe,GAAI9B,IAAY,IAAsB;EAChE,OAAOf,yBAAI,CAAC6C,eAAe,CAAC9B,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAM+B,QAAQ,GAAG,MAAqB;EAC3C,OAAO9C,yBAAI,CAAC8C,QAAQ,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMC,OAAO,GAAG,CACrBC,MAAc,EACdC,KAAc,KACO;EACrB,OAAOjD,yBAAI,CAAC+C,OAAO,CAACC,MAAM,EAAEC,KAAK,CAAC;AACpC,CAAC;;AAGD;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,OAAO,GAAG,YAAuD;EAAA,IAAtDC,eAAwB,uEAAG,IAAI;EACrD,OAAOnD,yBAAI,CAACkD,OAAO,CAACC,eAAe,CAAC;AACtC,CAAC;AAAC"}
1
+ {"version":3,"names":["init","identity","storePath","bloxAddr","exchange","autoFlush","rootCid","useRelay","refresh","console","log","Fula","newClient","logout","checkFailedActions","retry","timeout","listFailedActions","cids","checkConnection","get","key","has","push","testData","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","then","res","lsResult","lsRows","split","element","rowItems","item","name","created","modified","jsonRes","JSON","parse","stringify","catch","e","rm","cp","sourcePath","targetPath","mv","readFile","readFileContent","shutdown","setAuth","peerId","allow","isReady","filesystemCheck"],"sources":["fula.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\n\n/**\n * Get gets the value corresponding to the given key from the local datastore.\n// The key must be a valid ipld.Link.\n * @param config\n * @returns boolean\n */\n\nexport const init = (\n identity: string, //privateKey of did identity\n storePath: string,\n bloxAddr: string,\n exchange: string,\n autoFlush: boolean = false,\n rootCid: string | null = null,\n useRelay: boolean = true,\n refresh: boolean = false\n): Promise<{ peerId: string; rootCid: string; private_ref: string }> => {\n console.log(\n 'init in react-native started',\n identity,\n storePath,\n bloxAddr,\n exchange,\n autoFlush,\n useRelay\n );\n return Fula.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);\n};\n\n/**\n * Get gets the value corresponding to the given key from the local datastore.\n// The key must be a valid ipld.Link.\n * @param config\n * @returns boolean\n */\n\nexport const newClient = (\n identity: string, //privateKey of did identity\n storePath: string,\n bloxAddr: string,\n exchange: string,\n autoFlush: boolean = false,\n useRelay: boolean = true,\n refresh: boolean = false\n): Promise<string> => {\n console.log(\n 'newClient in react-native started',\n identity,\n storePath,\n bloxAddr,\n exchange,\n autoFlush,\n useRelay,\n refresh\n );\n return Fula.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);\n};\n\n/**\n * rm removes all data\n * @param path\n * @returns string: new cid of the root\n */\nexport const logout = (\n identity: string,\n storePath: string\n): Promise<boolean> => {\n return Fula.logout(identity, storePath);\n};\n\n/**\n * Checks if there are any un-synced changes on the device\n */\nexport const checkFailedActions = (\n retry: boolean = false,\n timeout: number = 20\n): Promise<boolean> => {\n return Fula.checkFailedActions(retry, timeout);\n};\n\n/**\n * Lists the cids that failed to be sent to backend and are kept only locally\n */\nexport const listFailedActions = (cids: string[] = []): Promise<string[]> => {\n return Fula.listFailedActions(cids);\n};\n\n/**\n * Checks if there are any un-synced changes on the device\n */\nexport const checkConnection = (timeout: number = 20): Promise<boolean> => {\n return Fula.checkConnection(timeout);\n};\n\n/**\n * Get gets the value corresponding to the given key from the local datastore.\n// The key must be a valid ipld.Link.\n * @param key\n * @returns value\n */\nexport const get = (key: string): Promise<string> => {\n return Fula.get(key);\n};\n\n/**\n * Has checks whether the value corresponding to the given key is present in the local datastore.\n// The key must be a valid ipld.Link.\n * @param key\n * @returns boolean\n */\nexport const has = (key: Uint8Array): Promise<boolean> => {\n return Fula.has(key);\n};\n\n/**\n * Push requests the given addr to download the root cid from this node.\n// The addr must be a valid multiaddr that includes peer ID.\n// this function.\n * @param addr\n * @returns null or error\n */\nexport const push = (): Promise<string> => {\n return Fula.push();\n};\n\n//This method sends some test data to backedn\nexport const testData = (\n identity: string,\n bloxAddr: string\n): Promise<string> => {\n return Fula.testData(identity, bloxAddr);\n};\n\n/**\n * Put stores the given key value onto the local datastore.\n// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding\n// to the given key.\n * @param key, value\n * @returns null or string\n */\nexport const put = (value: string, codec: string): Promise<string> => {\n return Fula.put(value, codec);\n};\n\n/**\n * mkdir creates a directory at the given path.\n * @param path\n * @returns string: new cid of the root\n */\nexport const mkdir = (path: string): Promise<string> => {\n return Fula.mkdir(path);\n};\n\n/**\n * writeFileContent writes content at a given path\n * @param path\n * @returns string: new cid of the root\n */\nexport const writeFileContent = (\n path: string,\n content: string\n): Promise<string> => {\n return Fula.writeFileContent(path, content);\n};\n\n/*\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\n // It keeps the original file modiifcation date\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\n // Returns: new cid of the root after this file is placed in the tree\n */\nexport const writeFile = (\n fulaTargetFilename: string,\n localFilename: string\n): Promise<string> => {\n return Fula.writeFile(fulaTargetFilename, localFilename);\n};\n\n/**\n * ls lists the name of files and folders at a given path\n * @param path\n * @returns string: list of items\n * TODO: Findout how is the string and convert to array\n */\nexport const ls = (path: string): Promise<void | JSON> => {\n return Fula.ls(path)\n .then((res) => {\n let lsResult = [];\n let lsRows = res.split('!!!');\n for (const element of lsRows) {\n let rowItems = element.split('???');\n if (rowItems && rowItems[0]) {\n let item = {\n name: '',\n created: '',\n modified: '',\n };\n item.name = rowItems[0];\n if (rowItems[1]) {\n item.created = rowItems[1];\n }\n if (rowItems[2]) {\n item.modified = rowItems[2];\n }\n lsResult.push(item);\n }\n }\n let jsonRes = JSON.parse(JSON.stringify(lsResult));\n return jsonRes;\n })\n .catch((e) => {\n return e;\n });\n};\n\n/**\n * rm removes all files and folders at a given path\n * @param path\n * @returns string: new cid of the root\n */\nexport const rm = (path: string): Promise<string> => {\n return Fula.rm(path);\n};\n\n/**\n * cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\n * @param sourcePath, targetPath\n * @returns string: new cid of the root\n */\nexport const cp = (sourcePath: string, targetPath: string): Promise<string> => {\n return Fula.cp(sourcePath, targetPath);\n};\n\n/**\n * mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already\n * @param sourcePath, targetPath\n * @returns string: new cid of the root\n */\nexport const mv = (sourcePath: string, targetPath: string): Promise<string> => {\n return Fula.mv(sourcePath, targetPath);\n};\n\n/*\n // reads content of the file form localFilename (should include full absolute path to local file with read permission\n // writes content to the specified location by fulaTargetFilename in Fula filesystem\n // fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)\n // localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)\n // Returns: new cid of the root after this file is placed in the tree\n */\nexport const readFile = (\n fulaTargetFilename: string,\n localFilename: string\n): Promise<string> => {\n return Fula.readFile(fulaTargetFilename, localFilename);\n};\n\n/**\n * readFile reads content of a given path\n * @param path\n * @returns string: cotent\n */\nexport const readFileContent = (path: string): Promise<string> => {\n return Fula.readFileContent(path);\n};\n\n/**\n * Shutdown closes all resources used by Client.\n// After calling this function Client must be discarded.\n * @param\n * @returns\n */\nexport const shutdown = (): Promise<void> => {\n return Fula.shutdown();\n};\n\n/**\n * setAuth adds or removes a peer from the list of peers that are allowed to push to this node.\n * This can only be called on a peer that is added as an owner of blox by --authorizer parameter\n * @param peerId, allow\n * @returns boolean: true if successful or false if not\n */\nexport const setAuth = (\n peerId: string,\n allow: boolean\n): Promise<boolean> => {\n return Fula.setAuth(peerId, allow);\n};\n\n\n/**\n * isReady checks if the connection is ready to be used.\n * @param filesystemCheck: also check if the wnfs is ready\n * @returns boolean: true if ready or false if not\n */\nexport const isReady = (filesystemCheck: boolean = true): Promise<boolean> => {\n return Fula.isReady(filesystemCheck);\n};\n"],"mappings":";;;;;;AAAA;AAAkD;AAElD;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,IAAI,GAAG,UAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAKsD;EAAA,IAJtEC,SAAkB,uEAAG,KAAK;EAAA,IAC1BC,OAAsB,uEAAG,IAAI;EAAA,IAC7BC,QAAiB,uEAAG,IAAI;EAAA,IACxBC,OAAgB,uEAAG,KAAK;EAExBC,OAAO,CAACC,GAAG,CACT,8BAA8B,EAC9BT,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTE,QAAQ,CACT;EACD,OAAOI,yBAAI,CAACX,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AAClG,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAOO,MAAMI,SAAS,GAAG,UACvBX,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAII;EAAA,IAHpBC,SAAkB,uEAAG,KAAK;EAAA,IAC1BE,QAAiB,uEAAG,IAAI;EAAA,IACxBC,OAAgB,uEAAG,KAAK;EAExBC,OAAO,CAACC,GAAG,CACT,mCAAmC,EACnCT,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTE,QAAQ,EACRC,OAAO,CACR;EACD,OAAOG,yBAAI,CAACC,SAAS,CAACX,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEE,QAAQ,EAAEC,OAAO,CAAC;AAC9F,CAAC;;AAED;AACA;AACA;AACA;A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ChE,OAAOlB,yBAAI,CAACgD,eAAe,CAAC9B,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAM+B,QAAQ,GAAG,MAAqB;EAC3C,OAAOjD,yBAAI,CAACiD,QAAQ,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMC,OAAO,GAAG,CACrBC,MAAc,EACdC,KAAc,KACO;EACrB,OAAOpD,yBAAI,CAACkD,OAAO,CAACC,MAAM,EAAEC,KAAK,CAAC;AACpC,CAAC;;AAGD;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,OAAO,GAAG,YAAuD;EAAA,IAAtDC,eAAwB,uEAAG,IAAI;EACrD,OAAOtD,yBAAI,CAACqD,OAAO,CAACC,eAAe,CAAC;AACtC,CAAC;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Fula","FulaModule","Proxy","get","Error"],"sources":["fulaNativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\r\n\r\ninterface FulaNativeModule {\r\n init: (\r\n identity: string, //Private key of did identity\r\n storePath: string, //You can leave empty\r\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\r\n exchange: string, //set to 'noope' for testing\r\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\r\n rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem\r\n useRelay: boolean | null, // if true it forces the use of relay\r\n refresh: boolean // if true it forces to refresh the fula object\r\n ) => Promise<{ peerId: string; rootCid: string; private_ref: string }>;\r\n newClient: (\r\n identity: string, //Private key of did identity\r\n storePath: string, //You can leave empty\r\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\r\n exchange: string, //set to 'noope' for testing\r\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\r\n useRelay: boolean | null, // if true it forces the use of relay\r\n refresh: boolean // if true it forces to refresh the fula object\r\n ) => Promise<string>;\r\n isReady: (filesystemCheck: boolean) => Promise<boolean>;\r\n logout: (identity: string, storePath: string) => Promise<boolean>;\r\n checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;\r\n checkConnection: (timeout: number) => Promise<boolean>;\r\n get: (key: string) => Promise<string>;\r\n has: (key: Uint8Array) => Promise<boolean>;\r\n push: () => Promise<string>;\r\n put: (content: string, codec: string) => Promise<string>;\r\n mkdir: (path: string) => Promise<string>;\r\n writeFileContent: (path: string, content: string) => Promise<string>;\r\n writeFile: (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n ) => Promise<string>;\r\n ls: (path: string) => Promise<string>;\r\n rm: (path: string) => Promise<string>;\r\n cp: (sourcePath: string, targetPath: string) => Promise<string>;\r\n mv: (sourcePath: string, targetPath: string) => Promise<string>;\r\n readFile: (\r\n fulaTargetFilename: string,\r\n localFilename: string\r\n ) => Promise<string>;\r\n readFileContent: (path: string) => Promise<string>;\r\n setAuth: (peerId: string, allow: boolean) => Promise<boolean>;\r\n\r\n shutdown: () => Promise<void>;\r\n\r\n //Blockchain related functions\r\n createAccount: (seed: string) => Promise<string>;\r\n checkAccountExists: (account: string) => Promise<string>;\r\n createPool: (seed: string, poolName: string) => Promise<string>;\r\n listPools: () => Promise<string>;\r\n joinPool: (seed: string, poolID: number) => Promise<string>;\r\n leavePool: (seed: string, poolID: number) => Promise<string>;\r\n cancelPoolJoin: (seed: string, poolID: number) => Promise<string>;\r\n listPoolJoinRequests: (poolID: number) => Promise<string>;\r\n votePoolJoinRequest: (\r\n seed: string,\r\n poolID: number,\r\n account: string,\r\n accept: boolean\r\n ) => Promise<string>;\r\n newReplicationRequest: (\r\n seed: string,\r\n poolID: number,\r\n replicationFactor: number,\r\n cid: string\r\n ) => Promise<string>;\r\n newStoreRequest: (\r\n seed: string,\r\n poolID: number,\r\n uploader: string,\r\n cid: string\r\n ) => Promise<string>;\r\n listAvailableReplicationRequests: (poolID: number) => Promise<string>;\r\n removeReplicationRequest: (\r\n seed: string,\r\n poolID: number,\r\n cid: string\r\n ) => Promise<string>;\r\n removeStorer: (\r\n seed: string,\r\n storer: string,\r\n poolID: number,\r\n cid: string\r\n ) => Promise<string>;\r\n removeStoredReplication: (\r\n seed: string,\r\n uploader: string,\r\n poolID: number,\r\n cid: string\r\n ) => Promise<string>;\r\n\r\n //Hardware\r\n bloxFreeSpace: () => Promise<string>;\r\n wifiRemoveall: () => Promise<string>;\r\n reboot: () => Promise<string>;\r\n}\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-fula/Fula' doesn't seem to be linked. Make sure: \\n\\n` +\r\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\r\n '- You rebuilt the app after installing the package\\n' +\r\n '- You are not using Expo managed workflow\\n';\r\n\r\nconst Fula = NativeModules.FulaModule\r\n ? NativeModules.FulaModule\r\n : new Proxy(\r\n {},\r\n {\r\n get() {\r\n throw new Error(LINKING_ERROR);\r\n },\r\n }\r\n );\r\n\r\nexport default Fula as FulaNativeModule;\r\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAqGtD,MAAMC,aAAa,GAChB,iFAAgF,GACjFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,IAAI,GAAGN,aAAa,CAACO,UAAU,GACjCP,aAAa,CAACO,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,eAAeI,IAAI"}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Fula","FulaModule","Proxy","get","Error"],"sources":["fulaNativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\ninterface FulaNativeModule {\n init: (\n identity: string, //Private key of did identity\n storePath: string, //You can leave empty\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\n exchange: string, //set to 'noope' for testing\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\n rootCid: string | null, //if you have the latest rootCid you can send it and it generates the private_ref for filesystem\n useRelay: boolean | null, // if true it forces the use of relay\n refresh: boolean // if true it forces to refresh the fula object\n ) => Promise<{ peerId: string; rootCid: string; private_ref: string }>;\n newClient: (\n identity: string, //Private key of did identity\n storePath: string, //You can leave empty\n bloxAddr: string, //Blox multiadddr needs to be manually entered now\n exchange: string, //set to 'noope' for testing\n autoFlush: boolean, //set to false always unless you know what you are doing. This is to write actions to disk explicitly after each write\n useRelay: boolean | null, // if true it forces the use of relay\n refresh: boolean // if true it forces to refresh the fula object\n ) => Promise<string>;\n isReady: (filesystemCheck: boolean) => Promise<boolean>;\n logout: (identity: string, storePath: string) => Promise<boolean>;\n checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;\n listFailedActions: (cids: string[]) => Promise<string[]>;\n checkConnection: (timeout: number) => Promise<boolean>;\n get: (key: string) => Promise<string>;\n has: (key: Uint8Array) => Promise<boolean>;\n push: () => Promise<string>;\n put: (content: string, codec: string) => Promise<string>;\n mkdir: (path: string) => Promise<string>;\n writeFileContent: (path: string, content: string) => Promise<string>;\n writeFile: (\n fulaTargetFilename: string,\n localFilename: string\n ) => Promise<string>;\n ls: (path: string) => Promise<string>;\n rm: (path: string) => Promise<string>;\n cp: (sourcePath: string, targetPath: string) => Promise<string>;\n mv: (sourcePath: string, targetPath: string) => Promise<string>;\n readFile: (\n fulaTargetFilename: string,\n localFilename: string\n ) => Promise<string>;\n readFileContent: (path: string) => Promise<string>;\n setAuth: (peerId: string, allow: boolean) => Promise<boolean>;\n\n shutdown: () => Promise<void>;\n\n testData: (identity: string, bloxAddr: string) => Promise<string>;\n\n //Blockchain related functions\n createAccount: (seed: string) => Promise<string>;\n checkAccountExists: (account: string) => Promise<string>;\n createPool: (seed: string, poolName: string) => Promise<string>;\n listPools: () => Promise<string>;\n joinPool: (seed: string, poolID: number) => Promise<string>;\n leavePool: (seed: string, poolID: number) => Promise<string>;\n cancelPoolJoin: (seed: string, poolID: number) => Promise<string>;\n listPoolJoinRequests: (poolID: number) => Promise<string>;\n votePoolJoinRequest: (\n seed: string,\n poolID: number,\n account: string,\n accept: boolean\n ) => Promise<string>;\n newReplicationRequest: (\n seed: string,\n poolID: number,\n replicationFactor: number,\n cid: string\n ) => Promise<string>;\n newStoreRequest: (\n seed: string,\n poolID: number,\n uploader: string,\n cid: string\n ) => Promise<string>;\n listAvailableReplicationRequests: (poolID: number) => Promise<string>;\n removeReplicationRequest: (\n seed: string,\n poolID: number,\n cid: string\n ) => Promise<string>;\n removeStorer: (\n seed: string,\n storer: string,\n poolID: number,\n cid: string\n ) => Promise<string>;\n removeStoredReplication: (\n seed: string,\n uploader: string,\n poolID: number,\n cid: string\n ) => Promise<string>;\n\n //Hardware\n bloxFreeSpace: () => Promise<string>;\n wifiRemoveall: () => Promise<string>;\n reboot: () => Promise<string>;\n}\n\nconst LINKING_ERROR =\n `The package 'react-native-fula/Fula' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Fula = NativeModules.FulaModule\n ? NativeModules.FulaModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport default Fula as FulaNativeModule;\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAwGtD,MAAMC,aAAa,GAChB,iFAAgF,GACjFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,IAAI,GAAGN,aAAa,CAACO,UAAU,GACjCP,aAAa,CAACO,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,eAAeI,IAAI"}