@opra/core 1.0.0-alpha.2 → 1.0.0-alpha.21

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.
Files changed (54) hide show
  1. package/cjs/augmentation/18n.augmentation.js +1 -1
  2. package/cjs/execution-context.js +0 -1
  3. package/cjs/http/express-adapter.js +6 -17
  4. package/cjs/http/http-context.js +6 -3
  5. package/cjs/http/impl/http-handler.js +73 -62
  6. package/cjs/http/impl/http-incoming.host.js +3 -3
  7. package/cjs/http/impl/http-outgoing.host.js +2 -2
  8. package/cjs/http/impl/multipart-reader.js +4 -10
  9. package/cjs/http/impl/node-incoming-message.host.js +5 -3
  10. package/cjs/http/interfaces/node-incoming-message.interface.js +3 -2
  11. package/cjs/http/utils/body-reader.js +6 -5
  12. package/cjs/http/utils/common.js +6 -5
  13. package/cjs/http/utils/concat-readable.js +1 -2
  14. package/cjs/http/utils/convert-to-headers.js +2 -3
  15. package/cjs/http/utils/convert-to-raw-headers.js +1 -2
  16. package/cjs/http/utils/match-known-fields.js +2 -2
  17. package/cjs/http/utils/wrap-exception.js +1 -2
  18. package/cjs/index.js +3 -3
  19. package/cjs/platform-adapter.js +1 -1
  20. package/cjs/type-guards.js +4 -5
  21. package/esm/augmentation/18n.augmentation.js +1 -1
  22. package/esm/execution-context.js +0 -1
  23. package/esm/http/express-adapter.js +6 -17
  24. package/esm/http/http-context.js +6 -3
  25. package/esm/http/impl/http-handler.js +73 -62
  26. package/esm/http/impl/http-incoming.host.js +3 -3
  27. package/esm/http/impl/http-outgoing.host.js +2 -2
  28. package/esm/http/impl/multipart-reader.js +4 -10
  29. package/esm/http/impl/node-incoming-message.host.js +5 -3
  30. package/esm/http/interfaces/node-incoming-message.interface.js +3 -2
  31. package/esm/http/utils/body-reader.js +6 -5
  32. package/esm/http/utils/common.js +2 -1
  33. package/esm/index.js +3 -3
  34. package/esm/platform-adapter.js +1 -1
  35. package/i18n/i18n/en/error.json +21 -0
  36. package/package.json +13 -7
  37. package/types/augmentation/18n.augmentation.d.ts +1 -1
  38. package/types/execution-context.d.ts +1 -3
  39. package/types/http/express-adapter.d.ts +1 -1
  40. package/types/http/http-context.d.ts +2 -2
  41. package/types/http/impl/http-incoming.host.d.ts +1 -2
  42. package/types/http/impl/http-outgoing.host.d.ts +1 -1
  43. package/types/http/impl/multipart-reader.d.ts +0 -1
  44. package/types/http/impl/node-incoming-message.host.d.ts +2 -6
  45. package/types/http/impl/node-outgoing-message.host.d.ts +2 -5
  46. package/types/http/interfaces/http-incoming.interface.d.ts +1 -2
  47. package/types/http/interfaces/http-outgoing.interface.d.ts +1 -1
  48. package/types/http/interfaces/node-incoming-message.interface.d.ts +0 -2
  49. package/types/http/interfaces/node-outgoing-message.interface.d.ts +0 -2
  50. package/types/http/utils/body-reader.d.ts +1 -4
  51. package/types/http/utils/concat-readable.d.ts +0 -1
  52. package/types/http/utils/convert-to-raw-headers.d.ts +0 -1
  53. package/types/index.d.ts +3 -3
  54. package/types/platform-adapter.d.ts +2 -2
@@ -2,10 +2,10 @@
2
2
  Some parts of this file contains codes from open source express library
3
3
  https://github.com/expressjs
4
4
  */
5
+ import typeIs from '@browsery/type-is';
5
6
  import accepts from 'accepts';
