@darksheep/express 2.1.5 → 2.1.8-alpha.2bd5629

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 CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.7](https://github.com/DarkSheepSoftware/node-packages/compare/express-v2.1.6...express-v2.1.7) (2026-10-31)
4
+
5
+
6
+ ### 🩹 Fixes
7
+
8
+ * give published packages real ranges on their sibling packages ([#1216](https://github.com/DarkSheepSoftware/node-packages/issues/1216)) ([5c6df37](https://github.com/DarkSheepSoftware/node-packages/commit/5c6df37d03f94aae39e90e712693f697d7bb2dc1)), closes [#1215](https://github.com/DarkSheepSoftware/node-packages/issues/1215)
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * devDependencies
15
+ * @darksheep/json-schema bumped to 0.1.4
16
+ * peerDependencies
17
+ * @darksheep/json-schema bumped to 0.1.4
18
+
19
+ ## [2.1.6](https://github.com/DarkSheepSoftware/node-packages/compare/express-v2.1.5...express-v2.1.6) (2026-10-26)
20
+
21
+
22
+ ### 🩹 Fixes
23
+
24
+ * build published types with the repo's typescript ([#1117](https://github.com/DarkSheepSoftware/node-packages/issues/1117)) ([c14d1de](https://github.com/DarkSheepSoftware/node-packages/commit/c14d1dec79596718729149114d2bc716c3f2fe37))
25
+
26
+
27
+ ### 📦 Dependencies
28
+
29
+ * **pkg:** update dependency on-finished to v2.4.2 ([#1162](https://github.com/DarkSheepSoftware/node-packages/issues/1162)) ([5aaa491](https://github.com/DarkSheepSoftware/node-packages/commit/5aaa491932332f49af9c810d47a5fd54fd450697))
30
+
31
+
32
+ ### Dependencies
33
+
34
+ * The following workspace dependencies were updated
35
+ * dependencies
36
+ * @darksheep/errors bumped from 1.2.1 to 1.2.2
37
+ * @darksheep/prune bumped from 1.1.0 to 1.1.1
38
+ * devDependencies
39
+ * @darksheep/json-schema bumped to 0.1.3
40
+ * @darksheep/logger bumped from 1.4.1 to 1.4.2
41
+ * peerDependencies
42
+ * @darksheep/json-schema bumped to 0.1.3
43
+ * @darksheep/logger bumped from >=1.0.10 to >=1.4.2
44
+
3
45
  ## [2.1.5](https://github.com/DarkSheepSoftware/node-packages/compare/express-v2.1.4...express-v2.1.5) (2026-09-21)
4
46
 
5
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darksheep/express",
3
- "version": "2.1.5",
3
+ "version": "2.1.8-alpha.2bd5629",
4
4
  "description": "express utilites and other bits",
5
5
  "license": "UNLICENCED",
6
6
  "type": "module",
@@ -14,27 +14,28 @@
14
14
  "src",
15
15
  "types",
16
16
  "express.d.ts",
17
- "!*.test.*"
17
+ "!*.test.*",
18
+ "!*.tsbuildinfo"
18
19
  ],
19
20
  "scripts": {
20
- "prepack": "yarn dlx -q -p typescript tsc",
21
+ "prepack": "rm -rf types && yarn run -T tsc -b",
21
22
  "test": "node --test src/**/*.test.js",
22
23
  "test:watch": "node --watch --test src/**/*.test.js"
23
24
  },
24
25
  "dependencies": {
25
- "@darksheep/errors": "1.2.1",
26
- "@darksheep/prune": "1.1.0",
27
- "on-finished": "2.4.1"
26
+ "@darksheep/errors": "1.2.2",
27
+ "@darksheep/prune": "1.1.1",
28
+ "on-finished": "2.4.2"
28
29
  },
29
30
  "devDependencies": {
30
- "@darksheep/json-schema": "",
31
- "@darksheep/logger": "1.4.1",
31
+ "@darksheep/json-schema": "0.1.5-alpha.2bd5629",
32
+ "@darksheep/logger": "1.4.2",
32
33
  "@types/express": "~5.0.0",
33
34
  "@types/on-finished": "^2",
34
- "express": "~5.2.0"
35
+ "express": "~5.3.0"
35
36
  },
36
37
  "peerDependencies": {
37
- "@darksheep/json-schema": "",
38
+ "@darksheep/json-schema": "0.1.5-alpha.2bd5629",
38
39
  "@darksheep/logger": ">=1.0.10",
39
40
  "express": "~4.21.2 || ~5"
40
41
  },
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @import { Handler } from '../../express.js'
2
+ * @import { NextFunction } from 'express'
3
+ * @import { Handler, Request, Response } from '../../express.js'
3
4
  */
4
5
 
5
6
  import { UnsupportedMediaType } from '@darksheep/errors';
@@ -34,7 +35,12 @@ export function createContentTypeMiddleware(targetContentTypes, shouldThrow = tr
34
35
  };
35
36
  }
36
37
 
37
- /** @type {Handler} */
38
+ /**
39
+ * @param {Request} request - The express request.
40
+ * @param {Response} _response - The express response.
41
+ * @param {NextFunction} _next - The next handler.
42
+ * @returns {never}
43
+ */
38
44
  export function unsupportedMediaType(request, _response, _next) {
39
45
  const { method } = request;
40
46
  const url = request.originalUrl.split('?', 1).at(0) ?? '/';
@@ -1,10 +1,15 @@
1
1
  /**
2
- * @import {
3
- * ErrorRequestHandler,
4
- * } from '../../express.js'
2
+ * @import { NextFunction } from 'express'
3
+ * @import { ErrorRequestHandler, Request, Response } from '../../express.js'
5
4
  */
6
5
 
7
- /** @type {ErrorRequestHandler} */
6
+ /**
7
+ * @param {Parameters<ErrorRequestHandler>[0]} error - The error to respond with.
8
+ * @param {Request} request - The express request.
9
+ * @param {Response} response - The express response.
10
+ * @param {NextFunction} _next - The next handler.
11
+ * @returns {void}
12
+ */
8
13
  export function errorHandlerMiddleware(error, request, response, _next) {
9
14
  response.locals.error = error;
10
15
 
@@ -52,9 +52,9 @@ export function createRequestLoggerMiddleware(
52
52
  const [ requestPath ] = request.originalUrl.split('?', 1);
53
53
 
54
54
  if (
55
+ error == null &&
55
56
  shouldFilterOutRequest(requestPath, filters) === true &&
56
- response.statusCode < 400 &&
57
- error == null
57
+ response.statusCode < 400
58
58
  ) {
59
59
  return;
60
60
  }
@@ -1,10 +1,17 @@
1
- /**
2
- * @import { Handler } from '../../express.js'
3
- */
4
- import type { Handler } from '../../express.js';
5
1
  /**
6
2
  * @param {string | string[]} targetContentTypes - The permitted content types.
7
3
  * @param {boolean} [shouldThrow] - Should the middleware throw an error.
8
4
  * @returns {Handler}
9
5
  */
10
- export declare function createContentTypeMiddleware(targetContentTypes: string | string[], shouldThrow?: boolean): Handler;
6
+ export function createContentTypeMiddleware(targetContentTypes: string | string[], shouldThrow?: boolean): Handler;
7
+ /**
8
+ * @param {Request} request - The express request.
9
+ * @param {Response} _response - The express response.
10
+ * @param {NextFunction} _next - The next handler.
11
+ * @returns {never}
12
+ */
13
+ export function unsupportedMediaType(request: Request, _response: Response, _next: NextFunction): never;
14
+ import type { Handler } from '../../express.js';
15
+ import type { Request } from '../../express.js';
16
+ import type { Response } from '../../express.js';
17
+ import type { NextFunction } from 'express';
@@ -1,10 +1,7 @@
1
- /**
2
- * @import { Handler } from '../../express.js'
3
- */
4
- import type { Handler } from '../../express.js';
5
- import { Router } from 'express';
6
1
  /**
7
2
  * @param {Record<string, Handler | Handler[]>} contentTypeRoutes - An object containing the contentType and routes.
8
3
  * @returns {Router}
9
4
  */
10
- export declare function createContentTypeRouter(contentTypeRoutes: Record<string, Handler | Handler[]>): Router;
5
+ export function createContentTypeRouter(contentTypeRoutes: Record<string, Handler | Handler[]>): Router;
6
+ import type { Handler } from '../../express.js';
7
+ import { Router } from 'express';
@@ -1,7 +1,17 @@
1
1
  /**
2
2
  * @import { ErrorHandler } from '../../express.js';
3
3
  */
4
- import type { ErrorHandler } from '../../express.js';
4
+ /**
5
+ * @typedef HttpErrorExtra
6
+ * @property {boolean} expose - Should the error message be sent to the client.
7
+ * @property {Record<string, string> | undefined} headers - Additional headers to send.
8
+ * @property {number} statusCode - The response status code.
9
+ */
10
+ /**
11
+ * @typedef {Error & HttpErrorExtra} HttpError
12
+ */
13
+ /** @type {ErrorHandler<HttpError>} */
14
+ export const HttpErrorHandler: ErrorHandler<HttpError>;
5
15
  export type HttpErrorExtra = {
6
16
  /**
7
17
  * - Should the error message be sent to the client.
@@ -17,14 +27,4 @@ export type HttpErrorExtra = {
17
27
  statusCode: number;
18
28
  };
19
29
  export type HttpError = Error & HttpErrorExtra;
20
- /**
21
- * @typedef HttpErrorExtra
22
- * @property {boolean} expose - Should the error message be sent to the client.
23
- * @property {Record<string, string> | undefined} headers - Additional headers to send.
24
- * @property {number} statusCode - The response status code.
25
- */
26
- /**
27
- * @typedef {Error & HttpErrorExtra} HttpError
28
- */
29
- /** @type {ErrorHandler<HttpError>} */
30
- export declare const HttpErrorHandler: ErrorHandler<HttpError>;
30
+ import type { ErrorHandler } from '../../express.js';
@@ -1,9 +1,4 @@
1
- /**
2
- * @import * as JsonSchema from '@darksheep/json-schema';
3
- * @import { ErrorHandler } from '../../express.js';
4
- * @import { RequestSchemaError, ResponseSchemaError } from '@darksheep/json-schema';
5
- */
6
- import type { ErrorHandler } from '../../express.js';
7
- import type { RequestSchemaError, ResponseSchemaError } from '@darksheep/json-schema';
8
1
  /** @type {ErrorHandler<RequestSchemaError | ResponseSchemaError>} */
9
- export declare const SchemaErrorHandler: ErrorHandler<RequestSchemaError | ResponseSchemaError>;
2
+ export const SchemaErrorHandler: ErrorHandler<JsonSchema.RequestSchemaError | JsonSchema.ResponseSchemaError>;
3
+ import type * as JsonSchema from '@darksheep/json-schema';
4
+ import type { ErrorHandler } from '../../express.js';
@@ -1,6 +1,16 @@
1
1
  /**
2
- * @import {
3
- * ErrorRequestHandler,
4
- * } from '../../express.js'
2
+ * @import { NextFunction } from 'express'
3
+ * @import { ErrorRequestHandler, Request, Response } from '../../express.js'
5
4
  */
6
- export {};
5
+ /**
6
+ * @param {Parameters<ErrorRequestHandler>[0]} error - The error to respond with.
7
+ * @param {Request} request - The express request.
8
+ * @param {Response} response - The express response.
9
+ * @param {NextFunction} _next - The next handler.
10
+ * @returns {void}
11
+ */
12
+ export function errorHandlerMiddleware(error: Parameters<ErrorRequestHandler>[0], request: Request, response: Response, _next: NextFunction): void;
13
+ import type { ErrorRequestHandler } from '../../express.js';
14
+ import type { Request } from '../../express.js';
15
+ import type { Response } from '../../express.js';
16
+ import type { NextFunction } from 'express';
@@ -1,7 +1,17 @@
1
1
  /**
2
2
  * @import { ErrorHandler } from '../../express.js';
3
3
  */
4
- import type { ErrorHandler } from '../../express.js';
4
+ /**
5
+ * @typedef ZodIssue
6
+ * @property {string} message - The error message for the path.
7
+ * @property {string} code - The zod error code text.
8
+ * @property {string} path - The path to the error in zod.
9
+ */
10
+ /**
11
+ * @typedef {Error & { errors: ZodIssue[] }} ZodError
12
+ */
13
+ /** @type {ErrorHandler<ZodError>} */
14
+ export const ZodErrorHandler: ErrorHandler<ZodError>;
5
15
  export type ZodIssue = {
6
16
  /**
7
17
  * - The error message for the path.
@@ -19,14 +29,4 @@ export type ZodIssue = {
19
29
  export type ZodError = Error & {
20
30
  errors: ZodIssue[];
21
31
  };
22
- /**
23
- * @typedef ZodIssue
24
- * @property {string} message - The error message for the path.
25
- * @property {string} code - The zod error code text.
26
- * @property {string} path - The path to the error in zod.
27
- */
28
- /**
29
- * @typedef {Error & { errors: ZodIssue[] }} ZodError
30
- */
31
- /** @type {ErrorHandler<ZodError>} */
32
- export declare const ZodErrorHandler: ErrorHandler<ZodError>;
32
+ import type { ErrorHandler } from '../../express.js';
package/types/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { createContentTypeMiddleware } from './content-type/middleware.js';
2
- export { createContentTypeRouter } from './content-type/router.js';
3
- export { createRequestLoggerMiddleware } from './logger/middleware.js';
4
- export { createRequestIdMiddleware } from './request-id/middleware.js';
5
- export { errorHandlerMiddleware } from './error-handler/middleware.js';
6
- export { notFoundMiddleware } from './not-found/middleware.js';
7
- export { HttpErrorHandler } from './error-handler/http.handler.js';
8
- export { SchemaErrorHandler } from './error-handler/json-schema.handler.js';
9
- export { ZodErrorHandler } from './error-handler/zod.handler.js';
1
+ export { createContentTypeMiddleware } from "./content-type/middleware.js";
2
+ export { createContentTypeRouter } from "./content-type/router.js";
3
+ export { createRequestLoggerMiddleware } from "./logger/middleware.js";
4
+ export { createRequestIdMiddleware } from "./request-id/middleware.js";
5
+ export { errorHandlerMiddleware } from "./error-handler/middleware.js";
6
+ export { notFoundMiddleware } from "./not-found/middleware.js";
7
+ export { HttpErrorHandler } from "./error-handler/http.handler.js";
8
+ export { SchemaErrorHandler } from "./error-handler/json-schema.handler.js";
9
+ export { ZodErrorHandler } from "./error-handler/zod.handler.js";
@@ -1,4 +1,3 @@
1
- export type Filter = string | RegExp;
2
1
  /**
3
2
  * @typedef {string|RegExp} Filter
4
3
  */
@@ -7,4 +6,5 @@ export type Filter = string | RegExp;
7
6
  * @param {Filter[]} [filters] - A list of paths to filter out.
8
7
  * @returns {boolean}
9
8
  */
10
- export declare function shouldFilterOutRequest(requestPath?: string | undefined | null, filters?: Filter[]): boolean;
9
+ export function shouldFilterOutRequest(requestPath?: string | undefined | null, filters?: Filter[]): boolean;
10
+ export type Filter = string | RegExp;
@@ -1,15 +1,9 @@
1
- /**
2
- * @import { Socket } from 'node:net'
3
- * @import { Logger as LoggerType } from '@darksheep/logger'
4
- * @import { Handler } from '../../express.js'
5
- * @import { Filter } from './filter.js'
6
- */
7
- import type { Logger as LoggerType } from '@darksheep/logger';
8
- import type { Handler } from '../../express.js';
9
- import type { Filter } from './filter.js';
10
1
  /**
11
2
  * @param {LoggerType} logger - A callback that can be bound to the request.
12
3
  * @param {Filter[]} [filters] - A list of requests to not log.
13
4
  * @returns {Handler}
14
5
  */
15
- export declare function createRequestLoggerMiddleware(logger: LoggerType, filters?: Filter[]): Handler;
6
+ export function createRequestLoggerMiddleware(logger: LoggerType, filters?: Filter[]): Handler;
7
+ import type { Logger as LoggerType } from '@darksheep/logger';
8
+ import type { Filter } from './filter.js';
9
+ import type { Handler } from '../../express.js';
@@ -1,9 +1,10 @@
1
- import type { NextFunction } from 'express';
2
- import type { Request, Response } from '../../express.js';
3
1
  /**
4
2
  * @param {Request} request - The express request.
5
3
  * @param {Response} _response - The express response.
6
4
  * @param {NextFunction} next - The next handler.
7
5
  * @returns {void}
8
6
  */
9
- export declare function notFoundMiddleware(request: Request, _response: Response, next: NextFunction): void;
7
+ export function notFoundMiddleware(request: Request, _response: Response, next: NextFunction): void;
8
+ import type { Request } from '../../express.js';
9
+ import type { Response } from '../../express.js';
10
+ import type { NextFunction } from 'express';
@@ -1,12 +1,13 @@
1
- import type { Handler, Request } from '../../express.js';
2
1
  /**
3
2
  * @param {Request} request - The express request.
4
3
  * @param {string} [headerName] - The name of the header used in correlation.
5
4
  * @returns {string}
6
5
  */
7
- export declare function getTrail(request: Request, headerName?: string): string;
6
+ export function getTrail(request: Request, headerName?: string): string;
8
7
  /**
9
8
  * @param {string} [headerName] - The name of a header to include in the response with the trail.
10
9
  * @returns {Handler}
11
10
  */
12
- export declare function createRequestIdMiddleware(headerName?: string): Handler;
11
+ export function createRequestIdMiddleware(headerName?: string): Handler;
12
+ import type { Request } from '../../express.js';
13
+ import type { Handler } from '../../express.js';