@enonic-types/lib-node 7.11.2 → 7.12.0-B1
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.
- package/node.d.ts +36 -292
- package/package.json +2 -2
package/node.d.ts
CHANGED
|
@@ -11,176 +11,11 @@ declare global {
|
|
|
11
11
|
'/lib/xp/node': typeof import('./node');
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
import type { ByteSource, PrincipalKey } from '@enonic-types/core';
|
|
15
|
-
export type { ByteSource, GroupKey, PrincipalKey, RoleKey, UserKey, } from '@enonic-types/core';
|
|
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';
|
|
16
16
|
declare type WithRequiredProperty<T, K extends keyof T> = T & {
|
|
17
17
|
[P in K]-?: T[P];
|
|
18
18
|
};
|
|
19
|
-
export interface Bucket {
|
|
20
|
-
[subAggregationName: string]: AggregationsResult | string | number | undefined;
|
|
21
|
-
key: string;
|
|
22
|
-
docCount: number;
|
|
23
|
-
}
|
|
24
|
-
export interface NumericBucket extends Bucket {
|
|
25
|
-
from?: number;
|
|
26
|
-
to?: number;
|
|
27
|
-
}
|
|
28
|
-
export interface DateBucket extends Bucket {
|
|
29
|
-
from?: string;
|
|
30
|
-
to?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface BucketsAggregationResult {
|
|
33
|
-
buckets: (DateBucket | NumericBucket)[];
|
|
34
|
-
}
|
|
35
|
-
export interface StatsAggregationResult {
|
|
36
|
-
count: number;
|
|
37
|
-
min: number;
|
|
38
|
-
max: number;
|
|
39
|
-
avg: number;
|
|
40
|
-
sum: number;
|
|
41
|
-
}
|
|
42
|
-
export interface SingleValueMetricAggregationResult {
|
|
43
|
-
value: number;
|
|
44
|
-
}
|
|
45
|
-
export declare type AggregationsResult = BucketsAggregationResult | StatsAggregationResult | SingleValueMetricAggregationResult;
|
|
46
|
-
export declare type Aggregation = TermsAggregation | HistogramAggregation | DateHistogramAggregation | NumericRangeAggregation | DateRangeAggregation | StatsAggregation | GeoDistanceAggregation | MinAggregation | MaxAggregation | ValueCountAggregation;
|
|
47
|
-
export interface TermsAggregation {
|
|
48
|
-
terms: {
|
|
49
|
-
field: string;
|
|
50
|
-
order?: string;
|
|
51
|
-
size?: number;
|
|
52
|
-
minDocCount?: number;
|
|
53
|
-
};
|
|
54
|
-
aggregations?: Record<string, Aggregation>;
|
|
55
|
-
}
|
|
56
|
-
export interface HistogramAggregation {
|
|
57
|
-
histogram: {
|
|
58
|
-
field: string;
|
|
59
|
-
order?: string;
|
|
60
|
-
interval?: number;
|
|
61
|
-
extendedBoundMin?: number;
|
|
62
|
-
extendedBoundMax?: number;
|
|
63
|
-
minDocCount?: number;
|
|
64
|
-
};
|
|
65
|
-
aggregations?: Record<string, Aggregation>;
|
|
66
|
-
}
|
|
67
|
-
export interface DateHistogramAggregation {
|
|
68
|
-
dateHistogram: {
|
|
69
|
-
field: string;
|
|
70
|
-
interval?: string;
|
|
71
|
-
minDocCount?: number;
|
|
72
|
-
format: string;
|
|
73
|
-
};
|
|
74
|
-
aggregations?: Record<string, Aggregation>;
|
|
75
|
-
}
|
|
76
|
-
export interface NumericRange {
|
|
77
|
-
from?: number;
|
|
78
|
-
to?: number;
|
|
79
|
-
key?: string;
|
|
80
|
-
}
|
|
81
|
-
export interface NumericRangeAggregation {
|
|
82
|
-
range: {
|
|
83
|
-
field: string;
|
|
84
|
-
ranges?: NumericRange[];
|
|
85
|
-
};
|
|
86
|
-
aggregations?: Record<string, Aggregation>;
|
|
87
|
-
}
|
|
88
|
-
export interface NumericRangeAggregation {
|
|
89
|
-
range: {
|
|
90
|
-
field: string;
|
|
91
|
-
ranges?: NumericRange[];
|
|
92
|
-
};
|
|
93
|
-
aggregations?: Record<string, Aggregation>;
|
|
94
|
-
}
|
|
95
|
-
export interface DateRange {
|
|
96
|
-
from?: string;
|
|
97
|
-
to?: string;
|
|
98
|
-
key?: string;
|
|
99
|
-
}
|
|
100
|
-
export interface DateRangeAggregation {
|
|
101
|
-
dateRange: {
|
|
102
|
-
field: string;
|
|
103
|
-
format: string;
|
|
104
|
-
ranges: DateRange[];
|
|
105
|
-
};
|
|
106
|
-
aggregations?: Record<string, Aggregation>;
|
|
107
|
-
}
|
|
108
|
-
export interface StatsAggregation {
|
|
109
|
-
stats: {
|
|
110
|
-
field: string;
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
export interface GeoDistanceAggregation {
|
|
114
|
-
geoDistance: {
|
|
115
|
-
field: string;
|
|
116
|
-
unit: string;
|
|
117
|
-
origin?: {
|
|
118
|
-
lat: string;
|
|
119
|
-
lon: string;
|
|
120
|
-
};
|
|
121
|
-
ranges?: NumericRange[];
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
export interface MinAggregation {
|
|
125
|
-
min: {
|
|
126
|
-
field: string;
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
export interface MaxAggregation {
|
|
130
|
-
max: {
|
|
131
|
-
field: string;
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
export interface ValueCountAggregation {
|
|
135
|
-
count: {
|
|
136
|
-
field: string;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
export interface Highlight {
|
|
140
|
-
encoder?: 'default' | 'html';
|
|
141
|
-
tagsSchema?: 'styled';
|
|
142
|
-
fragmenter?: 'simple' | 'span';
|
|
143
|
-
fragmentSize?: number;
|
|
144
|
-
noMatchSize?: number;
|
|
145
|
-
numberOfFragments?: number;
|
|
146
|
-
order?: 'score' | 'none';
|
|
147
|
-
preTag?: string;
|
|
148
|
-
postTag?: string;
|
|
149
|
-
requireFieldMatch?: boolean;
|
|
150
|
-
properties?: Record<string, Highlight>;
|
|
151
|
-
}
|
|
152
|
-
export interface HighlightResult {
|
|
153
|
-
[highlightedFieldName: string]: string[];
|
|
154
|
-
}
|
|
155
|
-
export interface ExistsFilter {
|
|
156
|
-
exists: {
|
|
157
|
-
field: string;
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
export interface NotExistsFilter {
|
|
161
|
-
notExists: {
|
|
162
|
-
field: string;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
export interface HasValueFilter {
|
|
166
|
-
hasValue: {
|
|
167
|
-
field: string;
|
|
168
|
-
values: unknown[];
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
export interface IdsFilter {
|
|
172
|
-
ids: {
|
|
173
|
-
values: string[];
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
export interface BooleanFilter {
|
|
177
|
-
boolean: {
|
|
178
|
-
must?: Filter | Filter[];
|
|
179
|
-
mustNot?: Filter | Filter[];
|
|
180
|
-
should?: Filter | Filter[];
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
export declare type Filter = ExistsFilter | NotExistsFilter | HasValueFilter | IdsFilter | BooleanFilter;
|
|
184
19
|
export interface TermSuggestion {
|
|
185
20
|
text: string;
|
|
186
21
|
term: TermSuggestionOptions;
|
|
@@ -199,111 +34,6 @@ export interface TermSuggestionOptions {
|
|
|
199
34
|
minDocFreq?: number | null;
|
|
200
35
|
maxTermFreq?: number | null;
|
|
201
36
|
}
|
|
202
|
-
export declare type DslQueryType = 'dateTime' | 'time';
|
|
203
|
-
export declare type DslOperator = 'OR' | 'AND';
|
|
204
|
-
export interface TermDslExpression {
|
|
205
|
-
field: string;
|
|
206
|
-
value: unknown;
|
|
207
|
-
type?: DslQueryType;
|
|
208
|
-
boost?: number;
|
|
209
|
-
}
|
|
210
|
-
export interface InDslExpression {
|
|
211
|
-
field: string;
|
|
212
|
-
values: unknown[];
|
|
213
|
-
type?: DslQueryType;
|
|
214
|
-
boost?: number;
|
|
215
|
-
}
|
|
216
|
-
export interface LikeDslExpression {
|
|
217
|
-
field: string;
|
|
218
|
-
value: string;
|
|
219
|
-
type?: DslQueryType;
|
|
220
|
-
boost?: number;
|
|
221
|
-
}
|
|
222
|
-
export interface RangeDslExpression {
|
|
223
|
-
field: string;
|
|
224
|
-
type?: DslQueryType;
|
|
225
|
-
lt?: unknown;
|
|
226
|
-
lte?: unknown;
|
|
227
|
-
gt?: unknown;
|
|
228
|
-
gte?: unknown;
|
|
229
|
-
boost?: number;
|
|
230
|
-
}
|
|
231
|
-
export interface PathMatchDslExpression {
|
|
232
|
-
field: string;
|
|
233
|
-
path: string;
|
|
234
|
-
minimumMatch?: number;
|
|
235
|
-
boost?: number;
|
|
236
|
-
}
|
|
237
|
-
export interface MatchAllDslExpression {
|
|
238
|
-
boost?: number;
|
|
239
|
-
}
|
|
240
|
-
export interface FulltextDslExpression {
|
|
241
|
-
fields: string[];
|
|
242
|
-
query: string;
|
|
243
|
-
operator?: DslOperator;
|
|
244
|
-
boost?: number;
|
|
245
|
-
}
|
|
246
|
-
export interface NgramDslExpression {
|
|
247
|
-
fields: string[];
|
|
248
|
-
query: string;
|
|
249
|
-
operator?: DslOperator;
|
|
250
|
-
boost?: number;
|
|
251
|
-
}
|
|
252
|
-
export interface StemmedDslExpression {
|
|
253
|
-
fields: string[];
|
|
254
|
-
query: string;
|
|
255
|
-
language: string;
|
|
256
|
-
operator?: DslOperator;
|
|
257
|
-
boost?: number;
|
|
258
|
-
}
|
|
259
|
-
export interface ExistsDslExpression {
|
|
260
|
-
field: string;
|
|
261
|
-
boost?: number;
|
|
262
|
-
}
|
|
263
|
-
export interface BooleanDslExpression {
|
|
264
|
-
should?: QueryDsl | QueryDsl[];
|
|
265
|
-
must?: QueryDsl | QueryDsl[];
|
|
266
|
-
mustNot?: QueryDsl | QueryDsl[];
|
|
267
|
-
filter?: QueryDsl | QueryDsl[];
|
|
268
|
-
boost?: number;
|
|
269
|
-
}
|
|
270
|
-
export declare type QueryDsl = {
|
|
271
|
-
boolean: BooleanDslExpression;
|
|
272
|
-
} | {
|
|
273
|
-
ngram: NgramDslExpression;
|
|
274
|
-
} | {
|
|
275
|
-
stemmed: StemmedDslExpression;
|
|
276
|
-
} | {
|
|
277
|
-
fulltext: FulltextDslExpression;
|
|
278
|
-
} | {
|
|
279
|
-
matchAll: MatchAllDslExpression;
|
|
280
|
-
} | {
|
|
281
|
-
pathMatch: PathMatchDslExpression;
|
|
282
|
-
} | {
|
|
283
|
-
range: RangeDslExpression;
|
|
284
|
-
} | {
|
|
285
|
-
like: LikeDslExpression;
|
|
286
|
-
} | {
|
|
287
|
-
in: InDslExpression;
|
|
288
|
-
} | {
|
|
289
|
-
term: TermDslExpression;
|
|
290
|
-
} | {
|
|
291
|
-
exists: ExistsDslExpression;
|
|
292
|
-
};
|
|
293
|
-
export declare type SortDirection = 'ASC' | 'DESC';
|
|
294
|
-
export declare type DistanceUnit = 'm' | 'meters' | 'in' | 'inch' | 'yd' | 'yards' | 'ft' | 'feet' | 'km' | 'kilometers' | 'NM' | 'nmi' | 'nauticalmiles' | 'mm' | 'millimeters' | 'cm' | 'centimeters' | 'mi' | 'miles';
|
|
295
|
-
export interface FieldSortDsl {
|
|
296
|
-
field: string;
|
|
297
|
-
direction?: SortDirection;
|
|
298
|
-
}
|
|
299
|
-
export interface GeoDistanceSortDsl extends FieldSortDsl {
|
|
300
|
-
unit?: DistanceUnit;
|
|
301
|
-
location?: {
|
|
302
|
-
lat: number;
|
|
303
|
-
lon: number;
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
export declare type SortDsl = FieldSortDsl | GeoDistanceSortDsl;
|
|
307
37
|
export interface Explanation {
|
|
308
38
|
value: number;
|
|
309
39
|
description: string;
|
|
@@ -342,18 +72,10 @@ export interface NodeMultiRepoQueryResult {
|
|
|
342
72
|
aggregations?: Record<string, AggregationsResult>;
|
|
343
73
|
suggestions?: Record<string, SuggestionResult[]>;
|
|
344
74
|
}
|
|
345
|
-
export declare type CreateNodeParams<NodeData = unknown> =
|
|
346
|
-
_name?: string;
|
|
347
|
-
_parentPath?: string;
|
|
348
|
-
_indexConfig?: Partial<NodeIndexConfigParams>;
|
|
349
|
-
_permissions?: AccessControlEntry[];
|
|
350
|
-
_inheritsPermissions?: boolean;
|
|
351
|
-
_manualOrderValue?: number;
|
|
352
|
-
_childOrder?: string;
|
|
353
|
-
} & NodeData;
|
|
75
|
+
export declare type CreateNodeParams<NodeData = unknown> = NodePropertiesOnCreate & NodeData;
|
|
354
76
|
export interface ModifyNodeParams<NodeData = unknown> {
|
|
355
77
|
key: string;
|
|
356
|
-
editor: (node: Node<NodeData>) =>
|
|
78
|
+
editor: (node: Node<NodeData>) => ModifiedNode<NodeData>;
|
|
357
79
|
}
|
|
358
80
|
export interface GetNodeParams {
|
|
359
81
|
key: string;
|
|
@@ -441,6 +163,14 @@ export interface FindChildrenParams {
|
|
|
441
163
|
countOnly: boolean;
|
|
442
164
|
recursive: boolean;
|
|
443
165
|
}
|
|
166
|
+
export interface DuplicateParams {
|
|
167
|
+
nodeId: string;
|
|
168
|
+
name?: string;
|
|
169
|
+
parent?: string;
|
|
170
|
+
includeChildren?: boolean;
|
|
171
|
+
dataProcessor?: ScriptValue;
|
|
172
|
+
refresh?: RefreshMode;
|
|
173
|
+
}
|
|
444
174
|
export interface FindNodesByParentResult {
|
|
445
175
|
total: number;
|
|
446
176
|
count: number;
|
|
@@ -499,21 +229,34 @@ export interface NodeConfigEntry {
|
|
|
499
229
|
indexValueProcessors: string[];
|
|
500
230
|
languages: string[];
|
|
501
231
|
}
|
|
502
|
-
export declare type
|
|
503
|
-
|
|
232
|
+
export declare type CommonNodeProperties = {
|
|
233
|
+
_childOrder: string;
|
|
234
|
+
_inheritsPermissions: boolean;
|
|
235
|
+
_manualOrderValue?: number;
|
|
504
236
|
_name: string;
|
|
237
|
+
_nodeType: string;
|
|
505
238
|
_path: string;
|
|
506
|
-
|
|
239
|
+
_permissions: AccessControlEntry[];
|
|
507
240
|
_state: string;
|
|
508
|
-
_nodeType: string;
|
|
509
|
-
_versionKey: string;
|
|
510
|
-
_manualOrderValue: number;
|
|
511
241
|
_ts: string;
|
|
512
|
-
|
|
242
|
+
_versionKey: string;
|
|
243
|
+
};
|
|
244
|
+
export declare type NodePropertiesOnCreate = Partial<CommonNodeProperties> & {
|
|
245
|
+
_indexConfig?: Partial<NodeIndexConfigParams>;
|
|
246
|
+
_parentPath?: string;
|
|
247
|
+
};
|
|
248
|
+
export declare type NodePropertiesOnModify = CommonNodeProperties & {
|
|
249
|
+
_id: string;
|
|
250
|
+
_indexConfig: NodeIndexConfigParams;
|
|
251
|
+
_parentPath?: never;
|
|
252
|
+
};
|
|
253
|
+
export declare type NodePropertiesOnRead = CommonNodeProperties & {
|
|
254
|
+
_id: string;
|
|
513
255
|
_indexConfig: NodeIndexConfig;
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
256
|
+
_parentPath?: never;
|
|
257
|
+
};
|
|
258
|
+
export declare type ModifiedNode<Data = Record<string, unknown>> = NodePropertiesOnModify & Data;
|
|
259
|
+
export declare type Node<Data = Record<string, unknown>> = NodePropertiesOnRead & Data;
|
|
517
260
|
export interface RepoConnection {
|
|
518
261
|
create<NodeData = Record<string, unknown>>(params: CreateNodeParams<NodeData>): Node<NodeData>;
|
|
519
262
|
modify<NodeData = Record<string, unknown>>(params: ModifyNodeParams<NodeData>): Node<NodeData>;
|
|
@@ -537,6 +280,7 @@ export interface RepoConnection {
|
|
|
537
280
|
setRootPermissions<NodeData = Record<string, unknown>>(params: SetRootPermissionsParams): Node<NodeData>;
|
|
538
281
|
commit(params: CommitParams): NodeCommit;
|
|
539
282
|
getCommit(params: GetCommitParams): NodeCommit | null;
|
|
283
|
+
duplicate<NodeData = Record<string, unknown>>(params: DuplicateParams): Node<NodeData>;
|
|
540
284
|
}
|
|
541
285
|
export interface MultiRepoConnection {
|
|
542
286
|
query(params: QueryNodeParams): NodeMultiRepoQueryResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-node",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0-B1",
|
|
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.
|
|
30
|
+
"@enonic-types/core": "7.12.0-B1"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|