Socket
Socket
Sign inDemoInstall

jsmodbus

Package Overview
Dependencies
3
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.6 to 4.0.10

2

dist/client-request-handler.d.ts

@@ -24,3 +24,3 @@ /// <reference types="node" />

manuallylRejectAllRequests(): void;
customErrorRequest(err: UserRequestError<any>): void;
customErrorRequest(err: UserRequestError<any, any>): void;
protected _clearCurrentRequest(): void;

@@ -27,0 +27,0 @@ protected _clearAllRequests(): void;

@@ -52,3 +52,4 @@ "use strict";

err: OUT_OF_SYNC,
message: 'request fc and response fc does not match.'
message: 'request fc and response fc does not match.',
request
}));

@@ -63,2 +64,3 @@ this._clearAllRequests();

message: `A Modbus Exception Occurred - See Response Body`,
request,
response

@@ -79,3 +81,4 @@ }));

err: MANUALLY_CLEARED,
message: 'the request was manually cleared'
message: 'the request was manually cleared',
request: this._currentRequest.request
}));

@@ -112,3 +115,4 @@ this._flush();

err: OUT_OF_SYNC,
message: 'rejecting because of earlier OutOfSync error'
message: 'rejecting because of earlier OutOfSync error',
request: req.request
}));

@@ -123,2 +127,7 @@ }

this._state = 'offline';
this._currentRequest && this._currentRequest.reject(new user_request_error_1.UserRequestError({
err: OFFLINE,
message: 'connection to modbus server closed',
request: this._currentRequest.request
}));
this._clearAllRequests();

@@ -141,3 +150,4 @@ }

err: OFFLINE,
message: 'no connection to modbus server'
message: 'no connection to modbus server',
request: this._currentRequest.request
}));

@@ -144,0 +154,0 @@ this._clearCurrentRequest();

@@ -31,5 +31,5 @@ /// <reference types="node" />

manuallyRejectCurrentRequest(): void;
customErrorRequest(err: UserRequestError<any>): void;
customErrorRequest(err: UserRequestError<any, any>): void;
private _onData;
}
//# sourceMappingURL=modbus-client.d.ts.map

@@ -62,2 +62,4 @@ import ModbusTCPClient from './modbus-tcp-client.js';

export { default as ModbusTCPResponse } from './tcp-response';
export { default as ModbusRTURequest } from './rtu-request';
export { default as ModbusRTUResponse } from './rtu-response';
export { UserRequestError } from './user-request-error';

@@ -64,0 +66,0 @@ export { default as UserRequest, ModbusRequest, IUserRequestResolve as UserRequestResolve, PromiseUserRequest } from './user-request';

@@ -54,2 +54,6 @@ "use strict";

exports.ModbusTCPResponse = tcp_response_1.default;
var rtu_request_1 = require("./rtu-request");
exports.ModbusRTURequest = rtu_request_1.default;
var rtu_response_1 = require("./rtu-response");
exports.ModbusRTUResponse = rtu_response_1.default;
var user_request_error_1 = require("./user-request-error");

@@ -56,0 +60,0 @@ exports.UserRequestError = user_request_error_1.UserRequestError;

@@ -45,3 +45,5 @@ "use strict";

err: 'crcMismatch',
message: 'the response payload does not match the crc'
message: 'the response payload does not match the crc',
request: userRequest.request,
response
}));

@@ -48,0 +50,0 @@ this._clearAllRequests();

@@ -43,3 +43,4 @@ "use strict";

err: OUT_OF_SYNC,
message: 'request fc and response fc does not match.'
message: 'request fc and response fc does not match.',
request
}));

@@ -53,3 +54,4 @@ this._clearAllRequests();

err: PROTOCOL,
message: 'Unknown protocol version ' + response.protocol
message: 'Unknown protocol version ' + response.protocol,
request
}));

@@ -56,0 +58,0 @@ this._clearAllRequests();

@@ -0,15 +1,18 @@

import ModbusAbstractRequest from './abstract-request';
import ModbusAbstractResponse from './abstract-response';
export declare type UserRequestErrorCodes = 'OutOfSync' | 'Protocol' | 'Timeout' | 'ManuallyCleared' | 'ModbusException' | 'Offline' | 'crcMismatch';
export interface IUserRequestError<Res extends ModbusAbstractResponse> {
export interface IUserRequestError<Res extends ModbusAbstractResponse, Req extends ModbusAbstractRequest> {
err: UserRequestErrorCodes;
message: string;
response?: Res;
request?: Req;
}
export declare class UserRequestError<Res extends ModbusAbstractResponse> implements IUserRequestError<Res> {
export declare class UserRequestError<Res extends ModbusAbstractResponse, Req extends ModbusAbstractRequest> implements IUserRequestError<Res, Req> {
err: UserRequestErrorCodes;
message: string;
request?: Req;
response?: Res;
constructor({ err, message, response }: IUserRequestError<Res>);
constructor({ err, message, response, request }: IUserRequestError<Res, Req>);
}
export declare function isUserRequestError(x: any): x is UserRequestError<any>;
export declare function isUserRequestError(x: any): x is UserRequestError<any, any>;
//# sourceMappingURL=user-request-error.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class UserRequestError {
constructor({ err, message, response }) {
constructor({ err, message, response, request }) {
this.err = err;
this.message = message;
this.request = request;
this.response = response;

@@ -8,0 +9,0 @@ }

@@ -20,3 +20,3 @@ /// <reference types="node" />

protected _resolve: (value: IUserRequestResolve<Req>) => void;
protected _reject: (err: UserRequestError<RequestToResponse<Req>>) => void;
protected _reject: (err: UserRequestError<RequestToResponse<Req>, Req>) => void;
protected _timer: NodeJS.Timeout;

@@ -33,4 +33,4 @@ protected _metrics: UserRequestMetrics;

resolve(response: RequestToResponse<Req>): void;
readonly reject: (err: UserRequestError<RequestToResponse<Req>>) => void;
readonly reject: (err: UserRequestError<RequestToResponse<Req>, Req>) => void;
}
//# sourceMappingURL=user-request.d.ts.map

@@ -26,3 +26,4 @@ "use strict";

err: 'Timeout',
message: 'Req timed out'
message: 'Req timed out',
request: this._request
}));

@@ -29,0 +30,0 @@ cb();

{
"name": "jsmodbus",
"version": "4.0.6",
"version": "4.0.10",
"description": "Implementation for the Serial/TCP Modbus protocol.",

@@ -38,7 +38,7 @@ "author": "Stefan Poeter <stefan.poeter@cloud-automation.de>",

"scripts": {
"test": "npm run lint && npm run build && mocha test/*.test.js",
"build": "tsc",
"lint": "tslint -c tslint.json 'src/**/*.ts'",
"lint:fix": "tslint -c tslint.json 'src/**/*.ts' --fix",
"watch": "npm run lint && npm run build && mocha --watch test/*.test.js",
"test": "npm run lint && npm run build && npx mocha test/*.test.js",
"build": "npx tsc",
"lint": "npx tslint -c tslint.json 'src/**/*.ts'",
"lint:fix": "npx tslint -c tslint.json 'src/**/*.ts' --fix",
"watch": "npm run lint && npm run build && npx mocha --watch test/*.test.js",
"prepublishOnly": "npm run test",

@@ -45,0 +45,0 @@ "prepare": "npm run build",

@@ -47,3 +47,3 @@ A simple an easy to use Modbus TCP client/server implementation.

const options = {
'host' : host
'host' : host,
'port' : port

@@ -50,0 +50,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc