@opra/core 0.20.3 → 0.21.0
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/cjs/adapter/adapter.js +2 -2
- package/cjs/adapter/http/express-adapter.js +29 -7
- package/cjs/adapter/http/helpers/common.js +66 -0
- package/cjs/adapter/http/helpers/convert-to-headers.js +65 -0
- package/cjs/adapter/http/helpers/convert-to-raw-headers.js +25 -0
- package/cjs/adapter/http/helpers/match-known-fields.js +47 -0
- package/cjs/adapter/http/http-adapter.js +76 -438
- package/cjs/adapter/http/impl/http-incoming-message-host.js +127 -0
- package/cjs/adapter/http/impl/http-outgoing-message-host.js +210 -0
- package/cjs/adapter/http/impl/http-server-request.js +125 -0
- package/cjs/adapter/http/impl/http-server-response.js +226 -0
- package/cjs/adapter/http/request-parsers/batch-request-parser.js +169 -0
- package/cjs/adapter/http/request-parsers/parse-collection-request.js +165 -0
- package/cjs/adapter/http/request-parsers/parse-request.js +24 -0
- package/cjs/adapter/http/request-parsers/parse-singleton-request.js +96 -0
- package/cjs/adapter/request-context.host.js +17 -3
- package/cjs/adapter/request.host.js +6 -3
- package/cjs/adapter/response.host.js +5 -3
- package/cjs/index.js +4 -2
- package/esm/adapter/adapter.js +2 -2
- package/esm/adapter/http/express-adapter.js +6 -6
- package/esm/adapter/http/helpers/common.js +60 -0
- package/esm/adapter/http/helpers/convert-to-headers.js +60 -0
- package/esm/adapter/http/helpers/convert-to-raw-headers.js +21 -0
- package/esm/adapter/http/helpers/match-known-fields.js +43 -0
- package/esm/adapter/http/http-adapter.js +77 -439
- package/esm/adapter/http/impl/http-incoming-message-host.js +122 -0
- package/esm/adapter/http/impl/http-outgoing-message-host.js +205 -0
- package/esm/adapter/http/impl/http-server-request.js +121 -0
- package/esm/adapter/http/impl/http-server-response.js +222 -0
- package/esm/adapter/http/request-parsers/batch-request-parser.js +169 -0
- package/esm/adapter/http/request-parsers/parse-collection-request.js +161 -0
- package/esm/adapter/http/request-parsers/parse-request.js +20 -0
- package/esm/adapter/http/request-parsers/parse-singleton-request.js +92 -0
- package/esm/adapter/request-context.host.js +17 -3
- package/esm/adapter/request.host.js +6 -3
- package/esm/adapter/response.host.js +5 -3
- package/esm/index.js +4 -2
- package/package.json +20 -16
- package/types/adapter/adapter.d.ts +1 -1
- package/types/adapter/http/helpers/common.d.ts +17 -0
- package/types/adapter/http/helpers/convert-to-headers.d.ts +2 -0
- package/types/adapter/http/helpers/convert-to-raw-headers.d.ts +3 -0
- package/types/adapter/http/helpers/match-known-fields.d.ts +6 -0
- package/types/adapter/http/http-adapter.d.ts +7 -12
- package/types/adapter/http/impl/http-incoming-message-host.d.ts +58 -0
- package/types/adapter/http/impl/http-outgoing-message-host.d.ts +72 -0
- package/types/adapter/http/{http-request-message.d.ts → impl/http-server-request.d.ts} +52 -85
- package/types/adapter/http/impl/http-server-response.d.ts +137 -0
- package/types/adapter/http/request-parsers/batch-request-parser.d.ts +0 -0
- package/types/adapter/http/request-parsers/parse-collection-request.d.ts +4 -0
- package/types/adapter/http/request-parsers/parse-request.d.ts +4 -0
- package/types/adapter/http/request-parsers/parse-singleton-request.d.ts +4 -0
- package/types/adapter/interfaces/request-context.interface.d.ts +14 -10
- package/types/adapter/interfaces/request.interface.d.ts +3 -2
- package/types/adapter/interfaces/response.interface.d.ts +2 -2
- package/types/adapter/request-context.host.d.ts +9 -6
- package/types/adapter/request.host.d.ts +8 -4
- package/types/adapter/response.host.d.ts +6 -4
- package/types/index.d.ts +4 -2
- package/cjs/adapter/http/http-message.host.js +0 -251
- package/cjs/adapter/http/http-request-context.host.js +0 -28
- package/cjs/adapter/http/http-request-message.js +0 -152
- package/cjs/adapter/http/http-request.host.js +0 -14
- package/cjs/adapter/http/http-response-message.js +0 -238
- package/cjs/adapter/http/http-response.host.js +0 -14
- package/esm/adapter/http/http-message.host.js +0 -246
- package/esm/adapter/http/http-request-context.host.js +0 -24
- package/esm/adapter/http/http-request-message.js +0 -148
- package/esm/adapter/http/http-request.host.js +0 -10
- package/esm/adapter/http/http-response-message.js +0 -233
- package/esm/adapter/http/http-response.host.js +0 -10
- package/types/adapter/http/http-message.host.d.ts +0 -122
- package/types/adapter/http/http-request-context.host.d.ts +0 -16
- package/types/adapter/http/http-request.host.d.ts +0 -7
- package/types/adapter/http/http-response-message.d.ts +0 -321
- package/types/adapter/http/http-response.host.d.ts +0 -7
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import contentDisposition from 'content-disposition';
|
|
2
|
-
import cookie from 'cookie';
|
|
3
|
-
import cookieSignature from 'cookie-signature';
|
|
4
|
-
import encodeUrl from 'encodeurl';
|
|
5
|
-
import mime from 'mime-types';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import { HTTPParser } from '@browsery/http-parser';
|
|
8
|
-
import { HttpStatusMessages } from '@opra/common';
|
|
9
|
-
import { HttpMessageHost } from './http-message.host.js';
|
|
10
|
-
/**
|
|
11
|
-
* @namespace HttpResponseMessage
|
|
12
|
-
*/
|
|
13
|
-
export var HttpResponseMessage;
|
|
14
|
-
(function (HttpResponseMessage) {
|
|
15
|
-
function create(init) {
|
|
16
|
-
return HttpResponseMessageHost.create(init);
|
|
17
|
-
}
|
|
18
|
-
HttpResponseMessage.create = create;
|
|
19
|
-
function fromBuffer(buffer) {
|
|
20
|
-
return HttpResponseMessageHost.fromBuffer(buffer);
|
|
21
|
-
}
|
|
22
|
-
HttpResponseMessage.fromBuffer = fromBuffer;
|
|
23
|
-
async function fromStream(readable) {
|
|
24
|
-
return HttpResponseMessageHost.fromStream(readable);
|
|
25
|
-
}
|
|
26
|
-
HttpResponseMessage.fromStream = fromStream;
|
|
27
|
-
})(HttpResponseMessage || (HttpResponseMessage = {}));
|
|
28
|
-
/**
|
|
29
|
-
* @class HttpResponseMessageHost
|
|
30
|
-
*/
|
|
31
|
-
export class HttpResponseMessageHost extends HttpMessageHost {
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
}
|
|
35
|
-
header(arg0, arg1) {
|
|
36
|
-
return this.set(arg0, arg1);
|
|
37
|
-
}
|
|
38
|
-
append(name, value) {
|
|
39
|
-
this[HttpMessageHost.kHeaders].append(name, value);
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Set "Content-Disposition" header to "attachment" with optional `filename`.
|
|
44
|
-
*/
|
|
45
|
-
attachment(filename) {
|
|
46
|
-
if (filename)
|
|
47
|
-
this.type(path.extname(filename));
|
|
48
|
-
this.set('Content-Disposition', contentDisposition(filename));
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Alias for msg.type()
|
|
53
|
-
*/
|
|
54
|
-
contentType(type) {
|
|
55
|
-
return this.type(type);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
|
59
|
-
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
60
|
-
*
|
|
61
|
-
* Examples:
|
|
62
|
-
*
|
|
63
|
-
* res.type('.html');
|
|
64
|
-
* res.type('html');
|
|
65
|
-
* res.type('json');
|
|
66
|
-
* res.type('application/json');
|
|
67
|
-
* res.type('png');
|
|
68
|
-
*/
|
|
69
|
-
type(type) {
|
|
70
|
-
const ct = type.indexOf('/') === -1
|
|
71
|
-
? mime.lookup(type)
|
|
72
|
-
: type;
|
|
73
|
-
if (ct)
|
|
74
|
-
this.set('Content-Type', ct);
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Set cookie `name` to `value`, with the given `options`.
|
|
79
|
-
*
|
|
80
|
-
* Options:
|
|
81
|
-
*
|
|
82
|
-
* - `maxAge` max-age in milliseconds, converted to `expires`
|
|
83
|
-
* - `signed` sign the cookie
|
|
84
|
-
* - `path` defaults to "/"
|
|
85
|
-
*
|
|
86
|
-
* Examples:
|
|
87
|
-
*
|
|
88
|
-
* // "Remember Me" for 15 minutes
|
|
89
|
-
* res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
|
|
90
|
-
*
|
|
91
|
-
* // same as above
|
|
92
|
-
* res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
95
|
-
cookie(name, value, options) {
|
|
96
|
-
const opts = { ...options };
|
|
97
|
-
const secret = this.req?.secret;
|
|
98
|
-
const signed = opts.signed;
|
|
99
|
-
if (signed && !secret) {
|
|
100
|
-
throw new Error('cookieParser("secret") required for signed cookies');
|
|
101
|
-
}
|
|
102
|
-
let val = typeof value === 'object'
|
|
103
|
-
? 'j:' + JSON.stringify(value)
|
|
104
|
-
: String(value);
|
|
105
|
-
if (signed)
|
|
106
|
-
val = 's:' + cookieSignature.sign(val, secret);
|
|
107
|
-
if (opts.maxAge != null) {
|
|
108
|
-
const maxAge = opts.maxAge - 0;
|
|
109
|
-
if (!isNaN(maxAge)) {
|
|
110
|
-
opts.expires = new Date(Date.now() + maxAge);
|
|
111
|
-
opts.maxAge = Math.floor(maxAge / 1000);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (opts.path == null)
|
|
115
|
-
opts.path = '/';
|
|
116
|
-
// Remove old cookie
|
|
117
|
-
let a = this.get('Set-Cookie');
|
|
118
|
-
if (a && Array.isArray(a)) {
|
|
119
|
-
a = a.filter(x => !x.startsWith(name + '='));
|
|
120
|
-
this.set('Set-Cookie', a);
|
|
121
|
-
}
|
|
122
|
-
this.append('Set-Cookie', cookie.serialize(name, String(val), opts));
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Clear cookie `name`.
|
|
127
|
-
*/
|
|
128
|
-
clearCookie(name, options) {
|
|
129
|
-
return this.cookie(name, '', { expires: new Date(1), path: '/', ...options });
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Set Link header field with the given `links`.
|
|
133
|
-
*
|
|
134
|
-
* Examples:
|
|
135
|
-
*
|
|
136
|
-
* res.links({
|
|
137
|
-
* next: 'http://api.example.com/users?page=2',
|
|
138
|
-
* last: 'http://api.example.com/users?page=5'
|
|
139
|
-
* });
|
|
140
|
-
*
|
|
141
|
-
*/
|
|
142
|
-
links(links) {
|
|
143
|
-
let link = this.get('Link') || '';
|
|
144
|
-
if (link)
|
|
145
|
-
link += ', ';
|
|
146
|
-
return this.set('Link', link + Object.keys(links).map(rel => '<' + links[rel] + '>; rel="' + rel + '"').join(', '));
|
|
147
|
-
}
|
|
148
|
-
redirect(arg0, url) {
|
|
149
|
-
let status = 302;
|
|
150
|
-
// allow status / url
|
|
151
|
-
if (typeof arg0 === 'number') {
|
|
152
|
-
status = arg0;
|
|
153
|
-
}
|
|
154
|
-
else
|
|
155
|
-
url = arg0 || '';
|
|
156
|
-
// Set location header
|
|
157
|
-
this.location(url || '/');
|
|
158
|
-
// Respond
|
|
159
|
-
this.statusCode = status;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Send JSON response.
|
|
163
|
-
*
|
|
164
|
-
* Examples:
|
|
165
|
-
*
|
|
166
|
-
* res.json(null);
|
|
167
|
-
* res.json({ user: 'tj' });
|
|
168
|
-
*/
|
|
169
|
-
json(obj) {
|
|
170
|
-
if (!this.get('Content-Type'))
|
|
171
|
-
this.set('Content-Type', 'application/json');
|
|
172
|
-
const body = JSON.stringify(obj);
|
|
173
|
-
return this.send(body);
|
|
174
|
-
}
|
|
175
|
-
location(url) {
|
|
176
|
-
let loc = url;
|
|
177
|
-
// "back" is an alias for the referrer
|
|
178
|
-
if (url === 'back')
|
|
179
|
-
loc = this.req?.get('Referrer') || '/';
|
|
180
|
-
// set location
|
|
181
|
-
return this.set('Location', encodeUrl(loc));
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Set status `code`.
|
|
185
|
-
*/
|
|
186
|
-
status(code) {
|
|
187
|
-
this.statusCode = code;
|
|
188
|
-
return this;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Set the response HTTP status code to `statusCode` and send its string representation as the response body.
|
|
192
|
-
* @link http://expressjs.com/4x/api.html#res.sendStatus
|
|
193
|
-
*
|
|
194
|
-
* Examples:
|
|
195
|
-
*
|
|
196
|
-
* res.sendStatus(200); // equivalent to res.status(200).send('OK')
|
|
197
|
-
* res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
|
|
198
|
-
* res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
|
|
199
|
-
* res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
|
|
200
|
-
*/
|
|
201
|
-
sendStatus(statusCode) {
|
|
202
|
-
const body = HttpStatusMessages[statusCode] || String(statusCode);
|
|
203
|
-
this.statusCode = statusCode;
|
|
204
|
-
this.type('txt');
|
|
205
|
-
return this.send(body);
|
|
206
|
-
}
|
|
207
|
-
_init(init) {
|
|
208
|
-
super._init(init);
|
|
209
|
-
this.statusCode = init?.statusCode;
|
|
210
|
-
this.statusMessage = init?.statusMessage;
|
|
211
|
-
this.req = init?.req;
|
|
212
|
-
this.chunkedEncoding = init?.chunkedEncoding;
|
|
213
|
-
}
|
|
214
|
-
[HttpMessageHost.kOnHeaderReceived](info) {
|
|
215
|
-
super[HttpMessageHost.kOnHeaderReceived](info);
|
|
216
|
-
this.statusCode = info.statusCode;
|
|
217
|
-
this.statusMessage = info.statusMessage;
|
|
218
|
-
}
|
|
219
|
-
static create(init) {
|
|
220
|
-
const msg = new HttpResponseMessageHost();
|
|
221
|
-
msg._init(init);
|
|
222
|
-
return msg;
|
|
223
|
-
}
|
|
224
|
-
static fromBuffer(buffer) {
|
|
225
|
-
const msg = new HttpResponseMessageHost();
|
|
226
|
-
msg._parseBuffer(buffer, HTTPParser.RESPONSE);
|
|
227
|
-
return msg;
|
|
228
|
-
}
|
|
229
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
230
|
-
static async fromStream(readable) {
|
|
231
|
-
throw new Error('fromStream is not implemented yet');
|
|
232
|
-
}
|
|
233
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import * as stream from 'stream';
|
|
4
|
-
import { HeaderInfo, ParserType } from '@browsery/http-parser';
|
|
5
|
-
import { HttpHeaders } from '@opra/common';
|
|
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,16 +0,0 @@
|
|
|
1
|
-
import { ApiDocument } from '@opra/common';
|
|
2
|
-
import { Request } from '../interfaces/request.interface.js';
|
|
3
|
-
import { HttpRequestContext, RpcRequestContext, WsRequestContext } from '../interfaces/request-context.interface.js';
|
|
4
|
-
import { Response } from '../interfaces/response.interface.js';
|
|
5
|
-
import { RequestContextHost } from '../request-context.host.js';
|
|
6
|
-
export declare class HttpRequestContextHost extends RequestContextHost {
|
|
7
|
-
readonly platform: string;
|
|
8
|
-
readonly api: ApiDocument;
|
|
9
|
-
protected _request: Request;
|
|
10
|
-
protected _response: Response;
|
|
11
|
-
user?: any;
|
|
12
|
-
constructor(platform: string, api: ApiDocument, _request: Request, _response: Response);
|
|
13
|
-
switchToHttp(): HttpRequestContext;
|
|
14
|
-
switchToWs(): WsRequestContext;
|
|
15
|
-
switchToRpc(): RpcRequestContext;
|
|
16
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { RequestHost } from '../request.host.js';
|
|
2
|
-
import { HttpRequestMessage } from './http-request-message.js';
|
|
3
|
-
export declare class HttpRequestHost extends RequestHost {
|
|
4
|
-
protected _incoming: HttpRequestMessage;
|
|
5
|
-
constructor(init: RequestHost.Initiator, _incoming: HttpRequestMessage);
|
|
6
|
-
switchToHttp(): HttpRequestMessage;
|
|
7
|
-
}
|