tests for stream hanging, change node

This commit is contained in:
DieMyst
2022-06-23 13:59:53 +03:00
parent e111d51f17
commit eec1917df6
28 changed files with 622 additions and 173 deletions

View File

@ -48,7 +48,7 @@ func getNeighbours() -> []string:
func bugLNG59() -> string: func bugLNG59() -> string:
on HOST_PEER_ID: on HOST_PEER_ID:
nodes <- getNeighbours() nodes <- getNeighbours()
n = nodes[0] n = nodes[2]
on n: on n:
res <- OpO.identity("some str") res <- OpO.identity("some str")
<- res <- res

View File

@ -1,3 +1,5 @@
export accumRes, bugLNG63, bugLNG63_2
func toOpt(s: string) -> ?string: func toOpt(s: string) -> ?string:
str: *string str: *string
str <<- s str <<- s
@ -10,3 +12,23 @@ func accumRes() -> *?string:
res_accum <- toOpt("b") res_accum <- toOpt("b")
res_accum <<- nil res_accum <<- nil
<- res_accum <- res_accum
func returnCanStream() -> string:
status: *string
status <<- "ok"
stat = status!
<- stat
func bugLNG63() -> string:
res <- returnCanStream()
<- res
func returnMultipleStreamResults() -> string, []string, []string, []string:
status: *string
status <<- "ok"
stat = status!
<- stat, status, [status!, status!], [status!, "no", status!]
func bugLNG63_2() -> string, []string, []string:
res, res2, res3, res4 <- returnMultipleStreamResults()
<- res, res2, res4

View File

@ -30,7 +30,7 @@ import { declareCall } from '../examples/declareCall';
import { genOptions } from '../examples/optionsCall'; import { genOptions } from '../examples/optionsCall';
import { config } from '../config'; import { config } from '../config';
import {closuresCall} from "../examples/closures"; import {closuresCall} from "../examples/closures";
import {streamCanCall} from "../examples/streamCan"; import {bugLNG63Call, streamCanCall} from "../examples/streamCanCall";
import {streamCallbackCall} from "../examples/streamCallback"; import {streamCallbackCall} from "../examples/streamCallback";
import {streamResCall} from "../examples/streamRestrictionsCall"; import {streamResCall} from "../examples/streamRestrictionsCall";
import {joinIdxCall, joinIdxLocalCall, joinIdxRelayCall} from "../examples/joinCall"; import {joinIdxCall, joinIdxLocalCall, joinIdxRelayCall} from "../examples/joinCall";
@ -183,6 +183,16 @@ describe('Testing examples', () => {
expect(streamCanResult).toEqual(["a", "b", null]); expect(streamCanResult).toEqual(["a", "b", null]);
}); });
//it('streamCan.aqua LNG-63', async () => {
// let result = await bugLNG63Call();
// expect(result).toEqual(["a", "b", null]);
//});
//
//it('streamCan.aqua LNG-63 2', async () => {
// let result = await bugLNG63Call();
// expect(result).toEqual(["a", "b", null]);
//});
it('collectionSugar array', async () => { it('collectionSugar array', async () => {
let result = await arraySugarCall(); let result = await arraySugarCall();
expect(result).toEqual([[1,2,3], [4,5,6]]); expect(result).toEqual([[1,2,3], [4,5,6]]);

View File

@ -114,7 +114,7 @@ export function closureBig(...args: any) {
(ap p2Info.$.external_addresses.[0]! $p2Id-0) (ap p2Info.$.external_addresses.[0]! $p2Id-0)
) )
) )
(call %init_peer_id% ("op" "identity") [$p2Id-0.$.[0]!] p2Id-fix) (call %init_peer_id% ("op" "identity") [$p2Id-0.$.[0]!] p2Id-fix-0)
) )
) )
) )
@ -145,7 +145,7 @@ export function closureBig(...args: any) {
(ap p2Info-0.$.external_addresses.[0]! $p2Id) (ap p2Info-0.$.external_addresses.[0]! $p2Id)
) )
) )
(call peer2 ("op" "identity") [$p2Id.$.[0]!] p2Id-fix-0) (call peer2 ("op" "identity") [$p2Id.$.[0]!] p2Id-fix-0-0)
) )
) )
(call -relay- ("op" "noop") []) (call -relay- ("op" "noop") [])
@ -157,7 +157,7 @@ export function closureBig(...args: any) {
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [p2Id-fix p2Id-fix-0]) (call %init_peer_id% ("callbackSrv" "response") [p2Id-fix-0 p2Id-fix-0-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 5])
) )
) )

