webhoster 0.3.3 → 0.3.5

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.
Files changed (157) hide show
  1. package/README.md +4 -4
  2. package/data/CookieObject.js +1 -1
  3. package/{types/index.js → data/custom-types.js} +1 -1
  4. package/{types/typings.d.ts → data/middleware.d.ts} +1 -1
  5. package/helpers/RequestReader.js +1 -1
  6. package/helpers/ResponseHeaders.js +9 -10
  7. package/lib/HttpHandler.js +4 -4
  8. package/lib/HttpRequest.js +2 -2
  9. package/lib/HttpResponse.js +2 -2
  10. package/lib/HttpTransaction.js +2 -2
  11. package/middleware/AutoHeadersMiddleware.js +2 -2
  12. package/middleware/CORSMiddleware.js +3 -3
  13. package/middleware/CaseInsensitiveHeadersMiddleware.js +2 -2
  14. package/middleware/ContentDecoderMiddleware.js +1 -1
  15. package/middleware/ContentEncoderMiddleware.js +2 -2
  16. package/middleware/ContentLengthMiddleware.js +2 -2
  17. package/middleware/HashMiddleware.js +2 -2
  18. package/middleware/HeadMethodMiddleware.js +3 -3
  19. package/middleware/MethodMiddleware.js +3 -3
  20. package/middleware/PathMiddleware.js +4 -4
  21. package/middleware/ReadFormData.js +1 -1
  22. package/middleware/SendJsonMiddleware.js +4 -4
  23. package/middleware/SendStringMiddleware.js +3 -3
  24. package/package.json +21 -4
  25. package/templates/starter.js +2 -2
  26. package/types/data/CookieObject.d.ts +34 -0
  27. package/types/data/CookieObject.d.ts.map +1 -0
  28. package/types/data/custom-types.d.ts +111 -0
  29. package/types/data/custom-types.d.ts.map +1 -0
  30. package/types/errata/socketio.d.ts +11 -0
  31. package/types/errata/socketio.d.ts.map +1 -0
  32. package/types/examples/starter.d.ts +2 -0
  33. package/types/examples/starter.d.ts.map +1 -0
  34. package/types/helpers/HeadersParser.d.ts +27 -0
  35. package/types/helpers/HeadersParser.d.ts.map +1 -0
  36. package/types/helpers/HttpListener.d.ts +84 -0
  37. package/types/helpers/HttpListener.d.ts.map +1 -0
  38. package/types/helpers/RequestHeaders.d.ts +25 -0
  39. package/types/helpers/RequestHeaders.d.ts.map +1 -0
  40. package/types/helpers/RequestReader.d.ts +52 -0
  41. package/types/helpers/RequestReader.d.ts.map +1 -0
  42. package/types/helpers/ResponseHeaders.d.ts +126 -0
  43. package/types/helpers/ResponseHeaders.d.ts.map +1 -0
  44. package/types/helpers/index.d.ts +6 -0
  45. package/types/helpers/index.d.ts.map +1 -0
  46. package/types/lib/HttpHandler.d.ts +79 -0
  47. package/types/lib/HttpHandler.d.ts.map +1 -0
  48. package/types/lib/HttpRequest.d.ts +175 -0
  49. package/types/lib/HttpRequest.d.ts.map +1 -0
  50. package/types/lib/HttpResponse.d.ts +117 -0
  51. package/types/lib/HttpResponse.d.ts.map +1 -0
  52. package/types/lib/HttpTransaction.d.ts +114 -0
  53. package/types/lib/HttpTransaction.d.ts.map +1 -0
  54. package/types/middleware/AutoHeadersMiddleware.d.ts +27 -0
  55. package/types/middleware/AutoHeadersMiddleware.d.ts.map +1 -0
  56. package/types/middleware/CORSMiddleware.d.ts +65 -0
  57. package/types/middleware/CORSMiddleware.d.ts.map +1 -0
  58. package/types/middleware/CaseInsensitiveHeadersMiddleware.d.ts +27 -0
  59. package/types/middleware/CaseInsensitiveHeadersMiddleware.d.ts.map +1 -0
  60. package/types/middleware/ContentDecoderMiddleware.d.ts +17 -0
  61. package/types/middleware/ContentDecoderMiddleware.d.ts.map +1 -0
  62. package/types/middleware/ContentEncoderMiddleware.d.ts +48 -0
  63. package/types/middleware/ContentEncoderMiddleware.d.ts.map +1 -0
  64. package/types/middleware/ContentLengthMiddleware.d.ts +38 -0
  65. package/types/middleware/ContentLengthMiddleware.d.ts.map +1 -0
  66. package/types/middleware/HashMiddleware.d.ts +28 -0
  67. package/types/middleware/HashMiddleware.d.ts.map +1 -0
  68. package/types/middleware/HeadMethodMiddleware.d.ts +12 -0
  69. package/types/middleware/HeadMethodMiddleware.d.ts.map +1 -0
  70. package/types/middleware/MethodMiddleware.d.ts +40 -0
  71. package/types/middleware/MethodMiddleware.d.ts.map +1 -0
  72. package/types/middleware/PathMiddleware.d.ts +81 -0
  73. package/types/middleware/PathMiddleware.d.ts.map +1 -0
  74. package/types/middleware/ReadFormData.d.ts +7 -0
  75. package/types/middleware/ReadFormData.d.ts.map +1 -0
  76. package/types/middleware/SendJsonMiddleware.d.ts +51 -0
  77. package/types/middleware/SendJsonMiddleware.d.ts.map +1 -0
  78. package/types/middleware/SendStringMiddleware.d.ts +35 -0
  79. package/types/middleware/SendStringMiddleware.d.ts.map +1 -0
  80. package/types/templates/starter.d.ts +15 -0
  81. package/types/templates/starter.d.ts.map +1 -0
  82. package/types/utils/AsyncObject.d.ts +38 -0
  83. package/types/utils/AsyncObject.d.ts.map +1 -0
  84. package/types/utils/CaseInsensitiveObject.d.ts +9 -0
  85. package/types/utils/CaseInsensitiveObject.d.ts.map +1 -0
  86. package/types/utils/function.d.ts +2 -0
  87. package/types/utils/function.d.ts.map +1 -0
  88. package/types/utils/headers.d.ts +7 -0
  89. package/types/utils/headers.d.ts.map +1 -0
  90. package/types/utils/qualityValues.d.ts +12 -0
  91. package/types/utils/qualityValues.d.ts.map +1 -0
  92. package/types/utils/stream.d.ts +6 -0
  93. package/types/utils/stream.d.ts.map +1 -0
  94. package/utils/headers.js +1 -1
  95. package/.eslintrc.json +0 -96
  96. package/.github/FUNDING.yml +0 -4
  97. package/.github/copilot-instructions.md +0 -100
  98. package/.github/workflows/publish.yml +0 -29
  99. package/.github/workflows/test-matrix.yml +0 -37
  100. package/.test/benchmark.js +0 -28
  101. package/.test/constants.js +0 -4
  102. package/.test/cookietester.js +0 -19
  103. package/.test/http2server.js +0 -35
  104. package/.test/httpserver.js +0 -32
  105. package/.test/index.js +0 -498
  106. package/.test/multipromise.js +0 -32
  107. package/.test/tls.js +0 -75
  108. package/.test/urlencoded.js +0 -54
  109. package/.vscode/launch.json +0 -35
  110. package/.vscode/settings.json +0 -5
  111. package/CHANGELOG.md +0 -10
  112. package/CODE_OF_CONDUCT.md +0 -76
  113. package/errata/index.js +0 -1
  114. package/examples/starter.js +0 -11
  115. package/index.js +0 -4
  116. package/jsconfig.json +0 -12
  117. package/lib/index.js +0 -3
  118. package/middleware/ContentReaderMiddleware.js +0 -249
  119. package/middleware/ContentWriterMiddleware.js +0 -161
  120. package/middleware/SendHeadersMiddleware.js +0 -47
  121. package/middleware/index.js +0 -11
  122. package/polyfill/FormData.js +0 -164
  123. package/rollup.config.js +0 -8
  124. package/scripts/check-teapot.mjs +0 -40
  125. package/scripts/test-all-sync.sh +0 -6
  126. package/scripts/test-all.sh +0 -7
  127. package/test/fixtures/stream.js +0 -68
  128. package/test/helpers/HttpListener/construct.js +0 -18
  129. package/test/helpers/HttpListener/customOptions.js +0 -22
  130. package/test/helpers/HttpListener/doubleCreate.js +0 -40
  131. package/test/helpers/HttpListener/events.js +0 -77
  132. package/test/helpers/HttpListener/http.js +0 -31
  133. package/test/helpers/HttpListener/http2.js +0 -41
  134. package/test/helpers/HttpListener/https.js +0 -38
  135. package/test/helpers/HttpListener/startAll.js +0 -31
  136. package/test/helpers/HttpListener/stopNotStarted.js +0 -23
  137. package/test/lib/HttpHandler/class.js +0 -8
  138. package/test/lib/HttpHandler/handleRequest.js +0 -11
  139. package/test/lib/HttpHandler/middleware.js +0 -941
  140. package/test/lib/HttpHandler/parse.js +0 -41
  141. package/test/lib/HttpRequest/class.js +0 -8
  142. package/test/lib/HttpRequest/downstream.js +0 -171
  143. package/test/lib/HttpRequest/properties.js +0 -101
  144. package/test/lib/HttpRequest/read.js +0 -518
  145. package/test/lib/HttpResponse/async-iterable-middleware.js +0 -37
  146. package/test/lib/HttpResponse/async-iterable.js +0 -31
  147. package/test/lib/HttpResponse/class.js +0 -8
  148. package/test/lib/HttpResponse/properties.js +0 -59
  149. package/test/lib/HttpResponse/send.js +0 -275
  150. package/test/lib/HttpTransaction/class.js +0 -8
  151. package/test/lib/HttpTransaction/ping.js +0 -50
  152. package/test/lib/HttpTransaction/push.js +0 -89
  153. package/test/middleware/SendJsonMiddleware.js +0 -222
  154. package/test/sanity.js +0 -10
  155. package/test/templates/error-teapot.js +0 -47
  156. package/test/templates/starter.js +0 -93
  157. package/tsconfig.json +0 -30
