@opra/http 1.28.3 → 1.28.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.
- package/LICENSE +1 -1
- package/README.md +47 -3
- package/http-context.js +1 -0
- package/package.json +5 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,19 +1,63 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<a href="https://oprajs.com">
|
|
4
|
+
<img src="https://oprajs.com/img/opra-header-block.webp" width="880" alt="OPRA — Open Platform for Rich APIs" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
1
7
|
# @opra/http
|
|
2
8
|
|
|
9
|
+
Standalone HTTP server adapter for the OPRA framework
|
|
10
|
+
|
|
3
11
|
[![NPM Version][npm-image]][npm-url]
|
|
4
12
|
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
13
|
[![CI Tests][ci-test-image]][ci-test-url]
|
|
6
14
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
7
15
|
|
|
16
|
+
[🌐 Documentation](https://oprajs.com) · [🚀 Getting Started](https://oprajs.com/docs/introduction) · [📦 Packages](https://github.com/panates/opra#packages) · [💬 Issues](https://github.com/panates/opra/issues)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
Standalone HTTP server adapter for the [OPRA](https://oprajs.com) framework. Plug your existing Express (or any compatible) application into OPRA with minimal setup.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **`HttpAdapter`** — Abstract base for all HTTP platform adapters
|
|
27
|
+
- **`ExpressAdapter`** — Drop-in Express.js integration
|
|
28
|
+
- **`HttpHandler`** — Full request lifecycle: parsing, validation, routing, response
|
|
29
|
+
- **`HttpContext`** — Per-request context with typed access to params, headers, and body
|
|
30
|
+
- **Interceptors** — Middleware pipeline at the adapter level
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
8
33
|
|
|
9
|
-
|
|
10
|
-
|
|
34
|
+
```bash
|
|
35
|
+
npm install @opra/http
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import express from 'express';
|
|
42
|
+
import { ExpressAdapter } from '@opra/http';
|
|
43
|
+
|
|
44
|
+
const app = express();
|
|
45
|
+
|
|
46
|
+
const adapter = new ExpressAdapter(app, apiDocument, {
|
|
47
|
+
basePath: '/api/v1',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
await adapter.initialize();
|
|
51
|
+
|
|
52
|
+
app.listen(3000);
|
|
53
|
+
```
|
|
11
54
|
|
|
12
55
|
## Node Compatibility
|
|
13
|
-
- node >= 20.x
|
|
14
56
|
|
|
57
|
+
- node >= 20.x
|
|
15
58
|
|
|
16
59
|
## License
|
|
60
|
+
|
|
17
61
|
Available under [MIT](LICENSE) license.
|
|
18
62
|
|
|
19
63
|
[npm-image]: https://img.shields.io/npm/v/@opra/http
|
package/http-context.js
CHANGED
|
@@ -148,6 +148,7 @@ export class HttpContext extends ExecutionContext {
|
|
|
148
148
|
projection: '*',
|
|
149
149
|
ignoreReadonlyFields: true,
|
|
150
150
|
allowPatchOperators: __oprDef?.requestBody?.allowPatchOperators,
|
|
151
|
+
allowNullOptionals: __oprDef?.requestBody?.allowNullOptionals,
|
|
151
152
|
keepKeyFields: __oprDef?.requestBody?.keepKeyFields,
|
|
152
153
|
});
|
|
153
154
|
this.__adapter[kAssetCache].set(mediaType, 'decode', decode);
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/http",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.5",
|
|
4
4
|
"description": "Opra Http Server Adapter",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://www.oprajs.com",
|
|
7
8
|
"dependencies": {
|
|
8
9
|
"@browsery/antlr4": "^4.13.3-r7",
|
|
9
10
|
"@browsery/http-parser": "^0.5.10-r3",
|
|
10
11
|
"@browsery/type-is": "^2.0.2-r1",
|
|
11
|
-
"@jsopen/objects": "^2.2.
|
|
12
|
+
"@jsopen/objects": "^2.2.2",
|
|
12
13
|
"accepts": "^1.3.8",
|
|
13
14
|
"base64-stream": "^1.0.0",
|
|
14
15
|
"busboy": "^1.6.0",
|
|
@@ -38,8 +39,8 @@
|
|
|
38
39
|
"yaml": "^2.9.0"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
|
-
"@opra/common": "^1.28.
|
|
42
|
-
"@opra/core": "^1.28.
|
|
42
|
+
"@opra/common": "^1.28.5",
|
|
43
|
+
"@opra/core": "^1.28.5"
|
|
43
44
|
},
|
|
44
45
|
"optionalDependencies": {
|
|
45
46
|
"express": "^4.0.0 || ^5.0.0",
|