View File

@ -117,15 +117,15 @@ export function streamSugar(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$stream-inline] arr-fix) (call %init_peer_id% ("op" "identity") [$stream-inline] $arr-fix-0)
) )
) )
(call %init_peer_id% ("op" "identity") [$str] str-fix) (call %init_peer_id% ("op" "identity") [$str] $str-fix-1)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [arr-fix str-fix]) (call %init_peer_id% ("callbackSrv" "response") [$arr-fix-0 $str-fix-1])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -307,12 +307,12 @@ export function optionSugar(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$str] str-fix) (call %init_peer_id% ("op" "identity") [$str] $str-fix-1)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [option-inline-0 str-fix option-inline-1-0]) (call %init_peer_id% ("callbackSrv" "response") [option-inline-0 $str-fix-1 option-inline-1-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -422,17 +422,17 @@ export function emptySugar(...args: any) {
(new $strArr (new $strArr
(seq (seq
(new $numOp (new $numOp
(call %init_peer_id% ("op" "identity") [[]] numOp-fix) (call %init_peer_id% ("op" "identity") [[]] $numOp-fix-0)
) )
(call %init_peer_id% ("op" "identity") [[]] strArr-fix) (call %init_peer_id% ("op" "identity") [[]] $strArr-fix-1)
) )
) )
(call %init_peer_id% ("op" "identity") [[]] strStream-fix) (call %init_peer_id% ("op" "identity") [[]] $strStream-fix-2)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [numOp-fix strArr-fix strStream-fix $strEmptyStream [] [] []]) (call %init_peer_id% ("callbackSrv" "response") [$numOp-fix-0 $strArr-fix-1 $strStream-fix-2 $strEmptyStream [] [] []])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -730,12 +730,12 @@ export function arraySugar(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$str] str-fix) (call %init_peer_id% ("op" "identity") [$str] $str-fix-1)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [array-inline-0 str-fix]) (call %init_peer_id% ("callbackSrv" "response") [array-inline-0 $str-fix-1])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -221,12 +221,12 @@ export function doStuff(...args: any) {
) )
(call %init_peer_id% ("some-id" "multiline") [a b c] $stream) (call %init_peer_id% ("some-id" "multiline") [a b c] $stream)
) )
(call %init_peer_id% ("op" "identity") [$stream] stream-fix) (call %init_peer_id% ("op" "identity") [$stream] $stream-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [stream-fix]) (call %init_peer_id% ("callbackSrv" "response") [$stream-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 6])
) )
) )

View File

@ -237,12 +237,12 @@ export function callConstant(...args: any) {
(call %init_peer_id% ("test" "createStr") [5] $res) (call %init_peer_id% ("test" "createStr") [5] $res)
(call %init_peer_id% ("op" "identity") ["default-str"] $res) (call %init_peer_id% ("op" "identity") ["default-str"] $res)
) )
(call %init_peer_id% ("op" "identity") [$res] res-fix) (call %init_peer_id% ("op" "identity") [$res] $res-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res-fix]) (call %init_peer_id% ("callbackSrv" "response") [$res-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -317,12 +317,12 @@ export function forBug499(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$numbers] numbers-fix) (call %init_peer_id% ("op" "identity") [$numbers] $numbers-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [numbers-fix]) (call %init_peer_id% ("callbackSrv" "response") [$numbers-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -87,12 +87,12 @@ export function getTwoResults(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$res] res-fix) (call %init_peer_id% ("op" "identity") [$res] $res-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res-fix]) (call %init_peer_id% ("callbackSrv" "response") [$res-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
) )
) )

View File

