mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2024-12-05 02:10:18 +00:00
feat(fluence-network-environment): Introduce fluence-network-environment package (#442)
* Introduce fluence-network-environment package * Refactor types * Fix type * Remove BC * Update CLI * Remove fluence local up from CI * Add configs * Add type module * Update e2e file * Remove lock file * Revert "Add configs" This reverts commitade44760d1
. * Revert "Remove fluence local up from CI" This reverts commit477a12d889
.
This commit is contained in:
parent
aea5efb643
commit
9eeeb0fae0
@ -11,14 +11,13 @@
|
||||
"enum": [
|
||||
"dar",
|
||||
"stage",
|
||||
"kras",
|
||||
"local",
|
||||
"custom"
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"version": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"const": 0
|
||||
}
|
||||
},
|
||||
|
3
.github/release-please/config.json
vendored
3
.github/release-please/config.json
vendored
@ -13,6 +13,7 @@
|
||||
"packages/core/marine-worker": {},
|
||||
"packages/core/aqua-to-js": {},
|
||||
"packages/core/interfaces": {},
|
||||
"packages/core/npm-aqua-compiler": {}
|
||||
"packages/core/npm-aqua-compiler": {},
|
||||
"packages/core/fluence-network-environment": {}
|
||||
}
|
||||
}
|
||||
|
3
.github/release-please/manifest.json
vendored
3
.github/release-please/manifest.json
vendored
@ -4,5 +4,6 @@
|
||||
"packages/core/aqua-to-js": "0.3.13",
|
||||
"packages/core/js-client-isomorphic": "0.6.0",
|
||||
"packages/core/interfaces": "0.12.0",
|
||||
"packages/core/npm-aqua-compiler": "0.0.3"
|
||||
"packages/core/npm-aqua-compiler": "0.0.3",
|
||||
"packages/core/fluence-network-environment": "1.1.2"
|
||||
}
|
||||
|
2
.github/workflows/e2e.yml
vendored
2
.github/workflows/e2e.yml
vendored
@ -43,6 +43,7 @@ jobs:
|
||||
uses: fluencelabs/aqua/.github/workflows/tests.yml@main
|
||||
with:
|
||||
js-client-snapshots: "${{ needs.js-client.outputs.js-client-snapshots }}"
|
||||
nox-image: "docker.fluence.dev/nox:feat-vm-425-aquavm-mem-limits-from-config-2_5056_1"
|
||||
flox:
|
||||
needs:
|
||||
- js-client
|
||||
@ -50,3 +51,4 @@ jobs:
|
||||
uses: fluencelabs/flox/.github/workflows/tests.yml@main
|
||||
with:
|
||||
js-client-snapshots: "${{ needs.js-client.outputs.js-client-snapshots }}"
|
||||
nox-image: "docker.fluence.dev/nox:feat-vm-425-aquavm-mem-limits-from-config-2_5056_1"
|
||||
|
2
.github/workflows/run-tests.yml
vendored
2
.github/workflows/run-tests.yml
vendored
@ -28,4 +28,4 @@ jobs:
|
||||
uses: ./.github/workflows/tests.yml
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
nox-image: "docker.fluence.dev/nox:renovate-avm_4905_1"
|
||||
nox-image: "docker.fluence.dev/nox:feat-vm-425-aquavm-mem-limits-from-config-2_5056_1"
|
||||
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -81,6 +81,8 @@ jobs:
|
||||
|
||||
- name: Run nox network
|
||||
run: fluence local up
|
||||
env:
|
||||
FCLI_V_NOX: docker.fluence.dev/nox:feat-vm-425-aquavm-mem-limits-from-config-2_5056_1
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2.2.4
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue, ServiceDef } from "@fluencelabs/interfaces";
|
||||
import { ServiceDef } from "@fluencelabs/interfaces";
|
||||
|
||||
import { recursiveRenameLaquaProps } from "../utils.js";
|
||||
|
||||
@ -63,6 +63,6 @@ function generateRegisterServiceOverload(
|
||||
}
|
||||
|
||||
function serviceToJson(service: ServiceDef): string {
|
||||
const record: Record<never, JSONValue> = service;
|
||||
const record: Record<never, unknown> = service;
|
||||
return JSON.stringify(recursiveRenameLaquaProps(record), null, 4);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import { join } from "path";
|
||||
import {
|
||||
ArrowType,
|
||||
ArrowWithoutCallbacks,
|
||||
JSONValue,
|
||||
LabeledProductType,
|
||||
NilType,
|
||||
SimpleTypes,
|
||||
@ -67,7 +66,7 @@ export function getFuncArgs(
|
||||
}
|
||||
}
|
||||
|
||||
export function recursiveRenameLaquaProps(obj: JSONValue): unknown {
|
||||
export function recursiveRenameLaquaProps(obj: unknown): unknown {
|
||||
if (typeof obj !== "object" || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
@ -78,7 +77,9 @@ export function recursiveRenameLaquaProps(obj: JSONValue): unknown {
|
||||
});
|
||||
}
|
||||
|
||||
return Object.getOwnPropertyNames(obj).reduce((acc, prop) => {
|
||||
const objType: Record<never, unknown> = obj;
|
||||
|
||||
return Object.getOwnPropertyNames(objType).reduce((acc, prop) => {
|
||||
let accessProp = prop;
|
||||
|
||||
if (prop.includes("Laqua_js")) {
|
||||
@ -89,12 +90,14 @@ export function recursiveRenameLaquaProps(obj: JSONValue): unknown {
|
||||
throw new Error(`Bad property name: ${prop}.`);
|
||||
}
|
||||
|
||||
if (refinedProperty in obj) {
|
||||
if (refinedProperty in objType) {
|
||||
accessProp = refinedProperty;
|
||||
}
|
||||
}
|
||||
|
||||
const laquaProp = obj[accessProp];
|
||||
const accessObj: Record<string, unknown> = objType;
|
||||
|
||||
const laquaProp = accessObj[accessProp];
|
||||
|
||||
if (laquaProp === undefined) {
|
||||
return acc;
|
||||
|
16
packages/core/fluence-network-environment/.gitignore
vendored
Normal file
16
packages/core/fluence-network-environment/.gitignore
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
bundle/
|
||||
dist/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
28
packages/core/fluence-network-environment/CHANGELOG.md
Normal file
28
packages/core/fluence-network-environment/CHANGELOG.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Changelog
|
||||
|
||||
## [1.1.2](https://github.com/fluencelabs/fluence-network-environment/compare/fluence-network-environment-v1.1.1...fluence-network-environment-v1.1.2) (2023-07-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update DNS records after kras migration to Nomad ([#11](https://github.com/fluencelabs/fluence-network-environment/issues/11)) ([446df4f](https://github.com/fluencelabs/fluence-network-environment/commit/446df4f5eaa64d8d5b803e23f73b8cf8e4331d2e))
|
||||
|
||||
## [1.1.1](https://github.com/fluencelabs/fluence-network-environment/compare/fluence-network-environment-v1.1.0...fluence-network-environment-v1.1.1) (2023-07-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Actually build package ([#9](https://github.com/fluencelabs/fluence-network-environment/issues/9)) ([25ef57e](https://github.com/fluencelabs/fluence-network-environment/commit/25ef57e061d75abaa08d58a4fef89e71d9cfb4da))
|
||||
|
||||
## [1.1.0](https://github.com/fluencelabs/fluence-network-environment/compare/fluence-network-environment-v1.0.14...fluence-network-environment-v1.1.0) (2023-06-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Rename krasnodar to kras. Add functions to pick random nodes ([#4](https://github.com/fluencelabs/fluence-network-environment/issues/4)) ([a65217f](https://github.com/fluencelabs/fluence-network-environment/commit/a65217fd2e0d3c65f4ae54105b54018af778e92d))
|
||||
* Update stage multiaddr ([#7](https://github.com/fluencelabs/fluence-network-environment/issues/7)) ([3c0f1f8](https://github.com/fluencelabs/fluence-network-environment/commit/3c0f1f89a5f713e94ee0104bcf0fa9b66f8a5cca))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update testnet DNS records ([#8](https://github.com/fluencelabs/fluence-network-environment/issues/8)) ([2ed6209](https://github.com/fluencelabs/fluence-network-environment/commit/2ed6209c9c122fe2cd2b7811379c97163c64db88))
|
65
packages/core/fluence-network-environment/README.md
Normal file
65
packages/core/fluence-network-environment/README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# Fluence network environment
|
||||
|
||||
[![npm](https://img.shields.io/npm/v/@fluencelabs/fluence-network-environment)](https://www.npmjs.com/package/@fluencelabs/fluence-network-environment)
|
||||
|
||||
Maintained list of well-known Fluence network nodes. The package is meant to be used in combination with [Fluence JS SDK](https://github.com/fluencelabs/fluence-js).
|
||||
|
||||
## Installation
|
||||
|
||||
With npm
|
||||
|
||||
```bash
|
||||
npm install @fluencelabs/fluence-network-environment
|
||||
```
|
||||
|
||||
With yarn
|
||||
|
||||
```bash
|
||||
yarn add @fluencelabs/fluence-network-environment
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Pick a node to connect to the Fluence network.
|
||||
|
||||
```typescript
|
||||
import { testNet } from "@fluencelabs/fluence-network-environment";
|
||||
|
||||
export const relayNode = testNet[0];
|
||||
```
|
||||
|
||||
Which can be used to initialize the Fluence client (see [Fluence JS SDK](https://github.com/fluencelabs/fluence-js).)
|
||||
|
||||
```typescript
|
||||
import { FluencePeer } from "@fluencelabs/fluence";
|
||||
|
||||
const peer = new FluencePeer();
|
||||
await peer.start({ connectTo: relayNode });
|
||||
```
|
||||
|
||||
## Known networks
|
||||
|
||||
- stage - unstable network for development tests; low capacity
|
||||
- TestNet - more stable network, used for QA of new releases; higher capacity
|
||||
- Kras - stable network, has the highest load capacity
|
||||
|
||||
All 3 networks are connected, i.e. any node can be discovered from every other. They're open and permissionless, meaning that anyone can use any node for bootstrapping.
|
||||
|
||||
## Fluence Stack
|
||||
|
||||
| Layer | Tech | Scale | State | Based on |
|
||||
| :-------------------: | :-------------------------------------------------------------------------------------------------------------------------------: | :------------------------------: | :-------------------------------: | :-----------------------------------------------------------------------------------------------------------: |
|
||||
| Execution | [Marine](https://github.com/fluencelabs/marine) | Single peer | Disk, network, external processes | Wasm, [IT](https://github.com/fluencelabs/interface-types), [Wasmer\*](https://github.com/fluencelabs/wasmer) |
|
||||
| Composition | [Aqua](https://github.com/fluencelabs/aqua) | Involved peers | Results and signatures | ⇅, π-calculus |
|
||||
| Topology | [TrustGraph](https://github.com/fluencelabs/fluence/tree/master/trust-graph), [DHT\*](https://github.com/fluencelabs/rust-libp2p) | Distributed with Kademlia\* algo | Actual state of the network | [libp2p](https://github.com/libp2p/rust-libp2p) |
|
||||
| Security & Accounting | Blockchain | Whole network | Licenses & payments | substrate? |
|
||||
|
||||
<br/>
|
||||
|
||||
<p width="100%">
|
||||
<img alt="aquamarine scheme" align="center" src="doc/image.png"/>
|
||||
</p>
|
||||
|
||||
## License
|
||||
|
||||
[Apache 2.0](https://github.com/fluencelabs/fluence/blob/trustless_computing/LICENSE.md)
|
BIN
packages/core/fluence-network-environment/doc/image.png
Normal file
BIN
packages/core/fluence-network-environment/doc/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
17
packages/core/fluence-network-environment/package.json
Normal file
17
packages/core/fluence-network-environment/package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "module",
|
||||
"name": "@fluencelabs/fluence-network-environment",
|
||||
"version": "1.1.2",
|
||||
"description": "Fluence network environments addresses",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"repository": "https://github.com/fluencelabs/fluence-network-environment",
|
||||
"author": "Fluence Labs",
|
||||
"license": "Apache-2.0"
|
||||
}
|
@ -165,23 +165,24 @@ export const kras: Relay[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const randomKras = (): Relay => {
|
||||
// for backward compatibility
|
||||
export const krasnodar = kras;
|
||||
|
||||
export const randomKras = () => {
|
||||
return randomItem(kras);
|
||||
};
|
||||
|
||||
export const randomTestNet = (): Relay => {
|
||||
export const randomTestNet = () => {
|
||||
return randomItem(testNet);
|
||||
};
|
||||
|
||||
export const randomStage = (): Relay => {
|
||||
export const randomStage = () => {
|
||||
return randomItem(stage);
|
||||
};
|
||||
|
||||
function randomItem(arr: Relay[]): Relay {
|
||||
function randomItem(arr: Relay[]) {
|
||||
const index = randomInt(0, arr.length);
|
||||
// This array access always defined
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
return arr[index] as Relay;
|
||||
return arr[index];
|
||||
}
|
||||
|
||||
function randomInt(min: number, max: number) {
|
8
packages/core/fluence-network-environment/tsconfig.json
Normal file
8
packages/core/fluence-network-environment/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
@ -15,5 +15,4 @@
|
||||
*/
|
||||
|
||||
export * from "./compilerSupport/aquaTypeDefinitions.js";
|
||||
export * from "./commonTypes.js";
|
||||
export * from "./future.js";
|
||||
|
@ -35,6 +35,7 @@
|
||||
"@fluencelabs/avm": "0.62.0",
|
||||
"@fluencelabs/interfaces": "workspace:*",
|
||||
"@fluencelabs/js-client-isomorphic": "workspace:*",
|
||||
"@fluencelabs/fluence-network-environment": "workspace:*",
|
||||
"@fluencelabs/marine-worker": "0.6.0",
|
||||
"@fluencelabs/threads": "^2.0.0",
|
||||
"@libp2p/crypto": "4.0.1",
|
||||
|
@ -17,7 +17,6 @@
|
||||
import type {
|
||||
ArrowWithoutCallbacks,
|
||||
FunctionCallDef,
|
||||
JSONValue,
|
||||
ServiceDef,
|
||||
SimpleTypes,
|
||||
} from "@fluencelabs/interfaces";
|
||||
@ -32,6 +31,7 @@ import {
|
||||
} from "./compilerSupport/conversions.js";
|
||||
import { ServiceImpl, UserServiceImpl } from "./compilerSupport/types.js";
|
||||
import { FluencePeer } from "./jsPeer/FluencePeer.js";
|
||||
import type { JSONValue } from "./util/types.js";
|
||||
import { zip } from "./util/utils.js";
|
||||
|
||||
import { callAquaFunction, Fluence, registerService } from "./index.js";
|
||||
|
@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import { it, describe, expect, assert } from "vitest";
|
||||
|
||||
import { ExpirationError } from "../../jsPeer/errors.js";
|
||||
import { CallServiceData } from "../../jsServiceHost/interfaces.js";
|
||||
import { handleTimeout } from "../../particle/Particle.js";
|
||||
import { registerHandlersHelper, withClient } from "../../util/testUtils.js";
|
||||
import type { JSONValue } from "../../util/types.js";
|
||||
import { checkConnection } from "../checkConnection.js";
|
||||
|
||||
import { nodes, RELAY } from "./connection.js";
|
||||
|
@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
|
||||
import { WrapFnIntoServiceCall } from "../jsServiceHost/serviceUtils.js";
|
||||
import { handleTimeout } from "../particle/Particle.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import type { JSONValue } from "../util/types.js";
|
||||
|
||||
import { ClientPeer } from "./ClientPeer.js";
|
||||
|
||||
|
@ -16,11 +16,6 @@
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
* Peer ID's id as a base58 string (multihash/CIDv0).
|
||||
*/
|
||||
export type PeerIdB58 = string;
|
||||
|
||||
const relaySchema = z.object({
|
||||
peerId: z.string(),
|
||||
multiaddr: z.string(),
|
||||
|
@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue, NonArrowSimpleType } from "@fluencelabs/interfaces";
|
||||
import { NonArrowSimpleType } from "@fluencelabs/interfaces";
|
||||
import { it, describe, expect, test } from "vitest";
|
||||
|
||||
import type { JSONValue } from "../../util/types.js";
|
||||
import { aqua2js, js2aqua } from "../conversions.js";
|
||||
|
||||
const i32 = { tag: "scalar", name: "i32" } as const;
|
||||
|
@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
|
||||
import { FluencePeer } from "../jsPeer/FluencePeer.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import { ArgCallbackFunction } from "../util/testUtils.js";
|
||||
import type { JSONValue } from "../util/types.js";
|
||||
|
||||
import {
|
||||
errorHandlingService,
|
||||
|
@ -17,7 +17,6 @@
|
||||
import {
|
||||
ArrowType,
|
||||
ArrowWithoutCallbacks,
|
||||
JSONValue,
|
||||
LabeledProductType,
|
||||
NonArrowSimpleType,
|
||||
ScalarType,
|
||||
@ -25,6 +24,7 @@ import {
|
||||
UnlabeledProductType,
|
||||
} from "@fluencelabs/interfaces";
|
||||
|
||||
import { JSONValue } from "../util/types.js";
|
||||
import { zip } from "../util/utils.js";
|
||||
|
||||
import { ServiceImpl, UserServiceImpl } from "./types.js";
|
||||
|
@ -14,8 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
|
||||
import { FluencePeer } from "../jsPeer/FluencePeer.js";
|
||||
import {
|
||||
CallServiceData,
|
||||
@ -23,6 +21,7 @@ import {
|
||||
ResultCodes,
|
||||
} from "../jsServiceHost/interfaces.js";
|
||||
import { Particle } from "../particle/Particle.js";
|
||||
import type { JSONValue } from "../util/types.js";
|
||||
|
||||
import { ServiceImpl } from "./types.js";
|
||||
|
||||
|
@ -14,9 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONArray, JSONValue } from "@fluencelabs/interfaces";
|
||||
|
||||
import { ParticleContext } from "../jsServiceHost/interfaces.js";
|
||||
import type { JSONArray, JSONValue } from "../util/types.js";
|
||||
|
||||
export type MaybePromise<T> = T | Promise<T>;
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
import { noise } from "@chainsafe/libp2p-noise";
|
||||
import { yamux } from "@chainsafe/libp2p-yamux";
|
||||
import { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
import { identify } from "@libp2p/identify";
|
||||
import type { PeerId } from "@libp2p/interface";
|
||||
import { peerIdFromString } from "@libp2p/peer-id";
|
||||
@ -39,6 +38,7 @@ import {
|
||||
} from "../particle/Particle.js";
|
||||
import { throwHasNoPeerId } from "../util/libp2pUtils.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import type { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
import { IConnection } from "./interfaces.js";
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
import type { Subscribable } from "rxjs";
|
||||
|
||||
import { IParticle } from "../particle/interfaces.js";
|
||||
import { IStartable } from "../util/commonTypes.js";
|
||||
import { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
/**
|
||||
* Interface for connection used in Fluence Peer.
|
||||
|
@ -14,12 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
|
||||
import { FluencePeer, PeerConfig } from "../jsPeer/FluencePeer.js";
|
||||
import { JsServiceHost } from "../jsServiceHost/JsServiceHost.js";
|
||||
import { KeyPair } from "../keypair/index.js";
|
||||
import { IMarineHost } from "../marine/interfaces.js";
|
||||
import { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
import { EphemeralNetwork } from "./network.js";
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
import { Subject } from "rxjs";
|
||||
|
||||
import { IConnection } from "../connection/interfaces.js";
|
||||
@ -26,6 +25,7 @@ import { loadMarineDeps } from "../marine/loader.js";
|
||||
import { MarineBackgroundRunner } from "../marine/worker/index.js";
|
||||
import { Particle } from "../particle/Particle.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
const log = logger("ephemeral");
|
||||
|
||||
|
@ -146,7 +146,7 @@ export {
|
||||
fromOpts,
|
||||
} from "./keypair/index.js";
|
||||
|
||||
export * from "./network.js";
|
||||
export * from "@fluencelabs/fluence-network-environment";
|
||||
|
||||
// TODO: Remove this export after DXJ-535 is done!
|
||||
export { js2aqua, aqua2js } from "./compilerSupport/conversions.js";
|
||||
|
@ -20,7 +20,6 @@ import {
|
||||
KeyPairFormat,
|
||||
serializeAvmArgs,
|
||||
} from "@fluencelabs/avm";
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import { fromUint8Array } from "js-base64";
|
||||
import {
|
||||
concatMap,
|
||||
@ -64,6 +63,7 @@ import { defaultSigGuard, Sig } from "../services/Sig.js";
|
||||
import { Srv } from "../services/SingleModuleSrv.js";
|
||||
import { Tracing } from "../services/Tracing.js";
|
||||
import { logger } from "../util/logger.js";
|
||||
import type { JSONValue } from "../util/types.js";
|
||||
import { getErrorMessage, isString, jsonify } from "../util/utils.js";
|
||||
|
||||
import { ExpirationError, InterpreterError, SendError } from "./errors.js";
|
||||
|
@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import { it, describe, expect, assert } from "vitest";
|
||||
|
||||
import { handleTimeout } from "../../particle/Particle.js";
|
||||
import { registerHandlersHelper, withPeer } from "../../util/testUtils.js";
|
||||
import type { JSONValue } from "../../util/types.js";
|
||||
|
||||
describe("Basic AVM functionality in Fluence Peer tests", () => {
|
||||
it("Simple call", async () => {
|
||||
|
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import { describe, expect, it, assert } from "vitest";
|
||||
|
||||
import {
|
||||
@ -23,6 +22,7 @@ import {
|
||||
} from "../../jsServiceHost/interfaces.js";
|
||||
import { handleTimeout } from "../../particle/Particle.js";
|
||||
import { registerHandlersHelper, withPeer } from "../../util/testUtils.js";
|
||||
import type { JSONValue } from "../../util/types.js";
|
||||
|
||||
describe("FluencePeer flow tests", () => {
|
||||
it("should execute par instruction in parallel", async function () {
|
||||
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
|
||||
import type { SecurityTetraplet } from "@fluencelabs/avm";
|
||||
import type { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
import { JSONArray, JSONValue } from "@fluencelabs/interfaces";
|
||||
|
||||
import type { JSONArray, JSONValue, PeerIdB58 } from "../util/types.js";
|
||||
|
||||
/**
|
||||
* JS Service host a low level interface for managing pure javascript services.
|
||||
|
@ -15,11 +15,11 @@
|
||||
*/
|
||||
|
||||
import { SecurityTetraplet } from "@fluencelabs/avm";
|
||||
import { JSONArray } from "@fluencelabs/interfaces";
|
||||
|
||||
import { FluencePeer } from "../jsPeer/FluencePeer.js";
|
||||
import { IParticle } from "../particle/interfaces.js";
|
||||
import { builtInServices } from "../services/builtins.js";
|
||||
import type { JSONArray } from "../util/types.js";
|
||||
|
||||
import {
|
||||
CallServiceData,
|
||||
|
@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONObject, JSONValue, JSONArray } from "@fluencelabs/interfaces";
|
||||
import { CallParameters } from "@fluencelabs/marine-worker";
|
||||
|
||||
import { IStartable } from "../util/commonTypes.js";
|
||||
import type { JSONObject, JSONValue, JSONArray } from "../util/types.js";
|
||||
|
||||
/**
|
||||
* Contract for marine host implementations. Marine host is responsible for creating calling and removing marine services
|
||||
|
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import type {
|
||||
MarineBackgroundInterface,
|
||||
LogFunction,
|
||||
@ -24,6 +23,7 @@ import type {
|
||||
import { ModuleThread, Thread } from "@fluencelabs/threads/master";
|
||||
|
||||
import { MarineLogger, marineLogger } from "../../util/logger.js";
|
||||
import type { JSONValue } from "../../util/types.js";
|
||||
import { IMarineHost } from "../interfaces.js";
|
||||
|
||||
export class MarineBackgroundRunner implements IMarineHost {
|
||||
|
@ -19,7 +19,6 @@ import {
|
||||
MulticodecRepr,
|
||||
MsgPackRepr,
|
||||
} from "@fluencelabs/avm";
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import int64Buffer from "int64-buffer";
|
||||
import { concat } from "uint8arrays/concat";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
@ -28,6 +27,7 @@ import { z } from "zod";
|
||||
import { ExpirationError } from "../jsPeer/errors.js";
|
||||
import { KeyPair } from "../keypair/index.js";
|
||||
import { numberToLittleEndianBytes } from "../util/bytes.js";
|
||||
import type { JSONValue } from "../util/types.js";
|
||||
|
||||
import { IParticle } from "./interfaces.js";
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
import type { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
/**
|
||||
* Immutable part of the particle.
|
||||
|
@ -14,10 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
|
||||
import { ServiceFnArgs } from "../compilerSupport/types.js";
|
||||
import { KeyPair } from "../keypair/index.js";
|
||||
import type { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
import {
|
||||
allowOnlyParticleOriginatedAt,
|
||||
|
@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONArray } from "@fluencelabs/interfaces";
|
||||
import { toUint8Array } from "js-base64";
|
||||
import { describe, expect, it, test, assert } from "vitest";
|
||||
|
||||
import { CallServiceData } from "../../jsServiceHost/interfaces.js";
|
||||
import { KeyPair } from "../../keypair/index.js";
|
||||
import { makeTestTetraplet } from "../../util/testUtils.js";
|
||||
import type { JSONArray } from "../../util/types.js";
|
||||
import { builtInServices } from "../builtins.js";
|
||||
import { allowServiceFn } from "../securityGuard.js";
|
||||
import { defaultSigGuard, Sig } from "../Sig.js";
|
||||
|
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { JSONValue } from "@fluencelabs/interfaces";
|
||||
import bs58 from "bs58";
|
||||
import { sha256 } from "multiformats/hashes/sha2";
|
||||
import { z } from "zod";
|
||||
@ -26,6 +25,7 @@ import {
|
||||
GenericCallServiceHandler,
|
||||
ResultCodes,
|
||||
} from "../jsServiceHost/interfaces.js";
|
||||
import type { JSONValue } from "../util/types.js";
|
||||
import { getErrorMessage, jsonify } from "../util/utils.js";
|
||||
|
||||
const success = (result: CallServiceResultType): CallServiceResult => {
|
||||
|
@ -15,9 +15,9 @@
|
||||
*/
|
||||
|
||||
import { SecurityTetraplet } from "@fluencelabs/avm";
|
||||
import { PeerIdB58 } from "@fluencelabs/interfaces";
|
||||
|
||||
import { ParticleContext } from "../jsServiceHost/interfaces.js";
|
||||
import type { PeerIdB58 } from "../util/types.js";
|
||||
|
||||
// Helpers for validating service function
|
||||
|
||||
|
@ -17,12 +17,7 @@
|
||||
import { promises as fs } from "fs";
|
||||
|
||||
import { compileFromPath } from "@fluencelabs/aqua-api";
|
||||
import {
|
||||
FunctionCallDef,
|
||||
JSONArray,
|
||||
JSONValue,
|
||||
ServiceDef,
|
||||
} from "@fluencelabs/interfaces";
|
||||
import { FunctionCallDef, ServiceDef } from "@fluencelabs/interfaces";
|
||||
import { Subject, Subscribable } from "rxjs";
|
||||
|
||||
import { ClientPeer, makeClientPeerConfig } from "../clientPeer/ClientPeer.js";
|
||||
@ -43,6 +38,8 @@ import { loadMarineDeps } from "../marine/loader.js";
|
||||
import { MarineBackgroundRunner } from "../marine/worker/index.js";
|
||||
import { Particle } from "../particle/Particle.js";
|
||||
|
||||
import type { JSONArray, JSONValue } from "./types.js";
|
||||
|
||||
export const registerHandlersHelper = (
|
||||
peer: FluencePeer,
|
||||
particle: Particle,
|
||||
|
5
pnpm-lock.yaml
generated
5
pnpm-lock.yaml
generated
@ -194,6 +194,8 @@ importers:
|
||||
specifier: 3.22.4
|
||||
version: 3.22.4
|
||||
|
||||
packages/core/fluence-network-environment: {}
|
||||
|
||||
packages/core/interfaces:
|
||||
devDependencies:
|
||||
hotscript:
|
||||
@ -211,6 +213,9 @@ importers:
|
||||
'@fluencelabs/avm':
|
||||
specifier: 0.62.0
|
||||
version: 0.62.0
|
||||
'@fluencelabs/fluence-network-environment':
|
||||
specifier: workspace:*
|
||||
version: link:../fluence-network-environment
|
||||
'@fluencelabs/interfaces':
|
||||
specifier: workspace:*
|
||||
version: link:../interfaces
|
||||
|
Loading…
Reference in New Issue
Block a user