@opra/http 1.27.0 → 1.27.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.
- package/express-adapter.js +1 -1
- package/http-adapter.d.ts +1 -1
- package/http-adapter.js +2 -0
- package/http-context.js +2 -1
- package/http-handler.js +3 -2
- package/impl/multipart-reader.js +2 -2
- package/impl/node-incoming-message.host.js +5 -0
- package/interfaces/http-incoming.interface.js +1 -0
- package/interfaces/http-outgoing.interface.js +1 -0
- package/interfaces/node-incoming-message.interface.js +1 -0
- package/interfaces/node-outgoing-message.interface.js +3 -0
- package/package.json +3 -3
- package/utils/body-reader.js +1 -0
- package/utils/concat-readable.js +1 -1
package/express-adapter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as nodePath from 'node:path';
|
|
2
|
-
import { HttpApi, NotFoundError, } from '@opra/common';
|
|
2
|
+
import { ApiDocument, HttpApi, HttpController, HttpOperation, NotFoundError, } from '@opra/common';
|
|
3
3
|
import { Router, } from 'express';
|
|
4
4
|
import { HttpAdapter } from './http-adapter.js';
|
|
5
5
|
import { HttpContext } from './http-context.js';
|
package/http-adapter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpApi, OpraSchema } from '@opra/common';
|
|
2
2
|
import { PlatformAdapter } from '@opra/core';
|
|
3
|
-
import { EventMap } from 'node-events-async';
|
|
3
|
+
import type { EventMap } from 'node-events-async';
|
|
4
4
|
import { HttpContext } from './http-context.js';
|
|
5
5
|
import { HttpHandler } from './http-handler.js';
|
|
6
6
|
/**
|
package/http-adapter.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { HttpApi, OpraSchema } from '@opra/common';
|
|
1
2
|
import { PlatformAdapter } from '@opra/core';
|
|
3
|
+
import { HttpContext } from './http-context.js';
|
|
2
4
|
import { HttpHandler } from './http-handler.js';
|
|
3
5
|
/**
|
|
4
6
|
* HttpAdapter is the base class for all HTTP platform adapters.
|
package/http-context.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import typeIs from '@browsery/type-is';
|
|
2
|
-
import { BadRequestError, InternalServerError, MimeTypes, NotAcceptableError, } from '@opra/common';
|
|
2
|
+
import { BadRequestError, HttpController, HttpMediaType, HttpOperation, InternalServerError, MimeTypes, NotAcceptableError, } from '@opra/common';
|
|
3
3
|
import { ExecutionContext, kAssetCache } from '@opra/core';
|
|
4
4
|
import toml from 'toml';
|
|
5
|
+
import {} from 'valgen';
|
|
5
6
|
import yaml from 'yaml';
|
|
6
7
|
import { MultipartReader } from './impl/multipart-reader.js';
|
|
7
8
|
export class HttpContext extends ExecutionContext {
|
package/http-handler.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as process from 'node:process';
|
|
2
2
|
import typeIs from '@browsery/type-is';
|
|
3
|
-
import { ArrayType, BadRequestError, HttpHeaderCodes, HttpStatusCode, InternalServerError, isBlob, isReadableStream, IssueSeverity, MethodNotAllowedError, MimeTypes, OperationResult, OpraException, OpraSchema, safeJsonStringify, } from '@opra/common';
|
|
4
|
-
import { kAssetCache } from '@opra/core';
|
|
3
|
+
import { ArrayType, BadRequestError, HttpHeaderCodes, HttpMediaType, HttpOperationResponse, HttpParameter, HttpStatusCode, InternalServerError, isBlob, isReadableStream, IssueSeverity, MethodNotAllowedError, MimeTypes, OperationResult, OpraException, OpraHttpError, OpraSchema, safeJsonStringify, } from '@opra/common';
|
|
4
|
+
import { AssetCache, kAssetCache } from '@opra/core';
|
|
5
5
|
import { parse as parseContentType } from 'content-type';
|
|
6
6
|
import { splitString } from 'fast-tokenizer';
|
|
7
7
|
import { md5 } from 'super-fast-md5';
|
|
8
8
|
import { asMutable } from 'ts-gems';
|
|
9
9
|
import { toArray, ValidationError, vg, } from 'valgen';
|
|
10
|
+
import { HttpContext } from './http-context.js';
|
|
10
11
|
import { wrapException } from './utils/wrap-exception.js';
|
|
11
12
|
/**
|
|
12
13
|
* HttpHandler is responsible for processing incoming HTTP requests.
|
package/impl/multipart-reader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import typeIs from '@browsery/type-is';
|
|
4
|
-
import { BadRequestError } from '@opra/common';
|
|
4
|
+
import { BadRequestError, HttpMediaType } from '@opra/common';
|
|
5
5
|
import busboy from 'busboy';
|
|
6
6
|
import { EventEmitter } from 'events';
|
|
7
7
|
import fsPromise from 'fs/promises';
|
|
8
|
-
import { isNotNullish } from 'valgen';
|
|
8
|
+
import { isNotNullish, ValidationError } from 'valgen';
|
|
9
9
|
import { LocalFile } from './local-file.js';
|
|
10
10
|
/**
|
|
11
11
|
* MultipartReader is responsible for parsing multipart/form-data requests.
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file contains code blocks from open source NodeJs project
|
|
3
|
+
https://github.com/nodejs/
|
|
4
|
+
*/
|
|
5
|
+
import {} from '@browsery/http-parser';
|
|
1
6
|
import { isAsyncIterable, isIterable } from '@jsopen/objects';
|
|
2
7
|
import { Duplex, Readable } from 'stream';
|
|
3
8
|
import { convertToHeaders, convertToHeadersDistinct, } from '../utils/convert-to-headers.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mergePrototype } from '@opra/common';
|
|
2
2
|
import { HttpIncomingHost } from '../impl/http-incoming.host.js';
|
|
3
3
|
import { isHttpIncoming, isNodeIncomingMessage } from '../type-guards.js';
|
|
4
|
+
import { BodyReader } from '../utils/body-reader.js';
|
|
4
5
|
import { NodeIncomingMessage } from './node-incoming-message.interface.js';
|
|
5
6
|
/**
|
|
6
7
|
* Utility functions for HttpIncoming.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { mergePrototype } from '@opra/common';
|
|
2
|
+
import {} from 'ts-gems';
|
|
2
3
|
import { HttpOutgoingHost } from '../impl/http-outgoing.host.js';
|
|
3
4
|
import { isHttpOutgoing, isNodeOutgoingMessage } from '../type-guards.js';
|
|
4
5
|
import { NodeOutgoingMessage } from './node-outgoing-message.interface.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HTTPParser } from '@browsery/http-parser';
|
|
2
2
|
import { isAsyncIterable, isIterable } from '@jsopen/objects';
|
|
3
|
+
import http from 'http';
|
|
3
4
|
import { Readable } from 'stream';
|
|
4
5
|
import { CRLF, kHttpParser, NodeIncomingMessageHost, } from '../impl/node-incoming-message.host.js';
|
|
5
6
|
import { concatReadable } from '../utils/concat-readable.js';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import http, {} from 'http';
|
|
2
|
+
import { Writable } from 'stream';
|
|
1
3
|
import { NodeOutgoingMessageHost } from '../impl/node-outgoing-message.host.js';
|
|
4
|
+
import { NodeIncomingMessage } from './node-incoming-message.interface.js';
|
|
2
5
|
/**
|
|
3
6
|
*
|
|
4
7
|
* @namespace NodeOutgoingMessage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/http",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.2",
|
|
4
4
|
"description": "Opra Http Server Adapter",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"yaml": "^2.8.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@opra/common": "^1.27.
|
|
42
|
-
"@opra/core": "^1.27.
|
|
41
|
+
"@opra/common": "^1.27.2",
|
|
42
|
+
"@opra/core": "^1.27.2"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
45
|
"express": "^4.0.0 || ^5.0.0",
|
package/utils/body-reader.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import nodeStream from 'node:stream';
|
|
3
4
|
import typeIs from '@browsery/type-is';
|
|
4
5
|
import { BadRequestError, InternalServerError, OpraHttpError, } from '@opra/common';
|
|
5
6
|
import { Base64Decode } from 'base64-stream';
|
package/utils/concat-readable.js
CHANGED