@ -243,12 +243,12 @@ export function ifCorrectXorWrap(...args: any) {
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
(call %init_peer_id% ("op" "identity") [$service_id.$.[0]!] service_id-fix) (call %init_peer_id% ("op" "identity") [$service_id.$.[0]!] service_id-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [service_id-fix]) (call %init_peer_id% ("callbackSrv" "response") [service_id-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )

View File

@ -41,12 +41,12 @@ export function barfoo(...args: any) {
(ap "I am MyFooBar foo" $res) (ap "I am MyFooBar foo" $res)
(ap " I am MyFooBar bar" $res) (ap " I am MyFooBar bar" $res)
) )
(call %init_peer_id% ("op" "identity") [$res] res-fix) (call %init_peer_id% ("op" "identity") [$res] $res-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res-fix]) (call %init_peer_id% ("callbackSrv" "response") [$res-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -59,12 +59,12 @@ export function joinIdxLocal(...args: any) {
) )
(call %init_peer_id% ("op" "noop") [$nodes2.$.[idx]! nodes]) (call %init_peer_id% ("op" "noop") [$nodes2.$.[idx]! nodes])
) )
(call %init_peer_id% ("op" "identity") [$nodes2] nodes2-fix) (call %init_peer_id% ("op" "identity") [$nodes2] $nodes2-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [nodes2-fix]) (call %init_peer_id% ("callbackSrv" "response") [$nodes2-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -165,12 +165,12 @@ export function joinIdxRelay(...args: any) {
) )
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
(call %init_peer_id% ("op" "identity") [$nodes2] nodes2-fix) (call %init_peer_id% ("op" "identity") [$nodes2] $nodes2-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [nodes2-fix]) (call %init_peer_id% ("callbackSrv" "response") [$nodes2-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )
@ -287,13 +287,13 @@ export function joinIdx(...args: any) {
) )
(call %init_peer_id% ("op" "noop") [$infos.$.[idx]! $nodes2.$.[idx]!]) (call %init_peer_id% ("op" "noop") [$infos.$.[idx]! $nodes2.$.[idx]!])
) )
(call %init_peer_id% ("op" "identity") [$infos] infos-fix) (call %init_peer_id% ("op" "identity") [$infos] $infos-fix-0)
) )
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [infos-fix]) (call %init_peer_id% ("callbackSrv" "response") [$infos-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )

View File

@ -144,12 +144,12 @@ export function multiReturnFunc(...args: any) {
) )
(ap str $res) (ap str $res)
) )
(call %init_peer_id% ("op" "identity") [$res] res-fix) (call %init_peer_id% ("op" "identity") [$res] $res-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res-fix 5 "some-str" somethingToReturn smthOption n]) (call %init_peer_id% ("callbackSrv" "response") [$res-fix-0 5 "some-str" somethingToReturn smthOption n])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -148,12 +148,12 @@ export function returnNone(...args: any) {
(new $result (new $result
(seq (seq
(call %init_peer_id% ("op" "noop") []) (call %init_peer_id% ("op" "noop") [])
(call %init_peer_id% ("op" "identity") [$result] result-fix) (call %init_peer_id% ("op" "identity") [$result] $result-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [result-fix]) (call %init_peer_id% ("callbackSrv" "response") [$result-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -84,10 +84,10 @@ export function checkEmpty(...args: any) {
(seq (seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $valueEmpty (new $valueEmpty
(call %init_peer_id% ("op" "identity") [$valueEmpty] valueEmpty-fix) (call %init_peer_id% ("op" "identity") [$valueEmpty] $valueEmpty-fix-0)
) )
) )
(call %init_peer_id% ("opt_str" "checkOption") [valueEmpty-fix] res) (call %init_peer_id% ("opt_str" "checkOption") [$valueEmpty-fix-0] res)
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res]) (call %init_peer_id% ("callbackSrv" "response") [res])
@ -152,11 +152,11 @@ export function emptyString(...args: any) {
(seq (seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $valueEmpty (new $valueEmpty
(call %init_peer_id% ("op" "identity") [$valueEmpty] valueEmpty-fix) (call %init_peer_id% ("op" "identity") [$valueEmpty] $valueEmpty-fix-0)
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [valueEmpty-fix]) (call %init_peer_id% ("callbackSrv" "response") [$valueEmpty-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -229,11 +229,11 @@ export function checkNoneEmpty(...args: any) {
(new $valueEmpty (new $valueEmpty
(seq (seq
(ap str $valueEmpty) (ap str $valueEmpty)
(call %init_peer_id% ("op" "identity") [$valueEmpty] valueEmpty-fix) (call %init_peer_id% ("op" "identity") [$valueEmpty] $valueEmpty-fix-0)
) )
) )
) )
(call %init_peer_id% ("opt_str" "checkOption") [valueEmpty-fix] res) (call %init_peer_id% ("opt_str" "checkOption") [$valueEmpty-fix-0] res)
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res]) (call %init_peer_id% ("callbackSrv" "response") [res])
@ -308,12 +308,12 @@ export function stringAsOption(...args: any) {
(new $valueEmpty (new $valueEmpty
(seq (seq
(ap str $valueEmpty) (ap str $valueEmpty)
(call %init_peer_id% ("op" "identity") [$valueEmpty] valueEmpty-fix) (call %init_peer_id% ("op" "identity") [$valueEmpty] $valueEmpty-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [valueEmpty-fix]) (call %init_peer_id% ("callbackSrv" "response") [$valueEmpty-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -252,12 +252,12 @@ export function testTimeout(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] status-fix) (call %init_peer_id% ("op" "identity") [$status.$.[0]!] status-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [status-fix]) (call %init_peer_id% ("callbackSrv" "response") [status-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
) )
) )

View File

@ -82,12 +82,12 @@ export function get_results(...args: any) {
) )
(ap str $results) (ap str $results)
) )
(call %init_peer_id% ("op" "identity") [$results] results-fix) (call %init_peer_id% ("op" "identity") [$results] $results-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [results-fix]) (call %init_peer_id% ("callbackSrv" "response") [$results-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -97,15 +97,15 @@ export function recursiveStream(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$result] result-fix) (call %init_peer_id% ("op" "identity") [$result] $result-fix-0)
) )
) )
(call %init_peer_id% ("op" "identity") [$loop] loop-fix) (call %init_peer_id% ("op" "identity") [$loop] $loop-fix-1)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [result-fix loop-fix]) (call %init_peer_id% ("callbackSrv" "response") [$result-fix-0 $loop-fix-1])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )

View File

@ -80,11 +80,11 @@ export function returnNone(...args: any) {
(seq (seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $valueNone (new $valueNone
(call %init_peer_id% ("op" "identity") [$valueNone] valueNone-fix) (call %init_peer_id% ("op" "identity") [$valueNone] $valueNone-fix-0)
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [valueNone-fix]) (call %init_peer_id% ("callbackSrv" "response") [$valueNone-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -149,11 +149,11 @@ export function stringNone(...args: any) {
(seq (seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $valueNone (new $valueNone
(call %init_peer_id% ("op" "identity") [$valueNone] valueNone-fix) (call %init_peer_id% ("op" "identity") [$valueNone] $valueNone-fix-0)
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [valueNone-fix]) (call %init_peer_id% ("callbackSrv" "response") [$valueNone-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -370,12 +370,12 @@ export function checkStreams(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$stream] stream-fix) (call %init_peer_id% ("op" "identity") [$stream] $stream-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [stream-fix]) (call %init_peer_id% ("callbackSrv" "response") [$stream-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -173,12 +173,12 @@ export function retrieve_records(...args: any) {
(new $records (new $records
(seq (seq
(call %init_peer_id% ("test-service" "get_records") [peer] $records) (call %init_peer_id% ("test-service" "get_records") [peer] $records)
(call %init_peer_id% ("op" "identity") [$records] records-fix) (call %init_peer_id% ("op" "identity") [$records] $records-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [records-fix]) (call %init_peer_id% ("callbackSrv" "response") [$records-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -19,86 +19,6 @@ import {
// Functions // Functions
export function toOpt(
s: string,
config?: {ttl?: number}
): Promise<string | null>;
export function toOpt(
peer: FluencePeer,
s: string,
config?: {ttl?: number}
): Promise<string | null>;
export function toOpt(...args: any) {
let script = `
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "s") [] s)
)
(new $str
(seq
(ap s $str)
(call %init_peer_id% ("op" "identity") [$str] str-fix)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [str-fix])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "toOpt",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"s" : {
"tag" : "scalar",
"name" : "string"
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "option",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export function accumRes( export function accumRes(
config?: {ttl?: number} config?: {ttl?: number}
): Promise<string | null[]>; ): Promise<string | null[]>;
@ -118,24 +38,30 @@ export function accumRes(...args: any) {
(seq (seq
(seq (seq
(seq (seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) (seq
(new $str
(seq (seq
(ap "a" $str) (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("op" "identity") [$str] str-fix) (new $str
(seq
(ap "a" $str)
(call %init_peer_id% ("op" "identity") [$str] $str-fix-0)
)
)
) )
(call %init_peer_id% ("op" "identity") [$str-fix-0] push-to-stream-10)
)
(ap push-to-stream-10 $res_accum)
)
(new $str-0
(seq
(ap "b" $str-0)
(call %init_peer_id% ("op" "identity") [$str-0] $str-fix-0-0)
) )
) )
(ap str-fix $res_accum)
)
(new $str-0
(seq
(ap "b" $str-0)
(call %init_peer_id% ("op" "identity") [$str-0] str-fix-0)
)
) )
(call %init_peer_id% ("op" "identity") [$str-fix-0-0] push-to-stream-17)
) )
(ap str-fix-0 $res_accum) (ap push-to-stream-17 $res_accum)
) )
(ap [] $res_accum) (ap [] $res_accum)
) )
@ -188,3 +114,486 @@ export function accumRes(...args: any) {
script script
) )
} }
export function toOpt(
s: string,
config?: {ttl?: number}
): Promise<string | null>;
export function toOpt(
peer: FluencePeer,
s: string,
config?: {ttl?: number}
): Promise<string | null>;
export function toOpt(...args: any) {
let script = `
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "s") [] s)
)
(new $str
(seq
(ap s $str)
(call %init_peer_id% ("op" "identity") [$str] $str-fix-0)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [$str-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "toOpt",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"s" : {
"tag" : "scalar",
"name" : "string"
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "option",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export function returnCanStream(
config?: {ttl?: number}
): Promise<string>;
export function returnCanStream(
peer: FluencePeer,
config?: {ttl?: number}
): Promise<string>;
export function returnCanStream(...args: any) {
let script = `
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $status
(seq
(ap "ok" $status)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] stat-fix-0)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [stat-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "returnCanStream",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "string"
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export type BugLNG63_2Result = [string, string[], string[]]
export function bugLNG63_2(
config?: {ttl?: number}
): Promise<BugLNG63_2Result>;
export function bugLNG63_2(
peer: FluencePeer,
config?: {ttl?: number}
): Promise<BugLNG63_2Result>;
export function bugLNG63_2(...args: any) {
let script = `
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $status
(seq
(seq
(seq
(seq
(seq
(seq
(ap "ok" $status)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] stat-fix-0)
)
(call %init_peer_id% ("op" "identity") [$status] $status-fix-1)
)
(new $array-inline
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-18)
(ap push-to-stream-18 $array-inline)
)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-19)
)
(ap push-to-stream-19 $array-inline)
)
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
)
)
)
(call %init_peer_id% ("op" "identity") [array-inline-0] status-fix-2)
)
(new $array-inline-1
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-24)
(ap push-to-stream-24 $array-inline-1)
)
(ap "no" $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-26)
)
(ap push-to-stream-26 $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$array-inline-1] array-inline-1-0)
)
)
)
(call %init_peer_id% ("op" "identity") [array-inline-1-0] status-fix-3)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [stat-fix-0 $status-fix-1 status-fix-3])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "bugLNG63_2",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "string"
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export function bugLNG63(
config?: {ttl?: number}
): Promise<string>;
export function bugLNG63(
peer: FluencePeer,
config?: {ttl?: number}
): Promise<string>;
export function bugLNG63(...args: any) {
let script = `
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $status
(seq
(ap "ok" $status)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] stat-fix-0)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [stat-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "bugLNG63",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "string"
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}
export type ReturnMultipleStreamResultsResult = [string, string[], string[], string[]]
export function returnMultipleStreamResults(
config?: {ttl?: number}
): Promise<ReturnMultipleStreamResultsResult>;
export function returnMultipleStreamResults(
peer: FluencePeer,
config?: {ttl?: number}
): Promise<ReturnMultipleStreamResultsResult>;
export function returnMultipleStreamResults(...args: any) {
let script = `
(xor
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $status
(seq
(seq
(seq
(seq
(seq
(seq
(ap "ok" $status)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] stat-fix-0)
)
(call %init_peer_id% ("op" "identity") [$status] $status-fix-1)
)
(new $array-inline
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-18)
(ap push-to-stream-18 $array-inline)
)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-19)
)
(ap push-to-stream-19 $array-inline)
)
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
)
)
)
(call %init_peer_id% ("op" "identity") [array-inline-0] status-fix-2)
)
(new $array-inline-1
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-24)
(ap push-to-stream-24 $array-inline-1)
)
(ap "no" $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$status.$.[0]!] push-to-stream-26)
)
(ap push-to-stream-26 $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$array-inline-1] array-inline-1-0)
)
)
)
(call %init_peer_id% ("op" "identity") [array-inline-1-0] status-fix-3)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [stat-fix-0 $status-fix-1 status-fix-2 status-fix-3])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "returnMultipleStreamResults",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "string"
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}

