-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
105 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
### Added | ||
|
||
- TypeScript typings for config/settings | ||
- TypeScript typings for CQP queries | ||
|
||
### Changed | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** @format */ | ||
export type CqpQuery = CqpToken[] | ||
|
||
export type CqpToken = { | ||
and_block: Condition[][] | ||
bound?: Record<"lbound" | "rbound", true> | ||
/** `[min]` or `[min, max]` */ | ||
repeat?: [number] | [number, number] | ||
struct?: string | ||
start?: number | ||
} | ||
|
||
export type Condition = { | ||
type: string | ||
op: OperatorKorp | ||
val: string | DateRange | ||
flags: Record<string, true> | ||
} | ||
|
||
/** Should be `[fromdate, todate, fromtime, totime]` */ | ||
export type DateRange = (string | number)[] | ||
|
||
export type Operator = "=" | "!=" | "contains" | "not contains" | ||
|
||
export type OperatorKorp = | ||
| Operator | ||
| "^=" | ||
| "_=" | ||
| "&=" | ||
| "*=" | ||
| "!*=" | ||
| "rank_contains" | ||
| "not_rank_contains" | ||
| "highest_rank" | ||
| "not_highest_rank" | ||
| "regexp_contains" | ||
| "not_regexp_contains" | ||
| "starts_with_contains" | ||
| "not_starts_with_contains" | ||
| "incontains_contains" | ||
| "not_incontains_contains" | ||
| "ends_with_contains" | ||
| "not_ends_with_contains" |