@functionland/react-native-fula 1.8.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.
- package/README.md +214 -205
- package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
- package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.6/checksums/checksums.lock +0 -0
- package/android/.gradle/7.6/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.6/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.6/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.6/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.6/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.6/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.6/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.idea/compiler.xml +1 -1
- package/android/.idea/gradle.xml +1 -0
- package/android/.idea/misc.xml +9 -9
- package/android/.idea/sonarlint/securityhotspotstore/index.pb +0 -0
- package/android/build.gradle +2 -1
- package/android/src/main/java/land/fx/fula/Cryptography.java +60 -60
- package/android/src/main/java/land/fx/fula/FulaModule.java +126 -17
- package/android/src/main/java/land/fx/fula/FulaPackage.java +32 -32
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/commonjs/protocols/blockchain.js +12 -12
- package/lib/commonjs/protocols/blockchain.js.map +1 -1
- package/lib/commonjs/protocols/fula.js +113 -98
- package/lib/commonjs/protocols/fula.js.map +1 -1
- package/lib/commonjs/protocols/fxblox.js +23 -4
- package/lib/commonjs/protocols/fxblox.js.map +1 -1
- package/lib/commonjs/types/fxblox.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/module/protocols/blockchain.js +12 -12
- package/lib/module/protocols/blockchain.js.map +1 -1
- package/lib/module/protocols/fula.js +109 -96
- package/lib/module/protocols/fula.js.map +1 -1
- package/lib/module/protocols/fxblox.js +21 -3
- package/lib/module/protocols/fxblox.js.map +1 -1
- package/lib/module/types/fxblox.js.map +1 -1
- package/lib/typescript/interfaces/fulaNativeModule.d.ts +3 -0
- package/lib/typescript/protocols/fula.d.ts +5 -0
- package/lib/typescript/protocols/fxblox.d.ts +1 -0
- package/lib/typescript/types/fxblox.d.ts +4 -0
- package/package.json +1 -1
- package/src/index.tsx +4 -4
- package/src/interfaces/fulaNativeModule.ts +43 -8
- package/src/protocols/blockchain.ts +318 -274
- package/src/protocols/fula.ts +301 -286
- package/src/protocols/fxblox.ts +49 -28
- package/src/types/fxblox.ts +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Fula","createAccount","seed","console","log","res","then","jsonRes","JSON","parse","e","catch","err","checkAccountExists","account","createPool","poolName","listPools","joinPool","poolID","leavePool","cancelPoolJoin","listPoolJoinRequests","votePoolJoinRequest","accept","newReplicationRequest","replicationFactor","cid","newStoreRequest","uploader","listAvailableReplicationRequests","removeReplicationRequest","removeStorer","storer","removeStoredReplication","bloxFreeSpace"],"sources":["blockchain.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\nimport type * as BType from '../types/blockchain';\r\n\r\n/*\r\ncreateAccount: This function takes a seed argument, which is used to create an account. The seed must start with \"/\". The function returns a promise of an object that contains the seed and the account that was created.\r\n*/\r\nexport const createAccount = (\r\n seed: string, //seed that is used to create the account. It must start with \"/\"\r\n): Promise<BType.SeededResponse> => {\r\n console.log(\r\n 'createAccount in react-native started',\r\n seed\r\n );\r\n let res = Fula.createAccount(seed).then((res) => {\r\n try{\r\n let jsonRes:BType.SeededResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res)\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\ncheckAccountExists: This function takes an account argument, and returns a promise of an object that contains the account and a boolean exists flag. If exists is true, it means the account exists, otherwise, the account does not exist\r\n*/\r\nexport const checkAccountExists = (\r\n account: string,\r\n): Promise<BType.AccountExistsResponse> => {\r\n console.log(\r\n 'checkAccountExists in react-native started',\r\n account\r\n );\r\n let res = Fula.checkAccountExists(account).then((res) => {\r\n try{\r\n let jsonRes: BType.AccountExistsResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res)\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\ncreatePool: This function takes two arguments: seed and poolName. The seed is used to identify the account that is creating the pool, and the poolName is the name of the pool being created. The function returns a promise of an object that contains the owner of the pool and the poolID of the created pool.\r\n*/\r\nexport const createPool = (seed: string, poolName: string): Promise<BType.PoolCreateResponse> => {\r\n console.log(\r\n 'createPool in react-native started',\r\n seed,\r\n poolName\r\n );\r\n let res = Fula.createPool(seed, poolName).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolCreateResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n \r\n /*\r\n listPools: This function takes no arguments and returns a promise of an object that contains a list of pools. Each pool in the list contains the poolID, owner, poolName, parent, and participants of the pool\r\n */\r\n export const listPools = (): Promise<BType.PoolListResponse> => {\r\n console.log(\r\n 'listPools in react-native started'\r\n );\r\n let res = Fula.listPools().then((res) => {\r\n try {\r\n let jsonRes: BType.PoolListResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n /*\r\n joinPool: This function takes two arguments: seed and poolID. The seed is used to identify the account that is joining the pool, and the poolID is the ID of the pool the account is joining. The function returns a promise of an object that contains the account joining the pool and the poolID of the joined pool.\r\n */\r\n\r\n export const joinPool = (seed: string, poolID: number): Promise<BType.PoolJoinResponse> => {\r\n console.log(\r\n 'joinPool in react-native started',\r\n seed,\r\n poolID\r\n );\r\n let res = Fula.joinPool(seed, poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolJoinResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n /*\r\n leavePool: This function takes two arguments: seed and poolID. The seed is used to identify the account that is leaving the pool, and the poolID is the ID of the pool the account is leaving. The function returns a promise of an object that contains the `\r\n */\r\n \r\n export const leavePool = (seed: string, poolID: number): Promise<BType.PoolLeaveResponse> => {\r\n console.log(\r\n 'leavePool in react-native started',\r\n seed,\r\n poolID\r\n );\r\n let res = Fula.leavePool(seed, poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolLeaveResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n export const cancelPoolJoin = (seed: string, poolID: number): Promise<BType.PoolCancelJoinResponse> => {\r\n console.log(\r\n 'cancelPoolJoin in react-native started',\r\n seed,\r\n poolID\r\n );\r\n let res = Fula.cancelPoolJoin(seed, poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolCancelJoinResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n export const listPoolJoinRequests = (poolID: number): Promise<BType.PoolRequestsResponse> => {\r\n console.log(\r\n 'listPoolJoinRequests in react-native started',\r\n poolID\r\n );\r\n let res = Fula.listPoolJoinRequests(poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolRequestsResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n\r\n /*\r\n seed is used to authorize the request.\r\npoolID is the ID of the pool in which the account is requesting to join.\r\naccount is the account that is requesting to join the pool.\r\naccept is a boolean value that indicates whether to accept or reject the join request.\r\nIt returns a promise of BType.PoolVoteResponse which includes the account and poolID\r\n*/\r\n export const votePoolJoinRequest = (seed: string, poolID: number, account: string, accept: boolean): Promise<BType.PoolVoteResponse> => {\r\n console.log(\r\n 'votePoolJoinRequest in react-native started',\r\n seed,\r\n poolID,\r\n account,\r\n accept\r\n );\r\n let res = Fula.votePoolJoinRequest(seed, poolID, account, accept).then((res) => {\r\n try {\r\n let jsonRes: BType.PoolVoteResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };\r\n \r\n\r\n /*\r\nIt takes four arguments:\r\n\r\nseed is used to authorize the request.\r\npoolID is the ID of the pool in which the replication request is made.\r\nreplicationFactor is the number of copies of the content to be stored.\r\ncid is the content identifier of the content to be replicated.\r\nIt returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID\r\n */\r\n export const newReplicationRequest = (seed: string, poolID: number, replicationFactor: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'newReplicationRequest in react-native started',\r\n seed,\r\n poolID,\r\n replicationFactor,\r\n cid\r\n );\r\n let res = Fula.newReplicationRequest(seed, poolID, replicationFactor, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is used to authorize the request.\r\npoolID is the ID of the pool in which the replication request is made.\r\nuploader is the account of the user making the request\r\ncid is the content identifier of the content to be stored.\r\nIt returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const newStoreRequest = (seed: string, poolID: number, uploader: string, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'newStoreRequest in react-native started',\r\n seed,\r\n poolID,\r\n uploader,\r\n cid\r\n );\r\n let res = Fula.newStoreRequest(seed, poolID, uploader, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n\r\n/*\r\nIt takes one argument:\r\n\r\npoolID is the ID of the pool for which the replication requests are listed\r\nIt returns a promise of BType.ManifestUploadResponse[] which is an array of the replication requests, including the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const listAvailableReplicationRequests = (poolID: number): Promise<BType.ManifestUploadResponse[]> => {\r\n console.log(\r\n 'listAvailableReplicationRequests in react-native started',\r\n poolID\r\n );\r\n let res = Fula.listAvailableReplicationRequests(poolID).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse[] = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n\r\n/*\r\nIt takes three arguments:\r\n\r\nseed is the seed of the account that is removing the replication request\r\npoolID is the ID of the pool for which the replication request is being removed\r\ncid is the content ID of the replication request being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the removed replication request, including the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const removeReplicationRequest = (seed: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeReplicationRequest in react-native started',\r\n seed,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeReplicationRequest(seed, poolID, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is the seed of the account that is removing the storer\r\nstorer is the address of the storer that is being removed\r\npoolID is the ID of the pool for which the storer is being removed\r\ncid is the content ID of the replication request for which the storer is being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the storer has been removed.\r\n*/\r\nexport const removeStorer = (seed: string, storer: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeStorer in react-native started',\r\n seed,\r\n storer,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeStorer(seed, storer, poolID, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is the seed of the account that is removing the stored replication\r\nuploader is the address of the uploader that is being removed\r\npoolID is the ID of the pool for which the stored replication is being removed\r\ncid is the content ID of the replication request for which the stored replication is being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the stored replication has been removed.\r\n*/\r\nexport const removeStoredReplication = (seed: string, uploader: string, poolID: number, cid: string): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeStoredReplication in react-native started',\r\n seed,\r\n uploader,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeStoredReplication(seed, uploader, poolID, cid).then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n /*\r\n bloxFreeSpace: This function takes no arguments and returns a promise of an object that contains the blox free space information.\r\n */\r\n export const bloxFreeSpace = (): Promise<BType.BloxFreeSpaceResponse> => {\r\n console.log(\r\n 'bloxFreeSpace in react-native started'\r\n );\r\n let res = Fula.bloxFreeSpace().then((res) => {\r\n try {\r\n let jsonRes: BType.BloxFreeSpaceResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n }).catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n };"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;AAGjD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,CAC3BC,IAAY,CAAE;AAAA,KACoB;EAClCC,OAAO,CAACC,GAAG,CACT,uCAAuC,EACvCF,IAAI,CACL;EACD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;EACvEhC,OAAO,CAACC,GAAG,CACX,uCAAuC,CACtC;EACD,IAAIC,GAAG,GAAGL,IAAI,CAACmC,aAAa,EAAE,CAAC7B,IAAI,CAAED,GAAG,IAAK;IAC7C,IAAI;MACJ,IAAIE,OAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MAC1D,OAAOE,OAAO;IACd,CAAC,CAAC,OAAOG,CAAC,EAAE;MACZ,IAAI;QACJ,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACtB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACZ,OAAOL,GAAG;MACV;IACA;EACA,CAAC,CAAC,CAACM,KAAK,CAAEC,GAAG,IAAK;IAClB,OAAOA,GAAG;EACV,CAAC,CAAC;EACF,OAAOP,GAAG;AACV,CAAC"}
|
|
1
|
+
{"version":3,"names":["Fula","createAccount","seed","console","log","res","then","jsonRes","JSON","parse","e","catch","err","checkAccountExists","account","createPool","poolName","listPools","joinPool","poolID","leavePool","cancelPoolJoin","listPoolJoinRequests","votePoolJoinRequest","accept","newReplicationRequest","replicationFactor","cid","newStoreRequest","uploader","listAvailableReplicationRequests","removeReplicationRequest","removeStorer","storer","removeStoredReplication","bloxFreeSpace"],"sources":["blockchain.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\nimport type * as BType from '../types/blockchain';\r\n\r\n/*\r\ncreateAccount: This function takes a seed argument, which is used to create an account. The seed must start with \"/\". The function returns a promise of an object that contains the seed and the account that was created.\r\n*/\r\nexport const createAccount = (\r\n seed: string //seed that is used to create the account. It must start with \"/\"\r\n): Promise<BType.SeededResponse> => {\r\n console.log('createAccount in react-native started', seed);\r\n let res = Fula.createAccount(seed)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.SeededResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\ncheckAccountExists: This function takes an account argument, and returns a promise of an object that contains the account and a boolean exists flag. If exists is true, it means the account exists, otherwise, the account does not exist\r\n*/\r\nexport const checkAccountExists = (\r\n account: string\r\n): Promise<BType.AccountExistsResponse> => {\r\n console.log('checkAccountExists in react-native started', account);\r\n let res = Fula.checkAccountExists(account)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.AccountExistsResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\ncreatePool: This function takes two arguments: seed and poolName. The seed is used to identify the account that is creating the pool, and the poolName is the name of the pool being created. The function returns a promise of an object that contains the owner of the pool and the poolID of the created pool.\r\n*/\r\nexport const createPool = (\r\n seed: string,\r\n poolName: string\r\n): Promise<BType.PoolCreateResponse> => {\r\n console.log('createPool in react-native started', seed, poolName);\r\n let res = Fula.createPool(seed, poolName)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolCreateResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\n listPools: This function takes no arguments and returns a promise of an object that contains a list of pools. Each pool in the list contains the poolID, owner, poolName, parent, and participants of the pool\r\n */\r\nexport const listPools = (): Promise<BType.PoolListResponse> => {\r\n console.log('listPools in react-native started');\r\n let res = Fula.listPools()\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolListResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\n joinPool: This function takes two arguments: seed and poolID. The seed is used to identify the account that is joining the pool, and the poolID is the ID of the pool the account is joining. The function returns a promise of an object that contains the account joining the pool and the poolID of the joined pool.\r\n */\r\n\r\nexport const joinPool = (\r\n seed: string,\r\n poolID: number\r\n): Promise<BType.PoolJoinResponse> => {\r\n console.log('joinPool in react-native started', seed, poolID);\r\n let res = Fula.joinPool(seed, poolID)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolJoinResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\n leavePool: This function takes two arguments: seed and poolID. The seed is used to identify the account that is leaving the pool, and the poolID is the ID of the pool the account is leaving. The function returns a promise of an object that contains the `\r\n */\r\n\r\nexport const leavePool = (\r\n seed: string,\r\n poolID: number\r\n): Promise<BType.PoolLeaveResponse> => {\r\n console.log('leavePool in react-native started', seed, poolID);\r\n let res = Fula.leavePool(seed, poolID)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolLeaveResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\nexport const cancelPoolJoin = (\r\n seed: string,\r\n poolID: number\r\n): Promise<BType.PoolCancelJoinResponse> => {\r\n console.log('cancelPoolJoin in react-native started', seed, poolID);\r\n let res = Fula.cancelPoolJoin(seed, poolID)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolCancelJoinResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\nexport const listPoolJoinRequests = (\r\n poolID: number\r\n): Promise<BType.PoolRequestsResponse> => {\r\n console.log('listPoolJoinRequests in react-native started', poolID);\r\n let res = Fula.listPoolJoinRequests(poolID)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolRequestsResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\n seed is used to authorize the request.\r\npoolID is the ID of the pool in which the account is requesting to join.\r\naccount is the account that is requesting to join the pool.\r\naccept is a boolean value that indicates whether to accept or reject the join request.\r\nIt returns a promise of BType.PoolVoteResponse which includes the account and poolID\r\n*/\r\nexport const votePoolJoinRequest = (\r\n seed: string,\r\n poolID: number,\r\n account: string,\r\n accept: boolean\r\n): Promise<BType.PoolVoteResponse> => {\r\n console.log(\r\n 'votePoolJoinRequest in react-native started',\r\n seed,\r\n poolID,\r\n account,\r\n accept\r\n );\r\n let res = Fula.votePoolJoinRequest(seed, poolID, account, accept)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.PoolVoteResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is used to authorize the request.\r\npoolID is the ID of the pool in which the replication request is made.\r\nreplicationFactor is the number of copies of the content to be stored.\r\ncid is the content identifier of the content to be replicated.\r\nIt returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID\r\n */\r\nexport const newReplicationRequest = (\r\n seed: string,\r\n poolID: number,\r\n replicationFactor: number,\r\n cid: string\r\n): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'newReplicationRequest in react-native started',\r\n seed,\r\n poolID,\r\n replicationFactor,\r\n cid\r\n );\r\n let res = Fula.newReplicationRequest(seed, poolID, replicationFactor, cid)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is used to authorize the request.\r\npoolID is the ID of the pool in which the replication request is made.\r\nuploader is the account of the user making the request\r\ncid is the content identifier of the content to be stored.\r\nIt returns a promise of BType.ManifestUploadResponse which includes the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const newStoreRequest = (\r\n seed: string,\r\n poolID: number,\r\n uploader: string,\r\n cid: string\r\n): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'newStoreRequest in react-native started',\r\n seed,\r\n poolID,\r\n uploader,\r\n cid\r\n );\r\n let res = Fula.newStoreRequest(seed, poolID, uploader, cid)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes one argument:\r\n\r\npoolID is the ID of the pool for which the replication requests are listed\r\nIt returns a promise of BType.ManifestUploadResponse[] which is an array of the replication requests, including the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const listAvailableReplicationRequests = (\r\n poolID: number\r\n): Promise<BType.ManifestUploadResponse[]> => {\r\n console.log(\r\n 'listAvailableReplicationRequests in react-native started',\r\n poolID\r\n );\r\n let res = Fula.listAvailableReplicationRequests(poolID)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse[] = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes three arguments:\r\n\r\nseed is the seed of the account that is removing the replication request\r\npoolID is the ID of the pool for which the replication request is being removed\r\ncid is the content ID of the replication request being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the removed replication request, including the uploader, storage, ManifestMetadata, and poolID\r\n*/\r\nexport const removeReplicationRequest = (\r\n seed: string,\r\n poolID: number,\r\n cid: string\r\n): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeReplicationRequest in react-native started',\r\n seed,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeReplicationRequest(seed, poolID, cid)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is the seed of the account that is removing the storer\r\nstorer is the address of the storer that is being removed\r\npoolID is the ID of the pool for which the storer is being removed\r\ncid is the content ID of the replication request for which the storer is being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the storer has been removed.\r\n*/\r\nexport const removeStorer = (\r\n seed: string,\r\n storer: string,\r\n poolID: number,\r\n cid: string\r\n): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeStorer in react-native started',\r\n seed,\r\n storer,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeStorer(seed, storer, poolID, cid)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\nIt takes four arguments:\r\n\r\nseed is the seed of the account that is removing the stored replication\r\nuploader is the address of the uploader that is being removed\r\npoolID is the ID of the pool for which the stored replication is being removed\r\ncid is the content ID of the replication request for which the stored replication is being removed\r\nIt returns a promise of BType.ManifestUploadResponse which is the replication request, including the uploader, storage, ManifestMetadata, and poolID after the stored replication has been removed.\r\n*/\r\nexport const removeStoredReplication = (\r\n seed: string,\r\n uploader: string,\r\n poolID: number,\r\n cid: string\r\n): Promise<BType.ManifestUploadResponse> => {\r\n console.log(\r\n 'removeStoredReplication in react-native started',\r\n seed,\r\n uploader,\r\n poolID,\r\n cid\r\n );\r\n let res = Fula.removeStoredReplication(seed, uploader, poolID, cid)\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.ManifestUploadResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\n/*\r\n bloxFreeSpace: This function takes no arguments and returns a promise of an object that contains the blox free space information.\r\n */\r\nexport const bloxFreeSpace = (): Promise<BType.BloxFreeSpaceResponse> => {\r\n console.log('bloxFreeSpace in react-native started');\r\n let res = Fula.bloxFreeSpace()\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.BloxFreeSpaceResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;AAGjD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACxBC,IAAY,IACsB;EAClCC,OAAO,CAACC,GAAG,CAAC,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;AACA,OAAO,MAAM8B,aAAa,GAAG,MAA4C;EACvEhC,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;EACpD,IAAIC,GAAG,GAAGL,IAAI,CAACmC,aAAa,EAAE,CAC3B7B,IAAI,CAAED,GAAG,IAAK;IACb,IAAI;MACF,IAAIE,OAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MAC1D,OAAOE,OAAO;IAChB,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAI;QACF,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACxB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACV,OAAOL,GAAG;MACZ;IACF;EACF,CAAC,CAAC,CACDM,KAAK,CAAEC,GAAG,IAAK;IACd,OAAOA,GAAG;EACZ,CAAC,CAAC;EACJ,OAAOP,GAAG;AACZ,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Fula from '../interfaces/fulaNativeModule';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Get gets the value corresponding to the given key from the local datastore.
|
|
5
|
-
// The key must be a valid ipld.Link.
|
|
6
|
-
* @param config
|
|
7
|
-
* @returns boolean
|
|
3
|
+
/**
|
|
4
|
+
* Get gets the value corresponding to the given key from the local datastore.
|
|
5
|
+
// The key must be a valid ipld.Link.
|
|
6
|
+
* @param config
|
|
7
|
+
* @returns boolean
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export const init = function (identity, storePath, bloxAddr, exchange) {
|
|
@@ -16,11 +16,11 @@ export const init = function (identity, storePath, bloxAddr, exchange) {
|
|
|
16
16
|
return Fula.init(identity, storePath, bloxAddr, exchange, autoFlush, rootCid, useRelay, refresh);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Get gets the value corresponding to the given key from the local datastore.
|
|
21
|
-
// The key must be a valid ipld.Link.
|
|
22
|
-
* @param config
|
|
23
|
-
* @returns boolean
|
|
19
|
+
/**
|
|
20
|
+
* Get gets the value corresponding to the given key from the local datastore.
|
|
21
|
+
// The key must be a valid ipld.Link.
|
|
22
|
+
* @param config
|
|
23
|
+
* @returns boolean
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
export const newClient = function (identity, storePath, bloxAddr, exchange) {
|
|
@@ -31,17 +31,17 @@ export const newClient = function (identity, storePath, bloxAddr, exchange) {
|
|
|
31
31
|
return Fula.newClient(identity, storePath, bloxAddr, exchange, autoFlush, useRelay, refresh);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* rm removes all data
|
|
36
|
-
* @param path
|
|
37
|
-
* @returns string: new cid of the root
|
|
34
|
+
/**
|
|
35
|
+
* rm removes all data
|
|
36
|
+
* @param path
|
|
37
|
+
* @returns string: new cid of the root
|
|
38
38
|
*/
|
|
39
39
|
export const logout = (identity, storePath) => {
|
|
40
40
|
return Fula.logout(identity, storePath);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* Checks if there are any un-synced changes on the device
|
|
43
|
+
/**
|
|
44
|
+
* Checks if there are any un-synced changes on the device
|
|
45
45
|
*/
|
|
46
46
|
export const checkFailedActions = function () {
|
|
47
47
|
let retry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -49,91 +49,104 @@ export const checkFailedActions = function () {
|
|
|
49
49
|
return Fula.checkFailedActions(retry, timeout);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
52
|
+
/**
|
|
53
|
+
* Lists the cids that failed to be sent to backend and are kept only locally
|
|
54
|
+
*/
|
|
55
|
+
export const listFailedActions = function () {
|
|
56
|
+
let cids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
57
|
+
return Fula.listFailedActions(cids);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Checks if there are any un-synced changes on the device
|
|
54
62
|
*/
|
|
55
63
|
export const checkConnection = function () {
|
|
56
64
|
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
|
|
57
65
|
return Fula.checkConnection(timeout);
|
|
58
66
|
};
|
|
59
67
|
|
|
60
|
-
/**
|
|
61
|
-
* Get gets the value corresponding to the given key from the local datastore.
|
|
62
|
-
// The key must be a valid ipld.Link.
|
|
63
|
-
* @param key
|
|
64
|
-
* @returns value
|
|
68
|
+
/**
|
|
69
|
+
* Get gets the value corresponding to the given key from the local datastore.
|
|
70
|
+
// The key must be a valid ipld.Link.
|
|
71
|
+
* @param key
|
|
72
|
+
* @returns value
|
|
65
73
|
*/
|
|
66
74
|
export const get = key => {
|
|
67
75
|
return Fula.get(key);
|
|
68
76
|
};
|
|
69
77
|
|
|
70
|
-
/**
|
|
71
|
-
* Has checks whether the value corresponding to the given key is present in the local datastore.
|
|
72
|
-
// The key must be a valid ipld.Link.
|
|
73
|
-
* @param key
|
|
74
|
-
* @returns boolean
|
|
78
|
+
/**
|
|
79
|
+
* Has checks whether the value corresponding to the given key is present in the local datastore.
|
|
80
|
+
// The key must be a valid ipld.Link.
|
|
81
|
+
* @param key
|
|
82
|
+
* @returns boolean
|
|
75
83
|
*/
|
|
76
84
|
export const has = key => {
|
|
77
85
|
return Fula.has(key);
|
|
78
86
|
};
|
|
79
87
|
|
|
80
|
-
/**
|
|
81
|
-
* Push requests the given addr to download the root cid from this node.
|
|
82
|
-
// The addr must be a valid multiaddr that includes peer ID.
|
|
83
|
-
// this function.
|
|
84
|
-
* @param addr
|
|
85
|
-
* @returns null or error
|
|
88
|
+
/**
|
|
89
|
+
* Push requests the given addr to download the root cid from this node.
|
|
90
|
+
// The addr must be a valid multiaddr that includes peer ID.
|
|
91
|
+
// this function.
|
|
92
|
+
* @param addr
|
|
93
|
+
* @returns null or error
|
|
86
94
|
*/
|
|
87
95
|
export const push = () => {
|
|
88
96
|
return Fula.push();
|
|
89
97
|
};
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
99
|
+
//This method sends some test data to backedn
|
|
100
|
+
export const testData = (identity, bloxAddr) => {
|
|
101
|
+
return Fula.testData(identity, bloxAddr);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Put stores the given key value onto the local datastore.
|
|
106
|
+
// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
|
|
107
|
+
// to the given key.
|
|
108
|
+
* @param key, value
|
|
109
|
+
* @returns null or string
|
|
97
110
|
*/
|
|
98
111
|
export const put = (value, codec) => {
|
|
99
112
|
return Fula.put(value, codec);
|
|
100
113
|
};
|
|
101
114
|
|
|
102
|
-
/**
|
|
103
|
-
* mkdir creates a directory at the given path.
|
|
104
|
-
* @param path
|
|
105
|
-
* @returns string: new cid of the root
|
|
115
|
+
/**
|
|
116
|
+
* mkdir creates a directory at the given path.
|
|
117
|
+
* @param path
|
|
118
|
+
* @returns string: new cid of the root
|
|
106
119
|
*/
|
|
107
120
|
export const mkdir = path => {
|
|
108
121
|
return Fula.mkdir(path);
|
|
109
122
|
};
|
|
110
123
|
|
|
111
|
-
/**
|
|
112
|
-
* writeFileContent writes content at a given path
|
|
113
|
-
* @param path
|
|
114
|
-
* @returns string: new cid of the root
|
|
124
|
+
/**
|
|
125
|
+
* writeFileContent writes content at a given path
|
|
126
|
+
* @param path
|
|
127
|
+
* @returns string: new cid of the root
|
|
115
128
|
*/
|
|
116
129
|
export const writeFileContent = (path, content) => {
|
|
117
130
|
return Fula.writeFileContent(path, content);
|
|
118
131
|
};
|
|
119
132
|
|
|
120
|
-
/*
|
|
121
|
-
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
122
|
-
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
123
|
-
// It keeps the original file modiifcation date
|
|
124
|
-
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
125
|
-
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
126
|
-
// Returns: new cid of the root after this file is placed in the tree
|
|
133
|
+
/*
|
|
134
|
+
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
135
|
+
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
136
|
+
// It keeps the original file modiifcation date
|
|
137
|
+
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
138
|
+
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
139
|
+
// Returns: new cid of the root after this file is placed in the tree
|
|
127
140
|
*/
|
|
128
141
|
export const writeFile = (fulaTargetFilename, localFilename) => {
|
|
129
142
|
return Fula.writeFile(fulaTargetFilename, localFilename);
|
|
130
143
|
};
|
|
131
144
|
|
|
132
|
-
/**
|
|
133
|
-
* ls lists the name of files and folders at a given path
|
|
134
|
-
* @param path
|
|
135
|
-
* @returns string: list of items
|
|
136
|
-
* TODO: Findout how is the string and convert to array
|
|
145
|
+
/**
|
|
146
|
+
* ls lists the name of files and folders at a given path
|
|
147
|
+
* @param path
|
|
148
|
+
* @returns string: list of items
|
|
149
|
+
* TODO: Findout how is the string and convert to array
|
|
137
150
|
*/
|
|
138
151
|
export const ls = path => {
|
|
139
152
|
return Fula.ls(path).then(res => {
|
|
@@ -164,77 +177,77 @@ export const ls = path => {
|
|
|
164
177
|
});
|
|
165
178
|
};
|
|
166
179
|
|
|
167
|
-
/**
|
|
168
|
-
* rm removes all files and folders at a given path
|
|
169
|
-
* @param path
|
|
170
|
-
* @returns string: new cid of the root
|
|
180
|
+
/**
|
|
181
|
+
* rm removes all files and folders at a given path
|
|
182
|
+
* @param path
|
|
183
|
+
* @returns string: new cid of the root
|
|
171
184
|
*/
|
|
172
185
|
export const rm = path => {
|
|
173
186
|
return Fula.rm(path);
|
|
174
187
|
};
|
|
175
188
|
|
|
176
|
-
/**
|
|
177
|
-
* cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
|
|
178
|
-
* @param sourcePath, targetPath
|
|
179
|
-
* @returns string: new cid of the root
|
|
189
|
+
/**
|
|
190
|
+
* cp copies the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
|
|
191
|
+
* @param sourcePath, targetPath
|
|
192
|
+
* @returns string: new cid of the root
|
|
180
193
|
*/
|
|
181
194
|
export const cp = (sourcePath, targetPath) => {
|
|
182
195
|
return Fula.cp(sourcePath, targetPath);
|
|
183
196
|
};
|
|
184
197
|
|
|
185
|
-
/**
|
|
186
|
-
* mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
|
|
187
|
-
* @param sourcePath, targetPath
|
|
188
|
-
* @returns string: new cid of the root
|
|
198
|
+
/**
|
|
199
|
+
* mv moves the file or folder at the sourcePath to targetPath. targetPath is a folder that must exist already
|
|
200
|
+
* @param sourcePath, targetPath
|
|
201
|
+
* @returns string: new cid of the root
|
|
189
202
|
*/
|
|
190
203
|
export const mv = (sourcePath, targetPath) => {
|
|
191
204
|
return Fula.mv(sourcePath, targetPath);
|
|
192
205
|
};
|
|
193
206
|
|
|
194
|
-
/*
|
|
195
|
-
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
196
|
-
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
197
|
-
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
198
|
-
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
199
|
-
// Returns: new cid of the root after this file is placed in the tree
|
|
207
|
+
/*
|
|
208
|
+
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
209
|
+
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
210
|
+
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
211
|
+
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
212
|
+
// Returns: new cid of the root after this file is placed in the tree
|
|
200
213
|
*/
|
|
201
214
|
export const readFile = (fulaTargetFilename, localFilename) => {
|
|
202
215
|
return Fula.readFile(fulaTargetFilename, localFilename);
|
|
203
216
|
};
|
|
204
217
|
|
|
205
|
-
/**
|
|
206
|
-
* readFile reads content of a given path
|
|
207
|
-
* @param path
|
|
208
|
-
* @returns string: cotent
|
|
218
|
+
/**
|
|
219
|
+
* readFile reads content of a given path
|
|
220
|
+
* @param path
|
|
221
|
+
* @returns string: cotent
|
|
209
222
|
*/
|
|
210
223
|
export const readFileContent = path => {
|
|
211
224
|
return Fula.readFileContent(path);
|
|
212
225
|
};
|
|
213
226
|
|
|
214
|
-
/**
|
|
215
|
-
* Shutdown closes all resources used by Client.
|
|
216
|
-
// After calling this function Client must be discarded.
|
|
217
|
-
* @param
|
|
218
|
-
* @returns
|
|
227
|
+
/**
|
|
228
|
+
* Shutdown closes all resources used by Client.
|
|
229
|
+
// After calling this function Client must be discarded.
|
|
230
|
+
* @param
|
|
231
|
+
* @returns
|
|
219
232
|
*/
|
|
220
233
|
export const shutdown = () => {
|
|
221
234
|
return Fula.shutdown();
|
|
222
235
|
};
|
|
223
236
|
|
|
224
|
-
/**
|
|
225
|
-
* setAuth adds or removes a peer from the list of peers that are allowed to push to this node.
|
|
226
|
-
* This can only be called on a peer that is added as an owner of blox by --authorizer parameter
|
|
227
|
-
* @param peerId, allow
|
|
228
|
-
* @returns boolean: true if successful or false if not
|
|
237
|
+
/**
|
|
238
|
+
* setAuth adds or removes a peer from the list of peers that are allowed to push to this node.
|
|
239
|
+
* This can only be called on a peer that is added as an owner of blox by --authorizer parameter
|
|
240
|
+
* @param peerId, allow
|
|
241
|
+
* @returns boolean: true if successful or false if not
|
|
229
242
|
*/
|
|
230
243
|
export const setAuth = (peerId, allow) => {
|
|
231
244
|
return Fula.setAuth(peerId, allow);
|
|
232
245
|
};
|
|
233
246
|
|
|
234
|
-
/**
|
|
235
|
-
* isReady checks if the connection is ready to be used.
|
|
236
|
-
* @param filesystemCheck: also check if the wnfs is ready
|
|
237
|
-
* @returns boolean: true if ready or false if not
|
|
247
|
+
/**
|
|
248
|
+
* isReady checks if the connection is ready to be used.
|
|
249
|
+
* @param filesystemCheck: also check if the wnfs is ready
|
|
250
|
+
* @returns boolean: true if ready or false if not
|
|
238
251
|
*/
|
|
239
252
|
export const isReady = function () {
|
|
240
253
|
let filesystemCheck = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Fula","init","identity","storePath","bloxAddr","exchange","autoFlush","rootCid","useRelay","refresh","console","log","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,OAAOA,IAAI,MAAM,gCAAgC;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,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,OAAOR,IAAI,CAACC,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;;AAEA,OAAO,MAAMG,SAAS,GAAG,UACvBV,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,OAAO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,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,CACrBC,MAAc,EACdC,KAAc,KACO;EACrB,OAAO5D,IAAI,CAAC0D,OAAO,CAACC,MAAM,EAAEC,KAAK,CAAC;AACpC,CAAC;;AAGD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,YAAuD;EAAA,IAAtDC,eAAwB,uEAAG,IAAI;EACrD,OAAO9D,IAAI,CAAC6D,OAAO,CAACC,eAAe,CAAC;AACtC,CAAC"}
|
|
1
|
+
{"version":3,"names":["Fula","init","identity","storePath","bloxAddr","exchange","autoFlush","rootCid","useRelay","refresh","console","log","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,OAAOA,IAAI,MAAM,gCAAgC;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,IAAI,GAAG,UAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAKsD;E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OAAO,CAACC,MAAM,EAAEC,KAAK,CAAC;AACpC,CAAC;;AAGD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG,YAAuD;EAAA,IAAtDC,eAAwB,uEAAG,IAAI;EACrD,OAAOjE,IAAI,CAACgE,OAAO,CAACC,eAAe,CAAC;AACtC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Fula from '../interfaces/fulaNativeModule';
|
|
2
|
-
/**
|
|
3
|
-
* send a command to Blox hardware to remove all save wifis.
|
|
4
|
-
* @returns json{status:true if success, false if fails; msg: error message or success log}
|
|
2
|
+
/**
|
|
3
|
+
* send a command to Blox hardware to remove all save wifis.
|
|
4
|
+
* @returns json{status:true if success, false if fails; msg: error message or success log}
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export const wifiRemoveall = () => {
|
|
@@ -22,4 +22,22 @@ export const wifiRemoveall = () => {
|
|
|
22
22
|
});
|
|
23
23
|
return res;
|
|
24
24
|
};
|
|
25
|
+
export const reboot = () => {
|
|
26
|
+
console.log('reboot in react-native started');
|
|
27
|
+
let res = Fula.reboot().then(res => {
|
|
28
|
+
try {
|
|
29
|
+
let jsonRes = JSON.parse(res);
|
|
30
|
+
return jsonRes;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(res);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}).catch(err => {
|
|
39
|
+
return err;
|
|
40
|
+
});
|
|
41
|
+
return res;
|
|
42
|
+
};
|
|
25
43
|
//# sourceMappingURL=fxblox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Fula","wifiRemoveall","console","log","res","then","jsonRes","JSON","parse","e","catch","err"],"sources":["fxblox.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\nimport type * as BType from '../types/fxblox';\n\n/**\n * send a command to Blox hardware to remove all save wifis.\n * @returns json{status:true if success, false if fails; msg: error message or success log}\n */\n\nexport const wifiRemoveall = (): Promise<BType.wifiRemoveallResponse> => {\n console.log(
|
|
1
|
+
{"version":3,"names":["Fula","wifiRemoveall","console","log","res","then","jsonRes","JSON","parse","e","catch","err","reboot"],"sources":["fxblox.ts"],"sourcesContent":["import Fula from '../interfaces/fulaNativeModule';\r\nimport type * as BType from '../types/fxblox';\r\n\r\n/**\r\n * send a command to Blox hardware to remove all save wifis.\r\n * @returns json{status:true if success, false if fails; msg: error message or success log}\r\n */\r\n\r\nexport const wifiRemoveall = (): Promise<BType.wifiRemoveallResponse> => {\r\n console.log('wifiRemoveall in react-native started');\r\n let res = Fula.wifiRemoveall()\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.wifiRemoveallResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n\r\nexport const reboot = (): Promise<BType.rebootResponse> => {\r\n console.log('reboot in react-native started');\r\n let res = Fula.reboot()\r\n .then((res) => {\r\n try {\r\n let jsonRes: BType.rebootResponse = JSON.parse(res);\r\n return jsonRes;\r\n } catch (e) {\r\n try {\r\n return JSON.parse(res);\r\n } catch (e) {\r\n return res;\r\n }\r\n }\r\n })\r\n .catch((err) => {\r\n return err;\r\n });\r\n return res;\r\n};\r\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;AAGjD;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,aAAa,GAAG,MAA4C;EACvEC,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;EACpD,IAAIC,GAAG,GAAGJ,IAAI,CAACC,aAAa,EAAE,CAC3BI,IAAI,CAAED,GAAG,IAAK;IACb,IAAI;MACF,IAAIE,OAAoC,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MAC1D,OAAOE,OAAO;IAChB,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAI;QACF,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACxB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACV,OAAOL,GAAG;MACZ;IACF;EACF,CAAC,CAAC,CACDM,KAAK,CAAEC,GAAG,IAAK;IACd,OAAOA,GAAG;EACZ,CAAC,CAAC;EACJ,OAAOP,GAAG;AACZ,CAAC;AAED,OAAO,MAAMQ,MAAM,GAAG,MAAqC;EACzDV,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;EAC7C,IAAIC,GAAG,GAAGJ,IAAI,CAACY,MAAM,EAAE,CACpBP,IAAI,CAAED,GAAG,IAAK;IACb,IAAI;MACF,IAAIE,OAA6B,GAAGC,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACnD,OAAOE,OAAO;IAChB,CAAC,CAAC,OAAOG,CAAC,EAAE;MACV,IAAI;QACF,OAAOF,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC;MACxB,CAAC,CAAC,OAAOK,CAAC,EAAE;QACV,OAAOL,GAAG;MACZ;IACF;EACF,CAAC,CAAC,CACDM,KAAK,CAAEC,GAAG,IAAK;IACd,OAAOA,GAAG;EACZ,CAAC,CAAC;EACJ,OAAOP,GAAG;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["fxblox.ts"],"sourcesContent":["export interface wifiRemoveallResponse {\n status: boolean;\n msg: string;\n }\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["fxblox.ts"],"sourcesContent":["export interface wifiRemoveallResponse {\r\n status: boolean;\r\n msg: string;\r\n}\r\nexport interface rebootResponse {\r\n status: boolean;\r\n msg: string;\r\n}\r\n"],"mappings":""}
|
|
@@ -21,6 +21,7 @@ interface FulaNativeModule {
|
|
|
21
21
|
isReady: (filesystemCheck: boolean) => Promise<boolean>;
|
|
22
22
|
logout: (identity: string, storePath: string) => Promise<boolean>;
|
|
23
23
|
checkFailedActions: (retry: boolean, timeout: number) => Promise<boolean>;
|
|
24
|
+
listFailedActions: (cids: string[]) => Promise<string[]>;
|
|
24
25
|
checkConnection: (timeout: number) => Promise<boolean>;
|
|
25
26
|
get: (key: string) => Promise<string>;
|
|
26
27
|
has: (key: Uint8Array) => Promise<boolean>;
|
|
@@ -37,6 +38,7 @@ interface FulaNativeModule {
|
|
|
37
38
|
readFileContent: (path: string) => Promise<string>;
|
|
38
39
|
setAuth: (peerId: string, allow: boolean) => Promise<boolean>;
|
|
39
40
|
shutdown: () => Promise<void>;
|
|
41
|
+
testData: (identity: string, bloxAddr: string) => Promise<string>;
|
|
40
42
|
createAccount: (seed: string) => Promise<string>;
|
|
41
43
|
checkAccountExists: (account: string) => Promise<string>;
|
|
42
44
|
createPool: (seed: string, poolName: string) => Promise<string>;
|
|
@@ -54,6 +56,7 @@ interface FulaNativeModule {
|
|
|
54
56
|
removeStoredReplication: (seed: string, uploader: string, poolID: number, cid: string) => Promise<string>;
|
|
55
57
|
bloxFreeSpace: () => Promise<string>;
|
|
56
58
|
wifiRemoveall: () => Promise<string>;
|
|
59
|
+
reboot: () => Promise<string>;
|
|
57
60
|
}
|
|
58
61
|
declare const _default: FulaNativeModule;
|
|
59
62
|
export default _default;
|
|
@@ -26,6 +26,10 @@ export declare const logout: (identity: string, storePath: string) => Promise<bo
|
|
|
26
26
|
* Checks if there are any un-synced changes on the device
|
|
27
27
|
*/
|
|
28
28
|
export declare const checkFailedActions: (retry?: boolean, timeout?: number) => Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Lists the cids that failed to be sent to backend and are kept only locally
|
|
31
|
+
*/
|
|
32
|
+
export declare const listFailedActions: (cids?: string[]) => Promise<string[]>;
|
|
29
33
|
/**
|
|
30
34
|
* Checks if there are any un-synced changes on the device
|
|
31
35
|
*/
|
|
@@ -52,6 +56,7 @@ export declare const has: (key: Uint8Array) => Promise<boolean>;
|
|
|
52
56
|
* @returns null or error
|
|
53
57
|
*/
|
|
54
58
|
export declare const push: () => Promise<string>;
|
|
59
|
+
export declare const testData: (identity: string, bloxAddr: string) => Promise<string>;
|
|
55
60
|
/**
|
|
56
61
|
* Put stores the given key value onto the local datastore.
|
|
57
62
|
// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
|
|
@@ -4,3 +4,4 @@ import type * as BType from '../types/fxblox';
|
|
|
4
4
|
* @returns json{status:true if success, false if fails; msg: error message or success log}
|
|
5
5
|
*/
|
|
6
6
|
export declare const wifiRemoveall: () => Promise<BType.wifiRemoveallResponse>;
|
|
7
|
+
export declare const reboot: () => Promise<BType.rebootResponse>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionland/react-native-fula",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|