@opra/core 0.18.4 → 0.20.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.
@@ -0,0 +1,246 @@
1
+ import * as stream from 'stream';
2
+ import { HTTPParser } from '@browsery/http-parser';
3
+ import { HttpHeaders } from '@opra/common';
4
+ const kHeaders = Symbol('kHeaders');
5
+ const kHeadersProxy = Symbol('kHeadersProxy');
6
+ const kTrailers = Symbol('kTrailers');
7
+ const kTrailersProxy = Symbol('kTrailersProxy');
8
+ const kOnHeaderReceived = Symbol('kOnHeaderReceived');
9
+ const kOnTrailersReceived = Symbol('kOnTrailersReceived');
10
+ const kOnBodyChunk = Symbol('kOnBodyChunk');
11
+ const kOnReadComplete = Symbol('kOnReadComplete');
12
+ const crlfBuffer = Buffer.from('\r\n');
13
+ const HTTP_VERSION_PATTERN = /^(\d)\.(\d)$/;
14
+ export class HttpMessageHost {
15
+ constructor() {
16
+ this.complete = false;
17
+ stream.Duplex.apply(this);
18
+ this[kHeaders] = new HttpHeaders(undefined, {
19
+ onChange: () => this._headersChanged = true
20
+ });
21
+ this[kTrailers] = new HttpHeaders(undefined, {
22
+ onChange: () => this._trailersChanged = true
23
+ });
24
+ }
25
+ get httpVersion() {
26
+ return this.httpVersionMajor
27
+ ? this.httpVersionMajor + '.' + (this.httpVersionMinor || 0)
28
+ : undefined;
29
+ }
30
+ set httpVersion(value) {
31
+ if (value) {
32
+ const m = HTTP_VERSION_PATTERN.exec(value);
33
+ if (!m)
34
+ throw new TypeError(`Invalid http version string (${value})`);
35
+ this.httpVersionMajor = parseInt(m[1], 10);
36
+ this.httpVersionMinor = parseInt(m[2], 10);
37
+ }
38
+ else {
39
+ this.httpVersionMajor = undefined;
40
+ this.httpVersionMinor = undefined;
41
+ }
42
+ }
43
+ get headers() {
44
+ this._initHeaders();
45
+ return this[kHeadersProxy];
46
+ }
47
+ set headers(headers) {
48
+ this[kHeaders].clear();
49
+ this[kHeaders].set(headers);
50
+ }
51
+ get trailers() {
52
+ this._initTrailers();
53
+ return this[kTrailersProxy];
54
+ }
55
+ set trailers(trailers) {
56
+ this[kTrailers].clear();
57
+ this[kTrailers].set(trailers);
58
+ }
59
+ get rawHeaders() {
60
+ this._buildRawHeaders();
61
+ return this._rawHeaders;
62
+ }
63
+ set rawHeaders(headers) {
64
+ this[kHeadersProxy] = undefined;
65
+ this._headersChanged = false;
66
+ this._rawHeaders = headers;
67
+ }
68
+ get rawTrailers() {
69
+ this._buildRawTrailers();
70
+ return this._rawTrailers;
71
+ }
72
+ set rawTrailers(trailers) {
73
+ this[kTrailersProxy] = undefined;
74
+ this._trailersChanged = false;
75
+ this._rawTrailers = trailers;
76
+ }
77
+ getHeader(name) {
78
+ if (!name)
79
+ return;
80
+ this._initHeaders();
81
+ switch (name.toLowerCase()) {
82
+ case 'referer':
83
+ case 'referrer':
84
+ return this[kHeaders].get(name) ||
85
+ this[kHeaders].get('referrer') ||
86
+ this[kHeaders].get('referer');
87
+ default:
88
+ return this[kHeaders].get(name);
89
+ }
90
+ }
91
+ get(name) {
92
+ this._initHeaders();
93
+ return this[kHeaders].get(name);
94
+ }
95
+ setHeader(arg0, arg1) {
96
+ this._initHeaders();
97
+ if (typeof arg0 === 'object')
98
+ this[kHeaders].set(arg0);
99
+ else
100
+ this[kHeaders].set(arg0, arg1);
101
+ return this;
102
+ }
103
+ set(arg0, arg1) {
104
+ return this.setHeader(arg0, arg1);
105
+ }
106
+ getHeaders() {
107
+ this._initHeaders();
108
+ return this[kHeaders].toObject();
109
+ }
110
+ getHeaderNames() {
111
+ this._initHeaders();
112
+ return Array.from(this[kHeaders].keys());
113
+ }
114
+ hasHeader(name) {
115
+ this._initHeaders();
116
+ return this[kHeaders].has(name);
117
+ }
118
+ removeHeader(name) {
119
+ this._initHeaders();
120
+ this[kHeaders].delete(name);
121
+ }
122
+ send(body) {
123
+ this.body = body;
124
+ return this;
125
+ }
126
+ end(body) {
127
+ if (body)
128
+ this.body = body;
129
+ return this;
130
+ }
131
+ setTimeout() {
132
+ return this;
133
+ }
134
+ _init(args) {
135
+ this.complete = true;
136
+ this.httpVersionMajor = args?.httpVersionMajor;
137
+ this.httpVersionMinor = args?.httpVersionMinor;
138
+ this._rawHeaders = args.rawHeaders;
139
+ this._rawTrailers = args.rawTrailers;
140
+ if (args.headers)
141
+ this[kHeaders].set(args.headers);
142
+ if (args.trailers)
143
+ this[kTrailers].set(args.trailers);
144
+ this.body = args.body;
145
+ }
146
+ _parseBuffer(buf, parserType) {
147
+ const parser = new HTTPParser(parserType);
148
+ parser[HTTPParser.kOnHeadersComplete] = this[kOnHeaderReceived].bind(this);
149
+ parser[HTTPParser.kOnBody] = this[kOnBodyChunk].bind(this);
150
+ parser[HTTPParser.kOnHeaders] = this[kOnTrailersReceived].bind(this);
151
+ parser[HTTPParser.kOnMessageComplete] = this[kOnReadComplete].bind(this);
152
+ const buffer = Buffer.from(buf);
153
+ let x = parser.execute(buffer);
154
+ if (typeof x === 'object')
155
+ throw x;
156
+ if (!this.complete) {
157
+ x = parser.execute(crlfBuffer);
158
+ if (typeof x === 'object')
159
+ throw x;
160
+ }
161
+ parser.finish();
162
+ }
163
+ _initHeaders() {
164
+ if (!this[kHeadersProxy]) {
165
+ this[kHeadersProxy] = this[kHeaders].getProxy();
166
+ if (this._rawHeaders) {
167
+ const src = this._rawHeaders;
168
+ const l = Math.floor(src.length / 2);
169
+ for (let n = 0; n <= l; n += 2) {
170
+ this[kHeaders].append(src[n], src[n + 1]);
171
+ }
172
+ }
173
+ }
174
+ }
175
+ _initTrailers() {
176
+ if (!this[kTrailersProxy]) {
177
+ this[kTrailersProxy] = this[kTrailers].getProxy();
178
+ if (this._rawTrailers) {
179
+ const src = this._rawTrailers;
180
+ const l = Math.floor(src.length / 2);
181
+ for (let n = 0; n <= l; n += 2) {
182
+ this[kTrailers].append(src[n], src[n + 1]);
183
+ }
184
+ }
185
+ }
186
+ }
187
+ _buildRawHeaders() {
188
+ // Rebuild rawHeaders if headers object changed
189
+ if (this._headersChanged || !this._rawHeaders) {
190
+ this._headersChanged = false;
191
+ this._rawHeaders = Object.entries(this.headers)
192
+ .reduce((a, [k, v]) => {
193
+ if (Array.isArray(v))
194
+ v.forEach(x => a.push(k, String(x)));
195
+ else
196
+ a.push(k, String(v));
197
+ return a;
198
+ }, []);
199
+ }
200
+ }
201
+ _buildRawTrailers() {
202
+ // Rebuild rawHeaders if headers object changed
203
+ if (this._trailersChanged || !this._rawTrailers) {
204
+ this._trailersChanged = false;
205
+ this._rawTrailers = Object.entries(this.trailers)
206
+ .reduce((a, [k, v]) => {
207
+ if (Array.isArray(v))
208
+ v.forEach(x => a.push(k, String(x)));
209
+ else
210
+ a.push(k, String(v));
211
+ return a;
212
+ }, []);
213
+ }
214
+ }
215
+ [kOnHeaderReceived](info) {
216
+ this.httpVersionMajor = info.versionMajor;
217
+ this.httpVersionMinor = info.versionMinor;
218
+ this._rawHeaders = info.headers;
219
+ this.shouldKeepAlive = info.shouldKeepAlive;
220
+ this.upgrade = info.upgrade;
221
+ }
222
+ [kOnTrailersReceived](trailers) {
223
+ this._rawTrailers = trailers;
224
+ }
225
+ [kOnBodyChunk](chunk, offset, length) {
226
+ this._bodyChunks = this._bodyChunks || [];
227
+ this._bodyChunks.push(chunk.subarray(offset, offset + length));
228
+ }
229
+ [kOnReadComplete]() {
230
+ this.complete = true;
231
+ if (this._bodyChunks) {
232
+ this.body = Buffer.concat(this._bodyChunks);
233
+ this._bodyChunks = undefined;
234
+ }
235
+ }
236
+ }
237
+ HttpMessageHost.kHeaders = kHeaders;
238
+ HttpMessageHost.kHeadersProxy = kHeadersProxy;
239
+ HttpMessageHost.kTrailers = kTrailers;
240
+ HttpMessageHost.kTrailersProxy = kTrailersProxy;
241
+ HttpMessageHost.kOnHeaderReceived = kOnHeaderReceived;
242
+ HttpMessageHost.kOnTrailersReceived = kOnTrailersReceived;
243
+ HttpMessageHost.kOnBodyChunk = kOnBodyChunk;
244
+ HttpMessageHost.kOnReadComplete = kOnReadComplete;
245
+ // Mixin with Duplex
246
+ Object.assign(HttpMessageHost.prototype, stream.Duplex.prototype);
@@ -0,0 +1,148 @@
1
+ import accepts from 'accepts';
2
+ import typeIs from 'type-is';
3
+ import { HTTPParser } from '@browsery/http-parser';
4
+ import { HttpParams } from '@opra/common';
5
+ import { HttpMessageHost } from './http-message.host.js';
6
+ const HTTP_VERSION_PATTERN = /^(\d)\.(\d)$/;
7
+ export var HttpRequestMessage;
8
+ (function (HttpRequestMessage) {
9
+ function create(init) {
10
+ return HttpRequestMessageHost.create(init);
11
+ }
12
+ HttpRequestMessage.create = create;
13
+ function fromBuffer(buffer) {
14
+ return HttpRequestMessageHost.fromBuffer(buffer);
15
+ }
16
+ HttpRequestMessage.fromBuffer = fromBuffer;
17
+ async function fromStream(readable) {
18
+ return HttpRequestMessageHost.fromStream(readable);
19
+ }
20
+ HttpRequestMessage.fromStream = fromStream;
21
+ })(HttpRequestMessage || (HttpRequestMessage = {}));
22
+ const kQuery = Symbol('kQuery');
23
+ const kQueryProxy = Symbol('kQueryProxy');
24
+ const kProtocol = Symbol('kProtocol');
25
+ /**
26
+ *
27
+ */
28
+ class HttpRequestMessageHost extends HttpMessageHost {
29
+ constructor() {
30
+ super();
31
+ this.httpVersionMajor = 1;
32
+ this.httpVersionMinor = 0;
33
+ this[kQuery] = new HttpParams();
34
+ this[kQueryProxy] = this[kQuery].getProxy();
35
+ }
36
+ get httpVersion() {
37
+ return this.httpVersionMajor + '.' + this.httpVersionMinor;
38
+ }
39
+ set httpVersion(value) {
40
+ const m = HTTP_VERSION_PATTERN.exec(value);
41
+ if (!m)
42
+ throw new TypeError(`Invalid http version string (${value})`);
43
+ this.httpVersionMajor = parseInt(m[1], 10);
44
+ this.httpVersionMinor = parseInt(m[2], 10);
45
+ }
46
+ get hostname() {
47
+ let host = this.get('X-Forwarded-Host') || this.get('Host');
48
+ if (host && host.indexOf(',') !== -1) {
49
+ // Note: X-Forwarded-Host is normally only ever a single value, but this is to be safe.
50
+ host = host.substring(0, host.indexOf(',')).trimEnd();
51
+ }
52
+ if (!host)
53
+ return '';
54
+ // IPv6 literal support
55
+ const offset = host[0] === '['
56
+ ? host.indexOf(']') + 1
57
+ : 0;
58
+ const index = host.indexOf(':', offset);
59
+ return index !== -1
60
+ ? host.substring(0, index)
61
+ : host;
62
+ }
63
+ get protocol() {
64
+ if (this[kProtocol])
65
+ return this[kProtocol];
66
+ // Note: X-Forwarded-Proto is normally only ever a
67
+ // single value, but this is to be safe.
68
+ const header = this.get('X-Forwarded-Proto');
69
+ if (header) {
70
+ const index = header.indexOf(',');
71
+ return index !== -1
72
+ ? header.substring(0, index).trim()
73
+ : header.trim();
74
+ }
75
+ return 'http';
76
+ }
77
+ set protocol(v) {
78
+ this[kProtocol] = v;
79
+ }
80
+ get secure() {
81
+ return this.protocol === 'https';
82
+ }
83
+ get query() {
84
+ return this[kQueryProxy];
85
+ }
86
+ set query(value) {
87
+ this[kQuery].clear();
88
+ this[kQuery].appendAll(value);
89
+ }
90
+ header(name) {
91
+ return this.getHeader(name);
92
+ }
93
+ accepts(...type) {
94
+ const accept = accepts(this);
95
+ // eslint-disable-next-line prefer-spread
96
+ return accept.types.apply(accept, type);
97
+ }
98
+ acceptsCharsets(...charset) {
99
+ const accept = accepts(this);
100
+ // eslint-disable-next-line prefer-spread
101
+ return accept.charsets.apply(accept, charset);
102
+ }
103
+ acceptsEncodings(...encoding) {
104
+ const accept = accepts(this);
105
+ // eslint-disable-next-line prefer-spread
106
+ return accept.encodings.apply(accept, encoding);
107
+ }
108
+ acceptsLanguages(...lang) {
109
+ const accept = accepts(this);
110
+ // eslint-disable-next-line prefer-spread
111
+ return accept.languages.apply(accept, lang);
112
+ }
113
+ is(type, ...otherTypes) {
114
+ const types = Array.isArray(type) ? type : [type];
115
+ if (otherTypes.length)
116
+ types.push(...otherTypes);
117
+ const contentType = this.getHeader('content-type');
118
+ return contentType ? typeIs.is(contentType, types) : null;
119
+ }
120
+ _init(init) {
121
+ super._init(init);
122
+ this.method = init.method.toUpperCase();
123
+ this.url = init.url;
124
+ this.baseUrl = init.baseUrl || this.url;
125
+ this.protocol = init.protocol;
126
+ }
127
+ [HttpMessageHost.kOnHeaderReceived](info) {
128
+ super[HttpMessageHost.kOnHeaderReceived](info);
129
+ this.method = HTTPParser.methods[info.method];
130
+ this.url = info.url;
131
+ this.baseUrl = info.url;
132
+ }
133
+ static create(init) {
134
+ const msg = new HttpRequestMessageHost();
135
+ msg._init(init);
136
+ return msg;
137
+ }
138
+ static fromBuffer(buffer) {
139
+ const msg = new HttpRequestMessageHost();
140
+ msg._parseBuffer(buffer, HTTPParser.REQUEST);
141
+ return msg;
142
+ }
143
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
144
+ static async fromStream(readable) {
145
+ throw new Error('fromStream is not implemented yet');
146
+ }
147
+ }
148
+ HttpRequestMessageHost.kQuery = kQuery;
@@ -0,0 +1,233 @@
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,6 +1,6 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { ApiDocument, cloneObject, Singleton } from '@opra/common';
3
- let MetadataResource = class MetadataResource {
3
+ export let MetadataResource = class MetadataResource {
4
4
  constructor(document) {
5
5
  this.document = document;
6
6
  this._schema = document.exportSchema();
@@ -21,4 +21,3 @@ MetadataResource = __decorate([
21
21
  }),
22
22
  __metadata("design:paramtypes", [ApiDocument])
23
23
  ], MetadataResource);
24
- export { MetadataResource };
package/esm/index.js CHANGED
@@ -4,6 +4,8 @@ export * from './types.js';
4
4
  export * from './adapter/adapter.js';
5
5
  export * from './adapter/http/express-adapter.js';
6
6
  export * from './adapter/http/http-adapter.js';
7
+ export * from './adapter/http/http-request-message.js';
8
+ export * from './adapter/http/http-response-message.js';
7
9
  export * from './adapter/interfaces/request-context.interface.js';
8
10
  export * from './adapter/interfaces/logger.interface.js';
9
11
  export * from './adapter/interfaces/request.interface.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/core",
3
- "version": "0.18.4",
3
+ "version": "0.20.0",
4
4
  "description": "Opra schema package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -27,26 +27,38 @@
27
27
  "clean:cover": "rimraf ../../coverage/core"
28
28
  },
