@opra/core 1.0.0-alpha.17 → 1.0.0-alpha.19

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.
@@ -149,7 +149,6 @@ class BodyReader extends events_1.EventEmitter {
149
149
  message: 'request aborted',
150
150
  code: 'ECONNABORTED',
151
151
  details: {
152
- length,
153
152
  received: this._receivedSize,
154
153
  },
155
154
  }));
@@ -4,7 +4,10 @@
4
4
  https://github.com/nodejs/
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.validateString = exports.validateHeaderValue = exports.validateHeaderName = exports.hideStackFrames = exports.checkIsHttpToken = void 0;
7
+ exports.validateHeaderValue = exports.validateHeaderName = void 0;
8
+ exports.checkIsHttpToken = checkIsHttpToken;
9
+ exports.hideStackFrames = hideStackFrames;
10
+ exports.validateString = validateString;
8
11
  const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
9
12
  const nodeInternalPrefix = '__node_internal_';
10
13
  /**
@@ -17,7 +20,6 @@ const nodeInternalPrefix = '__node_internal_';
17
20
  function checkIsHttpToken(val) {
18
21
  return typeof val === 'string' && tokenRegExp.exec(val) !== null;
19
22
  }
20
- exports.checkIsHttpToken = checkIsHttpToken;
21
23
  const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
22
24
  /**
23
25
  * True if val contains an invalid field-vchar
@@ -44,7 +46,6 @@ function hideStackFrames(fn) {
44
46
  Object.defineProperty(fn, 'name', { __proto__: null, value: hidden });
45
47
  return fn;
46
48
  }
47
- exports.hideStackFrames = hideStackFrames;
48
49
  exports.validateHeaderName = hideStackFrames((name, label) => {
49
50
  // noinspection SuspiciousTypeOfGuard
50
51
  if (typeof name !== 'string' || !name || !checkIsHttpToken(name)) {
@@ -64,4 +65,3 @@ function validateString(value, name) {
64
65
  throw new TypeError(`Invalid ${name ? name + ' ' : ''}argument. Value must be a string`);
65
66
  }
66
67
  }
67
- exports.validateString = validateString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.concatReadable = void 0;
3
+ exports.concatReadable = concatReadable;
4
4
  const stream_1 = require("stream");
5
5
  function concatReadable(...streams) {
6
6
  const out = new stream_1.PassThrough();
@@ -17,4 +17,3 @@ function concatReadable(...streams) {
17
17
  pipeNext();
18
18
  return out;
19
19
  }
20
- exports.concatReadable = concatReadable;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToHeadersDistinct = exports.convertToHeaders = void 0;
3
+ exports.convertToHeaders = convertToHeaders;
4
+ exports.convertToHeadersDistinct = convertToHeadersDistinct;
4
5
  const match_known_fields_js_1 = require("./match-known-fields.js");
5
6
  function convertToHeaders(src, dst, joinDuplicateHeaders) {
6
7
  for (let n = 0; n < src.length; n += 2) {
@@ -8,7 +9,6 @@ function convertToHeaders(src, dst, joinDuplicateHeaders) {
8
9
  }
9
10
  return dst;
10
11
  }
11
- exports.convertToHeaders = convertToHeaders;
12
12
  function convertToHeadersDistinct(src, dst) {
13
13
  const count = src.length % 2;
14
14
  for (let n = 0; n < count; n += 2) {
@@ -16,7 +16,6 @@ function convertToHeadersDistinct(src, dst) {
16
16
  }
17
17
  return dst;
18
18
  }
19
- exports.convertToHeadersDistinct = convertToHeadersDistinct;
20
19
  function addHeaderLine(field, value, dest, joinDuplicateHeaders) {
21
20
  if (value == null)
22
21
  return;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToRawHeaders = void 0;
3
+ exports.convertToRawHeaders = convertToRawHeaders;
4
4
  const match_known_fields_js_1 = require("./match-known-fields.js");
5
5
  function convertToRawHeaders(src) {
6
6
  return Object.entries(src).reduce((a, [field, v]) => {
@@ -21,4 +21,3 @@ function convertToRawHeaders(src) {
21
21
  return a;
22
22
  }, []);
23
23
  }
24
- exports.convertToRawHeaders = convertToRawHeaders;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.matchKnownFields = exports.ARRAY_FIELD = exports.SEMICOLON_DELIMITED_FIELD = exports.COMMA_DELIMITED_FIELD = exports.NO_DUPLICATES_FIELD = void 0;
3
+ exports.ARRAY_FIELD = exports.SEMICOLON_DELIMITED_FIELD = exports.COMMA_DELIMITED_FIELD = exports.NO_DUPLICATES_FIELD = void 0;
4
+ exports.matchKnownFields = matchKnownFields;
4
5
  const common_1 = require("@opra/common");
5
6
  exports.NO_DUPLICATES_FIELD = 0;
6
7
  exports.COMMA_DELIMITED_FIELD = 1;
@@ -46,4 +47,3 @@ function matchKnownFields(field) {
46
47
  const x = KNOWN_FIELDS[field.toLowerCase()];
47
48
  return x ? x : [field, exports.COMMA_DELIMITED_FIELD];
48
49
  }
49
- exports.matchKnownFields = matchKnownFields;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapException = void 0;
3
+ exports.wrapException = wrapException;
4
4
  const common_1 = require("@opra/common");
5
5
  function wrapException(error) {
6
6
  if (error instanceof common_1.OpraHttpError)
@@ -31,4 +31,3 @@ function wrapException(error) {
31
31
  return new common_1.InternalServerError(error);
32
32
  }
33
33
  }
34
- exports.wrapException = wrapException;
@@ -1,23 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHttpOutgoing = exports.isNodeOutgoingMessage = exports.isHttpIncoming = exports.isNodeIncomingMessage = void 0;
3
+ exports.isNodeIncomingMessage = isNodeIncomingMessage;
4
+ exports.isHttpIncoming = isHttpIncoming;
5
+ exports.isNodeOutgoingMessage = isNodeOutgoingMessage;
6
+ exports.isHttpOutgoing = isHttpOutgoing;
4
7
  const common_1 = require("@opra/common");
5
8
  function isNodeIncomingMessage(v) {
6
9
  return v && typeof v.method === 'string' && Array.isArray(v.rawHeaders) && (0, common_1.isReadable)(v);
7
10
  }
8
- exports.isNodeIncomingMessage = isNodeIncomingMessage;
9
11
  function isHttpIncoming(v) {
10
12
  return (isNodeIncomingMessage(v) &&
11
13
  typeof v.header === 'function' &&
12
14
  typeof v.acceptsLanguages === 'function' &&
13
15
  typeof v.readBody === 'function');
14
16
  }
15
- exports.isHttpIncoming = isHttpIncoming;
16
17
  function isNodeOutgoingMessage(v) {
17
18
  return v && typeof v.getHeaders === 'function' && (0, common_1.isStream)(v);
18
19
  }
19
- exports.isNodeOutgoingMessage = isNodeOutgoingMessage;
20
20
  function isHttpOutgoing(v) {
21
21
  return isNodeOutgoingMessage(v) && typeof v.clearCookie === 'function' && typeof v.cookie === 'function';
22
22
  }
23
- exports.isHttpOutgoing = isHttpOutgoing;
@@ -145,7 +145,6 @@ export class BodyReader extends EventEmitter {
145
145
  message: 'request aborted',
146
146
  code: 'ECONNABORTED',
147
147
  details: {
148
- length,
149
148
  received: this._receivedSize,
150
149
  },
151
150
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/core",
3
- "version": "1.0.0-alpha.17",
3
+ "version": "1.0.0-alpha.19",
4
4
  "description": "Opra schema package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@browsery/http-parser": "^0.5.8",
35
35
  "@browsery/type-is": "^1.6.18-r2",
36
- "@opra/common": "^1.0.0-alpha.17",
36
+ "@opra/common": "^1.0.0-alpha.19",
37
37
  "@types/formidable": "^3.4.5",
38
38
  "accepts": "^1.3.8",
39
39
  "base64-stream": "^1.0.0",
@@ -2,8 +2,8 @@ import { HttpController, HttpMediaType, HttpOperation, OpraSchema } from '@opra/
2
2
  import { ExecutionContext } from '../execution-context.js';
3
3
  import type { HttpAdapter } from './http-adapter';
4
4
  import { MultipartReader } from './impl/multipart-reader.js';
5
- import type { HttpIncoming } from './interfaces/http-incoming.interface';
6
- import type { HttpOutgoing } from './interfaces/http-outgoing.interface';
5
+ import type { HttpIncoming } from './interfaces/http-incoming.interface.js';
6
+ import type { HttpOutgoing } from './interfaces/http-outgoing.interface.js';
7
7
  export declare namespace HttpContext {
8
8
  interface Initiator extends Omit<ExecutionContext.Initiator, 'document' | 'protocol'> {
9
9
  adapter: HttpAdapter;
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
2
1
  import parseRange from 'range-parser';
3
- import type { HttpIncoming } from '../interfaces/http-incoming.interface';
2
+ import type { HttpIncoming } from '../interfaces/http-incoming.interface.js';
4
3
  import { BodyReader } from '../utils/body-reader.js';
5
4
  export interface HttpIncomingHost extends HttpIncoming {
6
5
  }
@@ -1,4 +1,4 @@
1
- import type { CookieOptions, HttpOutgoing } from '../interfaces/http-outgoing.interface';
1
+ import type { CookieOptions, HttpOutgoing } from '../interfaces/http-outgoing.interface.js';
2
2
  export interface HttpOutgoingHost extends HttpOutgoing {
3
3
  }
4
4
  export declare class HttpOutgoingHost {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'events';
3
2
  import formidable from 'formidable';
4
3
  import type IncomingForm from 'formidable/Formidable.js';
@@ -1,11 +1,7 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
1
  import { HTTPParserJS } from '@browsery/http-parser';
6
2
  import { IncomingHttpHeaders } from 'http';
7
3
  import { Duplex, Readable } from 'stream';
8
- import type { NodeIncomingMessage } from '../interfaces/node-incoming-message.interface';
4
+ import type { NodeIncomingMessage } from '../interfaces/node-incoming-message.interface.js';
9
5
  export declare const CRLF: Buffer;
10
6
  export declare const kHeaders: unique symbol;
11
7
  export declare const kHeadersDistinct: unique symbol;
@@ -1,10 +1,7 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import { OutgoingHttpHeaders } from 'http';
5
2
  import { Duplex } from 'stream';
6
- import type { NodeIncomingMessage } from '../interfaces/node-incoming-message.interface';
7
- import type { NodeOutgoingMessage } from '../interfaces/node-outgoing-message.interface';
3
+ import type { NodeIncomingMessage } from '../interfaces/node-incoming-message.interface.js';
4
+ import type { NodeOutgoingMessage } from '../interfaces/node-outgoing-message.interface.js';
8
5
  export declare const kOutHeaders: unique symbol;
9
6
  export declare const kOutTrailers: unique symbol;
10
7
  declare global {
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
1
  import { Options as RangeParserOptions, Ranges as RangeParserRanges, Result as RangeParserResult } from 'range-parser';
3
2
  import { BodyReader } from '../utils/body-reader.js';
4
- import type { HttpOutgoing } from './http-outgoing.interface';
3
+ import type { HttpOutgoing } from './http-outgoing.interface.js';
5
4
  import { NodeIncomingMessage } from './node-incoming-message.interface.js';
6
5
  /**
7
6
  * @interface HttpIncoming
@@ -1,5 +1,5 @@
1
1
  import { StrictOmit } from 'ts-gems';
2
- import type { HttpIncoming } from './http-incoming.interface';
2
+ import type { HttpIncoming } from './http-incoming.interface.js';
3
3
  import { NodeOutgoingMessage } from './node-outgoing-message.interface.js';
4
4
  export interface HttpOutgoing extends StrictOmit<NodeOutgoingMessage, 'req' | 'appendHeader' | 'setHeader'> {
5
5
  req: HttpIncoming;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import http from 'http';
4
2
  import { Readable } from 'stream';
5
3
  /**
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import http, { OutgoingHttpHeaders } from 'http';
4
2
  import { Writable } from 'stream';
5
3
  import { NodeIncomingMessage } from './node-incoming-message.interface.js';
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import nodeStream from 'node:stream';
5
2
  import { EventEmitter } from 'events';
6
3
  import type { HttpIncoming } from '../interfaces/http-incoming.interface.js';
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  import { Readable } from 'stream';
3
2
  export declare function concatReadable(...streams: Readable[]): Readable;
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  import { IncomingHttpHeaders } from 'http';
3
2
  export declare function convertToRawHeaders(src: IncomingHttpHeaders | Record<string, any>): string[];
@@ -4,7 +4,7 @@ import { AsyncEventEmitter } from 'strict-typed-events';
4
4
  import { kAssetCache } from './constants.js';
5
5
  import { Logger } from './helpers/logger.js';
6
6
  import { AssetCache } from './http/impl/asset-cache.js';
7
- import type { ILogger } from './interfaces/logger.interface';
7
+ import type { ILogger } from './interfaces/logger.interface.js';
8
8
  /**
9
9
  * @namespace PlatformAdapter
10
10
  */