From 2a93f48ee687740fef133952cb07a37d487b0c7e Mon Sep 17 00:00:00 2001 From: Francis Gulotta Date: Sat, 22 Jan 2022 15:55:03 -0500 Subject: [PATCH] feat: migrate to typescript (#3) This change migrates to typescript. The tests have been modified to conform to typescript and to cleanup cases when they weren't actually working (only one or two cases). I've defined the existing bindings interface for all platforms. There are changes I'd love to make but didn't here (update/set/get/getBaudRate etc are messy). This should in theory be a drop in for the existing bindings. If there are bugs I imagine they're type related not functionality. I dropped abstract bindings as having it a separate package didn't make sense during the refactor. I'd like to iterate on the design a bit more before returning to that class. Mockbinding may also now be drifted slightly from this package. I'll clean those inconsistencies up when I upgrade the main repo. --- .eslintrc | 61 - .eslintrc.js | 43 + .github/workflows/test.yml | 1 + .gitignore | 2 + .mocharc.js | 5 - .npmignore | 4 + lib/binding-interface.test.ts | 42 + lib/binding-interface.ts | 135 + ...st.js => bindings-win32-sn-parser.test.ts} | 18 +- lib/{bindings.test.js => bindings.test.ts} | 242 +- lib/darwin.js | 111 - lib/darwin.ts | 195 ++ lib/errors.ts | 7 + lib/index.js | 15 - lib/index.ts | 30 + lib/legacy.js | 26 - lib/linux-list.js | 100 - ...{linux-list.test.js => linux-list.test.ts} | 32 +- lib/linux-list.ts | 115 + lib/linux.js | 111 - lib/linux.ts | 205 ++ lib/load-bindings.ts | 17 + lib/missing-types.ts | 2 + lib/mocks/linux-list.js | 36 - lib/mocks/linux-list.ts | 27 + lib/node-gype-build.d.ts | 3 + lib/{poller.test.js => poller.test.ts} | 27 +- lib/{poller.js => poller.ts} | 61 +- lib/{unix-read.test.js => unix-read.test.ts} | 43 +- lib/{unix-read.js => unix-read.ts} | 48 +- ...{unix-write.test.js => unix-write.test.ts} | 32 +- lib/{unix-write.js => unix-write.ts} | 30 +- ...{win32-sn-parser.js => win32-sn-parser.ts} | 2 +- lib/win32.js | 124 - lib/win32.ts | 188 ++ package-lock.json | 2356 +++++++---------- package.json | 30 +- src/serialport.h | 15 +- test/assert.ts | 15 + test/{test-config.json => config.json} | 0 test/initializers/assert-reject.js | 9 - test/initializers/assert.js | 4 - test/initializers/index.js | 6 - test/initializers/test-config.js | 11 - test/makeTestFeature.ts | 43 + tsconfig-build.json | 13 + tsconfig.json | 23 + 47 files changed, 2280 insertions(+), 2385 deletions(-) delete mode 100644 .eslintrc create mode 100644 .eslintrc.js delete mode 100644 .mocharc.js create mode 100644 lib/binding-interface.test.ts create mode 100644 lib/binding-interface.ts rename lib/{bindings-win32-sn-parser.test.js => bindings-win32-sn-parser.test.ts} (76%) rename lib/{bindings.test.js => bindings.test.ts} (71%) delete mode 100644 lib/darwin.js create mode 100644 lib/darwin.ts create mode 100644 lib/errors.ts delete mode 100644 lib/index.js create mode 100644 lib/index.ts delete mode 100644 lib/legacy.js delete mode 100644 lib/linux-list.js rename lib/{linux-list.test.js => linux-list.test.ts} (81%) create mode 100644 lib/linux-list.ts delete mode 100644 lib/linux.js create mode 100644 lib/linux.ts create mode 100644 lib/load-bindings.ts create mode 100644 lib/missing-types.ts delete mode 100644 lib/mocks/linux-list.js create mode 100644 lib/mocks/linux-list.ts create mode 100644 lib/node-gype-build.d.ts rename lib/{poller.test.js => poller.test.ts} (68%) rename lib/{poller.js => poller.ts} (68%) rename lib/{unix-read.test.js => unix-read.test.ts} (80%) rename lib/{unix-read.js => unix-read.ts} (53%) rename lib/{unix-write.test.js => unix-write.test.ts} (84%) rename lib/{unix-write.js => unix-write.ts} (64%) rename lib/{win32-sn-parser.js => win32-sn-parser.ts} (81%) delete mode 100644 lib/win32.js create mode 100644 lib/win32.ts create mode 100644 test/assert.ts rename test/{test-config.json => config.json} (100%) delete mode 100644 test/initializers/assert-reject.js delete mode 100644 test/initializers/assert.js delete mode 100644 test/initializers/index.js delete mode 100644 test/initializers/test-config.js create mode 100644 test/makeTestFeature.ts create mode 100644 tsconfig-build.json create mode 100644 tsconfig.json diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 18664e2..0000000 --- a/.eslintrc +++ /dev/null @@ -1,61 +0,0 @@ -{ - "extends": [ - "eslint:recommended", - "plugin:node/recommended", - "plugin:mocha/recommended" - ], - "plugins": [ - "prettier", - "node", - "mocha" - ], - "env": { - "node": true, - "mocha": true, - "es6": true - }, - "parserOptions": { - "ecmaVersion": 2018, - "ecmaFeatures": { - "jsx": true - } - }, - "globals": { - "assert": false, - "makeTestFeature": false, - "shouldReject": false - }, - "rules": { - "no-extra-semi": "off", - "no-process-exit": "off", - "no-unused-vars": [ "error", { "vars": "all", "args": "after-used" }], - "no-var": "error", - "node/no-extraneous-require": "off", - "node/no-unpublished-require": "off", - "node/no-unsupported-features/es-builtins": "error", - "node/no-unsupported-features/es-syntax": "error", - "node/no-unsupported-features/node-builtins": "error", - "node/shebang": "off", - "object-shorthand": "error", - "prefer-arrow-callback": "error", - "prefer-const": "error", - "prefer-template": "error", - "prettier/prettier": [ - "error", - { - "singleQuote": true, - "trailingComma": "es5", - "semi": false, - "printWidth": 150, - "arrowParens": "avoid" - } - ], - "mocha/no-exclusive-tests": "error", - "mocha/no-hooks-for-single-case": "off", - "mocha/no-mocha-arrows": "off", - "mocha/no-pending-tests": "error", - "mocha/no-setup-in-describe": "off", - "strict": [ "error", "never" ], - "valid-jsdoc": "off" - } -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..ae29568 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,43 @@ +module.exports = { + env: { + es2021: true, + node: true, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + ], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 12, + sourceType: 'module', + }, + plugins: [ + '@typescript-eslint', + ], + rules: { + indent: [ + 'error', + 2, + ], + 'linebreak-style': [ + 'error', + 'unix', + ], + quotes: [ + 'error', + 'single', + ], + semi: [ + 'error', + 'never', + ], + 'quote-props': ['error', 'as-needed'], + 'no-param-reassign': 'error', + 'comma-dangle': ['error', 'always-multiline'], + 'space-infix-ops': ['error'], + 'no-multi-spaces': ['error'], + '@typescript-eslint/no-empty-function': ['off'], + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + }, +} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b711e6..03beee9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,7 @@ jobs: node-version: 14 - run: npm ci - run: npm run lint + - run: npm run typecheck test: runs-on: ${{ matrix.config.os }} strategy: diff --git a/.gitignore b/.gitignore index b6e11ae..da71232 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ coverage node_modules npm-debug.log prebuilds +.tool-versions +dist diff --git a/.mocharc.js b/.mocharc.js deleted file mode 100644 index 1a9351a..0000000 --- a/.mocharc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - bail: true, - require: ['./test/initializers'], - 'spec': ['lib/**/*.test.js'], -} diff --git a/.npmignore b/.npmignore index 07b90b7..210ea9c 100644 --- a/.npmignore +++ b/.npmignore @@ -13,3 +13,7 @@ coverage lib/mocks npm-debug.log test +lib/* +tsconfig-build.json +tsconfig.json +.tool-versions diff --git a/lib/binding-interface.test.ts b/lib/binding-interface.test.ts new file mode 100644 index 0000000..f33a861 --- /dev/null +++ b/lib/binding-interface.test.ts @@ -0,0 +1,42 @@ +import { BindingInterface, OpenOptions, PortStatus, SetOptions, UpdateOptions } from './binding-interface' +import { shouldReject } from '../test/assert' + +class Mock extends BindingInterface { + isOpen: boolean + open(_path: string, _options?: OpenOptions): Promise { + throw new Error('Method not implemented.') + } + close(): Promise { + throw new Error('Method not implemented.') + } + read(_buffer: Buffer, _offset: number, _length: number): Promise<{ buffer: Buffer; bytesRead: number }> { + throw new Error('Method not implemented.') + } + write(_buffer: Buffer): Promise { + throw new Error('Method not implemented.') + } + update(_options: UpdateOptions): Promise { + throw new Error('Method not implemented.') + } + set(_options: SetOptions): Promise { + throw new Error('Method not implemented.') + } + get(): Promise { + throw new Error('Method not implemented.') + } + getBaudRate(): Promise<{ baudRate: number }> { + throw new Error('Method not implemented.') + } + flush(): Promise { + throw new Error('Method not implemented.') + } + drain(): Promise { + throw new Error('Method not implemented.') + } +} + +describe('BindingInterface', () => { + it('throws on unimplemented list', async () => { + await shouldReject(Mock.list(), Error, 'List should throw if not implemented') + }) +}) diff --git a/lib/binding-interface.ts b/lib/binding-interface.ts new file mode 100644 index 0000000..83b2426 --- /dev/null +++ b/lib/binding-interface.ts @@ -0,0 +1,135 @@ +/** + Serial port info with metadata. Only the `path` is guaranteed. If unavailable the other fields will be undefined. The `path` is either the path or an identifier (eg `COM1`) used to open the SerialPort. + + We make an effort to identify the hardware attached and have consistent results between systems. Linux and OS X are mostly consistent. Windows relies on 3rd party device drivers for the information and is unable to guarantee the information. On windows If you have a USB connected device can we provide a serial number otherwise it will be `undefined`. The `pnpId` and `locationId` are not the same or present on all systems. The examples below were run with the same Arduino Uno. +*/ +export interface PortInfo { + path: string + manufacturer: string | undefined + serialNumber: string | undefined + pnpId: string | undefined + locationId: string | undefined + productId: string | undefined + vendorId: string | undefined +} + +export interface OpenOptions { + /** The baud rate of the port to be opened. This should match one of the commonly available baud rates, such as 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, or 115200. Custom rates are supported best effort per platform. The device connected to the serial port is not guaranteed to support the requested baud rate, even if the port itself supports that baud rate. */ + baudRate: number + /** Must be one of these: 8, 7, 6, or 5 */ + dataBits: 8 | 7 | 6 | 5 + /** Prevent other processes from opening the port. Windows does not currently support `false`. */ + lock: boolean + stopBits: 1 | 2 + parity: 'none' | 'event' | 'mark' | 'odd' | 'space' + /** Flow control Setting */ + rtscts: boolean + /** Flow control Setting */ + xon: boolean + /** Flow control Setting */ + xoff: boolean + /** Flow control Setting */ + xany: boolean + /** drop DTR on close */ + hupcl: boolean +} + +export interface UpdateOptions { + /** If provided a baud rate that the bindings do not support, it should reject */ + baudRate: number +} + +export interface SetOptions { + brk?: boolean + cts?: boolean + dsr?: boolean + dtr?: boolean + rts?: boolean +} + +export interface PortStatus { + cts: boolean + dsr: boolean + dcd: boolean +} + +/** + * You never have to use `Binding` objects directly. SerialPort uses them to access the underlying hardware. This documentation is geared towards people who are making bindings for different platforms. This interface is implemented in all bindings. + */ +export abstract class BindingInterface { + /** + Retrieves a list of available serial ports with metadata. The `path` must be guaranteed, and all other fields should be undefined if unavailable. The `path` is either the path or an identifier (eg `COM1`) used to open the serialport. + */ + static async list(): Promise { + throw new Error('Method not implemented.') + } + + /** + * Required property. `true` if the port is open, `false` otherwise. Should be read-only. + */ + abstract isOpen: boolean + + /** + * Opens a connection to the serial port referenced by the path. + */ + abstract open(path: string, options?: OpenOptions): Promise + + /** + * Closes an open connection + */ + abstract close(): Promise + + /** + Request a number of bytes from the SerialPort. This function is similar to Node's [`fs.read`](http://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback) except it will always return at least one byte. + + The in progress reads must error when the port is closed with an error object that has the property `canceled` equal to `true`. Any other error will cause a disconnection. + + * @param offset The offset in the buffer to start writing at. + * @param length Specifies the maximum number of bytes to read. + * @returns {Promise} Resolves with the number of bytes read after a read operation. + */ + abstract read(buffer: Buffer, offset: number, length: number): Promise<{ buffer: Buffer; bytesRead: number }> + + /** + Write bytes to the SerialPort. Only called when there is no pending write operation. + + The in progress writes must error when the port is closed with an error object that has the property `canceled` equal to `true`. Any other error will cause a disconnection. + + Resolves after the data is passed to the operating system for writing. + */ + abstract write(buffer: Buffer): Promise + + /** + Changes connection settings on an open port. + */ + abstract update(options: UpdateOptions): Promise + + /** + * Set control flags on an open port. + * All options are operating system default when the port is opened. Every flag is set on each call to the provided or default values. + */ + abstract set(options: SetOptions): Promise + + /** + * Get the control flags (CTS, DSR, DCD) on the open port. + */ + abstract get(): Promise + + /** + * Get the OS reported baud rate for the open port. + * Used mostly for debugging custom baud rates. + */ + abstract getBaudRate(): Promise<{ baudRate: number }> + + /** + * Flush (discard) data received but not read, and written but not transmitted. + * Resolves once the flush operation finishes. + */ + abstract flush(): Promise + + /** + * Drain waits until all output data is transmitted to the serial port. An in progress write should be completed before this returns. + * Resolves once the drain operation finishes. + */ + abstract drain(): Promise +} diff --git a/lib/bindings-win32-sn-parser.test.js b/lib/bindings-win32-sn-parser.test.ts similarity index 76% rename from lib/bindings-win32-sn-parser.test.js rename to lib/bindings-win32-sn-parser.test.ts index f802c92..6fc84bd 100644 --- a/lib/bindings-win32-sn-parser.test.js +++ b/lib/bindings-win32-sn-parser.test.ts @@ -1,6 +1,7 @@ -const serialNumParser = require('./win32-sn-parser') +import { assert } from '../test/assert' +import { serialNumParser } from './win32-sn-parser' -const devices = Object.freeze({ +const devices = { 'FTDI Device': { pnpId: 'FTDIBUS\\VID_0403+PID_6015+DO004ZB7A\\0000', serialNumber: 'DO004ZB7', @@ -25,14 +26,17 @@ const devices = Object.freeze({ pnpId: 'WATEVER\\Whoever\\However!', serialNumber: null, }, -}) + 'bad data': { + pnpId: undefined, + serialNumber: null, + }, +} describe('serialNumParser', () => { - Object.entries(devices).forEach(([device, info]) => { + for (const [device, info] of Object.entries(devices)) { it(`parses pnp id for ${device}`, () => { - const pnpId = info.pnpId - const serialNumber = info.serialNumber + const { pnpId, serialNumber } = info assert.equal(serialNumParser(pnpId), serialNumber) }) - }) + } }) diff --git a/lib/bindings.test.js b/lib/bindings.test.ts similarity index 71% rename from lib/bindings.test.js rename to lib/bindings.test.ts index d75f19f..1574d4c 100644 --- a/lib/bindings.test.js +++ b/lib/bindings.test.ts @@ -1,16 +1,10 @@ -/* eslint-disable mocha/no-pending-tests */ -let platform -switch (process.platform) { - case 'win32': - case 'darwin': - case 'linux': - platform = process.platform - break - default: - throw new Error(`Unknown platform "${process.platform}"`) -} +import { assert, shouldReject } from '../test/assert' +import { makeTestFeature } from '../test/makeTestFeature' +import { BindingInterface, OpenOptions, PortInfo, SetOptions } from './binding-interface' +import Binding, { AllBindingClasses } from './index' +import MockBinding from '@serialport/binding-mock' -const defaultOpenOptions = Object.freeze({ +const defaultOpenOptions: OpenOptions = Object.freeze({ baudRate: 9600, dataBits: 8, hupcl: true, @@ -23,7 +17,7 @@ const defaultOpenOptions = Object.freeze({ xon: false, }) -const defaultSetFlags = Object.freeze({ +const defaultSetFlags: SetOptions = Object.freeze({ brk: false, cts: false, dtr: true, @@ -32,9 +26,9 @@ const defaultSetFlags = Object.freeze({ lowLatency: false, }) -const listFields = ['path', 'manufacturer', 'serialNumber', 'pnpId', 'locationId', 'vendorId', 'productId'] +type MockBinding = any -const bindingsToTest = ['mock', platform] +const listFields = ['path', 'manufacturer', 'serialNumber', 'pnpId', 'locationId', 'vendorId', 'productId'] // All bindings are required to work with an "echo" firmware // The echo firmware should respond with this data when it's @@ -42,32 +36,23 @@ const bindingsToTest = ['mock', platform] // the default firmware is called arduinoEcho.ino const readyData = Buffer.from('READY') -// Test our mock binding and the binding for the platform we're running on -bindingsToTest.forEach(bindingName => { - const Binding = bindingName === 'mock' ? require('@serialport/binding-mock') : require(`./${bindingName}`) - let testPort = process.env.TEST_PORT +testBinding('mock', MockBinding, '/dev/exists') +testBinding(process.platform, Binding, process.env.TEST_PORT) - if (bindingName === 'mock') { - testPort = '/dev/exists' - } - - // eslint-disable-next-line no-use-before-define - testBinding(bindingName, Binding, testPort) -}) - -function testBinding(bindingName, Binding, testPort) { - const testFeature = makeTestFeature(bindingName) +function testBinding(bindingName: string, Binding: AllBindingClasses, testPort?: string) { + const { testFeature, testHardware, describeHardware } = makeTestFeature(bindingName, testPort) describe(`bindings/${bindingName}`, () => { before(() => { if (bindingName === 'mock') { - Binding.createPort(testPort, { echo: true, readyData }) + (Binding as MockBinding).createPort(testPort, { echo: true, readyData }) } }) describe('static method', () => { describe('.list', () => { it('returns an array', async () => { + console.log({ Binding }) const ports = await Binding.list() assert.isArray(ports) }) @@ -81,11 +66,10 @@ function testBinding(bindingName, Binding, testPort) { } ports.forEach(port => { assert.containSubset(Object.keys(port), listFields) - Object.keys(port).forEach(key => { + Object.keys(port).forEach((key: keyof PortInfo) => { assert.notEqual(port[key], '', 'empty values should be undefined') assert.isNotNull(port[key], 'empty values should be undefined') }) - assert.equal(port.comName, port.path) }) }) }) @@ -96,16 +80,6 @@ function testBinding(bindingName, Binding, testPort) { const binding = new Binding() assert.instanceOf(binding, Binding) }) - - it('throws when given something weird', () => { - try { - new Binding(4) - } catch (e) { - assert.instanceOf(e, TypeError) - return - } - throw new Error('Should have errored') - }) }) describe('instance property', () => { @@ -115,26 +89,24 @@ function testBinding(bindingName, Binding, testPort) { return } - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() }) - it('is true after open and false after close', () => { + it('is true after open and false after close', async () => { + assert.equal(binding.isOpen, false) + await binding.open(testPort, defaultOpenOptions) + assert.equal(binding.isOpen, true) + await binding.close() assert.equal(binding.isOpen, false) - return binding.open(testPort, defaultOpenOptions).then(() => { - assert.equal(binding.isOpen, true) - return binding.close().then(() => { - assert.equal(binding.isOpen, false) - }) - }) }) }) }) describe('instance method', () => { describe('#open', () => { - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() }) @@ -158,21 +130,23 @@ function testBinding(bindingName, Binding, testPort) { return } - it('cannot open if already open', async () => { - const options = { ...defaultOpenOptions, lock: false } - await binding.open(testPort, options) - await shouldReject(binding.open(testPort, options)) - await binding.close() + describeHardware('with hardware', () => { + it('cannot open if already open', async () => { + const options = { ...defaultOpenOptions, lock: false } + await binding.open(testPort, options) + await shouldReject(binding.open(testPort, options)) + await binding.close() + }) + + it('keeps open state', async () => { + await binding.open(testPort, defaultOpenOptions) + assert.equal(binding.isOpen, true) + await binding.close() + }) }) - it('keeps open state', async () => { - await binding.open(testPort, defaultOpenOptions) - assert.equal(binding.isOpen, true) - await binding.close() - }) - - describe('arbitrary baud rates', () => { - ;[25000, 1000000, 250000].forEach(testBaud => { + describeHardware('arbitrary baud rates', () => { + [25000, 1000000, 250000].forEach(testBaud => { describe(`${testBaud} baud`, () => { const customRates = { ...defaultOpenOptions, baudRate: testBaud } testFeature(`baudrate.${testBaud}`, `opens at ${testBaud} baud`, async () => { @@ -191,7 +165,7 @@ function testBinding(bindingName, Binding, testPort) { }) }) - describe('optional locking', () => { + describeHardware('optional locking', () => { it('locks the port by default', async () => { const binding2 = new Binding() await binding.open(testPort, defaultOpenOptions) @@ -217,7 +191,7 @@ function testBinding(bindingName, Binding, testPort) { }) describe('#close', () => { - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() }) @@ -226,13 +200,8 @@ function testBinding(bindingName, Binding, testPort) { await shouldReject(binding.close()) }) - if (!testPort) { - it('Cannot be tested further. Set the TEST_PORT env var with an available serialport for more testing.') - return - } - - it('closes an open file descriptor', () => { - return binding.open(testPort, defaultOpenOptions).then(() => { + testHardware('closes an open file descriptor', () => { + return binding.open(testPort!, defaultOpenOptions).then(() => { assert.equal(binding.isOpen, true) return binding.close() }) @@ -242,7 +211,7 @@ function testBinding(bindingName, Binding, testPort) { describe('#update', () => { it('throws when not given an object', async () => { const binding = new Binding() - await shouldReject(binding.update(), TypeError) + await shouldReject((binding as any).update(), TypeError) }) it('errors asynchronously when not open', done => { @@ -256,32 +225,29 @@ function testBinding(bindingName, Binding, testPort) { noZalgo = true }) - if (!testPort) { - it('Cannot be tested further. Set the TEST_PORT env var with an available serialport for more testing.') - return - } + describeHardware('update with hardware', () => { + let binding: BindingInterface + beforeEach(() => { + binding = new Binding() + return binding.open(testPort!, defaultOpenOptions) + }) - let binding - beforeEach(() => { - binding = new Binding() - return binding.open(testPort, defaultOpenOptions) - }) + afterEach(() => binding.close()) - afterEach(() => binding.close()) + it('throws errors when updating nothing', async () => { + await shouldReject((binding as any).update({}), Error) + }) - it('throws errors when updating nothing', async () => { - await shouldReject(binding.update({}), Error) - }) + it('errors when not called with options', async () => { + await shouldReject( + (binding as any).set(() => { }), + Error, + ) + }) - it('errors when not called with options', async () => { - await shouldReject( - binding.set(() => {}), - Error - ) - }) - - it('updates baudRate', () => { - return binding.update({ baudRate: 57600 }) + it('updates baudRate', () => { + return binding.update({ baudRate: 57600 }) + }) }) }) @@ -300,7 +266,7 @@ function testBinding(bindingName, Binding, testPort) { assert.instanceOf(err, Error) assert(noZalgo) done() - } + }, ) .catch(done) noZalgo = true @@ -308,36 +274,33 @@ function testBinding(bindingName, Binding, testPort) { it('rejects when not given a buffer', async () => { const binding = new Binding() - await shouldReject(binding.write(null), TypeError) + await shouldReject((binding as any).write(null), TypeError) }) - if (!testPort) { - it(`Cannot be tested as we have no test ports on ${platform}`) - return - } + describeHardware('with hardware', () => { + let binding: BindingInterface + beforeEach(() => { + binding = new Binding() + return binding.open(testPort!, defaultOpenOptions) + }) - let binding - beforeEach(() => { - binding = new Binding() - return binding.open(testPort, defaultOpenOptions) - }) + afterEach(() => binding.close()) - afterEach(() => binding.close()) + it('resolves after a small write', () => { + const data = Buffer.from('simple write of 24 bytes') + return binding.write(data) + }) - it('resolves after a small write', () => { - const data = Buffer.from('simple write of 24 bytes') - return binding.write(data) - }) + it('resolves after a large write (2k)', function () { + this.timeout(20000) + const data = Buffer.alloc(1024 * 2) + return binding.write(data) + }) - it('resolves after a large write (2k)', function () { - this.timeout(20000) - const data = Buffer.alloc(1024 * 2) - return binding.write(data) - }) - - it('resolves after an empty write', () => { - const data = Buffer.from([]) - return binding.write(data) + it('resolves after an empty write', () => { + const data = Buffer.from([]) + return binding.write(data) + }) }) }) @@ -358,7 +321,7 @@ function testBinding(bindingName, Binding, testPort) { return } - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() return binding.open(testPort, defaultOpenOptions) @@ -370,20 +333,14 @@ function testBinding(bindingName, Binding, testPort) { return binding.drain() }) - it('waits for in progress writes to finish', function (done) { - this.timeout(10000) + it('waits for in progress writes to finish', async () => { let finishedWrite = false - binding - .write(Buffer.alloc(1024 * 2)) - .then(() => { - finishedWrite = true - }) - .catch(done) - binding - .drain(() => { - assert.isTrue(finishedWrite) - }) - .then(done, done) + const write = binding.write(Buffer.alloc(1024 * 2)).then(() => { + finishedWrite = true + }) + await binding.drain() + assert.isTrue(finishedWrite) + await write }) }) @@ -404,7 +361,7 @@ function testBinding(bindingName, Binding, testPort) { return } - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() return binding.open(testPort, defaultOpenOptions) @@ -432,8 +389,8 @@ function testBinding(bindingName, Binding, testPort) { it('throws when not called with options', async () => { const binding = new Binding() await shouldReject( - binding.set(() => {}), - TypeError + (binding as any).set(() => { }), + TypeError, ) }) @@ -442,7 +399,7 @@ function testBinding(bindingName, Binding, testPort) { return } - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() return binding.open(testPort, defaultOpenOptions) @@ -475,7 +432,8 @@ function testBinding(bindingName, Binding, testPort) { return } - let binding, buffer + let binding: BindingInterface + let buffer: Buffer beforeEach(async () => { buffer = Buffer.alloc(readyData.length) binding = new Binding() @@ -484,7 +442,7 @@ function testBinding(bindingName, Binding, testPort) { afterEach(() => binding.isOpen && binding.close()) - it("doesn't throw if the port is open", async () => { + it('doesn\'t throw if the port is open', async () => { await binding.read(buffer, 0, buffer.length) }) @@ -524,7 +482,7 @@ function testBinding(bindingName, Binding, testPort) { return } - let binding + let binding: BindingInterface beforeEach(() => { binding = new Binding() return binding.open(testPort, defaultOpenOptions) diff --git a/lib/darwin.js b/lib/darwin.js deleted file mode 100644 index a888069..0000000 --- a/lib/darwin.js +++ /dev/null @@ -1,111 +0,0 @@ -const { promisify } = require('util') -const { join } = require('path') -const binding = require('node-gyp-build')(join(__dirname, '../')) -const AbstractBinding = require('@serialport/binding-abstract') -const Poller = require('./poller') -const unixRead = require('./unix-read') -const unixWrite = require('./unix-write') -const { wrapWithHiddenComName } = require('./legacy') - -const defaultBindingOptions = Object.freeze({ - vmin: 1, - vtime: 0, -}) - -const asyncList = promisify(binding.list) -const asyncOpen = promisify(binding.open) -const asyncClose = promisify(binding.close) -const asyncUpdate = promisify(binding.update) -const asyncSet = promisify(binding.set) -const asyncGet = promisify(binding.get) -const asyncGetBaudRate = promisify(binding.getBaudRate) -const asyncDrain = promisify(binding.drain) -const asyncFlush = promisify(binding.flush) - -/** - * The Darwin binding layer for OSX - */ -class DarwinBinding extends AbstractBinding { - static list() { - return wrapWithHiddenComName(asyncList()) - } - - constructor(opt = {}) { - super(opt) - this.bindingOptions = { ...defaultBindingOptions, ...opt.bindingOptions } - this.fd = null - this.writeOperation = null - } - - get isOpen() { - return this.fd !== null - } - - async open(path, options) { - await super.open(path, options) - this.openOptions = { ...this.bindingOptions, ...options } - const fd = await asyncOpen(path, this.openOptions) - this.fd = fd - this.poller = new Poller(fd) - } - - async close() { - await super.close() - const fd = this.fd - this.poller.stop() - this.poller.destroy() - this.poller = null - this.openOptions = null - this.fd = null - return asyncClose(fd) - } - - async read(buffer, offset, length) { - await super.read(buffer, offset, length) - return unixRead({ binding: this, buffer, offset, length }) - } - - async write(buffer) { - this.writeOperation = super.write(buffer).then(async () => { - if (buffer.length === 0) { - return - } - await unixWrite({ binding: this, buffer }) - this.writeOperation = null - }) - return this.writeOperation - } - - async update(options) { - await super.update(options) - return asyncUpdate(this.fd, options) - } - - async set(options) { - await super.set(options) - return asyncSet(this.fd, options) - } - - async get() { - await super.get() - return asyncGet(this.fd) - } - - async getBaudRate() { - await super.get() - return asyncGetBaudRate(this.fd) - } - - async drain() { - await super.drain() - await this.writeOperation - return asyncDrain(this.fd) - } - - async flush() { - await super.flush() - return asyncFlush(this.fd) - } -} - -module.exports = DarwinBinding diff --git a/lib/darwin.ts b/lib/darwin.ts new file mode 100644 index 0000000..f0a5642 --- /dev/null +++ b/lib/darwin.ts @@ -0,0 +1,195 @@ +import debugFactory from 'debug' +import { BindingInterface, OpenOptions, PortInfo, PortStatus, SetOptions, UpdateOptions } from './binding-interface' +import { asyncClose, asyncDrain, asyncFlush, asyncGet, asyncGetBaudRate, asyncList, asyncOpen, asyncSet, asyncUpdate } from './load-bindings' +import { Poller } from './poller' +import { unixRead } from './unix-read' +import { unixWrite } from './unix-write' + +const debug = debugFactory('serialport/bindings-cpp') + +export interface DarwinBindingOptions { + /** see [`man termios`](http://linux.die.net/man/3/termios) defaults to 1 */ + vmin?: number + /** see [`man termios`](http://linux.die.net/man/3/termios) defaults to 0 */ + vtime?: number +} + +/** + * The Darwin binding layer for OSX + */ +export class DarwinBinding extends BindingInterface { + bindingOptions: DarwinBindingOptions + fd: null | number + writeOperation: Promise | null + openOptions: (DarwinBindingOptions & OpenOptions) | null + poller: Poller | null + + static async list(): Promise { + debug('list') + return asyncList() + } + + constructor(opt?: DarwinBindingOptions) { + super() + this.bindingOptions = { + vmin: 1, + vtime: 0, + ...opt, + } + this.fd = null + this.writeOperation = null + } + + get isOpen() { + return this.fd !== null + } + + async open(path: string, options?: OpenOptions) { + if (!path) { + throw new TypeError('"path" is not a valid port') + } + + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('open') + + if (this.isOpen) { + throw new Error('Already open') + } + + this.openOptions = { ...this.bindingOptions, ...options } + const fd: number = await asyncOpen(path, this.openOptions) + this.fd = fd + this.poller = new Poller(fd) + } + + async close(): Promise { + debug('close') + if (!this.isOpen) { + throw new Error('Port is not open') + } + + const fd = this.fd + this.poller?.stop() + this.poller?.destroy() + this.poller = null + this.openOptions = null + this.fd = null + await asyncClose(fd) + } + + async read( + buffer: Buffer, + offset: number, + length: number, + ): Promise<{ + buffer: Buffer + bytesRead: number + }> { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + if (typeof offset !== 'number' || isNaN(offset)) { + throw new TypeError(`"offset" is not an integer got "${isNaN(offset) ? 'NaN' : typeof offset}"`) + } + + if (typeof length !== 'number' || isNaN(length)) { + throw new TypeError(`"length" is not an integer got "${isNaN(length) ? 'NaN' : typeof length}"`) + } + + debug('read') + if (buffer.length < offset + length) { + throw new Error('buffer is too small') + } + + if (!this.isOpen) { + throw new Error('Port is not open') + } + + return unixRead({ binding: this, buffer, offset, length }) + } + + async write(buffer: Buffer): Promise { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + debug('write', buffer.length, 'bytes') + if (!this.isOpen) { + debug('write', 'error port is not open') + + throw new Error('Port is not open') + } + + this.writeOperation = (async () => { + if (buffer.length === 0) { + return + } + await unixWrite({ binding: this, buffer }) + this.writeOperation = null + })() + return this.writeOperation + } + + async update(options: UpdateOptions): Promise { + if (typeof options !== 'object') { + throw TypeError('"options" is not an object') + } + + if (typeof options.baudRate !== 'number') { + throw new TypeError('"options.baudRate" is not a number') + } + + debug('update') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncUpdate(this.fd, options) + } + + async set(options: SetOptions): Promise { + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('set', options) + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncSet(this.fd, options) + } + + async get(): Promise { + debug('get') + if (!this.isOpen) { + throw new Error('Port is not open') + } + return asyncGet(this.fd) + } + + async getBaudRate(): Promise<{ baudRate: number }> { + debug('getBaudRate') + if (!this.isOpen) { + throw new Error('Port is not open') + } + return asyncGetBaudRate(this.fd) + } + + async flush(): Promise { + debug('flush') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncFlush(this.fd) + } + + async drain(): Promise { + debug('drain') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await this.writeOperation + await asyncDrain(this.fd) + } +} diff --git a/lib/errors.ts b/lib/errors.ts new file mode 100644 index 0000000..36a2313 --- /dev/null +++ b/lib/errors.ts @@ -0,0 +1,7 @@ +export class CanceledError extends Error { + canceled: true + constructor(message: string) { + super(message) + this.canceled = true + } +} diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index af4e228..0000000 --- a/lib/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const debug = require('debug')('serialport/bindings') - -switch (process.platform) { - case 'win32': - debug('loading WindowsBinding') - module.exports = require('./win32') - break - case 'darwin': - debug('loading DarwinBinding') - module.exports = require('./darwin') - break - default: - debug('loading LinuxBinding') - module.exports = require('./linux') -} diff --git a/lib/index.ts b/lib/index.ts new file mode 100644 index 0000000..dee0f45 --- /dev/null +++ b/lib/index.ts @@ -0,0 +1,30 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +import debugFactory from 'debug' +import { DarwinBinding } from './darwin' +import { LinuxBinding } from './linux' +import { WindowsBinding } from './win32' +const debug = debugFactory('serialport/bindings-cpp') + +export * from './darwin' +export * from './linux' +export * from './win32' +export * from './binding-interface' + +export type AllBindingClasses = typeof WindowsBinding | typeof DarwinBinding | typeof LinuxBinding +export type AllBindings = WindowsBinding | DarwinBinding | LinuxBinding +let binding: AllBindingClasses +switch (process.platform) { +case 'win32': + debug('loading WindowsBinding') + binding = WindowsBinding + break +case 'darwin': + debug('loading DarwinBinding') + binding = DarwinBinding + break +default: + debug('loading LinuxBinding') + binding = LinuxBinding +} + +export default binding diff --git a/lib/legacy.js b/lib/legacy.js deleted file mode 100644 index 9cd2b70..0000000 --- a/lib/legacy.js +++ /dev/null @@ -1,26 +0,0 @@ -let warningSent = false - -const wrapWithHiddenComName = async portsPromise => { - const ports = await portsPromise - return ports.map(port => { - const newPort = { ...port } - return Object.defineProperties(newPort, { - comName: { - get() { - if (!warningSent) { - warningSent = true - console.warn( - `"PortInfo.comName" has been deprecated. You should now use "PortInfo.path". The property will be removed in the next major release.` - ) - } - return newPort.path - }, - enumerable: false, - }, - }) - }) -} - -module.exports = { - wrapWithHiddenComName, -} diff --git a/lib/linux-list.js b/lib/linux-list.js deleted file mode 100644 index 63cb95a..0000000 --- a/lib/linux-list.js +++ /dev/null @@ -1,100 +0,0 @@ -const childProcess = require('child_process') -const Readline = require('@serialport/parser-readline') - -// get only serial port names -function checkPathOfDevice(path) { - return /(tty(S|WCH|ACM|USB|AMA|MFD|O|XRUSB)|rfcomm)/.test(path) && path -} - -function propName(name) { - return { - DEVNAME: 'path', - ID_VENDOR_ENC: 'manufacturer', - ID_SERIAL_SHORT: 'serialNumber', - ID_VENDOR_ID: 'vendorId', - ID_MODEL_ID: 'productId', - DEVLINKS: 'pnpId', - }[name.toUpperCase()] -} - -function decodeHexEscape(str) { - return str.replace(/\\x([a-fA-F0-9]{2})/g, (a, b) => { - return String.fromCharCode(parseInt(b, 16)) - }) -} - -function propVal(name, val) { - if (name === 'pnpId') { - const match = val.match(/\/by-id\/([^\s]+)/) - return (match && match[1]) || undefined - } - if (name === 'manufacturer') { - return decodeHexEscape(val) - } - if (/^0x/.test(val)) { - return val.substr(2) - } - return val -} - -function listLinux() { - return new Promise((resolve, reject) => { - const ports = [] - const ude = childProcess.spawn('udevadm', ['info', '-e']) - const lines = ude.stdout.pipe(new Readline()) - ude.on('close', code => code && reject(new Error(`Error listing ports udevadm exited with error code: ${code}`))) - ude.on('error', reject) - lines.on('error', reject) - - let port = {} - let skipPort = false - lines.on('data', line => { - const lineType = line.slice(0, 1) - const data = line.slice(3) - // new port entry - if (lineType === 'P') { - port = { - manufacturer: undefined, - serialNumber: undefined, - pnpId: undefined, - locationId: undefined, - vendorId: undefined, - productId: undefined, - } - skipPort = false - return - } - - if (skipPort) { - return - } - - // Check dev name and save port if it matches flag to skip the rest of the data if not - if (lineType === 'N') { - if (checkPathOfDevice(data)) { - ports.push(port) - } else { - skipPort = true - } - return - } - - // parse data about each port - if (lineType === 'E') { - const keyValue = data.match(/^(.+)=(.*)/) - if (!keyValue) { - return - } - const key = propName(keyValue[1]) - if (!key) { - return - } - port[key] = propVal(key, keyValue[2]) - } - }) - - lines.on('finish', () => resolve(ports)) - }) -} - -module.exports = listLinux diff --git a/lib/linux-list.test.js b/lib/linux-list.test.ts similarity index 81% rename from lib/linux-list.test.js rename to lib/linux-list.test.ts index ec58f85..0274188 100644 --- a/lib/linux-list.test.js +++ b/lib/linux-list.test.ts @@ -1,6 +1,7 @@ -const listLinux = require('./mocks/linux-list') +import { assert, shouldReject } from '../test/assert' +import { mockLinuxList as linuxList, mockLinuxListError } from './mocks/linux-list' -const ports = String.raw` +const mockUdevOutput = String.raw` P: /devices/platform/serial8250/tty/ttyS0 N: ttyS0 E: DEVNAME=/dev/ttyS0 @@ -103,28 +104,13 @@ const portOutput = [ ] describe('listLinux', () => { - beforeEach(() => { - listLinux.reset() + it('lists available serialports', async () => { + const ports = await linuxList(mockUdevOutput) + assert.containSubset(ports, portOutput) }) - it('lists available serialports', () => { - listLinux.setPorts(ports) - return listLinux().then(ports => { - assert.containSubset(ports, portOutput) - }) - }) - - it('rejects on non-zero exit codes', () => { - const list = listLinux() - listLinux.emit('close', 1) - - list.then( - () => { - assert.fail('should not resolve for non-zero exit codes') - }, - error => { - assert(error, new Error('Error listing ports udevadm exited with error code: 1')) - } - ) + it('rejects on non-zero exit codes', async () => { + const list = mockLinuxListError('1') + await shouldReject(list, Error, 'Error listing ports udevadm exited with error code: 1') }) }) diff --git a/lib/linux-list.ts b/lib/linux-list.ts new file mode 100644 index 0000000..f40bcae --- /dev/null +++ b/lib/linux-list.ts @@ -0,0 +1,115 @@ +import { PortInfo } from './binding-interface' + +import { spawn } from 'child_process' +import Readline from '@serialport/parser-readline' + +// get only serial port names +function checkPathOfDevice(path: string) { + return /(tty(S|WCH|ACM|USB|AMA|MFD|O|XRUSB)|rfcomm)/.test(path) && path +} + +function propName(name: string) { + return { + DEVNAME: 'path', + ID_VENDOR_ENC: 'manufacturer', + ID_SERIAL_SHORT: 'serialNumber', + ID_VENDOR_ID: 'vendorId', + ID_MODEL_ID: 'productId', + DEVLINKS: 'pnpId', + }[name.toUpperCase()] +} + +function decodeHexEscape(str: string) { + return str.replace(/\\x([a-fA-F0-9]{2})/g, (a, b) => { + return String.fromCharCode(parseInt(b, 16)) + }) +} + +function propVal(name: string, val: string) { + if (name === 'pnpId') { + const match = val.match(/\/by-id\/([^\s]+)/) + return (match && match[1]) || undefined + } + if (name === 'manufacturer') { + return decodeHexEscape(val) + } + if (/^0x/.test(val)) { + return val.substr(2) + } + return val +} + +export function linuxList(spawnCmd: typeof spawn = spawn) { + const ports: PortInfo[] = [] + const udevadm = spawnCmd('udevadm', ['info', '-e']) + const lines = udevadm.stdout.pipe(new Readline()) + + let skipPort = false + let port: PortInfo = { + path: '', + manufacturer: undefined, + serialNumber: undefined, + pnpId: undefined, + locationId: undefined, + vendorId: undefined, + productId: undefined, + } + + lines.on('data', (line: string) => { + const lineType = line.slice(0, 1) + const data = line.slice(3) + // new port entry + if (lineType === 'P') { + port = { + path: '', + manufacturer: undefined, + serialNumber: undefined, + pnpId: undefined, + locationId: undefined, + vendorId: undefined, + productId: undefined, + } + skipPort = false + return + } + + if (skipPort) { + return + } + + // Check dev name and save port if it matches flag to skip the rest of the data if not + if (lineType === 'N') { + if (checkPathOfDevice(data)) { + ports.push(port) + } else { + skipPort = true + } + return + } + + // parse data about each port + if (lineType === 'E') { + const keyValue = data.match(/^(.+)=(.*)/) + if (!keyValue) { + return + } + const key = propName(keyValue[1]) as keyof PortInfo + if (!key) { + return + } + + port[key] = propVal(key, keyValue[2]) as string + } + }) + + return new Promise((resolve, reject) => { + udevadm.on('close', (code: string | null) => { + if (code) { + reject(new Error(`Error listing ports udevadm exited with error code: ${code}`)) + } + }) + udevadm.on('error', reject) + lines.on('error', reject) + lines.on('finish', () => resolve(ports)) + }) +} diff --git a/lib/linux.js b/lib/linux.js deleted file mode 100644 index d217090..0000000 --- a/lib/linux.js +++ /dev/null @@ -1,111 +0,0 @@ -const { promisify } = require('util') -const { join } = require('path') -const binding = require('node-gyp-build')(join(__dirname, '../')) -const AbstractBinding = require('@serialport/binding-abstract') -const linuxList = require('./linux-list') -const Poller = require('./poller') -const unixRead = require('./unix-read') -const unixWrite = require('./unix-write') -const { wrapWithHiddenComName } = require('./legacy') - -const defaultBindingOptions = Object.freeze({ - vmin: 1, - vtime: 0, -}) - -const asyncOpen = promisify(binding.open) -const asyncClose = promisify(binding.close) -const asyncUpdate = promisify(binding.update) -const asyncSet = promisify(binding.set) -const asyncGet = promisify(binding.get) -const asyncGetBaudRate = promisify(binding.getBaudRate) -const asyncDrain = promisify(binding.drain) -const asyncFlush = promisify(binding.flush) - -/** - * The linux binding layer - */ -class LinuxBinding extends AbstractBinding { - static list() { - return wrapWithHiddenComName(linuxList()) - } - - constructor(opt = {}) { - super(opt) - this.bindingOptions = { ...defaultBindingOptions, ...opt.bindingOptions } - this.fd = null - this.writeOperation = null - } - - get isOpen() { - return this.fd !== null - } - - async open(path, options) { - await super.open(path, options) - this.openOptions = { ...this.bindingOptions, ...options } - const fd = await asyncOpen(path, this.openOptions) - this.fd = fd - this.poller = new Poller(fd) - } - - async close() { - await super.close() - const fd = this.fd - this.poller.stop() - this.poller.destroy() - this.poller = null - this.openOptions = null - this.fd = null - return asyncClose(fd) - } - - async read(buffer, offset, length) { - await super.read(buffer, offset, length) - return unixRead({ binding: this, buffer, offset, length }) - } - - async write(buffer) { - this.writeOperation = super.write(buffer).then(async () => { - if (buffer.length === 0) { - return - } - await unixWrite({ binding: this, buffer }) - this.writeOperation = null - }) - return this.writeOperation - } - - async update(options) { - await super.update(options) - return asyncUpdate(this.fd, options) - } - - async set(options) { - await super.set(options) - return asyncSet(this.fd, options) - } - - async get() { - await super.get() - return asyncGet(this.fd) - } - - async getBaudRate() { - await super.get() - return asyncGetBaudRate(this.fd) - } - - async drain() { - await super.drain() - await this.writeOperation - return asyncDrain(this.fd) - } - - async flush() { - await super.flush() - return asyncFlush(this.fd) - } -} - -module.exports = LinuxBinding diff --git a/lib/linux.ts b/lib/linux.ts new file mode 100644 index 0000000..836f1c1 --- /dev/null +++ b/lib/linux.ts @@ -0,0 +1,205 @@ +import debugFactory from 'debug' +import { linuxList } from './linux-list' +import { Poller } from './poller' +import { unixRead } from './unix-read' +import { unixWrite } from './unix-write' +import { BindingInterface, OpenOptions, PortStatus, SetOptions, UpdateOptions } from './binding-interface' +import { asyncOpen, asyncClose, asyncUpdate, asyncSet, asyncGet, asyncGetBaudRate, asyncFlush, asyncDrain } from './load-bindings' + +const debug = debugFactory('serialport/bindings-cpp') + +export interface LinuxBindingOptions { + /** see [`man termios`](http://linux.die.net/man/3/termios) defaults to 1 */ + vmin?: number + /** see [`man termios`](http://linux.die.net/man/3/termios) defaults to 0 */ + vtime?: number + // * @param {Boolean} [options.lowLatency=false] flag for lowLatency mode on Linux +} + +export interface LinuxPortStatus extends PortStatus { + lowLatency: boolean +} + +export interface LinuxSetOptions extends SetOptions { + /** Low latency mode */ + lowLatency?: boolean +} + +/** + * The linux binding layer + */ +export class LinuxBinding extends BindingInterface { + bindingOptions: LinuxBindingOptions + fd: null | number + writeOperation: Promise | null + openOptions: (LinuxBindingOptions & OpenOptions) | null + poller: Poller | null + + static list() { + debug('list') + return linuxList() + } + + constructor(opt?: LinuxBindingOptions) { + super() + this.bindingOptions = { + vmin: 1, + vtime: 0, + ...opt, + } + this.fd = null + this.writeOperation = null + } + + get isOpen() { + return this.fd !== null + } + + async open(path: string, options?: OpenOptions) { + if (!path) { + throw new TypeError('"path" is not a valid port') + } + + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('open') + + if (this.isOpen) { + throw new Error('Already open') + } + this.openOptions = { ...this.bindingOptions, ...options } + const fd: number = await asyncOpen(path, this.openOptions) + this.fd = fd + this.poller = new Poller(fd) + } + + async close(): Promise { + debug('close') + if (!this.isOpen) { + throw new Error('Port is not open') + } + + const fd = this.fd + this.poller?.stop() + this.poller?.destroy() + this.poller = null + this.openOptions = null + this.fd = null + await asyncClose(fd) + } + + async read( + buffer: Buffer, + offset: number, + length: number, + ): Promise<{ + buffer: Buffer + bytesRead: number + }> { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + if (typeof offset !== 'number' || isNaN(offset)) { + throw new TypeError(`"offset" is not an integer got "${isNaN(offset) ? 'NaN' : typeof offset}"`) + } + + if (typeof length !== 'number' || isNaN(length)) { + throw new TypeError(`"length" is not an integer got "${isNaN(length) ? 'NaN' : typeof length}"`) + } + + debug('read') + if (buffer.length < offset + length) { + throw new Error('buffer is too small') + } + + if (!this.isOpen) { + throw new Error('Port is not open') + } + + return unixRead({ binding: this, buffer, offset, length }) + } + + async write(buffer: Buffer): Promise { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + debug('write', buffer.length, 'bytes') + if (!this.isOpen) { + debug('write', 'error port is not open') + + throw new Error('Port is not open') + } + + this.writeOperation = (async () => { + if (buffer.length === 0) { + return + } + await unixWrite({ binding: this, buffer }) + this.writeOperation = null + })() + return this.writeOperation + } + + async update(options: UpdateOptions): Promise { + if (typeof options !== 'object') { + throw TypeError('"options" is not an object') + } + + if (typeof options.baudRate !== 'number') { + throw new TypeError('"options.baudRate" is not a number') + } + + debug('update') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncUpdate(this.fd, options) + } + + async set(options: LinuxSetOptions): Promise { + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('set') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncSet(this.fd, options) + } + + async get(): Promise { + debug('get') + if (!this.isOpen) { + throw new Error('Port is not open') + } + return asyncGet(this.fd) + } + + async getBaudRate(): Promise<{ baudRate: number }> { + debug('getBaudRate') + if (!this.isOpen) { + throw new Error('Port is not open') + } + return asyncGetBaudRate(this.fd) + } + + async flush(): Promise { + debug('flush') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncFlush(this.fd) + } + + async drain(): Promise { + debug('drain') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await this.writeOperation + await asyncDrain(this.fd) + } +} diff --git a/lib/load-bindings.ts b/lib/load-bindings.ts new file mode 100644 index 0000000..2858265 --- /dev/null +++ b/lib/load-bindings.ts @@ -0,0 +1,17 @@ +import nodeGypBuild from 'node-gyp-build' +import { promisify } from 'util' +import { join } from 'path' + +const binding = nodeGypBuild(join(__dirname, '../')) as any + +export const asyncClose = binding.close ? promisify(binding.close) : async () => { throw new Error('"binding.close" Method not implemented')} +export const asyncDrain = binding.drain ? promisify(binding.drain) : async () => { throw new Error('"binding.drain" Method not implemented')} +export const asyncFlush = binding.flush ? promisify(binding.flush) : async () => { throw new Error('"binding.flush" Method not implemented')} +export const asyncGet = binding.get ? promisify(binding.get) : async () => { throw new Error('"binding.get" Method not implemented')} +export const asyncGetBaudRate = binding.getBaudRate ? promisify(binding.getBaudRate) : async () => { throw new Error('"binding.getBaudRate" Method not implemented')} +export const asyncList = binding.list ? promisify(binding.list) : async () => { throw new Error('"binding.list" Method not implemented')} +export const asyncOpen = binding.open ? promisify(binding.open) : async () => { throw new Error('"binding.open" Method not implemented')} +export const asyncSet = binding.set ? promisify(binding.set) : async () => { throw new Error('"binding.set" Method not implemented')} +export const asyncUpdate = binding.update ? promisify(binding.update) : async () => { throw new Error('"binding.update" Method not implemented')} +export const asyncRead = binding.read ? promisify(binding.read) : async () => { throw new Error('"binding.read" Method not implemented')} +export const asyncWrite = binding.read ? promisify(binding.write) : async () => { throw new Error('"binding.write" Method not implemented')} diff --git a/lib/missing-types.ts b/lib/missing-types.ts new file mode 100644 index 0000000..be4653b --- /dev/null +++ b/lib/missing-types.ts @@ -0,0 +1,2 @@ +declare module '@serialport/binding-mock' +declare module '@serialport/parser-readline' diff --git a/lib/mocks/linux-list.js b/lib/mocks/linux-list.js deleted file mode 100644 index f190b62..0000000 --- a/lib/mocks/linux-list.js +++ /dev/null @@ -1,36 +0,0 @@ -// Mocks fs.read for listLinux - -const EventEmitter = require('events') -const proxyquire = require('proxyquire') -const Readable = require('stream').Readable -let mockPorts -let event - -proxyquire.noPreserveCache() -const listLinux = proxyquire('../linux-list', { - child_process: { - spawn() { - const stream = new Readable() - event = new EventEmitter() - event.stdout = stream - stream.push(mockPorts) - stream.push(null) - return event - }, - }, -}) -proxyquire.preserveCache() - -listLinux.setPorts = ports => { - mockPorts = ports -} - -listLinux.emit = () => { - event.emit.apply(event, arguments) -} - -listLinux.reset = () => { - mockPorts = undefined -} - -module.exports = listLinux diff --git a/lib/mocks/linux-list.ts b/lib/mocks/linux-list.ts new file mode 100644 index 0000000..1d8b702 --- /dev/null +++ b/lib/mocks/linux-list.ts @@ -0,0 +1,27 @@ +// Mocks fs.read for listLinux + +import { EventEmitter } from 'events' +import { Readable } from 'stream' +import { linuxList } from '../linux-list' + +export const mockLinuxList = (mockUDevOutput: string) => { + return linuxList(() => { + const mockUDevAdm = new EventEmitter() as any + const stream = new Readable({ read() {} }) + mockUDevAdm.stdout = stream + stream.push(mockUDevOutput) + stream.push(null) + return mockUDevAdm + }) +} + +export const mockLinuxListError = (code: string) => { + return linuxList(() => { + const mockUDevAdm = new EventEmitter() as any + mockUDevAdm.stdout = new Readable({ read() {} }) + setImmediate(() => { + mockUDevAdm.emit('close', code) + }) + return mockUDevAdm + }) +} diff --git a/lib/node-gype-build.d.ts b/lib/node-gype-build.d.ts new file mode 100644 index 0000000..05dfc1b --- /dev/null +++ b/lib/node-gype-build.d.ts @@ -0,0 +1,3 @@ +declare module 'node-gyp-build' { + export default function load(path: string): unknown +} diff --git a/lib/poller.test.js b/lib/poller.test.ts similarity index 68% rename from lib/poller.test.js rename to lib/poller.test.ts index bcdc853..7d19baa 100644 --- a/lib/poller.test.js +++ b/lib/poller.test.ts @@ -1,22 +1,29 @@ -const Poller = require('./poller') +import { Poller } from './poller' +import { assert } from '../test/assert' -class MockPollerBidnings { - constructor(fd, callback) { +class MockPollerBindings { + fd: number + callback: any + lastPollFlag: string + constructor(fd: number, callback: any) { this.fd = fd this.callback = callback } - poll(flag) { + poll(flag: string) { this.lastPollFlag = flag setImmediate(() => this.callback(null, flag)) } } class ErrorPollerBindings { - constructor(fd, callback) { + fd: number + callback: any + lastPollFlag: string + constructor(fd: number, callback: any) { this.fd = fd this.callback = callback } - poll(flag) { + poll(flag: string) { this.lastPollFlag = flag setImmediate(() => this.callback(new Error('oh no!'), flag)) } @@ -24,10 +31,10 @@ class ErrorPollerBindings { describe('Poller', () => { it('constructs', () => { - new Poller(1, MockPollerBidnings) + new Poller(1, MockPollerBindings) }) it('can listen to the readable event', done => { - const poller = new Poller(1, MockPollerBidnings) + const poller = new Poller(1, MockPollerBindings) poller.once('readable', err => { assert.equal(err, null) assert.equal(poller.poller.lastPollFlag, 1) @@ -35,7 +42,7 @@ describe('Poller', () => { }) }) it('can listen to the writable event', done => { - const poller = new Poller(1, MockPollerBidnings) + const poller = new Poller(1, MockPollerBindings) poller.once('writable', err => { assert.equal(err, null) assert.equal(poller.poller.lastPollFlag, 2) @@ -43,7 +50,7 @@ describe('Poller', () => { }) }) it('can listen to the disconnect event', done => { - const poller = new Poller(1, MockPollerBidnings) + const poller = new Poller(1, MockPollerBindings) poller.once('disconnect', err => { assert.equal(err, null) assert.equal(poller.poller.lastPollFlag, 4) diff --git a/lib/poller.js b/lib/poller.ts similarity index 68% rename from lib/poller.js rename to lib/poller.ts index a3e0c90..6bd76c8 100644 --- a/lib/poller.js +++ b/lib/poller.ts @@ -1,16 +1,19 @@ -const debug = require('debug') -const logger = debug('serialport/bindings/poller') -const EventEmitter = require('events') -const { join } = require('path') -const PollerBindings = require('node-gyp-build')(join(__dirname, '../')).Poller +import debug from 'debug' +import { EventEmitter } from 'events' +import { join } from 'path' +import nodeGypBuild from 'node-gyp-build' +import { CanceledError } from './errors' -const EVENTS = { +const { Poller: PollerBindings } = nodeGypBuild(join(__dirname, '../')) as any +const logger = debug('serialport/bindings/poller') + +export const EVENTS = { UV_READABLE: 0b0001, UV_WRITABLE: 0b0010, UV_DISCONNECT: 0b0100, } -function handleEvent(error, eventFlag) { +function handleEvent(error: Error, eventFlag: number) { if (error) { logger('error', error) this.emit('readable', error) @@ -35,8 +38,9 @@ function handleEvent(error, eventFlag) { /** * Polls unix systems for readable or writable states of a file or serialport */ -class Poller extends EventEmitter { - constructor(fd, FDPoller = PollerBindings) { +export class Poller extends EventEmitter { + poller: any + constructor(fd: number, FDPoller = PollerBindings) { logger('Creating poller') super() this.poller = new FDPoller(fd, handleEvent.bind(this)) @@ -46,17 +50,17 @@ class Poller extends EventEmitter { * @param {string} event ('readable'|'writable'|'disconnect') * @returns {Poller} returns itself */ - once(event, callback) { + once(event: 'readable' | 'writable' | 'disconnect', callback: (err: null | Error) => void): this { switch (event) { - case 'readable': - this.poll(EVENTS.UV_READABLE) - break - case 'writable': - this.poll(EVENTS.UV_WRITABLE) - break - case 'disconnect': - this.poll(EVENTS.UV_DISCONNECT) - break + case 'readable': + this.poll(EVENTS.UV_READABLE) + break + case 'writable': + this.poll(EVENTS.UV_WRITABLE) + break + case 'disconnect': + this.poll(EVENTS.UV_DISCONNECT) + break } return super.once(event, callback) } @@ -64,11 +68,8 @@ class Poller extends EventEmitter { /** * Ask the bindings to listen for an event, it is recommend to use `.once()` for easy use * @param {EVENTS} eventFlag polls for an event or group of events based upon a flag. - * @returns {undefined} */ - poll(eventFlag) { - eventFlag = eventFlag || 0 - + poll(eventFlag = 0) { if (eventFlag & EVENTS.UV_READABLE) { logger('Polling for "readable"') } @@ -84,29 +85,23 @@ class Poller extends EventEmitter { /** * Stop listening for events and cancel all outstanding listening with an error - * @returns {undefined} */ - stop() { + stop(): void { logger('Stopping poller') this.poller.stop() this.emitCanceled() } - destroy() { + destroy(): void { logger('Destroying poller') this.poller.destroy() this.emitCanceled() } - emitCanceled() { - const err = new Error('Canceled') - err.canceled = true + emitCanceled(): void { + const err = new CanceledError('Canceled') this.emit('readable', err) this.emit('writable', err) this.emit('disconnect', err) } } - -Poller.EVENTS = EVENTS - -module.exports = Poller diff --git a/lib/unix-read.test.js b/lib/unix-read.test.ts similarity index 80% rename from lib/unix-read.test.js rename to lib/unix-read.test.ts index 6b289db..998f547 100644 --- a/lib/unix-read.test.js +++ b/lib/unix-read.test.ts @@ -1,24 +1,29 @@ -const unixRead = require('./unix-read') +import { assert, shouldReject } from '../test/assert' +import { LinuxBinding } from './linux' +import { unixRead } from './unix-read' -const makeFsRead = (bytesRead, fill) => (fd, buffer, offset, length) => { - buffer.fill(fill, offset, Math.min(length, bytesRead)) - return { - buffer, - bytesRead, - } -} +const makeFsRead = + (bytesRead: number, fill: number): any => + (fd: number, buffer: Buffer, offset: number, length: number) => { + buffer.fill(fill, offset, Math.min(length, bytesRead)) + return { + buffer, + bytesRead, + } + } -const makeFsReadError = code => { +const makeFsReadError = (code: string) => { const err = new Error(`Error: ${code}`) - err.code = code + ;(err as any).code = code return () => { throw err } } -const sequenceCalls = (...functions) => { +// eslint-disable-next-line @typescript-eslint/ban-types +const sequenceCalls = (...functions: Function[]) => { const funcs = [...functions] - return (...args) => { + return (...args: any[]) => { const func = funcs.shift() if (func) { return func(...args) @@ -28,25 +33,25 @@ const sequenceCalls = (...functions) => { } } -const makeMockBinding = () => { +const makeMockBinding = (): LinuxBinding => { return { isOpen: true, fd: 1, poller: { - once(event, func) { + once(event: any, func: () => void) { setImmediate(func) }, }, - } + } as any } describe('unixRead', () => { - let mock + let mock: LinuxBinding beforeEach(() => { mock = makeMockBinding() }) it('rejects when not open', async () => { - mock.isOpen = false + (mock as any).isOpen = false const readBuffer = Buffer.alloc(8, 0) await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync: makeFsRead(8, 255) })) }) @@ -88,8 +93,8 @@ describe('unixRead', () => { }) it('rejects a canceled error if port closes after read a retryable error', async () => { const readBuffer = Buffer.alloc(8, 0) - const fsReadAsync = () => { - mock.isOpen = false + const fsReadAsync: any = () => { + (mock as any).isOpen = false makeFsReadError('EAGAIN')() } const err = await shouldReject(unixRead({ binding: mock, buffer: readBuffer, offset: 0, length: 8, fsReadAsync })) diff --git a/lib/unix-read.js b/lib/unix-read.ts similarity index 53% rename from lib/unix-read.js rename to lib/unix-read.ts index ea3107d..6a0fb08 100644 --- a/lib/unix-read.js +++ b/lib/unix-read.ts @@ -1,22 +1,40 @@ -const fs = require('fs') -const debug = require('debug') -const logger = debug('serialport/bindings/unixRead') -const { promisify } = require('util') +import { promisify } from 'util' +import { read as fsRead } from 'fs' +import { CanceledError } from './errors' +import debugFactory from 'debug' +import { LinuxBinding } from './linux' +import { DarwinBinding } from './darwin' -const readAsync = promisify(fs.read) +const logger = debugFactory('serialport/bindings-cpp/unixRead') +const readAsync = promisify(fsRead) -const readable = binding => { - return new Promise((resolve, reject) => { +const readable = (binding: LinuxBinding | DarwinBinding) => { + return new Promise((resolve, reject) => { + if (!binding.poller) { + throw new Error('No poller on bindings') + } binding.poller.once('readable', err => (err ? reject(err) : resolve())) }) } -const unixRead = async ({ binding, buffer, offset, length, fsReadAsync = readAsync }) => { +interface UnixReadOptions { + binding: LinuxBinding | DarwinBinding + buffer: Buffer + offset: number + length: number + fsReadAsync?: typeof readAsync +} + +export const unixRead = async ({ + binding, + buffer, + offset, + length, + fsReadAsync = readAsync, +}: UnixReadOptions): Promise<{ buffer: Buffer; bytesRead: number }> => { logger('Starting read') - if (!binding.isOpen) { - const err = new Error('Port is not open') - err.canceled = true - throw err + if (!binding.isOpen || !binding.fd) { + throw new CanceledError('Port is not open') } try { @@ -30,9 +48,7 @@ const unixRead = async ({ binding, buffer, offset, length, fsReadAsync = readAsy logger('read error', err) if (err.code === 'EAGAIN' || err.code === 'EWOULDBLOCK' || err.code === 'EINTR') { if (!binding.isOpen) { - const err = new Error('Port is not open') - err.canceled = true - throw err + throw new CanceledError('Port is not open') } logger('waiting for readable because of code:', err.code) await readable(binding) @@ -53,5 +69,3 @@ const unixRead = async ({ binding, buffer, offset, length, fsReadAsync = readAsy throw err } } - -module.exports = unixRead diff --git a/lib/unix-write.test.js b/lib/unix-write.test.ts similarity index 84% rename from lib/unix-write.test.js rename to lib/unix-write.test.ts index 21954d8..e6d0c11 100644 --- a/lib/unix-write.test.js +++ b/lib/unix-write.test.ts @@ -1,6 +1,7 @@ -const unixWrite = require('./unix-write') -const { randomBytes } = require('crypto') -const { promisify } = require('util') +import { assert, shouldReject } from '../test/assert' +import { unixWrite } from './unix-write' +import { randomBytes } from 'crypto' +import { promisify } from 'util' const randomBytesAsync = promisify(randomBytes) const makeMockBinding = () => { @@ -9,11 +10,11 @@ const makeMockBinding = () => { fd: 1, poller: { error: null, - once(event, func) { + once(event: any, func: (err: null | Error) => void) { setImmediate(() => func(this.error)) }, }, - } + } as any } const makeFsWrite = (maxBytesToWrite = Infinity) => { @@ -22,7 +23,7 @@ const makeFsWrite = (maxBytesToWrite = Infinity) => { writeBuffer: Buffer.alloc(0), writes: 0, } - const fsWriteAsync = (fd, buffer, offset, bytesToWrite) => { + const fsWriteAsync: any = (fd: number, buffer: Buffer, offset: number, bytesToWrite: number) => { const bytesWritten = Math.min(maxBytesToWrite, bytesToWrite) info.bytesWritten += bytesWritten info.writeBuffer = Buffer.concat([info.writeBuffer, buffer.slice(offset, offset + bytesWritten)]) @@ -39,9 +40,10 @@ const makeFsWrite = (maxBytesToWrite = Infinity) => { } } -const sequenceCalls = (...functions) => { +// eslint-disable-next-line @typescript-eslint/ban-types +const sequenceCalls = (...functions: Function[]) => { const funcs = [...functions] - return (...args) => { + return (...args: any[]) => { const func = funcs.shift() if (func) { return func(...args) @@ -51,16 +53,16 @@ const sequenceCalls = (...functions) => { } } -const makeFsWriteError = code => { +const makeFsWriteError = (code: string) => { const err = new Error(`Error: ${code}`) - err.code = code + ;(err as any).code = code return () => { throw err } } describe('unixWrite', () => { - let mock + let mock: ReturnType beforeEach(() => { mock = makeMockBinding() }) @@ -88,7 +90,7 @@ describe('unixWrite', () => { it('errors if the port closes after a partial write', async () => { const writeBuffer = await randomBytesAsync(16) const { fsWriteAsync: realFsWrite, info } = makeFsWrite(8) - const fsWriteAsync = (...args) => { + const fsWriteAsync = (...args: any[]) => { mock.isOpen = false return realFsWrite(...args) } @@ -98,7 +100,7 @@ describe('unixWrite', () => { }) it('errors if the poller errors after a partial write', async () => { const writeBuffer = await randomBytesAsync(16) - const fsWriteAsync = () => { + const fsWriteAsync: any = () => { mock.poller.error = new Error('PollerError') makeFsWriteError('EAGAIN')() } @@ -114,7 +116,7 @@ describe('unixWrite', () => { makeFsWriteError('EAGAIN'), makeFsWriteError('EWOULDBLOCK'), makeFsWriteError('EINTR'), - fsWriteAsyncReal + fsWriteAsyncReal, ) await unixWrite({ binding: mock, buffer: writeBuffer, fsWriteAsync }) @@ -128,7 +130,7 @@ describe('unixWrite', () => { }) it('rejects an error if port closes after read a retryable error', async () => { const writeBuffer = Buffer.alloc(8, 0) - const fsWriteAsync = () => { + const fsWriteAsync: any = () => { mock.isOpen = false makeFsWriteError('EAGAIN')() } diff --git a/lib/unix-write.js b/lib/unix-write.ts similarity index 64% rename from lib/unix-write.js rename to lib/unix-write.ts index dd8cd34..23028a0 100644 --- a/lib/unix-write.js +++ b/lib/unix-write.ts @@ -1,20 +1,29 @@ -const fs = require('fs') -const debug = require('debug') -const logger = debug('serialport/bindings/unixWrite') -const { promisify } = require('util') +import { write } from 'fs' +import debugFactory from 'debug' +import { promisify } from 'util' +import { LinuxBinding } from './linux' +import { DarwinBinding } from './darwin' +const logger = debugFactory('serialport/bindings-cpp/unixWrite') -const writeAsync = promisify(fs.write) +const writeAsync = promisify(write) -const writable = binding => { - return new Promise((resolve, reject) => { - binding.poller.once('writable', err => (err ? reject(err) : resolve())) +const writable = (binding: LinuxBinding | DarwinBinding) => { + return new Promise((resolve, reject) => { + binding.poller?.once('writable', err => (err ? reject(err) : resolve())) }) } -const unixWrite = async ({ binding, buffer, offset = 0, fsWriteAsync = writeAsync }) => { +interface UnixWriteOptions { + binding: LinuxBinding | DarwinBinding + buffer: Buffer + offset?: number + fsWriteAsync?: typeof writeAsync +} + +export const unixWrite = async ({ binding, buffer, offset = 0, fsWriteAsync = writeAsync }: UnixWriteOptions): Promise => { const bytesToWrite = buffer.length - offset logger('Starting write', buffer.length, 'bytes offset', offset, 'bytesToWrite', bytesToWrite) - if (!binding.isOpen) { + if (!binding.isOpen || !binding.fd) { throw new Error('Port is not open') } try { @@ -54,4 +63,3 @@ const unixWrite = async ({ binding, buffer, offset = 0, fsWriteAsync = writeAsyn throw err } } -module.exports = unixWrite diff --git a/lib/win32-sn-parser.js b/lib/win32-sn-parser.ts similarity index 81% rename from lib/win32-sn-parser.js rename to lib/win32-sn-parser.ts index 6322f6b..06e16c7 100644 --- a/lib/win32-sn-parser.js +++ b/lib/win32-sn-parser.ts @@ -1,6 +1,6 @@ const PARSERS = [/USB\\(?:.+)\\(.+)/, /FTDIBUS\\(?:.+)\+(.+?)A?\\.+/] -module.exports = pnpId => { +export const serialNumParser = (pnpId?: string) => { if (!pnpId) { return null } diff --git a/lib/win32.js b/lib/win32.js deleted file mode 100644 index 53bd0ef..0000000 --- a/lib/win32.js +++ /dev/null @@ -1,124 +0,0 @@ -const { join } = require('path') -const binding = require('node-gyp-build')(join(__dirname, '../')) -const AbstractBinding = require('@serialport/binding-abstract') -const { promisify } = require('util') -const serialNumParser = require('./win32-sn-parser') - -const asyncList = promisify(binding.list) -const asyncOpen = promisify(binding.open) -const asyncClose = promisify(binding.close) -const asyncRead = promisify(binding.read) -const asyncWrite = promisify(binding.write) -const asyncUpdate = promisify(binding.update) -const asyncSet = promisify(binding.set) -const asyncGet = promisify(binding.get) -const asyncGetBaudRate = promisify(binding.getBaudRate) -const asyncDrain = promisify(binding.drain) -const asyncFlush = promisify(binding.flush) -const { wrapWithHiddenComName } = require('./legacy') - -/** - * The Windows binding layer - */ -class WindowsBinding extends AbstractBinding { - static async list() { - const ports = await asyncList() - // Grab the serial number from the pnp id - return wrapWithHiddenComName( - ports.map(port => { - if (port.pnpId && !port.serialNumber) { - const serialNumber = serialNumParser(port.pnpId) - if (serialNumber) { - return { - ...port, - serialNumber, - } - } - } - return port - }) - ) - } - - constructor(opt = {}) { - super(opt) - this.bindingOptions = { ...opt.bindingOptions } - this.fd = null - this.writeOperation = null - } - - get isOpen() { - return this.fd !== null - } - - async open(path, options) { - await super.open(path, options) - this.openOptions = { ...this.bindingOptions, ...options } - const fd = await asyncOpen(path, this.openOptions) - this.fd = fd - } - - async close() { - await super.close() - const fd = this.fd - this.fd = null - return asyncClose(fd) - } - - async read(buffer, offset, length) { - await super.read(buffer, offset, length) - try { - const bytesRead = await asyncRead(this.fd, buffer, offset, length) - return { bytesRead, buffer } - } catch (err) { - if (!this.isOpen) { - err.canceled = true - } - throw err - } - } - - async write(buffer) { - this.writeOperation = super.write(buffer).then(async () => { - if (buffer.length === 0) { - return - } - await asyncWrite(this.fd, buffer) - this.writeOperation = null - }) - return this.writeOperation - } - - async update(options) { - await super.update(options) - return asyncUpdate(this.fd, options) - } - - async set(options) { - await super.set(options) - return asyncSet(this.fd, options) - } - - async get() { - await super.get() - return asyncGet(this.fd) - } - - async getBaudRate() { - await super.get() - return asyncGetBaudRate(this.fd) - } - - async drain() { - await super.drain() - await this.writeOperation - return asyncDrain(this.fd) - } - - async flush() { - await super.flush() - return asyncFlush(this.fd) - } -} - -module.exports = WindowsBinding diff --git a/lib/win32.ts b/lib/win32.ts new file mode 100644 index 0000000..56845e6 --- /dev/null +++ b/lib/win32.ts @@ -0,0 +1,188 @@ +import debugFactory from 'debug' +import { BindingInterface, OpenOptions, PortInfo, PortStatus, SetOptions, UpdateOptions } from './binding-interface' +import { asyncClose, asyncDrain, asyncFlush, asyncGet, asyncGetBaudRate, asyncList, asyncOpen, asyncRead, asyncSet, asyncUpdate, asyncWrite } from './load-bindings' +import { serialNumParser } from './win32-sn-parser' + +const debug = debugFactory('serialport/bindings-cpp') + +/** + * The Windows binding layer + */ +export class WindowsBinding extends BindingInterface { + fd: null | number + writeOperation: Promise | null + openOptions: OpenOptions | null + + static async list() { + const ports: PortInfo[] = await asyncList() + // Grab the serial number from the pnp id + return ports.map(port => { + if (port.pnpId && !port.serialNumber) { + const serialNumber = serialNumParser(port.pnpId) + if (serialNumber) { + return { + ...port, + serialNumber, + } + } + } + return port + }) + } + + constructor() { + super() + this.fd = null + this.writeOperation = null + } + + get isOpen() { + return this.fd !== null + } + + async open(path: string, options?: OpenOptions) { + if (!path) { + throw new TypeError('"path" is not a valid port') + } + + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('open') + + if (this.isOpen) { + throw new Error('Already open') + } + this.openOptions = { ...options } + const fd = await asyncOpen(path, this.openOptions) + this.fd = fd + } + + async close(): Promise { + debug('close') + if (!this.isOpen) { + throw new Error('Port is not open') + } + + const fd = this.fd + this.fd = null + await asyncClose(fd) + } + + async read(buffer: Buffer, offset: number, length: number): Promise<{ + buffer: Buffer + bytesRead: number + }> { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + if (typeof offset !== 'number' || isNaN(offset)) { + throw new TypeError(`"offset" is not an integer got "${isNaN(offset) ? 'NaN' : typeof offset}"`) + } + + if (typeof length !== 'number' || isNaN(length)) { + throw new TypeError(`"length" is not an integer got "${isNaN(length) ? 'NaN' : typeof length}"`) + } + + debug('read') + if (buffer.length < offset + length) { + throw new Error('buffer is too small') + } + + if (!this.isOpen) { + throw new Error('Port is not open') + } + try { + const bytesRead = await asyncRead(this.fd, buffer, offset, length) + return { bytesRead, buffer } + } catch (err) { + if (!this.isOpen) { + err.canceled = true + } + throw err + } + } + + async write(buffer: Buffer): Promise { + if (!Buffer.isBuffer(buffer)) { + throw new TypeError('"buffer" is not a Buffer') + } + + debug('write', buffer.length, 'bytes') + if (!this.isOpen) { + debug('write', 'error port is not open') + + throw new Error('Port is not open') + } + + this.writeOperation = (async () => { + if (buffer.length === 0) { + return + } + await asyncWrite(this.fd, buffer) + this.writeOperation = null + })() + return this.writeOperation + } + + async update(options: UpdateOptions): Promise { + if (typeof options !== 'object') { + throw TypeError('"options" is not an object') + } + + if (typeof options.baudRate !== 'number') { + throw new TypeError('"options.baudRate" is not a number') + } + + debug('update') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncUpdate(this.fd, options) + } + + async set(options: SetOptions): Promise { + if (typeof options !== 'object') { + throw new TypeError('"options" is not an object') + } + debug('set', options) + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncSet(this.fd, options) + } + + async get(): Promise { + debug('get') + if (!this.isOpen) { + throw new Error('Port is not open') + } + return asyncGet(this.fd) + } + + async getBaudRate(): Promise<{ baudRate: number }> { + debug('getBaudRate') + if (!this.isOpen) { + throw new Error('Port is not open') + } + return asyncGetBaudRate(this.fd) + } + + async flush(): Promise { + debug('flush') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await asyncFlush(this.fd) + } + + async drain(): Promise { + debug('drain') + if (!this.isOpen) { + throw new Error('Port is not open') + } + await this.writeOperation + await asyncDrain(this.fd) + } +} diff --git a/package-lock.json b/package-lock.json index 5cd14ef..a3a12bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,17 +19,19 @@ "devDependencies": { "@semantic-release/exec": "^6.0.3", "@serialport/binding-mock": "10.0.1", + "@types/chai": "^4.3.0", + "@types/chai-subset": "^1.3.3", + "@types/debug": "^4.1.7", + "@types/mocha": "^9.0.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", "cc": "^3.0.1", "chai": "^4.3.4", "chai-subset": "^1.6.0", "codecov": "^3.8.3", + "esbuild": "^0.14.12", + "esbuild-register": "^3.3.2", "eslint": "^8.2.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-mocha": "^9.0.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-promise": "^5.1.1", "mocha": "^9.1.3", "node-abi": "3.5.0", "node-gyp": "^7.1.2", @@ -37,10 +39,9 @@ "plop": "^2.7.6", "prebuildify": "^5.0.0", "prebuildify-cross": "^4.0.2", - "prettier": "^2.4.1", - "proxyquire": "^2.1.3", "semantic-release": "^18.0.1", - "sinon": "^12.0.1" + "sinon": "^12.0.1", + "typescript": "^4.5.4" }, "engines": { "node": ">=12.17.0 <13.0 || >=14.0.0" @@ -1066,6 +1067,30 @@ "node": ">= 6" } }, + "node_modules/@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true + }, + "node_modules/@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/debug": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", + "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", + "dev": true, + "dependencies": { + "@types/ms": "*" + } + }, "node_modules/@types/fined": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@types/fined/-/fined-1.1.3.tgz", @@ -1101,10 +1126,10 @@ "@types/node": "*" } }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "node_modules/@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, "node_modules/@types/liftoff": { @@ -1130,6 +1155,18 @@ "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", "dev": true }, + "node_modules/@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, + "node_modules/@types/ms": { + "version": "0.7.31", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", + "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==", + "dev": true + }, "node_modules/@types/node": { "version": "17.0.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.4.tgz", @@ -1163,6 +1200,212 @@ "@types/node": "*" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "debug": "^4.3.2" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.10.0", + "eslint-visitor-keys": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -1797,25 +2040,6 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, - "node_modules/array-includes": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", - "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", @@ -1843,23 +2067,6 @@ "node": ">=0.10.0" } }, - "node_modules/array.prototype.flat": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", - "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -2499,19 +2706,6 @@ "node": ">=8" } }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3487,18 +3681,6 @@ "clone": "^1.0.2" } }, - "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "dependencies": { - "object-keys": "^1.0.12" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -4020,63 +4202,285 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, + "node_modules/esbuild": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.12.tgz", + "integrity": "sha512-o1vQkG+eSDLkWDqWfR8v6eI+byGAUkbRs30eAJcJxUFp3dwMGWR0tAjtam1Bb1RSS2j+4kAUFiuJTnW3J4CYcw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "optionalDependencies": { + "esbuild-android-arm64": "0.14.12", + "esbuild-darwin-64": "0.14.12", + "esbuild-darwin-arm64": "0.14.12", + "esbuild-freebsd-64": "0.14.12", + "esbuild-freebsd-arm64": "0.14.12", + "esbuild-linux-32": "0.14.12", + "esbuild-linux-64": "0.14.12", + "esbuild-linux-arm": "0.14.12", + "esbuild-linux-arm64": "0.14.12", + "esbuild-linux-mips64le": "0.14.12", + "esbuild-linux-ppc64le": "0.14.12", + "esbuild-linux-s390x": "0.14.12", + "esbuild-netbsd-64": "0.14.12", + "esbuild-openbsd-64": "0.14.12", + "esbuild-sunos-64": "0.14.12", + "esbuild-windows-32": "0.14.12", + "esbuild-windows-64": "0.14.12", + "esbuild-windows-arm64": "0.14.12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.12.tgz", + "integrity": "sha512-eO4JHwnTeJq1/xC9K0FdHNEYztwT0HaWHnOzR5kXKwJxHatxDNZ+lCHOSxMzh9uVSmnA8YwdSiXPWbwTlWZVrw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.12.tgz", + "integrity": "sha512-LyZ81assnJWhq2IxKEVipwddKlXLTubbz/IObyKOm5cWS9jQCpuwQey2PpzroWSiy7QLGV8XCGWY5b8U8fsmWA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.12.tgz", + "integrity": "sha512-jj27iSbDS4KlftN1PHHNiTrtXPQIk11J/qpQiQLwKJpeEMNeJUBfQlS7X7dXgFFMxV0rNtcRl8AimEFl+qEMRQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.12.tgz", + "integrity": "sha512-RnTty09bA8Ts/eWnrJsYiE2dFM6ZseKYQ/7QCM5QYphU6GbifooO9oGjc/UE3Sg8R58yZVO15vnIV0i+kTgDOw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.12.tgz", + "integrity": "sha512-AvAQoEgsHE53hucgoVWdHnXJBl0r9W/7eUCaBvpcgYu3W/EbPZ26VnZwfSXLpk0Pf3t7o6SRwrU+KDTKPscDTw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.12.tgz", + "integrity": "sha512-na4I5i2c9ACPuglfYmrnJ6qGQnFJb59dFjyFk5OHTCtoKCq3lXbGHrvYa+3sYlOrRax1kYuRDRGse7YsDLbr3Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.12.tgz", + "integrity": "sha512-ObPoYGakJLx/RldQsFQiwsQ7N9YbQ4LLazHtpKx34bjqFjhqO5JiHPVAJYCmAtci3cJMsZ5DtEFXvijytTBz1g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.12.tgz", + "integrity": "sha512-tD4q/zVUeYkThGehYAJQElo80+ysxvq5vpd2QvykDp4hvIidEUJu2hf+NzG5OuMJSQJmAeAWPrkFOXN+6di9cA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.12.tgz", + "integrity": "sha512-i1/ikCl9gG9yx6QuI+8yJMk9XHUu8ekIQOo6cex2pDqXY5KVHSXDTAT4FDWOd5YXQ1QTjneBAQHcKGft4pd6PQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.12.tgz", + "integrity": "sha512-+/a6/tiKUCENep8ryUR75Jba4znG51Sb75OzKT6phZFEkB7fao4+GZD39Zxx3EaaA5OC10MsJPjJMFrn0dMusg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.12.tgz", + "integrity": "sha512-SD7e2VLza/cEU2qKuD18Ibt1V0h3TUuerC1Mp3jRJ4RRGXWAyUt4gUpqKSiB7R0rHe6LWECdLbeVFAuGEntCeA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.12.tgz", + "integrity": "sha512-KZmjYgAvYUpPBG0v6xv8qCngbfcRKC2AdYx3H3j3VqJfICgjt5XYsyG7ntWdc8Rdw9jZxr9sni6othy2Rp/T+A==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.12.tgz", + "integrity": "sha512-dG+hbCIJC65fHqzkTEYbrPSYG3m8pEaI9A1VDtqHfV13Oiw9/tua1odd47iwoWvTyurErb49wanHsIAKb8/2oQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ] + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.12.tgz", + "integrity": "sha512-W3SwxnMjJR3HtBD0aij5WPd0ow2bRB5BsW6FjhN7FgwDBQ+jgniFs1dq54HOkjQ2qBJrt8JvPDFAxacWjdD6Jw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/esbuild-register": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.3.2.tgz", + "integrity": "sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==", + "dev": true, + "peerDependencies": { + "esbuild": ">=0.12 <1" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.12.tgz", + "integrity": "sha512-jU/IcTFwvUtt21wOmqKJrevyHQ5XRfiCdFbPie4wsYr8VFcPZZsz18A9lcoI8gZdrF/8pBdD0V+L2UuUY0KsGg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ] + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.12.tgz", + "integrity": "sha512-6luae9cmTB0rSPMCQFWMgf0SLNZ9hxusoS0poVEUHJf3n8bW6wgdyLE2xfYcEcXPMsjAt2e71/etkpqlFxeuYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.12.tgz", + "integrity": "sha512-CdCXvME/7s0uMt+4rYd8d5roHJJ5k2VDOzWaOMWExjroet+nSSZngfLpxI5St+28lXLeBorUxeBS+p1qcfEDfw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.12.tgz", + "integrity": "sha512-vNuLQh/MpYDepK0GNpEWHy0Kn7Jf3Shz/Xetf8hUIc31jgCR1qbLVLDf3ckQdanD2U430YZupOGtEZKRwno79w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -4153,259 +4557,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-config-prettier": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", - "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", - "dev": true, - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", - "dev": true, - "dependencies": { - "debug": "^3.2.7", - "resolve": "^1.20.0" - } - }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-module-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", - "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", - "dev": true, - "dependencies": { - "debug": "^3.2.7", - "find-up": "^2.1.0", - "pkg-dir": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-es": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", - "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", - "dev": true, - "dependencies": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=4.19.1" - } - }, - "node_modules/eslint-plugin-es/node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-plugin-import": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz", - "integrity": "sha512-RzAVbby+72IB3iOEL8clzPLzL3wpDrlwjsTBAQXgyp5SeTqqY+0bFubwuo+y/HLhNZcXV4XqTBO4LGsfyHIDXg==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.1", - "has": "^1.0.3", - "is-core-module": "^2.8.0", - "is-glob": "^4.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.5", - "resolve": "^1.20.0", - "tsconfig-paths": "^3.11.0" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" - } - }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eslint-plugin-import/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "node_modules/eslint-plugin-mocha": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-9.0.0.tgz", - "integrity": "sha512-d7knAcQj1jPCzZf3caeBIn3BnW6ikcvfz0kSqQpwPYcVGLoJV5sz0l0OJB2LR8I7dvTDbqq1oV6ylhSgzA10zg==", - "dev": true, - "dependencies": { - "eslint-utils": "^3.0.0", - "ramda": "^0.27.1" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-node": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", - "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", - "dev": true, - "dependencies": { - "eslint-plugin-es": "^3.0.0", - "eslint-utils": "^2.0.0", - "ignore": "^5.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.10.1", - "semver": "^6.1.0" - }, - "engines": { - "node": ">=8.10.0" - }, - "peerDependencies": { - "eslint": ">=5.16.0" - } - }, - "node_modules/eslint-plugin-node/node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint-plugin-node/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-plugin-node/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/eslint-plugin-prettier": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz", - "integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==", - "dev": true, - "dependencies": { - "prettier-linter-helpers": "^1.0.0" - }, - "engines": { - "node": ">=6.0.0" - }, - "peerDependencies": { - "eslint": ">=7.28.0", - "prettier": ">=2.0.0" - }, - "peerDependenciesMeta": { - "eslint-config-prettier": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-promise": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz", - "integrity": "sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==", - "dev": true, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "peerDependencies": { - "eslint": "^7.0.0" - } - }, "node_modules/eslint-scope": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", @@ -4851,12 +5002,6 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, - "node_modules/fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, "node_modules/fast-glob": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", @@ -4963,19 +5108,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/fill-keys": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", - "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", - "dev": true, - "dependencies": { - "is-object": "~1.0.1", - "merge-descriptors": "~1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -5628,20 +5760,6 @@ "node": "*" } }, - "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -5672,22 +5790,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -5985,15 +6087,6 @@ "node": ">=0.10.0" } }, - "node_modules/has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -6003,33 +6096,6 @@ "node": ">=8" } }, - "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -6524,20 +6590,6 @@ "xtend": "~4.0.1" } }, - "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", @@ -6594,18 +6646,6 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, - "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -6618,40 +6658,12 @@ "node": ">=8" } }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, - "node_modules/is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", @@ -6676,21 +6688,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", @@ -6780,18 +6777,6 @@ "lower-case": "^1.1.0" } }, - "node_modules/is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -6801,21 +6786,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", @@ -6825,15 +6795,6 @@ "node": ">=8" } }, - "node_modules/is-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", - "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", @@ -6870,22 +6831,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", @@ -6898,15 +6843,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -6919,36 +6855,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -7006,18 +6912,6 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, - "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -7930,12 +7824,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", - "dev": true - }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -8407,12 +8295,6 @@ "xtend": "~4.0.1" } }, - "node_modules/module-not-found-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", - "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", - "dev": true - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -11977,24 +11859,6 @@ "node": ">=0.10.0" } }, - "node_modules/object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -12007,24 +11871,6 @@ "node": ">=0.10.0" } }, - "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object.defaults": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", @@ -12065,23 +11911,6 @@ "node": ">=0.10.0" } }, - "node_modules/object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -12854,18 +12683,6 @@ "node": ">=0.10" } }, - "node_modules/pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "dependencies": { - "find-up": "^2.1.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/plop": { "version": "2.7.6", "resolved": "https://registry.npmjs.org/plop/-/plop-2.7.6.tgz", @@ -13025,30 +12842,6 @@ "node": ">= 0.8.0" } }, - "node_modules/prettier": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", - "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "dependencies": { - "fast-diff": "^1.1.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -13097,17 +12890,6 @@ "node": ">=0.4.0" } }, - "node_modules/proxyquire": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", - "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==", - "dev": true, - "dependencies": { - "fill-keys": "^1.0.2", - "module-not-found-error": "^1.0.1", - "resolve": "^1.11.1" - } - }, "node_modules/psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -13220,12 +13002,6 @@ "node": ">=8" } }, - "node_modules/ramda": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", - "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", - "dev": true - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -14057,20 +13833,6 @@ "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==", "dev": true }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/signal-exit": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", @@ -14459,6 +14221,7 @@ "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", "dev": true, "dependencies": { "atob": "^2.1.2", @@ -14472,6 +14235,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", + "deprecated": "See https://github.com/lydell/source-map-url#deprecated", "dev": true }, "node_modules/spawn-error-forwarder": { @@ -14882,32 +14646,6 @@ "node": ">=8" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -15406,45 +15144,27 @@ "node": ">=8" } }, - "node_modules/tsconfig-paths": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", - "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", - "dev": true, - "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.0", - "strip-bom": "^3.0.0" - } - }, - "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, - "node_modules/tsconfig-paths/node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, "node_modules/tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -15517,6 +15237,19 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/uglify-js": { "version": "3.14.5", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz", @@ -15539,21 +15272,6 @@ "umd": "bin/cli.js" } }, - "node_modules/unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -15900,22 +15618,6 @@ "node": ">= 8" } }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", @@ -16914,6 +16616,30 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true + }, + "@types/chai-subset": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz", + "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==", + "dev": true, + "requires": { + "@types/chai": "*" + } + }, + "@types/debug": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", + "integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==", + "dev": true, + "requires": { + "@types/ms": "*" + } + }, "@types/fined": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@types/fined/-/fined-1.1.3.tgz", @@ -16949,10 +16675,10 @@ "@types/node": "*" } }, - "@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, "@types/liftoff": { @@ -16978,6 +16704,18 @@ "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", "dev": true }, + "@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, + "@types/ms": { + "version": "0.7.31", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz", + "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==", + "dev": true + }, "@types/node": { "version": "17.0.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.4.tgz", @@ -17011,6 +16749,119 @@ "@types/node": "*" } }, + "@typescript-eslint/eslint-plugin": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "debug": "^4.3.2" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.10.0", + "eslint-visitor-keys": "^3.0.0" + } + }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -17512,19 +17363,6 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, - "array-includes": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", - "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1", - "get-intrinsic": "^1.1.1", - "is-string": "^1.0.7" - } - }, "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", @@ -17543,17 +17381,6 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, - "array.prototype.flat": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", - "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0" - } - }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -18105,16 +17932,6 @@ "write-file-atomic": "^3.0.0" } }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -18906,15 +18723,6 @@ "clone": "^1.0.2" } }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, "define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -19389,51 +19197,171 @@ "is-arrayish": "^0.2.1" } }, - "es-abstract": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", - "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, "es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, + "esbuild": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.12.tgz", + "integrity": "sha512-o1vQkG+eSDLkWDqWfR8v6eI+byGAUkbRs30eAJcJxUFp3dwMGWR0tAjtam1Bb1RSS2j+4kAUFiuJTnW3J4CYcw==", + "dev": true, + "requires": { + "esbuild-android-arm64": "0.14.12", + "esbuild-darwin-64": "0.14.12", + "esbuild-darwin-arm64": "0.14.12", + "esbuild-freebsd-64": "0.14.12", + "esbuild-freebsd-arm64": "0.14.12", + "esbuild-linux-32": "0.14.12", + "esbuild-linux-64": "0.14.12", + "esbuild-linux-arm": "0.14.12", + "esbuild-linux-arm64": "0.14.12", + "esbuild-linux-mips64le": "0.14.12", + "esbuild-linux-ppc64le": "0.14.12", + "esbuild-linux-s390x": "0.14.12", + "esbuild-netbsd-64": "0.14.12", + "esbuild-openbsd-64": "0.14.12", + "esbuild-sunos-64": "0.14.12", + "esbuild-windows-32": "0.14.12", + "esbuild-windows-64": "0.14.12", + "esbuild-windows-arm64": "0.14.12" + } + }, + "esbuild-android-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.12.tgz", + "integrity": "sha512-eO4JHwnTeJq1/xC9K0FdHNEYztwT0HaWHnOzR5kXKwJxHatxDNZ+lCHOSxMzh9uVSmnA8YwdSiXPWbwTlWZVrw==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.12.tgz", + "integrity": "sha512-LyZ81assnJWhq2IxKEVipwddKlXLTubbz/IObyKOm5cWS9jQCpuwQey2PpzroWSiy7QLGV8XCGWY5b8U8fsmWA==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.12.tgz", + "integrity": "sha512-jj27iSbDS4KlftN1PHHNiTrtXPQIk11J/qpQiQLwKJpeEMNeJUBfQlS7X7dXgFFMxV0rNtcRl8AimEFl+qEMRQ==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.12.tgz", + "integrity": "sha512-RnTty09bA8Ts/eWnrJsYiE2dFM6ZseKYQ/7QCM5QYphU6GbifooO9oGjc/UE3Sg8R58yZVO15vnIV0i+kTgDOw==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.12.tgz", + "integrity": "sha512-AvAQoEgsHE53hucgoVWdHnXJBl0r9W/7eUCaBvpcgYu3W/EbPZ26VnZwfSXLpk0Pf3t7o6SRwrU+KDTKPscDTw==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.12.tgz", + "integrity": "sha512-na4I5i2c9ACPuglfYmrnJ6qGQnFJb59dFjyFk5OHTCtoKCq3lXbGHrvYa+3sYlOrRax1kYuRDRGse7YsDLbr3Q==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.12.tgz", + "integrity": "sha512-ObPoYGakJLx/RldQsFQiwsQ7N9YbQ4LLazHtpKx34bjqFjhqO5JiHPVAJYCmAtci3cJMsZ5DtEFXvijytTBz1g==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.12.tgz", + "integrity": "sha512-tD4q/zVUeYkThGehYAJQElo80+ysxvq5vpd2QvykDp4hvIidEUJu2hf+NzG5OuMJSQJmAeAWPrkFOXN+6di9cA==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.12.tgz", + "integrity": "sha512-i1/ikCl9gG9yx6QuI+8yJMk9XHUu8ekIQOo6cex2pDqXY5KVHSXDTAT4FDWOd5YXQ1QTjneBAQHcKGft4pd6PQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.12.tgz", + "integrity": "sha512-+/a6/tiKUCENep8ryUR75Jba4znG51Sb75OzKT6phZFEkB7fao4+GZD39Zxx3EaaA5OC10MsJPjJMFrn0dMusg==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.12.tgz", + "integrity": "sha512-SD7e2VLza/cEU2qKuD18Ibt1V0h3TUuerC1Mp3jRJ4RRGXWAyUt4gUpqKSiB7R0rHe6LWECdLbeVFAuGEntCeA==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.12.tgz", + "integrity": "sha512-KZmjYgAvYUpPBG0v6xv8qCngbfcRKC2AdYx3H3j3VqJfICgjt5XYsyG7ntWdc8Rdw9jZxr9sni6othy2Rp/T+A==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.12.tgz", + "integrity": "sha512-dG+hbCIJC65fHqzkTEYbrPSYG3m8pEaI9A1VDtqHfV13Oiw9/tua1odd47iwoWvTyurErb49wanHsIAKb8/2oQ==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.12.tgz", + "integrity": "sha512-W3SwxnMjJR3HtBD0aij5WPd0ow2bRB5BsW6FjhN7FgwDBQ+jgniFs1dq54HOkjQ2qBJrt8JvPDFAxacWjdD6Jw==", + "dev": true, + "optional": true + }, + "esbuild-register": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.3.2.tgz", + "integrity": "sha512-jceAtTO6zxPmCfSD5cBb3rgIK1vmuqCKYwgylHiS1BF4pq0jJiJb4K2QMuqF4BEw7XDBRatYzip0upyTzfkgsQ==", + "dev": true, + "requires": {} + }, + "esbuild-sunos-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.12.tgz", + "integrity": "sha512-jU/IcTFwvUtt21wOmqKJrevyHQ5XRfiCdFbPie4wsYr8VFcPZZsz18A9lcoI8gZdrF/8pBdD0V+L2UuUY0KsGg==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.12.tgz", + "integrity": "sha512-6luae9cmTB0rSPMCQFWMgf0SLNZ9hxusoS0poVEUHJf3n8bW6wgdyLE2xfYcEcXPMsjAt2e71/etkpqlFxeuYg==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.12.tgz", + "integrity": "sha512-CdCXvME/7s0uMt+4rYd8d5roHJJ5k2VDOzWaOMWExjroet+nSSZngfLpxI5St+28lXLeBorUxeBS+p1qcfEDfw==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.12.tgz", + "integrity": "sha512-vNuLQh/MpYDepK0GNpEWHy0Kn7Jf3Shz/Xetf8hUIc31jgCR1qbLVLDf3ckQdanD2U430YZupOGtEZKRwno79w==", + "dev": true, + "optional": true + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -19515,193 +19443,6 @@ } } }, - "eslint-config-prettier": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz", - "integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==", - "dev": true, - "requires": {} - }, - "eslint-import-resolver-node": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", - "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", - "dev": true, - "requires": { - "debug": "^3.2.7", - "resolve": "^1.20.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "eslint-module-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", - "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", - "dev": true, - "requires": { - "debug": "^3.2.7", - "find-up": "^2.1.0", - "pkg-dir": "^2.0.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "eslint-plugin-es": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", - "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", - "dev": true, - "requires": { - "eslint-utils": "^2.0.0", - "regexpp": "^3.0.0" - }, - "dependencies": { - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "eslint-plugin-import": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz", - "integrity": "sha512-RzAVbby+72IB3iOEL8clzPLzL3wpDrlwjsTBAQXgyp5SeTqqY+0bFubwuo+y/HLhNZcXV4XqTBO4LGsfyHIDXg==", - "dev": true, - "requires": { - "array-includes": "^3.1.4", - "array.prototype.flat": "^1.2.5", - "debug": "^2.6.9", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.6", - "eslint-module-utils": "^2.7.1", - "has": "^1.0.3", - "is-core-module": "^2.8.0", - "is-glob": "^4.0.3", - "minimatch": "^3.0.4", - "object.values": "^1.1.5", - "resolve": "^1.20.0", - "tsconfig-paths": "^3.11.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } - } - }, - "eslint-plugin-mocha": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-9.0.0.tgz", - "integrity": "sha512-d7knAcQj1jPCzZf3caeBIn3BnW6ikcvfz0kSqQpwPYcVGLoJV5sz0l0OJB2LR8I7dvTDbqq1oV6ylhSgzA10zg==", - "dev": true, - "requires": { - "eslint-utils": "^3.0.0", - "ramda": "^0.27.1" - } - }, - "eslint-plugin-node": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", - "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", - "dev": true, - "requires": { - "eslint-plugin-es": "^3.0.0", - "eslint-utils": "^2.0.0", - "ignore": "^5.1.1", - "minimatch": "^3.0.4", - "resolve": "^1.10.1", - "semver": "^6.1.0" - }, - "dependencies": { - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - }, - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "eslint-plugin-prettier": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz", - "integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0" - } - }, - "eslint-plugin-promise": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-5.2.0.tgz", - "integrity": "sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==", - "dev": true, - "requires": {} - }, "eslint-scope": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", @@ -20027,12 +19768,6 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, "fast-glob": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", @@ -20127,16 +19862,6 @@ "flat-cache": "^3.0.4" } }, - "fill-keys": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", - "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", - "dev": true, - "requires": { - "is-object": "~1.0.1", - "merge-descriptors": "~1.0.0" - } - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -20652,17 +20377,6 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, "get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -20681,16 +20395,6 @@ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, - "get-symbol-description": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", - "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -20931,33 +20635,12 @@ } } }, - "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "dev": true - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -21348,17 +21031,6 @@ } } }, - "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, "interpret": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", @@ -21400,15 +21072,6 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, - "is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", - "dev": true, - "requires": { - "has-bigints": "^1.0.1" - } - }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -21418,28 +21081,12 @@ "binary-extensions": "^2.0.0" } }, - "is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, - "is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", - "dev": true - }, "is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", @@ -21458,15 +21105,6 @@ "kind-of": "^6.0.0" } }, - "is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-descriptor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", @@ -21534,39 +21172,18 @@ "lower-case": "^1.1.0" } }, - "is-negative-zero": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", - "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true - }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, - "is-number-object": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", - "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, - "is-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", - "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", - "dev": true - }, "is-path-cwd": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", @@ -21591,16 +21208,6 @@ "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", "dev": true }, - "is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", @@ -21610,36 +21217,12 @@ "is-unc-path": "^1.0.0" } }, - "is-shared-array-buffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", - "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", - "dev": true - }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true }, - "is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", @@ -21685,15 +21268,6 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, - "is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2" - } - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -22422,12 +21996,6 @@ } } }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", - "dev": true - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -22795,12 +22363,6 @@ } } }, - "module-not-found-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", - "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", - "dev": true - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -25428,18 +24990,6 @@ } } }, - "object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, "object-visit": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", @@ -25449,18 +24999,6 @@ "isobject": "^3.0.0" } }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, "object.defaults": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", @@ -25492,17 +25030,6 @@ "isobject": "^3.0.1" } }, - "object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -26093,15 +25620,6 @@ "xtend": "^4.0.1" } }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, "plop": { "version": "2.7.6", "resolved": "https://registry.npmjs.org/plop/-/plop-2.7.6.tgz", @@ -26223,21 +25741,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prettier": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", - "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", - "dev": true - }, - "prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, "pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -26271,17 +25774,6 @@ "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "proxyquire": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", - "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==", - "dev": true, - "requires": { - "fill-keys": "^1.0.2", - "module-not-found-error": "^1.0.1", - "resolve": "^1.11.1" - } - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -26362,12 +25854,6 @@ "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true }, - "ramda": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", - "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", - "dev": true - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -27030,17 +26516,6 @@ "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==", "dev": true }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, "signal-exit": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", @@ -27727,26 +27202,6 @@ "strip-ansi": "^6.0.1" } }, - "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -28149,41 +27604,21 @@ "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, - "tsconfig-paths": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", - "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", - "dev": true, - "requires": { - "@types/json5": "^0.0.29", - "json5": "^1.0.1", - "minimist": "^1.2.0", - "strip-bom": "^3.0.0" - }, - "dependencies": { - "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - } - } - }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "tty-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", @@ -28241,6 +27676,12 @@ "is-typedarray": "^1.0.0" } }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, "uglify-js": { "version": "3.14.5", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz", @@ -28254,18 +27695,6 @@ "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", "dev": true }, - "unbox-primitive": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", - "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - } - }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -28562,19 +27991,6 @@ "isexe": "^2.0.0" } }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", - "dev": true, - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", diff --git a/package.json b/package.json index ad5bc4f..829f122 100644 --- a/package.json +++ b/package.json @@ -26,17 +26,19 @@ "devDependencies": { "@semantic-release/exec": "^6.0.3", "@serialport/binding-mock": "10.0.1", + "@types/chai": "^4.3.0", + "@types/chai-subset": "^1.3.3", + "@types/debug": "^4.1.7", + "@types/mocha": "^9.0.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", "cc": "^3.0.1", "chai": "^4.3.4", "chai-subset": "^1.6.0", "codecov": "^3.8.3", + "esbuild": "^0.14.12", + "esbuild-register": "^3.3.2", "eslint": "^8.2.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-mocha": "^9.0.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-promise": "^5.1.1", "mocha": "^9.1.3", "node-abi": "3.5.0", "node-gyp": "^7.1.2", @@ -44,15 +46,15 @@ "plop": "^2.7.6", "prebuildify": "^5.0.0", "prebuildify-cross": "^4.0.2", - "prettier": "^2.4.1", - "proxyquire": "^2.1.3", "semantic-release": "^18.0.1", - "sinon": "^12.0.1" + "sinon": "^12.0.1", + "typescript": "^4.5.4" }, "engines": { "node": ">=12.17.0 <13.0 || >=14.0.0" }, "scripts": { + "build": "rm -rf dist && tsc -p tsconfig-build.json", "install": "node-gyp-build", "prebuild": "prebuildify --napi --target 14.0.0 --force --strip --verbose", "prebuild-cross": "prebuildify-cross --napi --target 14.0.0 --force --strip --verbose", @@ -63,7 +65,8 @@ "test": "nyc --reporter=html --reporter=text --reporter lcovonly mocha", "test:arduino": "TEST_PORT=$(./bin/find-arduino.js) npm test", "test:watch": "mocha -w", - "semantic-release": "semantic-release" + "semantic-release": "semantic-release", + "typecheck": "tsc" }, "publishConfig": { "access": "public" @@ -99,5 +102,12 @@ "docs": "Documentation", "internal": "Chores" } + }, + "mocha": { + "bail": true, + "require": [ + "esbuild-register" + ], + "spec": "lib/**/*.test.*" } } diff --git a/src/serialport.h b/src/serialport.h index 7f40161..d67d701 100644 --- a/src/serialport.h +++ b/src/serialport.h @@ -50,7 +50,7 @@ SerialPortParity ToParityEnum(const Napi::String& str); SerialPortStopBits ToStopBitEnum(double stopBits); struct OpenBaton : public Napi::AsyncWorker { - OpenBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:OpenBaton"), + OpenBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:OpenBaton"), errorString(), path() {} char errorString[ERROR_STRING_SIZE]; char path[1024]; @@ -62,7 +62,6 @@ struct OpenBaton : public Napi::AsyncWorker { bool xon = false; bool xoff = false; bool xany = false; - bool dsrdtr = false; bool hupcl = false; bool lock = false; SerialPortParity parity; @@ -88,7 +87,7 @@ struct ConnectionOptions { }; struct ConnectionOptionsBaton : ConnectionOptions , Napi::AsyncWorker { ConnectionOptionsBaton(Napi::Function& callback) : ConnectionOptions() , Napi::AsyncWorker(callback, "node-serialport:ConnectionOptionsBaton") {} - + void Execute() override; void OnOK() override { @@ -99,7 +98,7 @@ struct ConnectionOptionsBaton : ConnectionOptions , Napi::AsyncWorker { }; struct SetBaton : public Napi::AsyncWorker { - SetBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:SetBaton"), + SetBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:SetBaton"), errorString() {} int fd = 0; int result = 0; @@ -121,7 +120,7 @@ struct SetBaton : public Napi::AsyncWorker { }; struct GetBaton : public Napi::AsyncWorker { - GetBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:GetBaton"), + GetBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:GetBaton"), errorString() {} int fd = 0; char errorString[ERROR_STRING_SIZE]; @@ -145,12 +144,12 @@ struct GetBaton : public Napi::AsyncWorker { }; struct GetBaudRateBaton : public Napi::AsyncWorker { - GetBaudRateBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:GetBaudRateBaton"), + GetBaudRateBaton(Napi::Function& callback) : Napi::AsyncWorker(callback, "node-serialport:GetBaudRateBaton"), errorString() {} int fd = 0; char errorString[ERROR_STRING_SIZE]; int baudRate = 0; - + void Execute() override; void OnOK() override { @@ -163,7 +162,7 @@ struct GetBaudRateBaton : public Napi::AsyncWorker { }; struct VoidBaton : public Napi::AsyncWorker { - VoidBaton(Napi::Function& callback, const char *resource_name) : Napi::AsyncWorker(callback, resource_name), + VoidBaton(Napi::Function& callback, const char *resource_name) : Napi::AsyncWorker(callback, resource_name), errorString() {} int fd = 0; char errorString[ERROR_STRING_SIZE]; diff --git a/test/assert.ts b/test/assert.ts new file mode 100644 index 0000000..c5f56fc --- /dev/null +++ b/test/assert.ts @@ -0,0 +1,15 @@ +import { assert, use } from 'chai' +import chaiSubset from 'chai-subset' +use(chaiSubset) + +export const shouldReject = async (promise: Promise, errType = Error, message = 'Should have rejected') => { + try { + await promise + } catch (err) { + assert.instanceOf(err, errType) + return err + } + throw new Error(message) +} + +export { assert } diff --git a/test/test-config.json b/test/config.json similarity index 100% rename from test/test-config.json rename to test/config.json diff --git a/test/initializers/assert-reject.js b/test/initializers/assert-reject.js deleted file mode 100644 index ceea60c..0000000 --- a/test/initializers/assert-reject.js +++ /dev/null @@ -1,9 +0,0 @@ -global.shouldReject = async (promise, errType = Error, message = 'Should have rejected') => { - try { - await promise - } catch (err) { - assert.instanceOf(err, errType) - return err - } - throw new Error(message) -} diff --git a/test/initializers/assert.js b/test/initializers/assert.js deleted file mode 100644 index 036e18c..0000000 --- a/test/initializers/assert.js +++ /dev/null @@ -1,4 +0,0 @@ -const chai = require('chai') -const chaiSubset = require('chai-subset') -global.assert = chai.assert -chai.use(chaiSubset) diff --git a/test/initializers/index.js b/test/initializers/index.js deleted file mode 100644 index 485ffff..0000000 --- a/test/initializers/index.js +++ /dev/null @@ -1,6 +0,0 @@ -const fs = require('fs') -const files = fs.readdirSync(__dirname).filter(file => file !== 'index.js' && file.match(/\.js$/)) -files.forEach(file => { - console.log(`Loading ${file}`) - require(`./${file}`) -}) diff --git a/test/initializers/test-config.js b/test/initializers/test-config.js deleted file mode 100644 index 2513d2a..0000000 --- a/test/initializers/test-config.js +++ /dev/null @@ -1,11 +0,0 @@ -const testConfig = require('../test-config.json') - -global.makeTestFeature = function makeTestFeature(envName) { - const config = { ...testConfig.all, ...testConfig[envName] } - return function testFeature(feature, description, callback) { - if (config[feature] === false) { - return it(`Feature "${feature}" is disabled in "${envName}. "${description}"`) - } - it(description, callback) - } -} diff --git a/test/makeTestFeature.ts b/test/makeTestFeature.ts new file mode 100644 index 0000000..535b955 --- /dev/null +++ b/test/makeTestFeature.ts @@ -0,0 +1,43 @@ +import testConfig from './config.json' + +export const makeTestFeature = (envName: string, testPort?: string) => { + const config = { ...testConfig.all, ...(testConfig as any)[envName] } + + const testFeature = (feature: string, description: string, callback: () => any) => { + if (config[feature] === false) { + return it(`Feature "${feature}" is disabled in "${envName}. "${description}"`) + } + it(description, callback) + } + + const testHardware = (description: string, callback: () => any) => { + if (!testPort) { + return it(`${description} - Cannot be tested. Set the TEST_PORT env var with an available serialport for more testing.`) + } + it(description, callback) + } + + const testHardwareFeature = (feature: string, description: string, callback: () => any) => { + if (!testPort) { + return it(`${description} - Cannot be tested. Set the TEST_PORT env var with an available serialport for more testing.`) + } + if (config[feature] === false) { + return it(`Feature "${feature}" is disabled in "${envName}. "${description}"`) + } + it(description, callback) + } + + const describeHardware = (description: string, callback: () => any) => { + if (!testPort) { + return it(`${description} - Cannot be tested. Set the TEST_PORT env var with an available serialport for more testing.`) + } + describe(description, callback) + } + + return { + testFeature, + testHardwareFeature, + testHardware, + describeHardware, + } +} diff --git a/tsconfig-build.json b/tsconfig-build.json new file mode 100644 index 0000000..e177b87 --- /dev/null +++ b/tsconfig-build.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "noEmit": false, + "module": "commonjs" + }, + "exclude": [ + "node_modules", + "**/*.test.ts", + "lib/mocks/*" + ] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a20e694 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "noEmit": true, + "allowJs": false, + "target": "es2017", + "moduleResolution": "node", + "module": "commonjs", + "noImplicitAny": true, + "strictNullChecks": true, + "declaration": true, + "importHelpers": false, + "forceConsistentCasingInFileNames": true, + "useUnknownInCatchVariables": false, + "esModuleInterop": true, + "resolveJsonModule": true + }, + "include": [ + "lib/**/*.ts", + ], + "exclude": [ + "node_modules" + ] +}