@naman_deep_singh/http-response 3.3.0 → 3.3.1
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/README.md +1 -1
- package/dist/types/core/factory.d.ts +1 -1
- package/dist/types/middleware/express/expressMiddleware.d.ts +2 -2
- package/package.json +1 -1
- package/src/core/factory.ts +1 -1
- package/src/core/index.ts +6 -6
- package/src/middleware/express/expressMiddleware.ts +3 -3
- package/src/middleware/express/index.ts +1 -1
- package/src/middleware/index.ts +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ExpressResponder } from '../adapters/express/ExpressResponder.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { ResponderConfig } from './config.js';
|
|
3
3
|
export declare const createResponderFactory: (cfg?: Partial<ResponderConfig>) => <P = unknown, _M = Record<string, unknown>>(res: import("express").Response) => ExpressResponder<P>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { RequestHandler } from 'express';
|
|
2
|
+
import type { ResponderConfig } from '../../core/config.js';
|
|
3
3
|
export declare const responderMiddleware: (cfg?: Partial<ResponderConfig>) => RequestHandler;
|
package/package.json
CHANGED
package/src/core/factory.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExpressResponder } from '../adapters/express/ExpressResponder.js'
|
|
2
|
-
import {
|
|
2
|
+
import type { ResponderConfig } from './config.js'
|
|
3
3
|
|
|
4
4
|
export const createResponderFactory = (cfg?: Partial<ResponderConfig>) => {
|
|
5
5
|
return <P = unknown, _M = Record<string, unknown>>(
|
package/src/core/index.ts
CHANGED
|
@@ -10,10 +10,10 @@ export { defaultConfig } from './config.js'
|
|
|
10
10
|
|
|
11
11
|
// Core types (explicit)
|
|
12
12
|
export type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
ResponseEnvelope,
|
|
14
|
+
ErrorShape,
|
|
15
|
+
PaginationMeta,
|
|
16
|
+
PlainObject,
|
|
17
|
+
Sender,
|
|
18
|
+
TransportResult,
|
|
19
19
|
} from './types.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { RequestHandler } from 'express'
|
|
2
|
+
import type { ResponderConfig } from '../../core/config.js'
|
|
3
3
|
import { createResponderFactory } from '../../core/factory.js'
|
|
4
4
|
|
|
5
5
|
export const responderMiddleware = (
|
|
@@ -8,7 +8,7 @@ export const responderMiddleware = (
|
|
|
8
8
|
const factory = createResponderFactory(cfg)
|
|
9
9
|
|
|
10
10
|
return (_req, res, next) => {
|
|
11
|
-
;
|
|
11
|
+
;(res as any).responder = <P = unknown>() => factory<P>(res)
|
|
12
12
|
next()
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { responderMiddleware } from './expressMiddleware.js'
|
|
1
|
+
export { responderMiddleware } from './expressMiddleware.js'
|
package/src/middleware/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { responderMiddleware } from './express/index.js'
|
|
1
|
+
export { responderMiddleware } from './express/index.js'
|