mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-03-15 07:20:49 +00:00
Split packages
This commit is contained in:
parent
e719bf26d8
commit
75fde48ef3
@ -1,8 +1,8 @@
|
||||
module.exports = {
|
||||
semi: true,
|
||||
trailingComma: "all",
|
||||
singleQuote: true,
|
||||
printWidth: 120,
|
||||
tabWidth: 4,
|
||||
useTabs: false
|
||||
semi: true,
|
||||
trailingComma: 'all',
|
||||
singleQuote: true,
|
||||
printWidth: 120,
|
||||
tabWidth: 4,
|
||||
useTabs: false,
|
||||
};
|
||||
|
18
packages/@tests-integration/.gitignore
vendored
Normal file
18
packages/@tests-integration/.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# 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/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
/dist/
|
||||
|
||||
.idea
|
@ -1,6 +1,6 @@
|
||||
module Export
|
||||
|
||||
import SignResult, Sig from "../src/services.aqua"
|
||||
import SignResult, Sig from "./services.aqua"
|
||||
export Sig, DataProvider, callSig
|
||||
|
||||
service DataProvider("data"):
|
30
packages/@tests-integration/package.json
Normal file
30
packages/@tests-integration/package.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "integration-tests",
|
||||
"version": "0.0.0",
|
||||
"description": "Tests",
|
||||
"scripts": {
|
||||
"compile-aqua": "aqua -i ./aqua -o ./src/_aqua",
|
||||
"test": "jest",
|
||||
"prebuild": "compile-aqua",
|
||||
"build": "tsc tsc"
|
||||
},
|
||||
"author": "Fluence Labs",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@fluencelabs/fluence": "workspace:*",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "^0.7.2-307",
|
||||
"@fluencelabs/aqua-lib": "^0.5.1",
|
||||
"@types/jest": "^27.5.1",
|
||||
"@types/node": "^17.0.36",
|
||||
"@types/platform": "^1.3.4",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"add": "^2.0.6",
|
||||
"jest": "^28.1.0",
|
||||
"jest-each": "^28.1.0",
|
||||
"ts-jest": "^28.0.2",
|
||||
"typescript": "^4.0.0"
|
||||
}
|
||||
}
|
2
packages/@tests-integration/src/__test__/integration/marine-js.spec.d.ts
vendored
Normal file
2
packages/@tests-integration/src/__test__/integration/marine-js.spec.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=marine-js.spec.d.ts.map
|
@ -1,10 +1,8 @@
|
||||
import { FluencePeer } from '../index';
|
||||
import { Particle } from '../internal/Particle';
|
||||
import { MakeServiceCall } from '../internal/utils';
|
||||
import { FluencePeer } from '@fluencelabs/fluence';
|
||||
|
||||
export const registerHandlersHelper = (
|
||||
peer: FluencePeer,
|
||||
particle: Particle,
|
||||
particle: any,
|
||||
handlers: Record<string, Record<string, any>>,
|
||||
) => {
|
||||
Object.entries(handlers).forEach(([serviceId, service]) => {
|
||||
@ -13,3 +11,10 @@ export const registerHandlersHelper = (
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const MakeServiceCall =
|
||||
(fn: (args: any[]) => any) =>
|
||||
(req: any): any => ({
|
||||
retCode: 0,
|
||||
result: fn(req.args),
|
||||
});
|
183
packages/@tests-integration/src/_aqua/marine-js-logging.ts
Normal file
183
packages/@tests-integration/src/_aqua/marine-js-logging.ts
Normal file
@ -0,0 +1,183 @@
|
||||
/**
|
||||
*
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.7.2-314
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
|
||||
export interface GreetingRecordDef {
|
||||
greeting_record: (callParams: CallParams<null>) => { num: number; str: string; } | Promise<{ num: number; str: string; }>;
|
||||
log_debug: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_error: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_info: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_trace: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_warn: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
void_fn: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
}
|
||||
export function registerGreetingRecord(serviceId: string, service: GreetingRecordDef): void;
|
||||
export function registerGreetingRecord(peer: FluencePeer, serviceId: string, service: GreetingRecordDef): void;
|
||||
|
||||
|
||||
export function registerGreetingRecord(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"functions" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"greeting_record" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "GreetingRecord",
|
||||
"fields" : {
|
||||
"num" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "i32"
|
||||
},
|
||||
"str" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"log_debug" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"log_error" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"log_info" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"log_trace" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"log_warn" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"void_fn" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
|
||||
export function call_info(
|
||||
srvId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function call_info(
|
||||
peer: FluencePeer,
|
||||
srvId: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function call_info(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "srvId") [] srvId)
|
||||
)
|
||||
(call %init_peer_id% (srvId "log_info") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "call_info",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"srvId" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
166
packages/@tests-integration/src/_aqua/marine-js.ts
Normal file
166
packages/@tests-integration/src/_aqua/marine-js.ts
Normal file
@ -0,0 +1,166 @@
|
||||
/**
|
||||
*
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.7.2-314
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
|
||||
export interface GreetingDef {
|
||||
greeting: (name: string, callParams: CallParams<'name'>) => string | Promise<string>;
|
||||
greeting_record: (callParams: CallParams<null>) => { num: number; str: string; } | Promise<{ num: number; str: string; }>;
|
||||
}
|
||||
export function registerGreeting(service: GreetingDef): void;
|
||||
export function registerGreeting(serviceId: string, service: GreetingDef): void;
|
||||
export function registerGreeting(peer: FluencePeer, service: GreetingDef): void;
|
||||
export function registerGreeting(peer: FluencePeer, serviceId: string, service: GreetingDef): void;
|
||||
|
||||
|
||||
export function registerGreeting(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "greeting",
|
||||
"functions" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"greeting" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"name" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"greeting_record" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "GreetingRecord",
|
||||
"fields" : {
|
||||
"num" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "i32"
|
||||
},
|
||||
"str" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
|
||||
export function call(
|
||||
arg: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<string>;
|
||||
|
||||
export function call(
|
||||
peer: FluencePeer,
|
||||
arg: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<string>;
|
||||
|
||||
export function call(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "arg") [] arg)
|
||||
)
|
||||
(call %init_peer_id% ("greeting" "greeting") [arg] res1)
|
||||
)
|
||||
(call %init_peer_id% ("greeting" "greeting") [res1] res2)
|
||||
)
|
||||
(call %init_peer_id% ("greeting" "greeting") [res2] res3)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res3])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "call",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"arg" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
138
packages/@tests-integration/src/_aqua/services.ts
Normal file
138
packages/@tests-integration/src/_aqua/services.ts
Normal file
@ -0,0 +1,138 @@
|
||||
/**
|
||||
*
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.7.2-314
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
|
||||
export interface SigDef {
|
||||
get_pub_key: (callParams: CallParams<null>) => string | Promise<string>;
|
||||
sign: (data: number[], callParams: CallParams<'data'>) => { error: string | null; signature: number[] | null; success: boolean; } | Promise<{ error: string | null; signature: number[] | null; success: boolean; }>;
|
||||
verify: (signature: number[], data: number[], callParams: CallParams<'signature' | 'data'>) => boolean | Promise<boolean>;
|
||||
}
|
||||
export function registerSig(service: SigDef): void;
|
||||
export function registerSig(serviceId: string, service: SigDef): void;
|
||||
export function registerSig(peer: FluencePeer, service: SigDef): void;
|
||||
export function registerSig(peer: FluencePeer, serviceId: string, service: SigDef): void;
|
||||
|
||||
|
||||
export function registerSig(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "sig",
|
||||
"functions" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"get_pub_key" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sign" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"data" : {
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "SignResult",
|
||||
"fields" : {
|
||||
"error" : {
|
||||
"tag" : "option",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
},
|
||||
"signature" : {
|
||||
"tag" : "option",
|
||||
"type" : {
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"success" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "bool"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"verify" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"signature" : {
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u8"
|
||||
}
|
||||
},
|
||||
"data" : {
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
@ -3,11 +3,11 @@
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.7.0-285
|
||||
* Aqua version: 0.7.2-314
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '../../index';
|
||||
import { CallParams, callFunction, registerService } from '../../internal/compilerSupport/v3';
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import { CallParams, callFunction, registerService } from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
// Services
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { krasnodar } from '@fluencelabs/fluence-network-environment';
|
||||
|
||||
// Uncomment to test on dev nodes
|
||||
// export const nodes = [
|
||||
// {
|
||||
@ -16,9 +18,4 @@
|
||||
docker run --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence -t 1210 -w 4310 -k gKdiCSUr1TFGFEgu2t8Ch1XEUsrN5A2UfBLjSZvfci9SPR3NvZpACfcpPGC3eY4zma1pk7UvYv5zb1VjvPHwCjj --local
|
||||
|
||||
*/
|
||||
export const nodes = [
|
||||
{
|
||||
multiaddr: '/ip4/127.0.0.1/tcp/4310/ws/p2p/12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',
|
||||
peerId: '12D3KooWKEprYXUXqoV5xSBeyqrWLpQLLH4PXfvVkDJtmcqmh5V3',
|
||||
},
|
||||
];
|
||||
export const nodes = krasnodar[4];
|
9
packages/@tests-integration/tsconfig.json
Normal file
9
packages/@tests-integration/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
},
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
]
|
||||
}
|
18
packages/fluence-js/.gitignore
vendored
Normal file
18
packages/fluence-js/.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# 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/
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
/dist/
|
||||
|
||||
.idea
|
35
packages/fluence-js/aqua/services.aqua
Normal file
35
packages/fluence-js/aqua/services.aqua
Normal file
@ -0,0 +1,35 @@
|
||||
-- import SignResult, Sig from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
-- export SignResult, Sig
|
||||
|
||||
-- TODO:: fix this issue: https://github.com/fluencelabs/aqua-lib/issues/12
|
||||
-- and remove copy-paste
|
||||
|
||||
data SignResult:
|
||||
-- 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
|
||||
|
||||
-- Available only on FluenceJS peers
|
||||
-- The service can also be resolved by it's host peer id
|
||||
service Sig("sig"):
|
||||
-- Signs data with the service's private key.
|
||||
-- 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_route_bytes
|
||||
-- registry.get_record_bytes
|
||||
-- registry.get_host_record_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 service's public key.
|
||||
get_pub_key() -> string
|
6
packages/fluence-js/jest.config.cjs
Normal file
6
packages/fluence-js/jest.config.cjs
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
testTimeout: 10000,
|
||||
testPathIgnorePatterns: ['/node_modules/', 'dist'],
|
||||
};
|
@ -13,19 +13,14 @@
|
||||
"internal/compilerSupport/v3": "./dist/internal/compilerSupport/v3.ts"
|
||||
},
|
||||
"module": "./dist/esm/index.js",
|
||||
"types": "./dist/cjs/index.d.ts",
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=16.0",
|
||||
"pnpm": ">=3"
|
||||
},
|
||||
"scripts": {
|
||||
"compile-aqua": "npm run compile-aqua:src && npm run compile-aqua:test",
|
||||
"compile-aqua:src": "aqua -i ./aqua/src/ -o ./src/internal/_aqua",
|
||||
"compile-aqua:test": "aqua -i ./aqua/tests/ -o ./src/__test__/_aqua",
|
||||
"test": "jest --watch",
|
||||
"test:all": "jest",
|
||||
"test:unit": "jest --testPathPattern=src/__test__/unit",
|
||||
"test:integration": "jest --testPathPattern=src/__test__/integration",
|
||||
"compile-aqua": "aqua -i ./aqua/src/ -o ./src/internal/_aqua",
|
||||
"test": "jest",
|
||||
"build": "rollup -c rollup.config.ts --configPlugin swc3",
|
||||
"build:docs": "typedoc"
|
||||
},
|
5597
packages/fluence-js/pnpm-lock.yaml
generated
Normal file
5597
packages/fluence-js/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
43
packages/fluence-js/src/__test__/KeyPair.spec.ts
Normal file
43
packages/fluence-js/src/__test__/KeyPair.spec.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import * as bs58 from 'bs58';
|
||||
import * as base64 from 'base64-js';
|
||||
import { KeyPair } from '../../internal/KeyPair';
|
||||
|
||||
describe('KeyPair tests', () => {
|
||||
it('generate keypair from seed', async function () {
|
||||
// arrange
|
||||
const random = await KeyPair.randomEd25519();
|
||||
const privateKey = random.toEd25519PrivateKey();
|
||||
|
||||
// act
|
||||
const keyPair = await KeyPair.fromEd25519SK(privateKey);
|
||||
const privateKey2 = keyPair.toEd25519PrivateKey();
|
||||
|
||||
// assert
|
||||
expect(privateKey).toStrictEqual(privateKey2);
|
||||
});
|
||||
|
||||
it('create keypair from ed25519 private key', async function () {
|
||||
// arrange
|
||||
const rustSK = 'jDaxLJzYtzgwTMrELJCAqavtmx85ktQNfB2rLcK7MhH';
|
||||
const sk = bs58.decode(rustSK);
|
||||
|
||||
// act
|
||||
const keyPair = await KeyPair.fromEd25519SK(sk);
|
||||
|
||||
// assert
|
||||
const expectedPeerId = '12D3KooWH1W3VznVZ87JH4FwABK4mkntcspTVWJDta6c2xg9Pzbp';
|
||||
expect(keyPair.libp2pPeerId.toString()).toStrictEqual(expectedPeerId);
|
||||
});
|
||||
|
||||
it('create keypair from a seed phrase', async function () {
|
||||
// arrange
|
||||
const seedArray = new Uint8Array(32).fill(1);
|
||||
|
||||
// act
|
||||
const keyPair = await KeyPair.fromEd25519SK(seedArray);
|
||||
|
||||
// assert
|
||||
const expectedPeerId = '12D3KooWK99VoVxNE7XzyBwXEzW7xhK7Gpv85r9F3V3fyKSUKPH5';
|
||||
expect(keyPair.libp2pPeerId.toString()).toStrictEqual(expectedPeerId);
|
||||
});
|
||||
});
|
307
packages/fluence-js/src/__test__/builtInHandler.spec.ts
Normal file
307
packages/fluence-js/src/__test__/builtInHandler.spec.ts
Normal file
@ -0,0 +1,307 @@
|
||||
import { CallParams, CallServiceData } from '../../internal/commonTypes';
|
||||
import each from 'jest-each';
|
||||
import { builtInServices } from '../../internal/builtins/common';
|
||||
import { KeyPair } from '../../internal/KeyPair';
|
||||
import { Sig, defaultSigGuard, allowServiceFn } from '../../internal/builtins/Sig';
|
||||
import { toUint8Array } from 'js-base64';
|
||||
|
||||
const a10b20 = `{
|
||||
"a": 10,
|
||||
"b": 20
|
||||
}`;
|
||||
|
||||
const oneTwoThreeFour = `[
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
]`;
|
||||
|
||||
describe('Tests for default handler', () => {
|
||||
// prettier-ignore
|
||||
each`
|
||||
serviceId | fnName | args | retCode | result
|
||||
${'op'} | ${'identity'} | ${[]} | ${0} | ${{}}
|
||||
${'op'} | ${'identity'} | ${[1]} | ${0} | ${1}
|
||||
${'op'} | ${'identity'} | ${[1, 2]} | ${1} | ${'identity accepts up to 1 arguments, received 2 arguments'}
|
||||
|
||||
${'op'} | ${'noop'} | ${[1, 2]} | ${0} | ${{}}
|
||||
|
||||
${'op'} | ${'array'} | ${[1, 2, 3]} | ${0} | ${[1, 2, 3]}
|
||||
|
||||
${'op'} | ${'array_length'} | ${[[1, 2, 3]]} | ${0} | ${3}
|
||||
${'op'} | ${'array_length'} | ${[]} | ${1} | ${'array_length accepts exactly one argument, found: 0'}
|
||||
|
||||
${'op'} | ${'concat'} | ${[[1, 2], [3, 4], [5, 6]]} | ${0} | ${[1, 2, 3, 4, 5, 6]}
|
||||
${'op'} | ${'concat'} | ${[[1, 2]]} | ${0} | ${[1, 2]}
|
||||
${'op'} | ${'concat'} | ${[]} | ${0} | ${[]}
|
||||
${'op'} | ${'concat'} | ${[1, [1, 2], 1]} | ${1} | ${"All arguments of 'concat' must be arrays: arguments 0, 2 are not"}
|
||||
|
||||
${'op'} | ${'string_to_b58'} | ${["test"]} | ${0} | ${"3yZe7d"}
|
||||
${'op'} | ${'string_to_b58'} | ${["test", 1]} | ${1} | ${"string_to_b58 accepts only one string argument"}
|
||||
|
||||
${'op'} | ${'string_from_b58'} | ${["3yZe7d"]} | ${0} | ${"test"}
|
||||
${'op'} | ${'string_from_b58'} | ${["3yZe7d", 1]} | ${1} | ${"string_from_b58 accepts only one string argument"}
|
||||
|
||||
${'op'} | ${'bytes_to_b58'} | ${[[116, 101, 115, 116]]} | ${0} | ${"3yZe7d"}
|
||||
${'op'} | ${'bytes_to_b58'} | ${[[116, 101, 115, 116], 1]} | ${1} | ${"bytes_to_b58 accepts only single argument: array of numbers"}
|
||||
|
||||
${'op'} | ${'bytes_from_b58'} | ${["3yZe7d"]} | ${0} | ${[116, 101, 115, 116]}
|
||||
${'op'} | ${'bytes_from_b58'} | ${["3yZe7d", 1]} | ${1} | ${"bytes_from_b58 accepts only one string argument"}
|
||||
|
||||
${'op'} | ${'sha256_string'} | ${["hello, world!"]} | ${0} | ${"QmVQ8pg6L1tpoWYeq6dpoWqnzZoSLCh7E96fCFXKvfKD3u"}
|
||||
${'op'} | ${'sha256_string'} | ${["hello, world!", true]} | ${0} | ${"84V7ZxLW7qKsx1Qvbd63BdGaHxUc3TfT2MBPqAXM7Wyu"}
|
||||
${'op'} | ${'sha256_string'} | ${[]} | ${1} | ${"sha256_string accepts 1-3 arguments, found: 0"}
|
||||
|
||||
${'op'} | ${'concat_strings'} | ${[]} | ${0} | ${""}
|
||||
${'op'} | ${'concat_strings'} | ${["a", "b", "c"]} | ${0} | ${"abc"}
|
||||
|
||||
${'peer'} | ${'timeout'} | ${[200, []]} | ${0} | ${[]}}
|
||||
${'peer'} | ${'timeout'} | ${[200, ['test']]} | ${0} | ${['test']}}
|
||||
${'peer'} | ${'timeout'} | ${[]} | ${1} | ${'timeout accepts exactly two arguments: timeout duration in ms and a message string'}}
|
||||
${'peer'} | ${'timeout'} | ${[200, 'test', 1]} | ${1} | ${'timeout accepts exactly two arguments: timeout duration in ms and a message string'}}
|
||||
|
||||
${'debug'} | ${'stringify'} | ${[]} | ${0} | ${'"<empty argument list>"'}}
|
||||
${'debug'} | ${'stringify'} | ${[{a: 10, b: 20}]} | ${0} | ${a10b20}}
|
||||
${'debug'} | ${'stringify'} | ${[1, 2, 3, 4]} | ${0} | ${oneTwoThreeFour}}
|
||||
|
||||
${'math'} | ${'add'}" | ${[2, 2]} | ${0} | ${4}
|
||||
${'math'} | ${'add'}" | ${[2]} | ${1} | ${"Expected 2 argument(s). Got 1"}
|
||||
|
||||
${'math'} | ${'sub'}" | ${[2, 2]} | ${0} | ${0}
|
||||
${'math'} | ${'sub'}" | ${[2, 3]} | ${0} | ${-1}
|
||||
|
||||
${'math'} | ${'mul'}" | ${[2, 2]} | ${0} | ${4}
|
||||
${'math'} | ${'mul'}" | ${[2, 0]} | ${0} | ${0}
|
||||
${'math'} | ${'mul'}" | ${[2, -1]} | ${0} | ${-2}
|
||||
|
||||
${'math'} | ${'fmul'}" | ${[10, 0.66]} | ${0} | ${6}
|
||||
${'math'} | ${'fmul'}" | ${[0.5, 0.5]} | ${0} | ${0}
|
||||
${'math'} | ${'fmul'}" | ${[100.5, 0.5]} | ${0} | ${50}
|
||||
|
||||
${'math'} | ${'div'}" | ${[2, 2]} | ${0} | ${1}
|
||||
${'math'} | ${'div'}" | ${[2, 3]} | ${0} | ${0}
|
||||
${'math'} | ${'div'}" | ${[10, 5]} | ${0} | ${2}
|
||||
|
||||
${'math'} | ${'rem'}" | ${[10, 3]} | ${0} | ${1}
|
||||
|
||||
${'math'} | ${'pow'}" | ${[2, 2]} | ${0} | ${4}
|
||||
${'math'} | ${'pow'}" | ${[2, 0]} | ${0} | ${1}
|
||||
|
||||
${'math'} | ${'log'}" | ${[2, 2]} | ${0} | ${1}
|
||||
${'math'} | ${'log'}" | ${[2, 4]} | ${0} | ${2}
|
||||
|
||||
${'cmp'} | ${'gt'}" | ${[2, 4]} | ${0} | ${false}
|
||||
${'cmp'} | ${'gte'}" | ${[2, 4]} | ${0} | ${false}
|
||||
${'cmp'} | ${'gte'}" | ${[4, 2]} | ${0} | ${true}
|
||||
${'cmp'} | ${'gte'}" | ${[2, 2]} | ${0} | ${true}
|
||||
|
||||
${'cmp'} | ${'lt'}" | ${[2, 4]} | ${0} | ${true}
|
||||
${'cmp'} | ${'lte'}" | ${[2, 4]} | ${0} | ${true}
|
||||
${'cmp'} | ${'lte'}" | ${[4, 2]} | ${0} | ${false}
|
||||
${'cmp'} | ${'lte'}" | ${[2, 2]} | ${0} | ${true}
|
||||
|
||||
${'cmp'} | ${'cmp'}" | ${[2, 4]} | ${0} | ${-1}
|
||||
${'cmp'} | ${'cmp'}" | ${[2, -4]} | ${0} | ${1}
|
||||
${'cmp'} | ${'cmp'}" | ${[2, 2]} | ${0} | ${0}
|
||||
|
||||
${'array'} | ${'sum'}" | ${[[1, 2, 3]]} | ${0} | ${6}
|
||||
${'array'} | ${'dedup'}" | ${[["a", "a", "b", "c", "a", "b", "c"]]} | ${0} | ${["a", "b", "c"]}
|
||||
${'array'} | ${'intersect'}" | ${[["a", "b", "c"], ["c", "b", "d"]]} | ${0} | ${["b", "c"]}
|
||||
${'array'} | ${'diff'}" | ${[["a", "b", "c"], ["c", "b", "d"]]} | ${0} | ${["a"]}
|
||||
${'array'} | ${'sdiff'}" | ${[["a", "b", "c"], ["c", "b", "d"]]} | ${0} | ${["a", "d"]}
|
||||
|
||||
`.test(
|
||||
//
|
||||
'$fnName with $args expected retcode: $retCode and result: $result',
|
||||
async ({ serviceId, fnName, args, retCode, result }) => {
|
||||
// arrange
|
||||
const req: CallServiceData = {
|
||||
serviceId: serviceId,
|
||||
fnName: fnName,
|
||||
args: args,
|
||||
tetraplets: [],
|
||||
particleContext: {
|
||||
particleId: 'some',
|
||||
initPeerId: 'init peer id',
|
||||
timestamp: 595951200,
|
||||
ttl: 595961200,
|
||||
signature: 'sig',
|
||||
},
|
||||
};
|
||||
|
||||
// act
|
||||
const fn = builtInServices[req.serviceId][req.fnName];
|
||||
const res = await fn(req);
|
||||
|
||||
// assert
|
||||
expect(res).toMatchObject({
|
||||
retCode: retCode,
|
||||
result: result,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it('should return correct error message for identiy service', async () => {
|
||||
// arrange
|
||||
const req: CallServiceData = {
|
||||
serviceId: 'peer',
|
||||
fnName: 'identify',
|
||||
args: [],
|
||||
tetraplets: [],
|
||||
particleContext: {
|
||||
particleId: 'some',
|
||||
initPeerId: 'init peer id',
|
||||
timestamp: 595951200,
|
||||
ttl: 595961200,
|
||||
signature: 'sig',
|
||||
},
|
||||
};
|
||||
|
||||
// act
|
||||
const fn = builtInServices[req.serviceId][req.fnName];
|
||||
const res = await fn(req);
|
||||
|
||||
// assert
|
||||
expect(res).toMatchObject({
|
||||
retCode: 1,
|
||||
result: 'The JS implementation of Peer does not support "peer.identify"',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const key = '+cmeYlZKj+MfSa9dpHV+BmLPm6wq4inGlsPlQ1GvtPk=';
|
||||
|
||||
const context = (async () => {
|
||||
const keyBytes = toUint8Array(key);
|
||||
const kp = await KeyPair.fromEd25519SK(keyBytes);
|
||||
const res = {
|
||||
peerKeyPair: kp,
|
||||
peerId: kp.libp2pPeerId.toString(),
|
||||
};
|
||||
return res;
|
||||
})();
|
||||
|
||||
const testData = [1, 2, 3, 4, 5, 6, 7, 9, 10];
|
||||
|
||||
// signature produced by KeyPair created from key above (`key` variable)
|
||||
const testDataSig = [
|
||||
224, 104, 245, 206, 140, 248, 27, 72, 68, 133, 111, 10, 164, 197, 242, 132, 107, 77, 224, 67, 99, 106, 76, 29, 144,
|
||||
121, 122, 169, 36, 173, 58, 80, 170, 102, 137, 253, 157, 247, 168, 87, 162, 223, 188, 214, 203, 220, 52, 246, 29,
|
||||
86, 77, 71, 224, 248, 16, 213, 254, 75, 78, 239, 243, 222, 241, 15,
|
||||
];
|
||||
|
||||
// signature produced by KeyPair created from some random KeyPair
|
||||
const testDataWrongSig = [
|
||||
116, 247, 189, 118, 236, 53, 147, 123, 219, 75, 176, 105, 101, 108, 233, 137, 97, 14, 146, 132, 252, 70, 51, 153,
|
||||
237, 167, 156, 150, 36, 90, 229, 108, 166, 231, 255, 137, 8, 246, 125, 0, 213, 150, 83, 196, 237, 221, 131, 159,
|
||||
157, 159, 25, 109, 95, 160, 181, 65, 254, 238, 47, 156, 240, 151, 58, 14,
|
||||
];
|
||||
|
||||
const makeTetraplet = (initPeerId: string, serviceId?: string, fnName?: string): CallParams<'data'> => {
|
||||
return {
|
||||
initPeerId: initPeerId,
|
||||
tetraplets: {
|
||||
data: [
|
||||
{
|
||||
function_name: fnName,
|
||||
service_id: serviceId,
|
||||
},
|
||||
],
|
||||
},
|
||||
} as any;
|
||||
};
|
||||
|
||||
describe('Sig service tests', () => {
|
||||
it('sig.sign should create the correct signature', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
|
||||
const res = await sig.sign(testData, makeTetraplet(ctx.peerId));
|
||||
|
||||
expect(res.success).toBe(true);
|
||||
expect(res.signature).toStrictEqual(testDataSig);
|
||||
});
|
||||
|
||||
it('sig.verify should return true for the correct signature', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
|
||||
const res = await sig.verify(testDataSig, testData);
|
||||
|
||||
expect(res).toBe(true);
|
||||
});
|
||||
|
||||
it('sig.verify should return false for the incorrect signature', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
|
||||
const res = await sig.verify(testDataWrongSig, testData);
|
||||
|
||||
expect(res).toBe(false);
|
||||
});
|
||||
|
||||
it('sign-verify call chain should work', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
|
||||
const signature = await sig.sign(testData, makeTetraplet(ctx.peerId));
|
||||
const res = await sig.verify(signature.signature as number[], testData);
|
||||
|
||||
expect(res).toBe(true);
|
||||
});
|
||||
|
||||
it('sig.sign with defaultSigGuard should work for correct callParams', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
sig.securityGuard = defaultSigGuard(ctx.peerId);
|
||||
|
||||
const signature = await sig.sign(testData, makeTetraplet(ctx.peerId, 'registry', 'get_route_bytes'));
|
||||
|
||||
await expect(signature).toBeDefined();
|
||||
});
|
||||
|
||||
it('sig.sign with defaultSigGuard should not allow particles initiated from incorrect service', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
sig.securityGuard = defaultSigGuard(ctx.peerId);
|
||||
|
||||
const res = await sig.sign(testData, makeTetraplet(ctx.peerId, 'other_service', 'other_fn'));
|
||||
|
||||
await expect(res.success).toBe(false);
|
||||
await expect(res.error).toBe('Security guard validation failed');
|
||||
});
|
||||
|
||||
it('sig.sign with defaultSigGuard should not allow particles initiated from other peers', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
sig.securityGuard = defaultSigGuard(ctx.peerId);
|
||||
|
||||
const res = await sig.sign(
|
||||
testData,
|
||||
makeTetraplet((await KeyPair.randomEd25519()).toB58String(), 'registry', 'get_key_bytes'),
|
||||
);
|
||||
|
||||
await expect(res.success).toBe(false);
|
||||
await expect(res.error).toBe('Security guard validation failed');
|
||||
});
|
||||
|
||||
it('changing securityGuard should work', async () => {
|
||||
const ctx = await context;
|
||||
const sig = new Sig(ctx.peerKeyPair);
|
||||
sig.securityGuard = allowServiceFn('test', 'test');
|
||||
|
||||
const successful1 = await sig.sign(testData, makeTetraplet(ctx.peerId, 'test', 'test'));
|
||||
const unSuccessful1 = await sig.sign(testData, makeTetraplet(ctx.peerId, 'wrong', 'wrong'));
|
||||
|
||||
sig.securityGuard = allowServiceFn('wrong', 'wrong');
|
||||
|
||||
const successful2 = await sig.sign(testData, makeTetraplet(ctx.peerId, 'wrong', 'wrong'));
|
||||
const unSuccessful2 = await sig.sign(testData, makeTetraplet(ctx.peerId, 'test', 'test'));
|
||||
|
||||
expect(successful1.success).toBe(true);
|
||||
expect(successful2.success).toBe(true);
|
||||
expect(unSuccessful1.success).toBe(false);
|
||||
expect(unSuccessful2.success).toBe(false);
|
||||
});
|
||||
});
|
37
packages/fluence-js/src/__test__/compiler/v2.spec.ts
Normal file
37
packages/fluence-js/src/__test__/compiler/v2.spec.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import each from 'jest-each';
|
||||
|
||||
import { Fluence, FluencePeer } from '../../..';
|
||||
import { forTests } from '../../../internal/compilerSupport/v2';
|
||||
|
||||
const peer = new FluencePeer();
|
||||
const cfg = { ttl: 1000 };
|
||||
|
||||
describe('Compiler support tests', () => {
|
||||
each`
|
||||
rawArgs | numArgs | expectedArgs | expectedConfig | isExpectedPeerDefault
|
||||
${[]} | ${0} | ${[]} | ${undefined} | ${true}
|
||||
${[cfg]} | ${0} | ${[]} | ${cfg} | ${true}
|
||||
${[peer]} | ${0} | ${[]} | ${undefined} | ${false}
|
||||
${[peer, cfg]} | ${0} | ${[]} | ${cfg} | ${false}
|
||||
${['a']} | ${1} | ${['a']} | ${undefined} | ${true}
|
||||
${['a', cfg]} | ${1} | ${['a']} | ${cfg} | ${true}
|
||||
${[peer, 'a']} | ${1} | ${['a']} | ${undefined} | ${false}
|
||||
${[peer, 'a', cfg]} | ${1} | ${['a']} | ${cfg} | ${false}
|
||||
`.test(
|
||||
//
|
||||
'raw rawArgs: $rawArgs, numArgs: $numArgs. expected args: $expectedArgs, config: $expectedConfig, default peer?: $isExpectedPeerDefault',
|
||||
({ rawArgs, numArgs, expectedArgs, expectedConfig, isExpectedPeerDefault }) => {
|
||||
// arrange
|
||||
const testFn = forTests.extractFunctionArgs;
|
||||
|
||||
// act
|
||||
const { peer, config, args } = testFn(rawArgs, numArgs);
|
||||
const isActualPeerDefault = Fluence.getPeer() === peer;
|
||||
|
||||
// assert
|
||||
expect(config).toStrictEqual(expectedConfig);
|
||||
expect(args).toStrictEqual(expectedArgs);
|
||||
expect(isActualPeerDefault).toStrictEqual(isExpectedPeerDefault);
|
||||
},
|
||||
);
|
||||
});
|
223
packages/fluence-js/src/__test__/compiler/v3.spec.ts
Normal file
223
packages/fluence-js/src/__test__/compiler/v3.spec.ts
Normal file
@ -0,0 +1,223 @@
|
||||
import each from 'jest-each';
|
||||
import { aqua2ts, ts2aqua } from '../../../internal/compilerSupport/v3impl/conversions';
|
||||
|
||||
const i32 = { tag: 'scalar', name: 'i32' } as const;
|
||||
|
||||
const opt_i32 = {
|
||||
tag: 'option',
|
||||
type: i32,
|
||||
} as const;
|
||||
|
||||
const array_i32 = { tag: 'array', type: i32 };
|
||||
|
||||
const array_opt_i32 = { tag: 'array', type: opt_i32 };
|
||||
|
||||
const labeledProduct = {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
a: i32,
|
||||
b: opt_i32,
|
||||
c: array_opt_i32,
|
||||
},
|
||||
};
|
||||
|
||||
const struct = {
|
||||
tag: 'struct',
|
||||
name: 'someStruct',
|
||||
fields: {
|
||||
a: i32,
|
||||
b: opt_i32,
|
||||
c: array_opt_i32,
|
||||
},
|
||||
};
|
||||
|
||||
const structs = [
|
||||
{
|
||||
aqua: {
|
||||
a: 1,
|
||||
b: [2],
|
||||
c: [[1], [2]],
|
||||
},
|
||||
|
||||
ts: {
|
||||
a: 1,
|
||||
b: 2,
|
||||
c: [1, 2],
|
||||
},
|
||||
},
|
||||
{
|
||||
aqua: {
|
||||
a: 1,
|
||||
b: [],
|
||||
c: [[], [2]],
|
||||
},
|
||||
|
||||
ts: {
|
||||
a: 1,
|
||||
b: null,
|
||||
c: [null, 2],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const labeledProduct2 = {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
x: i32,
|
||||
y: i32,
|
||||
},
|
||||
};
|
||||
|
||||
const nestedLabeledProductType = {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
a: labeledProduct2,
|
||||
b: {
|
||||
tag: 'option',
|
||||
type: labeledProduct2,
|
||||
},
|
||||
c: {
|
||||
tag: 'array',
|
||||
type: labeledProduct2,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const nestedStructs = [
|
||||
{
|
||||
aqua: {
|
||||
a: {
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
b: [
|
||||
{
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
],
|
||||
c: [
|
||||
{
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
{
|
||||
x: 3,
|
||||
y: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
ts: {
|
||||
a: {
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
b: {
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
|
||||
c: [
|
||||
{
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
{
|
||||
x: 3,
|
||||
y: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
aqua: {
|
||||
a: {
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
b: [],
|
||||
c: [],
|
||||
},
|
||||
|
||||
ts: {
|
||||
a: {
|
||||
x: 1,
|
||||
y: 2,
|
||||
},
|
||||
b: null,
|
||||
c: [],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
describe('Conversion from aqua to typescript', () => {
|
||||
each`
|
||||
aqua | ts | type
|
||||
${1} | ${1} | ${i32}
|
||||
${[]} | ${null} | ${opt_i32}
|
||||
${[1]} | ${1} | ${opt_i32}
|
||||
${[1, 2, 3]} | ${[1, 2, 3]} | ${array_i32}
|
||||
${[]} | ${[]} | ${array_i32}
|
||||
${[[1]]} | ${[1]} | ${array_opt_i32}
|
||||
${[[]]} | ${[null]} | ${array_opt_i32}
|
||||
${[[1], [2]]} | ${[1, 2]} | ${array_opt_i32}
|
||||
${[[], [2]]} | ${[null, 2]} | ${array_opt_i32}
|
||||
${structs[0].aqua} | ${structs[0].ts} | ${labeledProduct}
|
||||
${structs[1].aqua} | ${structs[1].ts} | ${labeledProduct}
|
||||
${structs[0].aqua} | ${structs[0].ts} | ${struct}
|
||||
${structs[1].aqua} | ${structs[1].ts} | ${struct}
|
||||
${nestedStructs[0].aqua} | ${nestedStructs[0].ts} | ${nestedLabeledProductType}
|
||||
${nestedStructs[1].aqua} | ${nestedStructs[1].ts} | ${nestedLabeledProductType}
|
||||
`.test(
|
||||
//
|
||||
'aqua: $aqua. ts: $ts. type: $type',
|
||||
async ({ aqua, ts, type }) => {
|
||||
// arrange
|
||||
|
||||
// act
|
||||
const tsFromAqua = aqua2ts(aqua, type);
|
||||
const aquaFromTs = ts2aqua(ts, type);
|
||||
|
||||
// assert
|
||||
expect(tsFromAqua).toStrictEqual(ts);
|
||||
expect(aquaFromTs).toStrictEqual(aqua);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('Conversion corner cases', () => {
|
||||
it('Should accept undefined in object entry', () => {
|
||||
// arrange
|
||||
const type = {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
x: opt_i32,
|
||||
y: opt_i32,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const valueInTs = {
|
||||
x: 1,
|
||||
};
|
||||
const valueInAqua = {
|
||||
x: [1],
|
||||
y: [],
|
||||
};
|
||||
|
||||
// act
|
||||
const aqua = ts2aqua(valueInTs, type);
|
||||
const ts = aqua2ts(valueInAqua, type);
|
||||
|
||||
// assert
|
||||
expect(aqua).toStrictEqual({
|
||||
x: [1],
|
||||
y: [],
|
||||
});
|
||||
|
||||
expect(ts).toStrictEqual({
|
||||
x: 1,
|
||||
y: null,
|
||||
});
|
||||
});
|
||||
});
|
6
packages/fluence-js/tsconfig.json
Normal file
6
packages/fluence-js/tsconfig.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": [
|
||||
"src/**/*",
|
||||
]
|
||||
}
|
373
pnpm-lock.yaml
generated
373
pnpm-lock.yaml
generated
@ -1,104 +1,136 @@
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@chainsafe/libp2p-noise': ^6.1.1
|
||||
'@fluencelabs/aqua': ^0.7.2-307
|
||||
'@fluencelabs/aqua-lib': ^0.5.1
|
||||
'@fluencelabs/avm': 0.24.2
|
||||
'@fluencelabs/marine-js': 0.2.5
|
||||
'@libp2p/interfaces': ^2.0.2
|
||||
'@libp2p/mplex': ^1.0.5
|
||||
'@libp2p/peer-id': ^1.1.10
|
||||
'@libp2p/websockets': ^1.0.8
|
||||
'@multiformats/multiaddr': ^10.1.8
|
||||
'@rollup/plugin-commonjs': ^22.0.0
|
||||
'@rollup/plugin-node-resolve': ^13.3.0
|
||||
'@swc/core': ^1.2.194
|
||||
'@types/bs58': ^4.0.1
|
||||
'@types/jest': ^27.5.1
|
||||
'@types/node': ^17.0.36
|
||||
'@types/platform': ^1.3.4
|
||||
'@types/uuid': ^8.3.4
|
||||
add: ^2.0.6
|
||||
async: 3.2.3
|
||||
base64-js: ^1.5.1
|
||||
browser-or-node: ^2.0.0
|
||||
bs58: 5.0.0
|
||||
buffer: ^6.0.3
|
||||
cids: 1.1.9
|
||||
it-length-prefixed: 5.0.3
|
||||
it-pipe: 1.1.0
|
||||
jest: ^28.1.0
|
||||
jest-each: ^28.1.0
|
||||
js-base64: ^3.7.2
|
||||
libp2p: 0.37.0
|
||||
libp2p-crypto: 0.21.2
|
||||
loglevel: 1.8.0
|
||||
multiformats: ^9.6.5
|
||||
platform: ^1.3.6
|
||||
rollup: ^2.74.1
|
||||
rollup-plugin-clear: ^2.0.7
|
||||
rollup-plugin-dts: ^4.2.2
|
||||
rollup-plugin-preserve-shebang: ^1.0.1
|
||||
rollup-plugin-swc3: ^0.3.0
|
||||
rollup-plugin-terser: ^7.0.2
|
||||
rxjs: ^7.5.5
|
||||
ts-jest: ^28.0.2
|
||||
ts-pattern: 3.3.3
|
||||
typedoc: ^0.22.15
|
||||
typescript: ^4.0.0
|
||||
uuid: 8.3.2
|
||||
importers:
|
||||
|
||||
dependencies:
|
||||
'@chainsafe/libp2p-noise': 6.2.0
|
||||
'@fluencelabs/avm': 0.24.2
|
||||
'@fluencelabs/marine-js': 0.2.5_7sa2e64agunq5kj4zcolhrnkbm
|
||||
'@libp2p/mplex': 1.1.0
|
||||
'@libp2p/peer-id': 1.1.11
|
||||
'@libp2p/websockets': 1.0.9_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@multiformats/multiaddr': 10.1.8
|
||||
async: 3.2.3
|
||||
base64-js: 1.5.1
|
||||
browser-or-node: 2.0.0
|
||||
bs58: 5.0.0
|
||||
buffer: 6.0.3
|
||||
cids: 1.1.9
|
||||
it-length-prefixed: 5.0.3
|
||||
it-pipe: 1.1.0
|
||||
libp2p: 0.37.0_twvoj2kiwyd72xzblfrweyrn2m
|
||||
libp2p-crypto: 0.21.2
|
||||
loglevel: 1.8.0
|
||||
platform: 1.3.6
|
||||
rxjs: 7.5.5
|
||||
ts-pattern: 3.3.3
|
||||
uuid: 8.3.2
|
||||
packages/@tests-integration:
|
||||
specifiers:
|
||||
'@fluencelabs/aqua': ^0.7.2-307
|
||||
'@fluencelabs/aqua-lib': ^0.5.1
|
||||
'@fluencelabs/fluence': workspace:*
|
||||
'@fluencelabs/fluence-network-environment': ^1.0.13
|
||||
'@types/jest': ^27.5.1
|
||||
'@types/node': ^17.0.36
|
||||
'@types/platform': ^1.3.4
|
||||
'@types/uuid': ^8.3.4
|
||||
add: ^2.0.6
|
||||
jest: ^28.1.0
|
||||
jest-each: ^28.1.0
|
||||
ts-jest: ^28.0.2
|
||||
typescript: ^4.0.0
|
||||
dependencies:
|
||||
'@fluencelabs/fluence': link:../fluence-js
|
||||
'@fluencelabs/fluence-network-environment': 1.0.13
|
||||
devDependencies:
|
||||
'@fluencelabs/aqua': 0.7.2-314_7sa2e64agunq5kj4zcolhrnkbm
|
||||
'@fluencelabs/aqua-lib': 0.5.1
|
||||
'@types/jest': 27.5.1
|
||||
'@types/node': 17.0.36
|
||||
'@types/platform': 1.3.4
|
||||
'@types/uuid': 8.3.4
|
||||
add: 2.0.6
|
||||
jest: 28.1.0_@types+node@17.0.36
|
||||
jest-each: 28.1.0
|
||||
ts-jest: 28.0.3_7sa2e64agunq5kj4zcolhrnkbm
|
||||
typescript: 4.7.2
|
||||
|
||||
devDependencies:
|
||||
'@fluencelabs/aqua': 0.7.2-314_7sa2e64agunq5kj4zcolhrnkbm
|
||||
'@fluencelabs/aqua-lib': 0.5.1
|
||||
'@libp2p/interfaces': 2.0.2
|
||||
'@rollup/plugin-commonjs': 22.0.0_rollup@2.75.3
|
||||
'@rollup/plugin-node-resolve': 13.3.0_rollup@2.75.3
|
||||
'@swc/core': 1.2.194
|
||||
'@types/bs58': 4.0.1
|
||||
'@types/jest': 27.5.1
|
||||
'@types/node': 17.0.36
|
||||
'@types/platform': 1.3.4
|
||||
'@types/uuid': 8.3.4
|
||||
add: 2.0.6
|
||||
jest: 28.1.0_@types+node@17.0.36
|
||||
jest-each: 28.1.0
|
||||
js-base64: 3.7.2
|
||||
multiformats: 9.6.5
|
||||
rollup: 2.75.3
|
||||
rollup-plugin-clear: 2.0.7
|
||||
rollup-plugin-dts: 4.2.2_nl2qxg2fxlgm6l264qcwjguuca
|
||||
rollup-plugin-preserve-shebang: 1.0.1
|
||||
rollup-plugin-swc3: 0.3.0_nux4s62oux7eje2qunhyzaj53m
|
||||
rollup-plugin-terser: 7.0.2_rollup@2.75.3
|
||||
ts-jest: 28.0.3_7sa2e64agunq5kj4zcolhrnkbm
|
||||
typedoc: 0.22.16_typescript@4.7.2
|
||||
typescript: 4.7.2
|
||||
packages/fluence-js:
|
||||
specifiers:
|
||||
'@chainsafe/libp2p-noise': ^6.1.1
|
||||
'@fluencelabs/aqua': ^0.7.2-307
|
||||
'@fluencelabs/aqua-lib': ^0.5.1
|
||||
'@fluencelabs/avm': 0.24.2
|
||||
'@fluencelabs/marine-js': 0.2.5
|
||||
'@libp2p/interfaces': ^2.0.2
|
||||
'@libp2p/mplex': ^1.0.5
|
||||
'@libp2p/peer-id': ^1.1.10
|
||||
'@libp2p/websockets': ^1.0.8
|
||||
'@multiformats/multiaddr': ^10.1.8
|
||||
'@rollup/plugin-commonjs': ^22.0.0
|
||||
'@rollup/plugin-node-resolve': ^13.3.0
|
||||
'@swc/core': ^1.2.194
|
||||
'@types/bs58': ^4.0.1
|
||||
'@types/jest': ^27.5.1
|
||||
'@types/node': ^17.0.36
|
||||
'@types/platform': ^1.3.4
|
||||
'@types/uuid': ^8.3.4
|
||||
add: ^2.0.6
|
||||
async: 3.2.3
|
||||
base64-js: ^1.5.1
|
||||
browser-or-node: ^2.0.0
|
||||
bs58: 5.0.0
|
||||
buffer: ^6.0.3
|
||||
cids: 1.1.9
|
||||
it-length-prefixed: 5.0.3
|
||||
it-pipe: 1.1.0
|
||||
jest: ^28.1.0
|
||||
jest-each: ^28.1.0
|
||||
js-base64: ^3.7.2
|
||||
libp2p: 0.37.0
|
||||
libp2p-crypto: 0.21.2
|
||||
loglevel: 1.8.0
|
||||
multiformats: ^9.6.5
|
||||
platform: ^1.3.6
|
||||
rollup: ^2.74.1
|
||||
rollup-plugin-clear: ^2.0.7
|
||||
rollup-plugin-dts: ^4.2.2
|
||||
rollup-plugin-preserve-shebang: ^1.0.1
|
||||
rollup-plugin-swc3: ^0.3.0
|
||||
rollup-plugin-terser: ^7.0.2
|
||||
rxjs: ^7.5.5
|
||||
ts-jest: ^28.0.2
|
||||
ts-pattern: 3.3.3
|
||||
typedoc: ^0.22.15
|
||||
typescript: ^4.0.0
|
||||
uuid: 8.3.2
|
||||
dependencies:
|
||||
'@chainsafe/libp2p-noise': 6.2.0
|
||||
'@fluencelabs/avm': 0.24.2
|
||||
'@fluencelabs/marine-js': 0.2.5_7sa2e64agunq5kj4zcolhrnkbm
|
||||
'@libp2p/mplex': 1.1.0
|
||||
'@libp2p/peer-id': 1.1.11
|
||||
'@libp2p/websockets': 1.0.9_uluuwrprffmsiwy2zanpihzgue
|
||||
'@multiformats/multiaddr': 10.1.8
|
||||
async: 3.2.3
|
||||
base64-js: 1.5.1
|
||||
browser-or-node: 2.0.0
|
||||
bs58: 5.0.0
|
||||
buffer: 6.0.3
|
||||
cids: 1.1.9
|
||||
it-length-prefixed: 5.0.3
|
||||
it-pipe: 1.1.0
|
||||
libp2p: 0.37.0_uluuwrprffmsiwy2zanpihzgue
|
||||
libp2p-crypto: 0.21.2
|
||||
loglevel: 1.8.0
|
||||
platform: 1.3.6
|
||||
rxjs: 7.5.5
|
||||
ts-pattern: 3.3.3
|
||||
uuid: 8.3.2
|
||||
devDependencies:
|
||||
'@fluencelabs/aqua': 0.7.2-314_7sa2e64agunq5kj4zcolhrnkbm
|
||||
'@fluencelabs/aqua-lib': 0.5.1
|
||||
'@libp2p/interfaces': 2.0.2
|
||||
'@rollup/plugin-commonjs': 22.0.0_rollup@2.75.4
|
||||
'@rollup/plugin-node-resolve': 13.3.0_rollup@2.75.4
|
||||
'@swc/core': 1.2.196
|
||||
'@types/bs58': 4.0.1
|
||||
'@types/jest': 27.5.1
|
||||
'@types/node': 17.0.36
|
||||
'@types/platform': 1.3.4
|
||||
'@types/uuid': 8.3.4
|
||||
add: 2.0.6
|
||||
jest: 28.1.0_@types+node@17.0.36
|
||||
jest-each: 28.1.0
|
||||
js-base64: 3.7.2
|
||||
multiformats: 9.6.5
|
||||
rollup: 2.75.4
|
||||
rollup-plugin-clear: 2.0.7
|
||||
rollup-plugin-dts: 4.2.2_flgbp2mwh7cyq7tyxrigr47lze
|
||||
rollup-plugin-preserve-shebang: 1.0.1
|
||||
rollup-plugin-swc3: 0.3.0_oeyekckw7q3dbr2t2h5zcb37ie
|
||||
rollup-plugin-terser: 7.0.2_rollup@2.75.4
|
||||
ts-jest: 28.0.3_7sa2e64agunq5kj4zcolhrnkbm
|
||||
typedoc: 0.22.16_typescript@4.7.2
|
||||
typescript: 4.7.2
|
||||
|
||||
packages:
|
||||
|
||||
@ -524,7 +556,6 @@ packages:
|
||||
|
||||
/@fluencelabs/fluence-network-environment/1.0.13:
|
||||
resolution: {integrity: sha512-2pci3T0sUHE08jwEs1r/vHKVT4XUh/A3j/QJ0eIhddsxyIjEksjdn05X7DF6STD14CF8GgBVOJEPgav8qaUMpA==}
|
||||
dev: true
|
||||
|
||||
/@fluencelabs/fluence/0.23.0_7sa2e64agunq5kj4zcolhrnkbm:
|
||||
resolution: {integrity: sha512-HbSmOzXnRaLKUfS75FreXJ6E1P4HA+Qi0yUFD1VfEyvN5p40ujzHGu5wv+6hHOQnBJPkWse9Lv4U9NQVdwUzvQ==}
|
||||
@ -1002,7 +1033,7 @@ packages:
|
||||
- undici
|
||||
dev: false
|
||||
|
||||
/@libp2p/peer-record/1.0.12_twvoj2kiwyd72xzblfrweyrn2m:
|
||||
/@libp2p/peer-record/1.0.12_uluuwrprffmsiwy2zanpihzgue:
|
||||
resolution: {integrity: sha512-1b4aeU4sduRBUH4RKDtYBHKOEXwohrlOoBrrNPKb1WFweLMnG3oznhGusMvKQ8YuXSOTpbNPHrbJ/iJnrBbVUQ==}
|
||||
engines: {node: '>=16.0.0', npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
@ -1010,7 +1041,7 @@ packages:
|
||||
'@libp2p/interfaces': 2.0.2
|
||||
'@libp2p/logger': 1.1.5
|
||||
'@libp2p/peer-id': 1.1.11
|
||||
'@libp2p/utils': 1.0.10_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@libp2p/utils': 1.0.10_uluuwrprffmsiwy2zanpihzgue
|
||||
'@multiformats/multiaddr': 10.1.8
|
||||
err-code: 3.0.1
|
||||
interface-datastore: 6.1.0
|
||||
@ -1033,14 +1064,14 @@ packages:
|
||||
- undici
|
||||
dev: false
|
||||
|
||||
/@libp2p/peer-store/1.0.16_twvoj2kiwyd72xzblfrweyrn2m:
|
||||
/@libp2p/peer-store/1.0.16_uluuwrprffmsiwy2zanpihzgue:
|
||||
resolution: {integrity: sha512-TSO4ARn7L+CKBp1+hLgW6N7Mn/o4d6mvjMm7zoxxdCFtxqnZa0385mZcjYRurvslwZzksiDflcLn+AKkXKdEhw==}
|
||||
engines: {node: '>=16.0.0', npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
'@libp2p/interfaces': 2.0.2
|
||||
'@libp2p/logger': 1.1.5
|
||||
'@libp2p/peer-id': 1.1.11
|
||||
'@libp2p/peer-record': 1.0.12_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@libp2p/peer-record': 1.0.12_uluuwrprffmsiwy2zanpihzgue
|
||||
'@multiformats/multiaddr': 10.1.8
|
||||
err-code: 3.0.1
|
||||
interface-datastore: 6.1.0
|
||||
@ -1073,7 +1104,7 @@ packages:
|
||||
- undici
|
||||
dev: false
|
||||
|
||||
/@libp2p/utils/1.0.10_twvoj2kiwyd72xzblfrweyrn2m:
|
||||
/@libp2p/utils/1.0.10_uluuwrprffmsiwy2zanpihzgue:
|
||||
resolution: {integrity: sha512-jlVLfac1IoBlgXL8V+XZYxNw0SOAkKweiLhXWolUbKOgRtMDquJzbwG1n8y9GtdiFKPlkiBwOB7l9xighcOR6w==}
|
||||
engines: {node: '>=16.0.0', npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
@ -1086,7 +1117,7 @@ packages:
|
||||
it-stream-types: 1.0.4
|
||||
private-ip: 2.3.3
|
||||
ts-mocha: 9.0.2
|
||||
ts-node: 10.8.0_twvoj2kiwyd72xzblfrweyrn2m
|
||||
ts-node: 10.8.0_uluuwrprffmsiwy2zanpihzgue
|
||||
transitivePeerDependencies:
|
||||
- '@swc/core'
|
||||
- '@swc/wasm'
|
||||
@ -1097,13 +1128,13 @@ packages:
|
||||
- undici
|
||||
dev: false
|
||||
|
||||
/@libp2p/websockets/1.0.9_twvoj2kiwyd72xzblfrweyrn2m:
|
||||
/@libp2p/websockets/1.0.9_uluuwrprffmsiwy2zanpihzgue:
|
||||
resolution: {integrity: sha512-fKqTqzGXAcSIG2kFuDOgMyqjE8khTwE7+J1m+XvZRfz4b732wspg/3o/81dExN+T6F5wU60s2VeEYYyc1K++Vg==}
|
||||
engines: {node: '>=16.0.0', npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
'@libp2p/interfaces': 2.0.2
|
||||
'@libp2p/logger': 1.1.5
|
||||
'@libp2p/utils': 1.0.10_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@libp2p/utils': 1.0.10_uluuwrprffmsiwy2zanpihzgue
|
||||
'@multiformats/mafmt': 11.0.2
|
||||
'@multiformats/multiaddr': 10.1.8
|
||||
'@multiformats/multiaddr-to-uri': 9.0.1
|
||||
@ -1215,38 +1246,38 @@ packages:
|
||||
/@protobufjs/utf8/1.1.0:
|
||||
resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==}
|
||||
|
||||
/@rollup/plugin-commonjs/22.0.0_rollup@2.75.3:
|
||||
/@rollup/plugin-commonjs/22.0.0_rollup@2.75.4:
|
||||
resolution: {integrity: sha512-Ktvf2j+bAO+30awhbYoCaXpBcyPmJbaEUYClQns/+6SNCYFURbvBiNbWgHITEsIgDDWCDUclWRKEuf8cwZCFoQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
peerDependencies:
|
||||
rollup: ^2.68.0
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 3.1.0_rollup@2.75.3
|
||||
'@rollup/pluginutils': 3.1.0_rollup@2.75.4
|
||||
commondir: 1.0.1
|
||||
estree-walker: 2.0.2
|
||||
glob: 7.2.3
|
||||
is-reference: 1.2.1
|
||||
magic-string: 0.25.9
|
||||
resolve: 1.22.0
|
||||
rollup: 2.75.3
|
||||
rollup: 2.75.4
|
||||
dev: true
|
||||
|
||||
/@rollup/plugin-node-resolve/13.3.0_rollup@2.75.3:
|
||||
/@rollup/plugin-node-resolve/13.3.0_rollup@2.75.4:
|
||||
resolution: {integrity: sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
peerDependencies:
|
||||
rollup: ^2.42.0
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 3.1.0_rollup@2.75.3
|
||||
'@rollup/pluginutils': 3.1.0_rollup@2.75.4
|
||||
'@types/resolve': 1.17.1
|
||||
deepmerge: 4.2.2
|
||||
is-builtin-module: 3.1.0
|
||||
is-module: 1.0.0
|
||||
resolve: 1.22.0
|
||||
rollup: 2.75.3
|
||||
rollup: 2.75.4
|
||||
dev: true
|
||||
|
||||
/@rollup/pluginutils/3.1.0_rollup@2.75.3:
|
||||
/@rollup/pluginutils/3.1.0_rollup@2.75.4:
|
||||
resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==}
|
||||
engines: {node: '>= 8.0.0'}
|
||||
peerDependencies:
|
||||
@ -1255,7 +1286,7 @@ packages:
|
||||
'@types/estree': 0.0.39
|
||||
estree-walker: 1.0.1
|
||||
picomatch: 2.3.1
|
||||
rollup: 2.75.3
|
||||
rollup: 2.75.4
|
||||
dev: true
|
||||
|
||||
/@rollup/pluginutils/4.2.1:
|
||||
@ -1368,128 +1399,128 @@ packages:
|
||||
'@stablelib/random': 1.0.1
|
||||
'@stablelib/wipe': 1.0.1
|
||||
|
||||
/@swc/core-android-arm-eabi/1.2.194:
|
||||
resolution: {integrity: sha512-Hv/k9KN2Aab8jO/SmSlzKpzS941IXfdr9XEQRl/rc5Nj4neVW8AWS4+AJnl4u7MiJrfM0No6ZRQx32Ke+APmLQ==}
|
||||
/@swc/core-android-arm-eabi/1.2.196:
|
||||
resolution: {integrity: sha512-rWM909UT01+CWxvOkQ7f6bhtceFz/jBuVhYqtOjkDleMV6UsKVfMOAkAMQBfvQmoQzvqddypCDl5tOZIoj3O0w==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-android-arm64/1.2.194:
|
||||
resolution: {integrity: sha512-/r2iah0khiv3xUbOT6upf1fdeGdKrVa8sghyTI0jPRpQ5GKD01nuEq+FlmieTwkQ0pQbgVKun0zyriAOXjLqWA==}
|
||||
/@swc/core-android-arm64/1.2.196:
|
||||
resolution: {integrity: sha512-SPNMBcziCev0B439raRC2KpRrqiw6Jw8Bvw5Swrra34kUHjxxEYbxHeFBdUA0Ka1YoMJ95gCEW9fsqTlPkYBIQ==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-darwin-arm64/1.2.194:
|
||||
resolution: {integrity: sha512-pLsxgi985iSu+wqskJAO+kr0QwNqYQSyfdQEjCtWi5oYp3wIBPHLccIPVcIUfD6YAqXdqnQJg9RtA4scpdrQNg==}
|
||||
/@swc/core-darwin-arm64/1.2.196:
|
||||
resolution: {integrity: sha512-Sd22WY9frsbUQVay9LTakqFtkOnzkWw+PB1iwcpBzenOVQxbQ8i7JlxcujTkMFc2J/SAKDelq+M4TE6JEdfU6A==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-darwin-x64/1.2.194:
|
||||
resolution: {integrity: sha512-WLFhotRbGqMKg9HwB0RF0Ycz6B6uSMEHcblAdBhiyL4fIp+CMUhkvC8jTs0xij/yJj96B6Xf9UH/Q5MFUQrJEw==}
|
||||
/@swc/core-darwin-x64/1.2.196:
|
||||
resolution: {integrity: sha512-1z0ROEMIKjAqEc/jNdZwcdgWzUqw/mHmhQABm1J6lUf3UEucUAy/4cniWPHXKKRCdj7Eq7kHtU52ynQpB/ii0Q==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-freebsd-x64/1.2.194:
|
||||
resolution: {integrity: sha512-UNG8G5TlYWvfyB7+Fc1h5hoSwEY1LLLth7V8DFMljd0dm2hcSpukuWaQk/GE3EANCE40nq3y4THEAlSu4lauSg==}
|
||||
/@swc/core-freebsd-x64/1.2.196:
|
||||
resolution: {integrity: sha512-KjUo4Vgs7AuGhLJCE5yeVazTUpoiRNuaLbRxnXIC7Ua7T4JpnO9lc34aWWUhz8Gu7QLEWpLFMM52W+bwVeBi7A==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-linux-arm-gnueabihf/1.2.194:
|
||||
resolution: {integrity: sha512-mbk4MMgBf9BWFV0yqvReT29xZ6N6CLNgiG2UFnmXkLrrEBrAz5c3W8so5VqdyK52yWMS5Vs0a6VOvlimh057KA==}
|
||||
/@swc/core-linux-arm-gnueabihf/1.2.196:
|
||||
resolution: {integrity: sha512-n7V9GyPQ7H6UvJKB15K0vHek2WihbPdv866h2LG1Lrw5mxxDs5A4o7hj4scKF355kjyj9LI+4GykT3R9MpIWzw==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-linux-arm64-gnu/1.2.194:
|
||||
resolution: {integrity: sha512-vdr2zUJnd67oQfXn1Ix0ueND+iEnCTwA4dobT4s0KsZCusJKuJlkm97p7rgk3Cxn2sHm/8BBQX4KpdXwNEL3Tw==}
|
||||
/@swc/core-linux-arm64-gnu/1.2.196:
|
||||
resolution: {integrity: sha512-1ToeE8/5Ew8HEa3GQf9znijzpmNf5jnnU39mrO0dpmhiUJVgRU/IBoe45t0I8R84PRDfayqoSfq0vPt7dWSjdQ==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-linux-arm64-musl/1.2.194:
|
||||
resolution: {integrity: sha512-wocEG55mu/KAFs1B9l1E0FbfU9nKaY3ULuT/isELHqDNZB23nNFRa+ymez/NqBhqVPhX4B0L+7j2r4tipXiI2A==}
|
||||
/@swc/core-linux-arm64-musl/1.2.196:
|
||||
resolution: {integrity: sha512-93Pvb0lpgL/B7Em+qAScYsf4QvE4OmuTQ+aXRz4VsKiw/+DQKt5jUmCzkYa4ecSvSur3rlqFLMU8ufPI7EF22g==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-linux-x64-gnu/1.2.194:
|
||||
resolution: {integrity: sha512-PA7kudCtpGy1m40LKTeIsSse0zkmMyHthYjfn7q8pUWlo2b9o9RxO5zsnLxLsgATsoPwfMmVl9m3+1xSkxJp+g==}
|
||||
/@swc/core-linux-x64-gnu/1.2.196:
|
||||
resolution: {integrity: sha512-JZkQ/ETPCNae8hOOfVOBHJuy9vhSJwdzWFO1Kd8PhyDyCi0caNX8Tu3mgGTZJ0UToP0ot7mC945+1w4lcuQPBA==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-linux-x64-musl/1.2.194:
|
||||
resolution: {integrity: sha512-2CdLXLpdKqtZmFgcEOyw9Gu/24ku5/4NabSdYg58XGarrPS96lQk80rzaMYxs6AzfsfhHGmsp3se07jnLwSlXQ==}
|
||||
/@swc/core-linux-x64-musl/1.2.196:
|
||||
resolution: {integrity: sha512-TJAfEf7l79mceXO3AXaf4Lun8ZjjaHXMlQe/3QrtblxKUFeHgFDbQeabjcgsYyNzAffPXDLsKVvmC4GJTu35DQ==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-win32-arm64-msvc/1.2.194:
|
||||
resolution: {integrity: sha512-7NpBJ1fgeP8Y2H0aCTZR8nx0BEHXdSuFwBAwKrb4kaP0d2qVAVIv/rOk7L/MwsuXmlsISQ13JnUtQYjYPGJsUg==}
|
||||
/@swc/core-win32-arm64-msvc/1.2.196:
|
||||
resolution: {integrity: sha512-WDQ9HZZ8SrInw2kisBPbNg8W0IgA8P9eGijQeigyvT2rT81A/Gj9G57YMq0fQclcodBLr6SJPDIHh4fC8JInFg==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-win32-ia32-msvc/1.2.194:
|
||||
resolution: {integrity: sha512-1TP+kS32uFSgBHOJGmLNfxcqU7e85FZZTKAVAQgEPmHH0lJ/9BcViMDhMOdnyEWjIluD5aj6WdPdeAz1YlXDng==}
|
||||
/@swc/core-win32-ia32-msvc/1.2.196:
|
||||
resolution: {integrity: sha512-c355907n5RCeuF99/3nFmJdiw4Ask0BwH7hs+4Y1dcOzC/FYvh2TmYZ+VTJzL78TiIekmvi4buxGqFvHePZ2Pw==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core-win32-x64-msvc/1.2.194:
|
||||
resolution: {integrity: sha512-c3tiShCGY03XbJqXpliHRHMBBB/KGWS1kcbKn2GhaZN4fY8UgD5kZk3XJDwDJ6oqwlgkBdWXRAgD5Td2aAKMRg==}
|
||||
/@swc/core-win32-x64-msvc/1.2.196:
|
||||
resolution: {integrity: sha512-zQKrvEDmTqMd1lwbQ4KcBVKQ2OVoQlX1I/kZNISZlh/+UhBpKnkqQme/76wtILH9r0Lz+ujumL2ZvwoVAzAJkQ==}
|
||||
engines: {node: '>=10'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@swc/core/1.2.194:
|
||||
resolution: {integrity: sha512-+Jg3qxad32CqnFmw4pqwm/5JCVWGkoM8P5pqPlyj5sokHFUJluMkCeaikuvIZhJCabR9q84lEnXlIjMu42ZfKA==}
|
||||
/@swc/core/1.2.196:
|
||||
resolution: {integrity: sha512-395byH+v71OwJpXIvt+FZJZeF20Cs+LwYkURpkkmN5aKImdTuCqnNqapWsh3nfuIgDdC5k8QvrGEQNTmE8+cTw==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
optionalDependencies:
|
||||
'@swc/core-android-arm-eabi': 1.2.194
|
||||
'@swc/core-android-arm64': 1.2.194
|
||||
'@swc/core-darwin-arm64': 1.2.194
|
||||
'@swc/core-darwin-x64': 1.2.194
|
||||
'@swc/core-freebsd-x64': 1.2.194
|
||||
'@swc/core-linux-arm-gnueabihf': 1.2.194
|
||||
'@swc/core-linux-arm64-gnu': 1.2.194
|
||||
'@swc/core-linux-arm64-musl': 1.2.194
|
||||
'@swc/core-linux-x64-gnu': 1.2.194
|
||||
'@swc/core-linux-x64-musl': 1.2.194
|
||||
'@swc/core-win32-arm64-msvc': 1.2.194
|
||||
'@swc/core-win32-ia32-msvc': 1.2.194
|
||||
'@swc/core-win32-x64-msvc': 1.2.194
|
||||
'@swc/core-android-arm-eabi': 1.2.196
|
||||
'@swc/core-android-arm64': 1.2.196
|
||||
'@swc/core-darwin-arm64': 1.2.196
|
||||
'@swc/core-darwin-x64': 1.2.196
|
||||
'@swc/core-freebsd-x64': 1.2.196
|
||||
'@swc/core-linux-arm-gnueabihf': 1.2.196
|
||||
'@swc/core-linux-arm64-gnu': 1.2.196
|
||||
'@swc/core-linux-arm64-musl': 1.2.196
|
||||
'@swc/core-linux-x64-gnu': 1.2.196
|
||||
'@swc/core-linux-x64-musl': 1.2.196
|
||||
'@swc/core-win32-arm64-msvc': 1.2.196
|
||||
'@swc/core-win32-ia32-msvc': 1.2.196
|
||||
'@swc/core-win32-x64-msvc': 1.2.196
|
||||
|
||||
/@tsconfig/node10/1.0.8:
|
||||
resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==}
|
||||
@ -3949,7 +3980,7 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/libp2p/0.37.0_twvoj2kiwyd72xzblfrweyrn2m:
|
||||
/libp2p/0.37.0_uluuwrprffmsiwy2zanpihzgue:
|
||||
resolution: {integrity: sha512-hfc2Pq+MeMwQgIVJUdzBculEkMSOGWw4wF9V93+A6e8gRFRm9w5sUpJTFsM4TP+iRqx+yNiyofdiBgOFTKxt8A==}
|
||||
engines: {node: '>=16.0.0', npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
@ -3962,10 +3993,10 @@ packages:
|
||||
'@libp2p/peer-collections': 1.0.3
|
||||
'@libp2p/peer-id': 1.1.11
|
||||
'@libp2p/peer-id-factory': 1.0.11
|
||||
'@libp2p/peer-record': 1.0.12_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@libp2p/peer-store': 1.0.16_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@libp2p/peer-record': 1.0.12_uluuwrprffmsiwy2zanpihzgue
|
||||
'@libp2p/peer-store': 1.0.16_uluuwrprffmsiwy2zanpihzgue
|
||||
'@libp2p/tracked-map': 1.0.7
|
||||
'@libp2p/utils': 1.0.10_twvoj2kiwyd72xzblfrweyrn2m
|
||||
'@libp2p/utils': 1.0.10_uluuwrprffmsiwy2zanpihzgue
|
||||
'@multiformats/mafmt': 11.0.2
|
||||
'@multiformats/multiaddr': 10.1.8
|
||||
abortable-iterator: 4.0.2
|
||||
@ -4347,7 +4378,7 @@ packages:
|
||||
undici: '*'
|
||||
|
||||
/natural-compare/1.4.0:
|
||||
resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=}
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
|
||||
/netmask/2.0.2:
|
||||
resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==}
|
||||
@ -4831,7 +4862,7 @@ packages:
|
||||
rimraf: 2.7.1
|
||||
dev: true
|
||||
|
||||
/rollup-plugin-dts/4.2.2_nl2qxg2fxlgm6l264qcwjguuca:
|
||||
/rollup-plugin-dts/4.2.2_flgbp2mwh7cyq7tyxrigr47lze:
|
||||
resolution: {integrity: sha512-A3g6Rogyko/PXeKoUlkjxkP++8UDVpgA7C+Tdl77Xj4fgEaIjPSnxRmR53EzvoYy97VMVwLAOcWJudaVAuxneQ==}
|
||||
engines: {node: '>=v12.22.11'}
|
||||
peerDependencies:
|
||||
@ -4839,7 +4870,7 @@ packages:
|
||||
typescript: ^4.1
|
||||
dependencies:
|
||||
magic-string: 0.26.2
|
||||
rollup: 2.75.3
|
||||
rollup: 2.75.4
|
||||
typescript: 4.7.2
|
||||
optionalDependencies:
|
||||
'@babel/code-frame': 7.16.7
|
||||
@ -4851,7 +4882,7 @@ packages:
|
||||
magic-string: 0.25.9
|
||||
dev: true
|
||||
|
||||
/rollup-plugin-swc3/0.3.0_nux4s62oux7eje2qunhyzaj53m:
|
||||
/rollup-plugin-swc3/0.3.0_oeyekckw7q3dbr2t2h5zcb37ie:
|
||||
resolution: {integrity: sha512-ZQK2XxYxSspmT8j6/Y4CaxRxAlZHbNnxI+m+yJ5I87ZLp5uH7CYL4hFlJk1jkcZ+Q2QC19jIg7AClB/7+XFljw==}
|
||||
engines: {node: '>=12'}
|
||||
peerDependencies:
|
||||
@ -4859,30 +4890,30 @@ packages:
|
||||
rollup: ^2.0.0
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 4.2.1
|
||||
'@swc/core': 1.2.194
|
||||
'@swc/core': 1.2.196
|
||||
deepmerge: 4.2.2
|
||||
joycon: 3.1.1
|
||||
jsonc-parser: 3.0.0
|
||||
rollup: 2.75.3
|
||||
rollup: 2.75.4
|
||||
typedoc: 0.22.16_typescript@4.7.2
|
||||
transitivePeerDependencies:
|
||||
- typescript
|
||||
dev: true
|
||||
|
||||
/rollup-plugin-terser/7.0.2_rollup@2.75.3:
|
||||
/rollup-plugin-terser/7.0.2_rollup@2.75.4:
|
||||
resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==}
|
||||
peerDependencies:
|
||||
rollup: ^2.0.0
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.16.7
|
||||
jest-worker: 26.6.2
|
||||
rollup: 2.75.3
|
||||
rollup: 2.75.4
|
||||
serialize-javascript: 4.0.0
|
||||
terser: 5.14.0
|
||||
dev: true
|
||||
|
||||
/rollup/2.75.3:
|
||||
resolution: {integrity: sha512-YA29fLU6MAYSaDxIQYrGGOcbXlDmG96h0krGGYObroezcQ0KgEPM3+7MtKD/qeuUbFuAJXvKZee5dA1dpwq1PQ==}
|
||||
/rollup/2.75.4:
|
||||
resolution: {integrity: sha512-JgZiJMJkKImMZJ8ZY1zU80Z2bA/TvrL/7D9qcBCrfl2bP+HUaIw0QHUroB4E3gBpFl6CRFM1YxGbuYGtdAswbQ==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
hasBin: true
|
||||
optionalDependencies:
|
||||
@ -5282,7 +5313,7 @@ packages:
|
||||
tsconfig-paths: 3.14.1
|
||||
dev: false
|
||||
|
||||
/ts-node/10.8.0_twvoj2kiwyd72xzblfrweyrn2m:
|
||||
/ts-node/10.8.0_uluuwrprffmsiwy2zanpihzgue:
|
||||
resolution: {integrity: sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@ -5297,7 +5328,7 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@cspotcode/source-map-support': 0.8.1
|
||||
'@swc/core': 1.2.194
|
||||
'@swc/core': 1.2.196
|
||||
'@tsconfig/node10': 1.0.8
|
||||
'@tsconfig/node12': 1.0.9
|
||||
'@tsconfig/node14': 1.0.1
|
||||
|
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
packages:
|
||||
- 'packages/*'
|
@ -1,167 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.7.0-287
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '../../index';
|
||||
import { CallParams, callFunction, registerService } from '../../internal/compilerSupport/v3';
|
||||
|
||||
// Services
|
||||
|
||||
export interface GreetingRecordDef {
|
||||
greeting_record: (
|
||||
callParams: CallParams<null>,
|
||||
) => { num: number; str: string } | Promise<{ num: number; str: string }>;
|
||||
log_debug: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_error: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_info: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_trace: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
log_warn: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
void_fn: (callParams: CallParams<null>) => void | Promise<void>;
|
||||
}
|
||||
export function registerGreetingRecord(serviceId: string, service: GreetingRecordDef): void;
|
||||
export function registerGreetingRecord(peer: FluencePeer, serviceId: string, service: GreetingRecordDef): void;
|
||||
|
||||
export function registerGreetingRecord(...args: any) {
|
||||
registerService(args, {
|
||||
functions: {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
greeting_record: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'unlabeledProduct',
|
||||
items: [
|
||||
{
|
||||
tag: 'struct',
|
||||
name: 'GreetingRecord',
|
||||
fields: {
|
||||
num: {
|
||||
tag: 'scalar',
|
||||
name: 'i32',
|
||||
},
|
||||
str: {
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
log_debug: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
log_error: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
log_info: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
log_trace: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
log_warn: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
void_fn: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
export function call_info(srvId: string, config?: { ttl?: number }): Promise<void>;
|
||||
|
||||
export function call_info(peer: FluencePeer, srvId: string, config?: { ttl?: number }): Promise<void>;
|
||||
|
||||
export function call_info(...args: any) {
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "srvId") [] srvId)
|
||||
)
|
||||
(call %init_peer_id% (srvId "log_info") [])
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
`;
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
functionName: 'call_info',
|
||||
arrow: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
srvId: {
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
codomain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
},
|
||||
names: {
|
||||
relay: '-relay-',
|
||||
getDataSrv: 'getDataSrv',
|
||||
callbackSrv: 'callbackSrv',
|
||||
responseSrv: 'callbackSrv',
|
||||
responseFnName: 'response',
|
||||
errorHandlingSrv: 'errorHandlingSrv',
|
||||
errorFnName: 'error',
|
||||
},
|
||||
},
|
||||
script,
|
||||
);
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||
* Aqua version: 0.7.0-285
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '../../index';
|
||||
import { CallParams, callFunction, registerService } from '../../internal/compilerSupport/v3';
|
||||
|
||||
// Services
|
||||
|
||||
export interface GreetingDef {
|
||||
greeting: (name: string, callParams: CallParams<'name'>) => string | Promise<string>;
|
||||
greeting_record: (
|
||||
callParams: CallParams<null>,
|
||||
) => { num: number; str: string } | Promise<{ num: number; str: string }>;
|
||||
}
|
||||
export function registerGreeting(service: GreetingDef): void;
|
||||
export function registerGreeting(serviceId: string, service: GreetingDef): void;
|
||||
export function registerGreeting(peer: FluencePeer, service: GreetingDef): void;
|
||||
export function registerGreeting(peer: FluencePeer, serviceId: string, service: GreetingDef): void;
|
||||
|
||||
export function registerGreeting(...args: any) {
|
||||
registerService(args, {
|
||||
defaultServiceId: 'greeting',
|
||||
functions: {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
greeting: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
name: {
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
codomain: {
|
||||
tag: 'unlabeledProduct',
|
||||
items: [
|
||||
{
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
greeting_record: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'nil',
|
||||
},
|
||||
codomain: {
|
||||
tag: 'unlabeledProduct',
|
||||
items: [
|
||||
{
|
||||
tag: 'struct',
|
||||
name: 'GreetingRecord',
|
||||
fields: {
|
||||
num: {
|
||||
tag: 'scalar',
|
||||
name: 'i32',
|
||||
},
|
||||
str: {
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
export function call(arg: string, config?: { ttl?: number }): Promise<string>;
|
||||
|
||||
export function call(peer: FluencePeer, arg: string, config?: { ttl?: number }): Promise<string>;
|
||||
|
||||
export function call(...args: any) {
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "arg") [] arg)
|
||||
)
|
||||
(call %init_peer_id% ("greeting" "greeting") [arg] res1)
|
||||
)
|
||||
(call %init_peer_id% ("greeting" "greeting") [res1] res2)
|
||||
)
|
||||
(call %init_peer_id% ("greeting" "greeting") [res2] res3)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res3])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`;
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
functionName: 'call',
|
||||
arrow: {
|
||||
tag: 'arrow',
|
||||
domain: {
|
||||
tag: 'labeledProduct',
|
||||
fields: {
|
||||
arg: {
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
codomain: {
|
||||
tag: 'unlabeledProduct',
|
||||
items: [
|
||||
{
|
||||
tag: 'scalar',
|
||||
name: 'string',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
names: {
|
||||
relay: '-relay-',
|
||||
getDataSrv: 'getDataSrv',
|
||||
callbackSrv: 'callbackSrv',
|
||||
responseSrv: 'callbackSrv',
|
||||
responseFnName: 'response',
|
||||
errorHandlingSrv: 'errorHandlingSrv',
|
||||
errorFnName: 'error',
|
||||
},
|
||||
},
|
||||
script,
|
||||
);
|
||||
}
|
@ -1,8 +1,5 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["./node_modules/@types", "./node_modules/libp2p-ts/types"],
|
||||
"outDir": "./dist/",
|
||||
"baseUrl": ".",
|
||||
"downlevelIteration": true,
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
@ -17,6 +14,6 @@
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": ["node_modules", "dist", "bundle"],
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user