@enonic-types/lib-node 7.11.0-B3 → 7.11.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.
- package/README.md +7 -25
- package/node.d.ts +53 -43
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,20 +10,6 @@ npm i --save-dev @enonic-types/lib-node
|
|
|
10
10
|
|
|
11
11
|
## Use
|
|
12
12
|
|
|
13
|
-
Add the corresponding types to your `tsconfig.json` file that is used for application's server-side TypeScript code.
|
|
14
|
-
|
|
15
|
-
`tsconfig.json`
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"compilerOptions": {
|
|
20
|
-
"types": [
|
|
21
|
-
"@enonic-types/lib-node"
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
13
|
### Require and custom imports
|
|
28
14
|
|
|
29
15
|
To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
|
|
@@ -31,12 +17,11 @@ global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default
|
|
|
31
17
|
|
|
32
18
|
`tsconfig.json`
|
|
33
19
|
|
|
34
|
-
```
|
|
20
|
+
```json
|
|
35
21
|
{
|
|
36
22
|
"compilerOptions": {
|
|
37
23
|
"types": [
|
|
38
|
-
|
|
39
|
-
"@enonic-types/lib-node"
|
|
24
|
+
"@enonic-types/global"
|
|
40
25
|
]
|
|
41
26
|
}
|
|
42
27
|
}
|
|
@@ -58,16 +43,13 @@ types mapping to your configuration.
|
|
|
58
43
|
|
|
59
44
|
`tsconfig.json`
|
|
60
45
|
|
|
61
|
-
```
|
|
46
|
+
```json
|
|
62
47
|
{
|
|
63
48
|
"compilerOptions": {
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
+ "paths": {
|
|
69
|
-
+ "/lib/xp/node": ["node_modules/@enonic-types/lib-node"],
|
|
70
|
-
+ }
|
|
49
|
+
"baseUrl": "./",
|
|
50
|
+
"paths": {
|
|
51
|
+
"/lib/xp/node": ["node_modules/@enonic-types/lib-node"]
|
|
52
|
+
}
|
|
71
53
|
}
|
|
72
54
|
}
|
|
73
55
|
```
|
package/node.d.ts
CHANGED
|
@@ -175,9 +175,9 @@ export interface IdsFilter {
|
|
|
175
175
|
}
|
|
176
176
|
export interface BooleanFilter {
|
|
177
177
|
boolean: {
|
|
178
|
-
must?: Filter[];
|
|
179
|
-
mustNot?: Filter[];
|
|
180
|
-
should?: Filter[];
|
|
178
|
+
must?: Filter | Filter[];
|
|
179
|
+
mustNot?: Filter | Filter[];
|
|
180
|
+
should?: Filter | Filter[];
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
export declare type Filter = ExistsFilter | NotExistsFilter | HasValueFilter | IdsFilter | BooleanFilter;
|
|
@@ -255,16 +255,18 @@ export interface StemmedDslExpression {
|
|
|
255
255
|
language: string;
|
|
256
256
|
}
|
|
257
257
|
export interface BooleanDslExpression {
|
|
258
|
-
should?:
|
|
259
|
-
must?:
|
|
260
|
-
mustNot?:
|
|
261
|
-
filter?:
|
|
258
|
+
should?: QueryDsl | QueryDsl[];
|
|
259
|
+
must?: QueryDsl | QueryDsl[];
|
|
260
|
+
mustNot?: QueryDsl | QueryDsl[];
|
|
261
|
+
filter?: QueryDsl | QueryDsl[];
|
|
262
|
+
boost?: number;
|
|
262
263
|
}
|
|
263
|
-
export declare type DslExpression = TermDslExpression | InDslExpression | LikeDslExpression | RangeDslExpression | PathMatchDslExpression | MatchAllDslExpression | FulltextDslExpression | NgramDslExpression | BooleanDslExpression | StemmedDslExpression;
|
|
264
264
|
export declare type QueryDsl = {
|
|
265
265
|
boolean: BooleanDslExpression;
|
|
266
266
|
} | {
|
|
267
267
|
ngram: NgramDslExpression;
|
|
268
|
+
} | {
|
|
269
|
+
stemmed: StemmedDslExpression;
|
|
268
270
|
} | {
|
|
269
271
|
fulltext: FulltextDslExpression;
|
|
270
272
|
} | {
|
|
@@ -299,36 +301,42 @@ export interface Explanation {
|
|
|
299
301
|
description: string;
|
|
300
302
|
details: Explanation[];
|
|
301
303
|
}
|
|
304
|
+
export interface NodeQueryResultHit {
|
|
305
|
+
id: string;
|
|
306
|
+
score: number;
|
|
307
|
+
explanation?: Explanation;
|
|
308
|
+
highlight?: HighlightResult;
|
|
309
|
+
}
|
|
310
|
+
export interface NodeQueryResultSuggestion {
|
|
311
|
+
[suggestionName: string]: {
|
|
312
|
+
text: string;
|
|
313
|
+
length: number;
|
|
314
|
+
offset: number;
|
|
315
|
+
options: {
|
|
316
|
+
text: string;
|
|
317
|
+
score: number;
|
|
318
|
+
freq?: number;
|
|
319
|
+
}[];
|
|
320
|
+
}[];
|
|
321
|
+
}
|
|
302
322
|
export interface NodeQueryResult {
|
|
303
323
|
total: number;
|
|
304
324
|
count: number;
|
|
305
|
-
hits:
|
|
306
|
-
id: string;
|
|
307
|
-
score: number;
|
|
308
|
-
explanation?: Explanation;
|
|
309
|
-
highlight?: HighlightResult;
|
|
310
|
-
}[];
|
|
325
|
+
hits: NodeQueryResultHit[];
|
|
311
326
|
aggregations?: AggregationsResult;
|
|
312
|
-
suggestions?:
|
|
313
|
-
[suggestionName: string]: {
|
|
314
|
-
text: string;
|
|
315
|
-
length: number;
|
|
316
|
-
offset: number;
|
|
317
|
-
options: {
|
|
318
|
-
text: string;
|
|
319
|
-
score: number;
|
|
320
|
-
freq?: number;
|
|
321
|
-
}[];
|
|
322
|
-
}[];
|
|
323
|
-
}[];
|
|
327
|
+
suggestions?: NodeQueryResultSuggestion[];
|
|
324
328
|
}
|
|
325
|
-
export
|
|
326
|
-
|
|
329
|
+
export interface NodeMultiRepoQueryResult {
|
|
330
|
+
total: number;
|
|
331
|
+
count: number;
|
|
332
|
+
hits: (NodeQueryResultHit & {
|
|
327
333
|
repoId: string;
|
|
328
334
|
branch: string;
|
|
329
|
-
}[];
|
|
330
|
-
|
|
331
|
-
|
|
335
|
+
})[];
|
|
336
|
+
aggregations?: AggregationsResult;
|
|
337
|
+
suggestions?: NodeQueryResultSuggestion[];
|
|
338
|
+
}
|
|
339
|
+
export declare type CreateNodeParams<NodeData = unknown> = {
|
|
332
340
|
_name?: string;
|
|
333
341
|
_parentPath?: string;
|
|
334
342
|
_indexConfig?: NodeConfigEntry;
|
|
@@ -336,10 +344,10 @@ export interface CreateNodeParams {
|
|
|
336
344
|
_inheritsPermissions?: boolean;
|
|
337
345
|
_manualOrderValue?: number;
|
|
338
346
|
_childOrder?: string;
|
|
339
|
-
}
|
|
340
|
-
export interface ModifyNodeParams {
|
|
347
|
+
} & NodeData;
|
|
348
|
+
export interface ModifyNodeParams<NodeData = unknown> {
|
|
341
349
|
key: string;
|
|
342
|
-
editor: (node: Node) => Node
|
|
350
|
+
editor: (node: Node<NodeData>) => Node<NodeData>;
|
|
343
351
|
}
|
|
344
352
|
export interface GetNodeParams {
|
|
345
353
|
key: string;
|
|
@@ -476,8 +484,7 @@ export interface NodeConfigEntry {
|
|
|
476
484
|
indexValueProcessors: string[];
|
|
477
485
|
languages: string[];
|
|
478
486
|
}
|
|
479
|
-
export
|
|
480
|
-
[key: string]: unknown;
|
|
487
|
+
export declare type Node<Data = Record<string, unknown>> = {
|
|
481
488
|
_id: string;
|
|
482
489
|
_name: string;
|
|
483
490
|
_path: string;
|
|
@@ -491,25 +498,28 @@ export interface Node {
|
|
|
491
498
|
_indexConfig: NodeIndexConfig;
|
|
492
499
|
_inheritsPermissions: boolean;
|
|
493
500
|
_permissions?: AccessControlEntry[];
|
|
494
|
-
}
|
|
501
|
+
} & Data;
|
|
495
502
|
export interface RepoConnection {
|
|
496
|
-
create(params: CreateNodeParams): Node
|
|
497
|
-
modify(params: ModifyNodeParams): Node
|
|
498
|
-
get
|
|
503
|
+
create<NodeData = Record<string, unknown>>(params: CreateNodeParams<NodeData>): Node<NodeData>;
|
|
504
|
+
modify<NodeData = Record<string, unknown>>(params: ModifyNodeParams<NodeData>): Node<NodeData>;
|
|
505
|
+
get<NodeData = Record<string, unknown>>(key: string | GetNodeParams): Node<NodeData> | null;
|
|
506
|
+
get<NodeData = Record<string, unknown>>(keys: (string | GetNodeParams)[]): Node<NodeData>[] | null;
|
|
507
|
+
get<NodeData = Record<string, unknown>>(...keys: (string | GetNodeParams | (string | GetNodeParams)[])[]): Node<NodeData>[] | null;
|
|
508
|
+
get<NodeData = Record<string, unknown>>(...keys: (string | GetNodeParams | (string | GetNodeParams)[])[]): Node<NodeData> | Node<NodeData>[] | null;
|
|
499
509
|
delete(...keys: (string | string[])[]): string[];
|
|
500
510
|
push(params: PushNodeParams): PushNodesResult;
|
|
501
511
|
diff(params: DiffBranchesParams): DiffBranchesResult;
|
|
502
512
|
getBinary(params: GetBinaryParams): object;
|
|
503
513
|
move(params: MoveNodeParams): boolean;
|
|
504
|
-
setChildOrder(params: SetChildOrderParams): Node
|
|
514
|
+
setChildOrder<NodeData = Record<string, unknown>>(params: SetChildOrderParams): Node<NodeData>;
|
|
505
515
|
query(params: QueryNodeParams): NodeQueryResult;
|
|
506
516
|
exists(key: string): boolean;
|
|
507
517
|
findVersions(params: FindVersionsParams): NodeVersionsQueryResult;
|
|
508
518
|
getActiveVersion(params: GetActiveVersionParams): NodeVersion | null;
|
|
509
519
|
setActiveVersion(params: SetActiveVersionParams): boolean;
|
|
510
520
|
findChildren(params: FindChildrenParams): FindNodesByParentResult;
|
|
511
|
-
refresh(mode
|
|
512
|
-
setRootPermissions(params: SetRootPermissionsParams): Node
|
|
521
|
+
refresh(mode?: RefreshMode): void;
|
|
522
|
+
setRootPermissions<NodeData = Record<string, unknown>>(params: SetRootPermissionsParams): Node<NodeData>;
|
|
513
523
|
commit(params: CommitParams): NodeCommit;
|
|
514
524
|
getCommit(params: GetCommitParams): NodeCommit | null;
|
|
515
525
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-node",
|
|
3
|
-
"version": "7.11.0-
|
|
3
|
+
"version": "7.11.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.11.0-
|
|
30
|
+
"@enonic-types/core": "7.11.0-RC1"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|