@opra/common 0.17.1 → 0.17.3
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 +12220 -0
- package/cjs/document/data-type/complex-type.js +1 -1
- package/cjs/document/resource/collection.js +13 -7
- package/cjs/filter/antlr/OpraFilterLexer.js +209 -238
- package/cjs/filter/antlr/OpraFilterListener.js +1 -1
- package/cjs/filter/antlr/OpraFilterParser.js +795 -1482
- package/cjs/filter/antlr/OpraFilterVisitor.js +1 -1
- package/cjs/filter/ast/expressions/logical-expression.js +4 -0
- package/cjs/filter/ast/expressions/{parentheses-expression.js → negative-expression.js} +3 -3
- package/cjs/filter/ast/expressions/parenthesized-expression.js +14 -0
- package/cjs/filter/ast/index.js +2 -1
- package/cjs/filter/build.js +1 -1
- package/cjs/filter/filter-tree-visitor.js +44 -66
- package/cjs/filter/index.js +2 -5
- package/cjs/filter/opra-filter.ns.js +8 -0
- package/cjs/filter/parse.js +5 -6
- package/cjs/http/codecs/filter-codec.js +2 -2
- package/cjs/http/http-message.host.js +6 -6
- package/cjs/http/http-request-message.js +3 -3
- package/cjs/http/http-response-message.js +2 -2
- package/cjs/http/multipart/batch-multipart.js +1 -1
- package/cjs/i18n/i18n.js +1 -1
- package/esm/document/data-type/complex-type.js +1 -1
- package/esm/document/resource/collection.js +14 -8
- package/esm/filter/antlr/OpraFilterLexer.js +209 -238
- package/esm/filter/antlr/OpraFilterListener.js +1 -1
- package/esm/filter/antlr/OpraFilterParser.js +775 -1448
- package/esm/filter/antlr/OpraFilterVisitor.js +1 -1
- package/esm/filter/ast/expressions/logical-expression.js +4 -0
- package/esm/filter/ast/expressions/{parentheses-expression.js → negative-expression.js} +1 -1
- package/esm/filter/ast/expressions/parenthesized-expression.js +10 -0
- package/esm/filter/ast/index.js +2 -1
- package/esm/filter/build.js +2 -2
- package/esm/filter/filter-tree-visitor.js +46 -68
- package/esm/filter/index.js +1 -5
- package/esm/filter/opra-filter.ns.js +5 -0
- package/esm/filter/parse.js +3 -4
- package/esm/http/codecs/filter-codec.js +2 -2
- package/esm/http/http-message.host.js +1 -1
- package/esm/http/http-request-message.js +1 -1
- package/esm/http/http-response-message.js +1 -1
- package/esm/http/multipart/batch-multipart.js +1 -1
- package/esm/i18n/i18n.js +1 -1
- package/package.json +30 -18
- package/types/document/resource/collection.d.ts +2 -2
- package/types/filter/antlr/OpraFilterLexer.d.ts +9 -22
- package/types/filter/antlr/OpraFilterListener.d.ts +89 -217
- package/types/filter/antlr/OpraFilterParser.d.ts +91 -206
- package/types/filter/antlr/OpraFilterVisitor.d.ts +49 -124
- package/types/filter/ast/expressions/{parentheses-expression.d.ts → negative-expression.d.ts} +1 -1
- package/types/filter/ast/expressions/parenthesized-expression.d.ts +6 -0
- package/types/filter/ast/index.d.ts +2 -1
- package/types/filter/build.d.ts +2 -2
- package/types/filter/filter-tree-visitor.d.ts +10 -11
- package/types/filter/index.d.ts +1 -5
- package/types/filter/opra-filter.ns.d.ts +5 -0
- package/types/filter/parse.d.ts +1 -1
- package/types/http/http-message.host.d.ts +1 -1
- package/types/i18n/i18n.d.ts +2 -2
- package/types/i18n/translate.d.ts +1 -1
- package/types/schema/data-type/complex-type.interface.d.ts +1 -1
- package/types/schema/resource/endpoint.interface.d.ts +2 -2
|
@@ -142,7 +142,7 @@ const proto = {
|
|
|
142
142
|
if (dataType && !dataType.additionalFields) {
|
|
143
143
|
if (silent)
|
|
144
144
|
return { done: true, value: [] };
|
|
145
|
-
throw new Error(`Invalid field
|
|
145
|
+
throw new Error(`Unknown or Invalid field (${curPath})`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -137,23 +137,29 @@ const proto = {
|
|
|
137
137
|
});
|
|
138
138
|
return normalized;
|
|
139
139
|
},
|
|
140
|
-
normalizeFilter(
|
|
141
|
-
if (
|
|
140
|
+
normalizeFilter(filter) {
|
|
141
|
+
if (!filter)
|
|
142
|
+
return;
|
|
143
|
+
const ast = typeof filter === 'string' ? index_js_2.OpraFilter.parse(filter) : filter;
|
|
144
|
+
if (ast instanceof index_js_2.OpraFilter.ComparisonExpression) {
|
|
142
145
|
this.normalizeFilter(ast.left);
|
|
146
|
+
if (!(ast.left instanceof index_js_2.OpraFilter.QualifiedIdentifier && ast.left.field))
|
|
147
|
+
throw new TypeError(`Invalid filter query. Left side should be a data field.`);
|
|
148
|
+
this.normalizeFilter(ast.right);
|
|
143
149
|
}
|
|
144
|
-
else if (ast instanceof index_js_2.LogicalExpression) {
|
|
150
|
+
else if (ast instanceof index_js_2.OpraFilter.LogicalExpression) {
|
|
145
151
|
ast.items.forEach(item => this.normalizeFilter(item));
|
|
146
152
|
}
|
|
147
|
-
else if (ast instanceof index_js_2.ArithmeticExpression) {
|
|
153
|
+
else if (ast instanceof index_js_2.OpraFilter.ArithmeticExpression) {
|
|
148
154
|
ast.items.forEach(item => this.normalizeFilter(item.expression));
|
|
149
155
|
}
|
|
150
|
-
else if (ast instanceof index_js_2.ArrayExpression) {
|
|
156
|
+
else if (ast instanceof index_js_2.OpraFilter.ArrayExpression) {
|
|
151
157
|
ast.items.forEach(item => this.normalizeFilter(item));
|
|
152
158
|
}
|
|
153
|
-
else if (ast instanceof index_js_2.
|
|
159
|
+
else if (ast instanceof index_js_2.OpraFilter.ParenthesizedExpression) {
|
|
154
160
|
this.normalizeFilter(ast.expression);
|
|
155
161
|
}
|
|
156
|
-
else if (ast instanceof index_js_2.QualifiedIdentifier) {
|
|
162
|
+
else if (ast instanceof index_js_2.OpraFilter.QualifiedIdentifier) {
|
|
157
163
|
ast.field = this.type.findField(ast.value);
|
|
158
164
|
ast.dataType = ast.field?.type || this.document.getDataType('any');
|
|
159
165
|
ast.value = this.type.normalizeFieldPath(ast.value);
|