Add auto-generated reference

This commit is contained in:
Pavel Murygin 2021-09-06 23:58:02 +03:00
parent 3e5f5958e8
commit 0ed7f1e811
5 changed files with 274 additions and 6 deletions

View File

@ -21,7 +21,7 @@
- [In-depth](js-sdk/3_basics.md) - [In-depth](js-sdk/3_basics.md)
- [Running app in nodejs](js-sdk/4_run_in_node.md) - [Running app in nodejs](js-sdk/4_run_in_node.md)
- [Running app in browser](js-sdk/5_run_in_browser.md) - [Running app in browser](js-sdk/5_run_in_browser.md)
- [Api reference](js-sdk/6_reference.md) - [Api reference](js-sdk/6_reference/modules.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)

View File

@ -17,7 +17,7 @@ To create a new peer simple instantiate the `FluencePeer` class:
const peer = new FluencePeer(); const peer = new FluencePeer();
``` ```
The constructor simply creates a new object and does not initialize any workflow. The `init` function starts the Aqua VM, initialized the default call service handlers and (optionally) connect to the Fluence network. The function takes an optional object specifying additonal peer configuration. On option you will be using a lot is `connectTo`. It tells the peer to connect to a relay. For example: The constructor simply creates a new object and does not initialize any workflow. The `init` function starts the Aqua VM, initializes the default call service handlers and (optionally) connect to the Fluence network. The function takes an optional object specifying additonal peer configuration. On option you will be using a lot is `connectTo`. It tells the peer to connect to a relay. For example:
```typescript ```typescript
await peer.init({ await peer.init({
@ -25,9 +25,7 @@ await peer.init({
}); });
``` ```
connects the first node of the Kranodar network. You can find the officially maintained list networks in the `@fluencelabs/fluence-network-environment` package. The full list of supported options is described in the [API reference](js-sdk/6_reference.md) connects the first node of the Kranodar network. You can find the officially maintained list networks in the `@fluencelabs/fluence-network-environment` package. The full list of supported options is described in the [API reference](js-sdk/6_reference/modules.md)
The reverse to
Most of the time a single peer is enough for the whole application. For these use cases`FluncePeer` class contains the default instance which can be accessed with the corresponding property: Most of the time a single peer is enough for the whole application. For these use cases`FluncePeer` class contains the default instance which can be accessed with the corresponding property:

View File

@ -0,0 +1,141 @@
# Class: FluencePeer
This class implements the Fluence protocol for javascript-based environments.
It provides all the necessary features to communicate with Fluence network
## Table of contents
### Constructors
- [constructor](js-sdk/6_reference/classes/FluencePeer.md#constructor)
### Properties
- [callServiceHandler](js-sdk/6_reference/classes/FluencePeer.md#callservicehandler)
### Accessors
- [connectionInfo](js-sdk/6_reference/classes/FluencePeer.md#connectioninfo)
- [default](js-sdk/6_reference/classes/FluencePeer.md#default)
### Methods
- [init](js-sdk/6_reference/classes/FluencePeer.md#init)
- [initiateFlow](js-sdk/6_reference/classes/FluencePeer.md#initiateflow)
- [uninit](js-sdk/6_reference/classes/FluencePeer.md#uninit)
## Constructors
### constructor
**new FluencePeer**()
Creates a new Fluence Peer instance. Does not start the workflows.
In order to work with the Peer it has to be initialized with the `init` method
#### Defined in
[internal/FluencePeer.ts:111](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L111)
## Properties
### callServiceHandler
**callServiceHandler**: `CallServiceHandler`
#### Defined in
[internal/FluencePeer.ts:201](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L201)
## Accessors
### connectionInfo
`get` **connectionInfo**(): `ConnectionInfo`
Get the information about Fluence Peer connections
#### Returns
`ConnectionInfo`
#### Defined in
[internal/FluencePeer.ts:116](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L116)
___
### default
`Static` `get` **default**(): [`FluencePeer`](js-sdk/6_reference/classes/FluencePeer.md)
Get the default Fluence peer instance. The default peer is used automatically in all the functions generated
by the Aqua compiler if not specified otherwise.
#### Returns
[`FluencePeer`](js-sdk/6_reference/classes/FluencePeer.md)
#### Defined in
[internal/FluencePeer.ts:181](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L181)
## Methods
### init
**init**(`config?`): `Promise`<`void`\>
Initializes the peer: starts the Aqua VM, initializes the default call service handlers
and (optionally) connect to the Fluence network
#### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `config?` | `PeerConfig` | object specifying peer configuration |
#### Returns
`Promise`<`void`\>
#### Defined in
[internal/FluencePeer.ts:130](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L130)
___
### initiateFlow
**initiateFlow**(`request`): `Promise`<`void`\>
#### Parameters
| Name | Type |
| :------ | :------ |
| `request` | `RequestFlow` |
#### Returns
`Promise`<`void`\>
#### Defined in
[internal/FluencePeer.ts:187](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L187)
___
### uninit
**uninit**(): `Promise`<`void`\>
Uninitializes the peer: stops all the underltying workflows, stops the Aqua VM
and disconnects from the Fluence network
#### Returns
`Promise`<`void`\>
#### Defined in
[internal/FluencePeer.ts:172](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L172)

View File

@ -0,0 +1,130 @@
# @fluencelabs/fluence
## Table of contents
### Classes
- [FluencePeer](js-sdk/6_reference/classes/FluencePeer.md)
### Type aliases
- [AvmLoglevel](js-sdk/6_reference/modules.md#avmloglevel)
- [PeerIdB58](js-sdk/6_reference/modules.md#peeridb58)
### Functions
- [peerIdFromEd25519SK](js-sdk/6_reference/modules.md#peeridfromed25519sk)
- [peerIdToEd25519SK](js-sdk/6_reference/modules.md#peeridtoed25519sk)
- [randomPeerId](js-sdk/6_reference/modules.md#randompeerid)
- [setLogLevel](js-sdk/6_reference/modules.md#setloglevel)
## Type aliases
### AvmLoglevel
Ƭ **AvmLoglevel**: `LogLevel`
Enum representing the log level used in Aqua VM.
Possible values: 'info', 'trace', 'debug', 'info', 'warn', 'error', 'off';
#### Defined in
[internal/FluencePeer.ts:35](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/FluencePeer.ts#L35)
___
### PeerIdB58
Ƭ **PeerIdB58**: `string`
Peer ID's id as a base58 string (multihash/CIDv0).
#### Defined in
[internal/commonTypes.ts:20](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/commonTypes.ts#L20)
## Functions
### peerIdFromEd25519SK
`Const` **peerIdFromEd25519SK**(`sk`): `Promise`<`PeerId`\>
Generates a new peer id from base64 string contatining the 32 byte Ed25519S secret key
#### Parameters
| Name | Type |
| :------ | :------ |
| `sk` | `string` |
#### Returns
`Promise`<`PeerId`\>
- Promise with the created Peer Id
#### Defined in
[internal/peerIdUtils.ts:26](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/peerIdUtils.ts#L26)
___
### peerIdToEd25519SK
`Const` **peerIdToEd25519SK**(`peerId`): `string`
Converts peer id into base64 string contatining the 32 byte Ed25519S secret key
#### Parameters
| Name | Type |
| :------ | :------ |
| `peerId` | `PeerId` |
#### Returns
`string`
- base64 of Ed25519S secret key
#### Defined in
[internal/peerIdUtils.ts:45](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/peerIdUtils.ts#L45)
___
### randomPeerId
`Const` **randomPeerId**(): `Promise`<`PeerId`\>
Generates a new peer id with random private key
#### Returns
`Promise`<`PeerId`\>
- Promise with the created Peer Id
#### Defined in
[internal/peerIdUtils.ts:59](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/internal/peerIdUtils.ts#L59)
___
### setLogLevel
`Const` **setLogLevel**(`level`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `level` | `LogLevelDesc` |
#### Returns
`void`
#### Defined in
[index.ts:23](https://github.com/fluencelabs/fluence-js/blob/284a59b/src/index.ts#L23)

View File

@ -1 +0,0 @@
Auto-generated docs from jsdoc comments created with typedoc