@enonic-types/lib-content 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.
- package/content.d.ts +257 -30
- package/package.json +2 -2
package/content.d.ts
CHANGED
|
@@ -10,19 +10,46 @@ declare global {
|
|
|
10
10
|
interface XpLibraries {
|
|
11
11
|
'/lib/xp/content': typeof import('./content');
|
|
12
12
|
}
|
|
13
|
-
interface XpXData {
|
|
14
|
-
}
|
|
15
13
|
}
|
|
16
|
-
import
|
|
17
|
-
export type { Aggregation, Aggregations, AggregationsResult, Attachment, BooleanDslExpression, BooleanFilter, Bucket, BucketsAggregationResult, BucketsAggregationsUnion, ByteSource, Component, Content, DateBucket, DateHistogramAggregation, DateRange, DateRangeAggregation, DistanceUnit, DslOperator, DslQueryType, ExistsDslExpression, ExistsFilter, FieldSortDsl, Filter, FormItem,
|
|
18
|
-
|
|
19
|
-
export
|
|
14
|
+
import { Aggregations, AggregationsResult, AggregationsToAggregationResults, Attachment, ByteSource, Content, ContentComponent, ContentComponentConstraint, ContentInheritValue, Filter, FormItem, Highlight, HighlightResult, Layout, LayoutComponent, Page, PageComponent, Part, PartComponent, PublishInfo, QueryDsl, SortDsl, UserKey, ValidationError, Workflow, WorkflowState } from '@enonic-types/core';
|
|
15
|
+
export type { Aggregation, Aggregations, AggregationsResult, Attachment, BooleanDslExpression, BooleanFilter, Bucket, BucketsAggregationResult, BucketsAggregationsUnion, ByteSource, Component, Content, ContentComponent, ContentComponentConstraint, DateBucket, DateHistogramAggregation, DateRange, DateRangeAggregation, DistanceUnit, DslOperator, DslQueryType, ExistsDslExpression, ExistsFilter, FieldSortDsl, Filter, FormItem, FormItemFormFragment, FormItemInput, FormItemLayout, FormItemOptionSet, FormItemSet, FulltextDslExpression, GeoDistanceAggregation, GeoDistanceSortDsl, GroupKey, HasValueFilter, Highlight, HighlightResult, HistogramAggregation, IdsFilter, InDslExpression, InputType, LikeDslExpression, MatchAllDslExpression, MaxAggregation, MinAggregation, NgramDslExpression, NotExistsFilter, NumericBucket, NumericRange, NumericRangeAggregation, PathMatchDslExpression, PublishInfo, QueryDsl, RangeDslExpression, Region, RoleKey, ScriptValue, SingleValueMetricAggregationResult, SingleValueMetricAggregationsUnion, SortDirection, SortDsl, StatsAggregation, StatsAggregationResult, StemmedDslExpression, TermDslExpression, TermsAggregation, UserKey, ValueCountAggregation, ValueType, } from '@enonic-types/core';
|
|
16
|
+
type Attachments = Content['attachments'];
|
|
17
|
+
export type PageComponentWhenAutomaticTemplate = Record<string, never>;
|
|
20
18
|
export interface PageComponentWhenSpecificTemplate {
|
|
21
19
|
path: '/';
|
|
22
20
|
template: string;
|
|
23
21
|
type: 'page';
|
|
24
22
|
}
|
|
25
|
-
export
|
|
23
|
+
export type Schedule = Omit<PublishInfo, 'first'>;
|
|
24
|
+
export interface PatchableContent<Data extends Record<string, unknown> = Record<string, unknown>, Type extends string = string, _Component extends ContentComponentConstraint<Type> = ContentComponent<Type>> {
|
|
25
|
+
displayName: string;
|
|
26
|
+
data: Type extends 'portal:fragment' ? Record<string, never> : Data;
|
|
27
|
+
x: XpMixin;
|
|
28
|
+
page: Type extends 'portal:fragment' ? never : _Component;
|
|
29
|
+
valid: boolean;
|
|
30
|
+
owner: UserKey;
|
|
31
|
+
language: string;
|
|
32
|
+
creator: UserKey;
|
|
33
|
+
createdTime: string;
|
|
34
|
+
modifier: UserKey;
|
|
35
|
+
modifiedTime: string;
|
|
36
|
+
publishInfo: PublishInfo;
|
|
37
|
+
processedReferences: string[];
|
|
38
|
+
workflowInfo: Workflow;
|
|
39
|
+
manualOrderValue: number;
|
|
40
|
+
inherit: ContentInheritValue[];
|
|
41
|
+
variantOf: string;
|
|
42
|
+
modifyAttachments: Attachment;
|
|
43
|
+
removeAttachments: string[];
|
|
44
|
+
createAttachments: AddAttachmentParam[];
|
|
45
|
+
validationErrors: ValidationError[];
|
|
46
|
+
type: Type;
|
|
47
|
+
childOrder: string;
|
|
48
|
+
originProject: string;
|
|
49
|
+
originalParentPath: string;
|
|
50
|
+
archivedTime: string;
|
|
51
|
+
archivedBy: UserKey;
|
|
52
|
+
}
|
|
26
53
|
export declare const ARCHIVE_ROOT_PATH: string;
|
|
27
54
|
export declare const CONTENT_ROOT_PATH: string;
|
|
28
55
|
export interface GetContentParams {
|
|
@@ -105,12 +132,12 @@ export interface SiteConfig<Config> {
|
|
|
105
132
|
applicationKey: string;
|
|
106
133
|
config: Config;
|
|
107
134
|
}
|
|
108
|
-
export
|
|
135
|
+
export type Site<Config> = Content<{
|
|
109
136
|
description?: string;
|
|
110
137
|
siteConfig: SiteConfig<Config> | SiteConfig<Config>[];
|
|
111
138
|
}, 'portal:site'>;
|
|
112
139
|
export interface GetSiteParams {
|
|
113
|
-
key
|
|
140
|
+
key: string;
|
|
114
141
|
}
|
|
115
142
|
/**
|
|
116
143
|
* This function returns the parent site of a content.
|
|
@@ -152,8 +179,8 @@ export interface DeleteContentParams {
|
|
|
152
179
|
*
|
|
153
180
|
* @returns {boolean} True if deleted, false otherwise.
|
|
154
181
|
*/
|
|
155
|
-
declare function
|
|
156
|
-
export {
|
|
182
|
+
export declare function deleteContent(params: DeleteContentParams): boolean;
|
|
183
|
+
export { deleteContent as delete, };
|
|
157
184
|
export interface ContentsResult<Hit extends Content<unknown>, AggregationOutput extends Record<string, AggregationsResult> | undefined = undefined> {
|
|
158
185
|
total: number;
|
|
159
186
|
count: number;
|
|
@@ -181,8 +208,8 @@ export interface GetChildContentParams {
|
|
|
181
208
|
* @returns {Object} Result (of content) fetched from the repository.
|
|
182
209
|
*/
|
|
183
210
|
export declare function getChildren<Hit extends Content<unknown> = Content, AggregationOutput extends Record<string, AggregationsResult> = never>(params: GetChildContentParams): ContentsResult<Hit, AggregationOutput>;
|
|
184
|
-
export
|
|
185
|
-
export interface CreateContentParams<Data, Type extends string> {
|
|
211
|
+
export type IdGeneratorSupplier = (value: string) => string;
|
|
212
|
+
export interface CreateContentParams<Data, Type extends string, _Component extends (Type extends 'portal:fragment' ? LayoutComponent | PartComponent : PageComponent) = (Type extends 'portal:fragment' ? Layout | Part : Page)> {
|
|
186
213
|
name?: string;
|
|
187
214
|
parentPath: string;
|
|
188
215
|
displayName?: string;
|
|
@@ -192,7 +219,8 @@ export interface CreateContentParams<Data, Type extends string> {
|
|
|
192
219
|
language?: string;
|
|
193
220
|
childOrder?: string;
|
|
194
221
|
data: Data;
|
|
195
|
-
|
|
222
|
+
page?: Type extends 'portal:fragment' ? never : _Component;
|
|
223
|
+
x?: XpMixin;
|
|
196
224
|
idGenerator?: IdGeneratorSupplier;
|
|
197
225
|
workflow?: Workflow;
|
|
198
226
|
}
|
|
@@ -251,15 +279,38 @@ export interface QueryContentParams<AggregationInput extends Aggregations = neve
|
|
|
251
279
|
* @returns {object} Result of query.
|
|
252
280
|
*/
|
|
253
281
|
export declare function query<Hit extends Content<unknown> = Content, AggregationInput extends Aggregations = never>(params: QueryContentParams<AggregationInput>): ContentsResult<Hit, AggregationsToAggregationResults<AggregationInput>>;
|
|
282
|
+
/**
|
|
283
|
+
* @deprecated Use {@link UpdateContentParams} instead.
|
|
284
|
+
*/
|
|
254
285
|
export interface ModifyContentParams<Data, Type extends string> {
|
|
255
286
|
key: string;
|
|
256
287
|
editor: (v: Content<Data, Type>) => Content<Data, Type>;
|
|
257
288
|
requireValid?: boolean;
|
|
258
289
|
}
|
|
290
|
+
export interface UpdateContentParams<Data, Type extends string> {
|
|
291
|
+
key: string;
|
|
292
|
+
editor: (v: Content<Data, Type>) => Content<Data, Type>;
|
|
293
|
+
requireValid?: boolean;
|
|
294
|
+
}
|
|
295
|
+
export interface PatchContentParams {
|
|
296
|
+
key: string;
|
|
297
|
+
patcher: (v: PatchableContent) => PatchableContent;
|
|
298
|
+
attachments?: AddAttachmentParam[];
|
|
299
|
+
branches?: string[];
|
|
300
|
+
skipSync?: boolean;
|
|
301
|
+
}
|
|
302
|
+
export interface PatchContentResult<Data extends Record<string, unknown> = Record<string, unknown>, Type extends string = string> {
|
|
303
|
+
contentId: string;
|
|
304
|
+
results: BranchPatchResult<Data, Type>[];
|
|
305
|
+
}
|
|
306
|
+
export interface BranchPatchResult<Data extends Record<string, unknown> = Record<string, unknown>, Type extends string = string> {
|
|
307
|
+
branch: string;
|
|
308
|
+
content: Content<Data, Type> | null;
|
|
309
|
+
}
|
|
259
310
|
/**
|
|
260
311
|
* This function modifies a content.
|
|
261
312
|
*
|
|
262
|
-
* @
|
|
313
|
+
* @deprecated Use {@link update} instead.
|
|
263
314
|
*
|
|
264
315
|
* @param {object} params JSON with the parameters.
|
|
265
316
|
* @param {string} params.key Path or id to the content.
|
|
@@ -269,17 +320,95 @@ export interface ModifyContentParams<Data, Type extends string> {
|
|
|
269
320
|
* @returns {object} Modified content as JSON.
|
|
270
321
|
*/
|
|
271
322
|
export declare function modify<Data = Record<string, unknown>, Type extends string = string>(params: ModifyContentParams<Data, Type>): Content<Data, Type> | null;
|
|
323
|
+
/**
|
|
324
|
+
* This function updates a content.
|
|
325
|
+
*
|
|
326
|
+
* @example-ref examples/content/update.js
|
|
327
|
+
*
|
|
328
|
+
* @param {object} params JSON with the parameters.
|
|
329
|
+
* @param {string} params.key Path or id to the content.
|
|
330
|
+
* @param {function} params.editor Editor callback function.
|
|
331
|
+
* @param {boolean} [params.requireValid=true] The content has to be valid, according to the content type, to be updated. If requireValid=true and the content is not strictly valid, an error will be thrown.
|
|
332
|
+
*
|
|
333
|
+
* @returns {object} Modified content as JSON.
|
|
334
|
+
*/
|
|
335
|
+
export declare function update<Data extends Record<string, unknown> = Record<string, unknown>, Type extends string = string>(params: UpdateContentParams<Data, Type>): Content<Data, Type> | null;
|
|
336
|
+
/**
|
|
337
|
+
* This function patches a content.
|
|
338
|
+
*
|
|
339
|
+
* @example-ref examples/content/patch.js
|
|
340
|
+
*
|
|
341
|
+
* @param {object} params JSON with the parameters.
|
|
342
|
+
* @param {string} params.key Path or id to the content.
|
|
343
|
+
* @param {function} params.patcher Patcher callback function.
|
|
344
|
+
* @param {boolean} [params.skipSync=false] If true, the content will not be immediately synced to the child projects.
|
|
345
|
+
* @param {string[]} [params.branches=[]] List of branches to patch the content in. If not specified, the context's branch is used.
|
|
346
|
+
*
|
|
347
|
+
* @returns {object} Patched content as JSON.
|
|
348
|
+
*/
|
|
349
|
+
export declare function patch(params: PatchContentParams): PatchContentResult;
|
|
350
|
+
export interface EditableContentMetadata {
|
|
351
|
+
source: Content;
|
|
352
|
+
language?: string;
|
|
353
|
+
owner?: string;
|
|
354
|
+
variantOf?: string;
|
|
355
|
+
}
|
|
356
|
+
export interface UpdateMetadataParams {
|
|
357
|
+
key: string;
|
|
358
|
+
editor: (v: EditableContentMetadata) => EditableContentMetadata;
|
|
359
|
+
}
|
|
360
|
+
export interface UpdateMetadataResult<Data extends Record<string, unknown> = Record<string, unknown>, Type extends string = string> {
|
|
361
|
+
content: Content<Data, Type>;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* This function updates metadata (language, owner, and variantOf) for a content.
|
|
365
|
+
* The update is applied to both master and draft branches.
|
|
366
|
+
*
|
|
367
|
+
* @example-ref examples/content/updateMetadata.js
|
|
368
|
+
*
|
|
369
|
+
* @param {object} params JSON with the parameters.
|
|
370
|
+
* @param {string} params.key Path or id to the content.
|
|
371
|
+
* @param {function} params.editor Editor callback function to modify metadata.
|
|
372
|
+
*
|
|
373
|
+
* @returns {object} Updated content metadata result as JSON.
|
|
374
|
+
*/
|
|
375
|
+
export declare function updateMetadata(params: UpdateMetadataParams): UpdateMetadataResult;
|
|
376
|
+
export interface EditableWorkflow {
|
|
377
|
+
source: Content;
|
|
378
|
+
state: WorkflowState;
|
|
379
|
+
}
|
|
380
|
+
export interface UpdateWorkflowParams {
|
|
381
|
+
key: string;
|
|
382
|
+
editor: (v: EditableWorkflow) => EditableWorkflow;
|
|
383
|
+
}
|
|
384
|
+
export interface UpdateWorkflowResult<Data extends Record<string, unknown> = Record<string, unknown>, Type extends string = string> {
|
|
385
|
+
content: Content<Data, Type>;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* This function updates workflow information (state and checks) for a content.
|
|
389
|
+
* The update is applied to the draft branch only.
|
|
390
|
+
*
|
|
391
|
+
* @param {object} params JSON with the parameters.
|
|
392
|
+
* @param {string} params.key Path or id to the content.
|
|
393
|
+
* @param {function} params.editor Editor callback function to modify workflow.
|
|
394
|
+
*
|
|
395
|
+
* @returns {object} Updated workflow result as JSON.
|
|
396
|
+
*/
|
|
397
|
+
export declare function updateWorkflow(params: UpdateWorkflowParams): UpdateWorkflowResult;
|
|
272
398
|
export interface PublishContentParams {
|
|
273
399
|
keys: string[];
|
|
274
400
|
schedule?: Schedule;
|
|
275
401
|
includeChildren?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* @deprecated Use excludeDescendantsOf instead.
|
|
404
|
+
*/
|
|
276
405
|
excludeChildrenIds?: string[];
|
|
406
|
+
excludeDescendantsOf?: string[];
|
|
277
407
|
includeDependencies?: boolean;
|
|
278
408
|
message?: string;
|
|
279
409
|
}
|
|
280
410
|
export interface PublishContentResult {
|
|
281
411
|
pushedContents: string[];
|
|
282
|
-
deletedContents: string[];
|
|
283
412
|
failedContents: string[];
|
|
284
413
|
}
|
|
285
414
|
/**
|
|
@@ -293,7 +422,8 @@ export interface PublishContentResult {
|
|
|
293
422
|
* @param {object} [params.schedule] Schedule the publish.
|
|
294
423
|
* @param {string} [params.schedule.from] Time from which the content is considered published. Defaults to the time of the publish
|
|
295
424
|
* @param {string} [params.schedule.to] Time until which the content is considered published.
|
|
296
|
-
* @param {string[]} [params.excludeChildrenIds]
|
|
425
|
+
* @param {string[]} [params.excludeChildrenIds] Deprecated. Use excludeDescendantsOf instead.
|
|
426
|
+
* @param {string[]} [params.excludeDescendantsOf] List of all content keys which children should be excluded from publishing content.
|
|
297
427
|
* @param {boolean} [params.includeDependencies=true] Whether all related content should be included when publishing content.
|
|
298
428
|
* @param {string} [params.message] Publish message.
|
|
299
429
|
*
|
|
@@ -398,38 +528,45 @@ export interface RestoreContentParams {
|
|
|
398
528
|
* @returns {string[]} List with ids of the contents that were restored.
|
|
399
529
|
*/
|
|
400
530
|
export declare function restore(params: RestoreContentParams): string[];
|
|
401
|
-
export
|
|
531
|
+
export type Permission = 'READ' | 'CREATE' | 'MODIFY' | 'DELETE' | 'PUBLISH' | 'READ_PERMISSIONS' | 'WRITE_PERMISSIONS';
|
|
402
532
|
export interface AccessControlEntry {
|
|
403
533
|
principal: string;
|
|
404
534
|
allow?: Permission[];
|
|
405
535
|
deny?: Permission[];
|
|
406
536
|
}
|
|
407
|
-
export interface
|
|
537
|
+
export interface ApplyPermissionsParams {
|
|
408
538
|
key: string;
|
|
409
|
-
|
|
410
|
-
overwriteChildPermissions?: boolean;
|
|
539
|
+
scope?: 'SINGLE' | 'TREE' | 'SUBTREE';
|
|
411
540
|
permissions?: AccessControlEntry[];
|
|
541
|
+
addPermissions?: AccessControlEntry[];
|
|
542
|
+
removePermissions?: AccessControlEntry[];
|
|
543
|
+
}
|
|
544
|
+
export type ApplyPermissionsResult = Record<string, BranchResult[]>;
|
|
545
|
+
export interface BranchResult {
|
|
546
|
+
branch: string;
|
|
547
|
+
permissions: AccessControlEntry[];
|
|
412
548
|
}
|
|
413
549
|
export interface Permissions {
|
|
414
|
-
inheritsPermissions: boolean;
|
|
415
550
|
permissions?: AccessControlEntry[];
|
|
416
551
|
}
|
|
417
552
|
/**
|
|
418
|
-
*
|
|
553
|
+
* Applies permissions to a content.
|
|
419
554
|
*
|
|
420
|
-
* @example-ref examples/content/
|
|
555
|
+
* @example-ref examples/content/applyPermissions.js
|
|
421
556
|
*
|
|
422
557
|
* @param {object} params JSON parameters.
|
|
423
558
|
* @param {string} params.key Path or id of the content.
|
|
424
|
-
* @param {
|
|
425
|
-
* @param {
|
|
426
|
-
* @param {array} [params.permissions] Array of permissions.
|
|
559
|
+
* @param {string} [params.scope] Scope of operation. Possible values are 'SINGE', 'TREE' or 'SUBTREE'. Default is 'SINGLE'.
|
|
560
|
+
* @param {array} [params.permissions] Array of permissions. Cannot be used together with addPermissions and removePermissions.
|
|
427
561
|
* @param {string} params.permissions.principal Principal key.
|
|
428
562
|
* @param {array} params.permissions.allow Allowed permissions.
|
|
429
563
|
* @param {array} params.permissions.deny Denied permissions.
|
|
430
|
-
* @
|
|
564
|
+
* @param {array} [params.addPermissions] Array of permissions to add. Cannot be used together with permissions.
|
|
565
|
+
* @param {array} [params.removePermissions] Array of permissions to remove. Cannot be used together with permissions.
|
|
566
|
+
*
|
|
567
|
+
* @returns {object} Result of the apply permissions operation.
|
|
431
568
|
*/
|
|
432
|
-
export declare function
|
|
569
|
+
export declare function applyPermissions(params: ApplyPermissionsParams): ApplyPermissionsResult;
|
|
433
570
|
export interface GetPermissionsParams {
|
|
434
571
|
key: string;
|
|
435
572
|
}
|
|
@@ -525,6 +662,9 @@ export interface ResetInheritanceHandler {
|
|
|
525
662
|
* @param {string[]} params.inherit flags to be reset.
|
|
526
663
|
*/
|
|
527
664
|
export declare function resetInheritance(params: ResetInheritanceParams): void;
|
|
665
|
+
/**
|
|
666
|
+
* @deprecated Use {@link UpdateMediaParams} instead.
|
|
667
|
+
*/
|
|
528
668
|
export interface ModifyMediaParams {
|
|
529
669
|
key: string;
|
|
530
670
|
name: string;
|
|
@@ -538,9 +678,22 @@ export interface ModifyMediaParams {
|
|
|
538
678
|
tags?: string | string[];
|
|
539
679
|
workflow?: Workflow;
|
|
540
680
|
}
|
|
681
|
+
export interface UpdateMediaParams {
|
|
682
|
+
key: string;
|
|
683
|
+
name: string;
|
|
684
|
+
data: ByteSource;
|
|
685
|
+
artist?: string | string[];
|
|
686
|
+
caption?: string;
|
|
687
|
+
copyright?: string;
|
|
688
|
+
focalX?: number;
|
|
689
|
+
focalY?: number;
|
|
690
|
+
mimeType?: string;
|
|
691
|
+
tags?: string | string[];
|
|
692
|
+
workflow?: Workflow;
|
|
693
|
+
}
|
|
541
694
|
/** This function modifies a media content.
|
|
542
695
|
*
|
|
543
|
-
* @
|
|
696
|
+
* deprecated Use {@link updateMedia} instead.
|
|
544
697
|
*
|
|
545
698
|
* @param {object} params JSON with the parameters.
|
|
546
699
|
* @param {string} params.key Path or id to the content.
|
|
@@ -558,6 +711,26 @@ export interface ModifyMediaParams {
|
|
|
558
711
|
* @returns {object} Modified content as JSON.
|
|
559
712
|
*/
|
|
560
713
|
export declare function modifyMedia<Data = Record<string, unknown>, Type extends string = string>(params: ModifyMediaParams): Content<Data, Type> | null;
|
|
714
|
+
/** This function updates a media content.
|
|
715
|
+
*
|
|
716
|
+
* @example-ref examples/content/updateMedia.js
|
|
717
|
+
*
|
|
718
|
+
* @param {object} params JSON with the parameters.
|
|
719
|
+
* @param {string} params.key Path or id to the content.
|
|
720
|
+
* @param {string} params.name Name to the content.
|
|
721
|
+
* @param {function} params.data Data (as stream) to use.
|
|
722
|
+
* @param {string} [params.mimeType] Mime-type of the data.
|
|
723
|
+
* @param {string|string[]} [params.artist] Artist to the content.
|
|
724
|
+
* @param {string} [params.caption] Caption to the content.
|
|
725
|
+
* @param {string} [params.copyright] Copyright to the content.
|
|
726
|
+
* @param {string|string[]} [params.tags] Tags to the content.
|
|
727
|
+
* @param {object} [params.workflow] Workflow information to use. Default has state READY and empty check list.
|
|
728
|
+
* @param {number} [params.focalX=0.5] Focal point for X axis (if it's an image).
|
|
729
|
+
* @param {number} [params.focalY=0.5] Focal point for Y axis (if it's an image).
|
|
730
|
+
*
|
|
731
|
+
* @returns {object} Modified content as JSON.
|
|
732
|
+
*/
|
|
733
|
+
export declare function updateMedia<Data = Record<string, unknown>, Type extends string = string>(params: UpdateMediaParams): Content<Data, Type> | null;
|
|
561
734
|
export interface DuplicateContentParams {
|
|
562
735
|
contentId: string;
|
|
563
736
|
workflow?: Workflow;
|
|
@@ -586,3 +759,57 @@ export interface DuplicateContentsResult {
|
|
|
586
759
|
* @returns {object} summary about duplicated content.
|
|
587
760
|
*/
|
|
588
761
|
export declare function duplicate(params: DuplicateContentParams): DuplicateContentsResult;
|
|
762
|
+
export interface GetVersionsParams {
|
|
763
|
+
key: string;
|
|
764
|
+
count?: number;
|
|
765
|
+
cursor?: string;
|
|
766
|
+
}
|
|
767
|
+
export interface ContentVersion {
|
|
768
|
+
versionId: string;
|
|
769
|
+
contentId: string;
|
|
770
|
+
path: string;
|
|
771
|
+
timestamp: string;
|
|
772
|
+
comment?: string;
|
|
773
|
+
actions?: ContentVersionAction[];
|
|
774
|
+
}
|
|
775
|
+
export interface ContentVersionAction {
|
|
776
|
+
operation: string;
|
|
777
|
+
user: string;
|
|
778
|
+
opTime: string;
|
|
779
|
+
}
|
|
780
|
+
export interface ContentVersionsResult {
|
|
781
|
+
total: number;
|
|
782
|
+
count: number;
|
|
783
|
+
cursor: string | null;
|
|
784
|
+
hits: ContentVersion[];
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* This function returns content versions.
|
|
788
|
+
*
|
|
789
|
+
* @example-ref examples/content/getVersions.js
|
|
790
|
+
*
|
|
791
|
+
* @param {object} params JSON with the parameters.
|
|
792
|
+
* @param {string} params.key Path or ID of the content.
|
|
793
|
+
* @param {number} [params.count=10] Number of content versions to fetch.
|
|
794
|
+
* @param {string} [params.cursor] Cursor for pagination.
|
|
795
|
+
*
|
|
796
|
+
* @returns {object} Content versions result.
|
|
797
|
+
*/
|
|
798
|
+
export declare function getVersions(params: GetVersionsParams): ContentVersionsResult;
|
|
799
|
+
export interface GetActiveVersionsParams {
|
|
800
|
+
key: string;
|
|
801
|
+
branches: string[];
|
|
802
|
+
}
|
|
803
|
+
export type ActiveContentVersions = Record<string, ContentVersion>;
|
|
804
|
+
/**
|
|
805
|
+
* This function returns the active content version for each specified branch.
|
|
806
|
+
*
|
|
807
|
+
* @example-ref examples/content/getActiveVersions.js
|
|
808
|
+
*
|
|
809
|
+
* @param {object} params JSON with the parameters.
|
|
810
|
+
* @param {string} params.key Path or ID of the content.
|
|
811
|
+
* @param {string[]} params.branches Array of branch names to get active versions for.
|
|
812
|
+
*
|
|
813
|
+
* @returns {object} Object with branch names as keys and content versions as values.
|
|
814
|
+
*/
|
|
815
|
+
export declare function getActiveVersions(params: GetActiveVersionsParams): ActiveContentVersions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-content",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-A2",
|
|
4
4
|
"description": "Type definitions for lib-content.",
|
|
5
5
|
"types": "content.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-A2"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|