@enonic-types/lib-node 7.16.2-RC2 → 8.0.0-A2

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.
Files changed (2) hide show
  1. package/node.d.ts +79 -34
  2. package/package.json +2 -2
package/node.d.ts CHANGED
@@ -13,7 +13,7 @@ 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 & {
16
+ type WithRequiredProperty<T, K extends keyof T> = T & {
17
17
  [P in K]-?: T[P];
18
18
  };
19
19
  export interface TermSuggestion {
@@ -72,11 +72,18 @@ export interface NodeMultiRepoQueryResult<AggregationOutput extends Record<strin
72
72
  aggregations: AggregationOutput;
73
73
  suggestions?: Record<string, SuggestionResult[]>;
74
74
  }
75
- export declare type CreateNodeParams<NodeData = unknown> = NodePropertiesOnCreate & NodeData;
75
+ export type CreateNodeParams<NodeData = unknown> = NodePropertiesOnCreate & NodeData;
76
+ /**
77
+ * @deprecated Use {@link UpdateNodeParams} instead
78
+ */
76
79
  export interface ModifyNodeParams<NodeData = unknown> {
77
80
  key: string;
78
81
  editor: (node: Node<NodeData>) => ModifiedNode<NodeData>;
79
82
  }
83
+ export interface UpdateNodeParams<NodeData = unknown> {
84
+ key: string;
85
+ editor: (node: Node<NodeData>) => UpdatedNode<NodeData>;
86
+ }
80
87
  export interface GetNodeParams {
81
88
  key: string;
82
89
  versionId?: string;
@@ -97,6 +104,18 @@ export interface PushNodesResult {
97
104
  }[];
98
105
  deleted: string[];
99
106
  }
107
+ export interface PatchNodeParams {
108
+ key: string;
109
+ editor: (node: Node) => PatchedNode;
110
+ branches: string[];
111
+ }
112
+ export interface PatchNodeResult {
113
+ nodeId: string;
114
+ branchResult: {
115
+ branch: string;
116
+ node: PatchedNode;
117
+ }[];
118
+ }
100
119
  export interface DiffBranchesParams {
101
120
  key: string;
102
121
  target: string;
@@ -116,10 +135,14 @@ export interface MoveNodeParams {
116
135
  source: string;
117
136
  target: string;
118
137
  }
119
- export interface SetChildOrderParams {
138
+ export interface SortNodeParams {
120
139
  key: string;
121
140
  childOrder: string;
122
141
  }
142
+ export interface SortNodeResult<NodeData> {
143
+ node: Node<NodeData>;
144
+ reorderedNodes?: Node<NodeData>[];
145
+ }
123
146
  export interface QueryNodeParams<AggregationInput extends Aggregations = never> {
124
147
  start?: number;
125
148
  count?: number;
@@ -131,10 +154,10 @@ export interface QueryNodeParams<AggregationInput extends Aggregations = never>
131
154
  highlight?: Highlight;
132
155
  explain?: boolean;
133
156
  }
134
- export interface FindVersionsParams {
157
+ export interface GetVersionsParams {
135
158
  key: string;
136
- start?: number | null;
137
- count?: number | null;
159
+ cursor?: string | null;
160
+ count?: number;
138
161
  }
139
162
  export interface NodeVersion {
140
163
  versionId: string;
@@ -143,18 +166,15 @@ export interface NodeVersion {
143
166
  timestamp: string;
144
167
  commitId?: string;
145
168
  }
146
- export interface NodeVersionsQueryResult {
169
+ export interface GetNodeVersionsResult {
147
170
  total: number;
148
171
  count: number;
172
+ cursor?: string | null;
149
173
  hits: NodeVersion[];
150
174
  }
151
175
  export interface GetActiveVersionParams {
152
176
  key: string;
153
177
  }
154
- export interface SetActiveVersionParams {
155
- key: string;
156
- versionId: string;
157
- }
158
178
  export interface FindChildrenParams {
159
179
  parentKey: string;
160
180
  start?: number | null;
@@ -178,7 +198,20 @@ export interface FindNodesByParentResult {
178
198
  id: string;
179
199
  }[];
180
200
  }
181
- export declare type RefreshMode = 'SEARCH' | 'STORAGE' | 'ALL';
201
+ export interface ApplyPermissionsParams {
202
+ key: string;
203
+ permissions?: AccessControlEntry[];
204
+ addPermissions?: AccessControlEntry[];
205
+ removePermissions?: AccessControlEntry[];
206
+ branches?: string[];
207
+ scope?: string;
208
+ }
209
+ export type ApplyPermissionsResult = Record<string, BranchResult[]>;
210
+ export interface BranchResult {
211
+ branch: string;
212
+ node: Node;
213
+ }
214
+ export type RefreshMode = 'SEARCH' | 'STORAGE' | 'ALL';
182
215
  export interface GetCommitParams {
183
216
  id: string;
184
217
  }
@@ -192,11 +225,7 @@ export interface CommitParams {
192
225
  keys: string | string[];
193
226
  message?: string;
194
227
  }
195
- export interface SetRootPermissionsParams {
196
- _permissions: AccessControlEntry[];
197
- _inheritsPermissions: boolean;
198
- }
199
- export declare type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
228
+ export type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
200
229
  export interface AccessControlEntry {
201
230
  principal: PrincipalKey;
202
231
  allow?: Permission[];
@@ -210,7 +239,7 @@ export interface NodeIndexConfig {
210
239
  config: NodeConfigEntry;
211
240
  }[];
212
241
  }
213
- export declare type NodeIndexConfigTemplates = 'none' | 'byType' | 'fulltext' | 'path' | 'minimal';
242
+ export type NodeIndexConfigTemplates = 'none' | 'byType' | 'fulltext' | 'path' | 'minimal';
214
243
  export interface NodeIndexConfigParams {
215
244
  analyzer?: string;
216
245
  default?: Partial<NodeConfigEntry> | NodeIndexConfigTemplates;
@@ -229,37 +258,54 @@ export interface NodeConfigEntry {
229
258
  indexValueProcessors: string[];
230
259
  languages: string[];
231
260
  }
232
- export declare type CommonNodeProperties = {
261
+ export interface CommonNodeProperties {
233
262
  _childOrder: string;
234
- _inheritsPermissions: boolean;
235
263
  _manualOrderValue?: number;
236
264
  _name: string;
237
265
  _nodeType: string;
238
266
  _path: string;
239
267
  _permissions: AccessControlEntry[];
240
- _state: string;
241
268
  _ts: string;
242
269
  _versionKey: string;
243
- };
244
- export declare type NodePropertiesOnCreate = Partial<CommonNodeProperties> & {
270
+ }
271
+ export type NodePropertiesOnCreate = Partial<CommonNodeProperties> & {
245
272
  _indexConfig?: Partial<NodeIndexConfigParams>;
246
273
  _parentPath?: string;
274
+ _inheritsPermissions?: boolean;
275
+ };
276
+ /**
277
+ * @deprecated Use {@link NodePropertiesOnUpdate} instead
278
+ */
279
+ export type NodePropertiesOnModify = CommonNodeProperties & {
280
+ _id: string;
281
+ _indexConfig: NodeIndexConfigParams;
282
+ _parentPath?: never;
247
283
  };
248
- export declare type NodePropertiesOnModify = CommonNodeProperties & {
284
+ export type NodePropertiesOnUpdate = CommonNodeProperties & {
249
285
  _id: string;
250
286
  _indexConfig: NodeIndexConfigParams;
251
287
  _parentPath?: never;
252
288
  };
253
- export declare type NodePropertiesOnRead = CommonNodeProperties & {
289
+ export type NodePropertiesOnPatch = CommonNodeProperties & {
290
+ _id: string;
291
+ _indexConfig: NodeIndexConfigParams;
292
+ _parentPath?: never;
293
+ };
294
+ export type NodePropertiesOnRead = CommonNodeProperties & {
254
295
  _id: string;
255
296
  _indexConfig: NodeIndexConfig;
256
297
  _parentPath?: never;
257
298
  };
258
- export declare type ModifiedNode<Data = Record<string, unknown>> = NodePropertiesOnModify & Data;
259
- export declare type Node<Data = Record<string, unknown>> = NodePropertiesOnRead & Data;
299
+ /**
300
+ * @deprecated Use {@link UpdatedNode} instead
301
+ */
302
+ export type ModifiedNode<Data = Record<string, unknown>> = NodePropertiesOnModify & Data;
303
+ export type UpdatedNode<Data = Record<string, unknown>> = NodePropertiesOnUpdate & Data;
304
+ export type PatchedNode<Data = Record<string, unknown>> = NodePropertiesOnPatch & Data;
305
+ export type Node<Data = Record<string, unknown>> = NodePropertiesOnRead & Data;
260
306
  export interface RepoConnection {
261
307
  create<NodeData = Record<string, unknown>>(params: CreateNodeParams<NodeData>): Node<NodeData>;
262
- modify<NodeData = Record<string, unknown>>(params: ModifyNodeParams<NodeData>): Node<NodeData>;
308
+ update<NodeData = Record<string, unknown>>(params: UpdateNodeParams<NodeData>): Node<NodeData>;
263
309
  get<NodeData = Record<string, unknown>>(key: string | GetNodeParams): Node<NodeData> | null;
264
310
  get<NodeData = Record<string, unknown>>(keys: (string | GetNodeParams)[]): Node<NodeData> | Node<NodeData>[] | null;
265
311
  get<NodeData = Record<string, unknown>>(...keys: (string | GetNodeParams | (string | GetNodeParams)[])[]): Node<NodeData> | Node<NodeData>[] | null;
@@ -268,15 +314,14 @@ export interface RepoConnection {
268
314
  diff(params: DiffBranchesParams): DiffBranchesResult;
269
315
  getBinary(params: GetBinaryParams): ByteSource;
270
316
  move(params: MoveNodeParams): boolean;
271
- setChildOrder<NodeData = Record<string, unknown>>(params: SetChildOrderParams): Node<NodeData>;
317
+ sort<NodeData = Record<string, unknown>>(params: SortNodeParams): SortNodeResult<NodeData>;
272
318
  query<AggregationInput extends Aggregations = never>(params: QueryNodeParams<AggregationInput>): NodeQueryResult<AggregationsToAggregationResults<AggregationInput>>;
273
319
  exists(key: string): boolean;
274
- findVersions(params: FindVersionsParams): NodeVersionsQueryResult;
320
+ getVersions(params: GetVersionsParams): GetNodeVersionsResult;
275
321
  getActiveVersion(params: GetActiveVersionParams): NodeVersion | null;
276
- setActiveVersion(params: SetActiveVersionParams): boolean;
277
322
  findChildren(params: FindChildrenParams): FindNodesByParentResult;
278
323
  refresh(mode?: RefreshMode): void;
279
- setRootPermissions<NodeData = Record<string, unknown>>(params: SetRootPermissionsParams): Node<NodeData>;
324
+ applyPermissions(params: ApplyPermissionsParams): ApplyPermissionsResult;
280
325
  commit(params: CommitParams): NodeCommit;
281
326
  getCommit(params: GetCommitParams): NodeCommit | null;
282
327
  duplicate<NodeData = Record<string, unknown>>(params: DuplicateParams<NodeData>): Node<NodeData>;
@@ -303,7 +348,7 @@ export interface ConnectParams {
303
348
  * @param {object} params.branch branch id
304
349
  * @param {object} [params.user] User to execute the callback with. Default is the current user.
305
350
  * @param {string} params.user.login Login of the user.
306
- * @param {string} [params.user.idProvider] Id provider containing the user. By default, all the id providers will be used.
351
+ * @param {string} [params.user.idProvider] Id provider containing the user. By default, the system id provider is used.
307
352
  * @param {string[]} [params.principals] Additional principals to execute the callback with.
308
353
  * @returns {RepoConnection} Returns a new repo-connection.
309
354
  */
@@ -322,7 +367,7 @@ export interface MultiRepoConnectParams {
322
367
  * @param {object} params.sources.branch branch id
323
368
  * @param {object} [params.sources.user] User to execute the callback with. Default is the current user.
324
369
  * @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.
370
+ * @param {string} [params.sources.user.idProvider] Id provider containing the user. By default, the system id provider is used.
326
371
  * @param {string[]} params.sources.principals Principals to execute the callback with.
327
372
  *
328
373
  * @returns {MultiRepoConnection} Returns a new multirepo-connection.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-node",
3
- "version": "7.16.2-RC2",
3
+ "version": "8.0.0-A2",
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.16.2-RC2"
30
+ "@enonic-types/core": "8.0.0-A2"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"