@opra/client 0.17.1 → 0.17.2

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 (188) hide show
  1. package/cjs/client-error.js +17 -0
  2. package/cjs/constants.js +7 -0
  3. package/cjs/http/batch-request.js +90 -0
  4. package/cjs/http/http-client.js +232 -0
  5. package/cjs/http/http-collection-node.js +110 -0
  6. package/cjs/http/http-request-observable.js +36 -0
  7. package/cjs/http/http-request.js +88 -0
  8. package/cjs/http/http-response.js +24 -0
  9. package/cjs/http/http-service-base.js +9 -0
  10. package/cjs/http/http-singleton-node.js +63 -0
  11. package/cjs/http/http-types.js +2 -0
  12. package/cjs/index.js +12 -0
  13. package/cjs/package.json +3 -0
  14. package/esm/client-error.js +13 -0
  15. package/esm/constants.js +4 -0
  16. package/esm/http/batch-request.js +90 -0
  17. package/esm/http/http-client.js +228 -0
  18. package/esm/http/http-collection-node.js +106 -0
  19. package/esm/http/http-request-observable.js +32 -0
  20. package/esm/http/http-request.js +84 -0
  21. package/esm/http/http-response.js +20 -0
  22. package/esm/http/http-service-base.js +5 -0
  23. package/esm/http/http-singleton-node.js +59 -0
  24. package/esm/http/http-types.js +1 -0
  25. package/esm/index.js +9 -0
  26. package/package.json +32 -12
  27. package/types/client-error.d.ts +1 -1
  28. package/types/http/http-client.d.ts +1 -1
  29. package/types/http/http-collection-node.d.ts +5 -5
  30. package/types/http/http-request-observable.d.ts +1 -1
  31. package/types/http/http-request.d.ts +1 -1
  32. package/types/http/http-response.d.ts +3 -1
  33. package/types/http/http-singleton-node.d.ts +1 -1
  34. package/types/http/http-types.d.ts +1 -1
  35. package/types/index.d.ts +0 -6
  36. package/cjs/content-disposition-d575fee5.js +0 -473
  37. package/cjs/cookie-signature-3e974173.js +0 -64
  38. package/cjs/index.min.mjs +0 -9295
  39. package/cjs/mime-db-49f150d0.js +0 -10719
  40. package/cjs/mime-types-6e2bdb57.js +0 -201
  41. package/cjs/safe-buffer-8acd60c7.js +0 -78
  42. package/esm/content-disposition-65f281a9.js +0 -470
  43. package/esm/cookie-signature-bf274b6b.js +0 -62
  44. package/esm/index.min.mjs +0 -9174
  45. package/esm/mime-db-d0f15d8f.js +0 -10717
  46. package/esm/mime-types-79c091fd.js +0 -199
  47. package/esm/safe-buffer-63383356.js +0 -76
  48. package/types/common/document/api-document.d.ts +0 -102
  49. package/types/common/document/constants.d.ts +0 -3
  50. package/types/common/document/data-type/api-field.d.ts +0 -41
  51. package/types/common/document/data-type/builtin/any.type.d.ts +0 -2
  52. package/types/common/document/data-type/builtin/base64.type.d.ts +0 -6
  53. package/types/common/document/data-type/builtin/bigint.type.d.ts +0 -6
  54. package/types/common/document/data-type/builtin/boolean.type.d.ts +0 -5
  55. package/types/common/document/data-type/builtin/date.type.d.ts +0 -4
  56. package/types/common/document/data-type/builtin/guid.type.d.ts +0 -7
  57. package/types/common/document/data-type/builtin/index.d.ts +0 -10
  58. package/types/common/document/data-type/builtin/integer.type.d.ts +0 -6
  59. package/types/common/document/data-type/builtin/number.type.d.ts +0 -6
  60. package/types/common/document/data-type/builtin/object.type.d.ts +0 -3
  61. package/types/common/document/data-type/builtin/string.type.d.ts +0 -5
  62. package/types/common/document/data-type/builtin/time.type.d.ts +0 -7
  63. package/types/common/document/data-type/builtin/timestamp.type.d.ts +0 -5
  64. package/types/common/document/data-type/complex-type.d.ts +0 -56
  65. package/types/common/document/data-type/data-type.d.ts +0 -33
  66. package/types/common/document/data-type/enum-type.d.ts +0 -32
  67. package/types/common/document/data-type/mapped-type.d.ts +0 -53
  68. package/types/common/document/data-type/simple-type.d.ts +0 -33
  69. package/types/common/document/data-type/union-type.d.ts +0 -42
  70. package/types/common/document/factory/add-references.d.ts +0 -4
  71. package/types/common/document/factory/create-document.d.ts +0 -12
  72. package/types/common/document/factory/factory.d.ts +0 -61
  73. package/types/common/document/factory/import-resource-class.d.ts +0 -10
  74. package/types/common/document/factory/import-type-class.d.ts +0 -17
  75. package/types/common/document/factory/index.d.ts +0 -1
  76. package/types/common/document/factory/process-resources.d.ts +0 -7
  77. package/types/common/document/factory/process-types.d.ts +0 -6
  78. package/types/common/document/index.d.ts +0 -14
  79. package/types/common/document/resource/collection.d.ts +0 -69
  80. package/types/common/document/resource/resource.d.ts +0 -29
  81. package/types/common/document/resource/singleton.d.ts +0 -51
  82. package/types/common/document/utils/inspect.util.d.ts +0 -4
  83. package/types/common/document/utils/string-compare.util.d.ts +0 -1
  84. package/types/common/exception/enums/issue-severity.enum.d.ts +0 -13
  85. package/types/common/exception/error-issue.d.ts +0 -9
  86. package/types/common/exception/http-errors/bad-request.error.d.ts +0 -10
  87. package/types/common/exception/http-errors/failed-dependency.error.d.ts +0 -9
  88. package/types/common/exception/http-errors/forbidden.error.d.ts +0 -11
  89. package/types/common/exception/http-errors/internal-server.error.d.ts +0 -9
  90. package/types/common/exception/http-errors/method-not-allowed.error.d.ts +0 -10
  91. package/types/common/exception/http-errors/not-acceptable.error.d.ts +0 -10
  92. package/types/common/exception/http-errors/not-found.error.d.ts +0 -13
  93. package/types/common/exception/http-errors/unauthorized.error.d.ts +0 -10
  94. package/types/common/exception/http-errors/unprocessable-entity.error.d.ts +0 -9
  95. package/types/common/exception/index.d.ts +0 -15
  96. package/types/common/exception/opra-exception.d.ts +0 -15
  97. package/types/common/exception/resource-errors/resource-conflict.error.d.ts +0 -5
  98. package/types/common/exception/resource-errors/resource-not-found.error.d.ts +0 -8
  99. package/types/common/exception/wrap-exception.d.ts +0 -2
  100. package/types/common/filter/antlr/OpraFilterLexer.d.ts +0 -77
  101. package/types/common/filter/antlr/OpraFilterListener.d.ts +0 -430
  102. package/types/common/filter/antlr/OpraFilterParser.d.ts +0 -437
  103. package/types/common/filter/antlr/OpraFilterVisitor.d.ts +0 -260
  104. package/types/common/filter/ast/abstract/ast.d.ts +0 -5
  105. package/types/common/filter/ast/abstract/expression.d.ts +0 -3
  106. package/types/common/filter/ast/abstract/literal.d.ts +0 -6
  107. package/types/common/filter/ast/abstract/term.d.ts +0 -3
  108. package/types/common/filter/ast/expressions/arithmetic-expression.d.ts +0 -13
  109. package/types/common/filter/ast/expressions/array-expression.d.ts +0 -7
  110. package/types/common/filter/ast/expressions/comparison-expression.d.ts +0 -10
  111. package/types/common/filter/ast/expressions/logical-expression.d.ts +0 -8
  112. package/types/common/filter/ast/expressions/parentheses-expression.d.ts +0 -6
  113. package/types/common/filter/ast/index.d.ts +0 -16
  114. package/types/common/filter/ast/terms/boolean-literal.d.ts +0 -5
  115. package/types/common/filter/ast/terms/date-literal.d.ts +0 -6
  116. package/types/common/filter/ast/terms/external-constant.d.ts +0 -5
  117. package/types/common/filter/ast/terms/null-literal.d.ts +0 -5
  118. package/types/common/filter/ast/terms/number-literal.d.ts +0 -6
  119. package/types/common/filter/ast/terms/qualified-identifier.d.ts +0 -8
  120. package/types/common/filter/ast/terms/string-literal.d.ts +0 -5
  121. package/types/common/filter/ast/terms/time-literal.d.ts +0 -6
  122. package/types/common/filter/build.d.ts +0 -31
  123. package/types/common/filter/errors.d.ts +0 -20
  124. package/types/common/filter/filter-tree-visitor.d.ts +0 -33
  125. package/types/common/filter/index.d.ts +0 -5
  126. package/types/common/filter/opra-error-listener.d.ts +0 -8
  127. package/types/common/filter/parse.d.ts +0 -2
  128. package/types/common/filter/utils.d.ts +0 -2
  129. package/types/common/helpers/function-utils.d.ts +0 -4
  130. package/types/common/helpers/get-stack-filename.d.ts +0 -1
  131. package/types/common/helpers/index.d.ts +0 -8
  132. package/types/common/helpers/is-url.d.ts +0 -1
  133. package/types/common/helpers/mixin-utils.d.ts +0 -3
  134. package/types/common/helpers/object-utils.d.ts +0 -2
  135. package/types/common/helpers/path-to-object-tree.d.ts +0 -4
  136. package/types/common/helpers/responsive-map.d.ts +0 -34
  137. package/types/common/helpers/type-guards.d.ts +0 -11
  138. package/types/common/http/codecs/boolean-codec.d.ts +0 -5
  139. package/types/common/http/codecs/date-codec.d.ts +0 -16
  140. package/types/common/http/codecs/filter-codec.d.ts +0 -6
  141. package/types/common/http/codecs/integer-codec.d.ts +0 -11
  142. package/types/common/http/codecs/number-codec.d.ts +0 -14
  143. package/types/common/http/codecs/string-codec.d.ts +0 -16
  144. package/types/common/http/enums/http-headers-codes.enum.d.ts +0 -388
  145. package/types/common/http/enums/http-status-codes.enum.d.ts +0 -290
  146. package/types/common/http/enums/http-status-messages.d.ts +0 -65
  147. package/types/common/http/http-headers.d.ts +0 -86
  148. package/types/common/http/http-message.host.d.ts +0 -122
  149. package/types/common/http/http-params.d.ts +0 -114
  150. package/types/common/http/http-request-message.d.ts +0 -213
  151. package/types/common/http/http-response-message.d.ts +0 -318
  152. package/types/common/http/index.d.ts +0 -14
  153. package/types/common/http/interfaces/client-http-headers.interface.d.ts +0 -65
  154. package/types/common/http/interfaces/cookie-options.interface.d.ts +0 -4
  155. package/types/common/http/interfaces/server-http-headers.interface.d.ts +0 -1
  156. package/types/common/http/multipart/batch-multipart.d.ts +0 -0
  157. package/types/common/http/multipart/http-request-content.d.ts +0 -0
  158. package/types/common/http/multipart/http-response-content.d.ts +0 -0
  159. package/types/common/http/multipart/index.d.ts +0 -0
  160. package/types/common/i18n/i18n.d.ts +0 -28
  161. package/types/common/i18n/index.d.ts +0 -5
  162. package/types/common/i18n/string-utils.d.ts +0 -2
  163. package/types/common/i18n/translate.d.ts +0 -4
  164. package/types/common/index.d.ts +0 -11
  165. package/types/common/schema/constants.d.ts +0 -2
  166. package/types/common/schema/data-type/complex-type.interface.d.ts +0 -16
  167. package/types/common/schema/data-type/data-type.interface.d.ts +0 -14
  168. package/types/common/schema/data-type/enum-type.interface.d.ts +0 -15
  169. package/types/common/schema/data-type/field.interface.d.ts +0 -21
  170. package/types/common/schema/data-type/mapped-type.interface.d.ts +0 -11
  171. package/types/common/schema/data-type/simple-type.interface.d.ts +0 -18
  172. package/types/common/schema/data-type/union-type.interface.d.ts +0 -10
  173. package/types/common/schema/document.interface.d.ts +0 -34
  174. package/types/common/schema/index.d.ts +0 -51
  175. package/types/common/schema/resource/collection.interface.d.ts +0 -33
  176. package/types/common/schema/resource/container.interface.d.ts +0 -9
  177. package/types/common/schema/resource/endpoint.interface.d.ts +0 -29
  178. package/types/common/schema/resource/resource.interface.d.ts +0 -12
  179. package/types/common/schema/resource/singleton.interface.d.ts +0 -22
  180. package/types/common/schema/type-guards.d.ts +0 -20
  181. package/types/common/types.d.ts +0 -11
  182. package/types/common/url/index.d.ts +0 -5
  183. package/types/common/url/opra-url-path-component.d.ts +0 -15
  184. package/types/common/url/opra-url-path.d.ts +0 -36
  185. package/types/common/url/opra-url.d.ts +0 -70
  186. package/types/common/url/utils/decode-path-component.d.ts +0 -5
  187. package/types/common/url/utils/encode-path-component.d.ts +0 -1
  188. package/types/common/utils/path-utils.d.ts +0 -2
