mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-06-22 07:51:41 +00:00
update topology
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import "builtin.aqua"
|
||||
|
||||
service Testo("testo"):
|
||||
getString: string -> string
|
||||
|
||||
@ -8,5 +10,6 @@ service LocalPrint("lp"):
|
||||
func topologyTest(me: string, myRelay: string, friend: string, friendRelay: string) -> string:
|
||||
on friend via friendRelay:
|
||||
str2 <- Testo.getString("friends string via")
|
||||
par LocalPrint.print(str2)
|
||||
par LocalPrint.print("my string in par")
|
||||
LocalPrint.print(str2)
|
||||
<- "finish"
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -22,7 +23,10 @@ export async function id(client: FluenceClient): Promise<void> {
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function print(client: FluenceClient, str: string): Promise<void> {
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -69,7 +73,10 @@ export async function id(client: FluenceClient): Promise<void> {
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -109,6 +116,13 @@ export async function passFunctionAsArg(client: FluenceClient, node: string, str
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -117,30 +131,26 @@ export async function passFunctionAsArg(client: FluenceClient, node: string, str
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "str") [] str)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
)
|
||||
(call node ("peer" "identify") [])
|
||||
(seq
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "c") [str] init_call_res)
|
||||
)
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call node ("peer" "identify") [])
|
||||
)
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [init_call_res])
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -28,7 +29,10 @@ export async function helloWorld(client: FluenceClient, name: string): Promise<s
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -79,7 +83,10 @@ export async function print(client: FluenceClient, str: string): Promise<void> {
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -123,7 +130,10 @@ export async function id(client: FluenceClient): Promise<void> {
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -170,7 +180,10 @@ export async function testFunc(client: FluenceClient): Promise<string> {
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -225,15 +238,21 @@ export async function doStuff(client: FluenceClient, a: string): Promise<string>
|
||||
(call %init_peer_id% ("test-service-id" "str") [] str)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call a ("peer" "identify") [])
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function print(client: FluenceClient, str: string): Promise<void> {
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -66,18 +70,27 @@ export async function callConstant(client: FluenceClient, cb: (arg0: string) =>
|
||||
`
|
||||
(xor
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("test" "getNum") [] n)
|
||||
)
|
||||
(xor
|
||||
(match n 1
|
||||
(call %init_peer_id% ("callbackSrv" "cb") ["non-default string"])
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("callbackSrv" "cb") ["non-default string"])
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function getAliasedData(client: FluenceClient): Promise<string> {
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res.$.peerId!])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function print(client: FluenceClient, str: string): Promise<void> {
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -69,7 +73,10 @@ export async function id(client: FluenceClient): Promise<void> {
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -121,7 +128,10 @@ export async function iterateAndPrint(client: FluenceClient, strings: string[]):
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -169,20 +179,26 @@ export async function iterateAndPrintParallel(client: FluenceClient, nodes: stri
|
||||
(fold nodes s
|
||||
(par
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call s ("peer" "identify") [] ads)
|
||||
(seq
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "c") [ads])
|
||||
)
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(next s)
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function testFunc(client: FluenceClient): Promise<string> {
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -28,7 +29,10 @@ export async function helloWorld(client: FluenceClient, name: string): Promise<s
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function print(client: FluenceClient, str: string): Promise<void> {
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -77,7 +81,10 @@ export async function ifElseCall(client: FluenceClient, condition: boolean): Pro
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is false"])
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -129,7 +136,10 @@ export async function ifElseNumCall(client: FluenceClient, condition: number): P
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is not 1"])
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -22,7 +23,10 @@ export async function id(client: FluenceClient): Promise<void> {
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -64,21 +68,24 @@ export async function getPeerExternalAddresses(client: FluenceClient, otherNodeP
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("getDataSrv" "otherNodePeerId") [] otherNodePeerId)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call otherNodePeerId ("peer" "identify") [] res)
|
||||
)
|
||||
(call otherNodePeerId ("peer" "identify") [] res)
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res.$.external_addresses!])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -125,6 +132,8 @@ export async function getDistantAddresses(client: FluenceClient, target: string,
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
@ -133,21 +142,22 @@ export async function getDistantAddresses(client: FluenceClient, target: string,
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "viaNode") [] viaNode)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call viaNode ("op" "identity") [])
|
||||
)
|
||||
(call target ("peer" "identify") [] res)
|
||||
)
|
||||
)
|
||||
(call viaNode ("op" "identity") [])
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res.$.external_addresses!])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -22,7 +23,10 @@ export async function id(client: FluenceClient): Promise<void> {
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
@ -71,20 +75,26 @@ export async function parFunc(client: FluenceClient, node: string, c: (arg0: {ex
|
||||
(par
|
||||
(call %init_peer_id% ("parservice-id" "call") [] y)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call node ("peer" "identify") [] t)
|
||||
(seq
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "c") [t])
|
||||
)
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("parservice-id" "call") [] x)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
@ -3,6 +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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
@ -25,7 +26,10 @@ export async function print(client: FluenceClient, str: string): Promise<void> {
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [str])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
|
79
src/compiled/stream.ts
Normal file
79
src/compiled/stream.ts
Normal file
@ -0,0 +1,79 @@
|
||||
/**
|
||||
*
|
||||
* 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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
import { RequestFlowBuilder } from '@fluencelabs/fluence/dist/api.unstable';
|
||||
|
||||
|
||||
|
||||
export async function checkStreams(client: FluenceClient, ch: string[]): Promise<string[]> {
|
||||
let request;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("getDataSrv" "ch") [] ch)
|
||||
)
|
||||
(call %init_peer_id% ("stringer-id" "returnString") ["first"] $stream)
|
||||
)
|
||||
(call %init_peer_id% ("stringer-id" "returnString") ["second"] $stream)
|
||||
)
|
||||
(fold ch b
|
||||
(seq
|
||||
(call %init_peer_id% ("stringer-id" "returnString") [b] $stream)
|
||||
(next b)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") [$stream])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
)
|
||||
.configHandler((h) => {
|
||||
h.on('getDataSrv', 'relay', () => {
|
||||
return client.relayPeerId!;
|
||||
});
|
||||
h.on('getRelayService', 'hasRelay', () => {// Not Used
|
||||
return client.relayPeerId !== undefined;
|
||||
});
|
||||
h.on('getDataSrv', 'ch', () => {return ch;});
|
||||
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 checkStreams');
|
||||
})
|
||||
.build();
|
||||
});
|
||||
await client.initiateFlow(request);
|
||||
return promise;
|
||||
}
|
||||
|
145
src/compiled/topology.ts
Normal file
145
src/compiled/topology.ts
Normal file
@ -0,0 +1,145 @@
|
||||
/**
|
||||
*
|
||||
* 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.1.1-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
import { RequestFlowBuilder } from '@fluencelabs/fluence/dist/api.unstable';
|
||||
|
||||
|
||||
|
||||
export async function id(client: FluenceClient): Promise<void> {
|
||||
let request;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("op" "identity") [])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
)
|
||||
.configHandler((h) => {
|
||||
h.on('getDataSrv', 'relay', () => {
|
||||
return client.relayPeerId!;
|
||||
});
|
||||
h.on('getRelayService', 'hasRelay', () => {// Not Used
|
||||
return client.relayPeerId !== undefined;
|
||||
});
|
||||
|
||||
|
||||
h.onEvent('errorHandlingSrv', 'error', (args) => {
|
||||
// assuming error is the single argument
|
||||
const [err] = args;
|
||||
reject(err);
|
||||
});
|
||||
})
|
||||
.handleScriptError(reject)
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for id');
|
||||
})
|
||||
.build();
|
||||
});
|
||||
await client.initiateFlow(request);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export async function topologyTest(client: FluenceClient, me: string, myRelay: string, friend: string, friendRelay: string): Promise<string> {
|
||||
let request;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
|
||||
(call %init_peer_id% ("getDataSrv" "me") [] me)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "myRelay") [] myRelay)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "friend") [] friend)
|
||||
)
|
||||
(call %init_peer_id% ("getDataSrv" "friendRelay") [] friendRelay)
|
||||
)
|
||||
(par
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call friendRelay ("op" "identity") [])
|
||||
)
|
||||
(call friend ("testo" "getString") ["friends string via"] str2)
|
||||
)
|
||||
(call friendRelay ("op" "identity") [])
|
||||
)
|
||||
(call relay ("op" "identity") [])
|
||||
)
|
||||
(call %init_peer_id% ("lp" "print") ["my string in par"])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("lp" "print") [str2])
|
||||
)
|
||||
(call %init_peer_id% ("callbackSrv" "response") ["finish"])
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error%])
|
||||
)
|
||||
)
|
||||
|
||||
`,
|
||||
)
|
||||
.configHandler((h) => {
|
||||
h.on('getDataSrv', 'relay', () => {
|
||||
return client.relayPeerId!;
|
||||
});
|
||||
h.on('getRelayService', 'hasRelay', () => {// Not Used
|
||||
return client.relayPeerId !== undefined;
|
||||
});
|
||||
h.on('getDataSrv', 'me', () => {return me;});
|
||||
h.on('getDataSrv', 'myRelay', () => {return myRelay;});
|
||||
h.on('getDataSrv', 'friend', () => {return friend;});
|
||||
h.on('getDataSrv', 'friendRelay', () => {return friendRelay;});
|
||||
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 topologyTest');
|
||||
})
|
||||
.build();
|
||||
});
|
||||
await client.initiateFlow(request);
|
||||
return promise;
|
||||
}
|
||||
|
Reference in New Issue
Block a user