View File

@ -48,12 +48,12 @@ export function streamFold(...args: any) {
(next n-0) (next n-0)
) )
) )
(call %init_peer_id% ("op" "identity") [$res] res-fix) (call %init_peer_id% ("op" "identity") [$res] $res-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res-fix]) (call %init_peer_id% ("callbackSrv" "response") [$res-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
@ -138,15 +138,15 @@ export function streamRes(...args: any) {
(next n-0) (next n-0)
) )
) )
(call %init_peer_id% ("op" "identity") [$res-0] res-fix-0) (call %init_peer_id% ("op" "identity") [$res-0] $res-fix-0-0)
) )
) )
(call %init_peer_id% ("op" "identity") [$res] res-fix) (call %init_peer_id% ("op" "identity") [$res] $res-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [res-fix res-fix-0]) (call %init_peer_id% ("callbackSrv" "response") [$res-fix-0 $res-fix-0-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -180,12 +180,12 @@ export function use_name2(...args: any) {
) )
(ap results-2.$.field! $results) (ap results-2.$.field! $results)
) )
(call %init_peer_id% ("op" "identity") [$results] results-fix) (call %init_peer_id% ("op" "identity") [$results] $results-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [results-fix]) (call %init_peer_id% ("callbackSrv" "response") [$results-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )

View File

@ -245,12 +245,12 @@ export function topologyBug427(...args: any) {
) )
(call %init_peer_id% ("op" "noop") [$results.$.[1]!]) (call %init_peer_id% ("op" "noop") [$results.$.[1]!])
) )
(call %init_peer_id% ("op" "identity") [$results] results-fix) (call %init_peer_id% ("op" "identity") [$results] $results-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [results-fix]) (call %init_peer_id% ("callbackSrv" "response") [$results-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )
@ -374,12 +374,12 @@ export function topologyBug205(...args: any) {
) )
) )
) )
(call %init_peer_id% ("op" "identity") [$nodes] nodes-fix) (call %init_peer_id% ("op" "identity") [$nodes] $nodes-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [nodes-fix]) (call %init_peer_id% ("callbackSrv" "response") [$nodes-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
) )
) )

