@opra/core 0.29.1 → 0.30.1

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.
@@ -90,8 +90,8 @@ class HttpAdapterHost extends platform_adapter_host_js_1.PlatformAdapterHost {
90
90
  throw e;
91
91
  if (e instanceof vg.ValidationError) {
92
92
  throw new common_1.BadRequestError({
93
- message: (0, common_1.translate)('error:RESPONSE_VALIDATION,'),
94
- code: 'RESPONSE_VALIDATION',
93
+ message: e.issues.length === 1 ? e.message : (0, common_1.translate)('error:REQUEST_VALIDATION,'),
94
+ code: 'REQUEST_VALIDATION',
95
95
  details: e.issues
96
96
  }, e);
97
97
  }
@@ -164,7 +164,7 @@ class HttpAdapterHost extends platform_adapter_host_js_1.PlatformAdapterHost {
164
164
  }
165
165
  if (request)
166
166
  return request;
167
- const path = urlPath.toString();
167
+ const path = parsedUrl.path.toString();
168
168
  throw new common_1.BadRequestError({
169
169
  message: 'No resource or endpoint found at ' + path,
170
170
  details: { path }
@@ -4,7 +4,7 @@ exports.ApiService = void 0;
4
4
  class ApiService {
5
5
  get context() {
6
6
  if (!this._context)
7
- throw new Error(`No context assigned for ${Object.getPrototypeOf(this).name}`);
7
+ throw new Error(`No context assigned for ${Object.getPrototypeOf(this).constructor.name}`);
8
8
  return this._context;
9
9
  }
10
10
  forContext(context) {
@@ -86,8 +86,8 @@ export class HttpAdapterHost extends PlatformAdapterHost {
86
86
  throw e;
87
87
  if (e instanceof vg.ValidationError) {
88
88
  throw new BadRequestError({
89
- message: translate('error:RESPONSE_VALIDATION,'),
90
- code: 'RESPONSE_VALIDATION',
89
+ message: e.issues.length === 1 ? e.message : translate('error:REQUEST_VALIDATION,'),
90
+ code: 'REQUEST_VALIDATION',
91
91
  details: e.issues
92
92
  }, e);
93
93
  }
@@ -160,7 +160,7 @@ export class HttpAdapterHost extends PlatformAdapterHost {
160
160
  }
161
161
  if (request)
162
162
  return request;
163
- const path = urlPath.toString();
163
+ const path = parsedUrl.path.toString();
164
164
  throw new BadRequestError({
165
165
  message: 'No resource or endpoint found at ' + path,
166
166
  details: { path }
@@ -1,7 +1,7 @@
1
1
  export class ApiService {
2
2
  get context() {
3
3
  if (!this._context)
4
- throw new Error(`No context assigned for ${Object.getPrototypeOf(this).name}`);
4
+ throw new Error(`No context assigned for ${Object.getPrototypeOf(this).constructor.name}`);
5
5
  return this._context;
6
6
  }
7
7
  forContext(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/core",
3
- "version": "0.29.1",
3
+ "version": "0.30.1",
4
4
  "description": "Opra schema package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@browsery/type-is": "^0.6.3",
31
- "@opra/common": "^0.29.1",
31
+ "@opra/common": "^0.30.1",
32
32
  "accepts": "^1.3.8",
33
33
  "content-disposition": "^0.5.4",
34
34
  "content-type": "^1.0.5",
@@ -2,5 +2,5 @@ import { RequestContext } from '../request-context.js';
2
2
  export declare abstract class ApiService {
3
3
  protected _context: RequestContext;
4
4
  get context(): RequestContext;
5
- forContext(context: RequestContext): typeof this;
5
+ forContext(context: RequestContext): this;
6
6
  }