29
29
  "dependencies": {
30
- "@opra/common": "^0.18.4",
30
+ "@opra/common": "^0.20.0",
31
+ "accepts": "^1.3.8",
32
+ "content-disposition": "^0.5.4",
31
33
  "content-type": "^1.0.5",
34
+ "cookie": "^0.5.0",
32
35
  "lodash.isnil": "^4.0.0",
33
36
  "lodash.omitby": "^4.6.0",
34
- "power-tasks": "^1.6.4",
37
+ "mime-types": "^2.1.35",
38
+ "power-tasks": "^1.7.0",
35
39
  "putil-isplainobject": "^1.1.5",
36
40
  "putil-merge": "^3.10.3",
37
41
  "putil-varhelpers": "^1.6.5",
38
- "strict-typed-events": "^2.3.1"
42
+ "strict-typed-events": "^2.3.1",
43
+ "type-is": "^1.6.18"
39
44
  },
40
45
  "peerDependencies": {
41
46
  "body-parser": "^1.20.2",
42
47
  "express": "^4.x.x || ^5.x.x"
43
48
  },
44
49
  "devDependencies": {
45
- "@faker-js/faker": "^8.0.0",
50
+ "@faker-js/faker": "^8.0.2",
51
+ "@types/accepts": "^1.3.5",
52
+ "@types/content-disposition": "^0.5.5",
46
53
  "@types/content-type": "^1.1.5",
54
+ "@types/cookie": "^0.5.1",
47
55
  "@types/dicer": "^0.2.2",
48
56
  "@types/express": "^4.17.17",
57
+ "@types/mime-types": "^2.1.1",
58
+ "@types/type-is": "^1.6.3",
49
59
  "cors": "^2.8.5",
60
+ "crypto-browserify": "^3.12.0",
61
+ "path-browserify": "^1.0.1",
50
62
  "ts-gems": "^2.4.0"
51
63
  },
52
64
  "type": "module",