@enonic/js-utils
Advanced tools
Comparing version 0.26.0 to 0.26.1
@@ -59,3 +59,3 @@ { | ||
}, | ||
"version": "0.26.0" | ||
"version": "0.26.1" | ||
} |
@@ -329,3 +329,3 @@ import type { Log } from './globals.d' | ||
}; | ||
} | ||
} // query | ||
} // class Branch |
@@ -24,6 +24,8 @@ import type { PrincipalKey } from '../auth'; | ||
export type MultiRepoNodeQueryResponse<AggregationKeys extends string = never> = Omit< | ||
export type MultiRepoNodeQueryResponse< | ||
AggregationKeys extends undefined|string = undefined | ||
> = Omit< | ||
NodeQueryResponse<AggregationKeys>, | ||
"hits" | ||
> & { | ||
> & { | ||
hits: ReadonlyArray<MultiRepoNodeQueryHit>; | ||
@@ -33,5 +35,7 @@ }; | ||
export interface MultiRepoConnection { | ||
query<AggregationKeys extends string>( | ||
query< | ||
AggregationKeys extends undefined|string = undefined | ||
>( | ||
params: NodeQueryParams<AggregationKeys> | ||
): MultiRepoNodeQueryResponse<AggregationKeys>; | ||
} |
export interface TermsAggregation { | ||
terms: { | ||
field: string; | ||
order: string; | ||
size: number; | ||
order?: string; // _term ASC | ||
size?: number; // Default to 10 | ||
minDocCount?: number; | ||
@@ -136,2 +136,3 @@ }; | ||
export interface AggregationsResponseBucket { | ||
@@ -148,6 +149,23 @@ readonly docCount: number; | ||
readonly buckets: Array<AggregationsResponseBucket>; | ||
// Max, Min, Value Count | ||
readonly value? :number | ||
// Stats | ||
readonly avg? :number | ||
readonly count? :number | ||
readonly max? :number | ||
readonly min? :number | ||
readonly sum? :number | ||
} | ||
export type AggregationsResponse<AggregationKeys extends string> = { | ||
[K in AggregationKeys]: AggregationsResponseEntry; | ||
}; | ||
export type AggregationsResponse< | ||
AggregationKeys extends undefined|string = undefined | ||
> = AggregationKeys extends undefined | ||
? {} | ||
: AggregationKeys extends string | ||
? Record<AggregationKeys, AggregationsResponseEntry> | ||
/*? { | ||
[AggregationKey in AggregationKeys]: AggregationsResponseEntry | ||
}*/ | ||
: never; |
@@ -12,3 +12,3 @@ export interface Highlight { | ||
tagsSchema?: string; | ||
properties: Record<string, Highlight>; | ||
properties?: Record<string, Highlight>; // Yes it's optional, no error will occur, but no highilights returned either | ||
} |
@@ -9,3 +9,5 @@ import type {Aggregation} from './aggregation.d'; | ||
export interface NodeQueryParams<AggregationKeys extends string = never> { | ||
export interface NodeQueryParams< | ||
AggregationKeys extends undefined|string = undefined | ||
> { | ||
/** | ||
@@ -39,3 +41,7 @@ * Start index (used for paging). | ||
*/ | ||
aggregations?: Record<AggregationKeys, Aggregation>; | ||
aggregations?: AggregationKeys extends undefined | ||
? {} | ||
: AggregationKeys extends string | ||
? Record<AggregationKeys, Aggregation> | ||
: never | ||
@@ -42,0 +48,0 @@ /** |
@@ -33,3 +33,5 @@ import type { PrincipalKey } from '../auth'; | ||
export interface NodeQueryResponse<AggregationKeys extends string = never> { | ||
export interface NodeQueryResponse< | ||
AggregationKeys extends undefined|string = undefined | ||
> { | ||
readonly total: number; | ||
@@ -36,0 +38,0 @@ readonly count: number; |
import type {PermissionsParams} from '../auth' | ||
import type {AggregationsResponse} from '../node/query/aggregation.d'; | ||
export interface ElasticSearchIndexSettings { | ||
@@ -116,20 +118,5 @@ index?: { | ||
export interface AggregationsResponseBucket { | ||
docCount: number; | ||
key: string; | ||
from?: number | string; | ||
to?: number | string; | ||
[key2: string]: any; // sub aggregations | ||
} | ||
export interface AggregationsResponseEntry { | ||
buckets: Array<AggregationsResponseBucket>; | ||
} | ||
export type AggregationsResponse<AggregationKeys extends string> = { | ||
[K in AggregationKeys]: AggregationsResponseEntry; | ||
}; | ||
export interface NodeQueryResponse<AggregationKeys extends string = never> { | ||
export interface NodeQueryResponse< | ||
AggregationKeys extends undefined|string = undefined | ||
> { | ||
total: number; | ||
@@ -136,0 +123,0 @@ count: number; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1479448
46272