import-export tests

This commit is contained in:
DieMyst
2021-08-31 12:51:07 +03:00
parent 95cdd7313e
commit 71c8fc6d9e
33 changed files with 89 additions and 1208 deletions

View File

@ -0,0 +1,13 @@
module Export declares foobar, foo
func bar() -> string:
<- " I am MyFooBar bar"
func foo() -> string:
<- "I am MyFooBar foo"
func foobar() -> []string:
res: *string
res <- foo()
res <- bar()
<- res

View File

@ -0,0 +1,2 @@
service OneMore:
more_call()

View File

@ -0,0 +1,18 @@
module Import
import foobar from "export2.aqua"
use foo as f from "export2.aqua" as Exp
import "gen/OneMore.aqua"
import OneMore as OM from "gen/OneMore.aqua"
export foo_wrapper as wrap, foobar as barfoo
func foo_wrapper() -> string:
z <- Exp.f()
OneMore "hello"
OneMore.more_call()
OM "ohmygod"
OM.more_call()
<- z

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -16,53 +16,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Functions
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {
const r = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "str") [] str)
)
(call %init_peer_id% ("println-service-id" "print") [str])
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
`,
)
.configHandler((h) => {
h.on('getDataSrv', '-relay-', () => {
return client.relayPeerId!;
});
h.on('getDataSrv', 'str', () => {return str;});
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
});
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out for print');
})
if(config && config.ttl) {
r.withTTL(config.ttl)
}
request = r.build();
});
await client.initiateFlow(request!);
return Promise.race([promise, Promise.resolve()]);
}
export async function passFunctionAsArg(client: FluenceClient, node: string, str: string, c: (arg0: string) => string, config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,74 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//CoService
//defaultId = "coservice-id"
@ -89,23 +21,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
// Functions
export async function coFunc(client: FluenceClient, node: string, c: (arg0: {external_addresses:string[]}) => void, config?: {ttl?: number}): Promise<void> {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,20 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//TestS
//defaultId = "some-id"
@ -36,264 +22,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//StringExtra
//defaultId = "service-id"
//addNameToHello: (arg0: string) => string
//END StringExtra
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//TestSrv
//defaultId = "test-service-id"
//str: () => string
//END TestSrv
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Println
//defaultId = "println-service-id"
//print: (arg0: string) => void
//END Println
// Functions
export async function helloWorld(client: FluenceClient, name: string, config?: {ttl?: number}): Promise<string> {
let request: RequestFlow;
const promise = new Promise<string>((resolve, reject) => {
const r = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "name") [] name)
)
(call %init_peer_id% ("service-id" "addNameToHello") [name] res)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [res])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`,
)
.configHandler((h) => {
h.on('getDataSrv', '-relay-', () => {
return client.relayPeerId!;
});
h.on('getDataSrv', 'name', () => {return name;});
h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args;
resolve(res);
});
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
});
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out for helloWorld');
})
if(config && config.ttl) {
r.withTTL(config.ttl)
}
request = r.build();
});
await client.initiateFlow(request!);
return promise;
}
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {
const r = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "str") [] str)
)
(call %init_peer_id% ("println-service-id" "print") [str])
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
`,
)
.configHandler((h) => {
h.on('getDataSrv', '-relay-', () => {
return client.relayPeerId!;
});
h.on('getDataSrv', 'str', () => {return str;});
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
});
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out for print');
})
if(config && config.ttl) {
r.withTTL(config.ttl)
}
request = r.build();
});
await client.initiateFlow(request!);
return Promise.race([promise, Promise.resolve()]);
}
export async function testFunc(client: FluenceClient, config?: {ttl?: number}): Promise<string> {
let request: RequestFlow;
const promise = new Promise<string>((resolve, reject) => {
const r = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("test-service-id" "str") [] res)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [res])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`,
)
.configHandler((h) => {
h.on('getDataSrv', '-relay-', () => {
return client.relayPeerId!;
});
h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args;
resolve(res);
});
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
});
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out for testFunc');
})
if(config && config.ttl) {
r.withTTL(config.ttl)
}
request = r.build();
});
await client.initiateFlow(request!);
return promise;
}
export async function doStuff(client: FluenceClient, a: string, b: string, c: boolean, d: boolean, e: string[], g: string[], str: string, config?: {ttl?: number}): Promise<string[]> {
let request: RequestFlow;
const promise = new Promise<string[]>((resolve, reject) => {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,89 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//OpO
//defaultId = "op"
//identity: (arg0: string) => string
//END OpO
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
//Getter
//defaultId = "test"
@ -105,13 +22,11 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Script
//defaultId = "script"
//OpO
//defaultId = "op"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//identity: (arg0: string) => string
//END OpO

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,20 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Return
//defaultId = "returnService"
@ -35,77 +21,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
// Functions
export async function test(client: FluenceClient, node: string, config?: {ttl?: number}): Promise<void> {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -16,53 +16,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Functions
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {
const r = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "str") [] str)
)
(call %init_peer_id% ("println-service-id" "print") [str])
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
`,
)
.configHandler((h) => {
h.on('getDataSrv', '-relay-', () => {
return client.relayPeerId!;
});
h.on('getDataSrv', 'str', () => {return str;});
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
});
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out for print');
})
if(config && config.ttl) {
r.withTTL(config.ttl)
}
request = r.build();
});
await client.initiateFlow(request!);
return Promise.race([promise, Promise.resolve()]);
}
export async function iterateAndPrint(client: FluenceClient, strings: string[], config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,20 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Op2
//defaultId = "op"
@ -35,77 +21,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
// Functions
export async function getTwoResults(client: FluenceClient, relay: string, config?: {ttl?: number}): Promise<number[]> {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -16,53 +16,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Functions
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {
const r = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "str") [] str)
)
(call %init_peer_id% ("println-service-id" "print") [str])
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
`,
)
.configHandler((h) => {
h.on('getDataSrv', '-relay-', () => {
return client.relayPeerId!;
});
h.on('getDataSrv', 'str', () => {return str;});
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
});
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out for print');
})
if(config && config.ttl) {
r.withTTL(config.ttl)
}
request = r.build();
});
await client.initiateFlow(request!);
return Promise.race([promise, Promise.resolve()]);
}
export async function ifElseCall(client: FluenceClient, condition: boolean, config?: {ttl?: number}): Promise<void> {
let request: RequestFlow;
const promise = new Promise<void>((resolve, reject) => {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,34 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//OpH
//defaultId = "opa"
@ -49,63 +21,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
// Functions
export async function a(client: FluenceClient, b: string, config?: {ttl?: number}): Promise<string> {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,91 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//SomeS
//defaultId = "test2"

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,53 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//ParService
//defaultId = "parservice-id"
@ -68,44 +21,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
// Functions
export async function parFunc(client: FluenceClient, node: string, c: (arg0: {external_addresses:string[]}) => void, config?: {ttl?: number}): Promise<void> {

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,64 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Unexisted
//defaultId = "unex"
@ -80,33 +22,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//OpA
//defaultId = "op"

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';

View File

@ -3,7 +3,7 @@
* This file is auto-generated. Do not edit manually: changes may be erased.
* 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
* Aqua version: 0.2.0-SNAPSHOT
* Aqua version: 0.2.1-SNAPSHOT
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
@ -13,20 +13,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
// Services
//Srv
//defaultId = "srv"
//add_alias: (alias: string, service_id: string) => void
//create: (blueprint_id: string) => string
//get_interface: (service_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list: () => {blueprint_id:string;id:string;owner_id:string}[]
//remove: (service_id: string) => void
//resolve_alias: (alias: string) => string
//END Srv
//CustomId
//defaultId = "cid"
@ -35,77 +21,6 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
//Peer
//defaultId = "peer"
//connect: (id: string, multiaddrs: string[] | null) => boolean
//get_contact: (peer: string) => {addresses:string[];peer_id:string}
//identify: () => {external_addresses:string[]}
//is_connected: (peer: string) => boolean
//timestamp_ms: () => number
//timestamp_sec: () => number
//END Peer
//Op
//defaultId = "op"
//array: (a: string, b: string | null, c: string | null, d: string | null) => string[]
//array_length: (array: string[]) => number
//bytes_from_b58: (b: string) => number[]
//bytes_to_b58: (bs: number[]) => string
//concat: (a: string[], b: string[] | null, c: string[] | null, d: string[] | null) => string[]
//concat_strings: (a: string, b: string) => string
//identity: (s: string | null) => string | null
//noop: () => void
//sha256_string: (s: string) => string
//string_from_b58: (b: string) => string
//string_to_b58: (s: string) => string
//END Op
//Kademlia
//defaultId = "kad"
//merge: (target: string, left: string[], right: string[], count: number | null) => string[]
//neighborhood: (key: string, already_hashed: boolean | null, count: number | null) => string[]
//END Kademlia
//Script
//defaultId = "script"
//add: (air_script: string, interval: string | null) => string
//list: () => {failures:number;id:string;interval:string;owner:string;src:string}
//remove: (script_id: string) => boolean
//END Script
//Dist
//defaultId = "dist"
//add_blueprint: (blueprint: {dependencies:string[];name:string}) => string
//add_module: (wasm_b56_content: number[], conf: {name:string}) => string
//add_module_from_vault: (path: string, config: {name:string}) => string
//default_module_config: (module_name: string) => {name:string}
//get_interface: (module_id: string) => {function_signatures:{arguments:string[][];name:string;output_types:string[]}[];record_types:{fields:string[][];id:number;name:string}[]}
//list_blueprints: () => {dependencies:string[];id:string;name:string}[]
//list_modules: () => {config:{name:string};hash:string;name:string}[]
//make_blueprint: (name: string, dependencies: string[]) => {dependencies:string[];name:string}
//make_module_config: (name: string, mem_pages_count: number | null, logger_enabled: boolean | null, preopened_files: string[] | null, envs: string[][] | null, mapped_dirs: string[][] | null, mounted_binaries: string[][] | null, logging_mask: number | null) => {name:string}
//END Dist
// Functions
export async function viaArr(client: FluenceClient, node_id: string, viaAr: string[], config?: {ttl?: number}): Promise<{external_addresses:string[]}> {

View File

@ -0,0 +1,18 @@
import {FluenceClient, registerServiceFunction} from "@fluencelabs/fluence";
import {barfoo, wrap} from "../compiled/examples/imports_exports/import2";
export async function import2Call(client: FluenceClient) {
registerServiceFunction(client, "hello", "more_call", (args: any[], _) => {
return {}
})
registerServiceFunction(client, "ohmygod", "more_call", (args: any[], _) => {
return {}
})
let first = await wrap(client)
let second = await barfoo(client)
return { first, second }
}

View File

@ -30,6 +30,7 @@ import {literalCall} from "./examples/returnLiteralCall";
import {multiReturnCall} from "./examples/multiReturnCall";
import {declareCall} from "./examples/declareCall";
import {subImportCall} from "./examples/subImportUsageCall";
import {import2Call} from "./examples/import2Call";
let deepEqual = require('deep-equal')
function checkCall(name: string, actual: any, expected: any, callBackOnError: () => void) {
@ -154,6 +155,9 @@ const main = async () => {
// subImport.aqua and subImportUsage.aqua
let subImportResult = await subImportCall(client)
// import2.aqua, export2.aqua, OneMore.aqua
let import2Result = await import2Call(client)
await client.disconnect();
let success = true;
@ -215,6 +219,8 @@ const main = async () => {
checkCall("subImportResult", subImportResult, { one: "random_string", two: 42 }, cb)
checkCall("import2Result", import2Result, { first: 'I am MyFooBar foo', second: [ 'I am MyFooBar foo', ' I am MyFooBar bar' ] }, cb)
checkCallBy("tryCatchCall", tryCatchResult, (res) => {
return (res[0] as string).includes("Error: Service with id 'unex' not found") && res[1] === '/ip4/134.209.186.43/tcp/7001'
}, cb)