Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@etclabscore/jade-service-runner-client

Package Overview
Dependencies
Maintainers
4
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etclabscore/jade-service-runner-client - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

28

build/index.d.ts

@@ -54,2 +54,3 @@ import { Client } from "@open-rpc/client-js";

port: number;
path?: string;
};

@@ -63,4 +64,31 @@ }

/**
* Initiates [[ServiceRunner.startBatch]] in order to build a batch call.
*
* Subsequent calls to [[ServiceRunner.request]] will be added to the batch.
* Once [[ServiceRunner.stopBatch]] is called, the promises for the [[ServiceRunner.request]]
* will then be resolved. If there is already a batch in progress this method is a noop.
*
* @example
* myClient.startBatch();
* myClient.foo().then(() => console.log("foobar"))
* myClient.bar().then(() => console.log("foobarbaz"))
* myClient.stopBatch();
*/
startBatch(): void;
/**
* Initiates [[Client.stopBatch]] in order to finalize and send the batch to the underlying transport.
*
* stopBatch will send the [[ServiceRunner]] calls made since the last [[ServiceRunner.startBatch]] call. For
* that reason, [[ServiceRunner.startBatch]] MUST be called before [[ServiceRunner.stopBatch]].
*
* @example
* myClient.startBatch();
* myClient.foo().then(() => console.log("foobar"))
* myClient.bar().then(() => console.log("foobarbaz"))
* myClient.stopBatch();
*/
stopBatch(): void;
/**
*
*/
installService: InstallService;

