Add Robot_JoyIt driver

This commit is contained in:
2026-01-17 16:50:07 +01:00
parent e9e50acf5f
commit 0cfb4d5a95
15848 changed files with 570836 additions and 268976 deletions

8
node_modules/jayson/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/node_modules
.*
!.gitignore
!.travis.yml
!.jshintrc
!.npmignore
/coverage
/yarn-error.log

7
node_modules/jayson/README.md generated vendored
View File

@@ -655,6 +655,8 @@ Passing a property named `router` in the server options will enable you to write
Server example with custom routing logic in [examples/method_routing/server.js](examples/method_routing/server.js):
**Note:** You are strongly recommended to check method names using `Object.prototype.hasOwnProperty` to prevent a denial-of-service attack against your Jayson server when names such as `__defineGetter__` are used in JSON-RPC calls.
```javascript
const jayson = require('jayson');
@@ -667,7 +669,10 @@ const methods = {
const server = new jayson.Server(methods, {
router: function(method, params) {
// regular by-name routing first
if(typeof(this._methods[method]) === 'function') return this._methods[method];
const fn = Object.prototype.hasOwnProperty.call(this._methods, method) ? this._methods[method] : null;
if(typeof fn === 'function') {
return fn;
}
if(method === 'add_2') {
const fn = server.getMethod('add').getHandler();
return new jayson.Method(function(args, done) {

0
node_modules/jayson/bin/jayson.js generated vendored Normal file → Executable file
View File

29
node_modules/jayson/index.d.ts generated vendored
View File

@@ -32,9 +32,9 @@ export declare class Utils {
static request(method: string, params: RequestParamsLike, options?: GenerateRequestOptions): JSONRPCRequest;
static request(method: string, params: RequestParamsLike, id?: JSONRPCIDLike | null | undefined, options?: GenerateRequestOptions): JSONRPCRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version?: number): JSONRPCVersionTwoRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:2): JSONRPCVersionTwoRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:1): JSONRPCVersionOneRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version?: number): JSONRPCVersionTwoResponse;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:2): JSONRPCVersionTwoResponse;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:1): JSONRPCVersionOneResponse;
static generateId(): string;
@@ -52,6 +52,16 @@ export declare class Utils {
static walk(obj:object, key:string, fn: (key:string, value:any) => any): object;
static once<T extends (...args: any[]) => any>(fn: T): T;
static isPlainObject(obj: any): boolean;
static toArray(obj: any): Array<any>;
static toPlainObject(obj: any): object;
static pick(obj: object, keys: string[]): object;
static JSON: UtilsJSON;
static Request: UtilsRequest;
@@ -349,16 +359,27 @@ declare class WebsocketClient extends Client {
constructor(options?: WebsocketClientOptions);
}
export type BrowserClientCallServerCallback = (err?: Error | null, response?: string) => void;
export type BrowserClientCallServerFunction = (request: string, callback: BrowserClientCallServerCallback) => void;
declare class BrowserClient {
constructor(callServer: BrowserClientCallServerFunction, options?: ClientOptions);
request(method: string, params: RequestParamsLike, id?: JSONRPCIDLike | null, callback?: JSONRPCCallbackType): JSONRPCRequest;
request(method: string, params: RequestParamsLike, callback?: JSONRPCCallbackType): JSONRPCRequest;
request(method: Array<JSONRPCRequestLike>, callback: JSONRPCCallbackTypeBatch): Array<JSONRPCRequest>;
}
type ClientConstructor = ConstructorOf<Client, [options: ClientOptions] | [server: Server, options?: ClientOptions]> & {
http(options?: HttpClientOptions): HttpClient;
https(options?: HttpsClientOptions): HttpsClient;
tcp(options?: TcpClientOptions): TcpClient;
tls(options?: TlsClientOptions): TlsClient;
websocket(options?: WebsocketClientOptions): WebsocketClient;
browser(callServer: BrowserClientCallServerFunction, options?: ClientOptions): BrowserClient;
}
export interface Client extends events.EventEmitter {
request(method: string, params: RequestParamsLike, id?: string | null, callback?: JSONRPCCallbackType): JSONRPCRequest;
request(method: string, params: RequestParamsLike, id?: JSONRPCIDLike | null, callback?: JSONRPCCallbackType): JSONRPCRequest;
request(method: string, params: RequestParamsLike, callback?: JSONRPCCallbackType): JSONRPCRequest;
request(method: Array<JSONRPCRequestLike>, callback: JSONRPCCallbackTypeBatch): Array<JSONRPCRequest>;
}

View File

@@ -5,8 +5,8 @@ type ClientBrowserCallServerFunctionCallback = (err?:Error | null, response?:str
type ClientBrowserCallServerFunction = (request:string, callback:ClientBrowserCallServerFunctionCallback) => void;
declare class ClientBrowser {
constructor(callServer:ClientBrowserCallServerFunction, options:jayson.ClientOptions);
request(method: string, params: jayson.RequestParamsLike, id?: string | null, callback?: jayson.JSONRPCCallbackType): jayson.JSONRPCRequest;
constructor(callServer:ClientBrowserCallServerFunction, options?:jayson.ClientOptions);
request(method: string, params: jayson.RequestParamsLike, id?: jayson.JSONRPCIDLike | null, callback?: jayson.JSONRPCCallbackType): jayson.JSONRPCRequest;
request(method: string, params: jayson.RequestParamsLike, callback?: jayson.JSONRPCCallbackType): jayson.JSONRPCRequest;
request(method: Array<jayson.JSONRPCRequestLike>, callback: jayson.JSONRPCCallbackTypeBatch): Array<jayson.JSONRPCRequest>;
}

View File

@@ -80,7 +80,8 @@ ClientBrowser.prototype.request = function(method, params, id, callback) {
});
} catch(err) {
if(hasCallback) {
return callback(err);
callback(err);
return;
}
throw err;
}
@@ -96,7 +97,8 @@ ClientBrowser.prototype.request = function(method, params, id, callback) {
try {
message = JSON.stringify(request, this.options.replacer);
} catch(err) {
return callback(err);
callback(err);
return;
}
this.callServer(message, function(err, response) {
@@ -123,14 +125,16 @@ ClientBrowser.prototype._parseResponse = function(err, responseText, callback) {
if(!responseText) {
// empty response text, assume that is correct because it could be a
// notification which jayson does not give any body for
return callback();
callback();
return;
}
let response;
try {
response = JSON.parse(responseText, this.options.reviver);
} catch(err) {
return callback(err);
callback(err);
return;
}
if(callback.length === 3) {
@@ -139,7 +143,7 @@ ClientBrowser.prototype._parseResponse = function(err, responseText, callback) {
// is batch response?
if(Array.isArray(response)) {
// neccesary to split strictly on validity according to spec here
// necessary to split strictly on validity according to spec here
const isError = function(res) {
return typeof res.error !== 'undefined';
};
@@ -148,13 +152,13 @@ ClientBrowser.prototype._parseResponse = function(err, responseText, callback) {
return !isError(res);
};
return callback(null, response.filter(isError), response.filter(isNotError));
callback(null, response.filter(isError), response.filter(isNotError));
return;
} else {
// split regardless of validity
return callback(null, response.error, response.result);
callback(null, response.error, response.result);
return;
}
}

View File

@@ -43,7 +43,8 @@ ClientHttp.prototype._request = function(request, callback) {
utils.JSON.stringify(request, options, function(err, body) {
if(err) {
return callback(err);
callback(err);
return;
}
options.method = options.method || 'POST';
@@ -81,7 +82,8 @@ ClientHttp.prototype._request = function(request, callback) {
} else {
// empty reply
if(!data || typeof(data) !== 'string') {
return callback();
callback();
return;
}
utils.JSON.parse(data, options, callback);
}

View File

@@ -187,11 +187,13 @@ Client.prototype._request = function(request, callback) {
*/
Client.prototype._parseResponse = function(err, response, callback) {
if(err) {
return callback(err);
callback(err);
return;
}
if(!response || typeof(response) !== 'object') {
return callback();
callback();
return;
}
if(callback.length === 3) {
@@ -200,21 +202,20 @@ Client.prototype._parseResponse = function(err, response, callback) {
// is batch response?
if(Array.isArray(response)) {
// neccesary to split strictly on validity according to spec here
// necessary to split strictly on validity according to spec here
const isError = function(res) { return typeof(res.error) !== 'undefined'; };
const isNotError = function(res) { return !isError(res); };
return callback(null, response.filter(isError), response.filter(isNotError));
callback(null, response.filter(isError), response.filter(isNotError));
return;
} else {
// split regardless of validity
return callback(null, response.error, response.result);
callback(null, response.error, response.result);
return;
}
}
return callback(null, response);
callback(null, response);
};

View File

@@ -41,7 +41,8 @@ ClientTcp.prototype._request = function(request, callback) {
utils.JSON.stringify(request, options, function(err, body) {
if(err) {
return callback(err);
callback(err);
return;
}
let handled = false;
@@ -63,7 +64,8 @@ ClientTcp.prototype._request = function(request, callback) {
handled = true;
conn.end();
if(err) {
return callback(err);
callback(err);
return;
}
callback(null, response);
});

View File

@@ -40,7 +40,8 @@ ClientTls.prototype._request = function(request, callback) {
utils.JSON.stringify(request, options, function(err, body) {
if(err) {
return callback(err);
callback(err);
return;
}
let handled = false;
@@ -62,7 +63,8 @@ ClientTls.prototype._request = function(request, callback) {
handled = true;
conn.end();
if(err) {
return callback(err);
callback(err);
return;
}
callback(null, response);
});

View File

@@ -190,7 +190,9 @@ Server.prototype.removeMethod = function(name) {
* @return {Method}
*/
Server.prototype.getMethod = function(name) {
return this._methods[name];
if (Object.prototype.hasOwnProperty.call(this._methods, name)) {
return this._methods[name];
}
};
/**
@@ -420,7 +422,8 @@ Server.prototype._batch = function(requests, context, callback) {
// only notifications in request means empty response
if(!filtered.length) {
return callback();
callback();
return;
}
callback(null, filtered);
}

28
node_modules/jayson/lib/utils.js generated vendored
View File

@@ -1,6 +1,7 @@
'use strict';
const JSONStream = require('JSONStream');
const StreamValues = require('stream-json/streamers/StreamValues');
const Verifier = require('stream-json/utils/Verifier');
const JSONstringify = require('json-stringify-safe');
const uuid = require('uuid').v4;
@@ -64,19 +65,20 @@ Utils.merge = function(...args) {
};
/**
* Parses an incoming stream for requests using JSONStream
* Parses an incoming stream for requests using stream-json
* @param {Stream} stream
* @param {Object} options
* @param {Function} onRequest Called once for stream errors and an unlimited amount of times for valid requests
*/
Utils.parseStream = function(stream, options, onRequest) {
const onError = Utils.once(onRequest);
const onSuccess = (...args) => onRequest(null, ...args);
const result = JSONStream.parse();
const verifier = new Verifier({jsonStreaming: true});
const parser = StreamValues.withParser();
result.on('data', function(data) {
parser.on('data', function(obj) {
let data = obj.value;
// apply reviver walk function to prevent stringify/parse again
if(typeof options.reviver === 'function') {
@@ -86,11 +88,12 @@ Utils.parseStream = function(stream, options, onRequest) {
onSuccess(data);
});
result.on('error', onError);
parser.on('error', onError);
verifier.on('error', onError);
stream.on('error', onError);
stream.pipe(result);
stream.pipe(verifier);
stream.pipe(parser);
};
/**
@@ -182,7 +185,8 @@ Utils.parseBody = function(stream, options, callback) {
stream.on('end', function() {
utils.JSON.parse(data, options, function(err, request) {
if(err) {
return callback(err);
callback(err);
return;
}
callback(null, request);
});
@@ -322,7 +326,8 @@ Utils.JSON.parse = function(str, options, callback) {
try {
obj = JSON.parse.apply(JSON, [str, reviver].filter(v => v));
} catch(err) {
return callback(err);
callback(err);
return;
}
callback(null, obj);
@@ -346,7 +351,8 @@ Utils.JSON.stringify = function(obj, options, callback) {
try {
str = JSONstringify.apply(JSON, [obj, replacer].filter(v => v));
} catch(err) {
return callback(err);
callback(err);
return;
}
callback(null, str);

View File

@@ -210,12 +210,14 @@ class WebSocketServer extends EventEmitter {
req.headers['sec-websocket-key'] !== undefined
? req.headers['sec-websocket-key'].trim()
: false;
const upgrade = req.headers.upgrade;
const version = +req.headers['sec-websocket-version'];
const extensions = {};
if (
req.method !== 'GET' ||
req.headers.upgrade.toLowerCase() !== 'websocket' ||
upgrade === undefined ||
upgrade.toLowerCase() !== 'websocket' ||
!key ||
!keyRegex.test(key) ||
(version !== 8 && version !== 13) ||

View File

@@ -799,7 +799,9 @@ function initAsClient(websocket, address, protocols, options) {
req = websocket._req = null;
if (res.headers.upgrade.toLowerCase() !== 'websocket') {
const upgrade = res.headers.upgrade;
if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {
abortHandshake(websocket, socket, 'Invalid Upgrade header');
return;
}

View File

@@ -1,6 +1,6 @@
{
"name": "ws",
"version": "7.5.9",
"version": "7.5.10",
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
"keywords": [
"HyBi",

25
node_modules/jayson/package.json generated vendored
View File

@@ -1,6 +1,6 @@
{
"name": "jayson",
"version": "4.1.0",
"version": "4.3.0",
"description": "JSON-RPC 1.0/2.0 compliant server and client",
"license": "MIT",
"keywords": [
@@ -23,7 +23,9 @@
"api"
],
"author": "Tedde Lundgren <mail@tedeh.net> (https://tedeh.net)",
"maintainers": "Tedde Lundgren <mail@tedeh.net> (https://tedeh.net)",
"maintainers": [
"Tedde Lundgren <mail@tedeh.net> (https://tedeh.net)"
],
"bin": "./bin/jayson.js",
"repository": {
"type": "git",
@@ -41,11 +43,8 @@
"test-ci": "mocha -w -R min",
"test-tsc": "tsc --strict --lib es6 --esModuleInterop typescript/test.ts",
"coverage": "nyc mocha",
"coveralls": "mocha && nyc report --reporter=text-lcov | coveralls",
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"docs": "jsdoc -t node_modules/ink-docstrap/template -R README.md -c ./jsdoc.conf.json",
"docs_clear": "rm -rf ./docs/jayson/*; exit 0",
"docs_refresh": "npm run docs_clear && npm run docs",
"docs_deploy": "rsync --delete -r docs/jayson/* tedeh.net:/var/www/jayson.tedeh.net; exit 0",
"lint": "jshint lib/*.js lib/**/*.js promise/*.js promise/**/*.js; exit 0"
},
"dependencies": {
@@ -58,23 +57,24 @@
"eyes": "^0.1.8",
"isomorphic-ws": "^4.0.1",
"json-stringify-safe": "^5.0.1",
"JSONStream": "^1.3.5",
"stream-json": "^1.9.1",
"uuid": "^8.3.2",
"ws": "^7.4.5"
"ws": "^7.5.10"
},
"devDependencies": {
"@types/express-serve-static-core": "^4.17.30",
"body-parser": "^1.19.0",
"connect": "^3.7.0",
"coveralls": "^3.1.0",
"coveralls-next": "^6.0.1",
"es6-promise": "^4.2.8",
"express": "^4.17.1",
"ink-docstrap": "github:docstrap/docstrap#pull/345/head",
"jsdoc": "^4.0.2",
"jshint": "^2.12.0",
"mocha": "^10.2.0",
"node-fetch": "^2.6.7",
"nyc": "^14.1.1",
"mocha-lcov-reporter": "^1.3.0",
"node-fetch": "^2.7.0",
"nyc": "^17.1.0",
"pass-stream": "^1.0.0",
"should": "^13.2.3",
"superagent": "^3.8.3",
@@ -82,5 +82,6 @@
},
"engines": {
"node": ">=8"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

View File

@@ -32,9 +32,9 @@ export declare class Utils {
static request(method: string, params: RequestParamsLike, options?: GenerateRequestOptions): JSONRPCRequest;
static request(method: string, params: RequestParamsLike, id?: JSONRPCIDLike | null | undefined, options?: GenerateRequestOptions): JSONRPCRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version?: number): JSONRPCVersionTwoRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:2): JSONRPCVersionTwoRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:1): JSONRPCVersionOneRequest;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version?: number): JSONRPCVersionTwoResponse;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:2): JSONRPCVersionTwoResponse;
static response(error: JSONRPCError | undefined | null, result: JSONRPCResultLike | undefined | null, id: JSONRPCIDLike | null | undefined, version:1): JSONRPCVersionOneResponse;
static generateId(): string;
@@ -52,6 +52,16 @@ export declare class Utils {
static walk(obj:object, key:string, fn: (key:string, value:any) => any): object;
static once<T extends (...args: any[]) => any>(fn: T): T;
static isPlainObject(obj: any): boolean;
static toArray(obj: any): Array<any>;
static toPlainObject(obj: any): object;
static pick(obj: object, keys: string[]): object;
static JSON: UtilsJSON;
static Request: UtilsRequest;
@@ -225,12 +235,16 @@ export type ServerCallCallbackType = {
export interface MethodMap { [methodName:string]: Method }
type ServerConstructor = ConstructorOf<Server, [methods?: { [methodName: string]: MethodLike }, options?: ServerOptions]> & {
_methods: MethodMap;
options: ServerOptions;
errors: {[errorName: string]: number};
errorMessages: {[errorMessage: string]: string};
interfaces: {[interfaces: string]: Function};
}
export interface Server extends events.EventEmitter {
_methods: MethodMap;
options: ServerOptions;
errorMessages: {[errorMessage: string]: string};
http(options?: HttpServerOptions): HttpServer;
https(options?: HttpsServerOptions): HttpsServer;
tcp(options?: TcpServerOptions): TcpServer;
@@ -346,12 +360,22 @@ declare class WebsocketClient extends Client {
constructor(options?: WebsocketClientOptions);
}
export type BrowserClientCallServerFunction = (request: string) => Promise<string>;
declare class BrowserClient {
constructor(callServer: BrowserClientCallServerFunction, options?: ClientOptions);
request(method: string, params: RequestParamsLike, id: JSONRPCIDLike | undefined, shouldCall: false): JSONRPCRequest;
request(method: string, params: RequestParamsLike, id?: JSONRPCIDLike): Promise<JSONRPCResultLike>;
request(method: Array<JSONRPCRequestLike>): Promise<JSONRPCResultLike>;
}
type ClientConstructor = ConstructorOf<Client, [options: ClientOptions] | [server: Server, options?: ClientOptions]> & {
http(options?: HttpClientOptions): HttpClient;
https(options?: HttpsClientOptions): HttpsClient;
tcp(options?: TcpClientOptions): TcpClient;
tls(options?: TlsClientOptions): TlsClient;
websocket(options?: WebsocketClientOptions): WebsocketClient;
browser(callServer: BrowserClientCallServerFunction, options?: ClientOptions): BrowserClient;
}
export interface Client extends events.EventEmitter {

View File

@@ -3,7 +3,7 @@ import * as jayson from '../../../..';
type PromiseClientBrowserCallServerFunction = (request:string) => Promise<string>;
declare class PromiseClientBrowser {
constructor(callServer:PromiseClientBrowserCallServerFunction, options:jayson.ClientOptions);
constructor(callServer:PromiseClientBrowserCallServerFunction, options?:jayson.ClientOptions);
request(method:string, params:jayson.RequestParamsLike, id:jayson.JSONRPCIDLike | undefined, shouldCall:false): jayson.JSONRPCRequest;
request(method:string, params:jayson.RequestParamsLike, id?:jayson.JSONRPCIDLike): Promise<jayson.JSONRPCResultLike>;
request(method: Array<jayson.JSONRPCRequestLike>): Promise<jayson.JSONRPCResultLike>;