@opra/http 1.0.0-beta.5 → 1.0.0-beta.6
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/express-adapter.js
CHANGED
|
@@ -9,7 +9,6 @@ const http_adapter_js_1 = require("./http-adapter.js");
|
|
|
9
9
|
const http_context_js_1 = require("./http-context.js");
|
|
10
10
|
const http_incoming_interface_js_1 = require("./interfaces/http-incoming.interface.js");
|
|
11
11
|
const http_outgoing_interface_js_1 = require("./interfaces/http-outgoing.interface.js");
|
|
12
|
-
const wrap_exception_js_1 = require("./utils/wrap-exception.js");
|
|
13
12
|
class ExpressAdapter extends http_adapter_js_1.HttpAdapter {
|
|
14
13
|
constructor(app, document, options) {
|
|
15
14
|
super(document, options);
|
|
@@ -33,18 +32,6 @@ class ExpressAdapter extends http_adapter_js_1.HttpAdapter {
|
|
|
33
32
|
await processInstance(subResource);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
if (controller.onShutdown) {
|
|
37
|
-
const instance = this._controllerInstances.get(controller) || controller.instance;
|
|
38
|
-
if (instance) {
|
|
39
|
-
try {
|
|
40
|
-
await controller.onShutdown.call(instance, controller);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
if (this.listenerCount('error'))
|
|
44
|
-
this.emit('error', (0, wrap_exception_js_1.wrapException)(e));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
35
|
};
|
|
49
36
|
for (const c of this.api.controllers.values())
|
|
50
37
|
await processInstance(c);
|
|
@@ -134,8 +121,6 @@ class ExpressAdapter extends http_adapter_js_1.HttpAdapter {
|
|
|
134
121
|
if (!instance && controller.ctor)
|
|
135
122
|
instance = new controller.ctor();
|
|
136
123
|
if (instance) {
|
|
137
|
-
if (typeof controller.onInit === 'function')
|
|
138
|
-
controller.onInit.call(instance, controller);
|
|
139
124
|
this._controllerInstances.set(controller, instance);
|
|
140
125
|
// Initialize sub resources
|
|
141
126
|
for (const r of controller.controllers.values()) {
|
|
@@ -10,7 +10,7 @@ const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
|
10
10
|
const common_1 = require("@opra/common");
|
|
11
11
|
const content_disposition_1 = tslib_1.__importDefault(require("content-disposition"));
|
|
12
12
|
const content_type_1 = tslib_1.__importDefault(require("content-type"));
|
|
13
|
-
const
|
|
13
|
+
const cookie = tslib_1.__importStar(require("cookie"));
|
|
14
14
|
const cookie_signature_1 = tslib_1.__importDefault(require("cookie-signature"));
|
|
15
15
|
const encodeurl_1 = tslib_1.__importDefault(require("encodeurl"));
|
|
16
16
|
const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
|
|
@@ -79,7 +79,7 @@ class HttpOutgoingHost {
|
|
|
79
79
|
}
|
|
80
80
|
if (opts.path == null)
|
|
81
81
|
opts.path = '/';
|
|
82
|
-
this.appendHeader('Set-Cookie',
|
|
82
|
+
this.appendHeader('Set-Cookie', cookie.serialize(name, String(val), opts));
|
|
83
83
|
return this;
|
|
84
84
|
}
|
|
85
85
|
status(code) {
|
package/esm/express-adapter.js
CHANGED
|
@@ -5,7 +5,6 @@ import { HttpAdapter } from './http-adapter.js';
|
|
|
5
5
|
import { HttpContext } from './http-context.js';
|
|
6
6
|
import { HttpIncoming } from './interfaces/http-incoming.interface.js';
|
|
7
7
|
import { HttpOutgoing } from './interfaces/http-outgoing.interface.js';
|
|
8
|
-
import { wrapException } from './utils/wrap-exception.js';
|
|
9
8
|
export class ExpressAdapter extends HttpAdapter {
|
|
10
9
|
constructor(app, document, options) {
|
|
11
10
|
super(document, options);
|
|
@@ -29,18 +28,6 @@ export class ExpressAdapter extends HttpAdapter {
|
|
|
29
28
|
await processInstance(subResource);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
if (controller.onShutdown) {
|
|
33
|
-
const instance = this._controllerInstances.get(controller) || controller.instance;
|
|
34
|
-
if (instance) {
|
|
35
|
-
try {
|
|
36
|
-
await controller.onShutdown.call(instance, controller);
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
if (this.listenerCount('error'))
|
|
40
|
-
this.emit('error', wrapException(e));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
31
|
};
|
|
45
32
|
for (const c of this.api.controllers.values())
|
|
46
33
|
await processInstance(c);
|
|
@@ -130,8 +117,6 @@ export class ExpressAdapter extends HttpAdapter {
|
|
|
130
117
|
if (!instance && controller.ctor)
|
|
131
118
|
instance = new controller.ctor();
|
|
132
119
|
if (instance) {
|
|
133
|
-
if (typeof controller.onInit === 'function')
|
|
134
|
-
controller.onInit.call(instance, controller);
|
|
135
120
|
this._controllerInstances.set(controller, instance);
|
|
136
121
|
// Initialize sub resources
|
|
137
122
|
for (const r of controller.controllers.values()) {
|
|
@@ -6,7 +6,7 @@ import path from 'node:path';
|
|
|
6
6
|
import { HttpStatusCode } from '@opra/common';
|
|
7
7
|
import contentDisposition from 'content-disposition';
|
|
8
8
|
import contentType from 'content-type';
|
|
9
|
-
import cookie from 'cookie';
|
|
9
|
+
import * as cookie from 'cookie';
|
|
10
10
|
import cookieSignature from 'cookie-signature';
|
|
11
11
|
import encodeUrl from 'encodeurl';
|
|
12
12
|
import mime from 'mime-types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/http",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "Opra Http Server Adapter",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"@browsery/antlr4": "^4.13.3-r1",
|
|
9
9
|
"@browsery/http-parser": "^0.5.9-r1",
|
|
10
10
|
"@browsery/type-is": "^1.6.18-r5",
|
|
11
|
-
"@opra/common": "^1.0.0-beta.
|
|
12
|
-
"@opra/core": "^1.0.0-beta.
|
|
11
|
+
"@opra/common": "^1.0.0-beta.6",
|
|
12
|
+
"@opra/core": "^1.0.0-beta.6",
|
|
13
13
|
"accepts": "^1.3.8",
|
|
14
14
|
"base64-stream": "^1.0.0",
|
|
15
15
|
"busboy": "^1.6.0",
|
|
16
16
|
"bytes": "^3.1.2",
|
|
17
17
|
"content-disposition": "^0.5.4",
|
|
18
18
|
"content-type": "^1.0.5",
|
|
19
|
-
"cookie": "^0.
|
|
19
|
+
"cookie": "^1.0.0",
|
|
20
20
|
"cookie-signature": "^1.2.1",
|
|
21
21
|
"cppzst": "^2.0.12",
|
|
22
22
|
"encodeurl": "^2.0.0",
|