Update all getting started examples

This commit is contained in:
Pavel Murygin 2021-10-22 09:14:22 +03:00
parent b406212d5b
commit 7d1b960c3f
6 changed files with 116 additions and 136 deletions

View File

@ -24,7 +24,7 @@
"web-vitals": "^1.1.2"
},
"devDependencies": {
"@fluencelabs/aqua": "^0.4.0-234",
"@fluencelabs/aqua": "^0.4.0-235",
"@fluencelabs/aqua-lib": "0.1.14",
"chokidar-cli": "^2.1.0",
"node-sass": "^6.0.1"
@ -1953,9 +1953,9 @@
}
},
"node_modules/@fluencelabs/aqua": {
"version": "0.4.0-234",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-234.tgz",
"integrity": "sha512-7ysLPh3R4gAfXgO24OGT7rP5UGKUHs7ipfx4HTJsYZahZ0rMbWA98uC/aM3+q0WH1WEowyV16zvGACONFLZ5RA==",
"version": "0.4.0-235",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-235.tgz",
"integrity": "sha512-tbbHG3dhlwcSzlHMPoV4/MLW6JE00q3hiyznjLh+aW91ovBAXuWe5C1n9CKeRiJtYz3yIQCn2l3arI/PvzLx9Q==",
"dev": true,
"dependencies": {
"@fluencelabs/fluence": "0.12.1"
@ -25339,9 +25339,9 @@
}
},
"@fluencelabs/aqua": {
"version": "0.4.0-234",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-234.tgz",
"integrity": "sha512-7ysLPh3R4gAfXgO24OGT7rP5UGKUHs7ipfx4HTJsYZahZ0rMbWA98uC/aM3+q0WH1WEowyV16zvGACONFLZ5RA==",
"version": "0.4.0-235",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-235.tgz",
"integrity": "sha512-tbbHG3dhlwcSzlHMPoV4/MLW6JE00q3hiyznjLh+aW91ovBAXuWe5C1n9CKeRiJtYz3yIQCn2l3arI/PvzLx9Q==",
"dev": true,
"requires": {
"@fluencelabs/fluence": "0.12.1"

View File

@ -45,7 +45,7 @@
]
},
"devDependencies": {
"@fluencelabs/aqua": "^0.4.0-234",
"@fluencelabs/aqua": "^0.4.0-235",
"@fluencelabs/aqua-lib": "0.1.14",
"chokidar-cli": "^2.1.0",
"node-sass": "^6.0.1"

View File

@ -3,7 +3,7 @@
* 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.4.0-234
* Aqua version: 0.4.0-235
*
*/
import { Fluence, FluencePeer } from '@fluencelabs/fluence';

View File

@ -24,7 +24,7 @@
"web-vitals": "^1.1.2"
},
"devDependencies": {
"@fluencelabs/aqua": "^0.4.0-234",
"@fluencelabs/aqua": "^0.4.0-235",
"@fluencelabs/aqua-lib": "0.1.14",
"chokidar-cli": "^2.1.0",
"node-sass": "^6.0.1"
@ -1953,9 +1953,9 @@
}
},
"node_modules/@fluencelabs/aqua": {
"version": "0.4.0-234",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-234.tgz",
"integrity": "sha512-7ysLPh3R4gAfXgO24OGT7rP5UGKUHs7ipfx4HTJsYZahZ0rMbWA98uC/aM3+q0WH1WEowyV16zvGACONFLZ5RA==",
"version": "0.4.0-235",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-235.tgz",
"integrity": "sha512-tbbHG3dhlwcSzlHMPoV4/MLW6JE00q3hiyznjLh+aW91ovBAXuWe5C1n9CKeRiJtYz3yIQCn2l3arI/PvzLx9Q==",
"dev": true,
"dependencies": {
"@fluencelabs/fluence": "0.12.1"
@ -25339,9 +25339,9 @@
}
},
"@fluencelabs/aqua": {
"version": "0.4.0-234",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-234.tgz",
"integrity": "sha512-7ysLPh3R4gAfXgO24OGT7rP5UGKUHs7ipfx4HTJsYZahZ0rMbWA98uC/aM3+q0WH1WEowyV16zvGACONFLZ5RA==",
"version": "0.4.0-235",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.4.0-235.tgz",
"integrity": "sha512-tbbHG3dhlwcSzlHMPoV4/MLW6JE00q3hiyznjLh+aW91ovBAXuWe5C1n9CKeRiJtYz3yIQCn2l3arI/PvzLx9Q==",
"dev": true,
"requires": {
"@fluencelabs/fluence": "0.12.1"

View File

@ -45,7 +45,7 @@
]
},
"devDependencies": {
"@fluencelabs/aqua": "^0.4.0-234",
"@fluencelabs/aqua": "^0.4.0-235",
"@fluencelabs/aqua-lib": "0.1.14",
"chokidar-cli": "^2.1.0",
"node-sass": "^6.0.1"

View File

@ -3,114 +3,94 @@
* 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.4.0-234
* Aqua version: 0.4.0-235
*
*/
import { Fluence, FluencePeer } from "@fluencelabs/fluence";
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
import {
CallParams,
callFunction,
registerService,
} from "@fluencelabs/fluence/dist/internal/compilerSupport/v2";
CallParams,
callFunction,
registerService,
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v2';
// Services
export interface HelloWorldDef {
hello: (
from: string,
callParams: CallParams<"from">
) => { msg: string; reply: string } | Promise<{ msg: string; reply: string }>;
hello: (from: string, callParams: CallParams<'from'>) => { msg: string; reply: string; } | Promise<{ msg: string; reply: string; }>;
}
export function registerHelloWorld(
serviceId: string,
service: HelloWorldDef
): void;
export function registerHelloWorld(
peer: FluencePeer,
serviceId: string,
service: HelloWorldDef
): void;
export function registerHelloWorld(serviceId: string, service: HelloWorldDef): void;
export function registerHelloWorld(peer: FluencePeer, serviceId: string, service: HelloWorldDef): void;
export function registerHelloWorld(...args: any) {
registerService(args, {
defaultServiceId: undefined,
functions: [
{
functionName: "hello",
argDefs: [
{
name: "from",
argType: {
tag: "primitive",
},
},
],
returnType: {
tag: "primitive",
},
},
],
});
registerService(
args,
{
"functions" : [
{
"functionName" : "hello",
"argDefs" : [
{
"name" : "from",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "primitive"
}
}
]
}
);
}
export interface HelloPeerDef {
hello: (
message: string,
callParams: CallParams<"message">
) => string | Promise<string>;
hello: (message: string, callParams: CallParams<'message'>) => string | Promise<string>;
}
export function registerHelloPeer(service: HelloPeerDef): void;
export function registerHelloPeer(
serviceId: string,
service: HelloPeerDef
): void;
export function registerHelloPeer(
peer: FluencePeer,
service: HelloPeerDef
): void;
export function registerHelloPeer(
peer: FluencePeer,
serviceId: string,
service: HelloPeerDef
): void;
export function registerHelloPeer(serviceId: string, service: HelloPeerDef): void;
export function registerHelloPeer(peer: FluencePeer, service: HelloPeerDef): void;
export function registerHelloPeer(peer: FluencePeer, serviceId: string, service: HelloPeerDef): void;
export function registerHelloPeer(...args: any) {
registerService(args, {
defaultServiceId: "HelloPeer",
functions: [
{
functionName: "hello",
argDefs: [
{
name: "message",
argType: {
tag: "primitive",
},
},
],
returnType: {
tag: "primitive",
},
},
],
});
registerService(
args,
{
"defaultServiceId" : "HelloPeer",
"functions" : [
{
"functionName" : "hello",
"argDefs" : [
{
"name" : "message",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "primitive"
}
}
]
}
);
}
// Functions
export function sayHello(
targetPeerId: string,
targetRelayPeerId: string,
config?: { ttl?: number }
): Promise<string>;
export function sayHello(
peer: FluencePeer,
targetPeerId: string,
targetRelayPeerId: string,
config?: { ttl?: number }
): Promise<string>;
export function sayHello(targetPeerId: string, targetRelayPeerId: string, config?: {ttl?: number}): Promise<string>;
export function sayHello(peer: FluencePeer, targetPeerId: string, targetRelayPeerId: string, config?: {ttl?: number}): Promise<string>;
export function sayHello(...args: any) {
let script = `
let script = `
(xor
(seq
(seq
@ -163,38 +143,38 @@ export function sayHello(...args: any) {
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
)
`;
return callFunction(
args,
{
functionName: "sayHello",
returnType: {
tag: "primitive",
},
argDefs: [
`
return callFunction(
args,
{
name: "targetPeerId",
argType: {
tag: "primitive",
},
},
{
name: "targetRelayPeerId",
argType: {
tag: "primitive",
},
},
],
names: {
relay: "-relay-",
getDataSrv: "getDataSrv",
callbackSrv: "callbackSrv",
responseSrv: "callbackSrv",
responseFnName: "response",
errorHandlingSrv: "errorHandlingSrv",
errorFnName: "error",
},
"functionName" : "sayHello",
"returnType" : {
"tag" : "primitive"
},
script
);
"argDefs" : [
{
"name" : "targetPeerId",
"argType" : {
"tag" : "primitive"
}
},
{
"name" : "targetRelayPeerId",
"argType" : {
"tag" : "primitive"
}
}
],
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}