@enonic-types/lib-node 7.12.0-B1 → 7.12.0-RC1

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.
Files changed (2) hide show
  1. package/node.d.ts +10 -10
  2. package/package.json +2 -2
package/node.d.ts CHANGED
@@ -11,8 +11,8 @@ declare global {
11
11
  '/lib/xp/node': typeof import('./node');
12
12
  }
13
13
  }
14
- import type { Aggregation, AggregationsResult, ByteSource, Filter, Highlight, HighlightResult, PrincipalKey, QueryDsl, SortDsl } from '@enonic-types/core';
15
- export type { ByteSource, GroupKey, PrincipalKey, RoleKey, UserKey, QueryDsl, SortDsl, InDslExpression, ExistsDslExpression, FulltextDslExpression, LikeDslExpression, StemmedDslExpression, TermDslExpression, RangeDslExpression, NgramDslExpression, BooleanDslExpression, MatchAllDslExpression, PathMatchDslExpression, DateBucket, BucketsAggregationResult, StatsAggregationResult, SingleValueMetricAggregationResult, AggregationsResult, Aggregation, TermsAggregation, HistogramAggregation, DateHistogramAggregation, NumericRange, NumericRangeAggregation, DateRange, DateRangeAggregation, StatsAggregation, GeoDistanceAggregation, MinAggregation, MaxAggregation, ValueCountAggregation, Highlight, HighlightResult, ExistsFilter, NotExistsFilter, HasValueFilter, IdsFilter, BooleanFilter, Filter, } from '@enonic-types/core';
14
+ import type { Aggregations, AggregationsResult, AggregationsToAggregationResults, ByteSource, Filter, Highlight, HighlightResult, PrincipalKey, QueryDsl, SortDsl } from '@enonic-types/core';
15
+ export type { Aggregation, Aggregations, AggregationsResult, BooleanDslExpression, BooleanFilter, BucketsAggregationResult, BucketsAggregationsUnion, ByteSource, DateBucket, DateHistogramAggregation, DateRange, DateRangeAggregation, ExistsDslExpression, ExistsFilter, Filter, FulltextDslExpression, GeoDistanceAggregation, GroupKey, HasValueFilter, Highlight, HighlightResult, HistogramAggregation, IdsFilter, InDslExpression, LikeDslExpression, MatchAllDslExpression, MaxAggregation, MinAggregation, NgramDslExpression, NotExistsFilter, NumericRange, NumericRangeAggregation, PathMatchDslExpression, PrincipalKey, QueryDsl, RangeDslExpression, RoleKey, SingleValueMetricAggregationResult, SingleValueMetricAggregationsUnion, SortDsl, StatsAggregation, StatsAggregationResult, StemmedDslExpression, TermDslExpression, TermsAggregation, UserKey, ValueCountAggregation, } from '@enonic-types/core';
16
16
  declare type WithRequiredProperty<T, K extends keyof T> = T & {
17
17
  [P in K]-?: T[P];
18
18
  };
@@ -55,21 +55,21 @@ export interface SuggestionResult {
55
55
  freq?: number;
56
56
  }[];
57
57
  }
58
- export interface NodeQueryResult {
58
+ export interface NodeQueryResult<AggregationOutput extends Record<string, AggregationsResult>> {
59
59
  total: number;
60
60
  count: number;
61
61
  hits: NodeQueryResultHit[];
62
- aggregations?: Record<string, AggregationsResult>;
62
+ aggregations: AggregationOutput;
63
63
  suggestions?: Record<string, SuggestionResult[]>;
64
64
  }
65
- export interface NodeMultiRepoQueryResult {
65
+ export interface NodeMultiRepoQueryResult<AggregationOutput extends Record<string, AggregationsResult>> {
66
66
  total: number;
67
67
  count: number;
68
68
  hits: (NodeQueryResultHit & {
69
69
  repoId: string;
70
70
  branch: string;
71
71
  })[];
72
- aggregations?: Record<string, AggregationsResult>;
72
+ aggregations: AggregationOutput;
73
73
  suggestions?: Record<string, SuggestionResult[]>;
74
74
  }
75
75
  export declare type CreateNodeParams<NodeData = unknown> = NodePropertiesOnCreate & NodeData;
@@ -120,13 +120,13 @@ export interface SetChildOrderParams {
120
120
  key: string;
121
121
  childOrder: string;
122
122
  }
123
- export interface QueryNodeParams {
123
+ export interface QueryNodeParams<AggregationInput extends Aggregations> {
124
124
  start?: number;
125
125
  count?: number;
126
126
  query?: QueryDsl | string;
127
127
  sort?: string | SortDsl | SortDsl[];
128
128
  filters?: Filter | Filter[];
129
- aggregations?: Record<string, Aggregation>;
129
+ aggregations?: AggregationInput;
130
130
  suggestions?: Record<string, TermSuggestion>;
131
131
  highlight?: Highlight;
132
132
  explain?: boolean;
@@ -270,7 +270,7 @@ export interface RepoConnection {
270
270
  getBinary(params: GetBinaryParams): ByteSource;
271
271
  move(params: MoveNodeParams): boolean;
272
272
  setChildOrder<NodeData = Record<string, unknown>>(params: SetChildOrderParams): Node<NodeData>;
273
- query(params: QueryNodeParams): NodeQueryResult;
273
+ query<AggregationInput extends Aggregations = never>(params: QueryNodeParams<AggregationInput>): NodeQueryResult<AggregationsToAggregationResults<AggregationInput>>;
274
274
  exists(key: string): boolean;
275
275
  findVersions(params: FindVersionsParams): NodeVersionsQueryResult;
276
276
  getActiveVersion(params: GetActiveVersionParams): NodeVersion | null;
@@ -283,7 +283,7 @@ export interface RepoConnection {
283
283
  duplicate<NodeData = Record<string, unknown>>(params: DuplicateParams): Node<NodeData>;
284
284
  }
285
285
  export interface MultiRepoConnection {
286
- query(params: QueryNodeParams): NodeMultiRepoQueryResult;
286
+ query<AggregationInput extends Aggregations = never>(params: QueryNodeParams<AggregationInput>): NodeMultiRepoQueryResult<AggregationsToAggregationResults<AggregationInput>>;
287
287
  }
288
288
  export interface ConnectParams {
289
289
  repoId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-node",
3
- "version": "7.12.0-B1",
3
+ "version": "7.12.0-RC1",
4
4
  "description": "Type definitions for lib-node.",
5
5
  "types": "node.d.ts",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
29
  "dependencies": {
30
- "@enonic-types/core": "7.12.0-B1"
30
+ "@enonic-types/core": "7.12.0-RC1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"