@functionland/react-native-fula 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -9
- 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/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/build.gradle +67 -67
- package/android/src/main/java/land/fx/fula/FulaModule.java +480 -443
- package/lib/commonjs/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/commonjs/protocols/fula.js +84 -61
- package/lib/commonjs/protocols/fula.js.map +1 -1
- package/lib/module/interfaces/fulaNativeModule.js.map +1 -1
- package/lib/module/protocols/fula.js +81 -60
- package/lib/module/protocols/fula.js.map +1 -1
- package/lib/typescript/interfaces/fulaNativeModule.d.ts +5 -2
- package/lib/typescript/protocols/fula.d.ts +9 -2
- package/package.json +152 -152
- package/src/interfaces/fulaNativeModule.ts +42 -39
- package/src/protocols/fula.ts +138 -116
|
@@ -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';\n\ninterface FulaNativeModule {\n init: (\n identity: string | null, //Private key of did identity\n storePath: string | null, //You can leave empty\n bloxAddr: string //Blox multiadddr needs to be manually entered now\n ) => Promise<[string]>;\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: (fulaTargetFilename: string, localFilename: string) => Promise<string>;\n ls: (path: string) => Promise<string>;\n readFile: (path: string) => Promise<string>;\n\n shutdown: () => Promise<void>;\n}\n\nconst LINKING_ERROR =\n `The package 'react-native-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;
|
|
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 | null, //Private key of did identity\r\n storePath: string | null, //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 ) => Promise<[string, string, string]>;\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: (fulaTargetFilename: string, localFilename: string) => Promise<string>;\r\n ls: (path: string) => Promise<string>;\r\n rm: (path: string) => Promise<string>;\r\n readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;\r\n readFileContent: (path: string) => Promise<string>;\r\n\r\n shutdown: () => Promise<void>;\r\n}\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-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;AAwBA,MAAMA,aAAa,GAChB,4EAA2E,GAC5EC,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,126 +3,149 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.writeFileContent = exports.writeFile = exports.shutdown = exports.readFile = exports.put = exports.push = exports.mkdir = exports.ls = exports.init = exports.has = exports.get = void 0;
|
|
6
|
+
exports.writeFileContent = exports.writeFile = exports.shutdown = exports.rm = exports.readFileContent = exports.readFile = exports.put = exports.push = exports.mkdir = exports.ls = exports.init = exports.has = exports.get = 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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
const init = (identity, storePath, bloxAddr, exchange) => {
|
|
17
|
+
console.log('init in react-native started', identity, storePath, bloxAddr, exchange);
|
|
18
|
+
return _fulaNativeModule.default.init(identity, storePath, bloxAddr, exchange);
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
/**
|
|
21
|
-
* Get gets the value corresponding to the given key from the local datastore.
|
|
22
|
-
// The key must be a valid ipld.Link.
|
|
23
|
-
* @param key
|
|
24
|
-
* @returns value
|
|
21
|
+
/**
|
|
22
|
+
* Get gets the value corresponding to the given key from the local datastore.
|
|
23
|
+
// The key must be a valid ipld.Link.
|
|
24
|
+
* @param key
|
|
25
|
+
* @returns value
|
|
25
26
|
*/
|
|
26
27
|
exports.init = init;
|
|
27
28
|
const get = key => {
|
|
28
29
|
return _fulaNativeModule.default.get(key);
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
/**
|
|
32
|
-
* Has checks whether the value corresponding to the given key is present in the local datastore.
|
|
33
|
-
// The key must be a valid ipld.Link.
|
|
34
|
-
* @param key
|
|
35
|
-
* @returns boolean
|
|
32
|
+
/**
|
|
33
|
+
* Has checks whether the value corresponding to the given key is present in the local datastore.
|
|
34
|
+
// The key must be a valid ipld.Link.
|
|
35
|
+
* @param key
|
|
36
|
+
* @returns boolean
|
|
36
37
|
*/
|
|
37
38
|
exports.get = get;
|
|
38
39
|
const has = key => {
|
|
39
40
|
return _fulaNativeModule.default.has(key);
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
/**
|
|
43
|
-
* Push requests the given addr to download the root cid from this node.
|
|
44
|
-
// The addr must be a valid multiaddr that includes peer ID.
|
|
45
|
-
// this function.
|
|
46
|
-
* @param addr
|
|
47
|
-
* @returns null or error
|
|
43
|
+
/**
|
|
44
|
+
* Push requests the given addr to download the root cid from this node.
|
|
45
|
+
// The addr must be a valid multiaddr that includes peer ID.
|
|
46
|
+
// this function.
|
|
47
|
+
* @param addr
|
|
48
|
+
* @returns null or error
|
|
48
49
|
*/
|
|
49
50
|
exports.has = has;
|
|
50
51
|
const push = () => {
|
|
51
52
|
return _fulaNativeModule.default.push();
|
|
52
53
|
};
|
|
53
54
|
|
|
54
|
-
/**
|
|
55
|
-
* Put stores the given key value onto the local datastore.
|
|
56
|
-
// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
|
|
57
|
-
// to the given key.
|
|
58
|
-
* @param key, value
|
|
59
|
-
* @returns null or string
|
|
55
|
+
/**
|
|
56
|
+
* Put stores the given key value onto the local datastore.
|
|
57
|
+
// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
|
|
58
|
+
// to the given key.
|
|
59
|
+
* @param key, value
|
|
60
|
+
* @returns null or string
|
|
60
61
|
*/
|
|
61
62
|
exports.push = push;
|
|
62
63
|
const put = (value, codec) => {
|
|
63
64
|
return _fulaNativeModule.default.put(value, codec);
|
|
64
65
|
};
|
|
65
66
|
|
|
66
|
-
/**
|
|
67
|
-
* mkdir creates a directory at the given path.
|
|
68
|
-
* @param path
|
|
69
|
-
* @returns string: new cid of the root
|
|
67
|
+
/**
|
|
68
|
+
* mkdir creates a directory at the given path.
|
|
69
|
+
* @param path
|
|
70
|
+
* @returns string: new cid of the root
|
|
70
71
|
*/
|
|
71
72
|
exports.put = put;
|
|
72
73
|
const mkdir = path => {
|
|
73
74
|
return _fulaNativeModule.default.mkdir(path);
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
/**
|
|
77
|
-
* writeFileContent writes content at a given path
|
|
78
|
-
* @param path
|
|
79
|
-
* @returns string: new cid of the root
|
|
77
|
+
/**
|
|
78
|
+
* writeFileContent writes content at a given path
|
|
79
|
+
* @param path
|
|
80
|
+
* @returns string: new cid of the root
|
|
80
81
|
*/
|
|
81
82
|
exports.mkdir = mkdir;
|
|
82
83
|
const writeFileContent = (path, content) => {
|
|
83
84
|
return _fulaNativeModule.default.writeFileContent(path, content);
|
|
84
85
|
};
|
|
85
86
|
|
|
86
|
-
/*
|
|
87
|
-
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
88
|
-
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
89
|
-
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
90
|
-
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
91
|
-
// Returns: new cid of the root after this file is placed in the tree
|
|
87
|
+
/*
|
|
88
|
+
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
89
|
+
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
90
|
+
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
91
|
+
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
92
|
+
// Returns: new cid of the root after this file is placed in the tree
|
|
92
93
|
*/
|
|
93
94
|
exports.writeFileContent = writeFileContent;
|
|
94
95
|
const writeFile = (fulaTargetFilename, localFilename) => {
|
|
95
96
|
return _fulaNativeModule.default.writeFile(fulaTargetFilename, localFilename);
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
/**
|
|
99
|
-
* ls lists the name of files and folders at a given path
|
|
100
|
-
* @param path
|
|
101
|
-
* @returns string: list of items
|
|
102
|
-
* TODO: Findout how is the string and convert to array
|
|
99
|
+
/**
|
|
100
|
+
* ls lists the name of files and folders at a given path
|
|
101
|
+
* @param path
|
|
102
|
+
* @returns string: list of items
|
|
103
|
+
* TODO: Findout how is the string and convert to array
|
|
103
104
|
*/
|
|
104
105
|
exports.writeFile = writeFile;
|
|
105
106
|
const ls = path => {
|
|
106
107
|
return _fulaNativeModule.default.ls(path);
|
|
107
108
|
};
|
|
108
109
|
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @param path
|
|
112
|
-
* @returns string:
|
|
110
|
+
/**
|
|
111
|
+
* rm removes all files and folders at a given path
|
|
112
|
+
* @param path
|
|
113
|
+
* @returns string: new cid of the root
|
|
113
114
|
*/
|
|
114
115
|
exports.ls = ls;
|
|
115
|
-
const
|
|
116
|
-
return _fulaNativeModule.default.
|
|
116
|
+
const rm = path => {
|
|
117
|
+
return _fulaNativeModule.default.rm(path);
|
|
118
|
+
};
|
|
119
|
+
|
|
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
|
+
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
124
|
+
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
125
|
+
// Returns: new cid of the root after this file is placed in the tree
|
|
126
|
+
*/
|
|
127
|
+
exports.rm = rm;
|
|
128
|
+
const readFile = (fulaTargetFilename, localFilename) => {
|
|
129
|
+
return _fulaNativeModule.default.readFile(fulaTargetFilename, localFilename);
|
|
117
130
|
};
|
|
118
131
|
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
|
|
122
|
-
* @
|
|
123
|
-
* @returns
|
|
132
|
+
/**
|
|
133
|
+
* readFile reads content of a given path
|
|
134
|
+
* @param path
|
|
135
|
+
* @returns string: cotent
|
|
124
136
|
*/
|
|
125
137
|
exports.readFile = readFile;
|
|
138
|
+
const readFileContent = path => {
|
|
139
|
+
return _fulaNativeModule.default.readFileContent(path);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Shutdown closes all resources used by Client.
|
|
144
|
+
// After calling this function Client must be discarded.
|
|
145
|
+
* @param
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
exports.readFileContent = readFileContent;
|
|
126
149
|
const shutdown = () => {
|
|
127
150
|
return _fulaNativeModule.default.shutdown();
|
|
128
151
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["init","identity","storePath","bloxAddr","console","log","Fula","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","readFile","shutdown"],"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 */\nexport const init = (\n identity: string
|
|
1
|
+
{"version":3,"names":["init","identity","storePath","bloxAddr","exchange","console","log","Fula","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","rm","readFile","readFileContent","shutdown"],"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): Promise<[string, string, string]> => {\r\n console.log('init in react-native started',identity, storePath, bloxAddr, exchange);\r\n return Fula.init(identity, storePath, bloxAddr, exchange);\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 = (path: string, content: string): 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 // 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 = (fulaTargetFilename: string, localFilename: string): 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\n export const ls = (path: string): Promise<string> => {\r\n return Fula.ls(path);\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 // 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\n export const readFile = (fulaTargetFilename: string, localFilename: string): 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\n export 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"],"mappings":";;;;;;AAAA;AAAkD;AAElD;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,IAAI,GAAG,CAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,KACsB;EACtCC,OAAO,CAACC,GAAG,CAAC,8BAA8B,EAACL,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;EACnF,OAAOG,yBAAI,CAACP,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;AAC3D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMI,GAAG,GAAIC,GAAW,IAAsB;EACnD,OAAOF,yBAAI,CAACC,GAAG,CAACC,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMC,GAAG,GAAID,GAAe,IAAuB;EACxD,OAAOF,yBAAI,CAACG,GAAG,CAACD,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,MAAME,IAAI,GAAG,MAAuB;EACzC,OAAOJ,yBAAI,CAACI,IAAI,EAAE;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,MAAMC,GAAG,GAAG,CAACC,KAAa,EAAEC,KAAa,KAAsB;EACpE,OAAOP,yBAAI,CAACK,GAAG,CAACC,KAAK,EAAEC,KAAK,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,KAAK,GAAIC,IAAY,IAAsB;EACtD,OAAOT,yBAAI,CAACQ,KAAK,CAACC,IAAI,CAAC;AACzB,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,gBAAgB,GAAG,CAACD,IAAY,EAAEE,OAAe,KAAsB;EAClF,OAAOX,yBAAI,CAACU,gBAAgB,CAACD,IAAI,EAAEE,OAAO,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,MAAMC,SAAS,GAAG,CAACC,kBAA0B,EAAEC,aAAqB,KAAsB;EAC/F,OAAOd,yBAAI,CAACY,SAAS,CAACC,kBAAkB,EAAEC,aAAa,CAAC;AAC1D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMQ,MAAMC,EAAE,GAAIN,IAAY,IAAsB;EACpD,OAAOT,yBAAI,CAACe,EAAE,CAACN,IAAI,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMO,EAAE,GAAIP,IAAY,IAAsB;EACnD,OAAOT,yBAAI,CAACgB,EAAE,CAACP,IAAI,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOW,MAAMQ,QAAQ,GAAG,CAACJ,kBAA0B,EAAEC,aAAqB,KAAsB;EAC9F,OAAOd,yBAAI,CAACiB,QAAQ,CAACJ,kBAAkB,EAAEC,aAAa,CAAC;AACzD,CAAC;;AAEL;AACA;AACA;AACA;AACA;AAJA;AAKQ,MAAMI,eAAe,GAAIT,IAAY,IAAsB;EACjE,OAAOT,yBAAI,CAACkB,eAAe,CAACT,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALA;AAMO,MAAMU,QAAQ,GAAG,MAAqB;EAC3C,OAAOnB,yBAAI,CAACmB,QAAQ,EAAE;AACxB,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';\n\ninterface FulaNativeModule {\n init: (\n identity: string | null, //Private key of did identity\n storePath: string | null, //You can leave empty\n bloxAddr: string //Blox multiadddr needs to be manually entered now\n ) => Promise<[string]>;\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: (fulaTargetFilename: string, localFilename: string) => Promise<string>;\n ls: (path: string) => Promise<string>;\n readFile: (path: string) => Promise<string>;\n\n shutdown: () => Promise<void>;\n}\n\nconst LINKING_ERROR =\n `The package 'react-native-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;
|
|
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 | null, //Private key of did identity\r\n storePath: string | null, //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 ) => Promise<[string, string, string]>;\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: (fulaTargetFilename: string, localFilename: string) => Promise<string>;\r\n ls: (path: string) => Promise<string>;\r\n rm: (path: string) => Promise<string>;\r\n readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;\r\n readFileContent: (path: string) => Promise<string>;\r\n\r\n shutdown: () => Promise<void>;\r\n}\r\n\r\nconst LINKING_ERROR =\r\n `The package 'react-native-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;AAwBtD,MAAMC,aAAa,GAChB,4EAA2E,GAC5ED,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,111 +1,132 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
|
|
10
|
+
export const init = (identity, storePath, bloxAddr, exchange) => {
|
|
11
|
+
console.log('init in react-native started', identity, storePath, bloxAddr, exchange);
|
|
12
|
+
return Fula.init(identity, storePath, bloxAddr, exchange);
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
/**
|
|
15
|
-
* Get gets the value corresponding to the given key from the local datastore.
|
|
16
|
-
// The key must be a valid ipld.Link.
|
|
17
|
-
* @param key
|
|
18
|
-
* @returns value
|
|
15
|
+
/**
|
|
16
|
+
* Get gets the value corresponding to the given key from the local datastore.
|
|
17
|
+
// The key must be a valid ipld.Link.
|
|
18
|
+
* @param key
|
|
19
|
+
* @returns value
|
|
19
20
|
*/
|
|
20
21
|
export const get = key => {
|
|
21
22
|
return Fula.get(key);
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
/**
|
|
25
|
-
* Has checks whether the value corresponding to the given key is present in the local datastore.
|
|
26
|
-
// The key must be a valid ipld.Link.
|
|
27
|
-
* @param key
|
|
28
|
-
* @returns boolean
|
|
25
|
+
/**
|
|
26
|
+
* Has checks whether the value corresponding to the given key is present in the local datastore.
|
|
27
|
+
// The key must be a valid ipld.Link.
|
|
28
|
+
* @param key
|
|
29
|
+
* @returns boolean
|
|
29
30
|
*/
|
|
30
31
|
export const has = key => {
|
|
31
32
|
return Fula.has(key);
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
/**
|
|
35
|
-
* Push requests the given addr to download the root cid from this node.
|
|
36
|
-
// The addr must be a valid multiaddr that includes peer ID.
|
|
37
|
-
// this function.
|
|
38
|
-
* @param addr
|
|
39
|
-
* @returns null or error
|
|
35
|
+
/**
|
|
36
|
+
* Push requests the given addr to download the root cid from this node.
|
|
37
|
+
// The addr must be a valid multiaddr that includes peer ID.
|
|
38
|
+
// this function.
|
|
39
|
+
* @param addr
|
|
40
|
+
* @returns null or error
|
|
40
41
|
*/
|
|
41
42
|
export const push = () => {
|
|
42
43
|
return Fula.push();
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
/**
|
|
46
|
-
* Put stores the given key value onto the local datastore.
|
|
47
|
-
// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
|
|
48
|
-
// to the given key.
|
|
49
|
-
* @param key, value
|
|
50
|
-
* @returns null or string
|
|
46
|
+
/**
|
|
47
|
+
* Put stores the given key value onto the local datastore.
|
|
48
|
+
// The key must be a valid ipld.Link and the value must be the valid encoded ipld.Node corresponding
|
|
49
|
+
// to the given key.
|
|
50
|
+
* @param key, value
|
|
51
|
+
* @returns null or string
|
|
51
52
|
*/
|
|
52
53
|
export const put = (value, codec) => {
|
|
53
54
|
return Fula.put(value, codec);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
/**
|
|
57
|
-
* mkdir creates a directory at the given path.
|
|
58
|
-
* @param path
|
|
59
|
-
* @returns string: new cid of the root
|
|
57
|
+
/**
|
|
58
|
+
* mkdir creates a directory at the given path.
|
|
59
|
+
* @param path
|
|
60
|
+
* @returns string: new cid of the root
|
|
60
61
|
*/
|
|
61
62
|
export const mkdir = path => {
|
|
62
63
|
return Fula.mkdir(path);
|
|
63
64
|
};
|
|
64
65
|
|
|
65
|
-
/**
|
|
66
|
-
* writeFileContent writes content at a given path
|
|
67
|
-
* @param path
|
|
68
|
-
* @returns string: new cid of the root
|
|
66
|
+
/**
|
|
67
|
+
* writeFileContent writes content at a given path
|
|
68
|
+
* @param path
|
|
69
|
+
* @returns string: new cid of the root
|
|
69
70
|
*/
|
|
70
71
|
export const writeFileContent = (path, content) => {
|
|
71
72
|
return Fula.writeFileContent(path, content);
|
|
72
73
|
};
|
|
73
74
|
|
|
74
|
-
/*
|
|
75
|
-
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
76
|
-
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
77
|
-
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
78
|
-
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
79
|
-
// Returns: new cid of the root after this file is placed in the tree
|
|
75
|
+
/*
|
|
76
|
+
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
77
|
+
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
78
|
+
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
79
|
+
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
80
|
+
// Returns: new cid of the root after this file is placed in the tree
|
|
80
81
|
*/
|
|
81
82
|
export const writeFile = (fulaTargetFilename, localFilename) => {
|
|
82
83
|
return Fula.writeFile(fulaTargetFilename, localFilename);
|
|
83
84
|
};
|
|
84
85
|
|
|
85
|
-
/**
|
|
86
|
-
* ls lists the name of files and folders at a given path
|
|
87
|
-
* @param path
|
|
88
|
-
* @returns string: list of items
|
|
89
|
-
* TODO: Findout how is the string and convert to array
|
|
86
|
+
/**
|
|
87
|
+
* ls lists the name of files and folders at a given path
|
|
88
|
+
* @param path
|
|
89
|
+
* @returns string: list of items
|
|
90
|
+
* TODO: Findout how is the string and convert to array
|
|
90
91
|
*/
|
|
91
92
|
export const ls = path => {
|
|
92
93
|
return Fula.ls(path);
|
|
93
94
|
};
|
|
94
95
|
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* @param path
|
|
98
|
-
* @returns string:
|
|
96
|
+
/**
|
|
97
|
+
* rm removes all files and folders at a given path
|
|
98
|
+
* @param path
|
|
99
|
+
* @returns string: new cid of the root
|
|
100
|
+
*/
|
|
101
|
+
export const rm = path => {
|
|
102
|
+
return Fula.rm(path);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/*
|
|
106
|
+
// reads content of the file form localFilename (should include full absolute path to local file with read permission
|
|
107
|
+
// writes content to the specified location by fulaTargetFilename in Fula filesystem
|
|
108
|
+
// fulaTargetFilename: a string including full path and filename of target file on Fula (e.g. root/pictures/cat.jpg)
|
|
109
|
+
// localFilename: a string containing full path and filename of local file on hte device (e.g /usr/bin/cat.jpg)
|
|
110
|
+
// Returns: new cid of the root after this file is placed in the tree
|
|
111
|
+
*/
|
|
112
|
+
export const readFile = (fulaTargetFilename, localFilename) => {
|
|
113
|
+
return Fula.readFile(fulaTargetFilename, localFilename);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* readFile reads content of a given path
|
|
118
|
+
* @param path
|
|
119
|
+
* @returns string: cotent
|
|
99
120
|
*/
|
|
100
|
-
export const
|
|
101
|
-
return Fula.
|
|
121
|
+
export const readFileContent = path => {
|
|
122
|
+
return Fula.readFileContent(path);
|
|
102
123
|
};
|
|
103
124
|
|
|
104
|
-
/**
|
|
105
|
-
* Shutdown closes all resources used by Client.
|
|
106
|
-
// After calling this function Client must be discarded.
|
|
107
|
-
* @param
|
|
108
|
-
* @returns
|
|
125
|
+
/**
|
|
126
|
+
* Shutdown closes all resources used by Client.
|
|
127
|
+
// After calling this function Client must be discarded.
|
|
128
|
+
* @param
|
|
129
|
+
* @returns
|
|
109
130
|
*/
|
|
110
131
|
export const shutdown = () => {
|
|
111
132
|
return Fula.shutdown();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Fula","init","identity","storePath","bloxAddr","console","log","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","readFile","shutdown"],"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 */\nexport const init = (\n identity: string
|
|
1
|
+
{"version":3,"names":["Fula","init","identity","storePath","bloxAddr","exchange","console","log","get","key","has","push","put","value","codec","mkdir","path","writeFileContent","content","writeFile","fulaTargetFilename","localFilename","ls","rm","readFile","readFileContent","shutdown"],"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): Promise<[string, string, string]> => {\r\n console.log('init in react-native started',identity, storePath, bloxAddr, exchange);\r\n return Fula.init(identity, storePath, bloxAddr, exchange);\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 = (path: string, content: string): 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 // 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 = (fulaTargetFilename: string, localFilename: string): 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\n export const ls = (path: string): Promise<string> => {\r\n return Fula.ls(path);\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 // 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\n export const readFile = (fulaTargetFilename: string, localFilename: string): 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\n export 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"],"mappings":"AAAA,OAAOA,IAAI,MAAM,gCAAgC;;AAEjD;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,IAAI,GAAG,CAClBC,QAAgB,EAChBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,KACsB;EACtCC,OAAO,CAACC,GAAG,CAAC,8BAA8B,EAACL,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;EACnF,OAAOL,IAAI,CAACC,IAAI,CAACC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;AAC3D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,GAAG,GAAIC,GAAW,IAAsB;EACnD,OAAOT,IAAI,CAACQ,GAAG,CAACC,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,GAAG,GAAID,GAAe,IAAuB;EACxD,OAAOT,IAAI,CAACU,GAAG,CAACD,GAAG,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,IAAI,GAAG,MAAuB;EACzC,OAAOX,IAAI,CAACW,IAAI,EAAE;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,GAAG,GAAG,CAACC,KAAa,EAAEC,KAAa,KAAsB;EACpE,OAAOd,IAAI,CAACY,GAAG,CAACC,KAAK,EAAEC,KAAK,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAIC,IAAY,IAAsB;EACtD,OAAOhB,IAAI,CAACe,KAAK,CAACC,IAAI,CAAC;AACzB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,CAACD,IAAY,EAAEE,OAAe,KAAsB;EAClF,OAAOlB,IAAI,CAACiB,gBAAgB,CAACD,IAAI,EAAEE,OAAO,CAAC;AAC7C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,CAACC,kBAA0B,EAAEC,aAAqB,KAAsB;EAC/F,OAAOrB,IAAI,CAACmB,SAAS,CAACC,kBAAkB,EAAEC,aAAa,CAAC;AAC1D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACC,OAAO,MAAMC,EAAE,GAAIN,IAAY,IAAsB;EACpD,OAAOhB,IAAI,CAACsB,EAAE,CAACN,IAAI,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,EAAE,GAAIP,IAAY,IAAsB;EACnD,OAAOhB,IAAI,CAACuB,EAAE,CAACP,IAAI,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACI,OAAO,MAAMQ,QAAQ,GAAG,CAACJ,kBAA0B,EAAEC,aAAqB,KAAsB;EAC9F,OAAOrB,IAAI,CAACwB,QAAQ,CAACJ,kBAAkB,EAAEC,aAAa,CAAC;AACzD,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACC,OAAO,MAAMI,eAAe,GAAIT,IAAY,IAAsB;EACjE,OAAOhB,IAAI,CAACyB,eAAe,CAACT,IAAI,CAAC;AACnC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMU,QAAQ,GAAG,MAAqB;EAC3C,OAAO1B,IAAI,CAAC0B,QAAQ,EAAE;AACxB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
interface FulaNativeModule {
|
|
2
2
|
init: (identity: string | null, //Private key of did identity
|
|
3
3
|
storePath: string | null, //You can leave empty
|
|
4
|
-
bloxAddr: string
|
|
4
|
+
bloxAddr: string, //Blox multiadddr needs to be manually entered now
|
|
5
|
+
exchange: string) => Promise<[string, string, string]>;
|
|
5
6
|
get: (key: string) => Promise<string>;
|
|
6
7
|
has: (key: Uint8Array) => Promise<boolean>;
|
|
7
8
|
push: () => Promise<string>;
|
|
@@ -10,7 +11,9 @@ interface FulaNativeModule {
|
|
|
10
11
|
writeFileContent: (path: string, content: string) => Promise<string>;
|
|
11
12
|
writeFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
|
|
12
13
|
ls: (path: string) => Promise<string>;
|
|
13
|
-
|
|
14
|
+
rm: (path: string) => Promise<string>;
|
|
15
|
+
readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
|
|
16
|
+
readFileContent: (path: string) => Promise<string>;
|
|
14
17
|
shutdown: () => Promise<void>;
|
|
15
18
|
}
|
|
16
19
|
declare const _default: FulaNativeModule;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param config
|
|
5
5
|
* @returns boolean
|
|
6
6
|
*/
|
|
7
|
-
export declare const init: (identity: string
|
|
7
|
+
export declare const init: (identity: string, storePath: string, bloxAddr: string, exchange: string) => Promise<[string, string, string]>;
|
|
8
8
|
/**
|
|
9
9
|
* Get gets the value corresponding to the given key from the local datastore.
|
|
10
10
|
// The key must be a valid ipld.Link.
|
|
@@ -55,12 +55,19 @@ export declare const writeFile: (fulaTargetFilename: string, localFilename: stri
|
|
|
55
55
|
* TODO: Findout how is the string and convert to array
|
|
56
56
|
*/
|
|
57
57
|
export declare const ls: (path: string) => Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* rm removes all files and folders at a given path
|
|
60
|
+
* @param path
|
|
61
|
+
* @returns string: new cid of the root
|
|
62
|
+
*/
|
|
63
|
+
export declare const rm: (path: string) => Promise<string>;
|
|
64
|
+
export declare const readFile: (fulaTargetFilename: string, localFilename: string) => Promise<string>;
|
|
58
65
|
/**
|
|
59
66
|
* readFile reads content of a given path
|
|
60
67
|
* @param path
|
|
61
68
|
* @returns string: cotent
|
|
62
69
|
*/
|
|
63
|
-
export declare const
|
|
70
|
+
export declare const readFileContent: (path: string) => Promise<string>;
|
|
64
71
|
/**
|
|
65
72
|
* Shutdown closes all resources used by Client.
|
|
66
73
|
// After calling this function Client must be discarded.
|