@malloydata/malloy-filter 0.0.243-dev250314163430 → 0.0.243-dev250314171801
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/dist/boolean_filter_expression.d.ts +2 -2
- package/dist/boolean_filter_expression.js.map +1 -1
- package/dist/filter_clause.d.ts +1 -1
- package/dist/number_filter_expression.d.ts +2 -2
- package/dist/string_filter_expression.d.ts +2 -2
- package/dist/temporal_filter_expression.d.ts +2 -2
- package/package.json +1 -1
- package/src/boolean_filter_expression.ts +3 -3
- package/src/filter_clause.ts +1 -1
- package/src/number_filter_expression.ts +2 -2
- package/src/string_filter_expression.ts +2 -2
- package/src/temporal_filter_expression.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BooleanClause,
|
|
1
|
+
import type { BooleanClause, FilterParserResponse } from './filter_clause';
|
|
2
2
|
export declare const BooleanFilterExpression: {
|
|
3
|
-
parse(srcText: string):
|
|
3
|
+
parse(srcText: string): FilterParserResponse<BooleanClause>;
|
|
4
4
|
unparse(bc: BooleanClause | null): string;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean_filter_expression.js","sourceRoot":"","sources":["../src/boolean_filter_expression.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIU,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,OAAe;;QACnB,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"boolean_filter_expression.js","sourceRoot":"","sources":["../src/boolean_filter_expression.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIU,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,OAAe;;QACnB,MAAM,GAAG,GAAwC,EAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAC,CAAC;QACzE,IAAI,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,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ACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,CAAC,EAAwB;QAC9B,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;YACpB,KAAK,MAAM,CAAC;YACZ,KAAK,MAAM;gBACT,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;YACzB,KAAK,eAAe;gBAClB,OAAO,CAAC,GAAG,OAAO,CAAC;YACrB,KAAK,OAAO;gBACV,OAAO,CAAC,GAAG,QAAQ,CAAC;QACxB,CAAC;IACH,CAAC;CACF,CAAC"}
|
package/dist/filter_clause.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ export interface FilterLog {
|
|
|
126
126
|
endIndex: number;
|
|
127
127
|
severity: FilterLogSeverity;
|
|
128
128
|
}
|
|
129
|
-
export interface
|
|
129
|
+
export interface FilterParserResponse<T extends ClauseBase> {
|
|
130
130
|
parsed: T | null;
|
|
131
131
|
log: FilterLog[];
|
|
132
132
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilterParserResponse, NumberClause } from './filter_clause';
|
|
2
2
|
export declare const NumberFilterExpression: {
|
|
3
|
-
parse(src: string):
|
|
3
|
+
parse(src: string): FilterParserResponse<NumberClause>;
|
|
4
4
|
unparse(nc: NumberClause | null): string;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilterParserResponse, StringClause } from './filter_clause';
|
|
2
2
|
export declare const StringFilterExpression: {
|
|
3
|
-
parse(src: string):
|
|
3
|
+
parse(src: string): FilterParserResponse<StringClause>;
|
|
4
4
|
unparse(sc: StringClause | null): string;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilterParserResponse, TemporalClause } from './filter_clause';
|
|
2
2
|
export declare const TemporalFilterExpression: {
|
|
3
|
-
parse(src: string):
|
|
3
|
+
parse(src: string): FilterParserResponse<TemporalClause>;
|
|
4
4
|
unparse(tc: TemporalClause | null): string;
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {BooleanClause,
|
|
8
|
+
import type {BooleanClause, FilterParserResponse} from './filter_clause';
|
|
9
9
|
|
|
10
10
|
export const BooleanFilterExpression = {
|
|
11
|
-
parse(srcText: string):
|
|
12
|
-
const ret:
|
|
11
|
+
parse(srcText: string): FilterParserResponse<BooleanClause> {
|
|
12
|
+
const ret: FilterParserResponse<BooleanClause> = {parsed: null, log: []};
|
|
13
13
|
let src = srcText.toLowerCase().trim().replace(/\s\s+/, ' ');
|
|
14
14
|
let negate = false;
|
|
15
15
|
if (src.startsWith('not ')) {
|
package/src/filter_clause.ts
CHANGED
|
@@ -292,7 +292,7 @@ export interface FilterLog {
|
|
|
292
292
|
severity: FilterLogSeverity;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
export interface
|
|
295
|
+
export interface FilterParserResponse<T extends ClauseBase> {
|
|
296
296
|
parsed: T | null;
|
|
297
297
|
log: FilterLog[];
|
|
298
298
|
}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {FilterParserResponse, NumberClause} from './filter_clause';
|
|
9
9
|
import {isNumberClause} from './filter_clause';
|
|
10
10
|
import * as nearley from 'nearley';
|
|
11
11
|
import fnumber_grammar from './lib/fexpr_number_parser';
|
|
12
12
|
import {run_parser} from './nearley_parse';
|
|
13
13
|
|
|
14
14
|
export const NumberFilterExpression = {
|
|
15
|
-
parse(src: string):
|
|
15
|
+
parse(src: string): FilterParserResponse<NumberClause> {
|
|
16
16
|
const fnumber_parser = new nearley.Parser(
|
|
17
17
|
nearley.Grammar.fromCompiled(fnumber_grammar)
|
|
18
18
|
);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {FilterParserResponse, StringClause} from './filter_clause';
|
|
9
9
|
import {isStringClause} from './filter_clause';
|
|
10
10
|
import * as nearley from 'nearley';
|
|
11
11
|
import fstring_grammar from './lib/fexpr_string_parser';
|
|
@@ -18,7 +18,7 @@ import {run_parser} from './nearley_parse';
|
|
|
18
18
|
// is not hand coded. Full apologies to the original author of the hand
|
|
19
19
|
// coded parsers.
|
|
20
20
|
export const StringFilterExpression = {
|
|
21
|
-
parse(src: string):
|
|
21
|
+
parse(src: string): FilterParserResponse<StringClause> {
|
|
22
22
|
const fstring_parser = new nearley.Parser(
|
|
23
23
|
nearley.Grammar.fromCompiled(fstring_grammar)
|
|
24
24
|
);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type {
|
|
9
|
-
|
|
9
|
+
FilterParserResponse,
|
|
10
10
|
Moment,
|
|
11
11
|
TemporalClause,
|
|
12
12
|
Duration,
|
|
@@ -17,7 +17,7 @@ import * as nearley from 'nearley';
|
|
|
17
17
|
import {run_parser} from './nearley_parse';
|
|
18
18
|
|
|
19
19
|
export const TemporalFilterExpression = {
|
|
20
|
-
parse(src: string):
|
|
20
|
+
parse(src: string): FilterParserResponse<TemporalClause> {
|
|
21
21
|
const ftemporal_parser = new nearley.Parser(
|
|
22
22
|
nearley.Grammar.fromCompiled(ftemporal_grammar)
|
|
23
23
|
);
|