@opra/core 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (36) 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 +70 -61
  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 -4
  12. package/cjs/http/utils/common.js +2 -1
  13. package/cjs/index.js +3 -3
  14. package/cjs/platform-adapter.js +1 -1
  15. package/esm/augmentation/18n.augmentation.js +1 -1
  16. package/esm/execution-context.js +0 -1
  17. package/esm/http/express-adapter.js +6 -17
  18. package/esm/http/http-context.js +6 -3
  19. package/esm/http/impl/http-handler.js +70 -61
  20. package/esm/http/impl/http-incoming.host.js +3 -3
  21. package/esm/http/impl/http-outgoing.host.js +2 -2
  22. package/esm/http/impl/multipart-reader.js +4 -10
  23. package/esm/http/impl/node-incoming-message.host.js +5 -3
  24. package/esm/http/interfaces/node-incoming-message.interface.js +3 -2
  25. package/esm/http/utils/body-reader.js +6 -4
  26. package/esm/http/utils/common.js +2 -1
  27. package/esm/index.js +3 -3
  28. package/esm/platform-adapter.js +1 -1
  29. package/package.json +13 -7
  30. package/types/augmentation/18n.augmentation.d.ts +1 -1
  31. package/types/execution-context.d.ts +1 -3
  32. package/types/http/express-adapter.d.ts +1 -1
  33. package/types/http/impl/node-incoming-message.host.d.ts +1 -1
  34. package/types/http/utils/body-reader.d.ts +1 -1
  35. package/types/index.d.ts +3 -3
  36. package/types/platform-adapter.d.ts +1 -1
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/core",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.11",
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": "^0.33.13",
36
+ "@opra/common": "^1.0.0-alpha.11",
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,9 +2,9 @@
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
+ import { HTTPParserJS } from '@browsery/http-parser';
5
6
  import { IncomingHttpHeaders } from 'http';
6
7
  import { Duplex, Readable } from 'stream';
7
- import { HTTPParserJS } from '@browsery/http-parser';
8
8
  import type { NodeIncomingMessage } from '../interfaces/node-incoming-message.interface';
9
9
  export declare const CRLF: Buffer;
10
10
  export declare const kHeaders: unique symbol;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
- import { EventEmitter } from 'events';
5
4
  import nodeStream from 'node:stream';
5
+ import { EventEmitter } from 'events';
6
6
  import type { HttpIncoming } from '../interfaces/http-incoming.interface.js';
7
7
  /**
8
8
  *
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,6 +1,6 @@
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';