@opra/common 0.32.5 → 0.33.0

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 (96) hide show
  1. package/browser.js +95 -89
  2. package/cjs/document/data-type/builtin/approx-date.type.js +2 -2
  3. package/cjs/document/data-type/builtin/approx-datetime.type.js +2 -2
  4. package/cjs/document/data-type/builtin/base64.type.js +2 -2
  5. package/cjs/document/data-type/builtin/bigint.type.js +2 -2
  6. package/cjs/document/data-type/builtin/boolean.type.js +2 -2
  7. package/cjs/document/data-type/builtin/date.type.js +2 -2
  8. package/cjs/document/data-type/builtin/datetime.type.js +2 -2
  9. package/cjs/document/data-type/builtin/email.type.js +2 -2
  10. package/cjs/document/data-type/builtin/integer.type.js +2 -2
  11. package/cjs/document/data-type/builtin/null.type.js +2 -2
  12. package/cjs/document/data-type/builtin/number.type.js +2 -2
  13. package/cjs/document/data-type/builtin/object-id.type.js +2 -2
  14. package/cjs/document/data-type/builtin/string.type.js +2 -2
  15. package/cjs/document/data-type/builtin/time.type.js +2 -2
  16. package/cjs/document/data-type/builtin/url.type.js +2 -2
  17. package/cjs/document/data-type/builtin/uuid.type.js +2 -2
  18. package/cjs/document/data-type/complex-type-class.js +2 -3
  19. package/cjs/document/data-type/enum-type-class.js +5 -5
  20. package/cjs/document/data-type/field-class.js +10 -8
  21. package/cjs/document/data-type/simple-type-class.js +3 -4
  22. package/cjs/document/resource/action.js +2 -3
  23. package/cjs/document/resource/collection-class.js +3 -3
  24. package/cjs/document/resource/container-class.js +1 -1
  25. package/cjs/document/resource/crud-operation.js +3 -4
  26. package/cjs/document/resource/parameter.js +3 -4
  27. package/cjs/exception/index.js +2 -2
  28. package/cjs/exception/resource-errors/permission.error.js +21 -0
  29. package/cjs/exception/resource-errors/resource-conflict.error.js +1 -1
  30. package/cjs/exception/resource-errors/resource-not-found.error.js +2 -2
  31. package/cjs/exception/resource-errors/resource-not.available.error.js +24 -0
  32. package/cjs/exception/resource-errors/resource-not.available.js +24 -0
  33. package/cjs/filter/ast/terms/date-literal.js +1 -1
  34. package/cjs/filter/ast/terms/number-literal.js +1 -1
  35. package/cjs/filter/ast/terms/time-literal.js +1 -1
  36. package/cjs/filter/errors.js +3 -3
  37. package/esm/document/data-type/builtin/approx-date.type.js +3 -3
  38. package/esm/document/data-type/builtin/approx-datetime.type.js +2 -2
  39. package/esm/document/data-type/builtin/base64.type.js +2 -2
  40. package/esm/document/data-type/builtin/bigint.type.js +3 -3
  41. package/esm/document/data-type/builtin/boolean.type.js +2 -2
  42. package/esm/document/data-type/builtin/date.type.js +3 -3
  43. package/esm/document/data-type/builtin/datetime.type.js +3 -3
  44. package/esm/document/data-type/builtin/email.type.js +3 -3
  45. package/esm/document/data-type/builtin/integer.type.js +2 -2
  46. package/esm/document/data-type/builtin/null.type.js +2 -2
  47. package/esm/document/data-type/builtin/number.type.js +2 -2
  48. package/esm/document/data-type/builtin/object-id.type.js +3 -3
  49. package/esm/document/data-type/builtin/string.type.js +2 -2
  50. package/esm/document/data-type/builtin/time.type.js +3 -3
  51. package/esm/document/data-type/builtin/url.type.js +2 -2
  52. package/esm/document/data-type/builtin/uuid.type.js +2 -2
  53. package/esm/document/data-type/complex-type-class.js +1 -1
  54. package/esm/document/data-type/enum-type-class.js +3 -2
  55. package/esm/document/data-type/field-class.js +8 -5
  56. package/esm/document/data-type/simple-type-class.js +3 -3
  57. package/esm/document/resource/action.js +2 -2
  58. package/esm/document/resource/collection-class.js +2 -1
  59. package/esm/document/resource/container-class.js +2 -2
  60. package/esm/document/resource/crud-operation.js +1 -1
  61. package/esm/document/resource/parameter.js +1 -1
  62. package/esm/exception/index.js +2 -2
  63. package/esm/exception/resource-errors/permission.error.js +17 -0
  64. package/esm/exception/resource-errors/resource-conflict.error.js +1 -1
  65. package/esm/exception/resource-errors/resource-not-found.error.js +2 -2
  66. package/esm/exception/resource-errors/resource-not.available.error.js +20 -0
  67. package/esm/exception/resource-errors/resource-not.available.js +20 -0
  68. package/esm/filter/ast/terms/date-literal.js +2 -2
  69. package/esm/filter/ast/terms/number-literal.js +2 -2
  70. package/esm/filter/ast/terms/time-literal.js +2 -2
  71. package/esm/filter/errors.js +1 -1
  72. package/package.json +3 -3
  73. package/types/document/data-type/complex-type-class.d.ts +4 -4
  74. package/types/document/data-type/data-type.d.ts +3 -3
  75. package/types/document/data-type/enum-type-class.d.ts +4 -4
  76. package/types/document/data-type/field-class.d.ts +3 -3
  77. package/types/document/data-type/field.d.ts +6 -3
  78. package/types/document/data-type/simple-type-class.d.ts +4 -4
  79. package/types/document/data-type/simple-type.d.ts +7 -7
  80. package/types/document/resource/action.d.ts +2 -2
  81. package/types/document/resource/crud-operation.d.ts +3 -3
  82. package/types/document/resource/parameter.d.ts +6 -6
  83. package/types/exception/index.d.ts +2 -2
  84. package/types/exception/resource-errors/permission.error.d.ts +11 -0
  85. package/types/exception/resource-errors/resource-not.available.d.ts +8 -0
  86. package/types/exception/resource-errors/resource-not.available.error.d.ts +8 -0
  87. package/types/filter/errors.d.ts +1 -1
  88. package/types/helpers/object-utils.d.ts +2 -2
  89. package/types/schema/data-type/complex-type.interface.d.ts +1 -1
  90. package/types/schema/data-type/field.interface.d.ts +4 -1
  91. package/types/schema/data-type/mapped-type.interface.d.ts +1 -1
  92. package/types/schema/data-type/simple-type.interface.d.ts +3 -3
  93. package/types/types.d.ts +6 -14
  94. package/cjs/exception/common-errors/validation.error.js +0 -11
  95. package/esm/exception/common-errors/validation.error.js +0 -7
  96. package/types/exception/common-errors/validation.error.d.ts +0 -4
