mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-06-24 21:41:47 +00:00
update aqua
This commit is contained in:
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function doSmth(client: FluenceClient, arg: {value:string}, config?: {ttl?: number}): Promise<string[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -62,7 +61,10 @@ export async function doSmth(client: FluenceClient, arg: {value:string}, config?
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for doSmth');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -49,7 +48,10 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for print');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
@ -60,9 +62,8 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
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) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -129,7 +130,10 @@ h.on('callbackSrv', 'c', (args) => {return c(args[0]);});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for passFunctionAsArg');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function helloWorld(client: FluenceClient, name: string, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -59,7 +58,10 @@ export async function helloWorld(client: FluenceClient, name: string, config?: {
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for helloWorld');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
@ -70,9 +72,8 @@ export async function helloWorld(client: FluenceClient, name: string, config?: {
|
||||
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -104,7 +105,10 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for print');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
@ -115,9 +119,8 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
export async function testFunc(client: FluenceClient, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -156,7 +159,10 @@ export async function testFunc(client: FluenceClient, config?: {ttl?: number}):
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for testFunc');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
@ -167,9 +173,8 @@ export async function testFunc(client: FluenceClient, config?: {ttl?: number}):
|
||||
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) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -184,6 +189,7 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
@ -203,11 +209,14 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
|
||||
)
|
||||
(par
|
||||
(par
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("some-id" "t") [str] $stream)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call a ("op" "noop") [])
|
||||
)
|
||||
(call b ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") [a])
|
||||
@ -230,8 +239,11 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call a ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(match c true
|
||||
(xor
|
||||
@ -266,12 +278,17 @@ export async function doStuff(client: FluenceClient, a: string, b: string, c: bo
|
||||
(null)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(call a ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(call %init_peer_id% ("some-id" "multiline") [a b c] $stream)
|
||||
@ -312,7 +329,10 @@ h.on('getDataSrv', 'str', () => {return str;});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for doStuff');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function callConstant(client: FluenceClient, config?: {ttl?: number}): Promise<string[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -59,7 +58,10 @@ export async function callConstant(client: FluenceClient, config?: {ttl?: number
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for callConstant');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function getAliasedData(client: FluenceClient, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -56,7 +55,10 @@ export async function getAliasedData(client: FluenceClient, config?: {ttl?: numb
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for getAliasedData');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function betterMessage(client: FluenceClient, relay: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -72,7 +71,10 @@ export async function betterMessage(client: FluenceClient, relay: string, config
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for betterMessage');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function test(client: FluenceClient, node: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -64,7 +63,10 @@ export async function test(client: FluenceClient, node: string, config?: {ttl?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for test');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -49,7 +48,10 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for print');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
@ -60,9 +62,8 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
export async function iterateAndPrint(client: FluenceClient, strings: string[], config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -99,7 +100,10 @@ export async function iterateAndPrint(client: FluenceClient, strings: string[],
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for iterateAndPrint');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
@ -110,9 +114,8 @@ export async function iterateAndPrint(client: FluenceClient, strings: string[],
|
||||
export async function iterateAndPrintParallel(client: FluenceClient, nodes: string[], c: (arg0: {external_addresses:string[]}) => void, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -165,7 +168,10 @@ h.on('callbackSrv', 'c', (args) => {c(args[0]); return {};});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for iterateAndPrintParallel');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function getTwoResults(client: FluenceClient, relay: string, config?: {ttl?: number}): Promise<number[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<number[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -97,7 +96,10 @@ export async function getTwoResults(client: FluenceClient, relay: string, config
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for getTwoResults');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function testFunc(client: FluenceClient, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -56,7 +55,10 @@ export async function testFunc(client: FluenceClient, config?: {ttl?: number}):
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for testFunc');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function helloWorld(client: FluenceClient, name: string, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -59,7 +58,10 @@ export async function helloWorld(client: FluenceClient, name: string, config?: {
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for helloWorld');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -49,7 +48,10 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for print');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
@ -60,9 +62,8 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
export async function ifElseCall(client: FluenceClient, condition: boolean, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -102,7 +103,10 @@ export async function ifElseCall(client: FluenceClient, condition: boolean, conf
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for ifElseCall');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
@ -113,9 +117,8 @@ export async function ifElseCall(client: FluenceClient, condition: boolean, conf
|
||||
export async function ifElseNumCall(client: FluenceClient, condition: number, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -155,7 +158,10 @@ export async function ifElseNumCall(client: FluenceClient, condition: number, co
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for ifElseNumCall');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function a(client: FluenceClient, b: string, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -59,7 +58,10 @@ export async function a(client: FluenceClient, b: string, config?: {ttl?: number
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for a');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
@ -70,9 +72,8 @@ export async function a(client: FluenceClient, b: string, config?: {ttl?: number
|
||||
export async function d(client: FluenceClient, e: string, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -114,7 +115,10 @@ export async function d(client: FluenceClient, e: string, config?: {ttl?: number
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for d');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function getPeerExternalAddresses(client: FluenceClient, otherNodePeerId: string, config?: {ttl?: number}): Promise<string[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -71,7 +70,10 @@ export async function getPeerExternalAddresses(client: FluenceClient, otherNodeP
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for getPeerExternalAddresses');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
@ -82,9 +84,8 @@ export async function getPeerExternalAddresses(client: FluenceClient, otherNodeP
|
||||
export async function getDistantAddresses(client: FluenceClient, target: string, viaNode: string, config?: {ttl?: number}): Promise<string[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -154,7 +155,10 @@ h.on('getDataSrv', 'viaNode', () => {return viaNode;});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for getDistantAddresses');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function useOptional(client: FluenceClient, opt: string | null, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -67,7 +66,10 @@ export async function useOptional(client: FluenceClient, opt: string | null, con
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for useOptional');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function parFunc(client: FluenceClient, node: string, c: (arg0: {external_addresses:string[]}) => void, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -71,7 +70,10 @@ h.on('callbackSrv', 'c', (args) => {c(args[0]); return {};});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for parFunc');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function print(client: FluenceClient, str: string, config?: {ttl?: number}): Promise<void> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<void>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -49,7 +48,10 @@ export async function print(client: FluenceClient, str: string, config?: {ttl?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for print');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return Promise.race([promise, Promise.resolve()]);
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function checkStreams(client: FluenceClient, ch: string[], config?: {ttl?: number}): Promise<string[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -70,7 +69,10 @@ export async function checkStreams(client: FluenceClient, ch: string[], config?:
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for checkStreams');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function topologyTest(client: FluenceClient, me: string, myRelay: string, friend: string, friendRelay: string, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -101,7 +100,10 @@ h.on('getDataSrv', 'friendRelay', () => {return friendRelay;});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for topologyTest');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function tryCatchTest(client: FluenceClient, node_id: string, config?: {ttl?: number}): Promise<string[]> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string[]>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -80,7 +79,10 @@ export async function tryCatchTest(client: FluenceClient, node_id: string, confi
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for tryCatchTest');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function tryOtherwiseTest(client: FluenceClient, node_id: string, config?: {ttl?: number}): Promise<string> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -74,7 +73,10 @@ export async function tryOtherwiseTest(client: FluenceClient, node_id: string, c
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for tryOtherwiseTest');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
@ -15,9 +15,8 @@ import { RequestFlow } from '@fluencelabs/fluence/dist/internal/RequestFlow';
|
||||
export async function viaArr(client: FluenceClient, node_id: string, viaAr: string[], config?: {ttl?: number}): Promise<{external_addresses:string[]}> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<{external_addresses:string[]}>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -102,7 +101,10 @@ h.on('getDataSrv', 'viaAr', () => {return viaAr;});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for viaArr');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
@ -113,9 +115,8 @@ h.on('getDataSrv', 'viaAr', () => {return viaAr;});
|
||||
export async function viaStream(client: FluenceClient, node_id: string, viaStr: string[], config?: {ttl?: number}): Promise<{external_addresses:string[]}> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<{external_addresses:string[]}>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -208,7 +209,10 @@ h.on('getDataSrv', 'viaStr', () => {return viaStr;});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for viaStream');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
@ -219,9 +223,8 @@ h.on('getDataSrv', 'viaStr', () => {return viaStr;});
|
||||
export async function viaOpt(client: FluenceClient, relay: string, node_id: string, viaOpt: string | null, config?: {ttl?: number}): Promise<{external_addresses:string[]}> {
|
||||
let request: RequestFlow;
|
||||
const promise = new Promise<{external_addresses:string[]}>((resolve, reject) => {
|
||||
request = new RequestFlowBuilder()
|
||||
const r = new RequestFlowBuilder()
|
||||
.disableInjections()
|
||||
.withTTL(config?.ttl || 5000)
|
||||
.withRawScript(
|
||||
`
|
||||
(xor
|
||||
@ -310,7 +313,10 @@ h.on('getDataSrv', 'viaOpt', () => {return viaOpt === null ? [] : [viaOpt];});
|
||||
.handleTimeout(() => {
|
||||
reject('Request timed out for viaOpt');
|
||||
})
|
||||
.build();
|
||||
if(config?.ttl) {
|
||||
r.withTTL(config.ttl)
|
||||
}
|
||||
request = r.build();
|
||||
});
|
||||
await client.initiateFlow(request!);
|
||||
return promise;
|
||||
|
Reference in New Issue
Block a user