@enonic-types/lib-node 7.11.0-B3 → 7.11.0-B4
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 +20 -18
- 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
|
@@ -255,12 +255,12 @@ 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
|
} | {
|
|
@@ -328,7 +328,7 @@ export declare type NodeMultiRepoQueryResult = NodeQueryResult & {
|
|
|
328
328
|
branch: string;
|
|
329
329
|
}[];
|
|
330
330
|
};
|
|
331
|
-
export
|
|
331
|
+
export declare type CreateNodeParams<NodeData = unknown> = {
|
|
332
332
|
_name?: string;
|
|
333
333
|
_parentPath?: string;
|
|
334
334
|
_indexConfig?: NodeConfigEntry;
|
|
@@ -336,10 +336,10 @@ export interface CreateNodeParams {
|
|
|
336
336
|
_inheritsPermissions?: boolean;
|
|
337
337
|
_manualOrderValue?: number;
|
|
338
338
|
_childOrder?: string;
|
|
339
|
-
}
|
|
340
|
-
export interface ModifyNodeParams {
|
|
339
|
+
} & NodeData;
|
|
340
|
+
export interface ModifyNodeParams<NodeData = unknown> {
|
|
341
341
|
key: string;
|
|
342
|
-
editor: (node: Node) => Node
|
|
342
|
+
editor: (node: Node<NodeData>) => Node<NodeData>;
|
|
343
343
|
}
|
|
344
344
|
export interface GetNodeParams {
|
|
345
345
|
key: string;
|
|
@@ -476,8 +476,7 @@ export interface NodeConfigEntry {
|
|
|
476
476
|
indexValueProcessors: string[];
|
|
477
477
|
languages: string[];
|
|
478
478
|
}
|
|
479
|
-
export
|
|
480
|
-
[key: string]: unknown;
|
|
479
|
+
export declare type Node<Data = Record<string, unknown>> = {
|
|
481
480
|
_id: string;
|
|
482
481
|
_name: string;
|
|
483
482
|
_path: string;
|
|
@@ -491,25 +490,28 @@ export interface Node {
|
|
|
491
490
|
_indexConfig: NodeIndexConfig;
|
|
492
491
|
_inheritsPermissions: boolean;
|
|
493
492
|
_permissions?: AccessControlEntry[];
|
|
494
|
-
}
|
|
493
|
+
} & Data;
|
|
495
494
|
export interface RepoConnection {
|
|
496
|
-
create(params: CreateNodeParams): Node
|
|
497
|
-
modify(params: ModifyNodeParams): Node
|
|
498
|
-
get
|
|
495
|
+
create<NodeData = Record<string, unknown>>(params: CreateNodeParams<NodeData>): Node<NodeData>;
|
|
496
|
+
modify<NodeData = Record<string, unknown>>(params: ModifyNodeParams<NodeData>): Node<NodeData>;
|
|
497
|
+
get<NodeData = Record<string, unknown>>(key: string | GetNodeParams): Node<NodeData> | null;
|
|
498
|
+
get<NodeData = Record<string, unknown>>(keys: (string | GetNodeParams)[]): Node<NodeData>[] | null;
|
|
499
|
+
get<NodeData = Record<string, unknown>>(...keys: (string | GetNodeParams | (string | GetNodeParams)[])[]): Node<NodeData>[] | null;
|
|
500
|
+
get<NodeData = Record<string, unknown>>(...keys: (string | GetNodeParams | (string | GetNodeParams)[])[]): Node<NodeData> | Node<NodeData>[] | null;
|
|
499
501
|
delete(...keys: (string | string[])[]): string[];
|
|
500
502
|
push(params: PushNodeParams): PushNodesResult;
|
|
501
503
|
diff(params: DiffBranchesParams): DiffBranchesResult;
|
|
502
504
|
getBinary(params: GetBinaryParams): object;
|
|
503
505
|
move(params: MoveNodeParams): boolean;
|
|
504
|
-
setChildOrder(params: SetChildOrderParams): Node
|
|
506
|
+
setChildOrder<NodeData = Record<string, unknown>>(params: SetChildOrderParams): Node<NodeData>;
|
|
505
507
|
query(params: QueryNodeParams): NodeQueryResult;
|
|
506
508
|
exists(key: string): boolean;
|
|
507
509
|
findVersions(params: FindVersionsParams): NodeVersionsQueryResult;
|
|
508
510
|
getActiveVersion(params: GetActiveVersionParams): NodeVersion | null;
|
|
509
511
|
setActiveVersion(params: SetActiveVersionParams): boolean;
|
|
510
512
|
findChildren(params: FindChildrenParams): FindNodesByParentResult;
|
|
511
|
-
refresh(mode
|
|
512
|
-
setRootPermissions(params: SetRootPermissionsParams): Node
|
|
513
|
+
refresh(mode?: RefreshMode): void;
|
|
514
|
+
setRootPermissions<NodeData = Record<string, unknown>>(params: SetRootPermissionsParams): Node<NodeData>;
|
|
513
515
|
commit(params: CommitParams): NodeCommit;
|
|
514
516
|
getCommit(params: GetCommitParams): NodeCommit | null;
|
|
515
517
|
}
|
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-B4",
|
|
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-B4"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|