@@ -0,0 +1,8 @@
1
+ import { OpraException } from '../opra-exception.js';
2
+ /**
3
+ * The server cannot find the requested resource.
4
+ * This can also mean that the endpoint is valid but the resource itself does not exist.
5
+ */
6
+ export declare class ResourceNotAvailableError extends OpraException {
7
+ constructor(resource: string, keyValue?: any, cause?: Error);
8
+ }
@@ -2,7 +2,7 @@ import { RecognitionException } from '@browsery/antlr4';
2
2
  import { Recognizer } from '@browsery/antlr4/typings/Recognizer';
3
3
  export declare class SyntaxError extends TypeError {
4
4
  }
5
- export declare class ValidationError extends TypeError {
5
+ export declare class FilterValidationError extends TypeError {
6
6
  constructor(message?: string | {
7
7
  message?: string;
8
8
  });
@@ -1,4 +1,4 @@
1
- import { HighDeepRemoveNulls } from 'ts-gems';
1
+ import { DeeperOmitTypes } from 'ts-gems';
2
2
  export declare function cloneObject<T extends {}>(obj: T, jsonOnly?: boolean): T;
3
3
  export declare function omitUndefined<T>(obj: T, recursive?: boolean): T;
4
- export declare function omitNullish<T>(obj: T, recursive?: boolean): HighDeepRemoveNulls<T>;
4
+ export declare function omitNullish<T>(obj: T, recursive?: boolean): DeeperOmitTypes<T, null | undefined>;
@@ -13,5 +13,5 @@ export interface ComplexType extends StrictOmit<DataTypeBase, 'kind'> {
13
13
  }
14
14
  export declare namespace ComplexType {
15
15
  const Kind = "ComplexType";
16
- type Kind = 'ComplexType';
16
+ type Kind = typeof Kind;
17
17
  }
@@ -50,7 +50,10 @@ export type Field = {
50
50
  * Indicates if the field is deprecated and can be removed in the next
51
51
  */
52
52
  deprecated?: boolean | string;
53
- format?: string;
53
+ /**
54
+ * Defines RegExp pattern for the field. A String type is required for this option
55
+ */
56
+ pattern?: string;
54
57
  /**
55
58
  * Indicates if partial update enabled for this field
56
59
  */
@@ -9,5 +9,5 @@ export interface MappedType extends StrictOmit<ComplexType, 'kind'> {
9
9
  }
10
10
  export declare namespace MappedType {
11
11
  const Kind = "MappedType";
12
- type Kind = 'MappedType';
12
+ type Kind = typeof Kind;
13
13
  }
@@ -1,12 +1,12 @@
1
1
  import { StrictOmit } from 'ts-gems';
2
- import * as vg from 'valgen';
2
+ import { Validator } from 'valgen';
3
3
  import type { DataTypeBase } from './data-type.interface.js';
4
4
  import { DataType } from './data-type.interface.js';
5
5
  export interface SimpleType extends StrictOmit<DataTypeBase, 'kind'> {
6
6
  kind: SimpleType.Kind;
7
7
  base?: DataType.Name | SimpleType;
8
- decoder?: vg.Validator;
9
- encoder?: vg.Validator;
8
+ decoder?: Validator;
9
+ encoder?: Validator;
10
10
  }
11
11
  export declare namespace SimpleType {
12
12
  const Kind = "SimpleType";
package/types/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { IfNoDeepValue, IfUndefined, OmitNever, Type, WritableKeys } from 'ts-gems';
1
+ import type { DeeperNullish, DeeperPartial, IfNever, IfNoDeepValue, Type } from 'ts-gems';
2
2
  export type Thunk<T> = T | (() => T);
3
3
  export type ThunkAsync<T> = Thunk<T> | Thunk<Promise<T>>;
4
4
  export type TypeThunk<T = any> = Thunk<Type<T>>;
@@ -7,16 +7,8 @@ export type TypeThunkAsync<T = any> = ThunkAsync<Type<T>>;
7
7
  * Returns given type as a Data Transfer Object (DTO) interface, Removes symbol keys and function properties.
8
8
  * @template T - The type of the data being transferred.
9
9
  */
10
- export type DTO<T> = _DTO<Exclude<T, undefined>>;
11
- type _DTO<T, K extends keyof T = WritableKeys<T>> = T extends (infer U)[] ? DTO<U>[] : IfNoDeepValue<T> extends true ? T : OmitNever<{
12
- [P in K]: P extends symbol ? never : T[P] extends Function ? never : DTO<Exclude<T[P], undefined>>;
13
- }>;
14
- export type PartialDTO<T> = _PartialDTO<Exclude<T, undefined>>;
15
- type _PartialDTO<T, K extends keyof T = WritableKeys<T>> = T extends (infer U)[] ? PartialDTO<U>[] : IfNoDeepValue<T> extends true ? T : OmitNever<{
16
- [P in K]?: P extends symbol ? never : T[P] extends Function ? never : PartialDTO<Exclude<T[P], undefined>>;
17
- }>;
18
- export type PatchDTO<T> = _PatchDTO<Exclude<T, undefined>>;
19
- type _PatchDTO<T, K extends keyof T = WritableKeys<T>> = T extends (infer U)[] ? PatchDTO<U>[] : IfNoDeepValue<T> extends true ? T : OmitNever<{
20
- [P in K]?: P extends symbol ? never : T[P] extends Function ? never : IfUndefined<T> extends true ? T[P] : PatchDTO<Exclude<T[P], undefined>> | null;
21
- }>;
22
- export {};
10
+ export type DTO<T> = {
11
+ [K in keyof T as (IfNever<Exclude<T[K], undefined | Function>, never, K>)]: Exclude<T[K], undefined | null> extends (infer U)[] ? DTO<U>[] : IfNoDeepValue<Exclude<T[K], undefined | null>> extends true ? Exclude<T[K], undefined | null> : DTO<Exclude<T[K], undefined | null>>;
12
+ };
13
+ export type PartialDTO<T> = DeeperPartial<DTO<T>>;
14
+ export type PatchDTO<T> = DeeperNullish<DTO<T>>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValidationError = void 0;
4
- const opra_exception_js_1 = require("../opra-exception.js");
5
- class ValidationError extends opra_exception_js_1.OpraException {
6
- constructor() {
7
- super(...arguments);
8
- this.status = 400;
9
- }
10
- }
11
- exports.ValidationError = ValidationError;
@@ -1,7 +0,0 @@
1
- import { OpraException } from '../opra-exception.js';
2
- export class ValidationError extends OpraException {
3
- constructor() {
4
- super(...arguments);
5
- this.status = 400;
6
- }
7
- }
@@ -1,4 +0,0 @@
1
- import { OpraException } from '../opra-exception.js';
2
- export declare class ValidationError extends OpraException {
3
- status: number;
4
- }