View File

@ -148,12 +148,12 @@ export function tryCatchTest(...args: any) {
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
(call %init_peer_id% ("op" "identity") [$f] f-fix) (call %init_peer_id% ("op" "identity") [$f] $f-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [f-fix]) (call %init_peer_id% ("callbackSrv" "response") [$f-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )

View File

@ -142,12 +142,12 @@ export function tryOtherwiseTest(...args: any) {
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
) )
) )
(call %init_peer_id% ("op" "identity") [$f.$.[0]!] f-fix) (call %init_peer_id% ("op" "identity") [$f.$.[0]!] f-fix-0)
) )
) )
) )
(xor (xor
(call %init_peer_id% ("callbackSrv" "response") [f-fix]) (call %init_peer_id% ("callbackSrv" "response") [f-fix-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
) )
) )

View File

@ -1,5 +0,0 @@
import {accumRes} from "../compiled/examples/streamCan";
export async function streamCanCall() {
return await accumRes();
}

View File

@ -0,0 +1,13 @@
import {accumRes, bugLNG63, bugLNG63_2} from "../compiled/examples/streamCan";
export async function streamCanCall() {
return await accumRes();
}
export async function bugLNG63Call() {
return await bugLNG63();
}
export async function bugLNG63_2Call() {
return await bugLNG63_2();
}