@opra/common 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +6036 -5788
- package/cjs/document/api-document.js +12 -0
- package/cjs/document/common/api-base.js +1 -0
- package/cjs/document/common/document-element.js +5 -1
- package/cjs/document/data-type/api-field.js +12 -6
- package/cjs/document/data-type/complex-type-base.js +10 -3
- package/cjs/document/data-type/complex-type.js +6 -2
- package/cjs/document/data-type/data-type.js +2 -1
- package/cjs/document/data-type/enum-type.js +5 -2
- package/cjs/document/data-type/extended-types/base64.type.js +4 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +6 -2
- package/cjs/document/data-type/extended-types/date-time-string.type.js +6 -2
- package/cjs/document/data-type/extended-types/date-time.type.js +6 -2
- package/cjs/document/data-type/extended-types/date.type.js +6 -2
- package/cjs/document/data-type/extended-types/email.type.js +6 -2
- package/cjs/document/data-type/extended-types/field-path.type.js +5 -3
- package/cjs/document/data-type/extended-types/filter.type.js +19 -17
- package/cjs/document/data-type/extended-types/object-id.type.js +4 -0
- package/cjs/document/data-type/extended-types/time.type.js +6 -2
- package/cjs/document/data-type/extended-types/url.type.js +6 -2
- package/cjs/document/data-type/extended-types/uuid.type.js +4 -0
- package/cjs/document/data-type/mapped-type.js +12 -5
- package/cjs/document/data-type/mixin-type.js +5 -1
- package/cjs/document/data-type/omit-type.js +7 -2
- package/cjs/document/data-type/partial-type.js +7 -2
- package/cjs/document/data-type/pick-type.js +1 -2
- package/cjs/document/data-type/primitive-types/bigint.type.js +4 -0
- package/cjs/document/data-type/primitive-types/boolean.type.js +4 -0
- package/cjs/document/data-type/primitive-types/integer.type.js +4 -0
- package/cjs/document/data-type/primitive-types/null.type.js +4 -0
- package/cjs/document/data-type/primitive-types/number.type.js +4 -0
- package/cjs/document/data-type/primitive-types/object.type.js +0 -3
- package/cjs/document/data-type/primitive-types/string.type.js +4 -0
- package/cjs/document/data-type/required-type.js +1 -2
- package/cjs/document/data-type/simple-type.js +17 -16
- package/cjs/document/data-type/utils/create-mapped-class.js +3 -3
- package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
- package/cjs/document/decorators/api-field-decorator.js +4 -6
- package/cjs/document/decorators/complex-type.decorator.js +1 -2
- package/cjs/document/decorators/http-controller.decorator.js +26 -2
- package/cjs/document/decorators/http-operation-entity.decorator.js +123 -93
- package/cjs/document/decorators/http-operation.decorator.js +12 -6
- package/cjs/document/decorators/simple-type.decorator.js +2 -3
- package/cjs/document/factory/api-document.factory.js +14 -11
- package/cjs/document/factory/data-type.factory.js +97 -56
- package/cjs/document/factory/http-api.factory.js +3 -1
- package/cjs/document/http/http-api.js +2 -2
- package/cjs/document/http/http-controller.js +26 -14
- package/cjs/document/http/http-media-type.js +21 -4
- package/cjs/document/http/http-operation-response.js +2 -1
- package/cjs/document/http/http-operation.js +28 -4
- package/cjs/document/http/http-parameter.js +4 -0
- package/cjs/document/http/http-status-range.js +6 -4
- package/cjs/document/index.js +5 -5
- package/cjs/document/utils/parse-regexp.util.js +1 -2
- package/cjs/document/utils/string-compare.util.js +1 -2
- package/cjs/exception/index.js +5 -5
- package/cjs/exception/opra-exception.js +1 -0
- package/cjs/filter/antlr/OpraFilterParser.js +28 -82
- package/cjs/filter/ast/index.js +1 -1
- package/cjs/filter/build.js +22 -25
- package/cjs/filter/filter-rules.js +4 -2
- package/cjs/filter/opra-filter.ns.js +2 -2
- package/cjs/filter/parse.js +2 -5
- package/cjs/filter/utils.js +2 -3
- package/cjs/helpers/function-utils.js +1 -2
- package/cjs/helpers/get-stack-filename.js +2 -3
- package/cjs/helpers/mixin-utils.js +4 -4
- package/cjs/helpers/monkey-patches.js +4 -2
- package/cjs/helpers/object-utils.js +5 -6
- package/cjs/helpers/parse-fields-projection.js +4 -6
- package/cjs/helpers/responsive-map.js +5 -4
- package/cjs/helpers/type-guards.js +10 -11
- package/cjs/i18n/i18n.js +4 -3
- package/cjs/i18n/index.js +1 -1
- package/cjs/i18n/string-utils.js +2 -3
- package/cjs/i18n/translate.js +1 -2
- package/cjs/index.js +1 -1
- package/cjs/schema/type-guards.js +7 -8
- package/esm/document/api-document.js +11 -0
- package/esm/document/common/api-base.js +1 -0
- package/esm/document/common/document-element.js +4 -1
- package/esm/document/data-type/api-field.js +12 -6
- package/esm/document/data-type/complex-type-base.js +10 -3
- package/esm/document/data-type/complex-type.js +6 -2
- package/esm/document/data-type/data-type.js +2 -1
- package/esm/document/data-type/enum-type.js +5 -2
- package/esm/document/data-type/extended-types/base64.type.js +4 -0
- package/esm/document/data-type/extended-types/date-string.type.js +6 -2
- package/esm/document/data-type/extended-types/date-time-string.type.js +6 -2
- package/esm/document/data-type/extended-types/date-time.type.js +6 -2
- package/esm/document/data-type/extended-types/date.type.js +6 -2
- package/esm/document/data-type/extended-types/email.type.js +6 -2
- package/esm/document/data-type/extended-types/field-path.type.js +5 -3
- package/esm/document/data-type/extended-types/filter.type.js +19 -17
- package/esm/document/data-type/extended-types/object-id.type.js +4 -0
- package/esm/document/data-type/extended-types/time.type.js +6 -2
- package/esm/document/data-type/extended-types/url.type.js +6 -2
- package/esm/document/data-type/extended-types/uuid.type.js +4 -0
- package/esm/document/data-type/mapped-type.js +12 -5
- package/esm/document/data-type/mixin-type.js +5 -1
- package/esm/document/data-type/omit-type.js +6 -0
- package/esm/document/data-type/partial-type.js +6 -0
- package/esm/document/data-type/primitive-types/bigint.type.js +4 -0
- package/esm/document/data-type/primitive-types/boolean.type.js +4 -0
- package/esm/document/data-type/primitive-types/integer.type.js +4 -0
- package/esm/document/data-type/primitive-types/null.type.js +4 -0
- package/esm/document/data-type/primitive-types/number.type.js +4 -0
- package/esm/document/data-type/primitive-types/object.type.js +0 -3
- package/esm/document/data-type/primitive-types/string.type.js +4 -0
- package/esm/document/data-type/simple-type.js +17 -16
- package/esm/document/data-type/utils/create-mapped-class.js +2 -1
- package/esm/document/decorators/api-field-decorator.js +1 -2
- package/esm/document/decorators/http-controller.decorator.js +25 -0
- package/esm/document/decorators/http-operation-entity.decorator.js +80 -50
- package/esm/document/decorators/http-operation.decorator.js +11 -4
- package/esm/document/factory/api-document.factory.js +14 -10
- package/esm/document/factory/data-type.factory.js +97 -56
- package/esm/document/factory/http-api.factory.js +3 -1
- package/esm/document/http/http-api.js +2 -2
- package/esm/document/http/http-controller.js +25 -14
- package/esm/document/http/http-media-type.js +20 -4
- package/esm/document/http/http-operation-response.js +2 -1
- package/esm/document/http/http-operation.js +27 -4
- package/esm/document/http/http-parameter.js +4 -0
- package/esm/document/http/http-status-range.js +6 -4
- package/esm/document/index.js +5 -5
- package/esm/exception/index.js +5 -5
- package/esm/exception/opra-exception.js +1 -0
- package/esm/filter/antlr/OpraFilterParser.js +28 -82
- package/esm/filter/ast/index.js +1 -1
- package/esm/filter/build.js +1 -3
- package/esm/filter/filter-rules.js +4 -2
- package/esm/filter/opra-filter.ns.js +2 -2
- package/esm/filter/parse.js +1 -3
- package/esm/helpers/mixin-utils.js +2 -1
- package/esm/helpers/monkey-patches.js +4 -2
- package/esm/helpers/object-utils.js +2 -2
- package/esm/helpers/parse-fields-projection.js +1 -3
- package/esm/helpers/responsive-map.js +5 -4
- package/esm/i18n/i18n.js +4 -3
- package/esm/i18n/index.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +11 -8
- package/types/document/api-document.d.ts +1 -0
- package/types/document/common/document-element.d.ts +1 -0
- package/types/document/data-type/api-field.d.ts +12 -0
- package/types/document/data-type/complex-type-base.d.ts +1 -1
- package/types/document/data-type/complex-type.d.ts +1 -1
- package/types/document/data-type/data-type.d.ts +5 -2
- package/types/document/data-type/enum-type.d.ts +2 -2
- package/types/document/data-type/mapped-type.d.ts +3 -3
- package/types/document/data-type/mixin-type.d.ts +2 -2
- package/types/document/data-type/omit-type.d.ts +0 -6
- package/types/document/data-type/partial-type.d.ts +0 -6
- package/types/document/data-type/pick-type.d.ts +2 -2
- package/types/document/data-type/required-type.d.ts +7 -7
- package/types/document/data-type/simple-type.d.ts +4 -2
- package/types/document/decorators/http-controller.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity.decorator.d.ts +1 -0
- package/types/document/factory/data-type.factory.d.ts +5 -0
- package/types/document/http/http-controller.d.ts +1 -0
- package/types/document/http/http-media-type.d.ts +2 -1
- package/types/document/http/http-operation.d.ts +5 -3
- package/types/document/http/http-parameter.d.ts +3 -2
- package/types/document/http/http-status-range.d.ts +2 -1
- package/types/document/index.d.ts +5 -5
- package/types/exception/index.d.ts +5 -5
- package/types/filter/ast/index.d.ts +1 -1
- package/types/filter/opra-filter.ns.d.ts +2 -2
- package/types/helpers/type-guards.d.ts +0 -2
- package/types/i18n/i18n.d.ts +21 -19
- package/types/index.d.ts +1 -1
- package/types/schema/data-type/data-type.interface.d.ts +1 -1
- package/types/schema/data-type/mapped-type.interface.d.ts +2 -2
- package/types/schema/data-type/simple-type.interface.d.ts +4 -0
- package/types/schema/data-type-container.interface.d.ts +1 -1
- package/types/schema/document.interface.d.ts +1 -1
- package/types/schema/http/http-controller.interface.d.ts +2 -2
- package/types/schema/http/http-media-type.interface.d.ts +1 -1
- package/types/schema/http/http-operation-response.interface.d.ts +2 -2
- package/types/schema/http/http-operation.interface.d.ts +8 -4
- package/types/schema/http/http-parameter.interface.d.ts +5 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StrictOmit } from 'ts-gems';
|
|
1
|
+
import { StrictOmit, Type } from 'ts-gems';
|
|
2
2
|
import { ValidationOptions, Validator } from 'valgen';
|
|
3
3
|
import { FieldsProjection } from '../../helpers/index.js';
|
|
4
4
|
import type { DataTypeBase } from '../../schema/data-type/data-type.interface.js';
|
|
@@ -23,6 +23,9 @@ export declare namespace DataType {
|
|
|
23
23
|
caseInSensitive?: boolean;
|
|
24
24
|
partial?: boolean | 'deep';
|
|
25
25
|
projection?: string[] | FieldsProjection | '*';
|
|
26
|
+
ignoreReadonlyFields?: boolean;
|
|
27
|
+
ignoreWriteonlyFields?: boolean;
|
|
28
|
+
ignoreHiddenFields?: boolean;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
interface DataTypeStatic {
|
|
@@ -52,7 +55,7 @@ declare abstract class DataTypeClass extends DocumentElement {
|
|
|
52
55
|
readonly examples?: OpraSchema.DataTypeExample[];
|
|
53
56
|
abstract generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
|
|
54
57
|
get embedded(): any;
|
|
55
|
-
abstract extendsFrom(baseType: DataType): boolean;
|
|
58
|
+
abstract extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
56
59
|
toJSON(): OpraSchema.DataType;
|
|
57
60
|
toString(): string;
|
|
58
61
|
[nodeInspectCustom](): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Combine } from 'ts-gems';
|
|
2
|
+
import { Combine, Type } from 'ts-gems';
|
|
3
3
|
import { Validator } from 'valgen';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
5
|
import type { DocumentElement } from '../common/document-element.js';
|
|
@@ -63,7 +63,7 @@ declare class EnumTypeClass extends DataType {
|
|
|
63
63
|
readonly instance?: object;
|
|
64
64
|
readonly attributes: Record<string | number, OpraSchema.EnumType.ValueInfo>;
|
|
65
65
|
readonly ownAttributes: Record<string | number, OpraSchema.EnumType.ValueInfo>;
|
|
66
|
-
extendsFrom(baseType: DataType): boolean;
|
|
66
|
+
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
67
67
|
generateCodec(): Validator;
|
|
68
68
|
toJSON(): OpraSchema.EnumType;
|
|
69
69
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Combine, Type } from 'ts-gems';
|
|
3
|
-
import type { Field } from '../../schema/data-type/field.interface';
|
|
3
|
+
import type { Field } from '../../schema/data-type/field.interface.js';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
5
|
import { DocumentElement } from '../common/document-element.js';
|
|
6
6
|
import type { ComplexType } from './complex-type.js';
|
|
7
7
|
import { ComplexTypeBase } from './complex-type-base.js';
|
|
8
|
-
import
|
|
8
|
+
import { DataType } from './data-type.js';
|
|
9
9
|
import type { MixinType } from './mixin-type';
|
|
10
10
|
/**
|
|
11
11
|
* @namespace MappedType
|
|
@@ -67,7 +67,7 @@ declare class MappedTypeClass extends ComplexTypeBase {
|
|
|
67
67
|
readonly pick?: Field.Name[];
|
|
68
68
|
readonly partial?: Field.Name[] | boolean;
|
|
69
69
|
readonly required?: Field.Name[] | boolean;
|
|
70
|
-
extendsFrom(baseType: DataType): boolean;
|
|
70
|
+
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
71
71
|
toJSON(): OpraSchema.MappedType;
|
|
72
72
|
}
|
|
73
73
|
export {};
|
|
@@ -4,7 +4,7 @@ import { OpraSchema } from '../../schema/index.js';
|
|
|
4
4
|
import type { DocumentElement } from '../common/document-element.js';
|
|
5
5
|
import type { ComplexType } from './complex-type.js';
|
|
6
6
|
import { ComplexTypeBase } from './complex-type-base.js';
|
|
7
|
-
import
|
|
7
|
+
import { DataType } from './data-type.js';
|
|
8
8
|
import type { MappedType } from './mapped-type.js';
|
|
9
9
|
/**
|
|
10
10
|
* @namespace MixinType
|
|
@@ -76,7 +76,7 @@ export declare const MixinType: MixinTypeStatic;
|
|
|
76
76
|
declare class MixinTypeClass extends ComplexTypeBase {
|
|
77
77
|
readonly kind: OpraSchema.MixinType.Kind;
|
|
78
78
|
readonly types: (ComplexType | MixinType | MappedType)[];
|
|
79
|
-
extendsFrom(baseType: DataType): boolean;
|
|
79
|
+
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
80
80
|
toJSON(): OpraSchema.MixinType;
|
|
81
81
|
}
|
|
82
82
|
export {};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { Class, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new MappedType that omits given fields from base type
|
|
5
|
-
* @param baseType
|
|
6
|
-
* @param keys
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
3
|
export declare function OmitType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
|
|
10
4
|
/**
|
|
11
5
|
* Create a new MappedType that omits given fields from base type
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { Class, PartialSome, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new MappedType that marks given or all fields as optional
|
|
5
|
-
* @param baseType
|
|
6
|
-
* @param keys
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
3
|
export declare function PartialType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
|
|
10
4
|
/**
|
|
11
5
|
* Create a new MappedType that marks given or all fields as optional
|
|
@@ -6,11 +6,11 @@ import type { DataType } from './data-type.js';
|
|
|
6
6
|
* @param keys
|
|
7
7
|
* @param options
|
|
8
8
|
*/
|
|
9
|
-
export declare function PickType(baseType:
|
|
9
|
+
export declare function PickType<Args extends any[], Instance, Static, K extends keyof Instance>(baseType: Class<Args, Instance, Static>, keys: readonly K[], options?: DataType.Options): Class<Args, Pick<Instance, K>> & Omit<Pick<Static, keyof typeof baseType>, 'prototype' | 'constructor'>;
|
|
10
10
|
/**
|
|
11
11
|
* Create a new MappedType that picks given fields from base type
|
|
12
12
|
* @param baseType
|
|
13
13
|
* @param keys
|
|
14
14
|
* @param options
|
|
15
15
|
*/
|
|
16
|
-
export declare function PickType
|
|
16
|
+
export declare function PickType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { Class, RequiredSome, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new MappedType that marks given or all fields as required
|
|
5
|
-
* @param baseType
|
|
6
|
-
* @param keys
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
|
-
export declare function RequiredType(baseType: string | Type, keys?: string[] | true, options?: DataType.Options): Type;
|
|
10
3
|
/**
|
|
11
4
|
* Create a new MappedType that marks given fields as baseType
|
|
12
5
|
* @param baseType
|
|
@@ -20,3 +13,10 @@ export declare function RequiredType<Args extends any[], Instance, Static, K ext
|
|
|
20
13
|
* @param options
|
|
21
14
|
*/
|
|
22
15
|
export declare function RequiredType<Args extends any[], Instance, Static>(baseType: Class<Args, Instance, Static>, options?: DataType.Options): Class<Args, Required<Instance>> & Omit<Pick<Static, keyof typeof baseType>, 'prototype' | 'constructor'>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new MappedType that marks given or all fields as required
|
|
18
|
+
* @param baseType
|
|
19
|
+
* @param keys
|
|
20
|
+
* @param options
|
|
21
|
+
*/
|
|
22
|
+
export declare function RequiredType(baseType: string | Type, keys?: string[] | true, options?: DataType.Options): Type;
|
|
@@ -14,7 +14,7 @@ export declare namespace SimpleType {
|
|
|
14
14
|
kind: OpraSchema.SimpleType.Kind;
|
|
15
15
|
}, DataType.Metadata, OpraSchema.SimpleType> {
|
|
16
16
|
}
|
|
17
|
-
interface Options extends DataType.Options {
|
|
17
|
+
interface Options extends Combine<Pick<OpraSchema.SimpleType, 'nameMappings'>, DataType.Options> {
|
|
18
18
|
}
|
|
19
19
|
interface InitArguments extends Combine<{
|
|
20
20
|
kind: OpraSchema.SimpleType.Kind;
|
|
@@ -64,11 +64,13 @@ declare abstract class SimpleTypeClass extends DataType {
|
|
|
64
64
|
readonly kind: OpraSchema.SimpleType.Kind;
|
|
65
65
|
readonly base?: SimpleType;
|
|
66
66
|
readonly attributes: Record<string, SimpleType.Attribute>;
|
|
67
|
+
readonly nameMappings: Record<string, string>;
|
|
67
68
|
readonly ownAttributes: Record<string, SimpleType.Attribute>;
|
|
69
|
+
readonly ownNameMappings: Record<string, string>;
|
|
68
70
|
protected _generateDecoder?: SimpleType.ValidatorGenerator;
|
|
69
71
|
protected _generateEncoder?: SimpleType.ValidatorGenerator;
|
|
70
72
|
properties?: any;
|
|
71
|
-
extendsFrom(baseType: DataType): boolean;
|
|
73
|
+
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
72
74
|
generateCodec<T extends Record<string, any> | object = object>(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions | null, properties?: Partial<T>): Validator;
|
|
73
75
|
toJSON(): OpraSchema.SimpleType;
|
|
74
76
|
}
|
|
@@ -6,6 +6,7 @@ export interface HttpControllerDecorator<T extends HttpControllerDecorator<any>
|
|
|
6
6
|
Header(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
|
|
7
7
|
QueryParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
|
|
8
8
|
PathParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
|
|
9
|
+
KeyParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
|
|
9
10
|
UseType(...type: TypeThunkAsync[]): T;
|
|
10
11
|
}
|
|
11
12
|
export interface HttpControllerDecoratorFactory {
|
|
@@ -18,24 +18,29 @@ export declare namespace DataTypeFactory {
|
|
|
18
18
|
type DataTypeSources = ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray | object>[] | Record<string, OpraSchema.DataType>;
|
|
19
19
|
type DataTypeThunk = Type | EnumType.EnumObject | EnumType.EnumArray | object;
|
|
20
20
|
interface ComplexTypeInit extends Combine<{
|
|
21
|
+
_instance?: ComplexType;
|
|
21
22
|
base?: string | ComplexTypeInit | MappedTypeInit | MixinTypeInit;
|
|
22
23
|
fields?: Record<string, ApiFieldInit>;
|
|
23
24
|
additionalFields?: boolean | string | DataTypeFactory.DataTypeInitArguments | ['error'] | ['error', string];
|
|
24
25
|
}, ComplexType.InitArguments> {
|
|
25
26
|
}
|
|
26
27
|
interface EnumTypeInit extends Combine<{
|
|
28
|
+
_instance?: MappedType;
|
|
27
29
|
base?: string | EnumTypeInit;
|
|
28
30
|
}, EnumType.InitArguments> {
|
|
29
31
|
}
|
|
30
32
|
interface MappedTypeInit extends Combine<{
|
|
33
|
+
_instance?: MappedType;
|
|
31
34
|
base: string | ComplexTypeInit | MappedTypeInit | MixinTypeInit;
|
|
32
35
|
}, MappedType.InitArguments> {
|
|
33
36
|
}
|
|
34
37
|
interface MixinTypeInit extends Combine<{
|
|
38
|
+
_instance?: MixinType;
|
|
35
39
|
types: (string | ComplexTypeInit | MappedTypeInit | MixinTypeInit)[];
|
|
36
40
|
}, MixinType.InitArguments> {
|
|
37
41
|
}
|
|
38
42
|
interface SimpleTypeInit extends Combine<{
|
|
43
|
+
_instance?: SimpleType;
|
|
39
44
|
base?: string | SimpleTypeInit;
|
|
40
45
|
}, SimpleType.InitArguments> {
|
|
41
46
|
}
|
|
@@ -76,6 +76,7 @@ declare class HttpControllerClass extends DocumentElement {
|
|
|
76
76
|
findController(controller: Type): HttpController | undefined;
|
|
77
77
|
findController(resourcePath: string): HttpController | undefined;
|
|
78
78
|
findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
|
|
79
|
+
getFullUrl(): string;
|
|
79
80
|
/**
|
|
80
81
|
*
|
|
81
82
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Combine, StrictOmit, Type } from 'ts-gems';
|
|
2
|
+
import { Validator } from 'valgen';
|
|
2
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
4
|
import { DocumentElement } from '../common/document-element.js';
|
|
4
5
|
import { DataType } from '../data-type/data-type.js';
|
|
@@ -52,8 +53,8 @@ declare class HttpMediaTypeClass extends DocumentElement {
|
|
|
52
53
|
maxFiles?: number;
|
|
53
54
|
maxFileSize?: number;
|
|
54
55
|
maxTotalFileSize?: number;
|
|
55
|
-
minFileSize?: number;
|
|
56
56
|
findMultipartField(fieldName: string, fieldType?: OpraSchema.HttpMultipartFieldType): HttpMultipartField | undefined;
|
|
57
57
|
toJSON(): OpraSchema.HttpMediaType;
|
|
58
|
+
generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
|
|
58
59
|
}
|
|
59
60
|
export {};
|
|
@@ -13,20 +13,20 @@ import type { HttpRequestBody } from './http-request-body.js';
|
|
|
13
13
|
* @namespace HttpOperation
|
|
14
14
|
*/
|
|
15
15
|
export declare namespace HttpOperation {
|
|
16
|
-
interface Metadata extends Pick<OpraSchema.HttpOperation, 'description' | 'path' | '
|
|
16
|
+
interface Metadata extends Pick<OpraSchema.HttpOperation, 'description' | 'method' | 'path' | 'mergePath' | 'composition' | 'compositionOptions'> {
|
|
17
17
|
types?: ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray>[];
|
|
18
18
|
parameters?: HttpParameter.Metadata[];
|
|
19
19
|
responses?: HttpOperationResponse.Metadata[];
|
|
20
20
|
requestBody?: HttpRequestBody.Metadata;
|
|
21
21
|
immediateFetch?: boolean;
|
|
22
22
|
}
|
|
23
|
-
interface Options extends Partial<Pick<Metadata, 'path' | 'description' | 'method' | 'immediateFetch'>> {
|
|
23
|
+
interface Options extends Partial<Pick<Metadata, 'path' | 'mergePath' | 'description' | 'method' | 'immediateFetch'>> {
|
|
24
24
|
requestBody?: HttpRequestBody.Options;
|
|
25
25
|
}
|
|
26
26
|
interface InitArguments extends Combine<{
|
|
27
27
|
name: string;
|
|
28
28
|
types?: DataType[];
|
|
29
|
-
}, Pick<Metadata, 'description' | 'path' | '
|
|
29
|
+
}, Pick<Metadata, 'description' | 'method' | 'path' | 'mergePath' | 'composition' | 'compositionOptions' | 'immediateFetch'>> {
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
@@ -72,6 +72,7 @@ declare class HttpOperationClass extends DocumentElement {
|
|
|
72
72
|
method: OpraSchema.HttpMethod;
|
|
73
73
|
description?: string;
|
|
74
74
|
path?: string;
|
|
75
|
+
mergePath?: boolean;
|
|
75
76
|
types: DataTypeMap;
|
|
76
77
|
parameters: HttpParameter[];
|
|
77
78
|
responses: HttpOperationResponse[];
|
|
@@ -79,6 +80,7 @@ declare class HttpOperationClass extends DocumentElement {
|
|
|
79
80
|
composition?: string;
|
|
80
81
|
compositionOptions?: Record<string, any>;
|
|
81
82
|
findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
|
|
83
|
+
getFullUrl(): string;
|
|
82
84
|
toJSON(): OpraSchema.HttpOperation;
|
|
83
85
|
}
|
|
84
86
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Combine, StrictOmit, TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import type { OpraSchema } from '../../schema/index.js';
|
|
3
|
-
import { HttpParameterLocation } from '../../schema/types.js';
|
|
4
3
|
import { DocumentElement } from '../common/document-element.js';
|
|
5
4
|
import { Value } from '../common/value.js';
|
|
6
5
|
import { DataType } from '../data-type/data-type.js';
|
|
@@ -12,6 +11,7 @@ export declare namespace HttpParameter {
|
|
|
12
11
|
interface Metadata extends StrictOmit<OpraSchema.HttpParameter, 'type'> {
|
|
13
12
|
name: string | RegExp;
|
|
14
13
|
type?: string | TypeThunkAsync | EnumType.EnumObject | EnumType.EnumArray | object;
|
|
14
|
+
keyParam?: boolean;
|
|
15
15
|
}
|
|
16
16
|
interface Options extends Partial<StrictOmit<Metadata, 'type'>> {
|
|
17
17
|
type?: string | TypeThunkAsync | object;
|
|
@@ -41,10 +41,11 @@ export declare const HttpParameter: HttpParameterStatic;
|
|
|
41
41
|
*/
|
|
42
42
|
declare class HttpParameterClass extends Value {
|
|
43
43
|
readonly owner: DocumentElement;
|
|
44
|
+
location: OpraSchema.HttpParameterLocation;
|
|
45
|
+
keyParam?: boolean;
|
|
44
46
|
deprecated?: boolean | string;
|
|
45
47
|
required?: boolean;
|
|
46
48
|
arraySeparator?: string;
|
|
47
|
-
location: HttpParameterLocation;
|
|
48
49
|
toJSON(): OpraSchema.HttpParameter;
|
|
49
50
|
}
|
|
50
51
|
export {};
|
|
@@ -8,7 +8,8 @@ export declare class HttpStatusRange {
|
|
|
8
8
|
constructor(value: string);
|
|
9
9
|
constructor(start: number, end?: number);
|
|
10
10
|
constructor(init: Pick<HttpStatusRange, 'start' | 'end'>);
|
|
11
|
-
|
|
11
|
+
includes(statusCode: number): boolean;
|
|
12
|
+
intersects(start: number, end: number): boolean;
|
|
12
13
|
toString(): string;
|
|
13
14
|
toJSON(): OpraSchema.HttpStatusRange | number;
|
|
14
15
|
}
|
|
@@ -2,36 +2,36 @@ import 'reflect-metadata';
|
|
|
2
2
|
import * as DataTypeFactory_ from './factory/data-type.factory.js';
|
|
3
3
|
import * as HttpApiFactory_ from './factory/http-api.factory.js';
|
|
4
4
|
export * from './api-document.js';
|
|
5
|
-
export * from './constants.js';
|
|
6
5
|
export * from './common/api-base.js';
|
|
7
6
|
export * from './common/data-type-map.js';
|
|
8
7
|
export * from './common/document-element.js';
|
|
9
8
|
export * from './common/document-init-context.js';
|
|
10
9
|
export * from './common/document-node.js';
|
|
11
10
|
export * from './common/opra-document-error.js';
|
|
11
|
+
export * from './constants.js';
|
|
12
|
+
export * from './data-type/api-field.js';
|
|
12
13
|
export * from './data-type/complex-type.js';
|
|
13
14
|
export * from './data-type/data-type.js';
|
|
14
15
|
export * from './data-type/enum-type.js';
|
|
15
|
-
export * from './data-type/
|
|
16
|
+
export * from './data-type/extended-types/index.js';
|
|
16
17
|
export * from './data-type/mapped-type.js';
|
|
17
18
|
export * from './data-type/mixin-type.js';
|
|
18
19
|
export * from './data-type/omit-type.js';
|
|
19
20
|
export * from './data-type/partial-type.js';
|
|
20
21
|
export * from './data-type/pick-type.js';
|
|
22
|
+
export * from './data-type/primitive-types/index.js';
|
|
21
23
|
export * from './data-type/required-type.js';
|
|
22
24
|
export * from './data-type/simple-type.js';
|
|
23
|
-
export * from './data-type/primitive-types/index.js';
|
|
24
|
-
export * from './data-type/extended-types/index.js';
|
|
25
25
|
export * from './decorators/http-operation-entity.decorator.js';
|
|
26
26
|
export * from './factory/api-document.factory.js';
|
|
27
27
|
export * from './http/http-api.js';
|
|
28
|
+
export * from './http/http-controller.js';
|
|
28
29
|
export * from './http/http-media-type.js';
|
|
29
30
|
export * from './http/http-multipart-field.js';
|
|
30
31
|
export * from './http/http-operation.js';
|
|
31
32
|
export * from './http/http-operation-response.js';
|
|
32
33
|
export * from './http/http-parameter.js';
|
|
33
34
|
export * from './http/http-request-body.js';
|
|
34
|
-
export * from './http/http-controller.js';
|
|
35
35
|
export * from './http/http-status-range.js';
|
|
36
36
|
export declare namespace classes {
|
|
37
37
|
export import HttpApiFactory = HttpApiFactory_.HttpApiFactory;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export * from './opra-exception.js';
|
|
2
|
-
export * from './opra-http-error.js';
|
|
3
1
|
export * from './error-issue.js';
|
|
4
|
-
export * from './issue-severity.enum.js';
|
|
5
2
|
export * from './http-errors/bad-request.error.js';
|
|
6
3
|
export * from './http-errors/conflict.error.js';
|
|
7
4
|
export * from './http-errors/failed-dependency.error.js';
|
|
@@ -10,8 +7,11 @@ export * from './http-errors/internal-server.error.js';
|
|
|
10
7
|
export * from './http-errors/method-not-allowed.error.js';
|
|
11
8
|
export * from './http-errors/not-acceptable.error.js';
|
|
12
9
|
export * from './http-errors/not-found.error.js';
|
|
13
|
-
export * from './http-errors/unauthorized.error.js';
|
|
14
|
-
export * from './http-errors/unprocessable-entity.error.js';
|
|
15
10
|
export * from './http-errors/permission.error.js';
|
|
16
11
|
export * from './http-errors/resource-conflict.error.js';
|
|
17
12
|
export * from './http-errors/resource-not.available.error.js';
|
|
13
|
+
export * from './http-errors/unauthorized.error.js';
|
|
14
|
+
export * from './http-errors/unprocessable-entity.error.js';
|
|
15
|
+
export * from './issue-severity.enum.js';
|
|
16
|
+
export * from './opra-exception.js';
|
|
17
|
+
export * from './opra-http-error.js';
|
|
@@ -6,8 +6,8 @@ export * from './expressions/arithmetic-expression.js';
|
|
|
6
6
|
export * from './expressions/array-expression.js';
|
|
7
7
|
export * from './expressions/comparison-expression.js';
|
|
8
8
|
export * from './expressions/logical-expression.js';
|
|
9
|
-
export * from './expressions/parenthesized-expression.js';
|
|
10
9
|
export * from './expressions/negative-expression.js';
|
|
10
|
+
export * from './expressions/parenthesized-expression.js';
|
|
11
11
|
export * from './terms/boolean-literal.js';
|
|
12
12
|
export * from './terms/date-literal.js';
|
|
13
13
|
export * from './terms/null-literal.js';
|
package/types/i18n/i18n.d.ts
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FallbackLng, Formatter as I18nextFormatter, i18n, InitOptions as I18nextInitOptions, Resource as I18nextResource, TFunction as I18nextTFunction, TOptions } from '@browsery/i18next';
|
|
1
|
+
import { FallbackLng as I18nextFallbackLng, Formatter as I18nextFormatter, i18n, InitOptions as I18nextInitOptions, Resource as I18nextResource, TFunction as I18nextTFunction, TOptions } from '@browsery/i18next';
|
|
3
2
|
import * as I18next from '@browsery/i18next';
|
|
3
|
+
import { Type } from 'ts-gems';
|
|
4
4
|
export interface BaseI18n extends Type<I18next.i18n> {
|
|
5
5
|
}
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
export declare namespace I18n {
|
|
7
|
+
interface InitOptions extends I18nextInitOptions {
|
|
8
|
+
resourceDirs?: string[];
|
|
9
|
+
}
|
|
10
|
+
type DeepTranslateOptions = TOptions & {
|
|
11
|
+
ignore?: (input: any, inst: i18n) => boolean;
|
|
12
|
+
};
|
|
13
|
+
type InitCallback = I18next.Callback;
|
|
14
|
+
type TranslateFunction = I18nextTFunction;
|
|
15
|
+
type Formatter = I18nextFormatter;
|
|
16
|
+
type LanguageResource = I18nextResource;
|
|
17
|
+
type FallbackLng = I18nextFallbackLng;
|
|
17
18
|
}
|
|
19
|
+
export declare const BaseI18n: BaseI18n;
|
|
18
20
|
export declare class I18n extends BaseI18n {
|
|
19
|
-
init(callback?: InitCallback): Promise<TranslateFunction>;
|
|
20
|
-
init(options: InitOptions, callback?: InitCallback): Promise<TranslateFunction>;
|
|
21
|
-
deep(input: any, options?: DeepTranslateOptions): any;
|
|
22
|
-
createInstance(options
|
|
23
|
-
static createInstance(options?: InitOptions, callback?: InitCallback): I18n;
|
|
24
|
-
protected _deepTranslate(input: any, objectStack: WeakMap<object, any>, options?: DeepTranslateOptions): any;
|
|
21
|
+
init(callback?: I18n.InitCallback): Promise<I18n.TranslateFunction>;
|
|
22
|
+
init(options: I18n.InitOptions, callback?: I18n.InitCallback): Promise<I18n.TranslateFunction>;
|
|
23
|
+
deep(input: any, options?: I18n.DeepTranslateOptions): any;
|
|
24
|
+
createInstance(options?: I18n.InitOptions, callback?: I18n.InitCallback): I18n;
|
|
25
|
+
static createInstance(options?: I18n.InitOptions, callback?: I18n.InitCallback): I18n;
|
|
26
|
+
protected _deepTranslate(input: any, objectStack: WeakMap<object, any>, options?: I18n.DeepTranslateOptions): any;
|
|
25
27
|
static get defaultInstance(): I18n;
|
|
26
28
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
1
|
export * from './document/index.js';
|
|
3
2
|
export * from './exception/index.js';
|
|
4
3
|
export * from './filter/index.js';
|
|
@@ -6,4 +5,5 @@ export * from './helpers/index.js';
|
|
|
6
5
|
export * from './http/index.js';
|
|
7
6
|
export * from './i18n/index.js';
|
|
8
7
|
export * from './schema/index.js';
|
|
8
|
+
export * from './types.js';
|
|
9
9
|
export { uid } from 'uid';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComplexType } from './complex-type.interface.js';
|
|
2
2
|
import type { EnumType } from './enum-type.interface.js';
|
|
3
3
|
import type { MappedType } from './mapped-type.interface.js';
|
|
4
|
-
import type { MixinType } from './mixin-type.interface';
|
|
4
|
+
import type { MixinType } from './mixin-type.interface.js';
|
|
5
5
|
import type { SimpleType } from './simple-type.interface.js';
|
|
6
6
|
export type DataType = SimpleType | EnumType | ComplexType | MappedType | MixinType;
|
|
7
7
|
export declare namespace DataType {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StrictOmit } from 'ts-gems';
|
|
2
|
-
import type { ComplexType } from './complex-type.interface';
|
|
3
|
-
import type { DataType, DataTypeBase } from './data-type.interface';
|
|
2
|
+
import type { ComplexType } from './complex-type.interface.js';
|
|
3
|
+
import type { DataType, DataTypeBase } from './data-type.interface.js';
|
|
4
4
|
import type { Field } from './field.interface.js';
|
|
5
5
|
import type { MixinType } from './mixin-type.interface.js';
|
|
6
6
|
export interface MappedType extends StrictOmit<DataTypeBase, 'kind'> {
|
|
@@ -9,6 +9,10 @@ export interface SimpleType extends StrictOmit<DataTypeBase, 'kind'> {
|
|
|
9
9
|
base?: DataType.Name;
|
|
10
10
|
attributes?: Record<string, Attribute>;
|
|
11
11
|
properties?: Record<string, any>;
|
|
12
|
+
/**
|
|
13
|
+
* Naming alternatives across software languages
|
|
14
|
+
*/
|
|
15
|
+
nameMappings?: Record<string, string>;
|
|
12
16
|
}
|
|
13
17
|
export declare namespace SimpleType {
|
|
14
18
|
const Kind = "SimpleType";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SpecVersion } from './constants.js';
|
|
2
2
|
import type { DataTypeContainer } from './data-type-container.interface.js';
|
|
3
|
-
import type { HttpController } from './http/http-controller.interface';
|
|
3
|
+
import type { HttpController } from './http/http-controller.interface.js';
|
|
4
4
|
export type Protocol = 'http' | 'ws' | 'rpc';
|
|
5
5
|
/**
|
|
6
6
|
* @interface Document
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
2
|
-
import type { HttpOperation } from './http-operation.interface';
|
|
3
|
-
import type { HttpParameter } from './http-parameter.interface';
|
|
2
|
+
import type { HttpOperation } from './http-operation.interface.js';
|
|
3
|
+
import type { HttpParameter } from './http-parameter.interface.js';
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @interface HttpController
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HttpMediaType } from './http-media-type.interface.js';
|
|
2
|
-
import type { HttpParameter } from './http-parameter.interface';
|
|
3
|
-
import type { HttpStatusRange } from './http-status-range.interface';
|
|
2
|
+
import type { HttpParameter } from './http-parameter.interface.js';
|
|
3
|
+
import type { HttpStatusRange } from './http-status-range.interface.js';
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @interface HttpOperationResponse
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { DataTypeContainer } from '../data-type-container.interface';
|
|
1
|
+
import type { DataTypeContainer } from '../data-type-container.interface.js';
|
|
2
2
|
import type { HttpMethod } from '../types.js';
|
|
3
|
-
import type { HttpOperationResponse } from './http-operation-response.interface';
|
|
4
|
-
import type { HttpParameter } from './http-parameter.interface';
|
|
5
|
-
import type { HttpRequestBody } from './http-request-body.interface';
|
|
3
|
+
import type { HttpOperationResponse } from './http-operation-response.interface.js';
|
|
4
|
+
import type { HttpParameter } from './http-parameter.interface.js';
|
|
5
|
+
import type { HttpRequestBody } from './http-request-body.interface.js';
|
|
6
6
|
/**
|
|
7
7
|
* @interface HttpOperation
|
|
8
8
|
*/
|
|
@@ -11,6 +11,10 @@ export interface HttpOperation extends DataTypeContainer {
|
|
|
11
11
|
method: HttpMethod;
|
|
12
12
|
description?: string;
|
|
13
13
|
path?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Determines if the `path` will be joined or merged to parent path.
|
|
16
|
+
*/
|
|
17
|
+
mergePath?: boolean;
|
|
14
18
|
parameters?: HttpParameter[];
|
|
15
19
|
responses?: HttpOperationResponse[];
|
|
16
20
|
requestBody?: HttpRequestBody;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpParameterLocation } from '../types.js';
|
|
2
|
-
import type { Value } from '../value.interface';
|
|
2
|
+
import type { Value } from '../value.interface.js';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @interface HttpParameter
|
|
@@ -13,6 +13,10 @@ export interface HttpParameter extends Value {
|
|
|
13
13
|
* Name of the parameter. RegExp pattern can be used matching parameter name
|
|
14
14
|
*/
|
|
15
15
|
name: string | RegExp;
|
|
16
|
+
/**
|
|
17
|
+
* Determines if parameter is key
|
|
18
|
+
*/
|
|
19
|
+
keyParam?: boolean;
|
|
16
20
|
/**
|
|
17
21
|
* Defines array separator
|
|
18
22
|
*/
|