2022-08-05 17:09:51 +03:00

724 lines
22 KiB
TypeScript

/**
*
* 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.7.4-336
*
*/
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
import {
CallParams,
callFunction,
registerService,
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
// Services
export interface Op1Def {
array_length: (array: string[], callParams: CallParams<'array'>) => number | Promise<number>;
}
export function registerOp1(service: Op1Def): void;
export function registerOp1(serviceId: string, service: Op1Def): void;
export function registerOp1(peer: FluencePeer, service: Op1Def): void;
export function registerOp1(peer: FluencePeer, serviceId: string, service: Op1Def): void;
export function registerOp1(...args: any) {
registerService(
args,
{
"defaultServiceId" : "op",
"functions" : {
"tag" : "labeledProduct",
"fields" : {
"array_length" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"array" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "u32"
}
]
}
}
}
}
}
);
}
// Functions
export function accumRes(
config?: {ttl?: number}
): Promise<string | null[]>;
export function accumRes(
peer: FluencePeer,
config?: {ttl?: number}
): Promise<string | null[]>;
export function accumRes(...args: any) {
let script = `
(xor
(seq
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $str
(seq
(ap "a" $str)
(call %init_peer_id% ("op" "identity") [$str] str-fix)
)
)
)
(ap str-fix $res_accum)
)
(new $str-0
(seq
(ap "b" $str-0)
(call %init_peer_id% ("op" "identity") [$str-0] str-fix-0)
)
)
)
(ap str-fix-0 $res_accum)
)
(ap [] $res_accum)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [$res_accum])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "accumRes",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "array",
"type" : {
"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 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 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] status-fix)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [status-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
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $status
(seq
(ap "ok" $status)
(call %init_peer_id% ("op" "identity") [$status] status-fix)
)
)
)
(new $array-inline
(seq
(seq
(ap status-fix.$.[0]! $array-inline)
(ap status-fix.$.[0]! $array-inline)
)
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
)
)
)
(new $array-inline-1
(seq
(seq
(seq
(ap status-fix.$.[0]! $array-inline-1)
(ap "no" $array-inline-1)
)
(ap status-fix.$.[0]! $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$array-inline-1] array-inline-1-0)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [status-fix.$.[0]! status-fix array-inline-1-0])
(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] status-fix)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [status-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
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $status
(seq
(ap "ok" $status)
(call %init_peer_id% ("op" "identity") [$status] status-fix)
)
)
)
(new $array-inline
(seq
(seq
(ap status-fix.$.[0]! $array-inline)
(ap status-fix.$.[0]! $array-inline)
)
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
)
)
)
(new $array-inline-1
(seq
(seq
(seq
(ap status-fix.$.[0]! $array-inline-1)
(ap "no" $array-inline-1)
)
(ap status-fix.$.[0]! $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$array-inline-1] array-inline-1-0)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [status-fix.$.[0]! status-fix array-inline-0 array-inline-1-0])
(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
)
}
export type BugLNG63_3Result = [string, number, number[]]
export function bugLNG63_3(
config?: {ttl?: number}
): Promise<BugLNG63_3Result>;
export function bugLNG63_3(
peer: FluencePeer,
config?: {ttl?: number}
): Promise<BugLNG63_3Result>;
export function bugLNG63_3(...args: any) {
let script = `
(xor
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(new $num
(seq
(new $status
(seq
(seq
(seq
(ap "ok" $status)
(ap 2 $num)
)
(new $array-inline
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "array_length") [$status] array_length)
(ap array_length $array-inline)
)
(call %init_peer_id% ("op" "identity") [$num.$.[0]!] push-to-stream-24)
)
(ap push-to-stream-24 $array-inline)
)
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
)
)
)
(call %init_peer_id% ("op" "identity") [$status] status-fix)
)
)
(call %init_peer_id% ("op" "identity") [$num] num-fix)
)
)
)
(call %init_peer_id% ("op" "array_length") [status-fix] array_length-0)
)
(new $array-inline-1
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "array_length") [status-fix] array_length-1)
(ap array_length-1 $array-inline-1)
)
(ap 3 $array-inline-1)
)
(ap num-fix.$.[0]! $array-inline-1)
)
(call %init_peer_id% ("op" "identity") [$array-inline-1] array-inline-1-0)
)
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [status-fix.$.[0]! array_length-0 array-inline-1-0])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
`
return callFunction(
args,
{
"functionName" : "bugLNG63_3",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "string"
},
{
"tag" : "scalar",
"name" : "u32"
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "u32"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}