@opra/common 0.23.0 → 0.23.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.
Files changed (52) hide show
  1. package/browser.js +89 -84
  2. package/cjs/document/data-type/union-type.js +1 -1
  3. package/cjs/document/utils/generate-codec.js +1 -1
  4. package/cjs/exception/http-errors/bad-request.error.js +2 -3
  5. package/cjs/exception/http-errors/failed-dependency.error.js +2 -3
  6. package/cjs/exception/http-errors/forbidden.error.js +2 -3
  7. package/cjs/exception/http-errors/internal-server.error.js +2 -3
  8. package/cjs/exception/http-errors/method-not-allowed.error.js +2 -3
  9. package/cjs/exception/http-errors/not-acceptable.error.js +2 -3
  10. package/cjs/exception/http-errors/not-found.error.js +2 -3
  11. package/cjs/exception/http-errors/unauthorized.error.js +2 -3
  12. package/cjs/exception/http-errors/unprocessable-entity.error.js +2 -2
  13. package/cjs/exception/opra-exception.js +48 -33
  14. package/cjs/exception/resource-errors/resource-not-found.error.js +1 -2
  15. package/cjs/exception/wrap-exception.js +16 -16
  16. package/cjs/helpers/is-url-string.js +1 -2
  17. package/esm/document/data-type/union-type.js +1 -1
  18. package/esm/document/utils/generate-codec.js +1 -1
  19. package/esm/exception/http-errors/bad-request.error.js +2 -3
  20. package/esm/exception/http-errors/failed-dependency.error.js +2 -3
  21. package/esm/exception/http-errors/forbidden.error.js +2 -3
  22. package/esm/exception/http-errors/internal-server.error.js +2 -3
  23. package/esm/exception/http-errors/method-not-allowed.error.js +2 -3
  24. package/esm/exception/http-errors/not-acceptable.error.js +2 -3
  25. package/esm/exception/http-errors/not-found.error.js +2 -3
  26. package/esm/exception/http-errors/unauthorized.error.js +2 -3
  27. package/esm/exception/http-errors/unprocessable-entity.error.js +2 -2
  28. package/esm/exception/opra-exception.js +47 -32
  29. package/esm/exception/resource-errors/resource-not-found.error.js +1 -2
  30. package/esm/exception/wrap-exception.js +16 -16
  31. package/esm/helpers/is-url-string.js +0 -1
  32. package/package.json +5 -5
  33. package/types/document/data-type/complex-type.d.ts +1 -1
  34. package/types/document/data-type/mapped-type.d.ts +1 -1
  35. package/types/document/data-type/union-type.d.ts +2 -1
  36. package/types/document/resource/resource.d.ts +1 -1
  37. package/types/exception/error-issue.d.ts +2 -1
  38. package/types/exception/http-errors/bad-request.error.d.ts +2 -1
  39. package/types/exception/http-errors/failed-dependency.error.d.ts +2 -1
  40. package/types/exception/http-errors/forbidden.error.d.ts +2 -1
  41. package/types/exception/http-errors/internal-server.error.d.ts +2 -1
  42. package/types/exception/http-errors/method-not-allowed.error.d.ts +2 -1
  43. package/types/exception/http-errors/not-acceptable.error.d.ts +2 -1
  44. package/types/exception/http-errors/not-found.error.d.ts +2 -1
  45. package/types/exception/http-errors/unauthorized.error.d.ts +2 -1
  46. package/types/exception/http-errors/unprocessable-entity.error.d.ts +2 -1
  47. package/types/exception/opra-exception.d.ts +13 -8
  48. package/types/exception/wrap-exception.d.ts +1 -1
  49. package/types/helpers/object-utils.d.ts +1 -1
  50. package/types/schema/data-type/complex-type.interface.d.ts +1 -1
  51. package/types/schema/resource/resource.interface.d.ts +0 -1
  52. package/types/schema/resource/storage.interface.d.ts +1 -1
@@ -26,7 +26,7 @@ export function _generateDecoder(type, codec, options) {
26
26
  }
27
27
  return vg.isObject(schema, {
28
28
  ctor: type.ctor,
29
- additionalFields: type.additionalFields ?? 'ignore',
29
+ additionalFields: type.additionalFields ?? false,
30
30
  name: type.name,
31
31
  caseInSensitive: true,
32
32
  });