@@ -67,0 +95,0 @@ /**

44

build/index.js

@@ -36,14 +36,19 @@ "use strict";

};
this.openrpcDocument = { "info": { "title": "ServiceRunner", "version": "1.1.2" }, "methods": [{ "name": "installService", "params": [{ "name": "serviceName", "schema": { "type": "string" }, "required": true }, { "name": "version", "schema": { "type": "string" }, "required": true }], "result": { "name": "installSuccess", "schema": { "type": "boolean" } } }, { "name": "listInstalledServices", "params": [], "result": { "name": "installedServices", "schema": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "version": { "type": "string" } } } } } }, { "name": "listRunningServices", "params": [], "result": { "name": "runningServices", "schema": { "type": "array", "items": { "description": "An object that describes an instance of a service", "type": "object", "properties": { "env": { "type": "string" }, "rpcPort": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" }, "path": { "type": "string" }, "commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "args": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "state": { "type": "string" } }, "required": ["env", "rpcPort", "name", "version", "path", "commands", "args", "running"] } } } }, { "name": "startService", "params": [{ "name": "name", "schema": { "type": "string" }, "required": true }, { "name": "version", "schema": { "type": "string" }, "required": true }, { "name": "environment", "schema": { "type": "string" }, "required": true }], "result": { "name": "serviceConfig", "schema": { "description": "An object that describes an instance of a service", "type": "object", "properties": { "env": { "type": "string" }, "rpcPort": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" }, "path": { "type": "string" }, "commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "args": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "state": { "type": "string" } }, "required": ["env", "rpcPort", "name", "version", "path", "commands", "args", "running"] }, "required": true } }], "components": { "schemas": { "StringArray": { "type": "array", "items": { "type": "string" } }, "SeqCommand": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] }, "EnvArgs": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "Commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "Service": { "description": "An object that describes an instance of a service", "type": "object", "properties": { "env": { "type": "string" }, "rpcPort": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" }, "path": { "type": "string" }, "commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "args": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "state": { "type": "string" } }, "required": ["env", "rpcPort", "name", "version", "path", "commands", "args", "running"] } } }, "openrpc": "1.0.0-rc0" };
this.openrpcDocument = { "info": { "title": "ServiceRunner", "version": "1.2.0" }, "methods": [{ "name": "installService", "params": [{ "name": "serviceName", "schema": { "type": "string" }, "required": true }, { "name": "version", "schema": { "type": "string" }, "required": true }], "result": { "name": "installSuccess", "schema": { "type": "boolean" } } }, { "name": "listInstalledServices", "params": [], "result": { "name": "installedServices", "schema": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "version": { "type": "string" } } } } } }, { "name": "listRunningServices", "params": [], "result": { "name": "runningServices", "schema": { "type": "array", "items": { "description": "An object that describes an instance of a service", "type": "object", "properties": { "env": { "type": "string" }, "rpcPort": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" }, "path": { "type": "string" }, "commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "args": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "state": { "type": "string" } }, "required": ["env", "rpcPort", "name", "version", "path", "commands", "args", "running"] } } } }, { "name": "startService", "params": [{ "name": "name", "schema": { "type": "string" }, "required": true }, { "name": "version", "schema": { "type": "string" }, "required": true }, { "name": "environment", "schema": { "type": "string" }, "required": true }], "result": { "name": "serviceConfig", "schema": { "description": "An object that describes an instance of a service", "type": "object", "properties": { "env": { "type": "string" }, "rpcPort": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" }, "path": { "type": "string" }, "commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "args": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "state": { "type": "string" } }, "required": ["env", "rpcPort", "name", "version", "path", "commands", "args", "running"] }, "required": true } }], "components": { "schemas": { "StringArray": { "type": "array", "items": { "type": "string" } }, "SeqCommand": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] }, "EnvArgs": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "Commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "Service": { "description": "An object that describes an instance of a service", "type": "object", "properties": { "env": { "type": "string" }, "rpcPort": { "type": "string" }, "name": { "type": "string" }, "version": { "type": "string" }, "path": { "type": "string" }, "commands": { "type": "object", "properties": { "setup": { "type": "array", "items": { "type": "object", "properties": { "cmd": { "type": "string" }, "args": { "type": "array", "items": { "type": "string" } } }, "required": ["cmd", "args"] } }, "start": { "type": "string" }, "stop": { "type": "string" }, "teardown": { "type": "string" } }, "required": ["setup", "start", "stop", "teardown"] }, "args": { "type": "object", "properties": { "start": { "type": "array", "items": { "type": "string" } }, "stop": { "type": "array", "items": { "type": "string" } }, "teardown": { "type": "array", "items": { "type": "string" } } }, "required": ["start", "stop", "teardown"] }, "state": { "type": "string" } }, "required": ["env", "rpcPort", "name", "version", "path", "commands", "args", "running"] } } }, "openrpc": "1.0.0-rc0" };
if (options.transport === undefined || options.transport.type === undefined) {
throw new Error("Invalid constructor params");
}
const { type, host, port } = options.transport;
let path = options.transport.path || "";
if (path && path[0] !== "/") {
path = "/" + path;
}
let transport;
switch (options.transport.type) {
switch (type) {
case "http":
case "https":
transport = new client_js_1.HTTPTransport(options.transport.type + "://" + options.transport.host + ":" + options.transport.port);
transport = new client_js_1.HTTPTransport(type + "://" + host + ":" + port + path);
break;
case "websocket":
transport = new client_js_1.WebSocketTransport("ws://" + options.transport.host + ":" + options.transport.port);
transport = new client_js_1.WebSocketTransport("ws://" + host + ":" + port + path);
break;

@@ -57,2 +62,33 @@ default:

}
/**
* Initiates [[ServiceRunner.startBatch]] in order to build a batch call.
*
* Subsequent calls to [[ServiceRunner.request]] will be added to the batch.
* Once [[ServiceRunner.stopBatch]] is called, the promises for the [[ServiceRunner.request]]
* will then be resolved. If there is already a batch in progress this method is a noop.
*
* @example
* myClient.startBatch();
* myClient.foo().then(() => console.log("foobar"))
* myClient.bar().then(() => console.log("foobarbaz"))
* myClient.stopBatch();
*/
startBatch() {
return this.rpc.startBatch();
}
/**
* Initiates [[Client.stopBatch]] in order to finalize and send the batch to the underlying transport.
*
* stopBatch will send the [[ServiceRunner]] calls made since the last [[ServiceRunner.startBatch]] call. For
* that reason, [[ServiceRunner.startBatch]] MUST be called before [[ServiceRunner.stopBatch]].
*
* @example
* myClient.startBatch();
* myClient.foo().then(() => console.log("foobar"))
* myClient.bar().then(() => console.log("foobarbaz"))
* myClient.stopBatch();
*/
stopBatch() {
return this.rpc.stopBatch();
}
request(methodName, params) {

@@ -59,0 +95,0 @@ const methodObject = lodash_1.default.find(this.openrpcDocument.methods, ({ name }) => name === methodName);

14

package.json
{
"name": "@etclabscore/jade-service-runner-client",
"version": "1.1.2",
"version": "1.2.0",
"description": "",

@@ -14,16 +14,16 @@ "main": "build/index.js",

"author": "",
"license": "ISC",
"license": "Apache-2.0",
"dependencies": {
"@open-rpc/client-js": "^1.0.1",
"@open-rpc/client-js": "^1.1.0",
"@open-rpc/meta-schema": "^1.3.1",
"@open-rpc/schema-utils-js": "^1.10.2",
"lodash": "4.17.11"
"lodash": "^4.17.15"
},
"devDependencies": {
"typescript": "^3.2.4",
"@types/json-schema": "7.0.3",
"@types/ws": "^6.0.1",
"@types/json-schema": "7.0.3",
"tslint": "^5.13.1",
"typedoc": "^0.14.2"
"typedoc": "^0.15.0",
"typescript": "^3.2.4"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc