From 7d1b960c3fcedcc2b355f660d4b9ef08a99c12f9 Mon Sep 17 00:00:00 2001 From: Pavel Murygin Date: Fri, 22 Oct 2021 09:14:22 +0300 Subject: [PATCH] Update all getting started examples --- .../1-browser-to-browser/package-lock.json | 14 +- quickstart/1-browser-to-browser/package.json | 2 +- .../src/_aqua/getting-started.ts | 2 +- .../3-browser-to-service/package-lock.json | 14 +- quickstart/3-browser-to-service/package.json | 2 +- .../src/_aqua/getting-started.ts | 218 ++++++++---------- 6 files changed, 116 insertions(+), 136 deletions(-) diff --git a/quickstart/1-browser-to-browser/package-lock.json b/quickstart/1-browser-to-browser/package-lock.json index 5d5d743..8f0a4a1 100644 --- a/quickstart/1-browser-to-browser/package-lock.json +++ b/quickstart/1-browser-to-browser/package-lock.json @@ -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" diff --git a/quickstart/1-browser-to-browser/package.json b/quickstart/1-browser-to-browser/package.json index 30d7c8f..4977931 100644 --- a/quickstart/1-browser-to-browser/package.json +++ b/quickstart/1-browser-to-browser/package.json @@ -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" diff --git a/quickstart/1-browser-to-browser/src/_aqua/getting-started.ts b/quickstart/1-browser-to-browser/src/_aqua/getting-started.ts index a9f3e55..edab4aa 100644 --- a/quickstart/1-browser-to-browser/src/_aqua/getting-started.ts +++ b/quickstart/1-browser-to-browser/src/_aqua/getting-started.ts @@ -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'; diff --git a/quickstart/3-browser-to-service/package-lock.json b/quickstart/3-browser-to-service/package-lock.json index 441e2ef..21365f7 100644 --- a/quickstart/3-browser-to-service/package-lock.json +++ b/quickstart/3-browser-to-service/package-lock.json @@ -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" diff --git a/quickstart/3-browser-to-service/package.json b/quickstart/3-browser-to-service/package.json index 30d7c8f..4977931 100644 --- a/quickstart/3-browser-to-service/package.json +++ b/quickstart/3-browser-to-service/package.json @@ -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" diff --git a/quickstart/3-browser-to-service/src/_aqua/getting-started.ts b/quickstart/3-browser-to-service/src/_aqua/getting-started.ts index 0624fc9..6c2b678 100644 --- a/quickstart/3-browser-to-service/src/_aqua/getting-started.ts +++ b/quickstart/3-browser-to-service/src/_aqua/getting-started.ts @@ -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; + hello: (message: string, callParams: CallParams<'message'>) => string | Promise; } 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; -export function sayHello( - peer: FluencePeer, - targetPeerId: string, - targetRelayPeerId: string, - config?: { ttl?: number } -): Promise; +export function sayHello(targetPeerId: string, targetRelayPeerId: string, config?: {ttl?: number}): Promise; +export function sayHello(peer: FluencePeer, targetPeerId: string, targetRelayPeerId: string, config?: {ttl?: number}): Promise; 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 + ) }