diff --git a/.gitbook/assets/image (18) (1) (1) (1).png b/.gitbook/assets/image (18) (1) (1) (2) (1).png similarity index 100% rename from .gitbook/assets/image (18) (1) (1) (1).png rename to .gitbook/assets/image (18) (1) (1) (2) (1).png diff --git a/.gitbook/assets/image (18) (1) (1).png b/.gitbook/assets/image (18) (1) (1) (2) (2).png similarity index 100% rename from .gitbook/assets/image (18) (1) (1).png rename to .gitbook/assets/image (18) (1) (1) (2) (2).png diff --git a/.gitbook/assets/image (38) (2) (1).png b/.gitbook/assets/image (38) (2) (2) (1).png similarity index 100% rename from .gitbook/assets/image (38) (2) (1).png rename to .gitbook/assets/image (38) (2) (2) (1).png diff --git a/.gitbook/assets/image (38) (2).png b/.gitbook/assets/image (38) (2) (2) (2).png similarity index 100% rename from .gitbook/assets/image (38) (2).png rename to .gitbook/assets/image (38) (2) (2) (2).png diff --git a/SUMMARY.md b/SUMMARY.md index 9d274ee..af048a3 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -15,14 +15,14 @@ * [Marine Rust SDK](knowledge_aquamarine/marine/marine-rs-sdk.md) * [Tools](knowledge_tools.md) * [Node](node.md) -* [Fluence JS](js-sdk/README.md) - * [Concepts](js-sdk/1_concepts.md) - * [Basics](js-sdk/2_basics.md) - * [In-depth](js-sdk/3_in_depth.md) - * [Running app in nodejs](js-sdk/5_run_in_node.md) - * [Running app in browser](js-sdk/4_run_in_browser-1.md) - * [API reference](js-sdk/6-reference.md) - * [Changelog](js-sdk/changelog.md) +* [Fluence JS](fluence-js/README.md) + * [Concepts](fluence-js/1_concepts.md) + * [Basics](fluence-js/2_basics.md) + * [In-depth](fluence-js/3_in_depth.md) + * [Running app in nodejs](fluence-js/5_run_in_node.md) + * [Running app in browser](fluence-js/4_run_in_browser-1.md) + * [API reference](fluence-js/6-reference.md) + * [Changelog](fluence-js/changelog.md) * [Security](knowledge_security.md) * [Tutorials](tutorials_tutorials/README.md) * [Setting Up Your Environment](tutorials_tutorials/recipes_setting_up.md) diff --git a/js-sdk/1_concepts.md b/fluence-js/1_concepts.md similarity index 93% rename from js-sdk/1_concepts.md rename to fluence-js/1_concepts.md index b04b604..0d2f402 100644 --- a/js-sdk/1_concepts.md +++ b/fluence-js/1_concepts.md @@ -11,10 +11,10 @@ To learn more about Aqua see [aqua book](https://doc.fluence.dev/aqua-book/) The building block of the application are: -- Aqua code for peer-to-peer communication -- Compiler cli package for aqua to \(java\)typescript compilation -- Initialization of the `FluencePeer` -- Application specific code \(java\)typescript in the framework of your choice +* Aqua code for peer-to-peer communication +* Compiler cli package for aqua to \(java\)typescript compilation +* Initialization of the `FluencePeer` +* Application specific code \(java\)typescript in the framework of your choice In the next section we see it in action @@ -41,3 +41,4 @@ Due to the limitations of browser-based environment `FluencePeer` cannot be disc The js-based peer does not implement the full set of builtin functions due the limitations described previously. E.g there is no built-ins implementation for _kad_ or _srv_ services. However _op_ service is fully implemented. For the full descriptions of implemented built-ins refer to [Api reference](https://github.com/fluencelabs/gitbook-docs/js-sdk/js-sdk/6_reference/modules.md) In contrast with the node implementation `FluencePeer` can initiate new particles execution. Aqua compiler generates executable functions from `func` definitions in aqua code. + diff --git a/js-sdk/2_basics.md b/fluence-js/2_basics.md similarity index 99% rename from js-sdk/2_basics.md rename to fluence-js/2_basics.md index 37b5abb..c2af543 100644 --- a/js-sdk/2_basics.md +++ b/fluence-js/2_basics.md @@ -170,3 +170,4 @@ If everything has been done correctly yuo should see `Hello, world!` in the cons The next section will cover in-depth and advanced usage of Fluence JS The code from this section is available in on [github](https://github.com/fluencelabs/examples/tree/main/js-sdk-examples/hello-world) + diff --git a/js-sdk/3_in_depth.md b/fluence-js/3_in_depth.md similarity index 94% rename from js-sdk/3_in_depth.md rename to fluence-js/3_in_depth.md index 1ce9e41..3003914 100644 --- a/js-sdk/3_in_depth.md +++ b/fluence-js/3_in_depth.md @@ -8,10 +8,10 @@ In this section we will cover the Fluence JS in-depth. `@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. -- `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\) +* `start`: Start 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\) 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. @@ -134,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: -- `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`. @@ -183,9 +183,9 @@ export function registerServiceName( ): void; ``` -- `peer` - the Fluence Peer instance where the handler should be registered. The peer can be omitted. 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 omitted. -- `service` - the handler for the service. +* `peer` - the Fluence Peer instance where the handler should be registered. The peer can be omitted. 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 omitted. +* `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: @@ -274,9 +274,9 @@ export interface CalcDef { Basic types conversion is pretty much straightforward: -- `string` is converted to `string` 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 +* `string` is converted to `string` 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 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 omitted. @@ -312,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 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) + diff --git a/js-sdk/4_run_in_browser-1.md b/fluence-js/4_run_in_browser-1.md similarity index 99% rename from js-sdk/4_run_in_browser-1.md rename to fluence-js/4_run_in_browser-1.md index 60376f3..618eae7 100644 --- a/js-sdk/4_run_in_browser-1.md +++ b/fluence-js/4_run_in_browser-1.md @@ -5,3 +5,4 @@ You can use the Fluence JS with any framework \(or even without it\). The "fluen See the browser-example which demonstrate integrating Fluence with React: [github](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) + diff --git a/js-sdk/5_run_in_node.md b/fluence-js/5_run_in_node.md similarity index 99% rename from js-sdk/5_run_in_node.md rename to fluence-js/5_run_in_node.md index 2816733..8d73254 100644 --- a/js-sdk/5_run_in_node.md +++ b/fluence-js/5_run_in_node.md @@ -90,7 +90,6 @@ async function main() { } main(); - ``` As you can see all the service logic has been implemented in typescript. You have full power of npm at your disposal. diff --git a/fluence-js/6-reference.md b/fluence-js/6-reference.md new file mode 100644 index 0000000..07a9414 --- /dev/null +++ b/fluence-js/6-reference.md @@ -0,0 +1,4 @@ +# API reference + +API reference is available at [https://fluence.network/fluence-js/](https://fluence.network/fluence-js/) + diff --git a/js-sdk/README.md b/fluence-js/README.md similarity index 55% rename from js-sdk/README.md rename to fluence-js/README.md index 94463b5..93449bf 100644 --- a/js-sdk/README.md +++ b/fluence-js/README.md @@ -4,11 +4,11 @@ Fluence JS is an implementation of the Fluence protocol for JavaScript-based env Similar to the [Rust Fluence Peer implementation](https://github.com/fluencelabs/fluence) it includes: -- Peer-to-peer communication layer (via [js-libp2p](https://github.com/libp2p/js-libp2p)) -- [Aqua VM](https://github.com/fluencelabs/aquavm) -- Builtin services +* Peer-to-peer communication layer \(via [js-libp2p](https://github.com/libp2p/js-libp2p)\) +* [Aqua VM](https://github.com/fluencelabs/aquavm) +* Builtin services -Fluence JS can call services and functions on the Fluence network, and expose new APIs to the p2p network directly from TypeScript and JavaScript. -[Aqua language](https://github.com/fluencelabs/aqua) uses Fluence JS as a compilation target, and they are designed to [work in tandem](https://doc.fluence.dev/docs/js-sdk/3_in_depth#understanding-the-aqua-compiler-output). +Fluence JS can call services and functions on the Fluence network, and expose new APIs to the p2p network directly from TypeScript and JavaScript. [Aqua language](https://github.com/fluencelabs/aqua) uses Fluence JS as a compilation target, and they are designed to [work in tandem](https://doc.fluence.dev/docs/js-sdk/3_in_depth#understanding-the-aqua-compiler-output). Fluence JS can be used with any framework of your choice \(or even without frameworks\). + diff --git a/fluence-js/changelog.md b/fluence-js/changelog.md new file mode 100644 index 0000000..8d66ba6 --- /dev/null +++ b/fluence-js/changelog.md @@ -0,0 +1,34 @@ +# Changelog + +Fluence JS versioning scheme is the following: `0.BREAKING.ENHANCING` + +* `0` shows that Fluence JS does not meet its vision yet, so API can change quickly +* `BREAKING` part is incremented for each breaking API change +* `ENHANCING` part is incremented for every fix and update which is compatible on API level + +## [0.13.0](https://github.com/fluencelabs/fluence-js/releases/tag/v0.13.0) – September 24, 2021 + +* `PeerStatus` is now exported from index file \([\#80](https://github.com/fluencelabs/fluence-js/pull/80)\) +* `KeyPair`: method `fromBytes` is replaced with fromEd25519SK \([\#81](https://github.com/fluencelabs/fluence-js/pull/81)\) + +## [0.12.1](https://github.com/fluencelabs/fluence-js/releases/tag/v0.12.1) – September 14, 2021 + +* `KeyPair`: add fromBytes, toEd25519PrivateKey \([\#78](https://github.com/fluencelabs/fluence-js/pull/78)\) + +## [0.12.0](https://github.com/fluencelabs/fluence-js/releases/tag/v0.13.0) – September 10, 2021 + +* The API to work with the default Fluence Peer has been put under the facade `Fluence`. Method `init` was renamed to `start` and `uninit` renamed to `stop`. `connectionStatus` migrated to `getStatus`. + +To migrate from 0.11.0 to 0.12.0 + +1. `import { Fluence } from "@fluencelabs/fluence"`; instead of `FluencePeer` +2. replace `Fluence.default` with just `Fluence` +3. replace `init` with `start` and `uninit` with `stop` +4. replace `connectionInfo()` with `getStatus()` + +\([\#72](https://github.com/fluencelabs/fluence-js/pull/72)\) + +## [0.11.0](https://github.com/fluencelabs/fluence-js/releases/tag/v0.11.0) – September 08, 2021 + +* Update JS SDK api to the new version \([\#61](https://github.com/fluencelabs/fluence-js/pull/61)\) + diff --git a/js-sdk/6-reference.md b/js-sdk/6-reference.md deleted file mode 100644 index 486d8b8..0000000 --- a/js-sdk/6-reference.md +++ /dev/null @@ -1,3 +0,0 @@ -# API reference - -API reference is available at https://fluence.network/fluence-js/ diff --git a/js-sdk/changelog.md b/js-sdk/changelog.md deleted file mode 100644 index a6faaaa..0000000 --- a/js-sdk/changelog.md +++ /dev/null @@ -1,33 +0,0 @@ -# Changelog - -Fluence JS versioning scheme is the following: `0.BREAKING.ENHANCING` - -- `0` shows that Fluence JS does not meet its vision yet, so API can change quickly -- `BREAKING` part is incremented for each breaking API change -- `ENHANCING` part is incremented for every fix and update which is compatible on API level - -### [0.13.0](https://github.com/fluencelabs/fluence-js/releases/tag/v0.13.0) – September 24, 2021 - -- `PeerStatus` is now exported from index file \([#80](https://github.com/fluencelabs/fluence-js/pull/80)\) -- `KeyPair`: method `fromBytes` is replaced with fromEd25519SK \([#81](https://github.com/fluencelabs/fluence-js/pull/81)\) - -### [0.12.1](https://github.com/fluencelabs/fluence-js/releases/tag/v0.12.1) – September 14, 2021 - -- `KeyPair`: add fromBytes, toEd25519PrivateKey \([#78](https://github.com/fluencelabs/fluence-js/pull/78)\) - -### [0.12.0](https://github.com/fluencelabs/fluence-js/releases/tag/v0.13.0) – September 10, 2021 - -- The API to work with the default Fluence Peer has been put under the facade `Fluence`. Method `init` was renamed to `start` and `uninit` renamed to `stop`. `connectionStatus` migrated to `getStatus`. - -To migrate from 0.11.0 to 0.12.0 - -1. `import { Fluence } from "@fluencelabs/fluence"`; instead of `FluencePeer` -2. replace `Fluence.default` with just `Fluence` -3. replace `init` with `start` and `uninit` with `stop` -4. replace `connectionInfo()` with `getStatus()` - -\([#72](https://github.com/fluencelabs/fluence-js/pull/72)\) - -### [0.11.0](https://github.com/fluencelabs/fluence-js/releases/tag/v0.11.0) – September 08, 2021 - -- Update JS SDK api to the new version \([#61](https://github.com/fluencelabs/fluence-js/pull/61)\) diff --git a/knowledge_tools.md b/knowledge_tools.md index 069bf7d..6c489a2 100644 --- a/knowledge_tools.md +++ b/knowledge_tools.md @@ -1,6 +1,6 @@ # Tools -### Fluence Proto Distributor: FLDIST +## Fluence Proto Distributor: FLDIST [`fldist`](https://github.com/fluencelabs/proto-distributor) is a command line interface \(CLI\) to Fluence peers allowing for the lifecycle management of services and offers the fastest and most effective way to service deployment. @@ -39,11 +39,11 @@ Options: [number] [required] [default: 60000] ``` -### Fluence JS +## Fluence JS The [Fluence JS](https://github.com/fluencelabs/fluence-js) supports developers to build full-fledged applications for a variety of targets ranging from browsers to backend apps and greatly expands on the `fldist` capabilities. -### Marine Tools +## Marine Tools Marine offers multiple tools including the Marine CLI, REPL and SDK. Please see the [Marine section](knowledge_aquamarine/marine/) for more detail. diff --git a/quick-start/3.-browser-to-service.md b/quick-start/3.-browser-to-service.md index c63a679..2f8ffc1 100644 --- a/quick-start/3.-browser-to-service.md +++ b/quick-start/3.-browser-to-service.md @@ -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. -![Browser To Service Implementation](../.gitbook/assets/image%20%2838%29%20%282%29.png) +![Browser To Service Implementation](../.gitbook/assets/image%20%2838%29%20%282%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: diff --git a/quick-start/README.md b/quick-start/README.md index 3453dcc..a20efbf 100644 --- a/quick-start/README.md +++ b/quick-start/README.md @@ -39,7 +39,7 @@ With Docker and VSCode in place: * When asked for volume, press enter \(unique\) * Open Terminal in VSCode \(ctrl-\`\) -![Installed And Ready Devcontainer in VSCode](../.gitbook/assets/image%20%2818%29%20%281%29%20%281%29%20%282%29.png) +![Installed And Ready Devcontainer in VSCode](../.gitbook/assets/image%20%2818%29%20%281%29%20%281%29%20%282%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: