separate ts and aqua files

This commit is contained in:
DieMyst 2021-08-18 11:37:09 +03:00
parent c958dbb8e1
commit 289a9c8a5e
7 changed files with 5713 additions and 32 deletions

View File

@ -26,5 +26,5 @@ npm start
``` ```
## Aqua implementation ## Aqua implementation
The business logic is implemented in Aqua in [process.aqua](aqua/src/process.aqua) The business logic is implemented in Aqua in [process.aqua](aqua/aqua/process.aqua)

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"postinstall": "../service/scripts/build.sh && npm run build", "postinstall": "../service/scripts/build.sh && npm run build",
"compile-aqua": "aqua-cli -i . -o .", "compile-aqua": "aqua-cli -i aqua -o src",
"build": "npm run compile-aqua && tsc" "build": "npm run compile-aqua && tsc"
}, },
"keywords": [ "keywords": [
@ -32,6 +32,6 @@
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.5", "typescript": "^3.9.5",
"@fluencelabs/aqua-cli": "0.1.9-164" "@fluencelabs/aqua-cli": "0.1.13-206"
} }
} }

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased. * This file is auto-generated. Do not edit manually: changes may be erased.
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/. * Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues * If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
* Aqua version: 0.1.9-164 * Aqua version: 0.1.13-206
* *
*/ */
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence'; import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -53,7 +53,7 @@ export async function add_blueprint(client: FluenceClient, module_hash: string,
}); });
h.on('getDataSrv', 'module_hash', () => {return module_hash;}); h.on('getDataSrv', 'module_hash', () => {return module_hash;});
h.onEvent('callbackSrv', 'response', (args) => { h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args; const [res] = args;
resolve(res); resolve(res);
}); });
@ -220,8 +220,12 @@ h.on('getDataSrv', 'service_id', () => {return service_id;});
h.on('callbackSrv', 'logSize', (args) => {logSize(args[0]); return {};}); h.on('callbackSrv', 'logSize', (args) => {logSize(args[0]); return {};});
h.on('callbackSrv', 'error', (args) => {error(args[0], args[1]); return {};}); h.on('callbackSrv', 'error', (args) => {error(args[0], args[1]); return {};});
h.onEvent('callbackSrv', 'response', (args) => { h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args; let [opt] = args;
resolve(res); if (Array.isArray(opt)) {
if (opt.length === 0) { resolve(null); }
opt = opt[0];
}
return resolve(opt);
}); });
h.onEvent('errorHandlingSrv', 'error', (args) => { h.onEvent('errorHandlingSrv', 'error', (args) => {
@ -293,7 +297,7 @@ export async function remove_service(client: FluenceClient, relay: string, servi
h.on('getDataSrv', 'relay', () => {return relay;}); h.on('getDataSrv', 'relay', () => {return relay;});
h.on('getDataSrv', 'service_id', () => {return service_id;}); h.on('getDataSrv', 'service_id', () => {return service_id;});
h.onEvent('callbackSrv', 'response', (args) => { h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args; const [res] = args;
resolve(res); resolve(res);
}); });
@ -357,7 +361,7 @@ export async function add_module(client: FluenceClient, name: string, path: stri
h.on('getDataSrv', 'name', () => {return name;}); h.on('getDataSrv', 'name', () => {return name;});
h.on('getDataSrv', 'path', () => {return path;}); h.on('getDataSrv', 'path', () => {return path;});
h.onEvent('callbackSrv', 'response', (args) => { h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args; const [res] = args;
resolve(res); resolve(res);
}); });
@ -476,8 +480,12 @@ h.on('getDataSrv', 'cid', () => {return cid;});
h.on('getDataSrv', 'ipfs', () => {return ipfs;}); h.on('getDataSrv', 'ipfs', () => {return ipfs;});
h.on('callbackSrv', 'error', (args) => {error(args[0], args[1]); return {};}); h.on('callbackSrv', 'error', (args) => {error(args[0], args[1]); return {};});
h.onEvent('callbackSrv', 'response', (args) => { h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args; let [opt] = args;
resolve(res); if (Array.isArray(opt)) {
if (opt.length === 0) { resolve(null); }
opt = opt[0];
}
return resolve(opt);
}); });
h.onEvent('errorHandlingSrv', 'error', (args) => { h.onEvent('errorHandlingSrv', 'error', (args) => {

View File

@ -8,4 +8,4 @@ mkdir -p artifacts
rm -f artifacts/*.wasm rm -f artifacts/*.wasm
marine build --release marine build --release
cp target/wasm32-wasi/release/process_files.wasm artifacts/ cp target/wasm32-wasi/release/process_files.wasm artifacts/
marine aqua artifacts/process_files.wasm >../aqua/src/process_files.aqua marine aqua artifacts/process_files.wasm >../aqua/aqua/process_files.aqua