@opra/common 1.4.3 → 1.5.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/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/api-document.js +16 -9
- package/cjs/document/common/api-base.js +4 -2
- package/cjs/document/common/data-type-map.js +14 -3
- package/cjs/document/common/document-init-context.js +5 -0
- package/cjs/document/common/document-node.js +25 -29
- package/cjs/document/common/value.js +9 -3
- package/cjs/document/constants.js +1 -2
- package/cjs/document/data-type/api-field.js +19 -4
- package/cjs/document/data-type/complex-type-base.js +24 -7
- package/cjs/document/data-type/complex-type.js +17 -6
- package/cjs/document/data-type/data-type.js +16 -1
- package/cjs/document/data-type/enum-type.js +12 -3
- package/cjs/document/data-type/extended-types/base64.type.js +1 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +1 -0
- package/cjs/document/data-type/extended-types/date-time-string.type.js +1 -0
- package/cjs/document/data-type/extended-types/date-time.type.js +6 -1
- package/cjs/document/data-type/extended-types/date.type.js +6 -1
- package/cjs/document/data-type/extended-types/email.type.js +1 -0
- package/cjs/document/data-type/extended-types/field-path.type.js +9 -3
- package/cjs/document/data-type/extended-types/filter.type.js +14 -5
- package/cjs/document/data-type/extended-types/object-id.type.js +1 -0
- package/cjs/document/data-type/extended-types/operation-result.type.js +1 -0
- package/cjs/document/data-type/extended-types/time.type.js +1 -0
- package/cjs/document/data-type/extended-types/url.type.js +1 -0
- package/cjs/document/data-type/extended-types/uuid.type.js +1 -0
- package/cjs/document/data-type/mapped-type.js +21 -9
- package/cjs/document/data-type/mixin-type.js +10 -5
- package/cjs/document/data-type/primitive-types/any.type.js +1 -0
- package/cjs/document/data-type/primitive-types/bigint.type.js +4 -1
- package/cjs/document/data-type/primitive-types/boolean.type.js +1 -0
- package/cjs/document/data-type/primitive-types/integer.type.js +4 -1
- package/cjs/document/data-type/primitive-types/null.type.js +1 -0
- package/cjs/document/data-type/primitive-types/number.type.js +4 -1
- package/cjs/document/data-type/primitive-types/string.type.js +4 -1
- package/cjs/document/data-type/simple-type.js +17 -5
- package/cjs/document/data-type/utils/create-mapped-class.js +3 -1
- package/cjs/document/decorators/api-field-decorator.js +2 -1
- package/cjs/document/decorators/complex-type.decorator.js +1 -1
- package/cjs/document/decorators/http-controller.decorator.js +7 -1
- package/cjs/document/decorators/http-operation-entity.decorator.js +20 -10
- package/cjs/document/decorators/http-operation.decorator.js +23 -10
- package/cjs/document/decorators/rpc-operation.decorator.js +1 -2
- package/cjs/document/decorators/simple-type.decorator.js +3 -2
- package/cjs/document/factory/api-document.factory.js +12 -3
- package/cjs/document/factory/data-type.factory.js +19 -7
- package/cjs/document/factory/http-api.factory.js +13 -4
- package/cjs/document/http/http-api.js +2 -2
- package/cjs/document/http/http-controller.js +7 -6
- package/cjs/document/http/http-media-type.js +18 -8
- package/cjs/document/http/http-multipart-field.js +2 -2
- package/cjs/document/http/http-operation-response.js +11 -6
- package/cjs/document/http/http-operation.js +8 -6
- package/cjs/document/http/http-parameter.js +2 -2
- package/cjs/document/http/http-request-body.js +4 -2
- package/cjs/document/http/http-status-range.js +3 -1
- package/cjs/document/rpc/rpc-operation-response.js +11 -3
- package/cjs/document/rpc/rpc-operation.js +11 -3
- package/cjs/document/utils/parse-regexp.util.js +2 -2
- package/cjs/exception/opra-exception.js +3 -1
- package/cjs/filter/antlr/OpraFilterLexer.js +190 -123
- package/cjs/filter/antlr/OpraFilterParser.js +53 -35
- package/cjs/filter/ast/expressions/arithmetic-expression.js +3 -1
- package/cjs/filter/ast/terms/number-literal.js +3 -1
- package/cjs/filter/filter-rules.js +18 -8
- package/cjs/filter/filter-tree-visitor.js +2 -1
- package/cjs/filter/opra-error-listener.js +7 -1
- package/cjs/filter/parse.js +3 -1
- package/cjs/filter/utils.js +3 -1
- package/cjs/helpers/get-stack-filename.js +6 -2
- package/cjs/helpers/mixin-utils.js +7 -2
- package/cjs/helpers/object-utils.js +3 -1
- package/cjs/helpers/parse-fields-projection.js +4 -2
- package/cjs/helpers/type-guards.js +7 -2
- package/cjs/i18n/i18n.js +13 -3
- package/cjs/i18n/translate.js +3 -1
- package/cjs/polifils/array-find-last.js +0 -2
- package/esm/document/api-document.js +17 -10
- package/esm/document/common/api-base.js +4 -2
- package/esm/document/common/data-type-map.js +14 -3
- package/esm/document/common/document-init-context.js +5 -0
- package/esm/document/common/document-node.js +25 -29
- package/esm/document/common/value.js +9 -3
- package/esm/document/constants.js +0 -1
- package/esm/document/data-type/api-field.js +19 -4
- package/esm/document/data-type/complex-type-base.js +25 -8
- package/esm/document/data-type/complex-type.js +17 -6
- package/esm/document/data-type/data-type.js +17 -2
- package/esm/document/data-type/enum-type.js +12 -3
- package/esm/document/data-type/extended-types/base64.type.js +1 -0
- package/esm/document/data-type/extended-types/date-string.type.js +1 -0
- package/esm/document/data-type/extended-types/date-time-string.type.js +1 -0
- package/esm/document/data-type/extended-types/date-time.type.js +6 -1
- package/esm/document/data-type/extended-types/date.type.js +6 -1
- package/esm/document/data-type/extended-types/email.type.js +1 -0
- package/esm/document/data-type/extended-types/field-path.type.js +9 -3
- package/esm/document/data-type/extended-types/filter.type.js +14 -5
- package/esm/document/data-type/extended-types/object-id.type.js +1 -0
- package/esm/document/data-type/extended-types/operation-result.type.js +1 -0
- package/esm/document/data-type/extended-types/time.type.js +1 -0
- package/esm/document/data-type/extended-types/url.type.js +1 -0
- package/esm/document/data-type/extended-types/uuid.type.js +1 -0
- package/esm/document/data-type/mapped-type.js +21 -9
- package/esm/document/data-type/mixin-type.js +11 -6
- package/esm/document/data-type/primitive-types/any.type.js +1 -0
- package/esm/document/data-type/primitive-types/bigint.type.js +4 -1
- package/esm/document/data-type/primitive-types/boolean.type.js +1 -0
- package/esm/document/data-type/primitive-types/integer.type.js +4 -1
- package/esm/document/data-type/primitive-types/null.type.js +1 -0
- package/esm/document/data-type/primitive-types/number.type.js +4 -1
- package/esm/document/data-type/primitive-types/string.type.js +4 -1
- package/esm/document/data-type/simple-type.js +18 -6
- package/esm/document/data-type/utils/create-mapped-class.js +4 -2
- package/esm/document/decorators/api-field-decorator.js +2 -1
- package/esm/document/decorators/complex-type.decorator.js +2 -2
- package/esm/document/decorators/http-controller.decorator.js +7 -1
- package/esm/document/decorators/http-operation-entity.decorator.js +22 -12
- package/esm/document/decorators/http-operation.decorator.js +23 -10
- package/esm/document/decorators/rpc-operation.decorator.js +1 -2
- package/esm/document/decorators/simple-type.decorator.js +4 -3
- package/esm/document/factory/api-document.factory.js +12 -3
- package/esm/document/factory/data-type.factory.js +21 -9
- package/esm/document/factory/http-api.factory.js +13 -4
- package/esm/document/http/http-api.js +2 -2
- package/esm/document/http/http-controller.js +8 -7
- package/esm/document/http/http-media-type.js +18 -8
- package/esm/document/http/http-multipart-field.js +2 -2
- package/esm/document/http/http-operation-response.js +11 -6
- package/esm/document/http/http-operation.js +9 -7
- package/esm/document/http/http-parameter.js +3 -3
- package/esm/document/http/http-request-body.js +4 -2
- package/esm/document/http/http-status-range.js +3 -1
- package/esm/document/rpc/rpc-controller.js +1 -1
- package/esm/document/rpc/rpc-header.js +1 -1
- package/esm/document/rpc/rpc-operation-response.js +11 -3
- package/esm/document/rpc/rpc-operation.js +12 -4
- package/esm/document/utils/parse-regexp.util.js +2 -2
- package/esm/exception/opra-exception.js +3 -1
- package/esm/filter/antlr/OpraFilterLexer.js +190 -123
- package/esm/filter/antlr/OpraFilterParser.js +53 -35
- package/esm/filter/ast/expressions/arithmetic-expression.js +3 -1
- package/esm/filter/ast/terms/number-literal.js +3 -1
- package/esm/filter/filter-rules.js +18 -8
- package/esm/filter/filter-tree-visitor.js +2 -1
- package/esm/filter/opra-error-listener.js +8 -2
- package/esm/filter/parse.js +3 -1
- package/esm/filter/utils.js +3 -1
- package/esm/helpers/get-stack-filename.js +6 -2
- package/esm/helpers/mixin-utils.js +7 -2
- package/esm/helpers/object-utils.js +3 -1
- package/esm/helpers/parse-fields-projection.js +4 -2
- package/esm/helpers/type-guards.js +7 -2
- package/esm/i18n/i18n.js +13 -3
- package/esm/i18n/translate.js +3 -1
- package/esm/polifils/array-find-last.js +0 -2
- package/package.json +1 -1
- package/types/document/api-document.d.ts +8 -2
- package/types/document/common/api-base.d.ts +1 -1
- package/types/document/common/document-init-context.d.ts +2 -0
- package/types/document/common/document-node.d.ts +8 -14
- package/types/document/common/value.d.ts +2 -1
- package/types/document/constants.d.ts +0 -1
- package/types/document/data-type/api-field.d.ts +6 -11
- package/types/document/data-type/complex-type.d.ts +2 -1
- package/types/document/data-type/data-type.d.ts +7 -2
- package/types/document/data-type/enum-type.d.ts +2 -1
- package/types/document/data-type/extended-types/field-path.type.d.ts +2 -1
- package/types/document/data-type/extended-types/filter.type.d.ts +2 -1
- package/types/document/data-type/mapped-type.d.ts +2 -1
- package/types/document/data-type/mixin-type.d.ts +2 -1
- package/types/document/data-type/simple-type.d.ts +2 -1
- package/types/document/factory/api-document.factory.d.ts +2 -1
- package/types/document/http/http-api.d.ts +1 -1
- package/types/document/http/http-controller.d.ts +2 -1
- package/types/document/http/http-media-type.d.ts +2 -1
- package/types/document/http/http-multipart-field.d.ts +2 -1
- package/types/document/http/http-operation-response.d.ts +2 -1
- package/types/document/http/http-operation.d.ts +2 -1
- package/types/document/http/http-parameter.d.ts +2 -1
- package/types/document/http/http-request-body.d.ts +2 -1
- package/types/filter/filter-rules.d.ts +3 -3
|
@@ -10,6 +10,7 @@ export declare namespace ApiDocumentFactory {
|
|
|
10
10
|
references?: Record<string, ReferenceThunk>;
|
|
11
11
|
types?: DataTypeInitSources;
|
|
12
12
|
api?: StrictOmit<HttpApiFactory.InitArguments, 'owner'> | StrictOmit<RpcApiFactory.InitArguments, 'owner'>;
|
|
13
|
+
scopes?: string | string[];
|
|
13
14
|
}
|
|
14
15
|
type ReferenceSource = string | OpraSchema.ApiDocument | InitArguments | ApiDocument;
|
|
15
16
|
type ReferenceThunk = ThunkAsync<ReferenceSource>;
|
|
@@ -23,7 +24,7 @@ export declare class ApiDocumentFactory {
|
|
|
23
24
|
/**
|
|
24
25
|
* Creates ApiDocument instance from given schema object
|
|
25
26
|
*/
|
|
26
|
-
static createDocument(schemaOrUrl: string | PartialSome<OpraSchema.ApiDocument, 'spec'> | ApiDocumentFactory.InitArguments, options?: Partial<Pick<DocumentInitContext, 'maxErrors' | 'showErrorDetails'>> | DocumentInitContext): Promise<ApiDocument>;
|
|
27
|
+
static createDocument(schemaOrUrl: string | PartialSome<OpraSchema.ApiDocument, 'spec'> | ApiDocumentFactory.InitArguments, options?: Partial<Pick<DocumentInitContext, 'maxErrors' | 'showErrorDetails' | 'scopes'>> | DocumentInitContext): Promise<ApiDocument>;
|
|
27
28
|
/**
|
|
28
29
|
* Downloads schema from the given URL and creates the document instance * @param url
|
|
29
30
|
*/
|
|
@@ -24,5 +24,5 @@ export declare class HttpApi extends ApiBase {
|
|
|
24
24
|
findController(resourcePath: string): HttpController | undefined;
|
|
25
25
|
findOperation(controller: Type, operationName: string): HttpOperation | undefined;
|
|
26
26
|
findOperation(resourcePath: string, operationName: string): HttpOperation | undefined;
|
|
27
|
-
toJSON(): OpraSchema.HttpApi;
|
|
27
|
+
toJSON(options: ApiDocument.ExportOptions): OpraSchema.HttpApi;
|
|
28
28
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Combine, ThunkAsync, Type } from 'ts-gems';
|
|
2
2
|
import { ResponsiveMap } from '../../helpers/index.js';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
|
+
import type { ApiDocument } from '../api-document.js';
|
|
4
5
|
import { DataTypeMap } from '../common/data-type-map.js';
|
|
5
6
|
import { DocumentElement } from '../common/document-element.js';
|
|
6
7
|
import type { EnumType } from '../data-type/enum-type.js';
|
|
@@ -84,7 +85,7 @@ declare class HttpControllerClass extends DocumentElement {
|
|
|
84
85
|
/**
|
|
85
86
|
*
|
|
86
87
|
*/
|
|
87
|
-
toJSON(): OpraSchema.HttpController;
|
|
88
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpController;
|
|
88
89
|
/**
|
|
89
90
|
*
|
|
90
91
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Combine, StrictOmit, Type } from 'ts-gems';
|
|
2
2
|
import { type Validator } from 'valgen';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
|
+
import type { ApiDocument } from '../api-document.js';
|
|
4
5
|
import { DocumentElement } from '../common/document-element.js';
|
|
5
6
|
import { DataType } from '../data-type/data-type.js';
|
|
6
7
|
import type { HttpMultipartField } from './http-multipart-field.js';
|
|
@@ -54,7 +55,7 @@ declare class HttpMediaTypeClass extends DocumentElement {
|
|
|
54
55
|
maxFileSize?: number;
|
|
55
56
|
maxTotalFileSize?: number;
|
|
56
57
|
findMultipartField(fieldName: string, fieldType?: OpraSchema.HttpMultipartFieldType): HttpMultipartField | undefined;
|
|
57
|
-
toJSON(): OpraSchema.HttpMediaType;
|
|
58
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpMediaType;
|
|
58
59
|
generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
|
|
59
60
|
}
|
|
60
61
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Combine } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document';
|
|
3
4
|
import { HttpMediaType } from './http-media-type.js';
|
|
4
5
|
/**
|
|
5
6
|
* @namespace HttpMultipartField
|
|
@@ -21,5 +22,5 @@ export declare class HttpMultipartField extends HttpMediaType {
|
|
|
21
22
|
fieldType: OpraSchema.HttpMultipartFieldType;
|
|
22
23
|
required?: boolean;
|
|
23
24
|
constructor(owner: HttpMediaType | HttpMultipartField, initArgs: HttpMultipartField.InitArguments);
|
|
24
|
-
toJSON(): OpraSchema.HttpMultipartField;
|
|
25
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpMultipartField;
|
|
25
26
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Combine, StrictOmit } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document';
|
|
3
4
|
import { HttpMediaType } from './http-media-type.js';
|
|
4
5
|
import { HttpOperation } from './http-operation.js';
|
|
5
6
|
import type { HttpParameter } from './http-parameter.js';
|
|
@@ -32,5 +33,5 @@ export declare class HttpOperationResponse extends HttpMediaType {
|
|
|
32
33
|
partial?: boolean | 'deep';
|
|
33
34
|
constructor(owner: HttpOperation, init: HttpOperationResponse.InitArguments);
|
|
34
35
|
findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
|
|
35
|
-
toJSON(): OpraSchema.HttpOperationResponse;
|
|
36
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpOperationResponse;
|
|
36
37
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Combine, StrictOmit, ThunkAsync, Type } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document';
|
|
3
4
|
import { DataTypeMap } from '../common/data-type-map.js';
|
|
4
5
|
import { DocumentElement } from '../common/document-element.js';
|
|
5
6
|
import type { DataType } from '../data-type/data-type.js';
|
|
@@ -82,6 +83,6 @@ declare class HttpOperationClass extends DocumentElement {
|
|
|
82
83
|
compositionOptions?: Record<string, any>;
|
|
83
84
|
findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
|
|
84
85
|
getFullUrl(): string;
|
|
85
|
-
toJSON(): OpraSchema.HttpOperation;
|
|
86
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpOperation;
|
|
86
87
|
}
|
|
87
88
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Combine, type StrictOmit, type TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import type { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document';
|
|
3
4
|
import { DocumentElement } from '../common/document-element.js';
|
|
4
5
|
import { Value } from '../common/value.js';
|
|
5
6
|
import { DataType } from '../data-type/data-type.js';
|
|
@@ -46,6 +47,6 @@ declare class HttpParameterClass extends Value {
|
|
|
46
47
|
deprecated?: boolean | string;
|
|
47
48
|
required?: boolean;
|
|
48
49
|
arraySeparator?: string;
|
|
49
|
-
toJSON(): OpraSchema.HttpParameter;
|
|
50
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpParameter;
|
|
50
51
|
}
|
|
51
52
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StrictOmit } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document';
|
|
3
4
|
import { DocumentElement } from '../common/document-element.js';
|
|
4
5
|
import { HttpMediaType } from './http-media-type.js';
|
|
5
6
|
import type { HttpOperation } from './http-operation';
|
|
@@ -30,5 +31,5 @@ export declare class HttpRequestBody extends DocumentElement {
|
|
|
30
31
|
partial?: boolean | 'deep';
|
|
31
32
|
allowPatchOperators?: boolean;
|
|
32
33
|
constructor(owner: HttpOperation);
|
|
33
|
-
toJSON(): OpraSchema.HttpRequestBody;
|
|
34
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpRequestBody;
|
|
34
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../polifils/array-find-last.js';
|
|
2
2
|
import type { StrictOmit } from 'ts-gems';
|
|
3
3
|
import { Validator } from 'valgen';
|
|
4
|
-
import type { ComplexType } from '../document/index.js';
|
|
4
|
+
import type { ComplexType, DocumentElement } from '../document/index.js';
|
|
5
5
|
import { ResponsiveMap } from '../helpers/index.js';
|
|
6
6
|
import { OpraSchema } from '../schema/index.js';
|
|
7
7
|
import { type ComparisonOperator, Expression } from './ast/index.js';
|
|
@@ -21,8 +21,8 @@ export declare class FilterRules {
|
|
|
21
21
|
set(fieldName: string, options?: Partial<StrictOmit<FilterRules.Rule, 'operators'>> & {
|
|
22
22
|
operators?: ComparisonOperator[] | string;
|
|
23
23
|
}): void;
|
|
24
|
-
normalizeFilter(filter: OpraSchema.Field.QualifiedName | Expression, currentType?: ComplexType): Expression | undefined;
|
|
25
|
-
protected normalizeFilterAst(ast: Expression, stack: Expression[], currentType?: ComplexType): Expression | undefined;
|
|
24
|
+
normalizeFilter(filter: OpraSchema.Field.QualifiedName | Expression, currentType?: ComplexType, element?: DocumentElement): Expression | undefined;
|
|
25
|
+
protected normalizeFilterAst(ast: Expression, stack: Expression[], currentType?: ComplexType, scopes?: string[]): Expression | undefined;
|
|
26
26
|
toJSON(): Record<string, FilterRules.Rule>;
|
|
27
27
|
[Symbol.iterator](): IterableIterator<[string, FilterRules.Rule]>;
|
|
28
28
|
}
|