@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.
- package/browser.js +95 -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 +3 -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 +2 -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 +6 -14
- 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
|
@@ -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
|
+
}
|
package/types/filter/errors.d.ts
CHANGED
|
@@ -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
|
|
5
|
+
export declare class FilterValidationError extends TypeError {
|
|
6
6
|
constructor(message?: string | {
|
|
7
7
|
message?: string;
|
|
8
8
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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):
|
|
4
|
+
export declare function omitNullish<T>(obj: T, recursive?: boolean): DeeperOmitTypes<T, null | undefined>;
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
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> =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type
|
|
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;
|