From 56f2d1d094fce2a571e90458c9d2bd5109b49d2a Mon Sep 17 00:00:00 2001 From: gitbook-bot Date: Mon, 27 Jun 2022 12:55:59 +0000 Subject: [PATCH] GitBook: [#142] 0.7.4 --- aqua-cli/README.md | 27 ++++++++++++++++++++++++++- changelog.md | 10 ++++++++-- language/flow/conditional.md | 10 ++++++---- language/flow/sequential.md | 15 +++++++++++---- 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/aqua-cli/README.md b/aqua-cli/README.md index 354ad21..5f7af8a 100644 --- a/aqua-cli/README.md +++ b/aqua-cli/README.md @@ -67,7 +67,7 @@ func hello(name: string, node:string, sid: string) -> string: We instantiate our aqua client peer: ```bash -aqua run --addr /dns4/.../wss/p2p/12D3 ...aoHI --input some-dir/hello.aqua --func 'hello("reader", "peer id", "service id")' +aqua run --addr /dns4/.../wss/p2p/12D3 ...aoHI --input some-dir/hello.aqua --func 'hello("reader", "peer id", ["service id1", "service id2"])' ``` The `aqua run` command provides additional features such as: @@ -83,6 +83,31 @@ The `aqua run` command provides additional features such as: aqua run --addr /dns4/.../wss/p2p/12D3 ... oHI --input my_code.aqua --func 'my_aqua_func(a, b)' --data '{"a": "some_string", "b": 123}' ``` * `--data-path` or `p` allows you to specify data arguments, see `--data`, as a file. _Note that `--data` and `--data-path` are mutually exclusive._ +* `--json-service` or `-j` allows you to describe a service that will return a JSON. This service must be described in Aqua. There can be multiple functions strictly without any arguments. Also, you can use this flag multiple times targeting multiple services in different files. There is an example of a service description in Aqua and JSON: + +``` +-- aqua file +data SomeResult: + field1: string + num2: i32 + +service ServiceName("some id"): + funcName: -> SomeResult +``` + +``` +{ + "name": "ServiceName", + "serviceId": "some id", + "functions": [{ + "name": "funcName", + "result": { + "field1": "result 1", + "num2": 5 + } + }] +} +``` Use `aqua run --help` for a complete listing of available flags and explanations. diff --git a/changelog.md b/changelog.md index a82cfe6..f05af74 100644 --- a/changelog.md +++ b/changelog.md @@ -5,9 +5,15 @@ Aqua compiler's versioning scheme is the following: `0.BREAKING.ENHANCING.RELEAS * `0` shows that Aqua does not meet its vision yet, so syntax and semantics can change quickly * `BREAKING` part is incremented for each breaking change when old `.aqua` files need to be updated to compile with the new version * `ENHANCING` part is incremented for every syntax addition -* `RELEASE` is the release number, shows internal compiler changes, bugfixes that keep the language untouched +* `RELEASE` is the release number, shows internal compiler changes, bugfixes that keep the language untouched\ -### [0.7.3](https://github.com/fluencelabs/aqua/releases/tag/0.7.2) – June 10, 2022 + +### [0.7.4](https://github.com/fluencelabs/aqua/releases/tag/0.7.4) – June 24, 2022 + +* JSON services for `aqua run.` Read [here](https://doc.fluence.dev/aqua-book/aqua-cli#aqua-run) for more details. ([#520](https://github.com/fluencelabs/aqua/pull/520)). +* Use JSON for arguments in `aqua run` without extra brackets for optional fields ([#517](https://github.com/fluencelabs/aqua/pull/517)) + +### [0.7.3](https://github.com/fluencelabs/aqua/releases/tag/0.7.3) – June 10, 2022 * Language server for VSCode ([#512](https://github.com/fluencelabs/aqua/pull/512)) * Go-to definitions for VSCode ([#514](https://github.com/fluencelabs/aqua/pull/514) [#516](https://github.com/fluencelabs/aqua/pull/516)) diff --git a/language/flow/conditional.md b/language/flow/conditional.md index 52c5cb0..8d3cbbf 100644 --- a/language/flow/conditional.md +++ b/language/flow/conditional.md @@ -4,10 +4,12 @@ Aqua supports branching: you can return one value or another, recover from the e ## Contract -* The second arm of the conditional operator is executed if and only if the first arm failed. -* The second arm has no access to the first arm's data. -* A conditional block is considered "executed" if and only if any arm was executed successfully. -* A conditional block is considered "failed" if and only if the second (recovery) arm fails to execute. +* The second branch of the conditional operator is executed if and only if the first block failed. +* The second block has no access to the first block's data. +* A conditional block is considered "executed" if and only if any inner block was executed successfully. +* A conditional block is considered "failed" if and only if the second (recovery) block fails to execute. + +_Block of code is any number of lines on the same indentation level or deeper_ ## Conditional operations diff --git a/language/flow/sequential.md b/language/flow/sequential.md index 72e1084..fda6be5 100644 --- a/language/flow/sequential.md +++ b/language/flow/sequential.md @@ -4,10 +4,17 @@ By default, Aqua code is executed line by line, sequentially. ## Contract -* Data from the first arm is available in the second branch. -* The second arm is executed if and only if the first arm succeeded. -* If any arm failed, then the whole sequence is failed. -* If all arms are executed successfully, then the whole sequence is executed successfully. +* Data from the first line is available on the second line +* A second line will be executed only if the first line succeeded +* If any line failed, then the whole block is failed +* If all lines succeeded, then the whole block is succeeded + +``` +f <- first() -- first line +second(f) -- second line +``` + +_A block of code is any number of lines on the same indentation level or deeper._ ## Sequential operations