express-version-api 1.0.6 → 2.0.4

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/dist/esm/lib.js DELETED
@@ -1,201 +0,0 @@
1
- /**
2
- * Attempts to extract a semantic version string from an Express request.
3
- *
4
- * This function checks the `Request` object for a version identifier in the following order:
5
- * 1. `req.version` — typically set by middleware.
6
- * 2. `req.headers['accept-version']` — often provided by clients via HTTP headers.
7
- *
8
- * If no version is found, it returns `false`.
9
- *
10
- * @param req - The Express request object.
11
- * @returns The version string (e.g., "1.0.0"), or `false` if none is provided.
12
- *
13
- * @example
14
- * ```ts
15
- * const version = extractVersionFromRequest(req);
16
- * if (!version) {
17
- * res.status(422).send("No version provided");
18
- * }
19
- * ```
20
- */
21
- export const extractVersionFromRequest = (req) => {
22
- const sources = [req.version, req.headers["accept-version"]];
23
- for (const source of sources) {
24
- if (typeof source === "string")
25
- return source;
26
- }
27
- return false;
28
- };
29
- /**
30
- * Executes a version handler if the client version matches the handler's semantic key.
31
- *
32
- * Determines compatibility between the given `handlerKey` (e.g., "^1", "~2.1", "3.0.0")
33
- * and the `clientVersion` (e.g., "2.1.3") using simplified semantic version matching:
34
- *
35
- * - `^1` matches any version starting with "1" (e.g., "1.0.0", "1.9.5")
36
- * - `~2.1` matches versions like "2.1.x" (e.g., "2.1.0", "2.1.9")
37
- * - `"3.0.0"` matches exactly "3.0.0"
38
- *
39
- * If a match is found, the associated handler from `versionHandlers` is invoked.
40
- *
41
- * @param handlerKey - The version key used for comparison (e.g., "^1", "~2.1", "3.0.0").
42
- * @param clientVersion - The version string from the client request (e.g., "2.1.3").
43
- * @param versionHandlers - A mapping of version keys to Express request handlers.
44
- * @param req - The Express request object.
45
- * @param res - The Express response object.
46
- * @param next - The Express next middleware function.
47
- * @returns `true` if a compatible handler was executed, `false` otherwise.
48
- */
49
- export const executeVersionHandler = (handlerKey, clientVersion, versionHandlers, req, res, next) => {
50
- const [clientMajor = "0", clientMinor = "0", clientPatch = "0"] = clientVersion.split(".");
51
- let targetVersion;
52
- let requestedVersion;
53
- if (handlerKey.startsWith("~")) {
54
- // "~2.1" → match major.minor
55
- targetVersion = handlerKey.slice(1).split(".").slice(0, 2).join(".");
56
- requestedVersion = `${clientMajor}.${clientMinor}`;
57
- }
58
- else if (handlerKey.startsWith("^")) {
59
- // "^1" → match major only
60
- targetVersion = handlerKey.slice(1).split(".")[0];
61
- requestedVersion = clientMajor;
62
- }
63
- else {
64
- // Exact match: "2.1.3"
65
- targetVersion = handlerKey;
66
- requestedVersion = `${clientMajor}.${clientMinor}.${clientPatch}`;
67
- }
68
- const handler = versionHandlers[handlerKey];
69
- if (requestedVersion === targetVersion && typeof handler === "function") {
70
- void handler(req, res, next);
71
- return true;
72
- }
73
- return false;
74
- };
75
- /**
76
- * Executes the default handler when no version match is found.
77
- *
78
- * Priority order:
79
- * 1. If a `defaultHandler` is provided, it is invoked immediately.
80
- * 2. Otherwise, it tries to find and execute the handler for the latest version available.
81
- * 3. If none is found, it responds with HTTP 422 and an optional custom error message.
82
- *
83
- * This ensures that version-based routing gracefully degrades to a default behavior
84
- * or returns an informative error if no handler can be determined.
85
- *
86
- * @param defaultHandler - Optional fallback Express handler.
87
- * @param versionHandlers - A map of version keys to handlers.
88
- * @param keys - An array of version keys from the versionHandlers object.
89
- * @param req - Express request object.
90
- * @param res - Express response object.
91
- * @param next - Express next middleware function.
92
- * @param notFoundMessage - Optional custom error message for 422 responses.
93
- */
94
- export const executeDefaultHandler = (defaultHandler, versionHandlers, keys, req, res, next, notFoundMessage = "Unprocessable Entity: No valid version handler available.") => {
95
- if (defaultHandler) {
96
- void defaultHandler(req, res, next);
97
- return;
98
- }
99
- if (keys.length === 0) {
100
- res.status(422).send(notFoundMessage);
101
- return;
102
- }
103
- const latestVersionKey = findLatestVersion(keys);
104
- const fallbackHandler = latestVersionKey ? versionHandlers[latestVersionKey] : undefined;
105
- if (fallbackHandler) {
106
- void fallbackHandler(req, res, next);
107
- }
108
- else {
109
- res.status(422).send(notFoundMessage);
110
- }
111
- };
112
- /**
113
- * Middleware for handling version-based routing in Express.
114
- *
115
- * This middleware inspects the incoming request for a semantic version (e.g., "1.0.0", "~2.1", "^3")
116
- * and delegates the request to the appropriate handler defined in `versionHandlers`.
117
- *
118
- * Matching priority:
119
- * 1. If a version is found in the request, attempt to match a handler.
120
- * 2. If no match is found, invoke the `defaultHandler` (if provided).
121
- * 3. If no default handler exists, fall back to the latest version handler.
122
- * 4. If none is available, respond with HTTP 422.
123
- *
124
- * @param versionHandlers - A map of semantic version keys to Express handlers.
125
- * @param defaultHandler - Optional fallback handler if no version matches.
126
- * @returns An Express middleware function.
127
- *
128
- * @example
129
- * ```ts
130
- * app.use(
131
- * versioningMiddleware({
132
- * "^1": handlerForV1,
133
- * "~2.1": handlerForV2_1,
134
- * "3.0.0": handlerForV3
135
- * })
136
- * );
137
- * ```
138
- */
139
- export const versioningMiddleware = (versionHandlers, defaultHandler) => {
140
- if (!versionHandlers ||
141
- typeof versionHandlers !== "object" ||
142
- Array.isArray(versionHandlers)) {
143
- throw new Error("Invalid argument: 'versionHandlers' must be a non-array object.");
144
- }
145
- return (req, res, next) => {
146
- const clientVersion = extractVersionFromRequest(req);
147
- const handlerKeys = Object.keys(versionHandlers);
148
- // No version provided by the client
149
- if (!clientVersion) {
150
- res.status(422).send("Unprocessable Entity: No version provided.");
151
- return;
152
- }
153
- // Try to match a handler by version
154
- for (const handlerKey of handlerKeys) {
155
- const matched = executeVersionHandler(handlerKey, clientVersion, versionHandlers, req, res, next);
156
- if (matched)
157
- return;
158
- }
159
- // Fallback to default or latest handler
160
- executeDefaultHandler(defaultHandler, versionHandlers, handlerKeys, req, res, next);
161
- };
162
- };
163
- /**
164
- * Determines the latest semantic version from a list of version strings.
165
- *
166
- * This function removes any leading semantic operators (`^`, `~`) and
167
- * compares versions based on major, minor, and patch numbers.
168
- *
169
- * @param versions - An array of version keys, possibly including "^" or "~" prefixes.
170
- * @returns The latest normalized version string (e.g. "3.2.0"), or `null` if the array is empty.
171
- *
172
- * @example
173
- * ```ts
174
- * const latest = findLatestVersion(["^1", "~2.3", "3.0.0"]);
175
- * latest === "3.0.0"
176
- * ```
177
- */
178
- export const findLatestVersion = (versions) => {
179
- if (!Array.isArray(versions) || versions.length === 0) {
180
- return null;
181
- }
182
- const normalize = (version) => {
183
- const cleaned = version.replace(/^[\^~]/, "");
184
- const parts = cleaned.split(".").map((n) => parseInt(n, 10));
185
- while (parts.length < 3)
186
- parts.push(0); // pad missing parts with 0
187
- return parts.slice(0, 3);
188
- };
189
- const sorted = [...versions].sort((a, b) => {
190
- const [aMajor, aMinor, aPatch] = normalize(a);
191
- const [bMajor, bMinor, bPatch] = normalize(b);
192
- if (aMajor !== bMajor)
193
- return bMajor - aMajor;
194
- if (aMinor !== bMinor)
195
- return bMinor - aMinor;
196
- return bPatch - aPatch;
197
- });
198
- return sorted.length > 0 ? sorted[0].replace(/^[\^~]/, "") : null;
199
- };
200
- export default versioningMiddleware;
201
- //# sourceMappingURL=lib.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAqB,EAAkB,EAAE;IACjF,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAE7D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;IAChD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AACF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,UAAkB,EAClB,aAAqB,EACrB,eAAgC,EAChC,GAAY,EACZ,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CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAE9C,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,MAAM,GAAG,MAAM,CAAC;QAC9C,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,MAAM,GAAG,MAAM,CAAC;QAC9C,OAAO,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- export { default } from "./lib";
@@ -1,137 +0,0 @@
1
- import { type Request, type Response, type NextFunction, type RequestHandler } from "express";
2
- /**
3
- * An object that maps semantic version strings to specific request handlers.
4
- *
5
- * This is the core input to the `versioningMiddleware` function. Each key must be a valid
6
- * version string, such as `"1.0.0"`, `"^1"`, or `"~2.1"`. These prefixes (`^` and `~`) allow
7
- * matching of major/minor version ranges, similar to how they work in `package.json`.
8
- *
9
- * The value for each key is an Express-compatible handler that should respond to requests
10
- * targeting that version.
11
- *
12
- * @example
13
- * ```ts
14
- * const handlers: VersionHandlers = {
15
- * "^1": (req, res) => res.send("v1.x handler"),
16
- * "~2.1": (req, res) => res.send("v2.1.x handler"),
17
- * "3.0.0": (req, res) => res.send("exact v3.0.0 handler"),
18
- * };
19
- * ```
20
- */
21
- export interface VersionHandlers {
22
- [version: string]: RequestHandler;
23
- }
24
- /**
25
- * An extended Express `Request` object that optionally includes a `version` property.
26
- * This allows support for custom middleware.
27
- */
28
- interface VersionedRequest extends Request {
29
- version?: string;
30
- }
31
- /**
32
- * Attempts to extract a semantic version string from an Express request.
33
- *
34
- * This function checks the `Request` object for a version identifier in the following order:
35
- * 1. `req.version` — typically set by middleware.
36
- * 2. `req.headers['accept-version']` — often provided by clients via HTTP headers.
37
- *
38
- * If no version is found, it returns `false`.
39
- *
40
- * @param req - The Express request object.
41
- * @returns The version string (e.g., "1.0.0"), or `false` if none is provided.
42
- *
43
- * @example
44
- * ```ts
45
- * const version = extractVersionFromRequest(req);
46
- * if (!version) {
47
- * res.status(422).send("No version provided");
48
- * }
49
- * ```
50
- */
51
- export declare const extractVersionFromRequest: (req: VersionedRequest) => string | false;
52
- /**
53
- * Executes a version handler if the client version matches the handler's semantic key.
54
- *
55
- * Determines compatibility between the given `handlerKey` (e.g., "^1", "~2.1", "3.0.0")
56
- * and the `clientVersion` (e.g., "2.1.3") using simplified semantic version matching:
57
- *
58
- * - `^1` matches any version starting with "1" (e.g., "1.0.0", "1.9.5")
59
- * - `~2.1` matches versions like "2.1.x" (e.g., "2.1.0", "2.1.9")
60
- * - `"3.0.0"` matches exactly "3.0.0"
61
- *
62
- * If a match is found, the associated handler from `versionHandlers` is invoked.
63
- *
64
- * @param handlerKey - The version key used for comparison (e.g., "^1", "~2.1", "3.0.0").
65
- * @param clientVersion - The version string from the client request (e.g., "2.1.3").
66
- * @param versionHandlers - A mapping of version keys to Express request handlers.
67
- * @param req - The Express request object.
68
- * @param res - The Express response object.
69
- * @param next - The Express next middleware function.
70
- * @returns `true` if a compatible handler was executed, `false` otherwise.
71
- */
72
- export declare const executeVersionHandler: (handlerKey: string, clientVersion: string, versionHandlers: VersionHandlers, req: Request, res: Response, next: NextFunction) => boolean;
73
- /**
74
- * Executes the default handler when no version match is found.
75
- *
76
- * Priority order:
77
- * 1. If a `defaultHandler` is provided, it is invoked immediately.
78
- * 2. Otherwise, it tries to find and execute the handler for the latest version available.
79
- * 3. If none is found, it responds with HTTP 422 and an optional custom error message.
80
- *
81
- * This ensures that version-based routing gracefully degrades to a default behavior
82
- * or returns an informative error if no handler can be determined.
83
- *
84
- * @param defaultHandler - Optional fallback Express handler.
85
- * @param versionHandlers - A map of version keys to handlers.
86
- * @param keys - An array of version keys from the versionHandlers object.
87
- * @param req - Express request object.
88
- * @param res - Express response object.
89
- * @param next - Express next middleware function.
90
- * @param notFoundMessage - Optional custom error message for 422 responses.
91
- */
92
- export declare const executeDefaultHandler: (defaultHandler: RequestHandler | undefined, versionHandlers: VersionHandlers, keys: string[], req: Request, res: Response, next: NextFunction, notFoundMessage?: string) => void;
93
- /**
94
- * Middleware for handling version-based routing in Express.
95
- *
96
- * This middleware inspects the incoming request for a semantic version (e.g., "1.0.0", "~2.1", "^3")
97
- * and delegates the request to the appropriate handler defined in `versionHandlers`.
98
- *
99
- * Matching priority:
100
- * 1. If a version is found in the request, attempt to match a handler.
101
- * 2. If no match is found, invoke the `defaultHandler` (if provided).
102
- * 3. If no default handler exists, fall back to the latest version handler.
103
- * 4. If none is available, respond with HTTP 422.
104
- *
105
- * @param versionHandlers - A map of semantic version keys to Express handlers.
106
- * @param defaultHandler - Optional fallback handler if no version matches.
107
- * @returns An Express middleware function.
108
- *
109
- * @example
110
- * ```ts
111
- * app.use(
112
- * versioningMiddleware({
113
- * "^1": handlerForV1,
114
- * "~2.1": handlerForV2_1,
115
- * "3.0.0": handlerForV3
116
- * })
117
- * );
118
- * ```
119
- */
120
- export declare const versioningMiddleware: (versionHandlers: VersionHandlers, defaultHandler?: RequestHandler) => RequestHandler;
121
- /**
122
- * Determines the latest semantic version from a list of version strings.
123
- *
124
- * This function removes any leading semantic operators (`^`, `~`) and
125
- * compares versions based on major, minor, and patch numbers.
126
- *
127
- * @param versions - An array of version keys, possibly including "^" or "~" prefixes.
128
- * @returns The latest normalized version string (e.g. "3.2.0"), or `null` if the array is empty.
129
- *
130
- * @example
131
- * ```ts
132
- * const latest = findLatestVersion(["^1", "~2.3", "3.0.0"]);
133
- * latest === "3.0.0"
134
- * ```
135
- */
136
- export declare const findLatestVersion: (versions: string[]) => string | null;
137
- export default versioningMiddleware;