Compare commits

...

88 Commits
0.1.3 ... main

Author SHA1 Message Date
fluencebot
ac266a69bf
chore(main): release aqua-lib 0.12.1 (#93) 2024-09-18 11:39:51 +02:00
Maria Kuklina
cba9b785a3
fix: fix Peer.identify return type (#92) 2024-09-18 11:06:04 +02:00
fluencebot
49ca1fe7ff
chore(main): release aqua-lib 0.12.0 (#91) 2024-09-12 17:22:54 +02:00
Maria Kuklina
c8efe9c33a
update peer.identify (#90) 2024-09-12 17:16:33 +02:00
fluencebot
7bf3e62d3b
chore(main): release aqua-lib 0.11.0 (#89) 2024-08-08 13:37:03 +03:00
Aleksey Proshutinskiy
f8ef9f3a54
feat!: change Worker type in SubnetResolveResult (#88) 2024-08-08 13:28:08 +03:00
fluencebot
c01820d7ef
chore(main): release aqua-lib 0.10.2 (#87) 2024-02-24 13:50:32 +01:00
Maria Kuklina
b439997ba7
Add new method for module upload from vault (#86) 2024-02-24 13:39:51 +01:00
fluencebot
724bd44805
chore(main): release aqua-lib 0.10.1 (#85) 2024-02-19 20:12:54 +03:00
Nick
c92d3e3363
feat(worker): change cu_ids type (#84) 2024-02-19 20:12:24 +03:00
fluencebot
ae27eebd67
chore(main): release aqua-lib 0.10.0 (#83) 2024-02-19 18:41:30 +03:00
Nick
5414624156
feat(worker)!: add cu_ids to worker create (#82)
* feat(worker): add cu_ids to worker create

* add docs

* add docs
2024-02-19 18:35:02 +03:00
Maria Kuklina
f2665b0292
Remove Script API (#80) 2024-02-09 09:27:28 +01:00
fluencebot
5b5237dde6
chore(main): release aqua-lib 0.9.1 (#78) 2024-01-15 09:38:59 +01:00
InversionSpaces
60b91def4a
Add headers (#77) 2024-01-12 13:13:52 +01:00
fluencebot
d50ea23fb2
chore(main): release aqua-lib 0.9.0 (#76) 2023-12-21 16:24:44 +02:00
InversionSpaces
f89ecfbe79
fix(binary)!: Remove binary.aqua (#75) 2023-12-21 16:23:08 +02:00
InversionSpaces
09c2cd9c07
feat(builtin): Add header to builtin.aqua (#74) 2023-12-21 16:21:35 +02:00
InversionSpaces
e3c06bf8fc
Revert "Remove binary.aqua (#71)" (#73)
This reverts commit a062fcd44494bebf35ecdf238365f43a8b72732e.
2023-12-21 16:03:43 +02:00
InversionSpaces
3b31da9a41
Revert "Add header to builtin.aqua (#70)" (#72)
This reverts commit f8d7738798d38e5d2cbbe31f5009eb71a5b79101.
2023-12-21 16:03:30 +02:00
InversionSpaces
a062fcd444
Remove binary.aqua (#71) 2023-12-21 15:29:37 +02:00
InversionSpaces
f8d7738798
Add header to builtin.aqua (#70) 2023-12-21 11:37:07 +01:00
fluencebot
a59acbf40e
chore(main): release aqua-lib 0.8.2 (#68) 2023-12-13 15:37:16 +01:00
Aleksey Proshutinskiy
401621a389
feat(workers): add activate/deactivate (#65) 2023-11-27 20:34:22 +02:00
fluencebot
e0c0d953f6
chore(main): release aqua-lib 0.8.1 (#67) 2023-11-15 19:08:59 +02:00
Aleksey Proshutinskiy
f3b2144e35
fix(buitin): update Srv.list result type (#66) 2023-11-15 18:57:30 +02:00
fluencebot
a3ce915a11
chore(main): release aqua-lib 0.8.0 (#62) 2023-11-14 14:59:24 +02:00
Aleksey Proshutinskiy
0363446d79
feat(workers)!: deprecate API w/o deal_id; add list [NET-565] (#61) (#64)
BREAKING CHANGE: 
- deprecate the usage of Worker.get_peer_id that throws
- deprecate the usage of Worker API without deal_id (cli already generates deal_id even for workers deploy)
- add Worker.list
- rename DealWorker to Worker
2023-11-14 14:06:42 +02:00
Aleksey Proshutinskiy
658d63472c
Revert "feat(workers): deprecate API w/o deal_id; add list [NET-565] (#61)" (#63)
This reverts commit cce6da5f423837a1f0748150f9c703cae4f05fa5.
2023-11-14 14:01:05 +02:00
Aleksey Proshutinskiy
cce6da5f42
feat(workers): deprecate API w/o deal_id; add list [NET-565] (#61) 2023-11-14 13:58:37 +02:00
fluencebot
6dff62c393
chore(main): release aqua-lib 0.7.7 (#59) 2023-09-22 17:16:30 +03:00
Aleksey Proshutisnkiy
7402e0c072
fix(workers): fix get_worker_id signature (#58) 2023-09-22 17:14:49 +03:00
fluencebot
39da3b5b5c
chore(main): release aqua-lib 0.7.6 (#57) 2023-09-22 15:51:36 +03:00
Aleksey Proshutisnkiy
a773935d65
fix(subnet): change worker_id type (#56) 2023-09-22 14:44:29 +03:00
fluencebot
7634d381d1
chore(main): release aqua-lib 0.7.5 (#55) 2023-09-21 18:56:10 +02:00
Artsiom Shamsutdzinau
3c78d8693f
fix: add subnet.aqua to "files" 2023-09-21 18:54:55 +02:00
fluencebot
3da9ce925b
chore(main): release aqua-lib 0.7.4 (#52) 2023-09-21 18:34:44 +03:00
shamsartem
428365b886
feat(builtin): add subnet.resolve 2023-09-21 18:08:24 +03:00
Aleksey Proshutisnkiy
8447625cfa
feat(workers): add Worker.get_worker_id [NET-523] (#51) 2023-08-31 11:57:17 +03:00
Aleksey Proshutisnkiy
c47dd03e8c
feat(builtin): add resolve_alias_opt [NET-528] (#50) 2023-08-31 11:43:46 +03:00
fluencebot
67edcbb584
chore(main): release aqua-lib 0.7.3 (#48) 2023-08-07 22:22:46 +03:00
Aleksey Proshutisnkiy
fbde8e97c2
feat(builtin): add vault service (#49) 2023-07-17 15:13:20 +03:00
Aleksey Proshutisnkiy
8db811843c
feat: update blueprint API [NET-488] (#45) 2023-06-28 15:51:36 +03:00
fluencebot
b849728f05
chore(main): release aqua-lib 0.7.2 (#47) 2023-06-27 17:29:50 +02:00
Maria Kuklina
ca0af31ace
fix: add workers.aqua to aqua-lib package (#46) 2023-06-27 17:18:06 +02:00
fluencebot
a6f4a2af5a
chore(main): release aqua-lib 0.7.1 (#40) 2023-05-30 16:22:02 +02:00
shamsartem
96af0d4d4d
feat: add console-run (#44) 2023-05-30 16:20:18 +02:00
Maria Kuklina
d4b2e5dd40
extend peer identify api (#43) 2023-04-03 12:31:30 +02:00
Aleksey Proshutisnkiy
f575e71e05
feat(builtin): add worker builtin definition [NET-397] (#42) 2023-03-22 17:21:44 +04:00
Aleksey Proshutisnkiy
d7bc270d36
feat: update Service data structure (#39) 2023-02-24 14:43:36 +04:00
mikhail-1e20
419156c67d
docs: README+ updates (#37) 2023-02-23 21:05:17 +03:00
Anatolios Laskaris
4cd81dbe43
chore: Add release-please and update PR CI (#35)
* Add release-please and update PR CI

* Add renovate config

* Update renovate config

* Fix
2023-02-15 15:46:11 +02:00
folex
c1d0209c81 chore: bump to 0.7.0 😅 2023-02-15 19:13:22 +07:00
folex
e7e5fb41ca
chore: bump version to 0.3.0 2023-02-15 19:09:52 +07:00
folex
94ff99be24
feat!(builtins): srv.info, dist.get_blueprint (#34) 2023-02-15 19:07:33 +07:00
folex
f9ff829413
fix(dist): outline full ModuleConfig structure (#32) 2023-02-15 18:48:10 +07:00
Maria Kuklina
6f7f0cefb5
Add interface for stats (#30) 2022-12-26 14:49:58 +03:00
Aleksey Proshutisnkiy
9870e454a2
feat: add and, or and not (#31) 2022-11-18 16:42:48 +04:00
Maria Kuklina
c48bf22d0d
Fix Service data type (#29)
Add the `aliases` field to match what actually is returning from the node
2022-10-27 15:30:05 +03:00
Pavel
70c78e4f0d
Rename Sig.get_pub_key() to Sig.get_peer_id() (#28) 2022-09-05 21:18:21 +03:00
folex
3d5565f0e9
BREAKING CHANGE: Fix get_contact, clarify connect and is_connected docs (#27) 2022-08-26 10:07:08 +03:00
Maria Kuklina
3298a0e23c
Extend Script service interface with add_from_vault (#26) 2022-06-23 15:09:12 +03:00
folex
d24d2bf6ed
Remove delay from Script.add (#25) 2022-04-25 17:21:02 +04:00
Mike Voronov
69dbb49db6
Improve Script.add signature and docs (#24) 2022-04-25 17:07:22 +04:00
Aleksey Proshutisnkiy
1e892f4ac1
Sig: default tetraplets: get_key_bytes -> get_route_bytes (#23) 2022-03-11 00:52:38 +04:00
folex
8820344f60
Add math.aqua (#21) 2022-03-01 03:40:42 +07:00
boneyard93501
df80149d05
replace aqua-dht link with aqua-lib link 2022-02-28 05:14:22 -06:00
Dima
7e157fbd75
add Debug stringify function service (#22) 2022-02-28 12:17:26 +03:00
folex
c64babf199
Add max_heap_size to Dist.make_module_config 2022-02-08 17:45:53 +03:00
Pavel
83efd3dd74
Sig service redesign (#20) 2022-02-04 21:18:03 +03:00
folex
04e5d1775c
Add node_version and air_version to (op identify) (#19) 2022-01-26 14:16:44 +03:00
Dima
b1bab7036b
Update builtin.aqua 2021-12-27 15:17:14 +03:00
Pavel
75a978c779
Add definition of Sig service (#18) 2021-12-13 18:38:57 +03:00
folex
7ce35fdc74
Bug: change Script.list to return an array of ScriptInfo (#17) 2021-12-06 16:36:38 +03:00
folex
1193236fe7
Peer.timeout: make message non-optional (#16) 2021-11-24 09:52:21 +03:00
folex
0e87271350
Add Peer.timeout (#15) 2021-11-21 18:48:47 +03:00
folex
b90f2dddc3
Remove optional arguments from Op.concat and Op.array (#13)
Op.concat and Op.array do not expect optional arguments to be passed. This causes all sorts of bugs.
2021-10-26 17:47:46 +03:00
Aleksey Proshutisnkiy
049e761810
kad merge: document default count = 20 (#10) 2021-08-12 14:44:44 +03:00
folex
fde133e750 CI: Fix NPM link 2021-07-30 18:09:44 +03:00
folex
a12ebdf755
Switch to manual releases & automatic changelog (#9) 2021-07-30 17:53:16 +03:00
folex
49f3b39e4a
README: link to doc & add example 2021-07-30 15:00:01 +03:00
folex
0842501dfe Add new Op and Dist functions 2021-07-22 19:36:51 +03:00
folex
47875e6465
CI: check Aqua compilation (#7) 2021-07-05 15:26:22 +03:00
folex
15953e92eb
Add Op.array_length (#6) 2021-07-02 19:00:05 +03:00
folex
4b6cbbc31e
Add make_blueprint, make_module_config + use optional arguments (#5) 2021-07-02 18:53:53 +03:00
Pavel Murygin
a42965f53c Fix get_interface signature 2021-06-18 19:53:57 +03:00
folex
9207b76aeb
Add ops: noop, array, concat; change identity signature (#4) 2021-06-03 17:57:39 +03:00
folex
580cb7f596
Add kad merge, resolve_aliad, sha256_string (#3) 2021-06-03 16:36:34 +03:00
18 changed files with 15487 additions and 144 deletions

11
.github/release-please/config.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"bootstrap-sha": "c1d0209c81976c2b232b13f5526e81dba0875f05",
"release-type": "node",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"component": "aqua-lib"
}
}
}

3
.github/release-please/manifest.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
".": "0.12.1"
}

29
.github/renovate.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"enabledManagers": ["npm", "github-actions"],
"schedule": "every weekend",
"packageRules": [
{
"matchUpdateTypes": ["major"],
"prConcurrentLimit": 1
},
{
"matchManagers": ["github-actions"],
"prPriority": 1
},
{
"matchManagers": ["npm"],
"matchPackagePatterns": [
"@fluencelabs/.*"
],
"schedule": "at any time"
},
{
"matchDepTypes": ["devDependencies"],
"prPriority": -1
}
]
}

31
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: "ci"
on:
pull_request:
push:
branches:
- "main"
env:
FORCE_COLOR: true
jobs:
check-compiles:
name: "Check Aqua compiles"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
cache: "npm"
- run: npm i
- name: Check compilation
run: npm run compile-dry

35
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: lint
on:
pull_request:
types:
- opened
- edited
- synchronize
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
pr:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint actions
uses: reviewdog/action-actionlint@v1
env:
SHELLCHECK_OPTS: "-e SC2086"
with:
reporter: github-pr-check
fail_on_error: true

View File

@ -1,70 +1,124 @@
name: "publish-release" name: "release-please"
on: on:
push: push:
branches: branches:
- "main" - "main"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
env:
FORCE_COLOR: true
jobs: jobs:
npm-publish: release-please:
name: "Publish"
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run: outputs:
shell: bash releases-created: ${{ steps.release.outputs.releases_created }}
fluence-cli-release-created: ${{ steps.release.outputs['release_created'] }}
fluence-cli-tag-name: ${{ steps.release.outputs['tag_name'] }}
steps: steps:
- name: Checkout repository - name: Run release-please
uses: actions/checkout@v2 id: release
uses: google-github-actions/release-please-action@v3
### Calculate FINAL_VERSION
- name: Install jq
run: sudo apt-get update && sudo apt-get --yes --force-yes install jq
- name: Get version from npm and increment
run: |
yarn global add semver
PATH="$(yarn global bin):$PATH"
# take npm version and increment it
PKG_NAME="$(cat package.json | jq -r .name)"
NPM_VERSION="$(yarn info --silent "$PKG_NAME" version || true)"
NEXT_NPM_VERSION="$(semver --increment patch "$NPM_VERSION")"
# take local version
LOCAL_VERSION="$(cat package.json | jq -r .version)"
# take maximum of the local and NEXT_NPM versions
MAX_VERSION="$(semver "$LOCAL_VERSION" "$NEXT_NPM_VERSION" "0.0.0" | tail -n1)"
# save info to env
echo "FINAL_VERSION=$MAX_VERSION" | tee -a $GITHUB_ENV
echo "PKG_NAME=$PKG_NAME" | tee -a $GITHUB_ENV
### Set version
- name: Set version to ${{ env.FINAL_VERSION }}
run: yarn version --new-version ${{ env.FINAL_VERSION }} --no-git-tag-version
### Publish to NPM registry
- uses: actions/setup-node@v1
with: with:
node-version: "14" token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
- name: Show output from release-please
if: steps.release.outputs.releases_created
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
aqua-lib:
if: needs.release-please.outputs.fluence-cli-release-created
runs-on: ubuntu-latest
needs:
- release-please
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
cache: "npm"
- run: npm publish --access public - run: npm i
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }}
### Create a release - name: Publish to npm registry
- name: Create Release run: npm publish --access public --tag unstable
id: create_release
uses: actions/create-release@v1 slack:
env: if: always()
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} name: "Notify"
runs-on: ubuntu-latest
needs:
- release-please
- aqua-lib
permissions:
contents: read
id-token: write
steps:
- uses: lwhiteley/dependent-jobs-result-check@v1
id: status
with: with:
tag_name: ${{ env.FINAL_VERSION }} statuses: failure
release_name: Aqua lib ${{ env.FINAL_VERSION }} dependencies: ${{ toJSON(needs) }}
body: |
[${{ env.FINAL_VERSION }} @ NPM registry](https://www.npmjs.com/package/${{ env.PKG_NAME }}/v/${{ env.FINAL_VERSION }}) - name: Log output
draft: false run: |
prerelease: false echo "statuses:" "${{ steps.status.outputs.statuses }}"
echo "jobs:" "${{ steps.status.outputs.jobs }}"
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
- uses: ravsamhq/notify-slack-action@v2
if: steps.status.outputs.found == 'true'
with:
status: "failure"
notification_title: "*{workflow}* has {status_message}"
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
footer: "<{run_url}>"

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.tgz *.tgz
node_modules/

158
CHANGELOG.md Normal file
View File

@ -0,0 +1,158 @@
# Changelog
## [0.12.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.12.0...aqua-lib-v0.12.1) (2024-09-18)
### Bug Fixes
* fix Peer.identify return type ([#92](https://github.com/fluencelabs/aqua-lib/issues/92)) ([cba9b78](https://github.com/fluencelabs/aqua-lib/commit/cba9b785a3eae32bfd02d55d08febdd076540844))
## [0.12.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.11.0...aqua-lib-v0.12.0) (2024-09-12)
### ⚠ BREAKING CHANGES
* **builtins:** update peer.identify
### Features
* **builtins:** update peer.identify ([c8efe9c](https://github.com/fluencelabs/aqua-lib/commit/c8efe9c33a0730a5ebaeb17228c2f4db90f7729e))
## [0.11.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.10.2...aqua-lib-v0.11.0) (2024-08-08)
### ⚠ BREAKING CHANGES
* change Worker type in SubnetResolveResult ([#88](https://github.com/fluencelabs/aqua-lib/issues/88))
### Features
* change Worker type in SubnetResolveResult ([#88](https://github.com/fluencelabs/aqua-lib/issues/88)) ([f8ef9f3](https://github.com/fluencelabs/aqua-lib/commit/f8ef9f3a5408354026b6b6fccbf3689b492ff929))
## [0.10.2](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.10.1...aqua-lib-v0.10.2) (2024-02-24)
### Features
* Add new method for module upload from vault ([b439997](https://github.com/fluencelabs/aqua-lib/commit/b439997ba77168ea7a5e773368e0a03c6167d988))
## [0.10.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.10.0...aqua-lib-v0.10.1) (2024-02-19)
### Features
* **worker:** change cu_ids type ([#84](https://github.com/fluencelabs/aqua-lib/issues/84)) ([c92d3e3](https://github.com/fluencelabs/aqua-lib/commit/c92d3e3363a936b0ba4db6bd0b2e2e42337bcfd1))
## [0.10.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.9.1...aqua-lib-v0.10.0) (2024-02-19)
### ⚠ BREAKING CHANGES
* **worker:** add cu_ids to worker create ([#82](https://github.com/fluencelabs/aqua-lib/issues/82))
### Features
* **worker:** add cu_ids to worker create ([#82](https://github.com/fluencelabs/aqua-lib/issues/82)) ([5414624](https://github.com/fluencelabs/aqua-lib/commit/54146241562fcece7fd6783305d2c5fd32aa6da8))
## [0.9.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.9.0...aqua-lib-v0.9.1) (2024-01-15)
### Features
* **aqua-lib:** Add headers ([60b91de](https://github.com/fluencelabs/aqua-lib/commit/60b91def4a481e56f849f5d04734d117eb29c902))
## [0.9.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.8.2...aqua-lib-v0.9.0) (2023-12-21)
### ⚠ BREAKING CHANGES
* **binary:** Remove binary.aqua ([#75](https://github.com/fluencelabs/aqua-lib/issues/75))
### Features
* **builtin:** Add header to builtin.aqua ([#74](https://github.com/fluencelabs/aqua-lib/issues/74)) ([09c2cd9](https://github.com/fluencelabs/aqua-lib/commit/09c2cd9c07ad25af673dc6f69e5ce4599428dfc0))
### Bug Fixes
* **binary:** Remove binary.aqua ([#75](https://github.com/fluencelabs/aqua-lib/issues/75)) ([f89ecfb](https://github.com/fluencelabs/aqua-lib/commit/f89ecfbe7910aed418a30400b4d6de4a82efa197))
## [0.8.2](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.8.1...aqua-lib-v0.8.2) (2023-11-27)
### Features
* **workers:** add activate/deactivate ([#65](https://github.com/fluencelabs/aqua-lib/issues/65)) ([401621a](https://github.com/fluencelabs/aqua-lib/commit/401621a38930c8166984ecbf03edede451fe9487))
## [0.8.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.8.0...aqua-lib-v0.8.1) (2023-11-15)
### Bug Fixes
* **buitin:** update Srv.list result type ([#66](https://github.com/fluencelabs/aqua-lib/issues/66)) ([f3b2144](https://github.com/fluencelabs/aqua-lib/commit/f3b2144e35c972c09b1121cdd9fc51135eb6cd68))
## [0.8.0](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.7...aqua-lib-v0.8.0) (2023-11-14)
### ⚠ BREAKING CHANGES
* **workers:**
### Features
* **workers:** deprecate API w/o deal_id; add list [NET-565] ([#61](https://github.com/fluencelabs/aqua-lib/issues/61)) ([cce6da5](https://github.com/fluencelabs/aqua-lib/commit/cce6da5f423837a1f0748150f9c703cae4f05fa5))
* **workers:** deprecate API w/o deal_id; add list [NET-565] ([#61](https://github.com/fluencelabs/aqua-lib/issues/61)) ([#64](https://github.com/fluencelabs/aqua-lib/issues/64)) ([0363446](https://github.com/fluencelabs/aqua-lib/commit/0363446d790f7fd19d632e1016aee99f92ca9b39))
## [0.7.7](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.6...aqua-lib-v0.7.7) (2023-09-22)
### Bug Fixes
* **workers:** fix get_worker_id signature ([#58](https://github.com/fluencelabs/aqua-lib/issues/58)) ([7402e0c](https://github.com/fluencelabs/aqua-lib/commit/7402e0c072a0dd95e5321cba292ae58608ded82a))
## [0.7.6](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.5...aqua-lib-v0.7.6) (2023-09-22)
### Bug Fixes
* **subnet:** change worker_id type ([#56](https://github.com/fluencelabs/aqua-lib/issues/56)) ([a773935](https://github.com/fluencelabs/aqua-lib/commit/a773935d65d484f715a7349521d9802eb8f32f4a))
## [0.7.5](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.4...aqua-lib-v0.7.5) (2023-09-21)
### Bug Fixes
* add subnet.aqua to "files" ([3c78d86](https://github.com/fluencelabs/aqua-lib/commit/3c78d8693f909da9ec935e59bb2f48a862532dc9))
## [0.7.4](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.3...aqua-lib-v0.7.4) (2023-09-21)
### Features
* **builtin:** add resolve_alias_opt [NET-528] ([#50](https://github.com/fluencelabs/aqua-lib/issues/50)) ([c47dd03](https://github.com/fluencelabs/aqua-lib/commit/c47dd03e8cd20c6e5d30634adf3991289e1bde50))
* **builtin:** add subnet.resolve ([428365b](https://github.com/fluencelabs/aqua-lib/commit/428365b886f0690090fa0c7241111c62ab792d9c))
* **workers:** add Worker.get_worker_id [NET-523] ([#51](https://github.com/fluencelabs/aqua-lib/issues/51)) ([8447625](https://github.com/fluencelabs/aqua-lib/commit/8447625cfaa8bb1973427a0e989ef16143cc204a))
## [0.7.3](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.2...aqua-lib-v0.7.3) (2023-07-17)
### Features
* **builtin:** add vault service ([#49](https://github.com/fluencelabs/aqua-lib/issues/49)) ([fbde8e9](https://github.com/fluencelabs/aqua-lib/commit/fbde8e97c2344f9ded12327c0f27bafe56e66999))
* update blueprint API [NET-488] ([#45](https://github.com/fluencelabs/aqua-lib/issues/45)) ([8db8118](https://github.com/fluencelabs/aqua-lib/commit/8db811843c6c377c68b9927bc3bae1eca6944ab6))
## [0.7.2](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.1...aqua-lib-v0.7.2) (2023-06-27)
### Bug Fixes
* add workers.aqua to aqua-lib package ([#46](https://github.com/fluencelabs/aqua-lib/issues/46)) ([ca0af31](https://github.com/fluencelabs/aqua-lib/commit/ca0af31ace0122898382001a2403d905c829ae90))
## [0.7.1](https://github.com/fluencelabs/aqua-lib/compare/aqua-lib-v0.7.0...aqua-lib-v0.7.1) (2023-05-30)
### Features
* add console-run ([#44](https://github.com/fluencelabs/aqua-lib/issues/44)) ([96af0d4](https://github.com/fluencelabs/aqua-lib/commit/96af0d4d4d7c40562142896a5d6500c4e991302f))
* **builtin:** add worker builtin definition [NET-397] ([#42](https://github.com/fluencelabs/aqua-lib/issues/42)) ([f575e71](https://github.com/fluencelabs/aqua-lib/commit/f575e71e054cca529190835ed1cb2f605a544b70))
* update Service data structure ([#39](https://github.com/fluencelabs/aqua-lib/issues/39)) ([d7bc270](https://github.com/fluencelabs/aqua-lib/commit/d7bc270d361c25ac087f989d9eb2c6c86d7fba6b))

13
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,13 @@
## Contribute Code
You are welcome to contribute to Fluence!
Things you need to know:
1. You need to **agree to the [Contributor License Agreement](https://gist.github.com/fluencelabs-org/3f4cbb3cc14c1c0fb9ad99d8f7316ed7) (CLA)**. This is a common practice in all major Open Source projects. At the current moment, we are unable to accept contributions made on behalf of a company. Only individual contributions will be accepted.
2. **Not all proposed contributions can be accepted**. Some features may, e.g., just fit a third-party add-on better. The contribution must fit the overall direction of Fluence and really improve it. The more effort you invest, the better you should clarify in advance whether the contribution fits: the best way would be to just open an issue to discuss the contribution you plan to make.
### Contributor License Agreement
When you contribute, you have to be aware that your contribution is covered by **[Apache License 2.0](./LICENSE)**, but might relicensed under few other software licenses mentioned in the **Contributor License Agreement**. In particular, you need to agree to the Contributor License Agreement. If you agree to its content, you simply have to click on the link posted by the CLA assistant as a comment to the pull request. Click it to check the CLA, then accept it on the following screen if you agree to it. The CLA assistant will save this decision for upcoming contributions and will notify you if there is any change to the CLA in the meantime.

202
LICENSE
View File

@ -1,7 +1,201 @@
Copyright 2021 Fluence Labs Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 1. Definitions.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. "License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

28
README.md Normal file
View File

@ -0,0 +1,28 @@
# Aqua-lib
[![npm](https://img.shields.io/npm/v/@fluencelabs/aqua-lib)](https://www.npmjs.com/package/@fluencelabs/aqua-lib)
[Aqua](https://github.com/fluencelabs/aqua) is a new-generation language for distributed systems, the core of [Fluence](https://fluence.network). Aqua programs are executed on many peers, sequentially or in parallel, forming a single-use coordination network. Aqua's runtime is heterogeneous: it includes browsers, servers, devices, all involved in solving a single task. Therefore, Aqua scripts are compiled into several targets at once, with AIR and Typescript as a default.
**Aqua-lib** is the API of the protocol-level functions in the [Fluence](https://github.com/fluencelabs/fluence-cli) network. This API is available on all peers powered by Fluence nodes and a part of the API is available on JS/TS-based peers.
## Documentation
Comprehensive documentation on Fluence is available [here](https://fluence.network/). Detailed instructions and usage examples on Aqua can be found in our dedicated [Aqua Book](https://fluence.dev/docs/aqua-book/introduction).
## Support
Please, file an [issue](https://github.com/fluencelabs/aqua-lib/issues) if you find a bug. You can also contact us at [Discord](https://discord.com/invite/5qSnPZKh7u) or [Telegram](https://t.me/fluence_project). We will do our best to resolve the issue ASAP.
## Contributing
Any interested person is welcome to contribute to the project. Please, make sure you read and follow some basic [rules](./CONTRIBUTING.md).
## License
All software code is copyright (c) Fluence Labs, Inc. under the [Apache-2.0](./LICENSE) license.

View File

@ -1,14 +1,25 @@
-- Default public interface of Fluence nodes -- Default public interface of Fluence nodes
aqua Builtin declares *
alias Field : []string alias Field : []string
alias Argument : []string alias Argument : []string
alias Bytes : []u8 alias Bytes : []u8
alias PeerId : string alias PeerId : string
alias Pairs : [][]string
alias Base58String : string
alias Hash : string
alias IPLDBlueprint : string
alias CID : string
alias Path : string
data Service: data Service:
id: string id: string
blueprint_id: string blueprint_id: string
-- `spell` or `service`
service_type: string
owner_id: string owner_id: string
aliases: []string
worker_id: string
data FunctionSignature: data FunctionSignature:
arguments: []Argument arguments: []Argument
@ -24,66 +35,130 @@ data Interface:
function_signatures: []FunctionSignature function_signatures: []FunctionSignature
record_types: []RecordType record_types: []RecordType
data ServiceInfo: data VmInfo:
blueprint_id: string ip: string
service_id: string default_ssh_port: u16
interface: Interface forwarded_ports: []string
data Info: data Info:
external_addresses: []string external_addresses: []string
node_version: string
air_version: string
spell_version: string
allowed_binaries: []string
vm_info: ?VmInfo
data ModuleWASIConfig:
envs: ?Pairs
mapped_dirs: ?Pairs
mounted_binaries: ?Pairs
data ModuleConfig: data ModuleConfig:
name: string name: string
mem_pages_count: ?u32
max_heap_size: ?string
logger_enabled: ?bool
logging_mask: ?i32
wasi: ?ModuleWASIConfig
data Module: data Module:
name: string name: string
hash: string hash: string
config: ModuleConfig config: ModuleConfig
data AddBlueprint:
name: string
dependencies: []string
data Blueprint: data Blueprint:
id: string id: string
name: string name: string
dependencies: []string dependencies: []CID
data ScriptInfo:
id: string
src: string
failures: u32
interval: string
owner: string
data Contact: data Contact:
peer_id: string peer_id: string
addresses: []string addresses: []string
-- A collection of measurements of a stat.
-- `avg` and `total` fields are computed over all measured stats and
-- `series` stores only several last measurements. The number of measurements
-- is configured on each peer.
data SeriesStat:
avg: f64
series: []f64
total: f64
data Stats:
-- Number of successful request
success_req_count: u64
-- Number of failed request
failed_req_count: u64
-- Duration of call execution in seconds
call_time_sec: SeriesStat
-- Amount of addintionally allocated memory after a call
memory_deltas_bytes: SeriesStat
-- Timestamps of the last measurments
timestamps: []u64
data FunctionStat:
name: string
-- Series contain last measurements that were taken from last N calls to this function
stats: Stats
data ServiceStat:
-- Stats for the requested service in total.
-- Series contain last measurements that were taken from last N calls to the service
total_stats: Stats
-- Stats for each interface function of the service
functions_stats: []FunctionStat
data StatResult:
status: bool
error: string
result: ?ServiceStat
data MemoryStat:
-- module name
name: string
memory_size_bytes: u64
max_memory_size_bytes: u64
service Op("op"): service Op("op"):
identity() -- does nothing
string_to_b58(s: string) -> string noop()
string_from_b58(b: string) -> string
bytes_to_b58(bs: []u8) -> string -- returns length of the passed array
bytes_from_b58(b: string) -> []u8 array_length(array: []string) -> u32
-- takes any number of arguments and wraps them into a single array
-- see the doc on varargs https://doc.fluence.dev/aqua-book/libraries/aqua-lib#functions-with-a-variable-number-of-arguments
array(a: string, b: string, c: string, d: string) -> []string
-- takes any number of arrays and flattens them by concatenating
-- see the doc on varargs https://doc.fluence.dev/aqua-book/libraries/aqua-lib#functions-with-a-variable-number-of-arguments
concat(a: []string, b: []string, c: []string, d: []string) -> []string
-- takes a single argument and returns it back
identity(s: ?string) -> ?string
-- encodes string's utf8 bytes as base58
string_to_b58(s: string) -> Base58String
-- decodes base58 to bytes to utf8 string
-- throws error on invalid UTF8
string_from_b58(b: Base58String) -> string
-- encodes bytes as base58
bytes_to_b58(bs: []u8) -> Base58String
-- decodes base58 to bytes
bytes_from_b58(b: Base58String) -> []u8
-- Applies SHA256 to the given string
-- Argument: s - string to apply sha256 to (hash is applied to utf8 bytes of s)
-- Returns: returns sha256 multihash encoded as base58
sha256_string(s: string) -> Base58String
-- concatenate strings (in AIR it takes any number of arguments)
concat_strings(a: string, b: string) -> string
service Peer("peer"): service Peer("peer"):
-- Checks if there is a direct connection to the peer identified by a given PeerId
-- Argument: PeerId id of the peer to check if there's a connection with
-- Returns: bool - true if connected to the peer, false otherwise
is_connected(peer: PeerId) -> bool
-- Initiates a connection to the specified peer
-- Arguments:
-- PeerId id of the target peer
-- [Multiaddr] an array of target peer's addresses
-- Returns: bool - true if connection was successful
connect(id: PeerId, multiaddrs: []string) -> bool
-- Resolves the contact of a peer via Kademlia
-- Argument: PeerId id of the target peer
-- Returns: Contact - true if connection was successful
get_contact(peer: PeerId) -> Contact
-- Get information about the peer -- Get information about the peer
identify() -> Info identify() -> Info
@ -93,10 +168,55 @@ service Peer("peer"):
-- Get Unix timestamp in seconds -- Get Unix timestamp in seconds
timestamp_sec() -> u64 timestamp_sec() -> u64
-- Blocks for the given number of milliseconds. Meant to be used within `par` blocks.
-- message is returned after duration has passed
timeout(duration_ms: u64, message: string) -> string
---- Low level functions for accessing connection pool
-- Checks if there is a direct connection to the peer identified by a given PeerId
-- Argument: PeerId id of the peer to check if there's a connection with
-- Returns: bool - true if connected to the peer, false otherwise
-- NOTE:
-- This is a very low-level function, it most likely won't fit your goals.
-- It's almost always better to use race pattern to check connectivity.
-- See https://doc.fluence.dev/aqua-book/language/flow/parallel#timeout-and-race-patterns
is_connected(peer: PeerId) -> bool
-- Initiates a connection to the specified peer
-- Arguments:
-- id - id of the target peer
-- multiaddrs an array of target peer's addresses
-- Returns: bool - true if connection was successful
-- NOTE:
-- This is a low-level function, it most likely won't fit your goals.
-- Most often you just need to use `on id:` and connection will be established automatically.
connect(id: PeerId, multiaddrs: []string) -> bool
-- Returns known multiaddresses of a peer
-- Argument: PeerId id of the target peer
-- Returns:
-- Contact - if target peer is connected to current peer,
-- return data structure with multiaddresses inside, and nil otherwise.
get_contact(peer: PeerId) -> ?Contact
service Kademlia("kad"): service Kademlia("kad"):
-- Instructs node to return the locally-known nodes -- Instructs node to return the locally-known nodes
-- in the Kademlia neighborhood for a given key -- in the Kademlia neighborhood for a given key
neighborhood(key: PeerId, already_hashed: bool) -> []PeerId -- Arguments:
-- key base58 string
-- already_hashed default false; if set to true, key is considered to be a SHA256 multihash
-- count default 20; limits number of returned nodes
neighborhood(key: Base58String, already_hashed: ?bool, count: ?u32) -> []PeerId
-- Merges given lists and sorts them by distance to target
-- Arguments:
-- target base58 string; result is sorted by XOR distance to target
-- left list of base58 strings
-- right list of base58 strings
-- count how many items to return; default 20
-- Returns: list of base58 strings sorted by distance to target; list will contain at most count elements
merge(target: Base58String, left: []string, right: []string, count: ?u32) -> []string
service Srv("srv"): service Srv("srv"):
-- Used to create a service on a certain node -- Used to create a service on a certain node
@ -115,44 +235,145 @@ service Srv("srv"):
-- Adds an alias on service, so, service could be called -- Adds an alias on service, so, service could be called
-- not only by service_id but by alias as well. -- not only by service_id but by alias as well.
-- Argument: -- Arguments:
-- alias - settable service name -- alias - settable service name
-- service_id ID of the service whose interface you want to name. -- service_id ID of the service whose interface you want to name.
add_alias(alias: string, service_id: string) add_alias(alias: string, service_id: string)
-- Resolves given alias to a service id
-- If there's no such alias, throws an error
-- Returns: service id associated with the given alias
resolve_alias(alias: string) -> string
-- Resolves given alias to a service id
-- If there's no such alias, returns nil
-- Returns: service id associated with the given alias or nil
resolve_alias_opt(alias: string) -> ?string
-- Retrieves the functional interface of a service running -- Retrieves the functional interface of a service running
-- on the node specified in the service call -- on the node specified in the service call
-- Argument: service_id ID of the service whose interface you want to retrieve. -- Argument: service_id ID of the service whose interface you want to retrieve.
get_interface(service_id: string) -> ServiceInfo get_interface(service_id: string) -> Interface
-- Retrieves information about service
-- Argument: service_id ID or alias of the service
info(service_id: string) -> Service
service Dist("dist"): service Dist("dist"):
-- Constructs a ModuleConfig structure
-- Arguments:
-- module_name - import name of the module
-- mem_pages_count - Maximum memory size accessible by a module in Wasm pages (64 Kb)
-- logger_enabled - Defines whether Marine should provide a special host log_utf8_string function for this module
-- preopened_files - Files available for this module. Module can access only files from this list
-- envs - environment variables available for this module
-- mapped_dirs - Directory mapping, e.g. [["/sites", "./web/data"]] so all
-- reads & writes to /sites will actually to go ./web/data
-- mounted_binaries - Mapping of host binaries available to call from module,
-- e.g. [["curl", "/usr/bin/curl"]] will allow module to
-- call /usr/bin/curl binary as function 'curl'
-- logging_mask - Binary mask to enable & disable logging targets. Targets are
-- configured in WasmLoggerBuilder::with_target_map
-- mem_pages_count - (deprecated) Maximum memory size accessible by a module in Wasm pages (64 Kb)
-- max_heap_size - Maximum module heap size, in bytes
make_module_config(name: string, mem_pages_count: ?u32, max_heap_size: ?string, logger_enabled: ?bool, preopened_files: ?[]string, envs: ?Pairs, mapped_dirs: ?Pairs, mounted_binaries: ?Pairs, logging_mask: ?i32) -> ModuleConfig
-- Constructs a ModuleConfig structure
-- Arguments:
-- module_name - import name of the module
default_module_config(module_name: string) -> ModuleConfig
-- Used to add modules to the node specified in the service call -- Used to add modules to the node specified in the service call
-- Arguments: -- Arguments:
-- bytes a base64 string containing the .wasm module to add. -- bytes a base64 string containing the .wasm module to add.
-- config module info -- config module info
-- Returns: blake3 hash of the module -- Returns: blake3 hash of the module
-- NOTE: the config is IGNORED and only module's `name` is taken from it
add_module(wasm_b56_content: Bytes, conf: ModuleConfig) -> string add_module(wasm_b56_content: Bytes, conf: ModuleConfig) -> string
-- Adds module by copying it from Particle Vault directory
-- Arguments:
-- path path or a filename
-- config - module config
-- NOTE: the config is IGNORED and only module's `name` is taken from it
add_module_from_vault(path: Path, config: ModuleConfig) -> Hash
-- Adds module by copying it from Particle Vault directory
-- Arguments:
-- path path or a filename
-- config - module config
add_module_bytes_from_vault(name: string, module_cid: string) -> string
-- Get a list of modules available on the node -- Get a list of modules available on the node
list_modules() -> []Module list_modules() -> []Module
-- Get the interface of a module -- Get the interface of a module
get_interface(module_id: string) -> Interface get_module_interface(module_hash: string) -> Interface
-- Used to add a blueprint to the node specified in the service call -- Creates IPLD Blueprint structure from blueprint name and dependencies (modules)
add_blueprint(blueprint: AddBlueprint) -> string make_blueprint(name: string, dependencies: []CID) -> IPLDBlueprint
-- Add an IPLD blueprint to the node
add_blueprint(blueprint: IPLDBlueprint) -> string
-- Loads blueprint by copying it from Particle Vault directory
-- Arguments:
-- blueprint_path path in Particle Vault
load_blueprint(blueprint_path: Path) -> IPLDBlueprint
-- Used to get the blueprints available on the node specified in the service call. -- Used to get the blueprints available on the node specified in the service call.
-- A blueprint is an object of the following structure -- A blueprint is an object of the following structure
list_blueprints() -> []Blueprint list_blueprints() -> []Blueprint
service Script("script"): -- Get a single blueprint
-- Adds the given script to a node get_blueprint(blueprint_id: string) -> Blueprint
add(air_content: string, run_every: string) -> string
-- Removes recurring script from a node. Only a creator of the script can delete it data SignResult:
remove(script_id: string) -> bool -- Was call successful or not
success: bool
-- Error message. Will be null if the call is successful
error: ?string
-- Signature as byte array. Will be null if the call is not successful
signature: ?[]u8
-- Returns a list of existing scripts on the node. service Sig("sig"):
-- Each object in the list is of the following structure -- Signs data with the service's private key.
list() -> ScriptInfo -- Depending on implementation the service might check call params to restrict usage for security reasons.
-- By default it is only allowed to be used on the same peer the particle was initiated
-- and accepts data only from the following sources:
-- trust-graph.get_trust_bytes
-- trust-graph.get_revocation_bytes
-- registry.get_key_bytes (for FluenceJS only)
-- registry.get_record_bytes
-- registry.get_record_metadata_bytes
-- Argument: data - byte array to sign
-- Returns: signature as SignResult structure
sign(data: []u8) -> SignResult
-- Given the data and signature both as byte arrays, returns true if the signature is correct, false otherwise.
verify(signature: []u8, data: []u8) -> bool
-- Gets the peer id of the service's key pair.
get_peer_id() -> string
-- Available only on rust peers
-- Aquire service statistic
service Stat("stat"):
-- Detailed stats for the service and its interface functions
service_stat(service_id: string) -> StatResult
-- The amount of memeory allocated for each module of the service.
service_memory(service_id: string) -> []MemoryStat
-- Service for debugging purposes only
service Debug("debug"):
-- Convert any object into a string
stringify(o: ) -> string
service Console("run-console"):
print(any: )
-- Particle File Vault
service Vault("vault"):
-- Puts data into the vault and returns virtual path
put(data: string) -> Path
-- Returns the content of the file from the vault
cat(path: Path) -> string

48
math.aqua Normal file
View File

@ -0,0 +1,48 @@
aqua MathLib declares *
service Math("math"):
-- x + y
add(x: i64, y: i64) -> i64
-- x - y
sub(x: i64, y: i64) -> i64
-- x * y
mul(x: i64, y: i64) -> i64
-- floor(x * y)
fmul(x: f64, y: f64) -> i64
-- x / y
div(x: i64, y: i64) -> i64
-- division remainder, x % y
rem(x: i64, y: i64) -> i64
-- x^y
pow(x: i64, y: u32) -> i64
-- logarithm of y to base x
-- x logarithm base
log(x: i64, y: i64) -> u32
service Compare("cmp"):
-- x > y
gt(x: i64, y: i64) -> bool
-- x >= y
gte(x: i64, y: i64) -> bool
-- x < y
lt(x: i64, y: i64) -> bool
-- x <= y
lte(x: i64, y: i64) -> bool
-- compare x and y
-- x < y, return -1
-- x = y, return 0
-- x > y, return 1
cmp(x: i64, y: i64) -> i8
service Array("array"):
-- sum of all numbers in array
sum(xs: []i64) -> i64
-- remove duplicates, not stable
dedup(xs: []string) -> []string
-- set-intersection of two arrays, not stable, deduplicates
intersect(xs: []string, ys: []string) -> []string
-- set-difference of two arrays, not stable, deduplicates
diff(xs: []string, ys: []string) -> []string
-- symmetric difference of two arrays, not stable, deduplicates
sdiff(xs: []string, ys: []string) -> []string

14473
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,17 @@
{ {
"name": "@fluencelabs/aqua-lib", "name": "@fluencelabs/aqua-lib",
"version": "0.1.0", "version": "0.12.1",
"description": "Aqua standard library", "description": "Aqua standard library",
"files": [ "files": [
"builtin.aqua" "builtin.aqua",
"math.aqua",
"binary.aqua",
"workers.aqua",
"subnet.aqua"
], ],
"scripts": {}, "scripts": {
"compile-dry": "aqua -i . --dry"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/fluencelabs/aqua-lib.git" "url": "git+https://github.com/fluencelabs/aqua-lib.git"
@ -19,5 +25,8 @@
"bugs": { "bugs": {
"url": "https://github.com/fluencelabs/aqua-lib/issues" "url": "https://github.com/fluencelabs/aqua-lib/issues"
}, },
"homepage": "https://github.com/fluencelabs/aqua-lib#readme" "homepage": "https://github.com/fluencelabs/aqua-lib#readme",
"devDependencies": {
"@fluencelabs/aqua": "0.9.4"
}
} }

View File

@ -1,21 +0,0 @@
## Aqua
Aqua is a new-gen language for distributed systems.
Aqua programs are executed on many peers, sequentially
or in parallel, forming a single-use coordination network.
Aqua's runtime is heterogeneous: it includes browsers, servers, devices, all involved in solving a single task.
Therefore, Aqua scripts are compiled into several targets at once, with AIR and Typescript as a default.
## aqua-lib
TBD
### usage
TBD
### references
- To get started writing aqua see: https://github.com/fluencelabs/aqua-playground

17
subnet.aqua Normal file
View File

@ -0,0 +1,17 @@
aqua SubnetLib declares *
data Worker:
cu_ids: []string
host_id: string
worker_id: ?string
data SubnetResolveResult:
-- Was call successful or not
success: bool
-- Error message. Will be null if the call is successful
error: ?string
workers: []Worker
service Subnet("subnet"):
-- Returns a list of workers by deal id
resolve(deal_id: string) -> SubnetResolveResult

41
workers.aqua Normal file
View File

@ -0,0 +1,41 @@
aqua WorkersLib declares *
import PeerId from "./builtin.aqua"
alias CUID : []u8
-- Available only on rust peers
service Worker("worker"):
-- Creates new worker associated with `deal_id` and allows specifying custom `cu_ids`.
-- Arguments:
-- deal_id - ID of the deal
-- cu_ids an array of target compute unit IDs
-- Returns: PeerId - worker ID if creation was successful
-- Throws an error if a worker exists.
create(deal_id: string, cu_ids: []CUID) -> PeerId
-- Returns worker peer id associated with `deal_id`.
-- Returns nil if worker doesn't exist.
get_worker_id(deal_id: string) -> ?PeerId
-- Removes worker with all deployed spells and services.
-- Throws an error if worker doesn't exist.
-- Worker can be removed only by worker creator or worker itself.
remove(worker_id: PeerId)
-- Returns list of all workers.
list() -> []PeerId
-- Restarts worker installation spell.
-- Can be called only by system spells or peer manager,
-- Throws an error if worker doesn't exist.
activate(deal_id: string)
-- Stops all worker spells and drops all incoming particles until activation.
-- Can be called only by system spells or peer manager,
-- Throws an error if worker doesn't exist.
deactivate(deal_id: string)
-- Returns true if worker is active.
-- Throws an error if worker doesn't exist.
is_active(deal_id: string) -> bool