6
7
  import fresh from 'fresh';
7
8
  import parseRange from 'range-parser';
8
- import typeIs from '@browsery/type-is';
9
9
  import { BodyReader } from '../utils/body-reader.js';
10
10
  export class HttpIncomingHost {
11
11
  get protocol() {
@@ -37,11 +37,11 @@ export class HttpIncomingHost {
37
37
  get fresh() {
38
38
  const method = this.method;
39
39
  // GET or HEAD for weak freshness validation only
40
- if ('GET' !== method && 'HEAD' !== method)
40
+ if (method !== 'GET' && method !== 'HEAD')
41
41
  return false;
42
42
  const status = this.res?.statusCode;
43
43
  // 2xx or 304 as per rfc2616 14.26
44
- if ((status >= 200 && status < 300) || 304 === status) {
44
+ if ((status >= 200 && status < 300) || status === 304) {
45
45
  return fresh(this.headers, {
46
46
  etag: this.res.getHeader('ETag'),
47
47
  'last-modified': this.res.getHeader('Last-Modified'),
@@ -2,6 +2,7 @@
2
2
  Some parts of this file contains codes from open source express library
3
3
  https://github.com/expressjs
4
4
  */
5
+ import { HttpStatusCode } from '@opra/common';
5
6
  import contentDisposition from 'content-disposition';
6
7
  import contentType from 'content-type';
7
8
  import cookie from 'cookie';
@@ -11,7 +12,6 @@ import mime from 'mime-types';
11
12
  import path from 'path';
12
13
  import { toString } from 'putil-varhelpers';
13
14
  import vary from 'vary';
14
- import { HttpStatusCode } from '@opra/common';
15
15
  const charsetRegExp = /;\s*charset\s*=/;
16
16
  export class HttpOutgoingHost {
17
17
  attachment(filename) {
@@ -160,7 +160,7 @@ export class HttpOutgoingHost {
160
160
  if (req?.fresh)
161
161
  this.statusCode = 304;
162
162
  // strip irrelevant headers
163
- if (204 === this.statusCode || 304 === this.statusCode) {
163
+ if (this.statusCode === 204 || this.statusCode === 304) {
164
164
  this.removeHeader('Content-Type');
165
165
  this.removeHeader('Content-Length');
166
166
  this.removeHeader('Transfer-Encoding');
@@ -12,9 +12,7 @@ export class MultipartReader extends EventEmitter {
12
12
  this._incoming = incoming;
13
13
  const form = (this._form = formidable({
14
14
  ...options,
15
- filter: (part) => {
16
- return !this._cancelled && (!options?.filter || options.filter(part));
17
- },
15
+ filter: (part) => !this._cancelled && (!options?.filter || options.filter(part)),
18
16
  }));
19
17
  form.once('error', () => {
20
18
  this._cancelled = true;
@@ -69,7 +67,7 @@ export class MultipartReader extends EventEmitter {
69
67
  }
70
68
  resume() {
71
69
  if (!this._started)
72
- this._form.parse(this._incoming, () => void 0);
70
+ this._form.parse(this._incoming, () => undefined);
73
71
  if (this._form.req)
74
72
  this._form.resume();
75
73
  }
@@ -88,12 +86,8 @@ export class MultipartReader extends EventEmitter {
88
86
  return resolve();
89
87
  file._writeStream.once('close', resolve);
90
88
  })
91
- .then(() => {
92
- return fs.unlink(file.filepath);
93
- })
94
- .then(() => {
95
- return 0;
96
- }));
89
+ .then(() => fs.unlink(file.filepath))
90
+ .then(() => 0));
97
91
  });
98
92
  return Promise.allSettled(promises);
99
93
  }
@@ -1,5 +1,5 @@
1
- import { Duplex, Readable } from 'stream';
2
1
  import { isAsyncIterable, isIterable } from '@opra/common';
2
+ import { Duplex, Readable } from 'stream';
3
3
  import { convertToHeaders, convertToHeadersDistinct } from '../utils/convert-to-headers.js';
4
4
  import { convertToRawHeaders } from '../utils/convert-to-raw-headers.js';
5
5
  export const CRLF = Buffer.from('\r\n');
@@ -33,10 +33,12 @@ export class NodeIncomingMessageHost extends Duplex {
33
33
  else
34
34
  this.body = Buffer.from(JSON.stringify(init.body), 'utf-8');
35
35
  }
36
- if (init.headers)
36
+ if (init.headers) {
37
37
  this.rawHeaders = Array.isArray(init.headers) ? init.headers : convertToRawHeaders(init.headers);
38
- if (init.trailers)
38
+ }
39
+ if (init.trailers) {
39
40
  this.rawTrailers = Array.isArray(init.trailers) ? init.trailers : convertToRawHeaders(init.trailers);
41
+ }
40
42
  this.ip = init.ip || '';
41
43
  this.ips = init.ips || (this.ip ? [this.ip] : []);
42
44
  if (this.body && !this.headers['content-length'])
@@ -1,6 +1,6 @@
1
- import { Readable } from 'stream';
2
1
  import { HTTPParser } from '@browsery/http-parser';
3
2
  import { isAsyncIterable, isIterable } from '@opra/common';
3
+ import { Readable } from 'stream';
4
4
  import { CRLF, kHttpParser, NodeIncomingMessageHost } from '../impl/node-incoming-message.host.js';
5
5
  import { concatReadable } from '../utils/concat-readable.js';
6
6
  /**
@@ -14,8 +14,9 @@ export var NodeIncomingMessage;
14
14
  * @param iterable
15
15
  */
16
16
  function from(iterable) {
17
- if (typeof iterable === 'object' && !(isIterable(iterable) || isAsyncIterable(iterable)))
17
+ if (typeof iterable === 'object' && !(isIterable(iterable) || isAsyncIterable(iterable))) {
18
18
  return new NodeIncomingMessageHost(iterable);
19
+ }
19
20
  const msg = new NodeIncomingMessageHost();
20
21
  const parser = (msg[kHttpParser] = new HTTPParser(HTTPParser.REQUEST));
21
22
  let bodyChunks;
@@ -1,3 +1,5 @@
1
+ import typeIs from '@browsery/type-is';
2
+ import { BadRequestError, InternalServerError, OpraHttpError } from '@opra/common';
1
3
  import { Base64Decode } from 'base64-stream';
2
4
  import byteParser from 'bytes';
3
5
  import { parse as parseContentType } from 'content-type';
@@ -5,8 +7,6 @@ import { EventEmitter } from 'events';
5
7
  import iconv from 'iconv-lite';
6
8
  import { Writable } from 'stream';
7
9
  import * as zlib from 'zlib';
8
- import typeIs from '@browsery/type-is';
9
- import { BadRequestError, InternalServerError, OpraHttpError } from '@opra/common';
10
10
  /**
11
11
  *
12
12
  * @class BodyReader
@@ -29,11 +29,12 @@ export class BodyReader extends EventEmitter {
29
29
  }
30
30
  async read() {
31
31
  /* istanbul ignore next */
32
- if (this._completed)
32
+ if (this._completed) {
33
33
  throw new InternalServerError({
34
34
  message: 'Stream already read',
35
35
  code: 'STREAM_ALREADY_READ',
36
36
  });
37
+ }
37
38
  if (!this.req.readable) {
38
39
  throw new InternalServerError({
39
40
  message: 'Stream is not readable',
@@ -57,8 +58,9 @@ export class BodyReader extends EventEmitter {
57
58
  * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3
58
59
  */
59
60
  const contentLength = parseInt(this.req.headers['content-length'] || '0', 10);
60
- if (this.req.headers['transfer-encoding'] === undefined && !(contentLength && !isNaN(contentLength)))
61
+ if (this.req.headers['transfer-encoding'] === undefined && !(contentLength && !isNaN(contentLength))) {
61
62
  return this.onEnd();
63
+ }
62
64
  // check the length and limit options.
63
65
  // note: we intentionally leave the stream paused,
64
66
  // so users should handle the stream themselves.
@@ -143,7 +145,6 @@ export class BodyReader extends EventEmitter {
143
145
  message: 'request aborted',
144
146
  code: 'ECONNABORTED',
145
147
  details: {
146
- length,
147
148
  received: this._receivedSize,
148
149
  },
149
150
  }));
@@ -55,6 +55,7 @@ export const validateHeaderValue = hideStackFrames((name, value) => {
55
55
  }
56
56
  });
57
57
  export function validateString(value, name) {
58
- if (typeof value !== 'string')
58
+ if (typeof value !== 'string') {
59
59
  throw new TypeError(`Invalid ${name ? name + ' ' : ''}argument. Value must be a string`);
60
+ }
60
61
  }
package/esm/index.js CHANGED
@@ -6,20 +6,20 @@ import * as HttpOutgoingHost_ from './http/impl/http-outgoing.host.js';
6
6
  import * as NodeIncomingMessageHost_ from './http/impl/node-incoming-message.host.js';
7
7
  import * as NodeOutgoingMessageHost_ from './http/impl/node-outgoing-message.host.js';
8
8
  export * from './execution-context.js';
9
- export * from './platform-adapter.js';
10
- export * from './type-guards.js';
11
9
  export * from './helpers/logger.js';
12
10
  export * from './helpers/service-base.js';
13
11
  export * from './http/express-adapter.js';
14
12
  export * from './http/http-adapter.js';
15
13
  export * from './http/http-context.js';
14
+ export * from './http/impl/multipart-reader.js';
16
15
  export * from './http/interfaces/http-incoming.interface.js';
17
16
  export * from './http/interfaces/http-outgoing.interface.js';
18
17
  export * from './http/interfaces/node-incoming-message.interface.js';
19
18
  export * from './http/interfaces/node-outgoing-message.interface.js';
20
- export * from './http/impl/multipart-reader.js';
21
19
  export * from './http/utils/wrap-exception.js';
22
20
  export * from './interfaces/logger.interface.js';
21
+ export * from './platform-adapter.js';
22
+ export * from './type-guards.js';
23
23
  export var classes;
24
24
  (function (classes) {
25
25
  classes.HttpIncomingHost = HttpIncomingHost_.HttpIncomingHost;
@@ -1,6 +1,6 @@
1
1
  import './augmentation/18n.augmentation.js';
2
- import { AsyncEventEmitter } from 'strict-typed-events';
3
2
  import { I18n } from '@opra/common';
3
+ 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';
@@ -0,0 +1,21 @@
1
+ {
2
+ "BAD_REQUEST": "Bad request",
3
+ "FAILED_DEPENDENCY": "The request failed due to failure of a previous request",
4
+ "FORBIDDEN": "You are not authorized to perform this action",
5
+ "INTERNAL_SERVER_ERROR": "Internal server error",
6
+ "METHOD_NOT_ALLOWED": "Method not allowed",
7
+ "NOT_ACCEPTABLE": "Not acceptable",
8
+ "NOT_FOUND": "Not found",
9
+ "UNAUTHORIZED": "You have not been authenticated to perform this action",
10
+ "UNPROCESSABLE_ENTITY": "Unprocessable entity",
11
+ "REQUEST_VALIDATION": "Request validation failed",
12
+ "RESPONSE_VALIDATION": "Response validation failed",
13
+ "RESOURCE_NOT_AVAILABLE": "Resource is not available or you dont have access",
14
+ "RESOURCE_CONFLICT": "There is already an other {{resource}} resource with same field values ({{fields}})",
15
+ "OPERATION_FORBIDDEN": "The {{resource}} resource does not accept '{{operation}}' operations",
16
+ "ACTION_NOT_FOUND": "The {{resource}} resource doesn't have an action named '{{action}}'",
17
+ "UNKNOWN_FIELD": "Unknown field '{{field}}'",
18
+ "UNACCEPTED_SORT_FIELD": "Field '{{field}}' is not available for sort operation",
19
+ "UNACCEPTED_FILTER_FIELD": "Field '{{field}}' is not available for filter operation",
20
+ "UNACCEPTED_FILTER_OPERATION": "'{{operation}}' for field '{{field}}' is not available for filter operation"
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/core",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.21",
4
4
  "description": "Opra schema package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -19,10 +19,11 @@
19
19
  "_copy_pkg_files": "cp README.md package.json ../../LICENSE ../../build/core && cp ../../package.cjs.json ../../build/core/cjs/package.json",
20
20
  "_copyi18n": "cp -R i18n ../../build/core/i18n",
21
21
  "lint": "eslint . --max-warnings=0",
22
- "check": "madge --circular src/**",
22
+ "lint:fix": "eslint . --max-warnings=0 --fix",
23
23
  "format": "prettier . --write --log-level=warn",
24
- "test": "jest",
25
- "cover": "jest --collect-coverage",
24
+ "check": "madge --circular src/**",
25
+ "test": "jest --passWithNoTests",
26
+ "cover": "jest --passWithNoTests --collect-coverage",
26
27
  "clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
27
28
  "clean:src": "ts-cleanup -s src --all",
28
29
  "clean:test": "ts-cleanup -s test --all",
@@ -30,8 +31,9 @@
30
31
  "clean:cover": "rimraf ../../coverage/client"
31
32
  },
32
33
  "dependencies": {
34
+ "@browsery/http-parser": "^0.5.8",
33
35
  "@browsery/type-is": "^1.6.18-r2",
34
- "@opra/common": "^1.0.0-alpha.2",
36
+ "@opra/common": "^1.0.0-alpha.21",
35
37
  "@types/formidable": "^3.4.5",
36
38
  "accepts": "^1.3.8",
37
39
  "base64-stream": "^1.0.0",
@@ -44,12 +46,15 @@
44
46
  "encodeurl": "^2.0.0",
45
47
  "formidable": "^3.5.1",
46
48
  "fresh": "^0.5.2",
49
+ "iconv-lite": "^0.6.3",
47
50
  "mime-types": "^2.1.35",
48
- "power-tasks": "^1.7.3",
51
+ "power-tasks": "^1.7.4",
49
52
  "putil-isplainobject": "^1.1.5",
53
+ "putil-merge": "^3.12.1",
50
54
  "putil-varhelpers": "^1.6.5",
51
55
  "range-parser": "^1.2.1",
52
56
  "raw-body": "^2.5.2",
57
+ "reflect-metadata": "^0.2.2",
53
58
  "strict-typed-events": "^2.3.3",
54
59
  "vary": "^1.1.2"
55
60
  },
@@ -76,8 +81,9 @@
76
81
  "cookie-parser": "^1.4.6",
77
82
  "crypto-browserify": "^3.12.0",
78
83
  "express": "^4.19.2",
79
- "fastify": "^4.27.0",
84
+ "fastify": "^4.28.1",
80
85
  "path-browserify": "^1.0.1",
86
+ "supertest": "^7.0.0",
81
87
  "ts-gems": "^3.4.0"
82
88
  },
83
89
  "type": "module",
@@ -1,4 +1,3 @@
1
- import { FallbackLng, LanguageResource } from '@opra/common';
2
1
  declare module '@opra/common' {
3
2
  interface I18n {
4
3
  loadResourceDir(dirnames: string | string[], deep?: boolean, overwrite?: boolean): Promise<void>;
@@ -35,3 +34,4 @@ declare module '@opra/common' {
35
34
  }
36
35
  }
37
36
  }
37
+ export {};
@@ -1,5 +1,5 @@
1
- import { AsyncEventEmitter } from 'strict-typed-events';
2
1
  import { ApiDocument, OpraSchema } from '@opra/common';
2
+ import { AsyncEventEmitter } from 'strict-typed-events';
3
3
  /**
4
4
  * @namespace ExecutionContext
5
5
  */
@@ -8,7 +8,6 @@ export declare namespace ExecutionContext {
8
8
  document: ApiDocument;
9
9
  protocol: OpraSchema.Protocol;
10
10
  platform: string;
11
- platformArgs: any;
12
11
  }
13
12
  type OnFinishListener = (error: Error | undefined, context: ExecutionContext) => void | Promise<void>;
14
13
  }
@@ -19,7 +18,6 @@ export declare abstract class ExecutionContext extends AsyncEventEmitter {
19
18
  readonly document: ApiDocument;
20
19
  readonly protocol: OpraSchema.Protocol;
21
20
  readonly platform: string;
22
- readonly platformArgs: any;
23
21
  protected constructor(init: ExecutionContext.Initiator);
24
22
  addListener(event: 'finish', listener: ExecutionContext.OnFinishListener): this;
25
23
  removeListener(event: 'finish', listener: ExecutionContext.OnFinishListener): this;
@@ -1,5 +1,5 @@
1
- import { Application } from 'express';
2
1
  import { ApiDocument, HttpController } from '@opra/common';
2
+ import { Application } from 'express';
3
3
  import { HttpAdapter } from './http-adapter.js';
4
4
  export declare class ExpressAdapter extends HttpAdapter {
5
5
  readonly app: Application;
@@ -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" />
1
+ import { HTTPParserJS } from '@browsery/http-parser';
5
2
  import { IncomingHttpHeaders } from 'http';
6
3
  import { Duplex, Readable } from 'stream';
7
- import { HTTPParserJS } from '@browsery/http-parser';
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,8 +1,5 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import { EventEmitter } from 'events';
5
1
  import nodeStream from 'node:stream';
2
+ import { EventEmitter } from 'events';
6
3
  import type { HttpIncoming } from '../interfaces/http-incoming.interface.js';
7
4
  /**
8
5
  *
@@ -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[];
package/types/index.d.ts CHANGED
@@ -6,20 +6,20 @@ import * as HttpOutgoingHost_ from './http/impl/http-outgoing.host.js';
6
6
  import * as NodeIncomingMessageHost_ from './http/impl/node-incoming-message.host.js';
7
7
  import * as NodeOutgoingMessageHost_ from './http/impl/node-outgoing-message.host.js';
8
8
  export * from './execution-context.js';
9
- export * from './platform-adapter.js';
10
- export * from './type-guards.js';
11
9
  export * from './helpers/logger.js';
12
10
  export * from './helpers/service-base.js';
13
11
  export * from './http/express-adapter.js';
14
12
  export * from './http/http-adapter.js';
15
13
  export * from './http/http-context.js';
14
+ export * from './http/impl/multipart-reader.js';
16
15
  export * from './http/interfaces/http-incoming.interface.js';
17
16
  export * from './http/interfaces/http-outgoing.interface.js';
18
17
  export * from './http/interfaces/node-incoming-message.interface.js';
19
18
  export * from './http/interfaces/node-outgoing-message.interface.js';
20
- export * from './http/impl/multipart-reader.js';
21
19
  export * from './http/utils/wrap-exception.js';
22
20
  export * from './interfaces/logger.interface.js';
21
+ export * from './platform-adapter.js';
22
+ export * from './type-guards.js';
23
23
  export declare namespace classes {
24
24
  export import HttpIncomingHost = HttpIncomingHost_.HttpIncomingHost;
25
25
  export import HttpOutgoingHost = HttpOutgoingHost_.HttpOutgoingHost;
@@ -1,10 +1,10 @@
1
1
  import './augmentation/18n.augmentation.js';
2
- import { AsyncEventEmitter } from 'strict-typed-events';
3
2
  import { ApiDocument, I18n, OpraSchema } from '@opra/common';
3
+ 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
  */