Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump the dependencies #347

Open
wants to merge 3 commits into
base: v4.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,870 changes: 3,381 additions & 2,489 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,21 @@
"node": ">=6.0.0"
},
"dependencies": {
"crc": "3.4.0",
"debug": "^3.1.0"
"crc": "4.3.2",
"debug": "^4.3.7"
},
"devDependencies": {
"@types/crc": "^3.4.0",
"@types/debug": "^4.1.4",
"@types/mocha": "^5.2.7",
"@types/node": "^12.0.10",
"@types/serialport": "^7.0.4",
"commander": "^3.0.2",
"mocha": "^3.3.0",
"nyc": "^13.1.0",
"serialport": "^7.1.5",
"sinon": "2.2.0",
"tslint": "^5.20.0",
"tslint-config-standard": "^8.0.1",
"typescript": "^3.5.2"
"@types/debug": "^4.1.12",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.1",
"commander": "^12.1.0",
"mocha": "^10.8.2",
"nyc": "^17.1.0",
"serialport": "^12.0.0",
"sinon": "19.0.2",
"tslint": "^6.1.3",
"tslint-config-standard": "^9.0.0",
"typescript": "^5.7.2"
},
"scripts": {
"test": "npm run lint && npm run build && npx mocha test/*.test.js",
Expand Down
2 changes: 1 addition & 1 deletion src/constants/primatives.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type Byte = number
export type BooleanArray = Array<boolean | 0 | 1 | number>
export type BooleanArray = (boolean | 0 | 1 | number)[]
4 changes: 1 addition & 3 deletions src/modbus-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ import {
} from './request'

import ModbusAbstractRequest from './abstract-request.js'
import ModbusAbstractResponse from './abstract-response.js'
import MBClientRequestHandler from './client-request-handler.js'
import MBClientResponseHandler from './client-response-handler.js'
import { UserRequestError } from './errors'
import { CastRequestBody } from './request-response-map'
import { WriteMultipleCoilsResponseBody } from './response'
import { PromiseUserRequest } from './user-request.js'

/** Common Modbus Client
Expand Down Expand Up @@ -249,7 +247,7 @@ export default abstract class MBClient<S extends Stream.Duplex, Req extends Modb
if (values instanceof Buffer) {
request = new WriteMultipleCoilsRequestBody(start, values, quantity)
} else {
request = new WriteMultipleCoilsRequestBody(start, values)
request = new WriteMultipleCoilsRequestBody(start, values as boolean[])
}

} catch (e) {
Expand Down
3 changes: 1 addition & 2 deletions src/modbus-rtu-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import MBClient from './modbus-client.js'
import ModbusRTUClientRequestHandler from './rtu-client-request-handler.js'
import ModbusRTUClientResponseHandler from './rtu-client-response-handler.js'

import * as SerialPort from 'serialport'
import { SerialPort } from 'serialport'
import ModbusRTURequest from './rtu-request.js'
import ModbusRTUResponse from './rtu-response.js'

/** This Client musst be initiated with a socket object that implements the event emitter
* interface and fires a 'data' event with a buffer as a parameter. It also needs to
Expand Down
2 changes: 1 addition & 1 deletion src/modbus-rtu-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ModbusServer, { IModbusServerOptions } from './modbus-server.js'
import ModbusRTURequest from './rtu-request.js'
import ModbusRTUResponse from './rtu-response.js'

import * as SerialPort from 'serialport'
import { SerialPort } from 'serialport'

export default class ModbusRTUServer extends ModbusServer {
public _socket: any
Expand Down
8 changes: 4 additions & 4 deletions src/rtu-client-request-handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import Debug = require('debug'); const debug = Debug('rtu-client-request-handler')
import CRC from 'crc'
import * as SerialSocket from 'serialport'
import { SerialPort } from 'serialport'
import MBClientRequestHandler from './client-request-handler.js'
import ModbusRequestBody from './request/request-body.js'
import ModbusRTURequest from './rtu-request.js'
Expand All @@ -14,8 +14,8 @@ import UserRequest from './user-request.js'
* @extends MBClientRequestHandler
* @class
*/
export default class ModbusRTUClientRequestHandler extends MBClientRequestHandler<SerialSocket, ModbusRTURequest> {
protected _requests: Array<UserRequest<ModbusRTURequest>>
export default class ModbusRTUClientRequestHandler extends MBClientRequestHandler<SerialPort, ModbusRTURequest> {
protected _requests: UserRequest<ModbusRTURequest>[]
protected _currentRequest: UserRequest<ModbusRTURequest> | null | undefined
protected readonly _address: number

Expand All @@ -26,7 +26,7 @@ export default class ModbusRTUClientRequestHandler extends MBClientRequestHandle
* @param {number} [timeout=5000]
* @memberof ModbusRTUClientRequestHandler
*/
constructor (socket: SerialSocket, address: number, timeout: number = 5000) {
constructor (socket: SerialPort, address: number, timeout: number = 5000) {
super(socket, timeout)
this._address = address
this._requests = []
Expand Down
2 changes: 1 addition & 1 deletion src/tcp-client-request-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const PROTOCOL = 'Protocol'
* @class
*/
export default class ModbusTCPClientRequestHandler extends MBClientRequestHandler<Socket, ModbusTCPRequest> {
protected _requests: Array<UserRequest<ModbusTCPRequest>>
protected _requests: UserRequest<ModbusTCPRequest>[]
protected _currentRequest: UserRequest<ModbusTCPRequest> | null | undefined
private _requestId: number
private _unitId: number
Expand Down