Skip to content

Commit

Permalink
Fix type to allow nested boolean filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tajakobsen committed Oct 24, 2022
1 parent 85fe7bd commit aa1fd38
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "enonic-types",
"sideEffects": false,
"version": "0.4.11",
"version": "0.4.12",
"description": "TypeScript types for Enonic XP",
"typings": "index.d.ts",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ declare module "*/lib/xp/content" {
start?: number;
count: number;
query?: string | QueryDSL;
filters?: BasicFilters | BooleanFilter;
filters?: Filter | Filter[];
aggregations?: Record<string, Aggregation>;
contentTypes?: Array<string>;
highlight?: Highlight;
Expand Down Expand Up @@ -474,13 +474,13 @@ declare module "*/lib/xp/content" {
};
}

export type BasicFilters = ExistsFilter | NotExistsFilter | HasValueFilter | IdsFilter;
export type Filter = ExistsFilter | NotExistsFilter | HasValueFilter | IdsFilter | BooleanFilter;

export interface BooleanFilter {
boolean: {
must?: BasicFilters | Array<BasicFilters>;
mustNot?: BasicFilters | Array<BasicFilters>;
should?: BasicFilters | Array<BasicFilters>;
must?: Filter[];
mustNot?: Filter[];
should?: Filter[];
};
}

Expand Down
4 changes: 3 additions & 1 deletion src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ declare module "*/lib/xp/node" {

export type PrincipalKey = import("/lib/xp/auth").PrincipalKey;

export type Filter = import("/lib/xp/content").Filter;

export interface Source {
repoId: string;
branch: string;
Expand Down Expand Up @@ -82,7 +84,7 @@ declare module "*/lib/xp/node" {
/**
* Query filters
*/
filters?: import("/lib/xp/content").BasicFilters | import("/lib/xp/content").BooleanFilter;
filters?: Filter | Filter[];

/**
* Sorting expression.
Expand Down

0 comments on commit aa1fd38

Please sign in to comment.