@@ -0,0 +1,117 @@
1
+ /** @typedef {import('http').OutgoingHttpHeaders} OutgoingHttpHeaders */
2
+ /** @typedef {import('stream').Stream} Stream */
3
+ /** @typedef {import('../data/custom-types.js').Middleware} Middleware */
4
+ /** @typedef {import('./HttpRequest.js').default} HttpRequest */
5
+ /** @typedef {import('../data/custom-types.js').ResponseFinalizer} ResponseFinalizer */
6
+ /**
7
+ * @typedef {Object} HttpResponseOptions
8
+ * @prop {HttpRequest} [request]
9
+ * @prop {OutgoingHttpHeaders} [headers]
10
+ * @prop {function():boolean} [onHeadersSent]
11
+ * @prop {(flush:boolean, end:boolean) => any} [onSendHeaders]
12
+ * @prop {number} [status]
13
+ * @prop {Writable} stream
14
+ * @prop {Stream[]} [pipes]
15
+ * @prop {ResponseFinalizer[]} [finalizers] inline middleware for message body
16
+ * @prop {any} [body]
17
+ */
18
+ export default class HttpResponse {
19
+ /** @param {HttpResponseOptions} options */
20
+ constructor(options: HttpResponseOptions);
21
+ request: import("./HttpRequest.js").default;
22
+ /** @type {OutgoingHttpHeaders} */
23
+ headers: OutgoingHttpHeaders;
24
+ isStreaming: boolean;
25
+ stream: import("stream").Writable;
26
+ pipes: import("stream").Stream[];
27
+ /** @type {ResponseFinalizer[]} */
28
+ finalizers: ResponseFinalizer[];
29
+ status: number;
30
+ /** @type {any} */
31
+ body: any;
32
+ set statusCode(number: number);
33
+ get statusCode(): number;
34
+ /**
35
+ * A boolean indicating whether the response was successful (status in the range 200–299) or not.
36
+ * @return {boolean}
37
+ */
38
+ get ok(): boolean;
39
+ get headersSent(): boolean;
40
+ /**
41
+ * @param {boolean} [flush] Flush headers
42
+ * @param {boolean} [end] End stream
43
+ * @return {void}
44
+ */
45
+ sendHeaders(flush?: boolean, end?: boolean): void;
46
+ /**
47
+ * @param {number} [status]
48
+ * @return {Promise<0>} HttpHandler.END
49
+ */
50
+ sendStatusOnly(status?: number): Promise<0>;
51
+ /**
52
+ * Send message body to response stream without finalizers
53
+ * @param {any} [body]
54
+ * @return {Promise<0>}
55
+ */
56
+ sendRaw(body?: any): Promise<0>;
57
+ /** @return {boolean} */
58
+ hasPipeline(): boolean;
59
+ /**
60
+ * @param {import('stream').Transform} stream
61
+ * @return {this}
62
+ */
63
+ addUpstream(stream: import("stream").Transform): this;
64
+ /**
65
+ * @param {(err: NodeJS.ErrnoException | null) => void} [callback] pipeline completion
66
+ * @return {Writable}
67
+ */
68
+ getPipeline(callback?: (err: NodeJS.ErrnoException | null) => void): Writable;
69
+ /**
70
+ * Asynchronously sends message body
71
+ * Returns on completions
72
+ * @throws {Error}
73
+ * @param {any} [body]
74
+ * @return {Promise<0>} HttpHandler.END
75
+ */
76
+ send(body?: any): Promise<0>;
77
+ wasEndCalled(): boolean;
78
+ /**
79
+ * Synchronously ends stream with message body. Ignores errors
80
+ * @param {any} [body]
81
+ * @return {0} HttpHandler.END
82
+ */
83
+ end(body?: any): 0;
84
+ /**
85
+ * @param {number} status
86
+ * @return {this}
87
+ */
88
+ code(status: number): this;
89
+ /**
90
+ * @param {number} status
91
+ * @throws {Error<ERR_HEADER_SENT>}
92
+ * @return {this}
93
+ */
94
+ setStatus(status: number): this;
95
+ #private;
96
+ }
97
+ export type Writable = import("stream").Writable;
98
+ export type OutgoingHttpHeaders = import("http").OutgoingHttpHeaders;
99
+ export type Stream = import("stream").Stream;
100
+ export type Middleware = import("../data/custom-types.js").Middleware;
101
+ export type HttpRequest = import("./HttpRequest.js").default;
102
+ export type ResponseFinalizer = import("../data/custom-types.js").ResponseFinalizer;
103
+ export type HttpResponseOptions = {
104
+ request?: HttpRequest;
105
+ headers?: OutgoingHttpHeaders;
106
+ onHeadersSent?: () => boolean;
107
+ onSendHeaders?: (flush: boolean, end: boolean) => any;
108
+ status?: number;
109
+ stream: Writable;
110
+ pipes?: Stream[];
111
+ /**
112
+ * inline middleware for message body
113
+ */
114
+ finalizers?: ResponseFinalizer[];
115
+ body?: any;
116
+ };
117
+ //# sourceMappingURL=HttpResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpResponse.d.ts","sourceRoot":"","sources":["../../lib/HttpResponse.js"],"names":[],"mappings":"AAWA,wEAAwE;AACxE,gDAAgD;AAChD,yEAAyE;AACzE,gEAAgE;AAChE,uFAAuF;AAEvF;;;;;;;;;;;GAWG;AAEH;IAmBE,2CAA2C;IAC3C,qBADY,mBAAmB,EAe9B;IAbC,4CAA8B;IAC9B,kCAAkC;IAClC,SADW,mBAAmB,CACM;IACpC,qBAAwB;IACxB,kCAA4B;IAC5B,iCAAgC;IAChC,kCAAkC;IAClC,YADW,iBAAiB,EAAE,CACY;IAC1C,eAA4B;IAC5B,kBAAkB;IAClB,MADW,GAAG,CACU;IAS1B,+BAEC;IAND,yBAEC;IAMD;;;OAGG;IACH,UAFY,OAAO,CAIlB;IAED,2BAIC;IAED;;;;OAIG;IACH,oBAJW,OAAO,QACP,OAAO,GACN,IAAI,CAWf;IAED;;;OAGG;IACH,wBAHW,MAAM,GACL,OAAO,CAAC,CAAC,CAAC,CAUrB;IAED;;;;OAIG;IACH,eAHW,GAAG,GACF,OAAO,CAAC,CAAC,CAAC,CASrB;IAED,wBAAwB;IACxB,eADa,OAAO,CAGnB;IAED;;;OAGG;IACH,oBAHW,OAAO,QAAQ,EAAE,SAAS,GACzB,IAAI,CAKf;IAED;;;OAGG;IACH,uBAHW,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,KAAK,IAAI,GAC1C,QAAQ,CAmDnB;IAED;;;;;;OAMG;IACH,YAHW,GAAG,GACF,OAAO,CAAC,CAAC,CAAC,CA6CrB;IAED,wBAEC;IAED;;;;OAIG;IACH,WAHW,GAAG,GACF,CAAC,CAmGZ;IAID;;;OAGG;IACH,aAHW,MAAM,GACL,IAAI,CAKf;IAED;;;;OAIG;IACH,kBAJW,MAAM,GAEL,IAAI,CAMf;;CACF;uBAzXa,OAAO,QAAQ,EAAE,QAAQ;kCAMzB,OAAO,MAAM,EAAE,mBAAmB;qBAClC,OAAO,QAAQ,EAAE,MAAM;yBACvB,OAAO,yBAAyB,EAAE,UAAU;0BAC5C,OAAO,kBAAkB,EAAE,OAAO;gCAClC,OAAO,yBAAyB,EAAE,iBAAiB;;cAIvD,WAAW;cACX,mBAAmB;oBACnB,MAAW,OAAO;oBAClB,CAAC,KAAK,EAAC,OAAO,EAAE,GAAG,EAAC,OAAO,KAAK,GAAG;aACnC,MAAM;YACN,QAAQ;YACR,MAAM,EAAE;;;;iBACR,iBAAiB,EAAE;WACnB,GAAG"}
@@ -0,0 +1,114 @@
1
+ /** @typedef {import('./HttpRequest.js').default} HttpRequest */
2
+ /** @typedef {import('./HttpResponse.js').default} HttpResponse */
3
+ /** @typedef {import('stream').Stream} Stream */
4
+ /** @typedef {import('../data/custom-types.js').MediaType} MediaType */
5
+ /** @typedef {import('../data/custom-types.js').Middleware} Middleware */
6
+ /** @typedef {import('stream').Writable} Writable */
7
+ /** @typedef {Partial<MediaType> & {parse:(this:HttpRequest)=>any|PromiseLike<any>, test?:(this:HttpRequest, mediaType: MediaType)=>boolean}} ContentReaderRegistration */
8
+ /**
9
+ * @typedef {Object} PathHistoryEntry
10
+ * @prop {string} base
11
+ * @prop {number[]} treeIndex
12
+ */
13
+ /**
14
+ * @typedef {Object} PathState
15
+ * @prop {PathHistoryEntry[]} history
16
+ * @prop {string} currentPath
17
+ */
18
+ /**
19
+ * @typedef {Object} HttpTransactionState
20
+ * @prop {number[]} treeIndex Middleware level
21
+ * @prop {PathState} path
22
+ */
23
+ /**
24
+ * @template {Object<string,any>} T
25
+ * @typedef HttpTransactionOptions
26
+ * @prop {string} httpVersion
27
+ * @prop {HttpRequest} [request]
28
+ * @prop {HttpResponse} [response]
29
+ * @prop {import('net').Socket|import('tls').TLSSocket} socket
30
+ * @prop {boolean} [canPing]
31
+ * @prop {(function():Promise<any>)|(function():any)} [onPing]
32
+ * @prop {boolean|function():boolean} [canPushPath]
33
+ * @prop {(path:string) => Promise<any>} [onPushPath]
34
+ * @prop {function():boolean} [onHeadersSent]
35
+ * @prop {(flush:boolean, end:boolean) => boolean} [onSendHeaders]
36
+ * @prop {T} [locals]
37
+ * @prop {HttpTransactionState} [state]
38
+ * @prop {Error} [error]
39
+ */
40
+ /**
41
+ * @template {Object<string,any>} [T=any]
42
+ */
43
+ export default class HttpTransaction<T extends {
44
+ [x: string]: any;
45
+ } = any> {
46
+ /** @param {HttpTransactionOptions<T>} options */
47
+ constructor(options: HttpTransactionOptions<T>);
48
+ request: import("./HttpRequest.js").default;
49
+ response: import("./HttpResponse.js").default;
50
+ /** @type {T} */
51
+ locals: T;
52
+ state: HttpTransactionState;
53
+ socket: import("net").Socket | import("tls").TLSSocket;
54
+ httpVersion: string;
55
+ error: Error;
56
+ setErrorHandlerState(): void;
57
+ isErrorHandlerState(): boolean;
58
+ get canPing(): boolean;
59
+ /**
60
+ * @return {Promise<any>}
61
+ */
62
+ ping(): Promise<any>;
63
+ get pushedPaths(): string[];
64
+ get canPushPath(): boolean;
65
+ /**
66
+ * @param {string} [path]
67
+ * @return {Promise<any>}
68
+ */
69
+ pushPath(path?: string): Promise<any>;
70
+ #private;
71
+ }
72
+ export type HttpRequest = import("./HttpRequest.js").default;
73
+ export type HttpResponse = import("./HttpResponse.js").default;
74
+ export type Stream = import("stream").Stream;
75
+ export type MediaType = import("../data/custom-types.js").MediaType;
76
+ export type Middleware = import("../data/custom-types.js").Middleware;
77
+ export type Writable = import("stream").Writable;
78
+ export type ContentReaderRegistration = Partial<MediaType> & {
79
+ parse: (this: HttpRequest) => any | PromiseLike<any>;
80
+ test?: (this: HttpRequest, mediaType: MediaType) => boolean;
81
+ };
82
+ export type PathHistoryEntry = {
83
+ base: string;
84
+ treeIndex: number[];
85
+ };
86
+ export type PathState = {
87
+ history: PathHistoryEntry[];
88
+ currentPath: string;
89
+ };
90
+ export type HttpTransactionState = {
91
+ /**
92
+ * Middleware level
93
+ */
94
+ treeIndex: number[];
95
+ path: PathState;
96
+ };
97
+ export type HttpTransactionOptions<T extends {
98
+ [x: string]: any;
99
+ }> = {
100
+ httpVersion: string;
101
+ request?: HttpRequest;
102
+ response?: HttpResponse;
103
+ socket: import("net").Socket | import("tls").TLSSocket;
104
+ canPing?: boolean;
105
+ onPing?: (() => Promise<any>) | (() => any);
106
+ canPushPath?: boolean | (() => boolean);
107
+ onPushPath?: (path: string) => Promise<any>;
108
+ onHeadersSent?: () => boolean;
109
+ onSendHeaders?: (flush: boolean, end: boolean) => boolean;
110
+ locals?: T;
111
+ state?: HttpTransactionState;
112
+ error?: Error;
113
+ };
114
+ //# sourceMappingURL=HttpTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTransaction.d.ts","sourceRoot":"","sources":["../../lib/HttpTransaction.js"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,kEAAkE;AAClE,gDAAgD;AAEhD,uEAAuE;AACvE,yEAAyE;AACzE,oDAAoD;AAEpD,0KAA0K;AAE1K;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AACH,qCAFmC,CAAC,SAAvB;QAAQ,MAAM,GAAC,GAAG;CAAE;IAoB/B,iDAAiD;IACjD,qBADY,sBAAsB,CAAC,CAAC,CAAC,EAsBpC;IApBC,4CAA8B;IAC9B,8CAAgC;IAEhC,gBAAgB;IAChB,QADW,CAAC,CACyC;IACrD,4BAGC;IAED,uDAA4B;IAC5B,oBAAsC;IAQtC,aAA0B;IAG5B,6BAEC;IAED,+BAEC;IAED,uBAIC;IAED;;OAEG;IACH,QAFY,OAAO,CAAC,GAAG,CAAC,CAUvB;IAED,4BAEC;IAED,2BAIC;IAED;;;OAGG;IACH,gBAHW,MAAM,GACL,OAAO,CAAC,GAAG,CAAC,CAcvB;;CACF;0BAjJa,OAAO,kBAAkB,EAAE,OAAO;2BAClC,OAAO,mBAAmB,EAAE,OAAO;qBACnC,OAAO,QAAQ,EAAE,MAAM;wBAEvB,OAAO,yBAAyB,EAAE,SAAS;yBAC3C,OAAO,yBAAyB,EAAE,UAAU;uBAC5C,OAAO,QAAQ,EAAE,QAAQ;wCAEzB,OAAO,CAAC,SAAS,CAAC,GAAG;IAAC,KAAK,EAAC,CAAC,IAAI,EAAC,WAAW,KAAG,GAAG,GAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAAC,IAAI,CAAC,EAAC,CAAC,IAAI,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,KAAG,OAAO,CAAA;CAAC;;UAIlI,MAAM;eACN,MAAM,EAAE;;;aAKR,gBAAgB,EAAE;iBAClB,MAAM;;;;;;eAKN,MAAM,EAAE;UACR,SAAS;;mCAIe,CAAC,SAAtB;QAAQ,MAAM,GAAC,GAAG;CAAE;iBAEvB,MAAM;cACN,WAAW;eACX,YAAY;YACZ,OAAO,KAAK,EAAE,MAAM,GAAC,OAAO,KAAK,EAAE,SAAS;cAC5C,OAAO;aACP,CAAC,MAAW,OAAO,CAAC,GAAG,CAAC,CAAC,GAAC,CAAC,MAAW,GAAG,CAAC;kBAC1C,OAAO,IAAC,MAAW,OAAO,CAAA;iBAC1B,CAAC,IAAI,EAAC,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC;oBAC7B,MAAW,OAAO;oBAClB,CAAC,KAAK,EAAC,OAAO,EAAE,GAAG,EAAC,OAAO,KAAK,OAAO;aACvC,CAAC;YACD,oBAAoB;YACpB,KAAK"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @typedef {Object} AutoHeadersMiddlewareOptions
3
+ * @prop {boolean} [setStatus=true]
4
+ * Automatically set `200` or `204` status if not set
5
+ */
6
+ export default class AutoHeadersMiddleware {
7
+ /** @param {AutoHeadersMiddlewareOptions} options */
8
+ constructor(options?: AutoHeadersMiddlewareOptions);
9
+ setStatus: boolean;
10
+ finalizeResponse(response: import("../data/custom-types.js").HttpResponse): void | null | boolean | Promise<void | null | boolean>;
11
+ /**
12
+ * @param {HttpResponse} response
13
+ * @return {void}
14
+ */
15
+ addTransformStream(response: HttpResponse): void;
16
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
17
+ }
18
+ export type HttpResponse = import("../lib/HttpResponse.js").default;
19
+ export type ResponseFinalizer = import("../data/custom-types.js").ResponseFinalizer;
20
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
21
+ export type AutoHeadersMiddlewareOptions = {
22
+ /**
23
+ * Automatically set `200` or `204` status if not set
24
+ */
25
+ setStatus?: boolean;
26
+ };
27
+ //# sourceMappingURL=AutoHeadersMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoHeadersMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/AutoHeadersMiddleware.js"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH;IACE,oDAAoD;IACpD,sBADY,4BAA4B,EAIvC;IAFC,mBAA4C;;IAI9C;;;OAGG;IACH,6BAHW,YAAY,GACX,IAAI,CA+Bf;;CAoBF;2BAxEa,OAAO,wBAAwB,EAAE,OAAO;gCACxC,OAAO,yBAAyB,EAAE,iBAAiB;iCACnD,OAAO,yBAAyB,EAAE,kBAAkB;;;;;gBAMxD,OAAO"}
@@ -0,0 +1,65 @@
1
+ /** @typedef {import('../data/custom-types.js').IMiddleware} IMiddleware */
2
+ /** @typedef {import('../data/custom-types.js').MiddlewareFunction} MiddlewareFunction */
3
+ /** @typedef {import('../data/custom-types.js').RequestMethod} RequestMethod */
4
+ /**
5
+ * @typedef CORSMiddlewareOptions
6
+ * @prop {(string|RegExp)[]} [allowOrigin]
7
+ * Indicates whether the response can be shared, via returning the literal
8
+ * value of the `Origin` request header (which can be `null`) or `*` in a response.
9
+ * @prop {boolean} [allowCredentials]
10
+ * Indicates whether the response can be shared when request’s credentials mode is "include".
11
+ * @prop {RequestMethod[]} [allowMethods]
12
+ * Indicates which methods are supported by the response’s URL for the purposes of the CORS protocol.
13
+ * @prop {string[]} [allowHeaders]
14
+ * Indicates which headers are supported by the response’s URL for the purposes of the CORS protocol.
15
+ * @prop {number} [maxAge=5]
16
+ * Indicates the number of seconds (5 by default) the information provided by the
17
+ * `Access-Control-Allow-Methods` and `Access-Control-Allow-Headers` headers can be cached.
18
+ * @prop {string[]} [exposeHeaders]
19
+ * Indicates which headers can be exposed as part of the response by listing their names.
20
+ */
21
+ export default class CORSMiddleware {
22
+ static OK_BUFFER: Buffer<ArrayBuffer>;
23
+ static ACCESS_CONTROL_ALLOW_HEADERS_ALL: string;
24
+ /** @param {CORSMiddlewareOptions} [options] */
25
+ constructor(options?: CORSMiddlewareOptions);
26
+ allowOrigin: (string | RegExp)[];
27
+ allowCredentials: boolean;
28
+ allowMethods: import("../data/custom-types.js").RequestMethod[];
29
+ allowHeaders: string[];
30
+ maxAge: number;
31
+ exposeHeaders: string[];
32
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
33
+ }
34
+ export type IMiddleware = import("../data/custom-types.js").IMiddleware;
35
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
36
+ export type RequestMethod = import("../data/custom-types.js").RequestMethod;
37
+ export type CORSMiddlewareOptions = {
38
+ /**
39
+ * Indicates whether the response can be shared, via returning the literal
40
+ * value of the `Origin` request header (which can be `null`) or `*` in a response.
41
+ */
42
+ allowOrigin?: (string | RegExp)[];
43
+ /**
44
+ * Indicates whether the response can be shared when request’s credentials mode is "include".
45
+ */
46
+ allowCredentials?: boolean;
47
+ /**
48
+ * Indicates which methods are supported by the response’s URL for the purposes of the CORS protocol.
49
+ */
50
+ allowMethods?: RequestMethod[];
51
+ /**
52
+ * Indicates which headers are supported by the response’s URL for the purposes of the CORS protocol.
53
+ */
54
+ allowHeaders?: string[];
55
+ /**
56
+ * Indicates the number of seconds (5 by default) the information provided by the
57
+ * `Access-Control-Allow-Methods` and `Access-Control-Allow-Headers` headers can be cached.
58
+ */
59
+ maxAge?: number;
60
+ /**
61
+ * Indicates which headers can be exposed as part of the response by listing their names.
62
+ */
63
+ exposeHeaders?: string[];
64
+ };
65
+ //# sourceMappingURL=CORSMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CORSMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/CORSMiddleware.js"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,yFAAyF;AACzF,+EAA+E;AAE/E;;;;;;;;;;;;;;;;GAgBG;AAEH;IAWE,sCAA8C;IAE9C,gDAEY;IAdZ,+CAA+C;IAC/C,sBADY,qBAAqB,EAQhC;IANC,iCAAsC;IACtC,0BAAyD;IACzD,gEAAwC;IACxC,uBAAwC;IACxC,eAAiC;IACjC,wBAA0C;;CAkE7C;0BAhGa,OAAO,yBAAyB,EAAE,WAAW;iCAC7C,OAAO,yBAAyB,EAAE,kBAAkB;4BACpD,OAAO,yBAAyB,EAAE,aAAa;;;;;;kBAInD,CAAC,MAAM,GAAC,MAAM,CAAC,EAAE;;;;uBAGjB,OAAO;;;;mBAEP,aAAa,EAAE;;;;mBAEf,MAAM,EAAE;;;;;aAER,MAAM;;;;oBAGN,MAAM,EAAE"}
@@ -0,0 +1,27 @@
1
+ /** @typedef {import('../data/custom-types.js').IMiddleware} IMiddleware */
2
+ /** @typedef {import('../data/custom-types.js').MiddlewareFunction} MiddlewareFunction */
3
+ /**
4
+ * @typedef {Object} CaseInsensitiveHeadersMiddlewareOptions
5
+ * @prop {boolean} [request=false] Mutate request headers to be case-insensitive
6
+ * @prop {boolean} [response=false] Mutate response headers to be case-insensistive
7
+ */
8
+ export default class CaseInsensitiveHeadersMiddleware {
9
+ /** @param {CaseInsensitiveHeadersMiddlewareOptions} options */
10
+ constructor(options: CaseInsensitiveHeadersMiddlewareOptions);
11
+ request: boolean;
12
+ response: boolean;
13
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
14
+ }
15
+ export type IMiddleware = import("../data/custom-types.js").IMiddleware;
16
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
17
+ export type CaseInsensitiveHeadersMiddlewareOptions = {
18
+ /**
19
+ * Mutate request headers to be case-insensitive
20
+ */
21
+ request?: boolean;
22
+ /**
23
+ * Mutate response headers to be case-insensistive
24
+ */
25
+ response?: boolean;
26
+ };
27
+ //# sourceMappingURL=CaseInsensitiveHeadersMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseInsensitiveHeadersMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/CaseInsensitiveHeadersMiddleware.js"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,yFAAyF;AAEzF;;;;GAIG;AAEH;IACE,+DAA+D;IAC/D,qBADY,uCAAuC,EAIlD;IAFC,iBAAuC;IACvC,kBAAyC;;CAc5C;0BA3Ba,OAAO,yBAAyB,EAAE,WAAW;iCAC7C,OAAO,yBAAyB,EAAE,kBAAkB;;;;;cAIxD,OAAO;;;;eACP,OAAO"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Implements `Accept-Encoding`
3
+ * https://tools.ietf.org/html/rfc7231#section-5.3.4
4
+ */
5
+ export default class ContentDecoderMiddleware {
6
+ /** @param {ContentDecoderMiddlewareOptions} [options] */
7
+ constructor(options?: ContentDecoderMiddlewareOptions);
8
+ chunkSize: number;
9
+ respondNotAcceptable: boolean;
10
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
11
+ }
12
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
13
+ export type ContentDecoderMiddlewareOptions = {
14
+ chunkSize?: number;
15
+ respondNotAcceptable?: boolean;
16
+ };
17
+ //# sourceMappingURL=ContentDecoderMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentDecoderMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/ContentDecoderMiddleware.js"],"names":[],"mappings":"AAgBA;;;GAGG;AACH;IACE,yDAAyD;IACzD,sBADY,+BAA+B,EAI1C;IAFC,kBAAkC;IAClC,8BAAiE;;CAoHpE;iCAtIa,OAAO,yBAAyB,EAAE,kBAAkB;;gBAIxD,MAAM;2BACN,OAAO"}
@@ -0,0 +1,48 @@
1
+ export default class ContentEncoderMiddleware {
2
+ static BrotliCompressAsync: typeof brotliCompress.__promisify__;
3
+ static GzipAsync: typeof gzip.__promisify__;
4
+ static DeflateAsync: typeof deflate.__promisify__;
5
+ /**
6
+ * @param {IncomingHttpHeaders} headers
7
+ * @throws {NotAcceptableException} Error with `NOT_ACCEPTIBLE` message
8
+ * @return {COMPATIBLE_ENCODING}
9
+ */
10
+ static chooseEncoding(headers: IncomingHttpHeaders): COMPATIBLE_ENCODING;
11
+ /** @param {ContentEncoderMiddlewareOptions} [options] */
12
+ constructor(options?: ContentEncoderMiddlewareOptions);
13
+ chunkSize: number;
14
+ respondNotAcceptable: boolean;
15
+ preferredEncoding: "deflate" | "gzip" | "br" | "identity";
16
+ minimumSize: number;
17
+ asyncThreshold: number;
18
+ finalizeResponse(response: import("../data/custom-types.js").HttpResponse): void | null | boolean | Promise<void | null | boolean>;
19
+ /**
20
+ * @param {HttpResponse} response
21
+ * @return {void}
22
+ */
23
+ addTransformStream(response: HttpResponse): void;
24
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
25
+ }
26
+ export type IncomingHttpHeaders = import("http").IncomingHttpHeaders;
27
+ export type HttpRequest = import("../lib/HttpRequest.js").default;
28
+ export type HttpResponse = import("../lib/HttpResponse.js").default;
29
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
30
+ export type ResponseFinalizer = import("../data/custom-types.js").ResponseFinalizer;
31
+ export type COMPATIBLE_ENCODING = "br" | "gzip" | "deflate" | "identity" | "*";
32
+ export type ContentEncoderMiddlewareOptions = {
33
+ chunkSize?: number;
34
+ respondNotAcceptable?: boolean;
35
+ /**
36
+ * Minimum content size before using any compression
37
+ */
38
+ preferredEncoding?: "br" | "gzip" | "deflate" | "identity";
39
+ /**
40
+ * Minimum content size before using async compression
41
+ */
42
+ minimumSize?: number;
43
+ asyncThreshold?: number;
44
+ };
45
+ import { brotliCompress } from 'node:zlib';
46
+ import { gzip } from 'node:zlib';
47
+ import { deflate } from 'node:zlib';
48
+ //# sourceMappingURL=ContentEncoderMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentEncoderMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/ContentEncoderMiddleware.js"],"names":[],"mappings":"AAwCA;IACE,gEAAuD;IAEvD,4CAAmC;IAEnC,kDAAyC;IAEzC;;;;OAIG;IACH,+BAJW,mBAAmB,GAElB,mBAAmB,CA8C9B;IAED,yDAAyD;IACzD,sBADY,+BAA+B,EAQ1C;IANC,kBAAkC;IAClC,8BAAiE;IACjE,0DAAgE;IAChE,oBAA8D;IAC9D,uBAAuE;;IAIzE;;;OAGG;IACH,6BAHW,YAAY,GACX,IAAI,CA4Ef;;CAwGF;kCApRa,OAAO,MAAM,EAAE,mBAAmB;0BAClC,OAAO,uBAAuB,EAAE,OAAO;2BACvC,OAAO,wBAAwB,EAAE,OAAO;iCACxC,OAAO,yBAAyB,EAAE,kBAAkB;gCACpD,OAAO,yBAAyB,EAAE,iBAAiB;kCAEnD,IAAI,GAAC,MAAM,GAAC,SAAS,GAAC,UAAU,GAAC,GAAG;;gBAQxC,MAAM;2BACN,OAAO;;;;wBACP,IAAI,GAAC,MAAM,GAAC,SAAS,GAAC,UAAU;;;;kBAEhC,MAAM;qBAEN,MAAM;;+BA1BT,WAAW;qBAAX,WAAW;wBAAX,WAAW"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @typedef {Object} ContentLengthMiddlewareOptions
3
+ * @prop {number} [delayCycles=2]
4
+ * Delays writing to stream by setTimeout cycles when piping.
5
+ * If `.end()` is called on the same event loop as write, then the
6
+ * content length can be still calculated despite receiving data in chunks.
7
+ * @prop {boolean} [overrideHeader=false]
8
+ * Always replace `Content-Length` header
9
+ */
10
+ export default class ContentLengthMiddleware {
11
+ /** @param {ContentLengthMiddlewareOptions} [options] */
12
+ constructor(options?: ContentLengthMiddlewareOptions);
13
+ delayCycles: number;
14
+ overrideHeader: boolean;
15
+ finalizeResponse(response: import("../data/custom-types.js").HttpResponse): void | null | boolean | Promise<void | null | boolean>;
16
+ /**
17
+ * @param {HttpResponse} response
18
+ * @return {void}
19
+ */
20
+ addTransformStream(response: HttpResponse): void;
21
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
22
+ }
23
+ export type HttpResponse = import("../lib/HttpResponse.js").default;
24
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
25
+ export type ResponseFinalizer = import("../data/custom-types.js").ResponseFinalizer;
26
+ export type ContentLengthMiddlewareOptions = {
27
+ /**
28
+ * Delays writing to stream by setTimeout cycles when piping.
29
+ * If `.end()` is called on the same event loop as write, then the
30
+ * content length can be still calculated despite receiving data in chunks.
31
+ */
32
+ delayCycles?: number;
33
+ /**
34
+ * Always replace `Content-Length` header
35
+ */
36
+ overrideHeader?: boolean;
37
+ };
38
+ //# sourceMappingURL=ContentLengthMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentLengthMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/ContentLengthMiddleware.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AAEH;IACE,wDAAwD;IACxD,sBADY,8BAA8B,EAKzC;IAHC,oBAA2C;IAC3C,wBAAqD;;IAIvD;;;OAGG;IACH,6BAHW,YAAY,GACX,IAAI,CAwDf;;CA+BF;2BAjHa,OAAO,wBAAwB,EAAE,OAAO;iCACxC,OAAO,yBAAyB,EAAE,kBAAkB;gCACpD,OAAO,yBAAyB,EAAE,iBAAiB;;;;;;;kBAMvD,MAAM;;;;qBAIN,OAAO"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @typedef {Object} HashMiddlewareOptions
3
+ * @prop {'md5'|'sha1'|'sha256'|'sha512'} [algorithm=DEFAULT_ALGORITHM]
4
+ * @prop {BinaryToTextEncoding} [digest=DEFAULT_DIGEST]
5
+ */
6
+ export default class HashMiddleware {
7
+ /** @param {HashMiddlewareOptions} options */
8
+ constructor(options?: HashMiddlewareOptions);
9
+ algorithm: "sha1" | "md5" | "sha256" | "sha512";
10
+ digest: import("crypto").BinaryToTextEncoding;
11
+ finalizeResponse(response: import("../data/custom-types.js").HttpResponse): void | null | boolean | Promise<void | null | boolean>;
12
+ /**
13
+ * @param {HttpResponse} response
14
+ * @return {void}
15
+ */
16
+ addTransformStream(response: HttpResponse): void;
17
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
18
+ }
19
+ export type BinaryToTextEncoding = import("node:crypto").BinaryToTextEncoding;
20
+ export type HttpRequest = import("../lib/HttpRequest.js").default;
21
+ export type HttpResponse = import("../lib/HttpResponse.js").default;
22
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
23
+ export type ResponseFinalizer = import("../data/custom-types.js").ResponseFinalizer;
24
+ export type HashMiddlewareOptions = {
25
+ algorithm?: "md5" | "sha1" | "sha256" | "sha512";
26
+ digest?: BinaryToTextEncoding;
27
+ };
28
+ //# sourceMappingURL=HashMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HashMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/HashMiddleware.js"],"names":[],"mappings":"AAaA;;;;GAIG;AAEH;IACE,6CAA6C;IAC7C,sBADY,qBAAqB,EAKhC;IAHC,gDAAuD;IACvD,8CAA8C;;IAIhD;;;OAGG;IACH,6BAHW,YAAY,GACX,IAAI,CAiDf;;CA8BF;mCAzGa,OAAO,aAAa,EAAE,oBAAoB;0BAC1C,OAAO,uBAAuB,EAAE,OAAO;2BACvC,OAAO,wBAAwB,EAAE,OAAO;iCACxC,OAAO,yBAAyB,EAAE,kBAAkB;gCACpD,OAAO,yBAAyB,EAAE,iBAAiB;;gBAQvD,KAAK,GAAC,MAAM,GAAC,QAAQ,GAAC,QAAQ;aAC9B,oBAAoB"}
@@ -0,0 +1,12 @@
1
+ export default class HeadMethodMiddleware {
2
+ /** @type {ConstructorParameters<typeof Transform>[0]} */
3
+ static DEFAULT_TRANSFORM_OPTIONS: ConstructorParameters<typeof Transform>[0];
4
+ static FinalizeResponse(response: import("../data/custom-types.js").HttpResponse): void | null | boolean | Promise<void | null | boolean>;
5
+ static Execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
6
+ execute: any;
7
+ }
8
+ export type HttpTransaction = import("../data/custom-types.js").HttpTransaction;
9
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
10
+ export type ResponseFinalizer = import("../data/custom-types.js").ResponseFinalizer;
11
+ import { Transform } from 'node:stream';
12
+ //# sourceMappingURL=HeadMethodMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeadMethodMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/HeadMethodMiddleware.js"],"names":[],"mappings":"AAMA;IAKE,yDAAyD;IACzD,kCADW,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAInD;;;IAPA,aAAsD;CAuBzD;8BA/Ba,OAAO,yBAAyB,EAAE,eAAe;iCACjD,OAAO,yBAAyB,EAAE,kBAAkB;gCACpD,OAAO,yBAAyB,EAAE,iBAAiB;0BAEvC,aAAa"}
@@ -0,0 +1,40 @@
1
+ /** @typedef {import('../data/custom-types.js').HttpTransaction} HttpTransaction */
2
+ /** @typedef {import('../data/custom-types.js').MiddlewareFunction} MiddlewareFunction */
3
+ /** @typedef {import('../data/custom-types.js').RequestMethod} RequestMethod */
4
+ /** @typedef {RegExp|RequestMethod} MethodEntry */
5
+ /**
6
+ * @typedef {Object} MethodMiddlewareOptions
7
+ * @prop {MethodEntry|MethodEntry[]} method
8
+ */
9
+ export default class MethodMiddleware {
10
+ /** @type {Map<MethodEntry, MethodMiddleware>} */
11
+ static cache: Map<MethodEntry, MethodMiddleware>;
12
+ /**
13
+ * @param {RequestMethod} method
14
+ * @param {RegExp | string} input
15
+ * @return {boolean}
16
+ */
17
+ static test(method: RequestMethod, input: RegExp | string): boolean;
18
+ static CONNECT(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
19
+ static DELETE(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
20
+ static HEADORGET(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
21
+ static GET(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
22
+ static OPTIONS(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
23
+ static HEAD(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
24
+ static PATCH(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
25
+ static POST(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
26
+ static PUT(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
27
+ static TRACE(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
28
+ /** @param {MethodMiddlewareOptions|MethodEntry|MethodEntry[]} options */
29
+ constructor(options: MethodMiddlewareOptions | MethodEntry | MethodEntry[]);
30
+ method: MethodEntry[];
31
+ execute(transaction: import("../lib/HttpTransaction.js").default<any>): import("../data/custom-types.js").MiddlewareFunctionResult;
32
+ }
33
+ export type HttpTransaction = import("../data/custom-types.js").HttpTransaction;
34
+ export type MiddlewareFunction = import("../data/custom-types.js").MiddlewareFunction;
35
+ export type RequestMethod = import("../data/custom-types.js").RequestMethod;
36
+ export type MethodEntry = RegExp | RequestMethod;
37
+ export type MethodMiddlewareOptions = {
38
+ method: MethodEntry | MethodEntry[];
39
+ };
40
+ //# sourceMappingURL=MethodMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MethodMiddleware.d.ts","sourceRoot":"","sources":["../../middleware/MethodMiddleware.js"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,yFAAyF;AACzF,+EAA+E;AAE/E,kDAAkD;AAElD;;;GAGG;AAEH;IAYE,iDAAiD;IACjD,cADW,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,CACpB;IAEzB;;;;OAIG;IACH,oBAJW,aAAa,SACb,MAAM,GAAG,MAAM,GACd,OAAO,CAOlB;;;;;;;;;;;IAxBD,yEAAyE;IACzE,qBADY,uBAAuB,GAAC,WAAW,GAAC,WAAW,EAAE,EAS5D;IANG,sBAAqB;;CA8D1B;8BA7Ea,OAAO,yBAAyB,EAAE,eAAe;iCACjD,OAAO,yBAAyB,EAAE,kBAAkB;4BACpD,OAAO,yBAAyB,EAAE,aAAa;0BAE/C,MAAM,GAAC,aAAa;;YAIxB,WAAW,GAAC,WAAW,EAAE"}