@@ -1,65 +0,0 @@
1
- export declare const HttpStatusMessages: {
2
- "100": string;
3
- "101": string;
4
- "102": string;
5
- "103": string;
6
- "200": string;
7
- "201": string;
8
- "202": string;
9
- "203": string;
10
- "204": string;
11
- "205": string;
12
- "206": string;
13
- "207": string;
14
- "208": string;
15
- "226": string;
16
- "300": string;
17
- "301": string;
18
- "302": string;
19
- "303": string;
20
- "304": string;
21
- "305": string;
22
- "307": string;
23
- "308": string;
24
- "400": string;
25
- "401": string;
26
- "402": string;
27
- "403": string;
28
- "404": string;
29
- "405": string;
30
- "406": string;
31
- "407": string;
32
- "408": string;
33
- "409": string;
34
- "410": string;
35
- "411": string;
36
- "412": string;
37
- "413": string;
38
- "414": string;
39
- "415": string;
40
- "416": string;
41
- "417": string;
42
- "418": string;
43
- "421": string;
44
- "422": string;
45
- "423": string;
46
- "424": string;
47
- "425": string;
48
- "426": string;
49
- "428": string;
50
- "429": string;
51
- "431": string;
52
- "451": string;
53
- "500": string;
54
- "501": string;
55
- "502": string;
56
- "503": string;
57
- "504": string;
58
- "505": string;
59
- "506": string;
60
- "507": string;
61
- "508": string;
62
- "509": string;
63
- "510": string;
64
- "511": string;
65
- };
@@ -1,86 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference lib="dom" />
3
- import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
4
- import { ResponsiveMap } from '../helpers/index.js';
5
- declare const nodeInspectCustom: unique symbol;
6
- declare const kEntries: unique symbol;
7
- declare const kOptions: unique symbol;
8
- /**
9
- *
10
- * @namespace HttpHeaders
11
- */
12
- export declare namespace HttpHeaders {
13
- type Initiator = Headers | HttpHeaders | IncomingHttpHeaders | OutgoingHttpHeaders | HeadersObject | Map<string, string | string[]>;
14
- type HeadersObject = Record<string, string | string[]>;
15
- interface Options {
16
- onChange?: () => void;
17
- }
18
- }
19
- /**
20
- *
21
- * @class HttpHeaders
22
- */
23
- export declare class HttpHeaders {
24
- protected static kEntries: symbol;
25
- protected static kOptions: symbol;
26
- protected [kEntries]: ResponsiveMap<string | string[]>;
27
- protected [kOptions]: HttpHeaders.Options;
28
- constructor(init?: HttpHeaders.Initiator | string, options?: HttpHeaders.Options);
29
- get size(): number;
30
- /**
31
- * Appends a new value to the existing set of values for a header
32
- * and returns this instance
33
- */
34
- append(name: string, value: string | number | string[]): this;
35
- /**
36
- * Appends multiple values to the existing set of values for a header
37
- * and returns this instance
38
- */
39
- appendAll(headers: HttpHeaders.Initiator): this;
40
- /**
41
- * Appends multiple values to the existing set of values for a header
42
- * and returns this instance
43
- */
44
- set(init: HttpHeaders.Initiator): this;
45
- /**
46
- * Sets or modifies a value for a given header.
47
- * If the header already exists, its value is replaced with the given value
48
- */
49
- set(name: string, value: number | string | string[] | undefined): this;
50
- parse(init: string): void;
51
- /**
52
- * Retrieves value of a given header
53
- */
54
- get(name: string): string | string[] | undefined;
55
- clear(): void;
56
- /**
57
- * Deletes a header entry
58
- */
59
- delete(name: string): boolean;
60
- /**
61
- * Returns an iterable of key, value pairs for every entry in the map.
62
- */
63
- entries(): IterableIterator<[string, string | string[]]>;
64
- forEach(callbackFn: (value: number | string | string[], key: string, parent: HttpHeaders) => void, thisArg?: any): void;
65
- /**
66
- * Retrieves the names of the headers.
67
- */
68
- keys(): IterableIterator<string>;
69
- /**
70
- * Checks for existence of a given header.
71
- */
72
- has(name: string): boolean;
73
- sort(compareFn?: (a: string, b: string) => number): this;
74
- toObject(): Record<string, string>;
75
- getProxy(): HttpHeaders.HeadersObject;
76
- [nodeInspectCustom](): ResponsiveMap<string | string[]>;
77
- [Symbol.iterator](): IterableIterator<[string, number | string | string[]]>;
78
- get [Symbol.toStringTag](): string;
79
- protected _append(name: string, value: any): void;
80
- protected _set(name: string, value: any): void;
81
- protected changed(): void;
82
- static NON_DELIMITED_HEADERS: any;
83
- static SEMICOLON_DELIMITED_HEADERS: any;
84
- static ARRAY_HEADERS: any;
85
- }
86
- export {};
@@ -1,122 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { HeaderInfo, ParserType } from 'http-parser-js';
4
- import stream from 'stream';
5
- import { HttpHeaders } from './http-headers.js';
6
- declare const kHeaders: unique symbol;
7
- declare const kHeadersProxy: unique symbol;
8
- declare const kTrailers: unique symbol;
9
- declare const kTrailersProxy: unique symbol;
10
- declare const kOnHeaderReceived: unique symbol;
11
- declare const kOnTrailersReceived: unique symbol;
12
- declare const kOnBodyChunk: unique symbol;
13
- declare const kOnReadComplete: unique symbol;
14
- export interface HttpMessage {
15
- httpVersion?: string;
16
- httpVersionMajor?: number;
17
- httpVersionMinor?: number;
18
- headers?: any;
19
- trailers?: any;
20
- rawHeaders?: string[];
21
- rawTrailers?: string[];
22
- body?: any;
23
- complete?: boolean;
24
- upgrade?: boolean;
25
- end(body?: any): this;
26
- send(body: any): this;
27
- }
28
- export declare namespace HttpMessage {
29
- interface Initiator {
30
- httpVersionMajor?: number;
31
- httpVersionMinor?: number;
32
- headers?: HttpHeaders.Initiator;
33
- trailers?: HttpHeaders.Initiator;
34
- rawHeaders?: string[];
35
- rawTrailers?: string[];
36
- body?: any;
37
- }
38
- }
39
- export interface HttpMessageHost extends stream.Duplex {
40
- }
41
- export declare abstract class HttpMessageHost implements HttpMessage {
42
- static kHeaders: symbol;
43
- static kHeadersProxy: symbol;
44
- static kTrailers: symbol;
45
- static kTrailersProxy: symbol;
46
- static kOnHeaderReceived: symbol;
47
- static kOnTrailersReceived: symbol;
48
- static kOnBodyChunk: symbol;
49
- static kOnReadComplete: symbol;
50
- protected [kHeaders]: HttpHeaders;
51
- protected [kHeadersProxy]: any;
52
- protected [kTrailers]: HttpHeaders;
53
- protected [kTrailersProxy]: any;
54
- protected _bodyChunks?: Buffer[];
55
- protected _rawHeaders?: string[];
56
- protected _rawTrailers?: string[];
57
- protected _headersChanged?: boolean;
58
- protected _trailersChanged?: boolean;
59
- httpVersionMajor?: number;
60
- httpVersionMinor?: number;
61
- shouldKeepAlive?: boolean;
62
- complete: boolean;
63
- upgrade?: boolean;
64
- body?: Buffer | ArrayBuffer;
65
- protected constructor();
66
- get httpVersion(): string | undefined;
67
- set httpVersion(value: string | undefined);
68
- get headers(): any;
69
- set headers(headers: any);
70
- get trailers(): any;
71
- set trailers(trailers: any);
72
- get rawHeaders(): string[];
73
- set rawHeaders(headers: string[]);
74
- get rawTrailers(): string[];
75
- set rawTrailers(trailers: string[]);
76
- getHeader(name: 'set-cookie' | 'Set-Cookie'): string[] | undefined;
77
- getHeader(name: string): string | undefined;
78
- get(name: 'set-cookie' | 'Set-Cookie'): string[] | undefined;
79
- get(name: string): string | undefined;
80
- /**
81
- * Set header `field` to `val`,
82
- * or pass an object of header fields.
83
- *
84
- * Examples:
85
- *
86
- * msg.setHeader('Foo', ['bar', 'baz']);
87
- * msg.setHeader('Accept', 'application/json');
88
- * msg.setHeader({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
89
- *
90
- * @public
91
- */
92
- setHeader(name: 'set-cookie' | 'Set-Cookie', value: string | string[]): this;
93
- setHeader(name: string, value: number | string | string[]): this;
94
- setHeader(headers: HttpHeaders.Initiator): this;
95
- /**
96
- * Set header `field` to `val`,
97
- * or pass an object of header fields.
98
- * Alias as msg.setHeader()
99
- * @public
100
- */
101
- set(name: 'set-cookie' | 'Set-Cookie', value: string | string[]): this;
102
- set(name: string, value: number | string | string[]): this;
103
- set(headers: Record<string, number | string | string[]>): this;
104
- getHeaders(): Record<string, string>;
105
- getHeaderNames(): string[];
106
- hasHeader(name: string): boolean;
107
- removeHeader(name: string): void;
108
- send(body: any): this;
109
- end(body?: any): this;
110
- setTimeout(): this;
111
- protected _init(args: HttpMessage.Initiator): void;
112
- protected _parseBuffer(buf: Buffer | ArrayBuffer, parserType: ParserType): void;
113
- protected _initHeaders(): void;
114
- protected _initTrailers(): void;
115
- protected _buildRawHeaders(): void;
116
- protected _buildRawTrailers(): void;
117
- protected [kOnHeaderReceived](info: HeaderInfo): void;
118
- protected [kOnTrailersReceived](trailers: string[]): void;
119
- protected [kOnBodyChunk](chunk: Buffer, offset: number, length: number): void;
120
- protected [kOnReadComplete](): void;
121
- }
122
- export {};
@@ -1,114 +0,0 @@
1
- import { StrictOmit } from 'ts-gems';
2
- import { ResponsiveMap } from '../helpers/index.js';
3
- import { BooleanCodec } from './codecs/boolean-codec.js';
4
- import { DateCodec } from './codecs/date-codec.js';
5
- import { FilterCodec } from './codecs/filter-codec.js';
6
- import { IntegerCodec } from './codecs/integer-codec.js';
7
- import { NumberCodec } from './codecs/number-codec.js';
8
- import { StringCodec } from './codecs/string-codec.js';
9
- export declare namespace HttpParams {
10
- type Initiator = string | URLSearchParams | HttpParams | Map<string, HttpParams.Value> | Record<string, HttpParams.Value>;
11
- type Value = string | number | boolean | object | null;
12
- interface Options {
13
- onChange?: () => void;
14
- params?: Record<string, ParamDefinition>;
15
- }
16
- type ParamDefinition = StrictOmit<HttpParamMetadata, 'codec'> & {
17
- codec?: Codec | string;
18
- };
19
- interface Codec {
20
- decode(value: string): HttpParams.Value;
21
- encode(value: HttpParams.Value): string;
22
- }
23
- }
24
- interface HttpParamMetadata {
25
- codec: HttpParams.Codec;
26
- array?: boolean | 'strict';
27
- arrayDelimiter?: string;
28
- minArrayItems?: number;
29
- maxArrayItems?: number;
30
- }
31
- declare const kEntries: unique symbol;
32
- declare const kSize: unique symbol;
33
- declare const kParamDefs: unique symbol;
34
- declare const kOptions: unique symbol;
35
- export declare class HttpParams {
36
- protected static kEntries: symbol;
37
- protected static kSize: symbol;
38
- protected static kParamDefs: symbol;
39
- protected static kOptions: symbol;
40
- protected [kEntries]: ResponsiveMap<HttpParams.Value[]>;
41
- protected [kSize]: number;
42
- protected [kOptions]: HttpParams.Options;
43
- protected [kParamDefs]: Map<string, HttpParamMetadata>;
44
- constructor(init?: HttpParams.Initiator, options?: HttpParams.Options);
45
- get size(): number;
46
- /**
47
- * Appends a new value to the existing set of values for a parameter
48
- * and returns this instance
49
- */
50
- append(name: string, value?: HttpParams.Value): this;
51
- appendAll(input: HttpParams.Initiator): this;
52
- changed(): void;
53
- clear(): void;
54
- /**
55
- * Deletes values for a given parameter
56
- */
57
- delete(name: string, value?: HttpParams.Value): this;
58
- /**
59
- * Returns an iterable of key, value pairs for every entry in the map.
60
- */
61
- entries(): IterableIterator<[string, HttpParams.Value]>;
62
- forEach(callbackFn: (value: HttpParams.Value, key: string, parent: HttpParams) => void, thisArg?: any): void;
63
- /**
64
- * Retrieves value of a given parameter at given index
65
- */
66
- get(name: string, index?: number): HttpParams.Value;
67
- /**
68
- * Retrieves an array of values for a given parameter.
69
- */
70
- getAll(name: string): HttpParams.Value[] | null;
71
- /**
72
- * Retrieves the names of the parameters.
73
- */
74
- keys(): IterableIterator<string>;
75
- /**
76
- * Retrieves the names of the parameters.
77
- */
78
- values(): IterableIterator<HttpParams.Value>;
79
- /**
80
- * Checks for existence of a parameter.
81
- */
82
- has(name: string): boolean;
83
- /**
84
- * Sets or modifies a value for a given parameter.
85
- * If the header already exists, its value is replaced with the given value
86
- */
87
- set(name: string, value?: HttpParams.Value): this;
88
- sort(compareFn?: (a: string, b: string) => number): this;
89
- /**
90
- * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
91
- * separated by `&`s.
92
- */
93
- toString(): string;
94
- getProxy(): Record<string, HttpParams.Value>;
95
- define(params: Record<string, HttpParams.ParamDefinition>): this;
96
- define(name: string, options: HttpParams.ParamDefinition): this;
97
- encodeValue(value: HttpParams.Value, key: string): string;
98
- decodeValue(value: string, key: string): HttpParams.Value;
99
- [Symbol.iterator](): IterableIterator<[string, HttpParams.Value]>;
100
- get [Symbol.toStringTag](): string;
101
- protected _append(name: string, value?: HttpParams.Value): void;
102
- protected _delete(name: string, value?: HttpParams.Value): boolean;
103
- protected _set(name: string, value?: HttpParams.Value, index?: number): void;
104
- static codecs: {
105
- boolean: BooleanCodec;
106
- date: DateCodec;
107
- filter: FilterCodec;
108
- integer: IntegerCodec;
109
- number: NumberCodec;
110
- string: StringCodec;
111
- };
112
- }
113
- export declare function encodeURIParam(v: string): string;
114
- export {};
@@ -1,213 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
- import { IncomingHttpHeaders } from 'http';
6
- import { Readable } from 'stream';
7
- import { HttpMessage } from './http-message.host.js';
8
- export interface HttpRequestMessage extends HttpMessage {
9
- /**
10
- * In case of server request, the HTTP version sent by the client. In the case of
11
- * client response, the HTTP version of the connected-to server.
12
- * Probably either `'1.1'` or `'1.0'`.
13
- *
14
- * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second.
15
- * @since v0.1.1
16
- */
17
- httpVersion: string;
18
- httpVersionMajor: number;
19
- httpVersionMinor: number;
20
- /**
21
- * The request/response headers object.
22
- *
23
- * Key-value pairs of header names and values. Header names are lower-cased.
24
- */
25
- readonly headers: IncomingHttpHeaders;
26
- /**
27
- * The raw request/response headers list exactly as they were received.
28
- */
29
- rawHeaders: string[];
30
- /**
31
- * The request/response trailers object.
32
- */
33
- readonly trailers: NodeJS.Dict<string>;
34
- /**
35
- * The raw request/response trailer keys and values exactly as they were received.
36
- */
37
- rawTrailers: string[];
38
- readonly complete: boolean;
39
- readonly upgrade?: any;
40
- /**
41
- * Return the protocol string "http" or "https"
42
- * when requested with TLS. When the "trust proxy"
43
- * setting is enabled the "X-Forwarded-Proto" header
44
- * field will be trusted. If you're running behind
45
- * a reverse proxy that supplies https for you this
46
- * may be enabled.
47
- */
48
- protocol: string;
49
- /**
50
- * Short-hand for:
51
- *
52
- * req.protocol == 'https'
53
- */
54
- secure: boolean;
55
- /**
56
- * Return the remote address, or when
57
- * "trust proxy" is `true` return
58
- * the upstream addr.
59
- */
60
- ip: string;
61
- /**
62
- * When "trust proxy" is `true`, parse
63
- * the "X-Forwarded-For" ip address list.
64
- *
65
- * For example if the value were "client, proxy1, proxy2"
66
- * you would receive the array `["client", "proxy1", "proxy2"]`
67
- * where "proxy2" is the furthest down-stream.
68
- */
69
- ips: string[];
70
- /**
71
- * Parse the "Host" header field hostname.
72
- */
73
- hostname: string;
74
- method: string;
75
- url: string;
76
- baseUrl: string;
77
- query: Record<string, any>;
78
- /**
79
- * Return request header.
80
- *
81
- * The `Referrer` header field is special-cased,
82
- * both `Referrer` and `Referer` are interchangeable.
83
- *
84
- * Examples:
85
- *
86
- * req.get('Content-Type');
87
- * // => "text/plain"
88
- *
89
- * req.get('content-type');
90
- * // => "text/plain"
91
- *
92
- * req.get('Something');
93
- * // => undefined
94
- *
95
- * Aliased as `req.header()`.
96
- */
97
- get(name: 'set-cookie'): string[] | undefined;
98
- get(name: string): string | undefined;
99
- header(name: 'set-cookie'): string[] | undefined;
100
- header(name: string): string | undefined;
101
- /**
102
- * Check if the given `type(s)` is acceptable, returning
103
- * the best match when true, otherwise `undefined`, in which
104
- * case you should respond with 406 "Not Acceptable".
105
- *
106
- * The `type` value may be a single mime type string
107
- * such as "application/json", the extension name
108
- * such as "json", a comma-delimted list such as "json, html, text/plain",
109
- * or an array `["json", "html", "text/plain"]`. When a list
110
- * or array is given the _best_ match, if any is returned.
111
- *
112
- * Examples:
113
- *
114
- * // Accept: text/html
115
- * req.accepts('html');
116
- * // => "html"
117
- *
118
- * // Accept: text/*, application/json
119
- * req.accepts('html');
120
- * // => "html"
121
- * req.accepts('text/html');
122
- * // => "text/html"
123
- * req.accepts('json, text');
124
- * // => "json"
125
- * req.accepts('application/json');
126
- * // => "application/json"
127
- *
128
- * // Accept: text/*, application/json
129
- * req.accepts('image/png');
130
- * req.accepts('png');
131
- * // => undefined
132
- *
133
- * // Accept: text/*;q=.5, application/json
134
- * req.accepts(['html', 'json']);
135
- * req.accepts('html, json');
136
- * // => "json"
137
- */
138
- accepts(): string[];
139
- accepts(type: string): string | false;
140
- accepts(type: string[]): string | false;
141
- accepts(...type: string[]): string | false;
142
- /**
143
- * Returns the first accepted charset of the specified character sets,
144
- * based on the request's Accept-Charset HTTP header field.
145
- * If none of the specified charsets is accepted, returns false.
146
- *
147
- * For more information, or if you have issues or concerns, see accepts.
148
- */
149
- acceptsCharsets(): string[];
150
- acceptsCharsets(charset: string): string | false;
151
- acceptsCharsets(charset: string[]): string | false;
152
- acceptsCharsets(...charset: string[]): string | false;
153
- /**
154
- * Returns the first accepted encoding of the specified encodings,
155
- * based on the request's Accept-Encoding HTTP header field.
156
- * If none of the specified encodings is accepted, returns false.
157
- *
158
- * For more information, or if you have issues or concerns, see accepts.
159
- */
160
- acceptsEncodings(): string[];
161
- acceptsEncodings(encoding: string): string | false;
162
- acceptsEncodings(encoding: string[]): string | false;
163
- acceptsEncodings(...encoding: string[]): string | false;
164
- /**
165
- * Returns the first accepted language of the specified languages,
166
- * based on the request's Accept-Language HTTP header field.
167
- * If none of the specified languages is accepted, returns false.
168
- *
169
- * For more information, or if you have issues or concerns, see accepts.
170
- */
171
- acceptsLanguages(): string[];
172
- acceptsLanguages(lang: string): string | false;
173
- acceptsLanguages(lang: string[]): string | false;
174
- acceptsLanguages(...lang: string[]): string | false;
175
- /**
176
- * Check if the incoming request contains the "Content-Type"
177
- * header field, and it contains the give mime `type`.
178
- *
179
- * Examples:
180
- *
181
- * // With Content-Type: text/html; charset=utf-8
182
- * req.is('html');
183
- * req.is('text/html');
184
- * req.is('text/*');
185
- * // => true
186
- *
187
- * // When Content-Type is application/json
188
- * req.is('json');
189
- * req.is('application/json');
190
- * req.is('application/*');
191
- * // => true
192
- *
193
- * req.is('html');
194
- * // => false
195
- */
196
- is(type: string | string[]): string | false | null;
197
- is(...types: string[]): string | false | null;
198
- }
199
- export declare namespace HttpRequestMessage {
200
- interface Initiator extends HttpMessage.Initiator {
201
- httpVersionMajor?: number;
202
- httpVersionMinor?: number;
203
- method: string;
204
- url: string;
205
- protocol?: string;
206
- baseUrl?: string;
207
- ip?: string;
208
- ips?: [];
209
- }
210
- function create(init: Initiator): HttpRequestMessage;
211
- function fromBuffer(buffer: Buffer | ArrayBuffer): HttpRequestMessage;
212
- function fromStream(readable: Readable): Promise<HttpRequestMessage>;
213
- }