express-version-route 1.2.13 → 1.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +10 -9
- package/index.js +3 -3
- package/package.json +16 -13
- package/test/sanity.test.js +1 -1
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
strategy:
|
|
12
12
|
matrix:
|
|
13
13
|
platform: [ubuntu-latest]
|
|
14
|
-
node: ['
|
|
14
|
+
node: ['24.x']
|
|
15
15
|
name: Node ${{ matrix.node }} (${{ matrix.platform }})
|
|
16
16
|
runs-on: ${{ matrix.platform }}
|
|
17
17
|
steps:
|
|
@@ -21,16 +21,17 @@ jobs:
|
|
|
21
21
|
node-version: ${{ matrix.node }}
|
|
22
22
|
- name: install dependencies
|
|
23
23
|
run: yarn install --ignore-engines
|
|
24
|
-
- name: install codecov
|
|
25
|
-
run: npm install -g codecov
|
|
26
24
|
- name: run tests
|
|
27
25
|
run: yarn run test:coverage
|
|
28
|
-
- name:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
- name: coverage
|
|
27
|
+
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
28
|
+
if: github.actor != 'dependabot[bot]'
|
|
29
|
+
with:
|
|
30
|
+
fail_ci_if_error: true
|
|
31
|
+
verbose: false
|
|
32
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
32
33
|
env:
|
|
33
|
-
|
|
34
|
+
CI: true
|
|
34
35
|
|
|
35
36
|
release:
|
|
36
37
|
name: do semantic release
|
|
@@ -46,7 +47,7 @@ jobs:
|
|
|
46
47
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
47
48
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
48
49
|
with:
|
|
49
|
-
node-version: '24'
|
|
50
|
+
node-version: '24.x'
|
|
50
51
|
- name: install dependencies
|
|
51
52
|
run: yarn install --ignore-engines
|
|
52
53
|
- name: release
|
package/index.js
CHANGED
|
@@ -6,8 +6,8 @@ const { RouteVersionUnmatchedError } = require('./errors')
|
|
|
6
6
|
class versionRouter {
|
|
7
7
|
static route (versionsMap = new Map(), options = new Map()) {
|
|
8
8
|
return (req, res, next) => {
|
|
9
|
-
|
|
10
|
-
for (
|
|
9
|
+
const versionArray = []
|
|
10
|
+
for (const [versionKey, versionRouter] of versionsMap) {
|
|
11
11
|
versionArray.push(versionKey)
|
|
12
12
|
if (this.checkVersionMatch(req.version, versionKey)) {
|
|
13
13
|
if (Array.isArray(versionRouter)) {
|
|
@@ -22,7 +22,7 @@ class versionRouter {
|
|
|
22
22
|
if (options.useMaxVersion) {
|
|
23
23
|
const maxVersion = semver.maxSatisfying(versionArray, req.version)
|
|
24
24
|
if (maxVersion) {
|
|
25
|
-
for (
|
|
25
|
+
for (const [versionKey, versionRouter] of versionsMap) {
|
|
26
26
|
if (this.checkVersionMatch(maxVersion, versionKey)) {
|
|
27
27
|
return versionRouter(req, res, next)
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-version-route",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "provides middleware to load controllers based on api versions",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"cz-conventional-changelog": "^2.1.0",
|
|
33
33
|
"docco": "^0.7.0",
|
|
34
34
|
"doxdox": "^2.0.1",
|
|
35
|
-
"eslint": "^
|
|
36
|
-
"eslint-plugin-ava": "^
|
|
37
|
-
"eslint-plugin-import": "^2.
|
|
38
|
-
"eslint-plugin-
|
|
39
|
-
"eslint-plugin-security": "^
|
|
35
|
+
"eslint": "^8.57.1",
|
|
36
|
+
"eslint-plugin-ava": "^15.0.1",
|
|
37
|
+
"eslint-plugin-import": "^2.31.0",
|
|
38
|
+
"eslint-plugin-n": "^17.15.0",
|
|
39
|
+
"eslint-plugin-security": "^3.0.1",
|
|
40
40
|
"husky": "^3.0.0",
|
|
41
|
-
"nyc": "^
|
|
41
|
+
"nyc": "^17.1.0",
|
|
42
42
|
"opn-cli": "^4.0.0",
|
|
43
43
|
"semantic-release": "^25.0.3",
|
|
44
|
-
"standard": "^
|
|
44
|
+
"standard": "^17.1.2"
|
|
45
45
|
},
|
|
46
46
|
"nyc": {
|
|
47
47
|
"statements": 85,
|
|
@@ -81,17 +81,15 @@
|
|
|
81
81
|
"es6": true
|
|
82
82
|
},
|
|
83
83
|
"plugins": [
|
|
84
|
-
"
|
|
84
|
+
"n",
|
|
85
85
|
"security",
|
|
86
86
|
"ava"
|
|
87
87
|
],
|
|
88
88
|
"extends": [
|
|
89
89
|
"plugin:ava/recommended",
|
|
90
|
-
"plugin:
|
|
90
|
+
"plugin:n/recommended"
|
|
91
91
|
],
|
|
92
92
|
"rules": {
|
|
93
|
-
"node/no-unsupported-features": "off",
|
|
94
|
-
"node/no-unpublished-require": "off",
|
|
95
93
|
"security/detect-non-literal-fs-filename": "error",
|
|
96
94
|
"security/detect-unsafe-regex": "error",
|
|
97
95
|
"security/detect-buffer-noassert": "error",
|
|
@@ -103,7 +101,8 @@
|
|
|
103
101
|
"security/detect-non-literal-require": "error",
|
|
104
102
|
"security/detect-object-injection": "error",
|
|
105
103
|
"security/detect-possible-timing-attacks": "error",
|
|
106
|
-
"security/detect-pseudoRandomBytes": "error"
|
|
104
|
+
"security/detect-pseudoRandomBytes": "error",
|
|
105
|
+
"n/no-unpublished-require": "off"
|
|
107
106
|
},
|
|
108
107
|
"parserOptions": {
|
|
109
108
|
"ecmaFeatures": {
|
|
@@ -137,5 +136,9 @@
|
|
|
137
136
|
},
|
|
138
137
|
"dependencies": {
|
|
139
138
|
"semver": "^6.3.0"
|
|
139
|
+
},
|
|
140
|
+
"engines": {
|
|
141
|
+
"node": ">=24.0.0",
|
|
142
|
+
"npm": ">=11.10.0"
|
|
140
143
|
}
|
|
141
144
|
}
|
package/test/sanity.test.js
CHANGED
|
@@ -88,7 +88,7 @@ test('given a versioned router, dont match the requestVersion and error out if n
|
|
|
88
88
|
version: requestedVersion
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
const resIn = null
|
|
92
92
|
const result = middleware(req, resIn, nextHandler)
|
|
93
93
|
t.falsy(resIn)
|
|
94
94
|
t.truthy(result instanceof Error)
|