@opra/common 1.7.4 → 1.9.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/data-type/api-field.js +2 -0
- package/cjs/document/data-type/enum-type.js +2 -2
- package/cjs/document/decorators/api-field-decorator.js +1 -0
- package/cjs/document/decorators/http-operation-entity-create.decorator.js +58 -0
- package/cjs/document/decorators/http-operation-entity-delete-many.decorator.js +41 -0
- package/cjs/document/decorators/http-operation-entity-delete.decorator.js +41 -0
- package/cjs/document/decorators/http-operation-entity-find-many.decorator.js +85 -0
- package/cjs/document/decorators/http-operation-entity-get.decorator.js +56 -0
- package/cjs/document/decorators/http-operation-entity-replace.decorator.js +56 -0
- package/cjs/document/decorators/http-operation-entity-update-many.decorator.js +50 -0
- package/cjs/document/decorators/http-operation-entity-update.decorator.js +66 -0
- package/cjs/document/decorators/http-operation-entity.decorator.js +83 -525
- package/cjs/document/http/http-parameter.js +1 -0
- package/cjs/document/index.js +9 -1
- package/cjs/filter/antlr/OpraFilterLexer.js +212 -347
- package/cjs/filter/antlr/OpraFilterListener.js +1 -1
- package/cjs/filter/antlr/OpraFilterParser.js +198 -227
- package/cjs/filter/antlr/OpraFilterVisitor.js +1 -1
- package/cjs/filter/ast/index.js +1 -0
- package/cjs/filter/ast/terms/date-time-literal.js +27 -0
- package/cjs/filter/build.js +3 -1
- package/cjs/filter/filter-rules.js +2 -1
- package/cjs/filter/filter-tree-visitor.js +1 -1
- package/esm/document/data-type/api-field.js +2 -0
- package/esm/document/data-type/enum-type.js +2 -2
- package/esm/document/decorators/api-field-decorator.js +1 -0
- package/esm/document/decorators/http-operation-entity-create.decorator.js +56 -0
- package/esm/document/decorators/http-operation-entity-delete-many.decorator.js +39 -0
- package/esm/document/decorators/http-operation-entity-delete.decorator.js +39 -0
- package/esm/document/decorators/http-operation-entity-find-many.decorator.js +83 -0
- package/esm/document/decorators/http-operation-entity-get.decorator.js +54 -0
- package/esm/document/decorators/http-operation-entity-replace.decorator.js +54 -0
- package/esm/document/decorators/http-operation-entity-update-many.decorator.js +48 -0
- package/esm/document/decorators/http-operation-entity-update.decorator.js +64 -0
- package/esm/document/decorators/http-operation-entity.decorator.js +79 -525
- package/esm/document/http/http-parameter.js +1 -0
- package/esm/document/index.js +9 -1
- package/esm/filter/antlr/OpraFilterLexer.js +213 -348
- package/esm/filter/antlr/OpraFilterListener.js +2 -2
- package/esm/filter/antlr/OpraFilterParser.js +198 -227
- package/esm/filter/antlr/OpraFilterVisitor.js +1 -1
- package/esm/filter/ast/index.js +1 -0
- package/esm/filter/ast/terms/date-time-literal.js +23 -0
- package/esm/filter/build.js +3 -1
- package/esm/filter/filter-rules.js +2 -1
- package/esm/filter/filter-tree-visitor.js +2 -2
- package/package.json +2 -2
- package/types/document/data-type/api-field.d.ts +2 -1
- package/types/document/data-type/enum-type.d.ts +3 -3
- package/types/document/decorators/api-field-decorator.d.ts +2 -2
- package/types/document/decorators/http-operation-entity-create.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-delete-many.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-delete.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-find-many.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-get.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-replace.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-update-many.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-update.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity.decorator.d.ts +32 -4
- package/types/document/http/http-parameter.d.ts +3 -0
- package/types/document/index.d.ts +9 -1
- package/types/filter/antlr/OpraFilterLexer.d.ts +1 -1
- package/types/filter/antlr/OpraFilterListener.d.ts +36 -10
- package/types/filter/antlr/OpraFilterParser.d.ts +1 -1
- package/types/filter/antlr/OpraFilterVisitor.d.ts +31 -5
- package/types/filter/ast/expressions/comparison-expression.d.ts +1 -0
- package/types/filter/ast/index.d.ts +1 -0
- package/types/filter/ast/terms/date-time-literal.d.ts +6 -0
- package/types/filter/filter-rules.d.ts +1 -0
- package/types/filter/filter-tree-visitor.d.ts +2 -2
- package/types/schema/data-type/field.interface.d.ts +16 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from ./src/filter/antlr/OpraFilter.g4 by ANTLR 4.
|
|
1
|
+
// Generated from ./src/filter/antlr/OpraFilter.g4 by ANTLR 4.13.2
|
|
2
2
|
import { ParseTreeVisitor } from '@browsery/antlr4';
|
|
3
3
|
/**
|
|
4
4
|
* This interface defines a complete generic visitor for a parse tree produced
|
package/esm/filter/ast/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './expressions/negative-expression.js';
|
|
|
10
10
|
export * from './expressions/parenthesized-expression.js';
|
|
11
11
|
export * from './terms/boolean-literal.js';
|
|
12
12
|
export * from './terms/date-literal.js';
|
|
13
|
+
export * from './terms/date-time-literal.js';
|
|
13
14
|
export * from './terms/null-literal.js';
|
|
14
15
|
export * from './terms/number-literal.js';
|
|
15
16
|
export * from './terms/qualified-identifier.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { toDateDef } from 'putil-varhelpers';
|
|
2
|
+
import { FilterValidationError } from '../../errors.js';
|
|
3
|
+
import { quoteFilterString } from '../../utils.js';
|
|
4
|
+
import { Literal } from '../abstract/literal.js';
|
|
5
|
+
const NullDate = new Date(0);
|
|
6
|
+
export class DateTimeLiteral extends Literal {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
super('');
|
|
9
|
+
if (value instanceof Date) {
|
|
10
|
+
this.value = value.toISOString();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// noinspection SuspiciousTypeOfGuard
|
|
14
|
+
if (typeof value === 'string' && toDateDef(value, NullDate) !== NullDate) {
|
|
15
|
+
this.value = value;
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
throw new FilterValidationError(`Invalid date-time value "${value}"`);
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
return quoteFilterString(this.value);
|
|
22
|
+
}
|
|
23
|
+
}
|
package/esm/filter/build.js
CHANGED
|
@@ -81,7 +81,9 @@ export function $arithmetic(n) {
|
|
|
81
81
|
return exp;
|
|
82
82
|
}
|
|
83
83
|
function comparisonExpression(op, left, right) {
|
|
84
|
-
const lex =
|
|
84
|
+
const lex = typeof left === 'string'
|
|
85
|
+
? new QualifiedIdentifier(left)
|
|
86
|
+
: wrapEntryValue(left);
|
|
85
87
|
const rex = wrapEntryValue(right);
|
|
86
88
|
return new ComparisonExpression({ op, left: lex, right: rex });
|
|
87
89
|
}
|
|
@@ -41,7 +41,6 @@ export class FilterRules {
|
|
|
41
41
|
throw new TypeError(`Invalid filter query. Left side should be a data field.`);
|
|
42
42
|
}
|
|
43
43
|
// Check if filtering accepted for given field
|
|
44
|
-
// const findManyOp = this.getOperation('findMany');
|
|
45
44
|
const rule = this._rules.get(ast.left.value);
|
|
46
45
|
if (!rule) {
|
|
47
46
|
throw new OpraException({
|
|
@@ -67,6 +66,8 @@ export class FilterRules {
|
|
|
67
66
|
},
|
|
68
67
|
});
|
|
69
68
|
}
|
|
69
|
+
if (rule.prepare)
|
|
70
|
+
ast.prepare = rule.prepare;
|
|
70
71
|
this.normalizeFilterAst(ast.right, stack, currentType);
|
|
71
72
|
stack.pop();
|
|
72
73
|
return ast;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParseTreeVisitor } from '@browsery/antlr4';
|
|
2
2
|
import { LogicalExpressionContext, } from './antlr/OpraFilterParser.js';
|
|
3
|
-
import { ArrayExpression, BooleanLiteral, ComparisonExpression, DateLiteral, LogicalExpression, NegativeExpression, NullLiteral, NumberLiteral, ParenthesizedExpression, QualifiedIdentifier, StringLiteral, TimeLiteral, } from './ast/index.js';
|
|
3
|
+
import { ArrayExpression, BooleanLiteral, ComparisonExpression, DateLiteral, DateTimeLiteral, LogicalExpression, NegativeExpression, NullLiteral, NumberLiteral, ParenthesizedExpression, QualifiedIdentifier, StringLiteral, TimeLiteral, } from './ast/index.js';
|
|
4
4
|
import { ExternalConstant } from './ast/terms/external-constant.js';
|
|
5
5
|
import { unquoteFilterString } from './utils.js';
|
|
6
6
|
export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
@@ -82,7 +82,7 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
82
82
|
return new DateLiteral(unquoteFilterString(ctx.getText()));
|
|
83
83
|
}
|
|
84
84
|
visitDateTimeLiteral(ctx) {
|
|
85
|
-
return new
|
|
85
|
+
return new DateTimeLiteral(unquoteFilterString(ctx.getText()));
|
|
86
86
|
}
|
|
87
87
|
visitTimeLiteral(ctx) {
|
|
88
88
|
return new TimeLiteral(unquoteFilterString(ctx.getText()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Opra common package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@browsery/antlr4": "^4.13.3-r4",
|
|
9
9
|
"@browsery/highland": "^2.13.6-r4",
|
|
10
10
|
"@browsery/http-parser": "^0.5.9-r4",
|
|
11
|
-
"@browsery/i18next": "^
|
|
11
|
+
"@browsery/i18next": "^24.2.1-r1",
|
|
12
12
|
"@browsery/type-is": "^1.6.18-r8",
|
|
13
13
|
"@jsopen/objects": "^1.5.0",
|
|
14
14
|
"fast-tokenizer": "^1.7.0",
|
|
@@ -43,6 +43,7 @@ declare class ApiFieldClass extends DocumentElement {
|
|
|
43
43
|
readonly type: DataType;
|
|
44
44
|
readonly description?: string;
|
|
45
45
|
readonly isArray?: boolean;
|
|
46
|
+
readonly isNestedEntity?: boolean;
|
|
46
47
|
readonly default?: any;
|
|
47
48
|
readonly fixed?: any;
|
|
48
49
|
readonly required?: boolean;
|
|
@@ -66,7 +67,7 @@ export declare namespace ApiField {
|
|
|
66
67
|
type?: string | OpraSchema.DataType | TypeThunkAsync | EnumType.EnumObject | EnumType.EnumArray | object;
|
|
67
68
|
}, OpraSchema.Field> {
|
|
68
69
|
scopePattern?: (string | RegExp) | (string | RegExp)[];
|
|
69
|
-
override?: StrictOmit<Metadata, 'override' | 'type' | 'isArray'>[];
|
|
70
|
+
override?: StrictOmit<Metadata, 'override' | 'type' | 'isArray' | 'isNestedEntity'>[];
|
|
70
71
|
}
|
|
71
72
|
interface Options extends Partial<StrictOmit<Metadata, 'override' | 'scopePattern'>> {
|
|
72
73
|
/**
|
|
@@ -41,9 +41,9 @@ export interface EnumTypeStatic {
|
|
|
41
41
|
* @constructor
|
|
42
42
|
*/
|
|
43
43
|
new (owner: DocumentElement, args?: EnumType.InitArguments): EnumType;
|
|
44
|
-
<T extends EnumType.EnumObject, B extends EnumType.EnumObject>(enumSource: T, base
|
|
45
|
-
<T extends EnumType.EnumArray, B extends EnumType.EnumArray>(enumSource: T, base
|
|
46
|
-
<T extends EnumType.EnumObject | EnumType.EnumArray>(target: T, options
|
|
44
|
+
<T extends EnumType.EnumObject, B extends EnumType.EnumObject>(enumSource: T, base?: B, options?: EnumType.Options<T>): B & T;
|
|
45
|
+
<T extends EnumType.EnumArray, B extends EnumType.EnumArray>(enumSource: T, base?: B, options?: EnumType.Options<T>): B & T;
|
|
46
|
+
<T extends EnumType.EnumObject | EnumType.EnumArray>(target: T, options?: EnumType.Options<T>): T;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Type definition of EnumType prototype
|
|
@@ -6,11 +6,11 @@ export interface ApiFieldDecorator extends PropertyDecorator {
|
|
|
6
6
|
*
|
|
7
7
|
* @param {string | RegExp | (string | RegExp)[]} scopePattern - A pattern or array of patterns that defines the scope
|
|
8
8
|
* within which the override applies. Patterns can be strings or regular expressions.
|
|
9
|
-
* @param {StrictOmit<ApiField.Options, 'isArray' | 'type' | 'scopePattern'>} options - Configuration options to override
|
|
9
|
+
* @param {StrictOmit<ApiField.Options, 'isArray' | 'isNestedEntity' | 'type' | 'scopePattern'>} options - Configuration options to override
|
|
10
10
|
* the default API field behavior, excluding the properties 'isArray', 'type', and 'scopePattern'.
|
|
11
11
|
* @return {ApiFieldDecorator} The decorated API field after applying the override configuration.
|
|
12
12
|
*/
|
|
13
|
-
Override(scopePattern: (string | RegExp) | (string | RegExp)[], options: StrictOmit<ApiField.Options, 'isArray' | 'type' | 'scopePattern'>): ApiFieldDecorator;
|
|
13
|
+
Override(scopePattern: (string | RegExp) | (string | RegExp)[], options: StrictOmit<ApiField.Options, 'isArray' | 'isNestedEntity' | 'type' | 'scopePattern'>): ApiFieldDecorator;
|
|
14
14
|
}
|
|
15
15
|
export interface ApiFieldDecoratorFactory {
|
|
16
16
|
(options?: ApiField.Options): ApiFieldDecorator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StrictOmit, Type, TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import { OpraFilter } from '../../filter/index.js';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
|
+
import { HttpOperation } from '../http/http-operation.js';
|
|
4
5
|
import type { HttpParameter } from '../http/http-parameter.js';
|
|
5
6
|
import { HttpRequestBody } from '../http/http-request-body.js';
|
|
6
7
|
import { type HttpOperationDecorator } from './http-operation.decorator.js';
|
|
@@ -50,8 +51,14 @@ declare module '../http/http-operation.js' {
|
|
|
50
51
|
type: Type | string;
|
|
51
52
|
}
|
|
52
53
|
/** DeleteMany */
|
|
54
|
+
interface FilterOptions {
|
|
55
|
+
operators?: OpraFilter.ComparisonOperator[];
|
|
56
|
+
notes?: string;
|
|
57
|
+
prepare?: (value: any, op: OpraFilter.ComparisonOperator) => any;
|
|
58
|
+
}
|
|
53
59
|
interface DeleteManyDecorator extends HttpOperationDecorator {
|
|
54
|
-
Filter(field:
|
|
60
|
+
Filter(field: string, operators?: OpraFilter.ComparisonOperator[]): this;
|
|
61
|
+
Filter(field: string, options?: FilterOptions): this;
|
|
55
62
|
}
|
|
56
63
|
interface DeleteManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
57
64
|
type: Type | string;
|
|
@@ -59,8 +66,10 @@ declare module '../http/http-operation.js' {
|
|
|
59
66
|
/** FindMany */
|
|
60
67
|
interface FindManyDecorator extends HttpOperationDecorator {
|
|
61
68
|
SortFields(...fields: OpraSchema.Field.QualifiedName[]): FindManyDecorator;
|
|
69
|
+
SortFields(fieldsMap: Record<OpraSchema.Field.QualifiedName, OpraSchema.Field.QualifiedName>): FindManyDecorator;
|
|
62
70
|
DefaultSort(...fields: OpraSchema.Field.QualifiedName[]): FindManyDecorator;
|
|
63
|
-
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[]
|
|
71
|
+
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[]): this;
|
|
72
|
+
Filter(field: string, options?: FilterOptions): this;
|
|
64
73
|
}
|
|
65
74
|
interface FindManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
66
75
|
type: Type | string;
|
|
@@ -85,7 +94,8 @@ declare module '../http/http-operation.js' {
|
|
|
85
94
|
/** Update */
|
|
86
95
|
interface UpdateDecorator extends HttpOperationDecorator {
|
|
87
96
|
KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
|
|
88
|
-
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[]
|
|
97
|
+
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[]): this;
|
|
98
|
+
Filter(field: string, options?: FilterOptions): this;
|
|
89
99
|
}
|
|
90
100
|
interface UpdateArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
91
101
|
type: Type | string;
|
|
@@ -97,7 +107,8 @@ declare module '../http/http-operation.js' {
|
|
|
97
107
|
}
|
|
98
108
|
/** UpdateMany */
|
|
99
109
|
interface UpdateManyDecorator extends HttpOperationDecorator {
|
|
100
|
-
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[]
|
|
110
|
+
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[]): this;
|
|
111
|
+
Filter(field: string, options?: FilterOptions): this;
|
|
101
112
|
}
|
|
102
113
|
interface UpdateManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
103
114
|
type: Type | string;
|
|
@@ -110,3 +121,20 @@ declare module '../http/http-operation.js' {
|
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @param typ
|
|
127
|
+
*/
|
|
128
|
+
export declare function getDataTypeName(typ: Type | string): string;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
export declare function createKeyParamDecorator<T extends HttpOperationDecorator>(decorator: T, decoratorChain: Function[]): (name: string, prmOptions?: StrictOmit<HttpParameter.Options, "location"> | string | Type) => T;
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
export declare function createSortFieldsDecorator<T extends HttpOperationDecorator>(decorator: T, decoratorChain: Function[]): (...varargs: any[]) => T;
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
export declare function createFilterDecorator<T extends HttpOperationDecorator>(decorator: T, decoratorChain: Function[], dataType: string | Type): (field: string, arg0?: OpraFilter.ComparisonOperator[] | HttpOperation.Entity.FilterOptions) => T;
|
|
@@ -16,10 +16,12 @@ export declare namespace HttpParameter {
|
|
|
16
16
|
}
|
|
17
17
|
interface Options extends Partial<StrictOmit<Metadata, 'type'>> {
|
|
18
18
|
type?: string | TypeThunkAsync | object;
|
|
19
|
+
parser?: (v: any) => any;
|
|
19
20
|
}
|
|
20
21
|
interface InitArguments extends Combine<{
|
|
21
22
|
type?: DataType;
|
|
22
23
|
}, Metadata> {
|
|
24
|
+
parser?: (v: any) => any;
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
@@ -47,6 +49,7 @@ declare class HttpParameterClass extends Value {
|
|
|
47
49
|
deprecated?: boolean | string;
|
|
48
50
|
required?: boolean;
|
|
49
51
|
arraySeparator?: string;
|
|
52
|
+
parser?: (v: any) => any;
|
|
50
53
|
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.HttpParameter;
|
|
51
54
|
}
|
|
52
55
|
export {};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
+
import './decorators/http-operation-entity.decorator.js';
|
|
3
|
+
import './decorators/http-operation-entity-create.decorator.js';
|
|
4
|
+
import './decorators/http-operation-entity-delete.decorator.js';
|
|
5
|
+
import './decorators/http-operation-entity-delete-many.decorator.js';
|
|
6
|
+
import './decorators/http-operation-entity-find-many.decorator.js';
|
|
7
|
+
import './decorators/http-operation-entity-get.decorator.js';
|
|
8
|
+
import './decorators/http-operation-entity-replace.decorator.js';
|
|
9
|
+
import './decorators/http-operation-entity-update.decorator.js';
|
|
10
|
+
import './decorators/http-operation-entity-update-many.decorator.js';
|
|
2
11
|
import * as RpcControllerDecorator_ from './decorators/rpc-controller.decorator.js';
|
|
3
12
|
import * as RpcOperationDecorator_ from './decorators/rpc-operation.decorator.js';
|
|
4
13
|
import * as DataTypeFactory_ from './factory/data-type.factory.js';
|
|
@@ -24,7 +33,6 @@ export * from './data-type/pick-type.js';
|
|
|
24
33
|
export * from './data-type/primitive-types/index.js';
|
|
25
34
|
export * from './data-type/required-type.js';
|
|
26
35
|
export * from './data-type/simple-type.js';
|
|
27
|
-
export * from './decorators/http-operation-entity.decorator.js';
|
|
28
36
|
export type { RpcControllerDecorator } from './decorators/rpc-controller.decorator.js';
|
|
29
37
|
export type { RpcOperationDecorator } from './decorators/rpc-operation.decorator.js';
|
|
30
38
|
export * from './factory/api-document.factory.js';
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
import { ParseTreeListener } from
|
|
2
|
-
import {
|
|
1
|
+
import { ParseTreeListener } from "@browsery/antlr4";
|
|
2
|
+
import type { RootContext } from "./OpraFilterParser.js";
|
|
3
|
+
import type { ParenthesizedExpressionContext } from "./OpraFilterParser.js";
|
|
4
|
+
import type { NegativeExpressionContext } from "./OpraFilterParser.js";
|
|
5
|
+
import type { ComparisonExpressionContext } from "./OpraFilterParser.js";
|
|
6
|
+
import type { LogicalExpressionContext } from "./OpraFilterParser.js";
|
|
7
|
+
import type { ComparisonLeftContext } from "./OpraFilterParser.js";
|
|
8
|
+
import type { ComparisonRightContext } from "./OpraFilterParser.js";
|
|
9
|
+
import type { ParenthesizedItemContext } from "./OpraFilterParser.js";
|
|
10
|
+
import type { NumberLiteralContext } from "./OpraFilterParser.js";
|
|
11
|
+
import type { InfinityLiteralContext } from "./OpraFilterParser.js";
|
|
12
|
+
import type { BooleanLiteralContext } from "./OpraFilterParser.js";
|
|
13
|
+
import type { NullLiteralContext } from "./OpraFilterParser.js";
|
|
14
|
+
import type { DateTimeLiteralContext } from "./OpraFilterParser.js";
|
|
15
|
+
import type { DateLiteralContext } from "./OpraFilterParser.js";
|
|
16
|
+
import type { TimeLiteralContext } from "./OpraFilterParser.js";
|
|
17
|
+
import { type StringLiteralContext } from "./OpraFilterParser.js";
|
|
18
|
+
import type { QualifiedIdentifierContext } from "./OpraFilterParser.js";
|
|
19
|
+
import type { ExternalConstantContext } from "./OpraFilterParser.js";
|
|
20
|
+
import type { IdentifierContext } from "./OpraFilterParser.js";
|
|
21
|
+
import type { ArrayValueContext } from "./OpraFilterParser.js";
|
|
22
|
+
import type { BooleanContext } from "./OpraFilterParser.js";
|
|
23
|
+
import type { NullContext } from "./OpraFilterParser.js";
|
|
24
|
+
import type { InfinityContext } from "./OpraFilterParser.js";
|
|
25
|
+
import type { ArithmeticOperatorContext } from "./OpraFilterParser.js";
|
|
26
|
+
import type { ComparisonOperatorContext } from "./OpraFilterParser.js";
|
|
27
|
+
import type { LogicalOperatorContext } from "./OpraFilterParser.js";
|
|
28
|
+
import type { PolarityOperatorContext } from "./OpraFilterParser.js";
|
|
3
29
|
/**
|
|
4
30
|
* This interface defines a complete listener for a parse tree produced by
|
|
5
31
|
* `OpraFilterParser`.
|
|
@@ -142,29 +168,29 @@ export default class OpraFilterListener extends ParseTreeListener {
|
|
|
142
168
|
*/
|
|
143
169
|
exitNullLiteral?: (ctx: NullLiteralContext) => void;
|
|
144
170
|
/**
|
|
145
|
-
* Enter a parse tree produced by the `
|
|
171
|
+
* Enter a parse tree produced by the `dateTimeLiteral`
|
|
146
172
|
* labeled alternative in `OpraFilterParser.value`.
|
|
147
173
|
* @param ctx the parse tree
|
|
148
174
|
*/
|
|
149
|
-
|
|
175
|
+
enterDateTimeLiteral?: (ctx: DateTimeLiteralContext) => void;
|
|
150
176
|
/**
|
|
151
|
-
* Exit a parse tree produced by the `
|
|
177
|
+
* Exit a parse tree produced by the `dateTimeLiteral`
|
|
152
178
|
* labeled alternative in `OpraFilterParser.value`.
|
|
153
179
|
* @param ctx the parse tree
|
|
154
180
|
*/
|
|
155
|
-
|
|
181
|
+
exitDateTimeLiteral?: (ctx: DateTimeLiteralContext) => void;
|
|
156
182
|
/**
|
|
157
|
-
* Enter a parse tree produced by the `
|
|
183
|
+
* Enter a parse tree produced by the `dateLiteral`
|
|
158
184
|
* labeled alternative in `OpraFilterParser.value`.
|
|
159
185
|
* @param ctx the parse tree
|
|
160
186
|
*/
|
|
161
|
-
|
|
187
|
+
enterDateLiteral?: (ctx: DateLiteralContext) => void;
|
|
162
188
|
/**
|
|
163
|
-
* Exit a parse tree produced by the `
|
|
189
|
+
* Exit a parse tree produced by the `dateLiteral`
|
|
164
190
|
* labeled alternative in `OpraFilterParser.value`.
|
|
165
191
|
* @param ctx the parse tree
|
|
166
192
|
*/
|
|
167
|
-
|
|
193
|
+
exitDateLiteral?: (ctx: DateLiteralContext) => void;
|
|
168
194
|
/**
|
|
169
195
|
* Enter a parse tree produced by the `timeLiteral`
|
|
170
196
|
* labeled alternative in `OpraFilterParser.value`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ATN, DFA, FailedPredicateException, Parser, ParserRuleContext,
|
|
1
|
+
import { ATN, DFA, FailedPredicateException, Parser, ParserRuleContext, RuleContext, TerminalNode, TokenStream } from '@browsery/antlr4';
|
|
2
2
|
import type OpraFilterListener from './OpraFilterListener.js';
|
|
3
3
|
import type OpraFilterVisitor from './OpraFilterVisitor.js';
|
|
4
4
|
export default class OpraFilterParser extends Parser {
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
import { ParseTreeVisitor } from '@browsery/antlr4';
|
|
2
|
-
import {
|
|
2
|
+
import type { RootContext } from "./OpraFilterParser.js";
|
|
3
|
+
import type { ParenthesizedExpressionContext } from "./OpraFilterParser.js";
|
|
4
|
+
import type { NegativeExpressionContext } from "./OpraFilterParser.js";
|
|
5
|
+
import type { ComparisonExpressionContext } from "./OpraFilterParser.js";
|
|
6
|
+
import type { LogicalExpressionContext } from "./OpraFilterParser.js";
|
|
7
|
+
import type { ComparisonLeftContext } from "./OpraFilterParser.js";
|
|
8
|
+
import type { ComparisonRightContext } from "./OpraFilterParser.js";
|
|
9
|
+
import type { ParenthesizedItemContext } from "./OpraFilterParser.js";
|
|
10
|
+
import type { NumberLiteralContext } from "./OpraFilterParser.js";
|
|
11
|
+
import type { InfinityLiteralContext } from "./OpraFilterParser.js";
|
|
12
|
+
import type { BooleanLiteralContext } from "./OpraFilterParser.js";
|
|
13
|
+
import type { NullLiteralContext } from "./OpraFilterParser.js";
|
|
14
|
+
import type { DateTimeLiteralContext } from "./OpraFilterParser.js";
|
|
15
|
+
import type { DateLiteralContext } from "./OpraFilterParser.js";
|
|
16
|
+
import type { TimeLiteralContext } from "./OpraFilterParser.js";
|
|
17
|
+
import type { StringLiteralContext } from "./OpraFilterParser.js";
|
|
18
|
+
import type { QualifiedIdentifierContext } from "./OpraFilterParser.js";
|
|
19
|
+
import type { ExternalConstantContext } from "./OpraFilterParser.js";
|
|
20
|
+
import type { IdentifierContext } from "./OpraFilterParser.js";
|
|
21
|
+
import type { ArrayValueContext } from "./OpraFilterParser.js";
|
|
22
|
+
import type { BooleanContext } from "./OpraFilterParser.js";
|
|
23
|
+
import type { NullContext } from "./OpraFilterParser.js";
|
|
24
|
+
import type { InfinityContext } from "./OpraFilterParser.js";
|
|
25
|
+
import type { ArithmeticOperatorContext } from "./OpraFilterParser.js";
|
|
26
|
+
import type { ComparisonOperatorContext } from "./OpraFilterParser.js";
|
|
27
|
+
import type { LogicalOperatorContext } from "./OpraFilterParser.js";
|
|
28
|
+
import type { PolarityOperatorContext } from "./OpraFilterParser.js";
|
|
3
29
|
/**
|
|
4
30
|
* This interface defines a complete generic visitor for a parse tree produced
|
|
5
31
|
* by `OpraFilterParser`.
|
|
@@ -89,19 +115,19 @@ export default class OpraFilterVisitor<Result> extends ParseTreeVisitor<Result>
|
|
|
89
115
|
*/
|
|
90
116
|
visitNullLiteral?: (ctx: NullLiteralContext) => Result;
|
|
91
117
|
/**
|
|
92
|
-
* Visit a parse tree produced by the `
|
|
118
|
+
* Visit a parse tree produced by the `dateTimeLiteral`
|
|
93
119
|
* labeled alternative in `OpraFilterParser.value`.
|
|
94
120
|
* @param ctx the parse tree
|
|
95
121
|
* @return the visitor result
|
|
96
122
|
*/
|
|
97
|
-
|
|
123
|
+
visitDateTimeLiteral?: (ctx: DateTimeLiteralContext) => Result;
|
|
98
124
|
/**
|
|
99
|
-
* Visit a parse tree produced by the `
|
|
125
|
+
* Visit a parse tree produced by the `dateLiteral`
|
|
100
126
|
* labeled alternative in `OpraFilterParser.value`.
|
|
101
127
|
* @param ctx the parse tree
|
|
102
128
|
* @return the visitor result
|
|
103
129
|
*/
|
|
104
|
-
|
|
130
|
+
visitDateLiteral?: (ctx: DateLiteralContext) => Result;
|
|
105
131
|
/**
|
|
106
132
|
* Visit a parse tree produced by the `timeLiteral`
|
|
107
133
|
* labeled alternative in `OpraFilterParser.value`.
|
|
@@ -5,6 +5,7 @@ export declare class ComparisonExpression extends Expression {
|
|
|
5
5
|
op: ComparisonOperator;
|
|
6
6
|
left: Expression;
|
|
7
7
|
right: Expression;
|
|
8
|
+
prepare?: (value: any, op: ComparisonOperator) => any;
|
|
8
9
|
constructor(o: StrictOmit<ComparisonExpression, 'kind'>);
|
|
9
10
|
toString(): string;
|
|
10
11
|
}
|
|
@@ -10,6 +10,7 @@ export * from './expressions/negative-expression.js';
|
|
|
10
10
|
export * from './expressions/parenthesized-expression.js';
|
|
11
11
|
export * from './terms/boolean-literal.js';
|
|
12
12
|
export * from './terms/date-literal.js';
|
|
13
|
+
export * from './terms/date-time-literal.js';
|
|
13
14
|
export * from './terms/null-literal.js';
|
|
14
15
|
export * from './terms/number-literal.js';
|
|
15
16
|
export * from './terms/qualified-identifier.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ParseTreeVisitor, type RuleNode } from '@browsery/antlr4';
|
|
2
2
|
import { ArrayValueContext, BooleanLiteralContext, ComparisonExpressionContext, DateLiteralContext, DateTimeLiteralContext, ExternalConstantContext, LogicalExpressionContext, NegativeExpressionContext, NumberLiteralContext, ParenthesizedExpressionContext, ParenthesizedItemContext, QualifiedIdentifierContext, RootContext, StringLiteralContext, TimeLiteralContext } from './antlr/OpraFilterParser.js';
|
|
3
3
|
import OpraFilterVisitor from './antlr/OpraFilterVisitor.js';
|
|
4
|
-
import { ArrayExpression, BooleanLiteral, DateLiteral, LogicalExpression, NegativeExpression, NullLiteral, NumberLiteral, ParenthesizedExpression, QualifiedIdentifier, StringLiteral, TimeLiteral } from './ast/index.js';
|
|
4
|
+
import { ArrayExpression, BooleanLiteral, DateLiteral, DateTimeLiteral, LogicalExpression, NegativeExpression, NullLiteral, NumberLiteral, ParenthesizedExpression, QualifiedIdentifier, StringLiteral, TimeLiteral } from './ast/index.js';
|
|
5
5
|
import { ExternalConstant } from './ast/terms/external-constant.js';
|
|
6
6
|
export declare class FilterTreeVisitor extends ParseTreeVisitor<any> implements OpraFilterVisitor<any> {
|
|
7
7
|
private _timeZone?;
|
|
@@ -24,7 +24,7 @@ export declare class FilterTreeVisitor extends ParseTreeVisitor<any> implements
|
|
|
24
24
|
visitStringLiteral(ctx: StringLiteralContext): StringLiteral;
|
|
25
25
|
visitInfinityLiteral(): NumberLiteral;
|
|
26
26
|
visitDateLiteral(ctx: DateLiteralContext): DateLiteral;
|
|
27
|
-
visitDateTimeLiteral(ctx: DateTimeLiteralContext):
|
|
27
|
+
visitDateTimeLiteral(ctx: DateTimeLiteralContext): DateTimeLiteral;
|
|
28
28
|
visitTimeLiteral(ctx: TimeLiteralContext): TimeLiteral;
|
|
29
29
|
visitArrayValue(ctx: ArrayValueContext): ArrayExpression;
|
|
30
30
|
}
|
|
@@ -3,6 +3,11 @@ export declare namespace Field {
|
|
|
3
3
|
type Name = string;
|
|
4
4
|
type QualifiedName = string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Represents a Field type used to define properties and behaviors of a data structure.
|
|
8
|
+
*
|
|
9
|
+
* The `Field` type allows describing the characteristics, constraints, and metadata of a field within an entity or data type.
|
|
10
|
+
*/
|
|
6
11
|
export type Field = {
|
|
7
12
|
type?: DataType.Name | DataType;
|
|
8
13
|
/**
|
|
@@ -35,9 +40,19 @@ export type Field = {
|
|
|
35
40
|
*/
|
|
36
41
|
exclusive?: boolean;
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
43
|
+
* A boolean variable that indicates whether the value represents an array or not.
|
|
44
|
+
* If true, the value is recognized as an array.
|
|
45
|
+
* If false, the value is not an array.
|
|
46
|
+
* This property is optional and may be undefined.
|
|
39
47
|
*/
|
|
40
48
|
isArray?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Determines whether the field is a nested entity within a parent structure.
|
|
51
|
+
* If set to true, the field is considered to be part of a hierarchical or
|
|
52
|
+
* composite structure. If false or undefined, the field is considered
|
|
53
|
+
* standalone or root-level.
|
|
54
|
+
*/
|
|
55
|
+
isNestedEntity?: boolean;
|
|
41
56
|
/**
|
|
42
57
|
* Indicates key field when this field is a ComplexType array
|
|
43
58
|
*/
|