@enonic-types/lib-node 7.11.0-B1 → 7.11.0-B3
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 +4 -4
- package/node.d.ts +36 -361
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm i --save-dev @enonic/lib-node
|
|
8
|
+
npm i --save-dev @enonic-types/lib-node
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Use
|
|
@@ -26,8 +26,8 @@ Add the corresponding types to your `tsconfig.json` file that is used for applic
|
|
|
26
26
|
|
|
27
27
|
### Require and custom imports
|
|
28
28
|
|
|
29
|
-
To make `require` work out of box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
|
|
30
|
-
objects, e.g. `log`, `app`, `__`, etc, requiring library by the default path will return typed object.
|
|
29
|
+
To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
|
|
30
|
+
global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default path will return typed object.
|
|
31
31
|
|
|
32
32
|
`tsconfig.json`
|
|
33
33
|
|
|
@@ -49,7 +49,7 @@ const {connect, multiRepoConnect} = require('/lib/xp/node');
|
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
More detailed explanation on how it works and how to type custom import function can be
|
|
52
|
-
found [here](https://
|
|
52
|
+
found [here](https://developer.enonic.com/docs/xp/stable/api).
|
|
53
53
|
|
|
54
54
|
### ES6-style import
|
|
55
55
|
|
package/node.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ declare global {
|
|
|
11
11
|
'/lib/xp/node': typeof import('./node');
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
import type { PrincipalKey } from '@enonic-types/core';
|
|
15
|
+
export type { PrincipalKey, UserKey, GroupKey, RoleKey } from '@enonic-types/core';
|
|
16
|
+
declare type WithRequiredProperty<T, K extends keyof T> = T & {
|
|
17
|
+
[P in K]-?: T[P];
|
|
18
|
+
};
|
|
14
19
|
export interface Bucket {
|
|
15
20
|
[subAggregationName: string]: BucketsAggregation | StatsAggregation | SingleValueMetricAggregation | string | number | undefined;
|
|
16
21
|
key: string;
|
|
@@ -46,9 +51,7 @@ export interface TermsAggregation {
|
|
|
46
51
|
size?: number;
|
|
47
52
|
minDocCount?: number;
|
|
48
53
|
};
|
|
49
|
-
aggregations?:
|
|
50
|
-
[subAggregations: string]: Aggregation;
|
|
51
|
-
};
|
|
54
|
+
aggregations?: Record<string, Aggregation>;
|
|
52
55
|
}
|
|
53
56
|
export interface HistogramAggregation {
|
|
54
57
|
histogram: {
|
|
@@ -59,9 +62,7 @@ export interface HistogramAggregation {
|
|
|
59
62
|
extendedBoundMax?: number;
|
|
60
63
|
minDocCount?: number;
|
|
61
64
|
};
|
|
62
|
-
aggregations?:
|
|
63
|
-
[subAggregations: string]: Aggregation;
|
|
64
|
-
};
|
|
65
|
+
aggregations?: Record<string, Aggregation>;
|
|
65
66
|
}
|
|
66
67
|
export interface DateHistogramAggregation {
|
|
67
68
|
dateHistogram: {
|
|
@@ -70,9 +71,7 @@ export interface DateHistogramAggregation {
|
|
|
70
71
|
minDocCount?: number;
|
|
71
72
|
format: string;
|
|
72
73
|
};
|
|
73
|
-
aggregations?:
|
|
74
|
-
[subAggregations: string]: Aggregation;
|
|
75
|
-
};
|
|
74
|
+
aggregations?: Record<string, Aggregation>;
|
|
76
75
|
}
|
|
77
76
|
export interface NumericRange {
|
|
78
77
|
from?: number;
|
|
@@ -84,18 +83,14 @@ export interface NumericRangeAggregation {
|
|
|
84
83
|
field: string;
|
|
85
84
|
ranges?: NumericRange[];
|
|
86
85
|
};
|
|
87
|
-
aggregations?:
|
|
88
|
-
[subAggregations: string]: Aggregation;
|
|
89
|
-
};
|
|
86
|
+
aggregations?: Record<string, Aggregation>;
|
|
90
87
|
}
|
|
91
88
|
export interface NumericRangeAggregation {
|
|
92
89
|
range: {
|
|
93
90
|
field: string;
|
|
94
91
|
ranges?: NumericRange[];
|
|
95
92
|
};
|
|
96
|
-
aggregations?:
|
|
97
|
-
[subAggregations: string]: Aggregation;
|
|
98
|
-
};
|
|
93
|
+
aggregations?: Record<string, Aggregation>;
|
|
99
94
|
}
|
|
100
95
|
export interface DateRange {
|
|
101
96
|
from?: string;
|
|
@@ -108,9 +103,7 @@ export interface DateRangeAggregation {
|
|
|
108
103
|
format: string;
|
|
109
104
|
ranges: DateRange[];
|
|
110
105
|
};
|
|
111
|
-
aggregations?:
|
|
112
|
-
[subAggregations: string]: Aggregation;
|
|
113
|
-
};
|
|
106
|
+
aggregations?: Record<string, Aggregation>;
|
|
114
107
|
}
|
|
115
108
|
export interface StatsAggregation {
|
|
116
109
|
stats: {
|
|
@@ -329,43 +322,12 @@ export interface NodeQueryResult {
|
|
|
329
322
|
}[];
|
|
330
323
|
}[];
|
|
331
324
|
}
|
|
332
|
-
export
|
|
333
|
-
total: number;
|
|
334
|
-
count: number;
|
|
325
|
+
export declare type NodeMultiRepoQueryResult = NodeQueryResult & {
|
|
335
326
|
hits: {
|
|
336
|
-
id: string;
|
|
337
|
-
score: number;
|
|
338
327
|
repoId: string;
|
|
339
328
|
branch: string;
|
|
340
|
-
explanation?: Explanation;
|
|
341
|
-
highlight?: HighlightResult;
|
|
342
329
|
}[];
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
interface MultiRepoNodeHandler {
|
|
346
|
-
query(params: QueryNodeHandlerParams): NodeMultiRepoQueryResult;
|
|
347
|
-
}
|
|
348
|
-
interface NodeHandler {
|
|
349
|
-
create(node: ScriptValue): Node;
|
|
350
|
-
modify(editor: ScriptValue, key: string): Node;
|
|
351
|
-
setChildOrder(key: string, childOrder: string): Node;
|
|
352
|
-
get(params: GetNodeHandlerParams): Node | Node[] | null;
|
|
353
|
-
delete(keys: string[]): boolean;
|
|
354
|
-
push(params: PushNodeHandlerParams): PushNodesResult;
|
|
355
|
-
diff(params: DiffBranchesHandlerParams): object;
|
|
356
|
-
move(source: string, target: string): boolean;
|
|
357
|
-
query(params: QueryNodeHandlerParams): NodeQueryResult;
|
|
358
|
-
exist(key: string): boolean;
|
|
359
|
-
findVersions(params: FindVersionsHandlerParams): NodeVersionsQueryResult;
|
|
360
|
-
getActiveVersion(key: string): NodeVersion | null;
|
|
361
|
-
setActiveVersion(key: string, versionId: string): boolean;
|
|
362
|
-
findChildren(params: FindChildrenHandlerParams): FindNodesByParentResult;
|
|
363
|
-
commit(keys: string[], message?: string | null): object;
|
|
364
|
-
getCommit(commitId: string): NodeCommit | null;
|
|
365
|
-
setRootPermissions(v: ScriptValue): object;
|
|
366
|
-
getBinary(key: string, binaryReference?: string | null): object;
|
|
367
|
-
refresh(mode: RefreshMode): object;
|
|
368
|
-
}
|
|
330
|
+
};
|
|
369
331
|
export interface CreateNodeParams {
|
|
370
332
|
_name?: string;
|
|
371
333
|
_parentPath?: string;
|
|
@@ -383,10 +345,6 @@ export interface GetNodeParams {
|
|
|
383
345
|
key: string;
|
|
384
346
|
versionId?: string;
|
|
385
347
|
}
|
|
386
|
-
interface GetNodeHandlerParams {
|
|
387
|
-
add(key: string): void;
|
|
388
|
-
add(key: string, versionId?: string | null): void;
|
|
389
|
-
}
|
|
390
348
|
export interface PushNodeParams {
|
|
391
349
|
key?: string | null;
|
|
392
350
|
keys?: string[] | null;
|
|
@@ -403,23 +361,16 @@ export interface PushNodesResult {
|
|
|
403
361
|
}[];
|
|
404
362
|
deleted: string[];
|
|
405
363
|
}
|
|
406
|
-
interface PushNodeHandlerParams {
|
|
407
|
-
setKey(value?: string | null): void;
|
|
408
|
-
setKeys(value?: string[] | null): void;
|
|
409
|
-
setTargetBranch(value: string): void;
|
|
410
|
-
setIncludeChildren(value: boolean): void;
|
|
411
|
-
setExclude(value?: string[] | null): void;
|
|
412
|
-
setResolve(value: boolean): void;
|
|
413
|
-
}
|
|
414
364
|
export interface DiffBranchesParams {
|
|
415
365
|
key: string;
|
|
416
366
|
target: string;
|
|
417
367
|
includeChildren: boolean;
|
|
418
368
|
}
|
|
419
|
-
interface
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
369
|
+
export interface DiffBranchesResult {
|
|
370
|
+
diff: {
|
|
371
|
+
id: string;
|
|
372
|
+
status: string;
|
|
373
|
+
}[];
|
|
423
374
|
}
|
|
424
375
|
export interface GetBinaryParams {
|
|
425
376
|
key: string;
|
|
@@ -436,35 +387,19 @@ export interface SetChildOrderParams {
|
|
|
436
387
|
export interface QueryNodeParams {
|
|
437
388
|
start?: number;
|
|
438
389
|
count?: number;
|
|
439
|
-
query
|
|
390
|
+
query?: QueryDsl | string;
|
|
440
391
|
sort?: string | SortDsl | SortDsl[];
|
|
441
392
|
filters?: Filter | Filter[];
|
|
442
393
|
aggregations?: Record<string, Aggregation>;
|
|
443
394
|
suggestions?: Record<string, Suggestion>;
|
|
444
|
-
highlight
|
|
445
|
-
explain
|
|
446
|
-
}
|
|
447
|
-
interface QueryNodeHandlerParams {
|
|
448
|
-
setStart(value?: number | null): void;
|
|
449
|
-
setCount(value?: number | null): void;
|
|
450
|
-
setQuery(value: ScriptValue): void;
|
|
451
|
-
setSort(value: ScriptValue): void;
|
|
452
|
-
setAggregations(value: ScriptValue): void;
|
|
453
|
-
setSuggestions(value: ScriptValue): void;
|
|
454
|
-
setHighlight(value: ScriptValue): void;
|
|
455
|
-
setFilters(value: ScriptValue): void;
|
|
456
|
-
setExplain(value: boolean): void;
|
|
395
|
+
highlight?: Highlight;
|
|
396
|
+
explain?: boolean;
|
|
457
397
|
}
|
|
458
398
|
export interface FindVersionsParams {
|
|
459
399
|
key: string;
|
|
460
400
|
start?: number | null;
|
|
461
401
|
count?: number | null;
|
|
462
402
|
}
|
|
463
|
-
interface FindVersionsHandlerParams {
|
|
464
|
-
setKey(key: string): void;
|
|
465
|
-
setStart(start?: number | null): void;
|
|
466
|
-
setCount(count?: number | null): void;
|
|
467
|
-
}
|
|
468
403
|
export interface NodeVersion {
|
|
469
404
|
versionId: string;
|
|
470
405
|
nodeId: string;
|
|
@@ -492,14 +427,6 @@ export interface FindChildrenParams {
|
|
|
492
427
|
countOnly: boolean;
|
|
493
428
|
recursive: boolean;
|
|
494
429
|
}
|
|
495
|
-
interface FindChildrenHandlerParams {
|
|
496
|
-
setParentKey(parentKey: string): void;
|
|
497
|
-
setStart(start?: number | null): void;
|
|
498
|
-
setCount(count?: number | null): void;
|
|
499
|
-
setChildOrder(childOrder: string): void;
|
|
500
|
-
setCountOnly(countOnly: boolean): void;
|
|
501
|
-
setRecursive(recursive: boolean): void;
|
|
502
|
-
}
|
|
503
430
|
export interface FindNodesByParentResult {
|
|
504
431
|
total: number;
|
|
505
432
|
count: number;
|
|
@@ -565,288 +492,37 @@ export interface Node {
|
|
|
565
492
|
_inheritsPermissions: boolean;
|
|
566
493
|
_permissions?: AccessControlEntry[];
|
|
567
494
|
}
|
|
568
|
-
|
|
569
|
-
* Creates a new repo-connection.
|
|
570
|
-
*
|
|
571
|
-
* @returns {*} native Native repo-connection object.
|
|
572
|
-
* @constructor
|
|
573
|
-
*/
|
|
574
|
-
export declare class RepoConnection {
|
|
575
|
-
private nodeHandler;
|
|
576
|
-
constructor(nodeHandler: NodeHandler);
|
|
577
|
-
/**
|
|
578
|
-
* This function creates a node.
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
* To create a content where the name is not important and there could be multiple instances under the same parent content,
|
|
582
|
-
* skip the `name` parameter and specify a `displayName`.
|
|
583
|
-
*
|
|
584
|
-
* @example-ref examples/node/create-1.js
|
|
585
|
-
* @example-ref examples/node/create-2.js
|
|
586
|
-
*
|
|
587
|
-
* @param {object} params JSON with the parameters.
|
|
588
|
-
* @param {string} [params._name] Name of content.
|
|
589
|
-
* @param {string} [params._parentPath] Path to place content under.
|
|
590
|
-
* @param {object} [params._indexConfig] How the document should be indexed. A default value "byType" will be set if no value specified.
|
|
591
|
-
* @param {object} [params._permissions] The access control list for the node. By default the creator will have full access
|
|
592
|
-
* @param {boolean} [params._inheritsPermissions] true if the permissions should be inherited from the node parent. Default is false.
|
|
593
|
-
* @param {number} [params._manualOrderValue] Value used to order document when ordering by parent and child-order is set to manual
|
|
594
|
-
* @param {string} [params._childOrder] Default ordering of children when doing getChildren if no order is given in query
|
|
595
|
-
*
|
|
596
|
-
* @returns {object} Node created as JSON.
|
|
597
|
-
*/
|
|
495
|
+
export interface RepoConnection {
|
|
598
496
|
create(params: CreateNodeParams): Node;
|
|
599
|
-
/**
|
|
600
|
-
* This function modifies a node.
|
|
601
|
-
*
|
|
602
|
-
* @example-ref examples/node/modify.js
|
|
603
|
-
*
|
|
604
|
-
* @param {object} params JSON with the parameters.
|
|
605
|
-
* @param {string} params.key Path or id to the node.
|
|
606
|
-
* @param {function} params.editor Editor callback function.
|
|
607
|
-
*
|
|
608
|
-
* @returns {object} Modified node as JSON.
|
|
609
|
-
*/
|
|
610
497
|
modify(params: ModifyNodeParams): Node;
|
|
611
|
-
/**
|
|
612
|
-
* This function fetches nodes.
|
|
613
|
-
*
|
|
614
|
-
* @example-ref examples/node/get-1.js
|
|
615
|
-
* @example-ref examples/node/get-2.js
|
|
616
|
-
* @example-ref examples/node/get-3.js
|
|
617
|
-
*
|
|
618
|
-
* @param {...(string|string[]|object|object[])} keys to fetch. Each argument could be an id, a path, an object with key and versionId properties or an array of them.
|
|
619
|
-
*
|
|
620
|
-
* @returns {object} The node or node array (as JSON) fetched from the repository.
|
|
621
|
-
*/
|
|
622
498
|
get(...keys: (string | string[] | GetNodeParams | GetNodeParams[])[]): Node | Node[] | null;
|
|
623
|
-
|
|
624
|
-
* This function deletes a node or nodes.
|
|
625
|
-
*
|
|
626
|
-
* @example-ref examples/node/delete.js
|
|
627
|
-
*
|
|
628
|
-
* @param {...(string|string[])} keys Keys to delete. Each argument could be an id, a path or an array of the two.
|
|
629
|
-
*
|
|
630
|
-
* @returns {boolean} True if deleted, false otherwise.
|
|
631
|
-
*/
|
|
632
|
-
delete(...keys: (string | string[])[]): boolean;
|
|
633
|
-
/**
|
|
634
|
-
* This function push a node to a given branch.
|
|
635
|
-
*
|
|
636
|
-
* @example-ref examples/node/push-1.js
|
|
637
|
-
* @example-ref examples/node/push-2.js
|
|
638
|
-
* @example-ref examples/node/push-3.js
|
|
639
|
-
*
|
|
640
|
-
* @param {object} params JSON with the parameters.
|
|
641
|
-
* @param {string} params.key Id or path to the nodes
|
|
642
|
-
* @param {string[]} params.keys Array of ids or paths to the nodes
|
|
643
|
-
* @param {string} params.target Branch to push nodes to.
|
|
644
|
-
* @param {boolean} [params.includeChildren=false] Also push children of given nodes
|
|
645
|
-
* @param {boolean} [params.resolve=true] Resolve dependencies before pushing, meaning that references will also be pushed
|
|
646
|
-
* @param {string[]} [params.exclude] Array of ids or paths to nodes not to be pushed (nodes needed to maintain data integrity (e.g parents must be present in target) will be pushed anyway)
|
|
647
|
-
*
|
|
648
|
-
* @returns {object} PushNodesResult
|
|
649
|
-
*/
|
|
499
|
+
delete(...keys: (string | string[])[]): string[];
|
|
650
500
|
push(params: PushNodeParams): PushNodesResult;
|
|
651
|
-
|
|
652
|
-
* This function resolves the differences for node between current and given branch
|
|
653
|
-
*
|
|
654
|
-
* @example-ref examples/node/diff-1.js
|
|
655
|
-
*
|
|
656
|
-
* @param {object} params JSON with the parameters.
|
|
657
|
-
* @param {string} params.key Path or id to resolve diff for
|
|
658
|
-
* @param {string} params.target Branch to diff against.
|
|
659
|
-
* @param {boolean} [params.includeChildren=false] also resolve dependencies for children
|
|
660
|
-
*
|
|
661
|
-
* @returns {object} DiffNodesResult
|
|
662
|
-
*/
|
|
663
|
-
diff(params: DiffBranchesParams): object;
|
|
664
|
-
/**
|
|
665
|
-
* This function returns a binary stream.
|
|
666
|
-
*
|
|
667
|
-
* @example-ref examples/node/getBinary.js
|
|
668
|
-
* @param {string} params.key Path or id to the node.
|
|
669
|
-
* @param {string} params.binaryReference to the binary.
|
|
670
|
-
*
|
|
671
|
-
* @returns {*} Stream of the binary.
|
|
672
|
-
*/
|
|
501
|
+
diff(params: DiffBranchesParams): DiffBranchesResult;
|
|
673
502
|
getBinary(params: GetBinaryParams): object;
|
|
674
|
-
/**
|
|
675
|
-
* Rename a node or move it to a new path.
|
|
676
|
-
*
|
|
677
|
-
* @example-ref examples/node/move-1.js
|
|
678
|
-
* @example-ref examples/node/move-2.js
|
|
679
|
-
* @example-ref examples/node/move-3.js
|
|
680
|
-
*
|
|
681
|
-
* @param {object} params JSON with the parameters.
|
|
682
|
-
* @param {string} params.source Path or id of the node to be moved or renamed.
|
|
683
|
-
* @param {string} params.target New path or name for the node. If the target ends in slash '/', it specifies the parent path where to be moved. Otherwise it means the new desired path or name for the node.
|
|
684
|
-
*
|
|
685
|
-
* @returns {boolean} True if the node was successfully moved or renamed, false otherwise.
|
|
686
|
-
*/
|
|
687
503
|
move(params: MoveNodeParams): boolean;
|
|
688
|
-
/**
|
|
689
|
-
* Set node's children order
|
|
690
|
-
*
|
|
691
|
-
* @example-ref examples/node/setChildOrder.js
|
|
692
|
-
*
|
|
693
|
-
* @param {object} params JSON with the parameters.
|
|
694
|
-
* @param {string} params.key node's path or id
|
|
695
|
-
* @param {string} params.childOrder children order
|
|
696
|
-
* @returns {object} updated node
|
|
697
|
-
*/
|
|
698
504
|
setChildOrder(params: SetChildOrderParams): Node;
|
|
699
|
-
|
|
700
|
-
* This command queries nodes.
|
|
701
|
-
*
|
|
702
|
-
* @example-ref examples/node/query.js
|
|
703
|
-
*
|
|
704
|
-
* @param {object} params JSON with the parameters.
|
|
705
|
-
* @param {number} [params.start=0] Start index (used for paging).
|
|
706
|
-
* @param {number} [params.count=10] Number of contents to fetch.
|
|
707
|
-
* @param {string|object} [params.query] Query expression.
|
|
708
|
-
* @param {object} [params.filters] Query filters
|
|
709
|
-
* @param {string|object|object[]} [params.sort='_score DESC'] Sorting expression.
|
|
710
|
-
* @param {string} [params.aggregations] Aggregations expression.
|
|
711
|
-
* @param {string} [params.highlight] Highlighting parameters.
|
|
712
|
-
* @param {boolean} [params.explain=false] Return score calculation explanation.
|
|
713
|
-
* @returns {object} Result of query.
|
|
714
|
-
*/
|
|
715
|
-
query(params: QueryNodeParams): object;
|
|
716
|
-
/**
|
|
717
|
-
* Check if node exists.
|
|
718
|
-
*
|
|
719
|
-
* @example-ref examples/node/exists.js
|
|
720
|
-
*
|
|
721
|
-
* @param {string} [key] node path or id.
|
|
722
|
-
*
|
|
723
|
-
* @returns {boolean} True if exist, false otherwise.
|
|
724
|
-
*/
|
|
505
|
+
query(params: QueryNodeParams): NodeQueryResult;
|
|
725
506
|
exists(key: string): boolean;
|
|
726
|
-
/**
|
|
727
|
-
* This function returns node versions.
|
|
728
|
-
*
|
|
729
|
-
* @example-ref examples/node/findVersions.js
|
|
730
|
-
* @param {object} params JSON parameters.
|
|
731
|
-
* @param {string} params.key Path or ID of the node.
|
|
732
|
-
* @param {number} [params.start=0] Start index (used for paging).
|
|
733
|
-
* @param {number} [params.count=10] Number of node versions to fetch.
|
|
734
|
-
*
|
|
735
|
-
* @returns {object[]} Node versions.
|
|
736
|
-
*/
|
|
737
507
|
findVersions(params: FindVersionsParams): NodeVersionsQueryResult;
|
|
738
|
-
/**
|
|
739
|
-
* This function returns the active version of a node.
|
|
740
|
-
*
|
|
741
|
-
* @example-ref examples/node/getActiveVersion.js
|
|
742
|
-
* @param {object} params JSON parameters.
|
|
743
|
-
* @param {string} params.key Path or ID of the node.
|
|
744
|
-
*
|
|
745
|
-
* @returns {object} Active content versions per branch.
|
|
746
|
-
*/
|
|
747
508
|
getActiveVersion(params: GetActiveVersionParams): NodeVersion | null;
|
|
748
|
-
/**
|
|
749
|
-
* This function sets the active version of a node.
|
|
750
|
-
*
|
|
751
|
-
* @example-ref examples/node/setActiveVersion.js
|
|
752
|
-
* @param {object} params JSON parameters.
|
|
753
|
-
* @param {string} params.key Path or ID of the node.
|
|
754
|
-
* @param {string} params.versionId Version to set as active.
|
|
755
|
-
*
|
|
756
|
-
* @returns {boolean} True if deleted, false otherwise.
|
|
757
|
-
*/
|
|
758
509
|
setActiveVersion(params: SetActiveVersionParams): boolean;
|
|
759
|
-
/**
|
|
760
|
-
* Get children for given node.
|
|
761
|
-
*
|
|
762
|
-
* @example-ref examples/node/findChildren.js
|
|
763
|
-
*
|
|
764
|
-
* @param {object} params JSON with the parameters.
|
|
765
|
-
* @param {number} params.parentKey path or id of parent to get children of
|
|
766
|
-
* @param {number} [params.start=0] Start index (used for paging).
|
|
767
|
-
* @param {number} [params.count=10] Number of contents to fetch.
|
|
768
|
-
* @param {string} [params.childOrder] How to order the children (defaults to value stored on parent)
|
|
769
|
-
* @param {boolean} [params.countOnly=false] Optimize for count children only ( no children returned )
|
|
770
|
-
* @param {boolean} [params.recursive=false] Do recursive fetching of all children of children
|
|
771
|
-
* @returns {object} Result of getChildren.
|
|
772
|
-
*/
|
|
773
510
|
findChildren(params: FindChildrenParams): FindNodesByParentResult;
|
|
774
|
-
/**
|
|
775
|
-
* Refresh the index for the current repoConnection
|
|
776
|
-
*
|
|
777
|
-
* @example-ref examples/node/refresh.js
|
|
778
|
-
*
|
|
779
|
-
* @param {string} [mode]=ALL Refresh all (ALL) data, or just the search-index (SEARCH) or the storage-index (STORAGE)
|
|
780
|
-
*/
|
|
781
511
|
refresh(mode: RefreshMode): void;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
*
|
|
785
|
-
* @example-ref examples/node/modifyRootPermissions.js
|
|
786
|
-
*
|
|
787
|
-
* @param {object} params JSON with the parameters.
|
|
788
|
-
* @param {object} params._permissions the permission json
|
|
789
|
-
* @param {object} [params._inheritsPermissions]= true if the permissions should be inherited to children
|
|
790
|
-
*
|
|
791
|
-
* @returns {object} Updated root-node as JSON.
|
|
792
|
-
*/
|
|
793
|
-
setRootPermissions(params: SetRootPermissionsParams): object;
|
|
794
|
-
/**
|
|
795
|
-
* This function commits the active version of nodes.
|
|
796
|
-
*
|
|
797
|
-
* @example-ref examples/node/commit.js
|
|
798
|
-
*
|
|
799
|
-
* @param {...(string|string[])} params.keys Node keys to commit. Each argument could be an id, a path or an array of the two. Prefer the usage of ID rather than paths.
|
|
800
|
-
* @param {string} [params.message] Commit message.
|
|
801
|
-
*
|
|
802
|
-
* @returns {object} Commit object.
|
|
803
|
-
*/
|
|
804
|
-
commit(params: CommitParams): object;
|
|
805
|
-
/**
|
|
806
|
-
* This function fetches commit by id.
|
|
807
|
-
*
|
|
808
|
-
* @example-ref examples/node/commit.js
|
|
809
|
-
*
|
|
810
|
-
* @param {string} params.id existing commit id.
|
|
811
|
-
*
|
|
812
|
-
* @returns {object} Commit object.
|
|
813
|
-
*/
|
|
512
|
+
setRootPermissions(params: SetRootPermissionsParams): Node;
|
|
513
|
+
commit(params: CommitParams): NodeCommit;
|
|
814
514
|
getCommit(params: GetCommitParams): NodeCommit | null;
|
|
815
515
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
*
|
|
819
|
-
* @returns {*} native Native multirepo-connection object.
|
|
820
|
-
* @constructor
|
|
821
|
-
*/
|
|
822
|
-
export declare class MultiRepoConnection {
|
|
823
|
-
private multiRepoConnection;
|
|
824
|
-
constructor(multiRepoConnection: MultiRepoNodeHandler);
|
|
825
|
-
/**
|
|
826
|
-
* This command queries nodes in a multi-repo connection.
|
|
827
|
-
*
|
|
828
|
-
* @example-ref examples/node/multiRepoQuery.js
|
|
829
|
-
*
|
|
830
|
-
* @param {object} params JSON with the parameters.
|
|
831
|
-
* @param {number} [params.start=0] Start index (used for paging).
|
|
832
|
-
* @param {number} [params.count=10] Number of contents to fetch.
|
|
833
|
-
* @param {string|object} [params.query] Query expression.
|
|
834
|
-
* @param {object} [params.filters] Query filters
|
|
835
|
-
* @param {string|object|object[]} [params.sort='_score DESC'] Sorting expression.
|
|
836
|
-
* @param {string} [params.aggregations] Aggregations expression.
|
|
837
|
-
* @param {string} [params.highlight] Highlighting parameters.
|
|
838
|
-
* @param {boolean} [params.explain=false] Return score calculation explanation.
|
|
839
|
-
* @returns {object} Result of query.
|
|
840
|
-
*/
|
|
841
|
-
query(params: QueryNodeParams): object;
|
|
516
|
+
export interface MultiRepoConnection {
|
|
517
|
+
query(params: QueryNodeParams): NodeMultiRepoQueryResult;
|
|
842
518
|
}
|
|
843
519
|
export interface ConnectParams {
|
|
844
520
|
repoId: string;
|
|
845
521
|
branch: string;
|
|
846
|
-
principals
|
|
847
|
-
user
|
|
522
|
+
principals?: PrincipalKey[];
|
|
523
|
+
user?: {
|
|
848
524
|
login: string;
|
|
849
|
-
idProvider
|
|
525
|
+
idProvider?: string;
|
|
850
526
|
};
|
|
851
527
|
}
|
|
852
528
|
/**
|
|
@@ -864,6 +540,9 @@ export interface ConnectParams {
|
|
|
864
540
|
* @returns {RepoConnection} Returns a new repo-connection.
|
|
865
541
|
*/
|
|
866
542
|
export declare function connect(params: ConnectParams): RepoConnection;
|
|
543
|
+
export interface MultiRepoConnectParams {
|
|
544
|
+
sources: WithRequiredProperty<ConnectParams, 'principals'>[];
|
|
545
|
+
}
|
|
867
546
|
/**
|
|
868
547
|
* Creates a connection to several repositories with a given branch and authentication info.
|
|
869
548
|
*
|
|
@@ -876,12 +555,8 @@ export declare function connect(params: ConnectParams): RepoConnection;
|
|
|
876
555
|
* @param {object} [params.sources.user] User to execute the callback with. Default is the current user.
|
|
877
556
|
* @param {string} params.sources.user.login Login of the user.
|
|
878
557
|
* @param {string} [params.sources.user.idProvider] Id provider containing the user. By default, all the id providers will be used.
|
|
879
|
-
* @param {string[]}
|
|
558
|
+
* @param {string[]} params.sources.principals Principals to execute the callback with.
|
|
880
559
|
*
|
|
881
560
|
* @returns {MultiRepoConnection} Returns a new multirepo-connection.
|
|
882
561
|
*/
|
|
883
|
-
export interface MultiRepoConnectParams {
|
|
884
|
-
sources: ConnectParams[];
|
|
885
|
-
}
|
|
886
562
|
export declare function multiRepoConnect(params: MultiRepoConnectParams): MultiRepoConnection;
|
|
887
|
-
export {};
|
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-B3",
|
|
4
4
|
"description": "Type definitions for lib-node.",
|
|
5
5
|
"types": "node.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"url": "https://github.com/enonic/xp/issues"
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/enonic/xp/tree/master#readme",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@enonic-types/core": "7.11.0-B3"
|
|
31
|
+
},
|
|
29
32
|
"publishConfig": {
|
|
30
33
|
"access": "public"
|
|
31
34
|
}
|