@withautonomi/autonomi 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +2 -2
- package/README.md +76 -0
- package/artifacts/github-pages/artifact.tar +0 -0
- package/index.d.ts +125 -137
- package/index.js +2 -1
- package/package.json +16 -7
- package/src/lib.rs +444 -387
package/Cargo.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
edition = "2021"
|
|
3
3
|
name = "autonomi-nodejs"
|
|
4
|
-
version = "0.1.
|
|
4
|
+
version = "0.1.1"
|
|
5
5
|
description = "NodeJS bindings for the autonomi client"
|
|
6
6
|
license = "GPL-3.0"
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ license = "GPL-3.0"
|
|
|
9
9
|
crate-type = ["cdylib"]
|
|
10
10
|
|
|
11
11
|
[dependencies]
|
|
12
|
-
autonomi = { path = "../autonomi" }
|
|
12
|
+
autonomi = { path = "../autonomi", version = "0.5.0" }
|
|
13
13
|
bytes = { version = "1.0.1", features = ["serde"] }
|
|
14
14
|
eyre = "0.6.12"
|
|
15
15
|
futures = "0.3"
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
The client API for Autonomi. This Node.js addon provides bindings into the Rust `autonomi` crate.
|
|
2
|
+
|
|
3
|
+
# Usage
|
|
4
|
+
|
|
5
|
+
Add the `@withautonomi/autonomi` package to your project. For example, using `npm`:
|
|
6
|
+
```console
|
|
7
|
+
$ npm install @withautonomi/autonomi
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Using a modern version of Node.js we can use `import` and `async` easily when we use the `.mjs` extension. Import the `Client` and you're ready to connect to the network!
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
// main.mjs
|
|
14
|
+
import { Client } from '@withautonomi/autonomi'
|
|
15
|
+
const client = await Client.initLocal()
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Run the script:
|
|
19
|
+
|
|
20
|
+
```console
|
|
21
|
+
$ node main.js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
> Work in progress:
|
|
27
|
+
>
|
|
28
|
+
> For general guides and usage, see the [Developer Documentation](https://docs.autonomi.com/developers). This is currently worked on specifically to include Node.js usage.
|
|
29
|
+
|
|
30
|
+
For example usage, see the [`__test__`](./__test__) directory. Replace `import { .. } from '../index.js'` to import from `@withautonomi/autonomi` instead.
|
|
31
|
+
|
|
32
|
+
# Contributing, compilation and publishing
|
|
33
|
+
|
|
34
|
+
To contribute or develop on the source code directly, we need a few requirements.
|
|
35
|
+
|
|
36
|
+
- Yarn
|
|
37
|
+
- `npm install --global yarn`
|
|
38
|
+
- We need the NAPI RS CLI tool
|
|
39
|
+
- `yarn global add @napi-rs/cli`
|
|
40
|
+
|
|
41
|
+
Install the dependencies for the project:
|
|
42
|
+
```console
|
|
43
|
+
$ yarn install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Build
|
|
47
|
+
|
|
48
|
+
Then build using the `napi` CLI:
|
|
49
|
+
```console
|
|
50
|
+
$ npx napi build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Running tests
|
|
54
|
+
|
|
55
|
+
Run the `test` script:
|
|
56
|
+
|
|
57
|
+
```console
|
|
58
|
+
yarn test
|
|
59
|
+
# Or run a specific test
|
|
60
|
+
yarn test __test__/register.spec.mjs -m 'registers errors'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Publishing
|
|
64
|
+
|
|
65
|
+
Before publishing, bump the versions of *all* packages with the following:
|
|
66
|
+
```console
|
|
67
|
+
$ npm version patch --no-git-tag-version
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Use `major` or `minor` instead of `patch` depending on the release.
|
|
71
|
+
|
|
72
|
+
It's a good practice to have an unreleased version number ready to go. So if `0.4.0` is the version released on NPM currently, `package.json` should be at `0.4.1`.
|
|
73
|
+
|
|
74
|
+
### Workflow
|
|
75
|
+
|
|
76
|
+
Use the 'JS publish to NPM' workflow (`nodejs-publish.yml`) to publish the package from `main` or a tag. This workflow has to be manually dispatched through GitHub.
|
|
Binary file
|