@enonic-types/lib-node 7.16.2 → 8.0.0-A3
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 +79 -40
- package/package.json +2 -2
package/node.d.ts
CHANGED
|
@@ -13,9 +13,6 @@ declare global {
|
|
|
13
13
|
}
|
|
14
14
|
import type { Aggregations, AggregationsResult, AggregationsToAggregationResults, ByteSource, Filter, Highlight, HighlightResult, PrincipalKey, QueryDsl, SortDsl } from '@enonic-types/core';
|
|
15
15
|
export type { Aggregation, Aggregations, AggregationsResult, BooleanDslExpression, BooleanFilter, Bucket, BucketsAggregationResult, BucketsAggregationsUnion, ByteSource, DateBucket, DateHistogramAggregation, DateRange, DateRangeAggregation, DistanceUnit, DslOperator, DslQueryType, ExistsDslExpression, ExistsFilter, FieldSortDsl, Filter, FulltextDslExpression, GeoDistanceAggregation, GeoDistanceSortDsl, GroupKey, HasValueFilter, Highlight, HighlightResult, HistogramAggregation, IdsFilter, InDslExpression, LikeDslExpression, MatchAllDslExpression, MaxAggregation, MinAggregation, NgramDslExpression, NotExistsFilter, NumericBucket, NumericRange, NumericRangeAggregation, PathMatchDslExpression, PrincipalKey, QueryDsl, RangeDslExpression, RoleKey, ScriptValue, SingleValueMetricAggregationResult, SingleValueMetricAggregationsUnion, SortDirection, SortDsl, StatsAggregation, StatsAggregationResult, StemmedDslExpression, TermDslExpression, TermsAggregation, UserKey, ValueCountAggregation, ValueType, } from '@enonic-types/core';
|
|
16
|
-
declare type WithRequiredProperty<T, K extends keyof T> = T & {
|
|
17
|
-
[P in K]-?: T[P];
|
|
18
|
-
};
|
|
19
16
|
export interface TermSuggestion {
|
|
20
17
|
text: string;
|
|
21
18
|
term: TermSuggestionOptions;
|
|
@@ -72,11 +69,18 @@ export interface NodeMultiRepoQueryResult<AggregationOutput extends Record<strin
|
|
|
72
69
|
aggregations: AggregationOutput;
|
|
73
70
|
suggestions?: Record<string, SuggestionResult[]>;
|
|
74
71
|
}
|
|
75
|
-
export
|
|
72
|
+
export type CreateNodeParams<NodeData = unknown> = NodePropertiesOnCreate & NodeData;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated Use {@link UpdateNodeParams} instead
|
|
75
|
+
*/
|
|
76
76
|
export interface ModifyNodeParams<NodeData = unknown> {
|
|
77
77
|
key: string;
|
|
78
78
|
editor: (node: Node<NodeData>) => ModifiedNode<NodeData>;
|
|
79
79
|
}
|
|
80
|
+
export interface UpdateNodeParams<NodeData = unknown> {
|
|
81
|
+
key: string;
|
|
82
|
+
editor: (node: Node<NodeData>) => UpdatedNode<NodeData>;
|
|
83
|
+
}
|
|
80
84
|
export interface GetNodeParams {
|
|
81
85
|
key: string;
|
|
82
86
|
versionId?: string;
|
|
@@ -97,6 +101,18 @@ export interface PushNodesResult {
|
|
|
97
101
|
}[];
|
|
98
102
|
deleted: string[];
|
|
99
103
|
}
|
|
104
|
+
export interface PatchNodeParams {
|
|
105
|
+
key: string;
|
|
106
|
+
editor: (node: Node) => PatchedNode;
|
|
107
|
+
branches: string[];
|
|
108
|
+
}
|
|
109
|
+
export interface PatchNodeResult {
|
|
110
|
+
nodeId: string;
|
|
111
|
+
branchResult: {
|
|
112
|
+
branch: string;
|
|
113
|
+
node: PatchedNode;
|
|
114
|
+
}[];
|
|
115
|
+
}
|
|
100
116
|
export interface DiffBranchesParams {
|
|
101
117
|
key: string;
|
|
102
118
|
target: string;
|
|
@@ -116,10 +132,14 @@ export interface MoveNodeParams {
|
|
|
116
132
|
source: string;
|
|
117
133
|
target: string;
|
|
118
134
|
}
|
|
119
|
-
export interface
|
|
135
|
+
export interface SortNodeParams {
|
|
120
136
|
key: string;
|
|
121
137
|
childOrder: string;
|
|
122
138
|
}
|
|
139
|
+
export interface SortNodeResult<NodeData> {
|
|
140
|
+
node: Node<NodeData>;
|
|
141
|
+
reorderedNodes?: Node<NodeData>[];
|
|
142
|
+
}
|
|
123
143
|
export interface QueryNodeParams<AggregationInput extends Aggregations = never> {
|
|
124
144
|
start?: number;
|
|
125
145
|
count?: number;
|
|
@@ -131,10 +151,10 @@ export interface QueryNodeParams<AggregationInput extends Aggregations = never>
|
|
|
131
151
|
highlight?: Highlight;
|
|
132
152
|
explain?: boolean;
|
|
133
153
|
}
|
|
134
|
-
export interface
|
|
154
|
+
export interface GetVersionsParams {
|
|
135
155
|
key: string;
|
|
136
|
-
|
|
137
|
-
count?: number
|
|
156
|
+
cursor?: string | null;
|
|
157
|
+
count?: number;
|
|
138
158
|
}
|
|
139
159
|
export interface NodeVersion {
|
|
140
160
|
versionId: string;
|
|
@@ -143,18 +163,15 @@ export interface NodeVersion {
|
|
|
143
163
|
timestamp: string;
|
|
144
164
|
commitId?: string;
|
|
145
165
|
}
|
|
146
|
-
export interface
|
|
166
|
+
export interface GetNodeVersionsResult {
|
|
147
167
|
total: number;
|
|
148
168
|
count: number;
|
|
169
|
+
cursor?: string | null;
|
|
149
170
|
hits: NodeVersion[];
|
|
150
171
|
}
|
|
151
172
|
export interface GetActiveVersionParams {
|
|
152
173
|
key: string;
|
|
153
174
|
}
|
|
154
|
-
export interface SetActiveVersionParams {
|
|
155
|
-
key: string;
|
|
156
|
-
versionId: string;
|
|
157
|
-
}
|
|
158
175
|
export interface FindChildrenParams {
|
|
159
176
|
parentKey: string;
|
|
160
177
|
start?: number | null;
|
|
@@ -178,7 +195,20 @@ export interface FindNodesByParentResult {
|
|
|
178
195
|
id: string;
|
|
179
196
|
}[];
|
|
180
197
|
}
|
|
181
|
-
export
|
|
198
|
+
export interface ApplyPermissionsParams {
|
|
199
|
+
key: string;
|
|
200
|
+
permissions?: AccessControlEntry[];
|
|
201
|
+
addPermissions?: AccessControlEntry[];
|
|
202
|
+
removePermissions?: AccessControlEntry[];
|
|
203
|
+
branches?: string[];
|
|
204
|
+
scope?: string;
|
|
205
|
+
}
|
|
206
|
+
export type ApplyPermissionsResult = Record<string, BranchResult[]>;
|
|
207
|
+
export interface BranchResult {
|
|
208
|
+
branch: string;
|
|
209
|
+
node: Node;
|
|
210
|
+
}
|
|
211
|
+
export type RefreshMode = 'SEARCH' | 'STORAGE' | 'ALL';
|
|
182
212
|
export interface GetCommitParams {
|
|
183
213
|
id: string;
|
|
184
214
|
}
|
|
@@ -192,11 +222,7 @@ export interface CommitParams {
|
|
|
192
222
|
keys: string | string[];
|
|
193
223
|
message?: string;
|
|
194
224
|
}
|
|
195
|
-
export
|
|
196
|
-
_permissions: AccessControlEntry[];
|
|
197
|
-
_inheritsPermissions: boolean;
|
|
198
|
-
}
|
|
199
|
-
export declare type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
|
|
225
|
+
export type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
|
|
200
226
|
export interface AccessControlEntry {
|
|
201
227
|
principal: PrincipalKey;
|
|
202
228
|
allow?: Permission[];
|
|
@@ -210,7 +236,7 @@ export interface NodeIndexConfig {
|
|
|
210
236
|
config: NodeConfigEntry;
|
|
211
237
|
}[];
|
|
212
238
|
}
|
|
213
|
-
export
|
|
239
|
+
export type NodeIndexConfigTemplates = 'none' | 'byType' | 'fulltext' | 'path' | 'minimal';
|
|
214
240
|
export interface NodeIndexConfigParams {
|
|
215
241
|
analyzer?: string;
|
|
216
242
|
default?: Partial<NodeConfigEntry> | NodeIndexConfigTemplates;
|
|
@@ -229,37 +255,54 @@ export interface NodeConfigEntry {
|
|
|
229
255
|
indexValueProcessors: string[];
|
|
230
256
|
languages: string[];
|
|
231
257
|
}
|
|
232
|
-
export
|
|
258
|
+
export interface CommonNodeProperties {
|
|
233
259
|
_childOrder: string;
|
|
234
|
-
_inheritsPermissions: boolean;
|
|
235
260
|
_manualOrderValue?: number;
|
|
236
261
|
_name: string;
|
|
237
262
|
_nodeType: string;
|
|
238
263
|
_path: string;
|
|
239
264
|
_permissions: AccessControlEntry[];
|
|
240
|
-
_state: string;
|
|
241
265
|
_ts: string;
|
|
242
266
|
_versionKey: string;
|
|
243
|
-
}
|
|
244
|
-
export
|
|
267
|
+
}
|
|
268
|
+
export type NodePropertiesOnCreate = Partial<CommonNodeProperties> & {
|
|
245
269
|
_indexConfig?: Partial<NodeIndexConfigParams>;
|
|
246
270
|
_parentPath?: string;
|
|
271
|
+
_inheritsPermissions?: boolean;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* @deprecated Use {@link NodePropertiesOnUpdate} instead
|
|
275
|
+
*/
|
|
276
|
+
export type NodePropertiesOnModify = CommonNodeProperties & {
|
|
277
|
+
_id: string;
|
|
278
|
+
_indexConfig: NodeIndexConfigParams;
|
|
279
|
+
_parentPath?: never;
|
|
247
280
|
};
|
|
248
|
-
export
|
|
281
|
+
export type NodePropertiesOnUpdate = CommonNodeProperties & {
|
|
249
282
|
_id: string;
|
|
250
283
|
_indexConfig: NodeIndexConfigParams;
|
|
251
284
|
_parentPath?: never;
|
|
252
285
|
};
|
|
253
|
-
export
|
|
286
|
+
export type NodePropertiesOnPatch = CommonNodeProperties & {
|
|
287
|
+
_id: string;
|
|
288
|
+
_indexConfig: NodeIndexConfigParams;
|
|
289
|
+
_parentPath?: never;
|
|
290
|
+
};
|
|
291
|
+
export type NodePropertiesOnRead = CommonNodeProperties & {
|
|
254
292
|
_id: string;
|
|
255
293
|
_indexConfig: NodeIndexConfig;
|
|
256
294
|
_parentPath?: never;
|
|
257
295
|
};
|
|
258
|
-
|
|
259
|
-
|
|
296
|
+
/**
|
|
297
|
+
* @deprecated Use {@link UpdatedNode} instead
|
|
298
|
+
*/
|
|
299
|
+
export type ModifiedNode<Data = Record<string, unknown>> = NodePropertiesOnModify & Data;
|
|
300
|
+
export type UpdatedNode<Data = Record<string, unknown>> = NodePropertiesOnUpdate & Data;
|
|
301
|
+
export type PatchedNode<Data = Record<string, unknown>> = NodePropertiesOnPatch & Data;
|
|
302
|
+
export type Node<Data = Record<string, unknown>> = NodePropertiesOnRead & Data;
|
|
260
303
|
export interface RepoConnection {
|
|
261
304
|
create<NodeData = Record<string, unknown>>(params: CreateNodeParams<NodeData>): Node<NodeData>;
|
|
262
|
-
|
|
305
|
+
update<NodeData = Record<string, unknown>>(params: UpdateNodeParams<NodeData>): Node<NodeData>;
|
|
263
306
|
get<NodeData = Record<string, unknown>>(key: string | GetNodeParams): Node<NodeData> | null;
|
|
264
307
|
get<NodeData = Record<string, unknown>>(keys: (string | GetNodeParams)[]): Node<NodeData> | Node<NodeData>[] | null;
|
|
265
308
|
get<NodeData = Record<string, unknown>>(...keys: (string | GetNodeParams | (string | GetNodeParams)[])[]): Node<NodeData> | Node<NodeData>[] | null;
|
|
@@ -268,15 +311,14 @@ export interface RepoConnection {
|
|
|
268
311
|
diff(params: DiffBranchesParams): DiffBranchesResult;
|
|
269
312
|
getBinary(params: GetBinaryParams): ByteSource;
|
|
270
313
|
move(params: MoveNodeParams): boolean;
|
|
271
|
-
|
|
314
|
+
sort<NodeData = Record<string, unknown>>(params: SortNodeParams): SortNodeResult<NodeData>;
|
|
272
315
|
query<AggregationInput extends Aggregations = never>(params: QueryNodeParams<AggregationInput>): NodeQueryResult<AggregationsToAggregationResults<AggregationInput>>;
|
|
273
316
|
exists(key: string): boolean;
|
|
274
|
-
|
|
317
|
+
getVersions(params: GetVersionsParams): GetNodeVersionsResult;
|
|
275
318
|
getActiveVersion(params: GetActiveVersionParams): NodeVersion | null;
|
|
276
|
-
setActiveVersion(params: SetActiveVersionParams): boolean;
|
|
277
319
|
findChildren(params: FindChildrenParams): FindNodesByParentResult;
|
|
278
320
|
refresh(mode?: RefreshMode): void;
|
|
279
|
-
|
|
321
|
+
applyPermissions(params: ApplyPermissionsParams): ApplyPermissionsResult;
|
|
280
322
|
commit(params: CommitParams): NodeCommit;
|
|
281
323
|
getCommit(params: GetCommitParams): NodeCommit | null;
|
|
282
324
|
duplicate<NodeData = Record<string, unknown>>(params: DuplicateParams<NodeData>): Node<NodeData>;
|
|
@@ -303,13 +345,13 @@ export interface ConnectParams {
|
|
|
303
345
|
* @param {object} params.branch branch id
|
|
304
346
|
* @param {object} [params.user] User to execute the callback with. Default is the current user.
|
|
305
347
|
* @param {string} params.user.login Login of the user.
|
|
306
|
-
* @param {string} [params.user.idProvider] Id provider containing the user. By default,
|
|
348
|
+
* @param {string} [params.user.idProvider] Id provider containing the user. By default, the system id provider is used.
|
|
307
349
|
* @param {string[]} [params.principals] Additional principals to execute the callback with.
|
|
308
350
|
* @returns {RepoConnection} Returns a new repo-connection.
|
|
309
351
|
*/
|
|
310
352
|
export declare function connect(params: ConnectParams): RepoConnection;
|
|
311
353
|
export interface MultiRepoConnectParams {
|
|
312
|
-
sources:
|
|
354
|
+
sources: Omit<ConnectParams, 'user'>[];
|
|
313
355
|
}
|
|
314
356
|
/**
|
|
315
357
|
* Creates a connection to several repositories with a given branch and authentication info.
|
|
@@ -320,10 +362,7 @@ export interface MultiRepoConnectParams {
|
|
|
320
362
|
* @param {object[]} params.sources array of sources to connect to
|
|
321
363
|
* @param {object} params.sources.repoId repository id
|
|
322
364
|
* @param {object} params.sources.branch branch id
|
|
323
|
-
* @param {
|
|
324
|
-
* @param {string} params.sources.user.login Login of the user.
|
|
325
|
-
* @param {string} [params.sources.user.idProvider] Id provider containing the user. By default, all the id providers will be used.
|
|
326
|
-
* @param {string[]} params.sources.principals Principals to execute the callback with.
|
|
365
|
+
* @param {string[]} [params.sources.principals] Principals to execute the callback with. Uses principals in context if not specified or empty.
|
|
327
366
|
*
|
|
328
367
|
* @returns {MultiRepoConnection} Returns a new multirepo-connection.
|
|
329
368
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-A3",
|
|
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": "
|
|
30
|
+
"@enonic-types/core": "8.0.0-A3"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|