GitBook: [2.0.0] 31 pages and 13 assets modified

This commit is contained in:
boneyard93501 2021-09-13 22:43:21 +00:00 committed by gitbook-bot
parent 8ef255e0ba
commit ba0a17719c
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
15 changed files with 71 additions and 68 deletions

View File

Before

Width:  |  Height:  |  Size: 355 KiB

After

Width:  |  Height:  |  Size: 355 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

View File

Before

Width:  |  Height:  |  Size: 595 KiB

After

Width:  |  Height:  |  Size: 595 KiB

View File

Before

Width:  |  Height:  |  Size: 595 KiB

After

Width:  |  Height:  |  Size: 595 KiB

View File

@ -1,32 +1,33 @@
# Table of contents # Table of contents
- [Introduction](README.md) * [Introduction](README.md)
- [Thinking In Aquamarine](p2p.md) * [Thinking In Aquamarine](p2p.md)
- [Concepts](concepts.md) * [Concepts](concepts.md)
- [Quick Start](quick-start/README.md) * [Quick Start](quick-start/README.md)
- [1. Browser-to-Browser](quick-start/1.-browser-to-browser-1.md) * [1. Browser-to-Browser](quick-start/1.-browser-to-browser-1.md)
- [2. Hosted Services](quick-start/2.-hosted-services.md) * [2. Hosted Services](quick-start/2.-hosted-services.md)
- [3. Browser-to-Service](quick-start/3.-browser-to-service.md) * [3. Browser-to-Service](quick-start/3.-browser-to-service.md)
- [Aquamarine](knowledge_aquamarine/README.md) * [Aquamarine](knowledge_aquamarine/README.md)
- [Aqua](knowledge_aquamarine/hll.md) * [Aqua](knowledge_aquamarine/hll.md)
- [Marine](knowledge_aquamarine/marine/README.md) * [Marine](knowledge_aquamarine/marine/README.md)
- [Marine CLI](knowledge_aquamarine/marine/marine-cli.md) * [Marine CLI](knowledge_aquamarine/marine/marine-cli.md)
- [Marine REPL](knowledge_aquamarine/marine/marine-repl.md) * [Marine REPL](knowledge_aquamarine/marine/marine-repl.md)
- [Marine Rust SDK](knowledge_aquamarine/marine/marine-rs-sdk.md) * [Marine Rust SDK](knowledge_aquamarine/marine/marine-rs-sdk.md)
- [Tools](knowledge_tools.md) * [Tools](knowledge_tools.md)
- [Node](node.md) * [Node](node.md)
- [JS SDK](js-sdk/README.md) * [JS SDK](js-sdk/README.md)
- [Concepts](js-sdk/1_concepts.md) * [Concepts](js-sdk/1_concepts.md)
- [Basics](js-sdk/2_basics.md) * [Basics](js-sdk/2_basics.md)
- [In-depth](js-sdk/3_in_depth.md) * [In-depth](js-sdk/3_in_depth.md)
- [Running app in nodejs](js-sdk/5_run_in_node.md) * [Running app in nodejs](js-sdk/5_run_in_node.md)
- [Running app in browser](js-sdk/4_run_in_browser-1.md) * [Running app in browser](js-sdk/4_run_in_browser-1.md)
- [Api reference](js-sdk/6-reference.md) * [Api reference](js-sdk/6-reference.md)
- [Changelog](js-sdk/changelog.md) * [Changelog](js-sdk/changelog.md)
- [Security](knowledge_security.md) * [Security](knowledge_security.md)
- [Tutorials](tutorials_tutorials/README.md) * [Tutorials](tutorials_tutorials/README.md)
- [Setting Up Your Environment](tutorials_tutorials/recipes_setting_up.md) * [Setting Up Your Environment](tutorials_tutorials/recipes_setting_up.md)
- [Deploy A Local Fluence Node](tutorials_tutorials/tutorial_run_local_node.md) * [Deploy A Local Fluence Node](tutorials_tutorials/tutorial_run_local_node.md)
- [cUrl As A Service](tutorials_tutorials/curl-as-a-service.md) * [cUrl As A Service](tutorials_tutorials/curl-as-a-service.md)
- [Add Your Own Builtins](tutorials_tutorials/add-your-own-builtin.md) * [Add Your Own Builtins](tutorials_tutorials/add-your-own-builtin.md)
- [Research, Papers And References](research-papers-and-references.md) * [Research, Papers And References](research-papers-and-references.md)

View File

