@opra/common 0.32.6 → 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.
- package/browser.js +94 -89
- package/cjs/document/data-type/builtin/approx-date.type.js +2 -2
- package/cjs/document/data-type/builtin/approx-datetime.type.js +2 -2
- package/cjs/document/data-type/builtin/base64.type.js +2 -2
- package/cjs/document/data-type/builtin/bigint.type.js +2 -2
- package/cjs/document/data-type/builtin/boolean.type.js +2 -2
- package/cjs/document/data-type/builtin/date.type.js +2 -2
- package/cjs/document/data-type/builtin/datetime.type.js +2 -2
- package/cjs/document/data-type/builtin/email.type.js +2 -2
- package/cjs/document/data-type/builtin/integer.type.js +2 -2
- package/cjs/document/data-type/builtin/null.type.js +2 -2
- package/cjs/document/data-type/builtin/number.type.js +2 -2
- package/cjs/document/data-type/builtin/object-id.type.js +2 -2
- package/cjs/document/data-type/builtin/string.type.js +2 -2
- package/cjs/document/data-type/builtin/time.type.js +2 -2
- package/cjs/document/data-type/builtin/url.type.js +2 -2
- package/cjs/document/data-type/builtin/uuid.type.js +2 -2
- package/cjs/document/data-type/complex-type-class.js +2 -3
- package/cjs/document/data-type/enum-type-class.js +5 -5
- package/cjs/document/data-type/field-class.js +10 -8
- package/cjs/document/data-type/simple-type-class.js +3 -4
- package/cjs/document/resource/action.js +2 -3
- package/cjs/document/resource/collection-class.js +2 -3
- package/cjs/document/resource/container-class.js +1 -1
- package/cjs/document/resource/crud-operation.js +3 -4
- package/cjs/document/resource/parameter.js +3 -4
- package/cjs/exception/index.js +2 -2
- package/cjs/exception/resource-errors/permission.error.js +21 -0
- package/cjs/exception/resource-errors/resource-conflict.error.js +1 -1
- package/cjs/exception/resource-errors/resource-not-found.error.js +2 -2
- package/cjs/exception/resource-errors/resource-not.available.error.js +24 -0
- package/cjs/exception/resource-errors/resource-not.available.js +24 -0
- package/cjs/filter/ast/terms/date-literal.js +1 -1
- package/cjs/filter/ast/terms/number-literal.js +1 -1
- package/cjs/filter/ast/terms/time-literal.js +1 -1
- package/cjs/filter/errors.js +3 -3
- package/esm/document/data-type/builtin/approx-date.type.js +3 -3
- package/esm/document/data-type/builtin/approx-datetime.type.js +2 -2
- package/esm/document/data-type/builtin/base64.type.js +2 -2
- package/esm/document/data-type/builtin/bigint.type.js +3 -3
- package/esm/document/data-type/builtin/boolean.type.js +2 -2
- package/esm/document/data-type/builtin/date.type.js +3 -3
- package/esm/document/data-type/builtin/datetime.type.js +3 -3
- package/esm/document/data-type/builtin/email.type.js +3 -3
- package/esm/document/data-type/builtin/integer.type.js +2 -2
- package/esm/document/data-type/builtin/null.type.js +2 -2
- package/esm/document/data-type/builtin/number.type.js +2 -2
- package/esm/document/data-type/builtin/object-id.type.js +3 -3
- package/esm/document/data-type/builtin/string.type.js +2 -2
- package/esm/document/data-type/builtin/time.type.js +3 -3
- package/esm/document/data-type/builtin/url.type.js +2 -2
- package/esm/document/data-type/builtin/uuid.type.js +2 -2
- package/esm/document/data-type/complex-type-class.js +1 -1
- package/esm/document/data-type/enum-type-class.js +3 -2
- package/esm/document/data-type/field-class.js +8 -5
- package/esm/document/data-type/simple-type-class.js +3 -3
- package/esm/document/resource/action.js +2 -2
- package/esm/document/resource/collection-class.js +1 -1
- package/esm/document/resource/container-class.js +2 -2
- package/esm/document/resource/crud-operation.js +1 -1
- package/esm/document/resource/parameter.js +1 -1
- package/esm/exception/index.js +2 -2
- package/esm/exception/resource-errors/permission.error.js +17 -0
- package/esm/exception/resource-errors/resource-conflict.error.js +1 -1
- package/esm/exception/resource-errors/resource-not-found.error.js +2 -2
- package/esm/exception/resource-errors/resource-not.available.error.js +20 -0
- package/esm/exception/resource-errors/resource-not.available.js +20 -0
- package/esm/filter/ast/terms/date-literal.js +2 -2
- package/esm/filter/ast/terms/number-literal.js +2 -2
- package/esm/filter/ast/terms/time-literal.js +2 -2
- package/esm/filter/errors.js +1 -1
- package/package.json +3 -3
- package/types/document/data-type/complex-type-class.d.ts +4 -4
- package/types/document/data-type/data-type.d.ts +3 -3
- package/types/document/data-type/enum-type-class.d.ts +4 -4
- package/types/document/data-type/field-class.d.ts +3 -3
- package/types/document/data-type/field.d.ts +6 -3
- package/types/document/data-type/simple-type-class.d.ts +4 -4
- package/types/document/data-type/simple-type.d.ts +7 -7
- package/types/document/resource/action.d.ts +2 -2
- package/types/document/resource/crud-operation.d.ts +3 -3
- package/types/document/resource/parameter.d.ts +6 -6
- package/types/exception/index.d.ts +2 -2
- package/types/exception/resource-errors/permission.error.d.ts +11 -0
- package/types/exception/resource-errors/resource-not.available.d.ts +8 -0
- package/types/exception/resource-errors/resource-not.available.error.d.ts +8 -0
- package/types/filter/errors.d.ts +1 -1
- package/types/helpers/object-utils.d.ts +2 -2
- package/types/schema/data-type/complex-type.interface.d.ts +1 -1
- package/types/schema/data-type/field.interface.d.ts +4 -1
- package/types/schema/data-type/mapped-type.interface.d.ts +1 -1
- package/types/schema/data-type/simple-type.interface.d.ts +3 -3
- package/types/types.d.ts +5 -26
- package/cjs/exception/common-errors/validation.error.js +0 -11
- package/esm/exception/common-errors/validation.error.js +0 -7
- package/types/exception/common-errors/validation.error.d.ts +0 -4
|
@@ -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
|
-
|
|
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
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StrictOmit } from 'ts-gems';
|
|
2
|
-
import
|
|
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?:
|
|
9
|
-
encoder?:
|
|
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,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { IfEquals } from 'ts-gems/lib/type-check';
|
|
1
|
+
import type { DeeperNullish, DeeperPartial, IfNever, IfNoDeepValue, Type } from 'ts-gems';
|
|
3
2
|
export type Thunk<T> = T | (() => T);
|
|
4
3
|
export type ThunkAsync<T> = Thunk<T> | Thunk<Promise<T>>;
|
|
5
4
|
export type TypeThunk<T = any> = Thunk<Type<T>>;
|
|
@@ -8,28 +7,8 @@ export type TypeThunkAsync<T = any> = ThunkAsync<Type<T>>;
|
|
|
8
7
|
* Returns given type as a Data Transfer Object (DTO) interface, Removes symbol keys and function properties.
|
|
9
8
|
* @template T - The type of the data being transferred.
|
|
10
9
|
*/
|
|
11
|
-
export type DTO<T> =
|
|
12
|
-
|
|
13
|
-
[K in keyof T]: K extends symbol ? never : IfEquals<{
|
|
14
|
-
[Q in K]: T[K];
|
|
15
|
-
}, {
|
|
16
|
-
readonly [Q in K]: T[K];
|
|
17
|
-
}> extends true ? never : T[K] extends Function ? never : _DTO<Exclude<T[K], undefined>>;
|
|
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>>;
|
|
18
12
|
};
|
|
19
|
-
export type PartialDTO<T> =
|
|
20
|
-
type
|
|
21
|
-
[K in keyof T]?: K extends symbol ? never : IfEquals<{
|
|
22
|
-
[Q in K]: T[K];
|
|
23
|
-
}, {
|
|
24
|
-
readonly [Q in K]: T[K];
|
|
25
|
-
}> extends true ? never : T[K] extends Function ? never : _PartialDTO<Exclude<T[K], undefined>>;
|
|
26
|
-
};
|
|
27
|
-
export type PatchDTO<T> = HighDeepOmitNever<_PatchDTO<T>>;
|
|
28
|
-
type _PatchDTO<T> = T extends (infer U)[] ? _PatchDTO<U>[] : IfNoDeepValue<T> extends true ? T : {
|
|
29
|
-
[K in keyof T]?: K extends symbol ? never : IfEquals<{
|
|
30
|
-
[Q in K]: T[K];
|
|
31
|
-
}, {
|
|
32
|
-
readonly [Q in K]: T[K];
|
|
33
|
-
}> extends true ? never : T[K] extends Function ? never : _PatchDTO<Exclude<T[K], undefined>> | null;
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
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;
|