diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..9a4ac3c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + # versioning-strategy: increase-if-necessary + directory: "/" + schedule: + interval: "weekly" + day: "saturday" + time: "03:00" + timezone: "America/New_York" + - package-ecosystem: "npm" + versioning-strategy: increase-if-necessary + directory: "/" + schedule: + interval: "weekly" + day: "saturday" + time: "03:00" + timezone: "America/New_York" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9468cb..e9cae6f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: name: Lint Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - name: Install Packages run: npm install @@ -29,9 +29,10 @@ jobs: - 10.13.0 - 10.x - 12.x + - 14.x runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} @@ -40,12 +41,12 @@ jobs: - name: Run Tests run: npm run test:ci - name: Coveralls Parallel - uses: coverallsapp/github-action@master + uses: coverallsapp/github-action@v1.1.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} parallel: true - name: Coveralls Finished - uses: coverallsapp/github-action@master + uses: coverallsapp/github-action@v1.1.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true diff --git a/lib/filters/filter.js b/lib/filters/filter.js index 4c7e4ba..3874a45 100644 --- a/lib/filters/filter.js +++ b/lib/filters/filter.js @@ -2,14 +2,10 @@ // var assert = require('assert') -var asn1 = require('asn1') - var Protocol = require('../protocol') /// --- Globals -var BerWriter = asn1.BerWriter - var TYPES = { and: Protocol.FILTER_AND, or: Protocol.FILTER_OR, @@ -38,9 +34,18 @@ function isFilter (filter) { return false } +function isBerWriter (ber) { + return Boolean( + ber && + typeof (ber) === 'object' && + typeof (ber.startSequence) === 'function' && + typeof (ber.endSequence) === 'function' + ) +} + function mixin (target) { target.prototype.toBer = function toBer (ber) { - if (!ber || !(ber instanceof BerWriter)) { throw new TypeError('ber (BerWriter) required') } + if (isBerWriter(ber) === false) { throw new TypeError('ber (BerWriter) required') } ber.startSequence(TYPES[this.type]) ber = this._toBer(ber) diff --git a/lib/logger.js b/lib/logger.js index ad96ba4..1622872 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,6 +1,6 @@ 'use strict' -const logger = Object.create(require('abstract-logging')) +const logger = require('abstract-logging') logger.child = function () { return logger } module.exports = logger diff --git a/package.json b/package.json index 468dc27..bbe83eb 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "ldapjs", "homepage": "http://ldapjs.org", "description": "LDAP client and server APIs", - "version": "2.0.0", + "version": "2.1.0", "license": "MIT", "repository": { "type": "git", @@ -17,7 +17,7 @@ "node": ">=10.13.0" }, "dependencies": { - "abstract-logging": "^1.0.0", + "abstract-logging": "^2.0.0", "asn1": "^0.2.4", "assert-plus": "^1.0.0", "backoff": "^2.5.0", @@ -28,11 +28,10 @@ }, "devDependencies": { "get-port": "^5.1.1", - "husky": "^3.0.4", + "husky": "^4.2.5", "snazzy": "^8.0.0", "standard": "^14.0.2", - "tap": "14.10.1", - "uuid": "^3.3.3" + "tap": "14.10.8" }, "scripts": { "test": "tap --no-cov", diff --git a/test/client.test.js b/test/client.test.js index eed6c39..fca862f 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -3,10 +3,9 @@ const util = require('util') const assert = require('assert') const tap = require('tap') -const uuid = require('uuid') const vasync = require('vasync') const getPort = require('get-port') -const { getSock } = require('./utils') +const { getSock, uuid } = require('./utils') const ldap = require('../lib') const { Attribute, Change } = ldap diff --git a/test/laundry.test.js b/test/laundry.test.js index 796e48c..1c03b6e 100644 --- a/test/laundry.test.js +++ b/test/laundry.test.js @@ -1,8 +1,7 @@ 'use strict' const tap = require('tap') -const uuid = require('uuid') -const { getSock } = require('./utils') +const { getSock, uuid } = require('./utils') const ldap = require('../lib') function search (t, options, callback) { diff --git a/test/utils.js b/test/utils.js index 6d5598b..aea3ea4 100644 --- a/test/utils.js +++ b/test/utils.js @@ -2,7 +2,11 @@ const os = require('os') const path = require('path') -const uuid = require('uuid') +const crypto = require('crypto') + +function uuid () { + return crypto.randomBytes(16).toString('hex') +} function getSock () { if (process.platform === 'win32') { @@ -13,5 +17,6 @@ function getSock () { } module.exports = { - getSock + getSock, + uuid }