mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
chore(test): fix typing errors in parser
This commit is contained in:
@@ -6,7 +6,7 @@ import Expression from "./expression.js";
|
||||
import TrueExp from "./true.js";
|
||||
|
||||
class AndExp extends Expression {
|
||||
private subExpressions: Expression[];
|
||||
subExpressions: Expression[];
|
||||
|
||||
static of(_subExpressions: (Expression | null | undefined)[]) {
|
||||
const subExpressions = _subExpressions.filter((exp) => !!exp) as Expression[];
|
||||
|
||||
@@ -7,8 +7,8 @@ import becca from "../../../becca/becca.js";
|
||||
import Expression from "./expression.js";
|
||||
|
||||
class AttributeExistsExp extends Expression {
|
||||
private attributeType: string;
|
||||
private attributeName: string;
|
||||
attributeType: string;
|
||||
attributeName: string;
|
||||
private isTemplateLabel: boolean;
|
||||
private prefixMatch: boolean;
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import SearchContext from "../search_context.js";
|
||||
type Comparator = (value: string) => boolean;
|
||||
|
||||
class LabelComparisonExp extends Expression {
|
||||
private attributeType: string;
|
||||
private attributeName: string;
|
||||
private comparator: Comparator;
|
||||
attributeType: string;
|
||||
attributeName: string;
|
||||
comparator: Comparator;
|
||||
|
||||
constructor(attributeType: string, attributeName: string, comparator: Comparator) {
|
||||
super();
|
||||
|
||||
@@ -5,7 +5,7 @@ import SearchContext from "../search_context.js";
|
||||
import Expression from "./expression.js";
|
||||
|
||||
class NotExp extends Expression {
|
||||
private subExpression: Expression;
|
||||
subExpression: Expression;
|
||||
|
||||
constructor(subExpression: Expression) {
|
||||
super();
|
||||
|
||||
@@ -34,7 +34,7 @@ type SearchRow = Pick<NoteRow, "noteId" | "type" | "mime" | "content" | "isProte
|
||||
|
||||
class NoteContentFulltextExp extends Expression {
|
||||
private operator: string;
|
||||
private tokens: string[];
|
||||
tokens: string[];
|
||||
private raw: boolean;
|
||||
private flatText: boolean;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { normalize } from "../../utils.js";
|
||||
import beccaService from "../../../becca/becca_service.js";
|
||||
|
||||
class NoteFlatTextExp extends Expression {
|
||||
private tokens: string[];
|
||||
tokens: string[];
|
||||
|
||||
constructor(tokens: string[]) {
|
||||
super();
|
||||
|
||||
@@ -6,7 +6,7 @@ import TrueExp from "./true.js";
|
||||
import SearchContext from "../search_context.js";
|
||||
|
||||
class OrExp extends Expression {
|
||||
private subExpressions: Expression[];
|
||||
subExpressions: Expression[];
|
||||
|
||||
static of(subExpressions: Expression[]) {
|
||||
subExpressions = subExpressions.filter((exp) => !!exp);
|
||||
|
||||
@@ -18,7 +18,7 @@ interface OrderDefinition {
|
||||
|
||||
class OrderByAndLimitExp extends Expression {
|
||||
private orderDefinitions: OrderDefinition[];
|
||||
private limit: number;
|
||||
limit: number;
|
||||
subExpression: Expression | null;
|
||||
|
||||
constructor(orderDefinitions: Pick<OrderDefinition, "direction" | "valueExtractor">[], limit?: number) {
|
||||
|
||||
@@ -41,9 +41,9 @@ interface SearchContext {
|
||||
}
|
||||
|
||||
class PropertyComparisonExp extends Expression {
|
||||
private propertyName: string;
|
||||
private operator: string;
|
||||
private comparedValue: string;
|
||||
propertyName: string;
|
||||
operator: string;
|
||||
comparedValue: string;
|
||||
private comparator;
|
||||
|
||||
static isProperty(name: string) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class SearchContext {
|
||||
originalQuery: string;
|
||||
fulltextQuery: string;
|
||||
dbLoadNeeded: boolean;
|
||||
private error: string | null;
|
||||
error: string | null;
|
||||
|
||||
constructor(params: SearchParams = {}) {
|
||||
this.fastSearch = !!params.fastSearch;
|
||||
|
||||
@@ -423,7 +423,14 @@ function getExpression(tokens: TokenData[], searchContext: SearchContext, level
|
||||
return getAggregateExpression();
|
||||
}
|
||||
|
||||
function parse({ fulltextTokens, expressionTokens, searchContext }: { fulltextTokens: TokenData[]; expressionTokens: TokenStructure; searchContext: SearchContext; originalQuery: string }) {
|
||||
export interface ParseOpts {
|
||||
fulltextTokens: TokenData[];
|
||||
expressionTokens: TokenStructure;
|
||||
searchContext: SearchContext;
|
||||
originalQuery?: string
|
||||
}
|
||||
|
||||
function parse({ fulltextTokens, expressionTokens, searchContext }: ParseOpts) {
|
||||
let expression: Expression | undefined | null;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user