dx-server 0.14.0-alpha.5 → 0.14.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 -0
- package/lib/router.d.ts +2 -0
- package/lib/router.js +2 -1
- package/lib/stream.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -524,6 +524,7 @@ router.post(pattern, handler)
|
|
|
524
524
|
router.put(pattern, handler)
|
|
525
525
|
router.delete(pattern, handler)
|
|
526
526
|
router.patch(pattern, handler)
|
|
527
|
+
router.query(pattern, handler) // Safe, idempotent query with request content (RFC 10008)
|
|
527
528
|
router.head(pattern, handler)
|
|
528
529
|
router.options(pattern, handler)
|
|
529
530
|
router.all(pattern, handler) // Any method
|
package/lib/router.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ interface RouterOptions extends URLPatternOptions {
|
|
|
15
15
|
prefix?: string;
|
|
16
16
|
}
|
|
17
17
|
type Router = {
|
|
18
|
+
query(routes: Routes, options?: RouterOptions): Chainable;
|
|
19
|
+
query(pattern: string, route: Route, options?: RouterOptions): Chainable;
|
|
18
20
|
patch(routes: Routes, options?: RouterOptions): Chainable;
|
|
19
21
|
patch(pattern: string, route: Route, options?: RouterOptions): Chainable;
|
|
20
22
|
trace(routes: Routes, options?: RouterOptions): Chainable;
|
package/lib/router.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getReq } from './dx.js';
|
|
2
2
|
import { urlFromReq } from './bodyHelpers.js';
|
|
3
|
+
// QUERY is defined by RFC 10008: https://www.rfc-editor.org/rfc/rfc10008.html
|
|
3
4
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
|
|
4
|
-
const allMethods = ['get', 'head', 'post', 'put', 'delete', 'connect', 'options', 'trace', 'patch'];
|
|
5
|
+
const allMethods = ['get', 'head', 'post', 'put', 'delete', 'connect', 'options', 'trace', 'patch', 'query'];
|
|
5
6
|
function makeRouter(method, // undefined means any method
|
|
6
7
|
routes, { prefix = '' } = {}) {
|
|
7
8
|
const routeWithUrlPatterns = routes.map(([pattern, handler]) => [new URLPattern({ pathname: `${prefix}${pattern}` }), handler]);
|
package/lib/stream.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage } from 'node:http';
|
|
2
2
|
import type { Readable } from 'node:stream';
|
|
3
|
-
export declare function getContentStream(req: IncomingMessage, encoding: string):
|
|
3
|
+
export declare function getContentStream(req: IncomingMessage, encoding: string): import("node:zlib").BrotliDecompress | import("node:zlib").Gunzip | IncomingMessage | import("node:zlib").Inflate | import("node:zlib").ZstdDecompress;
|
|
4
4
|
export declare function readStream(stream: Readable, { length, limit, }: {
|
|
5
5
|
length?: number;
|
|
6
6
|
limit?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dx-server",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"typescript": "^
|
|
31
|
+
"@types/node": "^26.1.1",
|
|
32
|
+
"typescript": "^7.0.2"
|
|
33
33
|
}
|
|
34
34
|
}
|