@ -31,9 +31,10 @@ To learn more about Aqua see [aqua book](https://doc.fluence.dev/aqua-book/)
The building block of the application are: The building block of the application are:
- Aqua code for peer-to-peer communication * Aqua code for peer-to-peer communication
- Compiler cli package for aqua to \(java\)typescript compilation * Compiler cli package for aqua to \(java\)typescript compilation
- Initialization of the `FluencePeer` * Initialization of the `FluencePeer`
- Application specific code \(java\)typescript in the framework of your choice * Application specific code \(java\)typescript in the framework of your choice
In the next section we see it in action In the next section we see it in action

View File

@ -147,7 +147,7 @@ async function main() {
main(); main();
``` ```
\(1\) Import list of possible relay nodes (network enironment) \(1\) Import list of possible relay nodes \(network enironment\)
\(2\) Aqua compiler provides functions which can be directly imported like any normal typescript function. \(2\) Aqua compiler provides functions which can be directly imported like any normal typescript function.
@ -169,4 +169,5 @@ If everything has been done correctly yuo should see `Hello, world!` in the cons
The next secion will cover in-depth and advanced usage JS SDK The next secion will cover in-depth and advanced usage JS SDK
The code from this section is available in on (github)[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world] The code from this section is available in on \(github\)\[[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world](https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world)\]

View File

@ -8,13 +8,10 @@ In this section we will cover the JS SDK in-depth.
`@fluencelabs/fluence` exports a facade `Fluence` which provides all the needed functionality for the most uses cases. It defined 4 functions: `@fluencelabs/fluence` exports a facade `Fluence` which provides all the needed functionality for the most uses cases. It defined 4 functions:
- `start`: Start the default peer. * `start`: Start the default peer.
* `stop`: Stops the default peer
- `stop`: Stops the default peer * `getStatus`: Gets the status of the default peer. This includes connection
* `getPeer`: Gets the default Fluence Peer instance \(see below\)
- `getStatus`: Gets the status of the default peer. This includes connection
- `getPeer`: Gets the default Fluence Peer instance (see below)
Under the hood `Fluence` facade calls the corresponding method on the default instance of FluencePeer. This instance is passed to the Aqua-compiler generated functions by default. Under the hood `Fluence` facade calls the corresponding method on the default instance of FluencePeer. This instance is passed to the Aqua-compiler generated functions by default.
@ -137,7 +134,7 @@ Aqua compiler emits TypeScript or JavaScript which in turn can be called from a
For every exported function definition in aqua the compiler generated two overloads. One accepting the `FluencePeer` instance as the first argument, and one without it. Otherwise arguments are the same and correspond to the arguments of aqua functions. The last argument is always an optional config object with the following properties: For every exported function definition in aqua the compiler generated two overloads. One accepting the `FluencePeer` instance as the first argument, and one without it. Otherwise arguments are the same and correspond to the arguments of aqua functions. The last argument is always an optional config object with the following properties:
- `ttl`: Optional parameter which specify TTL \(time to live\) of particle with execution logic for the function * `ttl`: Optional parameter which specify TTL \(time to live\) of particle with execution logic for the function
The return type is always a promise of the aqua function return type. If the function does not return anything, the return type will be `Promise<void>`. The return type is always a promise of the aqua function return type. If the function does not return anything, the return type will be `Promise<void>`.
@ -167,7 +164,7 @@ export async function callMeBack(
### Service definitions ### Service definitions
``` ```text
service ServiceName: service ServiceName:
-- service interface -- service interface
``` ```
@ -186,9 +183,9 @@ export function registerServiceName(
): void; ): void;
``` ```
- `peer` - the Fluence Peer instance where the handler should be registered. The peer can be ommited. In that case the default Fluence Peer will be used instead * `peer` - the Fluence Peer instance where the handler should be registered. The peer can be ommited. In that case the default Fluence Peer will be used instead
- `serviceId` - the name of the service id. If the service was defined with the default service id in aqua code, this argument can be ommited. * `serviceId` - the name of the service id. If the service was defined with the default service id in aqua code, this argument can be ommited.
- `service` - the handler for the service. * `service` - the handler for the service.
Depending on whether or not the services was defined with the default id the number of overloads will be different. In the case it **is defined**, there would be four overloads: Depending on whether or not the services was defined with the default id the number of overloads will be different. In the case it **is defined**, there would be four overloads:
@ -277,9 +274,9 @@ export interface CalcDef {
Basic types convertion is pretty much straightforward: Basic types convertion is pretty much straightforward:
- `string` is converted to `string` in typescript * `string` is converted to `string` in typescript
- `bool` is converted to `boolean` in typescript * `bool` is converted to `boolean` in typescript
- All number types \(`u8`, `u16`, `u32`, `u64`, `s8`, `s16`, `s32`, `s64`, `f32`, `f64`\) are converted to `number` in typescript * All number types \(`u8`, `u16`, `u32`, `u64`, `s8`, `s16`, `s32`, `s64`, `f32`, `f64`\) are converted to `number` in typescript
Arrow types translate to functions in typescript which have their arguments translated to typescript types. In addition to arguments defined in aqua, typescript counterparts have an additional argument for call params. For the majority of use cases this parameter is not needed and can be ommited. Arrow types translate to functions in typescript which have their arguments translated to typescript types. In addition to arguments defined in aqua, typescript counterparts have an additional argument for call params. For the majority of use cases this parameter is not needed and can be ommited.
@ -315,3 +312,4 @@ Tetraplets have the form of:
To learn more about tetraplets and application security see [Security](https://github.com/fluencelabs/gitbook-docs/tree/77344eb147c2ce17fe1c0f37013082fc85c1ffa3/js-sdk/knowledge_security.md) To learn more about tetraplets and application security see [Security](https://github.com/fluencelabs/gitbook-docs/tree/77344eb147c2ce17fe1c0f37013082fc85c1ffa3/js-sdk/knowledge_security.md)
To see full specification of `CallParms` type see [Api reference](https://github.com/fluencelabs/gitbook-docs/tree/77344eb147c2ce17fe1c0f37013082fc85c1ffa3/js-sdk/js-sdk/6_reference/modules.md) To see full specification of `CallParms` type see [Api reference](https://github.com/fluencelabs/gitbook-docs/tree/77344eb147c2ce17fe1c0f37013082fc85c1ffa3/js-sdk/js-sdk/6_reference/modules.md)

View File

@ -2,6 +2,7 @@
You can use the JS SDK with any framework \(or even without it\). The "flunce" part of the application is a collection of pure typesctipt\javascript functions which can be called withing any framework of your choosing. You can use the JS SDK with any framework \(or even without it\). The "flunce" part of the application is a collection of pure typesctipt\javascript functions which can be called withing any framework of your choosing.
See the browser-example which demonstrate integrating Fluence with React: (github)[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/browser-example] See the browser-example which demonstrate integrating Fluence with React: \(github\)\[[https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/browser-example](https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/browser-example)\]
Also take a look at FluentPad. It is an example application written in React: [https://github.com/fluencelabs/fluent-pad](https://github.com/fluencelabs/fluent-pad) Also take a look at FluentPad. It is an example application written in React: [https://github.com/fluencelabs/fluent-pad](https://github.com/fluencelabs/fluent-pad)

View File

@ -16,7 +16,7 @@ npm start
Which will open a new browser tab at `http://localhost:3000` . Following the instructions, we connect to any one of the displayed relay ids, open another browser tab also at `http://localhost:3000`, select a relay and copy and paste the client peer id and relay id into corresponding fields in the first tab and press the `say hello` button. Which will open a new browser tab at `http://localhost:3000` . Following the instructions, we connect to any one of the displayed relay ids, open another browser tab also at `http://localhost:3000`, select a relay and copy and paste the client peer id and relay id into corresponding fields in the first tab and press the `say hello` button.
![Browser To Service Implementation](../.gitbook/assets/image%20%2838%29.png) ![Browser To Service Implementation](../.gitbook/assets/image%20%2838%29%20%282%29.png)
The result looks familiar, so what's different? Let's have a look at the Aqua file. Navigate to the `aqua/getting_started.aqua` file in your IDE: The result looks familiar, so what's different? Let's have a look at the Aqua file. Navigate to the `aqua/getting_started.aqua` file in your IDE:

View File

@ -8,38 +8,38 @@ Welcome to our quick-start tutorials which guide you through the necessary steps
For your development convenience, Fluence provides a [docker-based development environment](https://github.com/fluencelabs/devcontainer) that comes with the necessary dependencies, tooling and quick-start code pre-installed. For your development convenience, Fluence provides a [docker-based development environment](https://github.com/fluencelabs/devcontainer) that comes with the necessary dependencies, tooling and quick-start code pre-installed.
### Fluence Devcontainer ## Fluence Devcontainer
Fluence's devcontainer is a ready to use dockerized development environment with VSCode integration containing the following tools: Fluence's devcontainer is a ready to use dockerized development environment with VSCode integration containing the following tools:
- [`aqua`](https://www.npmjs.com/package/@fluencelabs/aqua) to compile [Aqua](https://doc.fluence.dev/aqua-book/) to AIR or wrapped in Typescript * [`aqua`](https://www.npmjs.com/package/@fluencelabs/aqua) to compile [Aqua](https://doc.fluence.dev/aqua-book/) to AIR or wrapped in Typescript
- [`fldist`](https://www.npmjs.com/package/@fluencelabs/fldist) to manage services and optionally execute compiled Aqua from the command line * [`fldist`](https://www.npmjs.com/package/@fluencelabs/fldist) to manage services and optionally execute compiled Aqua from the command line
- [`marine`](https://crates.io/crates/marine) to compile services developed in Rust to the wasm32-wasi target * [`marine`](https://crates.io/crates/marine) to compile services developed in Rust to the wasm32-wasi target
- [`mrepl`](https://crates.io/crates/mrepl) to run, test and debug WebAssembly \(Wasm\) services locally * [`mrepl`](https://crates.io/crates/mrepl) to run, test and debug WebAssembly \(Wasm\) services locally
### How to install ## How to install
Docker and optionally VSCode need to be available on your system. For Docker installation, follow the [Get Docker](https://docs.docker.com/get-docker/) instructions for your OS. For VSCode, see [VSCode](https://code.visualstudio.com/) for instructions. Docker and optionally VSCode need to be available on your system. For Docker installation, follow the [Get Docker](https://docs.docker.com/get-docker/) instructions for your OS. For VSCode, see [VSCode](https://code.visualstudio.com/) for instructions.
With Docker and VSCode in place: With Docker and VSCode in place:
- Install Remote-Containers extension in VSCode * Install Remote-Containers extension in VSCode
![Install Remote - Containers in VSCode](../.gitbook/assets/image%20%2813%29.png) ![Install Remote - Containers in VSCode](../.gitbook/assets/image%20%2813%29.png)
- `Run Remote-Containers: Clone Repository in Container Volume...` via the command palette \(F1 or Cmd-Shift-P\) * `Run Remote-Containers: Clone Repository in Container Volume...` via the command palette \(F1 or Cmd-Shift-P\)
![Select Remote Container Clone Repository](../.gitbook/assets/image%20%2814%29.png) ![Select Remote Container Clone Repository](../.gitbook/assets/image%20%2814%29.png)
- Enter `fluencelabs/devcontainer` * Enter `fluencelabs/devcontainer`
![Select `fluencelabs/devcontainer`](../.gitbook/assets/image%20%2815%29.png) ![Select \`fluencelabs/devcontainer\`](../.gitbook/assets/image%20%2815%29.png)
- When asked for branch, press enter \(main\) * When asked for branch, press enter \(main\)
- When asked for volume, press enter \(unique\) * When asked for volume, press enter \(unique\)
- Open Terminal in VSCode \(ctrl-\`\) * Open Terminal in VSCode \(ctrl-\`\)
![Installed And Ready Devcontainer in VSCode](../.gitbook/assets/image%20%2818%29%20%281%29.png) ![Installed And Ready Devcontainer in VSCode](../.gitbook/assets/image%20%2818%29%20%281%29%20%281%29%20%282%29.png)
Congratulations, you now have a fully functional Fluence development environment. For a variety of container management options, click on the `Dev Container: Fluence` button in the lower left of your tool bar: Congratulations, you now have a fully functional Fluence development environment. For a variety of container management options, click on the `Dev Container: Fluence` button in the lower left of your tool bar:
@ -48,3 +48,4 @@ Congratulations, you now have a fully functional Fluence development environment
If you encounter any problems or have suggestions, please open an issue or submit a PR. You can also reach out in [Discord](https://fluence.chat) or [Telegram](https://t.me/fluence_project). For more detailed reference resources, see the [Fluence documentation](https://doc.fluence.dev/docs/) and [Aqua book](https://doc.fluence.dev/aqua-book/). If you encounter any problems or have suggestions, please open an issue or submit a PR. You can also reach out in [Discord](https://fluence.chat) or [Telegram](https://t.me/fluence_project). For more detailed reference resources, see the [Fluence documentation](https://doc.fluence.dev/docs/) and [Aqua book](https://doc.fluence.dev/aqua-book/).
All right, now we are ready to proceed to the first application on Fluence. All right, now we are ready to proceed to the first application on Fluence.

View File

@ -165,7 +165,7 @@ fldist --node-id 12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx \
--node-addr /ip4/127.0.0.1/tcp/9999/ws/p2p/12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx \ --node-addr /ip4/127.0.0.1/tcp/9999/ws/p2p/12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx \
run_air \ run_air \
-p greeting.greeting.air \ -p greeting.greeting.air \
-d '{"service": "64551400-6296-4701-8e82-daf0b4e02751", "name":"Fluence"}' -d '{"service": "64551400-6296-4701-8e82-daf0b4e02751", "name":"Fluence", "node": "12D3KooWLFCmDq4vDRfaxW2GA6kYnorxAiie78XzQrVDVoWEZnPx"}'
``` ```
```bash ```bash