@opra/common 0.10.0 → 0.10.2
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/cjs/filter/antlr/OpraFilterLexer.js +225 -302
- package/cjs/filter/antlr/OpraFilterListener.js +11 -0
- package/cjs/filter/antlr/OpraFilterParser.js +1120 -721
- package/cjs/filter/antlr/OpraFilterVisitor.js +12 -1
- package/cjs/filter/ast/terms/date-literal.js +4 -3
- package/cjs/filter/filter-tree-visitor.js +31 -28
- package/cjs/filter/index.js +1 -1
- package/cjs/filter/opra-error-listener.js +15 -0
- package/cjs/filter/parse.js +11 -10
- package/cjs/i18n/i18n.js +13 -14
- package/cjs/schema/decorators/opr-collection-resource.decorator.js +3 -2
- package/cjs/schema/decorators/opr-complex-type.decorator.js +3 -2
- package/cjs/schema/decorators/opr-field.decorator.js +3 -2
- package/cjs/schema/decorators/opr-simple-type.decorator.js +3 -2
- package/cjs/schema/decorators/opr-singleton-resource.decorator.js +3 -2
- package/cjs/schema/implementation/data-type/union-type.js +3 -2
- package/cjs/schema/implementation/document-builder.js +4 -3
- package/cjs/schema/implementation/opra-document.js +3 -2
- package/esm/filter/antlr/OpraFilterLexer.d.ts +11 -12
- package/esm/filter/antlr/OpraFilterLexer.js +224 -299
- package/esm/filter/antlr/OpraFilterListener.d.ts +430 -0
- package/esm/filter/antlr/OpraFilterListener.js +8 -0
- package/esm/filter/antlr/OpraFilterParser.d.ts +183 -111
- package/esm/filter/antlr/OpraFilterParser.js +1052 -652
- package/esm/filter/antlr/OpraFilterVisitor.d.ts +77 -107
- package/esm/filter/antlr/OpraFilterVisitor.js +11 -2
- package/esm/filter/ast/terms/date-literal.js +4 -3
- package/esm/filter/errors.d.ts +4 -6
- package/esm/filter/filter-tree-visitor.d.ts +5 -3
- package/esm/filter/filter-tree-visitor.js +23 -21
- package/esm/filter/index.d.ts +1 -1
- package/esm/filter/index.js +1 -1
- package/esm/filter/opra-error-listener.d.ts +8 -0
- package/esm/filter/opra-error-listener.js +11 -0
- package/esm/filter/parse.d.ts +2 -2
- package/esm/filter/parse.js +8 -8
- package/esm/i18n/i18n.d.ts +1 -1
- package/esm/i18n/i18n.js +9 -10
- package/esm/schema/decorators/opr-collection-resource.decorator.js +1 -1
- package/esm/schema/decorators/opr-complex-type.decorator.js +1 -1
- package/esm/schema/decorators/opr-field.decorator.js +1 -1
- package/esm/schema/decorators/opr-simple-type.decorator.js +1 -1
- package/esm/schema/decorators/opr-singleton-resource.decorator.js +1 -1
- package/esm/schema/implementation/data-type/union-type.js +1 -1
- package/esm/schema/implementation/document-builder.js +3 -3
- package/esm/schema/implementation/opra-document.js +1 -1
- package/package.json +9 -9
- package/cjs/filter/error-listener.js +0 -13
- package/esm/filter/error-listener.d.ts +0 -8
- package/esm/filter/error-listener.js +0 -9
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated from ../antlr/OpraFilter.g4 by ANTLR 4.9.0-SNAPSHOT
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Generated from ./src/filter/antlr/OpraFilter.g4 by ANTLR 4.11.2-SNAPSHOT
|
|
4
|
+
const antlr4_1 = require("antlr4");
|
|
5
|
+
/**
|
|
6
|
+
* This interface defines a complete generic visitor for a parse tree produced
|
|
7
|
+
* by `OpraFilterParser`.
|
|
8
|
+
*
|
|
9
|
+
* @param <Result> The return type of the visit operation. Use `void` for
|
|
10
|
+
* operations with no return type.
|
|
11
|
+
*/
|
|
12
|
+
class OpraFilterVisitor extends antlr4_1.ParseTreeVisitor {
|
|
13
|
+
}
|
|
14
|
+
exports.default = OpraFilterVisitor;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DateLiteral = void 0;
|
|
4
|
-
const
|
|
4
|
+
const putil_varhelpers_1 = require("putil-varhelpers");
|
|
5
5
|
const errors_js_1 = require("../../errors.js");
|
|
6
6
|
const utils_js_1 = require("../../utils.js");
|
|
7
7
|
const literal_js_1 = require("../abstract/literal.js");
|
|
8
|
-
const DATE_PATTERN = /^(\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)/;
|
|
8
|
+
// const DATE_PATTERN = /^(\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)/;
|
|
9
|
+
const NullDate = new Date(0);
|
|
9
10
|
class DateLiteral extends literal_js_1.Literal {
|
|
10
11
|
constructor(value) {
|
|
11
12
|
super('');
|
|
@@ -14,7 +15,7 @@ class DateLiteral extends literal_js_1.Literal {
|
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
// noinspection SuspiciousTypeOfGuard
|
|
17
|
-
if (typeof value === 'string' &&
|
|
18
|
+
if (typeof value === 'string' && (0, putil_varhelpers_1.toDateDef)(value, NullDate) !== NullDate) {
|
|
18
19
|
this.value = value;
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FilterTreeVisitor = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const antlr4_1 = tslib_1.__importDefault(require("antlr4"));
|
|
5
6
|
const OpraFilterParser_js_1 = require("./antlr/OpraFilterParser.js");
|
|
6
|
-
const
|
|
7
|
+
const index_js_1 = require("./ast/index.js");
|
|
7
8
|
const external_constant_js_1 = require("./ast/terms/external-constant.js");
|
|
8
9
|
const errors_js_1 = require("./errors.js");
|
|
9
10
|
const utils_js_1 = require("./utils.js");
|
|
10
|
-
|
|
11
|
+
// Fix: antlr4 d.ts files is invalid
|
|
12
|
+
const ParseTreeVisitor = antlr4_1.default.tree.ParseTreeVisitor;
|
|
13
|
+
class FilterTreeVisitor extends ParseTreeVisitor {
|
|
11
14
|
constructor(options) {
|
|
12
15
|
super();
|
|
13
16
|
this._timeZone = options?.timeZone;
|
|
@@ -19,57 +22,57 @@ class FilterTreeVisitor extends index_js_1.AbstractParseTreeVisitor {
|
|
|
19
22
|
return this.visit(ctx.expression());
|
|
20
23
|
}
|
|
21
24
|
visitIdentifier(ctx) {
|
|
22
|
-
return ctx.
|
|
25
|
+
return ctx.getText();
|
|
23
26
|
}
|
|
24
27
|
visitNullLiteral() {
|
|
25
|
-
return new
|
|
28
|
+
return new index_js_1.NullLiteral();
|
|
26
29
|
}
|
|
27
30
|
visitBooleanLiteral(ctx) {
|
|
28
|
-
return new
|
|
31
|
+
return new index_js_1.BooleanLiteral(ctx.getText() === 'true');
|
|
29
32
|
}
|
|
30
33
|
visitNumberLiteral(ctx) {
|
|
31
|
-
return new
|
|
34
|
+
return new index_js_1.NumberLiteral(ctx.getText());
|
|
32
35
|
}
|
|
33
36
|
visitStringLiteral(ctx) {
|
|
34
|
-
return new
|
|
37
|
+
return new index_js_1.StringLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
35
38
|
}
|
|
36
39
|
visitInfinityLiteral() {
|
|
37
|
-
return new
|
|
40
|
+
return new index_js_1.NumberLiteral(Infinity);
|
|
38
41
|
}
|
|
39
42
|
visitDateLiteral(ctx) {
|
|
40
|
-
return new
|
|
43
|
+
return new index_js_1.DateLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
41
44
|
}
|
|
42
45
|
visitDateTimeLiteral(ctx) {
|
|
43
|
-
return new
|
|
46
|
+
return new index_js_1.DateLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
44
47
|
}
|
|
45
48
|
visitTimeLiteral(ctx) {
|
|
46
|
-
return new
|
|
49
|
+
return new index_js_1.TimeLiteral((0, utils_js_1.unquoteFilterString)(ctx.getText()));
|
|
47
50
|
}
|
|
48
51
|
visitQualifiedIdentifierTerm(ctx) {
|
|
49
|
-
return new
|
|
52
|
+
return new index_js_1.QualifiedIdentifier(ctx.getText());
|
|
50
53
|
}
|
|
51
54
|
visitPolarityExpression(ctx) {
|
|
52
55
|
const x = this.visit(ctx.expression());
|
|
53
56
|
if (x.kind === 'NumberLiteral') {
|
|
54
|
-
if (ctx.polarOp().
|
|
57
|
+
if (ctx.polarOp().getText() === '-')
|
|
55
58
|
x.value *= -1;
|
|
56
59
|
return x;
|
|
57
60
|
}
|
|
58
|
-
throw new errors_js_1.SyntaxError('Unexpected token "' + ctx.
|
|
61
|
+
throw new errors_js_1.SyntaxError('Unexpected token "' + ctx.getText() + '"');
|
|
59
62
|
}
|
|
60
63
|
visitExternalConstantTerm(ctx) {
|
|
61
|
-
return new external_constant_js_1.ExternalConstant(ctx.externalConstant().
|
|
64
|
+
return new external_constant_js_1.ExternalConstant(ctx.externalConstant().getText().substring(1));
|
|
62
65
|
}
|
|
63
66
|
visitParenthesizedExpression(ctx) {
|
|
64
67
|
const expression = this.visit(ctx.expression());
|
|
65
|
-
return new
|
|
68
|
+
return new index_js_1.ParenthesesExpression(expression);
|
|
66
69
|
}
|
|
67
70
|
visitArrayExpression(ctx) {
|
|
68
|
-
return new
|
|
71
|
+
return new index_js_1.ArrayExpression(ctx.expression_list().map(child => this.visit(child)));
|
|
69
72
|
}
|
|
70
73
|
visitComparisonExpression(ctx) {
|
|
71
|
-
return new
|
|
72
|
-
op: ctx.compOp().
|
|
74
|
+
return new index_js_1.ComparisonExpression({
|
|
75
|
+
op: ctx.compOp().getText(),
|
|
73
76
|
left: this.visit(ctx.expression(0)),
|
|
74
77
|
right: this.visit(ctx.expression(1))
|
|
75
78
|
});
|
|
@@ -78,34 +81,34 @@ class FilterTreeVisitor extends index_js_1.AbstractParseTreeVisitor {
|
|
|
78
81
|
const items = [];
|
|
79
82
|
const wrapChildren = (arr, op) => {
|
|
80
83
|
for (const c of arr) {
|
|
81
|
-
if (c instanceof OpraFilterParser_js_1.LogicalExpressionContext && c.logOp().
|
|
82
|
-
wrapChildren(c.
|
|
84
|
+
if (c instanceof OpraFilterParser_js_1.LogicalExpressionContext && c.logOp().getText() === op) {
|
|
85
|
+
wrapChildren(c.expression_list(), c.logOp().getText());
|
|
83
86
|
continue;
|
|
84
87
|
}
|
|
85
88
|
const o = this.visit(c);
|
|
86
89
|
items.push(o);
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
|
-
wrapChildren(ctx.
|
|
90
|
-
return new
|
|
91
|
-
op: ctx.logOp().
|
|
92
|
+
wrapChildren(ctx.expression_list(), ctx.logOp().getText());
|
|
93
|
+
return new index_js_1.LogicalExpression({
|
|
94
|
+
op: ctx.logOp().getText(),
|
|
92
95
|
items
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
98
|
visitArithmeticExpression(ctx) {
|
|
96
|
-
const exp = new
|
|
99
|
+
const exp = new index_js_1.ArithmeticExpression();
|
|
97
100
|
const wrapChildren = (children, op) => {
|
|
98
101
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
99
102
|
const child = children[i];
|
|
100
103
|
if (child instanceof OpraFilterParser_js_1.ArithmeticExpressionContext) {
|
|
101
|
-
wrapChildren(child.
|
|
104
|
+
wrapChildren(child.expression_list(), child.arthOp().getText());
|
|
102
105
|
continue;
|
|
103
106
|
}
|
|
104
107
|
const value = this.visit(child);
|
|
105
108
|
exp.append(op || '+', value);
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
|
-
wrapChildren(ctx.
|
|
111
|
+
wrapChildren(ctx.expression_list(), ctx.arthOp().getText());
|
|
109
112
|
return exp;
|
|
110
113
|
}
|
|
111
114
|
}
|
package/cjs/filter/index.js
CHANGED
|
@@ -4,5 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./ast/index.js"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./parse.js"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./build.js"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./error-listener.js"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./opra-error-listener.js"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./filter-tree-visitor.js"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpraErrorListener = void 0;
|
|
4
|
+
const antlr4_1 = require("antlr4");
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
|
+
class OpraErrorListener extends antlr4_1.ErrorListener {
|
|
7
|
+
constructor(errors) {
|
|
8
|
+
super();
|
|
9
|
+
this.errors = errors;
|
|
10
|
+
}
|
|
11
|
+
syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
|
|
12
|
+
this.errors.push(new errors_js_1.FilterParseError(msg, { recognizer, offendingSymbol, line, e }));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.OpraErrorListener = OpraErrorListener;
|
package/cjs/filter/parse.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseFilter = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const antlr4_1 = require("antlr4");
|
|
6
|
+
const OpraFilterLexer_js_1 = tslib_1.__importDefault(require("./antlr/OpraFilterLexer.js"));
|
|
7
|
+
const OpraFilterParser_js_1 = tslib_1.__importDefault(require("./antlr/OpraFilterParser.js"));
|
|
8
8
|
const errors_js_1 = require("./errors.js");
|
|
9
9
|
const filter_tree_visitor_js_1 = require("./filter-tree-visitor.js");
|
|
10
|
+
const opra_error_listener_js_1 = require("./opra-error-listener.js");
|
|
10
11
|
function parseFilter(text, visitor) {
|
|
11
|
-
const
|
|
12
|
-
const lexer = new OpraFilterLexer_js_1.
|
|
13
|
-
const tokenStream = new
|
|
14
|
-
const parser = new OpraFilterParser_js_1.
|
|
15
|
-
parser.
|
|
12
|
+
const chars = new antlr4_1.CharStream(text);
|
|
13
|
+
const lexer = new OpraFilterLexer_js_1.default(chars);
|
|
14
|
+
const tokenStream = new antlr4_1.CommonTokenStream(lexer);
|
|
15
|
+
const parser = new OpraFilterParser_js_1.default(tokenStream);
|
|
16
|
+
parser.buildParseTrees = true;
|
|
16
17
|
const errors = [];
|
|
17
|
-
const errorListener = new
|
|
18
|
+
const errorListener = new opra_error_listener_js_1.OpraErrorListener(errors);
|
|
18
19
|
lexer.removeErrorListeners();
|
|
19
20
|
lexer.addErrorListener(errorListener);
|
|
20
21
|
parser.removeErrorListeners();
|
package/cjs/i18n/i18n.js
CHANGED
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.I18n = exports.BaseI18n = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fast_tokenizer_1 = require("fast-tokenizer");
|
|
6
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
7
|
const i18next_1 = tslib_1.__importDefault(require("i18next"));
|
|
8
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
9
|
const index_js_1 = require("../utils/index.js");
|
|
8
10
|
const string_utils_js_1 = require("./string-utils.js");
|
|
9
11
|
exports.BaseI18n = Object.getPrototypeOf(i18next_1.default).constructor;
|
|
@@ -13,7 +15,7 @@ class I18n extends exports.BaseI18n {
|
|
|
13
15
|
const options = typeof arg0 === 'object' ? arg0 : {};
|
|
14
16
|
const callback = typeof arg0 === 'function' ? arg0 : arg1;
|
|
15
17
|
try {
|
|
16
|
-
const t = await super.init(options);
|
|
18
|
+
const t = await super.init(options, callback);
|
|
17
19
|
// Add formatters
|
|
18
20
|
const formatter = this.services.formatter;
|
|
19
21
|
formatter.add('lowercase', (value, lng) => value.toLocaleLowerCase(lng));
|
|
@@ -60,32 +62,29 @@ class I18n extends exports.BaseI18n {
|
|
|
60
62
|
obj = (await fetch(filePath, { headers: { accept: 'application/json' } })).json();
|
|
61
63
|
}
|
|
62
64
|
else {
|
|
63
|
-
const
|
|
64
|
-
const content = await fs.readFile(filePath, 'utf8');
|
|
65
|
+
const content = fs_1.default.readFileSync(filePath, 'utf8');
|
|
65
66
|
obj = JSON.parse(content);
|
|
66
67
|
}
|
|
67
68
|
this.addResourceBundle(lang, ns, obj, deep, overwrite);
|
|
68
69
|
}
|
|
69
70
|
async loadResourceDir(dirnames, deep, overwrite) {
|
|
70
|
-
const fs = await Promise.resolve().then(() => tslib_1.__importStar(require('fs/promises')));
|
|
71
|
-
const path = await Promise.resolve().then(() => tslib_1.__importStar(require('path')));
|
|
72
71
|
for (const dirname of Array.isArray(dirnames) ? dirnames : [dirnames]) {
|
|
73
72
|
/* istanbul ignore next */
|
|
74
|
-
if (!(
|
|
73
|
+
if (!(fs_1.default.statSync(dirname)).isDirectory()) {
|
|
75
74
|
// eslint-disable-next-line no-console
|
|
76
75
|
console.warn(`Locale directory does not exists. (${dirname})`);
|
|
77
76
|
continue;
|
|
78
77
|
}
|
|
79
|
-
const languageDirs =
|
|
78
|
+
const languageDirs = fs_1.default.readdirSync(dirname);
|
|
80
79
|
for (const lang of languageDirs) {
|
|
81
|
-
const langDir =
|
|
82
|
-
if ((
|
|
83
|
-
const nsDirs =
|
|
80
|
+
const langDir = path_1.default.join(dirname, lang);
|
|
81
|
+
if ((fs_1.default.statSync(langDir)).isDirectory()) {
|
|
82
|
+
const nsDirs = fs_1.default.readdirSync(langDir);
|
|
84
83
|
for (const nsfile of nsDirs) {
|
|
85
|
-
const nsFilePath =
|
|
86
|
-
const ext =
|
|
87
|
-
if (ext === '.json' && (
|
|
88
|
-
const ns =
|
|
84
|
+
const nsFilePath = path_1.default.join(langDir, nsfile);
|
|
85
|
+
const ext = path_1.default.extname(nsfile);
|
|
86
|
+
if (ext === '.json' && (fs_1.default.statSync(nsFilePath)).isFile()) {
|
|
87
|
+
const ns = path_1.default.basename(nsfile, ext);
|
|
89
88
|
await this.loadResourceBundle(lang, ns, nsFilePath, deep, overwrite);
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OprCollectionResource = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
require("reflect-metadata");
|
|
5
|
-
const
|
|
6
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
6
7
|
const constants_js_1 = require("../constants.js");
|
|
7
8
|
const NESTJS_INJECTABLE_WATERMARK = '__injectable__';
|
|
8
9
|
const NAME_PATTERN = /^(.*)Resource$/;
|
|
@@ -14,7 +15,7 @@ function OprCollectionResource(entityFunc, options) {
|
|
|
14
15
|
type: entityFunc,
|
|
15
16
|
name
|
|
16
17
|
};
|
|
17
|
-
Object.assign(meta, (0,
|
|
18
|
+
Object.assign(meta, (0, lodash_omit_1.default)(options, Object.keys(meta)));
|
|
18
19
|
Reflect.defineMetadata(constants_js_1.RESOURCE_METADATA, meta, target);
|
|
19
20
|
/* Define Injectable metadata for NestJS support*/
|
|
20
21
|
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OprComplexType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
5
6
|
const constants_js_1 = require("../constants.js");
|
|
6
7
|
const NAME_PATTERN = /^(.*)Type$/;
|
|
7
8
|
function OprComplexType(options) {
|
|
@@ -11,7 +12,7 @@ function OprComplexType(options) {
|
|
|
11
12
|
kind: 'ComplexType',
|
|
12
13
|
name,
|
|
13
14
|
};
|
|
14
|
-
Object.assign(meta, (0,
|
|
15
|
+
Object.assign(meta, (0, lodash_omit_1.default)(options, Object.keys(meta)));
|
|
15
16
|
const base = Object.getPrototypeOf(target);
|
|
16
17
|
const baseMeta = Reflect.getMetadata(constants_js_1.DATATYPE_METADATA, base);
|
|
17
18
|
if (baseMeta) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OprField = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
5
6
|
const constants_js_1 = require("../constants.js");
|
|
6
7
|
function OprField(args) {
|
|
7
8
|
return (target, propertyKey) => {
|
|
@@ -11,7 +12,7 @@ function OprField(args) {
|
|
|
11
12
|
const metadata = {
|
|
12
13
|
type: args?.type
|
|
13
14
|
};
|
|
14
|
-
Object.assign(metadata, (0,
|
|
15
|
+
Object.assign(metadata, (0, lodash_omit_1.default)(args, Object.keys(metadata)));
|
|
15
16
|
if (designType === Array) {
|
|
16
17
|
metadata.isArray = true;
|
|
17
18
|
metadata.type = metadata.type || 'any';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OprSimpleType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
5
6
|
const constants_js_1 = require("../constants.js");
|
|
6
7
|
const NAME_PATTERN = /^(.*)Type$/;
|
|
7
8
|
function OprSimpleType(options) {
|
|
@@ -11,7 +12,7 @@ function OprSimpleType(options) {
|
|
|
11
12
|
kind: 'SimpleType',
|
|
12
13
|
name
|
|
13
14
|
};
|
|
14
|
-
Object.assign(meta, (0,
|
|
15
|
+
Object.assign(meta, (0, lodash_omit_1.default)(options, Object.keys(meta)));
|
|
15
16
|
Reflect.defineMetadata(constants_js_1.DATATYPE_METADATA, meta, target);
|
|
16
17
|
};
|
|
17
18
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OprSingletonResource = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
require("reflect-metadata");
|
|
5
|
-
const
|
|
6
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
6
7
|
const constants_js_1 = require("../constants.js");
|
|
7
8
|
const NESTJS_INJECTABLE_WATERMARK = '__injectable__';
|
|
8
9
|
const NAME_PATTERN = /^(.*)Resource$/;
|
|
@@ -14,7 +15,7 @@ function OprSingletonResource(type, options) {
|
|
|
14
15
|
type,
|
|
15
16
|
name
|
|
16
17
|
};
|
|
17
|
-
Object.assign(meta, (0,
|
|
18
|
+
Object.assign(meta, (0, lodash_omit_1.default)(options, Object.keys(meta)));
|
|
18
19
|
Reflect.defineMetadata(constants_js_1.RESOURCE_METADATA, meta, target);
|
|
19
20
|
/* Define Injectable metadata for NestJS support*/
|
|
20
21
|
Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnionType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
5
6
|
const inspect_util_js_1 = require("../../utils/inspect.util.js");
|
|
6
7
|
const complex_type_js_1 = require("./complex-type.js");
|
|
7
8
|
const data_type_js_1 = require("./data-type.js");
|
|
8
9
|
class UnionType extends data_type_js_1.DataType {
|
|
9
10
|
constructor(owner, name, args) {
|
|
10
|
-
super(owner, name, (0,
|
|
11
|
+
super(owner, name, (0, lodash_omit_1.default)({ kind: 'UnionType', ...args }, ['types']));
|
|
11
12
|
this.types = args.types;
|
|
12
13
|
this.hasAdditionalFields = name === 'any' ||
|
|
13
14
|
!!this.types.find(t => t instanceof complex_type_js_1.ComplexType && t.additionalFields);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DocumentBuilder = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const putil_promisify_1 = tslib_1.__importDefault(require("putil-promisify"));
|
|
5
6
|
const responsive_map_js_1 = require("../../helpers/responsive-map.js");
|
|
6
7
|
const opra_schema_definition_js_1 = require("../opra-schema.definition.js");
|
|
7
8
|
const class_utils_js_1 = require("../utils/class.utils.js");
|
|
@@ -65,7 +66,7 @@ class DocumentBuilder {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
async addDataTypeClass(thunk) {
|
|
68
|
-
thunk =
|
|
69
|
+
thunk = putil_promisify_1.default.isPromise(thunk) ? await thunk : thunk;
|
|
69
70
|
if (!(0, class_utils_js_1.isConstructor)(thunk))
|
|
70
71
|
return this.addDataTypeClass(thunk());
|
|
71
72
|
const internalTypeName = builtin_data_types_js_1.primitiveClasses.get(thunk);
|
|
@@ -115,7 +116,7 @@ class DocumentBuilder {
|
|
|
115
116
|
this._resources.set(name, schema);
|
|
116
117
|
}
|
|
117
118
|
async addResourceInstance(thunk) {
|
|
118
|
-
thunk =
|
|
119
|
+
thunk = putil_promisify_1.default.isPromise(thunk) ? await thunk : thunk;
|
|
119
120
|
let instance;
|
|
120
121
|
if (typeof thunk === 'function') {
|
|
121
122
|
if ((0, class_utils_js_1.isConstructor)(thunk)) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpraDocument = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_omit_1 = tslib_1.__importDefault(require("lodash.omit"));
|
|
5
6
|
const responsive_map_js_1 = require("../../helpers/responsive-map.js");
|
|
6
7
|
const opra_schema_definition_js_1 = require("../opra-schema.definition.js");
|
|
7
8
|
const clone_object_util_js_1 = require("../utils/clone-object.util.js");
|
|
@@ -18,7 +19,7 @@ class OpraDocument {
|
|
|
18
19
|
this._ownTypes = new responsive_map_js_1.ResponsiveMap();
|
|
19
20
|
this._types = new responsive_map_js_1.ResponsiveMap();
|
|
20
21
|
this._resources = new responsive_map_js_1.ResponsiveMap();
|
|
21
|
-
this._meta = (0,
|
|
22
|
+
this._meta = (0, lodash_omit_1.default)(schema, ['types', 'resources']);
|
|
22
23
|
for (const [name, t] of builtin_data_types_js_1.builtInTypes.entries()) {
|
|
23
24
|
this._addDataType(name, t, false);
|
|
24
25
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { ATN } from "
|
|
2
|
-
|
|
3
|
-
import { Lexer } from "antlr4ts/Lexer";
|
|
4
|
-
import { Vocabulary } from "antlr4ts/Vocabulary";
|
|
5
|
-
export declare class OpraFilterLexer extends Lexer {
|
|
1
|
+
import { ATN, CharStream, DFA, Lexer } from "antlr4";
|
|
2
|
+
export default class OpraFilterLexer extends Lexer {
|
|
6
3
|
static readonly T__0 = 1;
|
|
7
4
|
static readonly T__1 = 2;
|
|
8
5
|
static readonly T__2 = 3;
|
|
@@ -59,20 +56,22 @@ export declare class OpraFilterLexer extends Lexer {
|
|
|
59
56
|
static readonly WHITESPACE = 54;
|
|
60
57
|
static readonly COMMENT = 55;
|
|
61
58
|
static readonly LINE_COMMENT = 56;
|
|
59
|
+
static readonly EOF: number;
|
|
62
60
|
static readonly channelNames: string[];
|
|
61
|
+
static readonly literalNames: (string | null)[];
|
|
62
|
+
static readonly symbolicNames: (string | null)[];
|
|
63
63
|
static readonly modeNames: string[];
|
|
64
64
|
static readonly ruleNames: string[];
|
|
65
|
-
private static readonly _LITERAL_NAMES;
|
|
66
|
-
private static readonly _SYMBOLIC_NAMES;
|
|
67
|
-
static readonly VOCABULARY: Vocabulary;
|
|
68
|
-
get vocabulary(): Vocabulary;
|
|
69
65
|
constructor(input: CharStream);
|
|
70
66
|
get grammarFileName(): string;
|
|
67
|
+
get literalNames(): (string | null)[];
|
|
68
|
+
get symbolicNames(): (string | null)[];
|
|
71
69
|
get ruleNames(): string[];
|
|
72
|
-
get serializedATN():
|
|
70
|
+
get serializedATN(): number[];
|
|
73
71
|
get channelNames(): string[];
|
|
74
72
|
get modeNames(): string[];
|
|
75
|
-
static readonly _serializedATN:
|
|
76
|
-
static __ATN
|
|
73
|
+
static readonly _serializedATN: number[];
|
|
74
|
+
private static __ATN;
|
|
77
75
|
static get _ATN(): ATN;
|
|
76
|
+
static DecisionsToDFA: DFA[];
|
|
78
77
|
}
|