mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-06-24 23:21:45 +00:00
update versions, subImport tests
This commit is contained in:
13
aqua/examples/imports_exports/subImport.aqua
Normal file
13
aqua/examples/imports_exports/subImport.aqua
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
alias SomeString : string
|
||||
|
||||
data SomeResult:
|
||||
one: SomeString
|
||||
two: u32
|
||||
|
||||
service SubService("sub_service"):
|
||||
sub(s: SomeString) -> SomeResult
|
||||
|
||||
func subImport() -> SomeResult:
|
||||
res <- SubService.sub("some thing")
|
||||
<- res
|
11
aqua/examples/subImportUsage.aqua
Normal file
11
aqua/examples/subImportUsage.aqua
Normal file
@ -0,0 +1,11 @@
|
||||
import "imports_exports/subImport.aqua"
|
||||
|
||||
service ConcatSubs("concat_subs"):
|
||||
get_some(s: SomeString, sr: SomeResult) -> SomeResult
|
||||
|
||||
func subImportUsage(s: SomeString) -> SomeResult:
|
||||
sr1 <- SubService.sub(s)
|
||||
sr2 <- subImport()
|
||||
result <- ConcatSubs.get_some(sr1.one, sr2)
|
||||
<- result
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.1.14-SNAPSHOT
|
||||
* Aqua version: 0.2.0-SNAPSHOT
|
||||
*
|
||||
*/
|
||||
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
|
||||
|
21
src/examples/subImportUsageCall.ts
Normal file
21
src/examples/subImportUsageCall.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import {FluenceClient, registerServiceFunction} from "@fluencelabs/fluence";
|
||||
import {subImportUsage} from "../compiled/examples/subImportUsage";
|
||||
|
||||
export async function subImportCall(client: FluenceClient) {
|
||||
// helloWorld.aqua
|
||||
registerServiceFunction(client, "sub_service", "sub", (args: any[], _) => {
|
||||
return {
|
||||
one: args[0],
|
||||
two: 42
|
||||
}
|
||||
})
|
||||
|
||||
registerServiceFunction(client, "concat_subs", "get_some", (args: any[], _) => {
|
||||
return {
|
||||
one: args[0],
|
||||
two: args[1].two
|
||||
}
|
||||
})
|
||||
|
||||
return await subImportUsage(client, "random_string");
|
||||
}
|
@ -29,6 +29,7 @@ import {pushToStreamCall} from "./examples/pushToStreamCall";
|
||||
import {literalCall} from "./examples/returnLiteralCall";
|
||||
import {multiReturnCall} from "./examples/multiReturnCall";
|
||||
import {declareCall} from "./examples/declareCall";
|
||||
import {subImportCall} from "./examples/subImportUsageCall";
|
||||
let deepEqual = require('deep-equal')
|
||||
|
||||
function checkCall(name: string, actual: any, expected: any, callBackOnError: () => void) {
|
||||
@ -150,6 +151,9 @@ const main = async () => {
|
||||
// declare.aqua
|
||||
let declareResult = await declareCall(client)
|
||||
|
||||
// subImport.aqua and subImportUsage.aqua
|
||||
let subImportResult = await subImportCall(client)
|
||||
|
||||
await client.disconnect();
|
||||
|
||||
let success = true;
|
||||
@ -209,6 +213,8 @@ const main = async () => {
|
||||
|
||||
checkCall("declareResult", declareResult, 'declare all foodeclare all barsmall_foo', cb)
|
||||
|
||||
checkCall("subImportResult", subImportResult, { one: "random_string", two: 42 }, cb)
|
||||
|
||||
checkCallBy("tryCatchCall", tryCatchResult, (res) => {
|
||||
return (res[0] as string).includes("Error: Service with id 'unex' not found") && res[1] === '/ip4/134.209.186.43/tcp/7001'
|
||||
}, cb)
|
||||
|
Reference in New Issue
Block a user