express-version-api 2.0.7 → 2.0.8
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/CHANGELOG.md +24 -2
- package/LICENSE +2 -4
- package/README.md +40 -6
- package/dist/index.d.ts +2 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.8] - 2026-11-03
|
|
11
|
+
|
|
12
|
+
No changes to the runtime code: same API and behavior as 2.0.7.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `SECURITY.md` with supported versions, private reporting and response times.
|
|
17
|
+
- README: contents line, JSR install for Node.js, typed quick start and a supply chain security section.
|
|
18
|
+
- "Report a vulnerability" link in the new-issue menu.
|
|
19
|
+
|
|
10
20
|
### Changed
|
|
11
21
|
|
|
12
|
-
- JSR package moved to `@braqon/express-version-api`. The old `@braian-quintian/express-version-api`
|
|
13
|
-
- npm releases are published with trusted publishing (OIDC) instead of a stored `NPM_TOKEN`.
|
|
22
|
+
- JSR package moved to `@braqon/express-version-api`. The old `@braian-quintian/express-version-api` is archived.
|
|
23
|
+
- npm releases are published with trusted publishing (OIDC) and provenance instead of a stored `NPM_TOKEN`.
|
|
24
|
+
- Bilingual (English/Spanish) code of conduct; reports go to hola@braqon.dev.
|
|
25
|
+
- Contributing guide matches the real workflow: pull requests target `develop`, signed commits, required checks and release process.
|
|
26
|
+
- Dev tooling: ESLint 10, tsup 9, lint-staged 17 and minor updates.
|
|
27
|
+
- CI runs the test suite once per pull request instead of up to three times.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- `LICENSE` is detected as MIT by GitHub; copyright is now 2024-present.
|
|
32
|
+
|
|
33
|
+
### Security
|
|
34
|
+
|
|
35
|
+
- Updated development dependencies to resolve the critical `proxy-addr` alert and most high alerts (dev-only; the published package has no runtime dependencies).
|
|
14
36
|
|
|
15
37
|
### Removed
|
|
16
38
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024-present Braian Alberto Quintian Romero
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,5 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
For more information, see <https://github.com/braqon-dev/express-version-api>
|
package/README.md
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/express-version-api)
|
|
4
4
|
[](https://www.npmjs.com/package/express-version-api)
|
|
5
|
-
[](https://jsr.io/@braqon/express-version-api)
|
|
6
|
+
[](https://github.com/braqon-dev/express-version-api/actions)
|
|
6
7
|
[](./LICENSE)
|
|
7
8
|
|
|
8
9
|
Version-aware middleware for Express.js APIs with semantic version matching.
|
|
9
10
|
|
|
11
|
+
**Contents:** [Why](#why-use-this) · [Install](#installation) · [Quick start](#quick-start) · [Matching rules](#version-matching-rules) · [Extraction](#how-version-extraction-works) · [Fallbacks](#fallback-strategies) · [Errors](#error-handling) · [API](#public-api) · [Supply chain](#supply-chain-security) · [Contributing](#contributing)
|
|
12
|
+
|
|
10
13
|
## Why use this
|
|
11
14
|
|
|
12
15
|
- Routes requests by semantic version (`exact`, `~`, `^`).
|
|
13
16
|
- Supports extraction from header, query, path, or custom function.
|
|
14
17
|
- Handles missing or unmatched versions with configurable fallback strategies.
|
|
15
18
|
- Exposes `req.versionInfo` metadata for observability and debugging.
|
|
16
|
-
- Fully typed for TypeScript projects.
|
|
19
|
+
- Fully typed for TypeScript projects, ESM and CommonJS.
|
|
20
|
+
- Zero runtime dependencies (Express is a peer dependency).
|
|
17
21
|
|
|
18
22
|
## Installation
|
|
19
23
|
|
|
@@ -26,18 +30,22 @@ npm install express-version-api
|
|
|
26
30
|
### JSR
|
|
27
31
|
|
|
28
32
|
```bash
|
|
33
|
+
# Deno
|
|
29
34
|
deno add jsr:@braqon/express-version-api
|
|
35
|
+
|
|
36
|
+
# Node.js (npm, pnpm, yarn or bun)
|
|
37
|
+
npx jsr add @braqon/express-version-api
|
|
30
38
|
```
|
|
31
39
|
|
|
32
40
|
Requirements:
|
|
33
41
|
|
|
34
42
|
- Node.js >= 18
|
|
35
|
-
- Express
|
|
43
|
+
- Express 4 or 5
|
|
36
44
|
|
|
37
45
|
## Quick Start
|
|
38
46
|
|
|
39
47
|
```ts
|
|
40
|
-
import express from 'express';
|
|
48
|
+
import express, { type NextFunction, type Request, type Response } from 'express';
|
|
41
49
|
import { versioningMiddleware } from 'express-version-api';
|
|
42
50
|
|
|
43
51
|
const app = express();
|
|
@@ -51,9 +59,11 @@ app.get(
|
|
|
51
59
|
})
|
|
52
60
|
);
|
|
53
61
|
|
|
54
|
-
app.use((error, _req, res, _next) => {
|
|
62
|
+
app.use((error: Error, _req: Request, res: Response, _next: NextFunction) => {
|
|
55
63
|
res.status(500).json({ error: error.message });
|
|
56
64
|
});
|
|
65
|
+
|
|
66
|
+
app.listen(3000);
|
|
57
67
|
```
|
|
58
68
|
|
|
59
69
|
Request examples:
|
|
@@ -281,6 +291,18 @@ Config export:
|
|
|
281
291
|
- Removed legacy `createVersionMiddleware` API.
|
|
282
292
|
- CommonJS default export was removed; CJS must use named imports.
|
|
283
293
|
|
|
294
|
+
## Supply chain security
|
|
295
|
+
|
|
296
|
+
- Every npm release is published from GitHub Actions with [trusted publishing](https://docs.npmjs.com/trusted-publishers) (no long-lived tokens) and a signed [provenance](https://docs.npmjs.com/generating-provenance-statements) statement that links the tarball to the exact commit and workflow that built it.
|
|
297
|
+
- Commits on `main` and `develop` must be signed and pass CI before merging.
|
|
298
|
+
- The package has no runtime dependencies, so installing it adds nothing else to your tree besides Express.
|
|
299
|
+
|
|
300
|
+
Verify what you installed:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
npm audit signatures
|
|
304
|
+
```
|
|
305
|
+
|
|
284
306
|
## Development
|
|
285
307
|
|
|
286
308
|
```bash
|
|
@@ -298,6 +320,18 @@ Main scripts:
|
|
|
298
320
|
- `npm run build`
|
|
299
321
|
- `npm run test:types`
|
|
300
322
|
|
|
323
|
+
## Contributing
|
|
324
|
+
|
|
325
|
+
Issues and pull requests are welcome, in English or Spanish. Read the [contributing guide](CONTRIBUTING.md) and the [code of conduct](CODE_OF_CONDUCT.md) first.
|
|
326
|
+
|
|
327
|
+
## Security
|
|
328
|
+
|
|
329
|
+
Please don't report vulnerabilities in public issues. See [SECURITY.md](SECURITY.md) for how to report them privately.
|
|
330
|
+
|
|
301
331
|
## License
|
|
302
332
|
|
|
303
|
-
MIT
|
|
333
|
+
[MIT](LICENSE) © 2024-present Braian Alberto Quintian Romero
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
<p align="center"><sub>Built and maintained by <a href="https://github.com/braqon-dev">BRAQON</a> · Report vulnerabilities privately: <a href="https://github.com/braqon-dev/express-version-api/security/advisories/new">security advisory</a> or <a href="mailto:security@braqon.dev">security@braqon.dev</a></sub></p>
|
package/dist/index.d.ts
CHANGED
|
@@ -441,4 +441,5 @@ declare function normalizeVersion(version: string): string | null;
|
|
|
441
441
|
*/
|
|
442
442
|
declare const DEFAULT_CONFIG: ResolvedConfig;
|
|
443
443
|
|
|
444
|
-
export {
|
|
444
|
+
export { DEFAULT_CONFIG, VersioningError, compareVersions, createInvalidConfigurationError, createInvalidHandlerError, createInvalidVersionFormatError, createMissingVersionError, createVersionNotFoundError, versioningMiddleware as default, findLatestVersion, hasErrorCode, isValidVersion, isValidVersionRange, isVersioningError, normalizeVersion, parseVersion, parseVersionRange, versionSatisfies, versioningMiddleware };
|
|
445
|
+
export type { CustomVersionExtractor, ErrorResponseConfig, FallbackStrategy, HeaderVersionConfig, ParsedVersion, ParsedVersionRange, PathVersionConfig, QueryVersionConfig, VersionExtractionConfig, VersionHandlers, VersionRangeType, VersionSource, VersionedRequest, VersionedRequestHandler, VersioningErrorCode, VersioningErrorDetails, VersioningOptions };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-version-api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Middleware for versioning routes/APIs in Express.js using semantic versioning like ^1.0 or ~1.2.",
|
|
5
|
-
"author": "Braian Quintian <
|
|
5
|
+
"author": "Braian Quintian <hola@braqon.dev> (https://github.com/braqon)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/braqon-dev/express-version-api#readme",
|
|
8
8
|
"repository": {
|
|
@@ -77,23 +77,23 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@eslint/js": "^
|
|
80
|
+
"@eslint/js": "^10.0.1",
|
|
81
81
|
"@types/express": "^5.0.3",
|
|
82
82
|
"@types/jest": "^30.0.0",
|
|
83
83
|
"@types/node": "^22.15.0",
|
|
84
|
-
"@types/supertest": "^
|
|
85
|
-
"eslint": "^
|
|
86
|
-
"eslint-config-prettier": "^10.1.
|
|
84
|
+
"@types/supertest": "^7.2.1",
|
|
85
|
+
"eslint": "^10.14.0",
|
|
86
|
+
"eslint-config-prettier": "^10.1.8",
|
|
87
87
|
"express": "^5.1.0",
|
|
88
88
|
"husky": "^9.1.0",
|
|
89
89
|
"jest": "^30.2.0",
|
|
90
|
-
"lint-staged": "^
|
|
90
|
+
"lint-staged": "^17.6.0",
|
|
91
91
|
"prettier": "^3.5.0",
|
|
92
92
|
"supertest": "^7.2.2",
|
|
93
93
|
"ts-jest": "^29.4.6",
|
|
94
94
|
"tsd": "^0.33.0",
|
|
95
|
-
"tsup": "^
|
|
95
|
+
"tsup": "^9.0.0",
|
|
96
96
|
"typescript": "^5.8.3",
|
|
97
|
-
"typescript-eslint": "^8.
|
|
97
|
+
"typescript-eslint": "^8.72.1"
|
|
98
98
|
}
|
|
99
99
|
}
|