@@ -10,10 +10,9 @@ export class BadRequestError extends OpraException {
10
10
  super(...arguments);
11
11
  this.status = 400;
12
12
  }
13
- setIssue(issue) {
14
- super.setIssue({
13
+ init(issue) {
14
+ super.init({
15
15
  message: translate('error:BAD_REQUEST', 'Bad request'),
16
- severity: 'error',
17
16
  code: 'BAD_REQUEST',
18
17
  ...issue
19
18
  });
@@ -9,10 +9,9 @@ export class FailedDependencyError extends OpraException {
9
9
  super(...arguments);
10
10
  this.status = 424;
11
11
  }
12
- setIssue(issue) {
13
- super.setIssue({
12
+ init(issue) {
13
+ super.init({
14
14
  message: translate('error:FAILED_DEPENDENCY', 'The request failed due to failure of a previous request'),
15
- severity: 'error',
16
15
  code: 'FAILED_DEPENDENCY',
17
16
  ...issue
18
17
  });
@@ -11,10 +11,9 @@ export class ForbiddenError extends OpraException {
11
11
  super(...arguments);
12
12
  this.status = 403;
13
13
  }
14
- setIssue(issue) {
15
- super.setIssue({
14
+ init(issue) {
15
+ super.init({
16
16
  message: translate('error:FORBIDDEN', 'You are not authorized to perform this action'),
17
- severity: 'error',
18
17
  code: 'FORBIDDEN',
19
18
  ...issue
20
19
  });
@@ -9,10 +9,9 @@ export class InternalServerError extends OpraException {
9
9
  super(...arguments);
10
10
  this.status = 500;
11
11
  }
12
- setIssue(issue) {
13
- super.setIssue({
12
+ init(issue) {
13
+ super.init({
14
14
  message: translate('error:INTERNAL_SERVER_ERROR', 'Internal server error'),
15
- severity: 'error',
16
15
  code: 'INTERNAL_SERVER_ERROR',
17
16
  ...issue
18
17
  });
@@ -10,10 +10,9 @@ export class MethodNotAllowedError extends OpraException {
10
10
  super(...arguments);
11
11
  this.status = 405;
12
12
  }
13
- setIssue(issue) {
14
- super.setIssue({
13
+ init(issue) {
14
+ super.init({
15
15
  message: translate('error:METHOD_NOT_ALLOWED', 'Method not allowed'),
16
- severity: 'error',
17
16
  code: 'METHOD_NOT_ALLOWED',
18
17
  ...issue
19
18
  });
@@ -10,10 +10,9 @@ export class NotAcceptableError extends OpraException {
10
10
  super(...arguments);
11
11
  this.status = 406;
12
12
  }
13
- setIssue(issue) {
14
- super.setIssue({
13
+ init(issue) {
14
+ super.init({
15
15
  message: translate('error:NOT_ACCEPTABLE', 'Not Acceptable'),
16
- severity: 'error',
17
16
  code: 'NOT_ACCEPTABLE',
18
17
  ...issue
19
18
  });
@@ -13,10 +13,9 @@ export class NotFoundError extends OpraException {
13
13
  super(...arguments);
14
14
  this.status = 404;
15
15
  }
16
- setIssue(issue) {
17
- super.setIssue({
16
+ init(issue) {
17
+ super.init({
18
18
  message: translate('error:NOT_FOUND', 'Not found'),
19
- severity: 'error',
20
19
  code: 'NOT_FOUND',
21
20
  ...issue
22
21
  });
@@ -10,10 +10,9 @@ export class UnauthorizedError extends OpraException {
10
10
  super(...arguments);
11
11
  this.status = 401;
12
12
  }
13
- setIssue(issue) {
14
- super.setIssue({
13
+ init(issue) {
14
+ super.init({
15
15
  message: translate('error:UNAUTHORIZED', 'You have not been authenticated to perform this action'),
16
- severity: 'error',
17
16
  code: 'UNAUTHORIZED',
18
17
  ...issue
19
18
  });
@@ -9,8 +9,8 @@ export class UnprocessableEntityError extends OpraException {
9
9
  super(...arguments);
10
10
  this.status = 422;
11
11
  }
12
- setIssue(issue) {
13
- super.setIssue({
12
+ init(issue) {
13
+ super.init({
14
14
  message: translate('error:UNPROCESSABLE_ENTITY', 'Unprocessable entity'),
15
15
  severity: 'error',
16
16
  code: 'UNPROCESSABLE_ENTITY',
@@ -1,52 +1,67 @@
1
+ import { omitUndefined } from '../helpers/index.js';
1
2
  import { i18n } from '../i18n/index.js';
3
+ const inDevelopment = (process.env.NODE_ENV || '').startsWith('dev');
2
4
  /**
3
5
  * Defines the base Opra exception, which is handled by the default Exceptions Handler.
4
6
  */
5
7
  export class OpraException extends Error {
6
- constructor(issue, cause) {
7
- super('');
8
+ constructor(issue, arg1, arg2) {
9
+ super('Unknown error');
8
10
  this.status = 500;
9
- this._initName();
11
+ let cause = arg1 && arg1 instanceof Error ? arg1 : undefined;
12
+ this.status = (typeof arg1 === 'number' ? arg1 : Number(arg2)) || 500;
10
13
  if (issue instanceof Error)
11
14
  cause = issue;
12
- if (cause) {
15
+ // noinspection SuspiciousTypeOfGuard
16
+ if (cause && cause instanceof Error) {
13
17
  this.cause = cause;
14
18
  if (cause.stack)
15
19
  this.stack = cause.stack;
16
20
  }
17
- this._init(issue || cause || 'Unknown error');
18
- this.message = i18n.deep(this.issue.message);
19
- }
20
- get issue() {
21
- return this._issue;
22
- }
23
- setIssue(issue) {
24
- this._issue = {
25
- message: 'Unknown error',
26
- severity: 'error',
27
- ...issue,
28
- };
21
+ if (typeof issue === 'string')
22
+ this.initString(issue);
23
+ else if (issue instanceof Error)
24
+ this.initError(issue);
25
+ else if (issue && typeof issue === 'object')
26
+ this.init(issue);
27
+ this.message = this.message || this.constructor.name;
29
28
  }
30
29
  setStatus(status) {
31
30
  this.status = status;
32
31
  return this;
33
32
  }
34
- _initName() {
35
- this.name = this.constructor.name;
33
+ toString() {
34
+ return i18n.deep(this.message);
36
35
  }
37
- _init(issue) {
38
- if (issue instanceof Error) {
39
- if (typeof issue.status === 'number')
40
- this.status = issue.status;
41
- else if (typeof issue.getStatus === 'function')
42
- this.status = issue.getStatus();
43
- this.setIssue({ message: issue.message });
44
- }
45
- else if (typeof issue === 'object') {
46
- this.setIssue(issue);
47
- }
48
- else {
49
- this.setIssue({ message: String(issue) });
50
- }
36
+ toJSON() {
37
+ return omitUndefined({
38
+ message: this.message,
39
+ severity: this.severity,
40
+ system: this.system,
41
+ code: this.code,
42
+ details: this.details,
43
+ stack: inDevelopment ? this.stack?.split('\n') : undefined
44
+ }, true);
45
+ }
46
+ init(issue) {
47
+ this.message = issue.message || this.constructor.name;
48
+ this.severity = issue.severity || 'error';
49
+ this.system = issue.system;
50
+ this.code = issue.code;
51
+ this.details = issue.details;
52
+ }
53
+ initString(issue) {
54
+ this.message = String(issue || '') || this.constructor.name;
55
+ this.severity = 'error';
56
+ this.code = this.constructor.name;
57
+ }
58
+ initError(issue) {
59
+ if (typeof issue.status === 'number')
60
+ this.status = issue.status;
61
+ else if (typeof issue.getStatus === 'function')
62
+ this.status = issue.getStatus();
63
+ this.message = issue.message;
64
+ this.severity = issue.severity || 'error';
65
+ this.code = issue.code || (issue.constructor.name);
51
66
  }
52
67
  }
@@ -14,7 +14,6 @@ export class ResourceNotFoundError extends OpraException {
14
14
  resource,
15
15
  key: keyValue
16
16
  }
17
- }, cause);
18
- this.status = 404;
17
+ }, cause, 404);
19
18
  }
20
19
  }
@@ -7,32 +7,32 @@ import { NotFoundError } from './http-errors/not-found.error.js';
7
7
  import { UnauthorizedError } from './http-errors/unauthorized.error.js';
8
8
  import { UnprocessableEntityError } from './http-errors/unprocessable-entity.error.js';
9
9
  import { OpraException } from './opra-exception.js';
10
- export function wrapException(e) {
11
- if (e instanceof OpraException)
12
- return e;
10
+ export function wrapException(error) {
11
+ if (error instanceof OpraException)
12
+ return error;
13
13
  let status = 500;
14
- if (typeof e.status === 'number')
15
- status = e.status;
16
- else if (typeof e.getStatus === 'function')
17
- status = e.getStatus();
14
+ if (typeof error.status === 'number')
15
+ status = error.status;
16
+ else if (typeof error.getStatus === 'function')
17
+ status = error.getStatus();
18
18
  switch (status) {
19
19
  case 400:
20
- return new BadRequestError(e);
20
+ return new BadRequestError(error);
21
21
  case 401:
22
- return new UnauthorizedError(e);
22
+ return new UnauthorizedError(error);
23
23
  case 403:
24
- return new ForbiddenError(e);
24
+ return new ForbiddenError(error);
25
25
  case 404:
26
- return new NotFoundError(e);
26
+ return new NotFoundError(error);
27
27
  case 405:
28
- return new MethodNotAllowedError(e);
28
+ return new MethodNotAllowedError(error);
29
29
  case 406:
30
- return new NotAcceptableError(e);
30
+ return new NotAcceptableError(error);
31
31
  case 422:
32
- return new UnprocessableEntityError(e);
32
+ return new UnprocessableEntityError(error);
33
33
  case 424:
34
- return new FailedDependencyError(e);
34
+ return new FailedDependencyError(error);
35
35
  default:
36
- return new FailedDependencyError(e);
36
+ return new FailedDependencyError(error);
37
37
  }
38
38
  }
@@ -1,4 +1,3 @@
1
- import { URL } from 'url';
2
1
  const URL_PATTERN = /^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/i;
3
2
  export function isUrlString(url) {
4
3
  return URL_PATTERN.test(url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -49,20 +49,20 @@
49
49
  "lodash.omit": "^4.5.0",
50
50
  "putil-isplainobject": "^1.1.5",
51
51
  "putil-merge": "^3.10.3",
52
- "putil-promisify": "^1.10.0",
52
+ "putil-promisify": "^1.10.1",
53
53
  "putil-varhelpers": "^1.6.5",
54
54
  "reflect-metadata": "^0.1.13",
55
55
  "uid": "^2.0.1",
56
- "valgen": "^4.0.0-alpha.6"
56
+ "valgen": "^4.0.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@browsery/fs": "^0.4.0",
60
60
  "@browsery/stream": "^0.5.0",
61
61
  "@browsery/util": "^0.4.0",
62
62
  "@types/encodeurl": "^1.0.0",
63
- "@types/validator": "^13.7.17",
63
+ "@types/validator": "^13.11.1",
64
64
  "path-browserify": "^1.0.1",
65
- "ts-gems": "^2.4.0"
65
+ "ts-gems": "^2.4.1"
66
66
  },
67
67
  "engines": {
68
68
  "node": ">=16.0",
@@ -37,7 +37,7 @@ declare class ComplexTypeClass extends DataType {
37
37
  readonly own: ComplexType.OwnProperties;
38
38
  readonly fields: ResponsiveMap<ApiField>;
39
39
  readonly abstract?: boolean;
40
- readonly additionalFields?: boolean | vg.Validator<any, any> | 'ignore';
40
+ readonly additionalFields?: boolean | vg.Validator | 'error';
41
41
  constructor(document: ApiDocument, init: ComplexType.InitArguments);
42
42
  addField(init: ApiField.InitArguments): ApiField;
43
43
  findField(nameOrPath: string): ApiField | undefined;
@@ -29,7 +29,7 @@ declare class MappedTypeClass extends DataType {
29
29
  readonly kind = "MappedType";
30
30
  readonly own: MappedType.OwnProperties;
31
31
  readonly type: ComplexType;
32
- readonly additionalFields?: boolean | vg.Validator<any, any> | 'ignore';
32
+ readonly additionalFields?: boolean | vg.Validator | 'error';
33
33
  readonly fields: ResponsiveMap<ApiField>;
34
34
  readonly omit?: Field.Name[];
35
35
  readonly pick?: Field.Name[];
@@ -1,5 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  import { Class, StrictOmit, Type } from 'ts-gems';
3
+ import * as vg from 'valgen';
3
4
  import { ResponsiveMap } from '../../helpers/index.js';
4
5
  import { OpraSchema } from '../../schema/index.js';
5
6
  import type { ApiDocument } from '../api-document.js';
@@ -25,7 +26,7 @@ declare class UnionTypeClass extends DataType {
25
26
  readonly kind = "UnionType";
26
27
  readonly own: UnionType.OwnProperties;
27
28
  readonly types: (ComplexType | UnionType | MappedType)[];
28
- readonly additionalFields?: boolean;
29
+ readonly additionalFields?: boolean | vg.Validator | 'error';
29
30
  readonly fields: ResponsiveMap<ApiField>;
30
31
  constructor(document: ApiDocument, init: UnionType.InitArguments);
31
32
  exportSchema(): OpraSchema.UnionType;
@@ -3,7 +3,7 @@ import { OpraSchema } from '../../schema/index.js';
3
3
  import type { ApiDocument } from '../api-document.js';
4
4
  import { nodeInspectCustom } from '../utils/inspect.util.js';
5
5
  export declare namespace Resource {
6
- interface InitArguments extends StrictOmit<OpraSchema.ResourceBase, 'kind' | 'operations'> {
6
+ interface InitArguments extends StrictOmit<OpraSchema.ResourceBase, 'kind'> {
7
7
  name: string;
8
8
  controller?: object | Type;
9
9
  }
@@ -2,8 +2,9 @@ import { IssueSeverity } from './issue-severity.enum.js';
2
2
  export interface ErrorIssue {
3
3
  message: string;
4
4
  severity: IssueSeverity.Type;
5
+ system?: string;
5
6
  code?: string;
6
7
  details?: any;
7
8
  diagnostics?: string | string[];
8
- debugInfo?: string;
9
+ stack?: string[];
9
10
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 400 Bad Request
@@ -6,5 +7,5 @@ import { OpraException } from '../opra-exception.js';
6
7
  */
7
8
  export declare class BadRequestError extends OpraException {
8
9
  status: number;
9
- setIssue(issue: any): void;
10
+ protected init(issue: Partial<ErrorIssue>): void;
10
11
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 424 Failed Dependency
@@ -5,5 +6,5 @@ import { OpraException } from '../opra-exception.js';
5
6
  */
6
7
  export declare class FailedDependencyError extends OpraException {
7
8
  status: number;
8
- setIssue(issue: any): void;
9
+ protected init(issue: Partial<ErrorIssue>): void;
9
10
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 403 Forbidden
@@ -7,5 +8,5 @@ import { OpraException } from '../opra-exception.js';
7
8
  */
8
9
  export declare class ForbiddenError extends OpraException {
9
10
  status: number;
10
- setIssue(issue: any): void;
11
+ protected init(issue: Partial<ErrorIssue>): void;
11
12
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 500 Internal Server Error
@@ -5,5 +6,5 @@ import { OpraException } from '../opra-exception.js';
5
6
  */
6
7
  export declare class InternalServerError extends OpraException {
7
8
  status: number;
8
- setIssue(issue: any): void;
9
+ protected init(issue: Partial<ErrorIssue>): void;
9
10
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 405 Method Not Allowed
@@ -6,5 +7,5 @@ import { OpraException } from '../opra-exception.js';
6
7
  */
7
8
  export declare class MethodNotAllowedError extends OpraException {
8
9
  status: number;
9
- setIssue(issue: any): void;
10
+ protected init(issue: Partial<ErrorIssue>): void;
10
11
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 406 Not Acceptable
@@ -6,5 +7,5 @@ import { OpraException } from '../opra-exception.js';
6
7
  */
7
8
  export declare class NotAcceptableError extends OpraException {
8
9
  status: number;
9
- setIssue(issue: any): void;
10
+ protected init(issue: Partial<ErrorIssue>): void;
10
11
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 404 Not Found
@@ -9,5 +10,5 @@ import { OpraException } from '../opra-exception.js';
9
10
  */
10
11
  export declare class NotFoundError extends OpraException {
11
12
  status: number;
12
- setIssue(issue: any): void;
13
+ protected init(issue: Partial<ErrorIssue>): void;
13
14
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 401 Unauthorized
@@ -6,5 +7,5 @@ import { OpraException } from '../opra-exception.js';
6
7
  */
7
8
  export declare class UnauthorizedError extends OpraException {
8
9
  status: number;
9
- setIssue(issue: any): void;
10
+ protected init(issue: Partial<ErrorIssue>): void;
10
11
  }
@@ -1,3 +1,4 @@
1
+ import { ErrorIssue } from '../error-issue.js';
1
2
  import { OpraException } from '../opra-exception.js';
2
3
  /**
3
4
  * 422 Unprocessable Entity
@@ -5,5 +6,5 @@ import { OpraException } from '../opra-exception.js';
5
6
  */
6
7
  export declare class UnprocessableEntityError extends OpraException {
7
8
  status: number;
8
- setIssue(issue: any): void;
9
+ protected init(issue: Partial<ErrorIssue>): void;
9
10
  }
@@ -1,17 +1,22 @@
1
1
  import { ErrorIssue } from './error-issue.js';
2
+ import { IssueSeverity } from './issue-severity.enum.js';
2
3
  /**
3
4
  * Defines the base Opra exception, which is handled by the default Exceptions Handler.
4
5
  */
5
6
  export declare class OpraException extends Error {
6
- protected _issue: ErrorIssue;
7
- status: number;
8
7
  cause?: Error;
8
+ status: number;
9
+ severity: IssueSeverity.Type;
10
+ system?: string;
11
+ code?: string;
12
+ details?: any;
9
13
  constructor();
10
- constructor(issue: string | Partial<ErrorIssue> | Error);
11
- constructor(issue: string | Partial<ErrorIssue>, cause?: Error);
12
- get issue(): ErrorIssue;
13
- setIssue(issue: Partial<ErrorIssue>): void;
14
+ constructor(issue: string | Partial<ErrorIssue> | Error, status?: number);
15
+ constructor(issue: string | Partial<ErrorIssue>, cause?: Error, status?: number);
14
16
  setStatus(status: number): this;
15
- protected _initName(): void;
16
- protected _init(issue: any): void;
17
+ toString(): string;
18
+ toJSON(): ErrorIssue;
19
+ protected init(issue: Partial<ErrorIssue>): void;
20
+ protected initString(issue: string): void;
21
+ protected initError(issue: Error): void;
17
22
  }
@@ -1,2 +1,2 @@
1
1
  import { OpraException } from './opra-exception.js';
2
- export declare function wrapException(e: any): OpraException;
2
+ export declare function wrapException(error: any): OpraException;
@@ -1,2 +1,2 @@
1
1
  export declare function cloneObject<T extends {}>(obj: T, jsonOnly?: boolean): T;
2
- export declare function omitUndefined(obj: any, recursive?: boolean): any;
2
+ export declare function omitUndefined<T>(obj: T, recursive?: boolean): T;
@@ -8,7 +8,7 @@ export interface ComplexType extends DataTypeBase {
8
8
  base?: DataType.Name | ComplexType | UnionType | MappedType;
9
9
  abstract?: boolean;
10
10
  fields?: Record<Field.Name, Field | DataType.Name>;
11
- additionalFields?: boolean;
11
+ additionalFields?: boolean | 'error';
12
12
  }
13
13
  export declare namespace ComplexType {
14
14
  const Kind = "ComplexType";
@@ -10,5 +10,4 @@ export declare namespace Resource {
10
10
  export interface ResourceBase {
11
11
  kind: string;
12
12
  description?: string;
13
- operations: any;
14
13
  }
@@ -31,7 +31,7 @@ export declare namespace Storage {
31
31
  /**
32
32
  * limit the size of the batch of uploaded files
33
33
  *
34
- * @default options.maxFileSize
34
+ * @default maxFileSize
35
35
  */
36
36
  maxTotalFileSize?: number | undefined;
37
37
  /**