@enonic-types/lib-content 8.0.0-B4 → 8.0.0-B5

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/content.d.ts +43 -22
  2. package/package.json +2 -2
package/content.d.ts CHANGED
@@ -11,7 +11,7 @@ declare global {
11
11
  '/lib/xp/content': typeof import('./content');
12
12
  }
13
13
  }
14
- import { Aggregations, AggregationsResult, AggregationsToAggregationResults, Attachment, ByteSource, ConfigValue, 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';
14
+ import { Aggregations, AggregationsResult, AggregationsToAggregationResults, ByteSource, ConfigValue, 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
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, ConfigValue, } from '@enonic-types/core';
16
16
  type Attachments = Content['attachments'];
17
17
  export type PageComponentWhenAutomaticTemplate = Record<string, never>;
@@ -33,20 +33,19 @@ export interface PatchableContent<Data extends Record<string, unknown> = Record<
33
33
  createdTime: string;
34
34
  modifier: UserKey;
35
35
  modifiedTime: string;
36
- publishInfo: PublishInfo;
36
+ publish: PublishInfo;
37
37
  processedReferences: string[];
38
- workflowInfo: Workflow;
38
+ workflow: Workflow;
39
39
  manualOrderValue: number;
40
40
  inherit: ContentInheritValue[];
41
41
  variantOf: string;
42
- modifyAttachments: Attachment;
43
- removeAttachments: string[];
44
- createAttachments: AddAttachmentParam[];
42
+ attachments: Attachments;
45
43
  validationErrors: ValidationError[];
46
44
  type: Type;
47
45
  childOrder: string;
48
46
  originProject: string;
49
47
  originalParentPath: string;
48
+ originalName: string;
50
49
  archivedTime: string;
51
50
  archivedBy: UserKey;
52
51
  }
@@ -246,7 +245,9 @@ export interface CreateContentParams<Data, Type extends string, _Component exten
246
245
  * @param {string} [params.language] The language tag representing the content’s locale.
247
246
  * @param {string} [params.childOrder] Default ordering of children when doing getChildren if no order is given in query
248
247
  * @param {object} params.data Actual content data.
248
+ * @param {object} [params.page] Page configuration to use.
249
249
  * @param {object} [params.x] eXtra data to use.
250
+ * @param {function} [params.idGenerator] Function used to generate the id-suffix appended to the content name.
250
251
  * @param {object} [params.workflow] Workflow information to use. Default has state READY and empty check list.
251
252
  *
252
253
  * @returns {object} Content created as JSON.
@@ -270,11 +271,12 @@ export interface QueryContentParams<AggregationInput extends Aggregations = neve
270
271
  * @param {object} params JSON with the parameters.
271
272
  * @param {number} [params.start=0] Start index (used for paging).
272
273
  * @param {number} [params.count=10] Number of contents to fetch.
273
- * @param {string|object} params.query Query expression.
274
+ * @param {string|object} [params.query] Query expression.
274
275
  * @param {object|object[]} [params.filters] Filters to apply to query result
275
276
  * @param {string|object|object[]} [params.sort] Sorting expression.
276
277
  * @param {object} [params.aggregations] Aggregations expression.
277
278
  * @param {string[]} [params.contentTypes] Content types to filter on.
279
+ * @param {object} [params.highlight] Highlight expression.
278
280
  *
279
281
  * @returns {object} Result of query.
280
282
  */
@@ -292,10 +294,28 @@ export interface UpdateContentParams<Data, Type extends string> {
292
294
  editor: (v: Content<Data, Type>) => Content<Data, Type>;
293
295
  requireValid?: boolean;
294
296
  }
297
+ export interface ModifyAttachmentParam {
298
+ name: string;
299
+ label?: string;
300
+ mimeType?: string;
301
+ sha512?: string;
302
+ size?: number;
303
+ }
304
+ export interface CreateAttachmentParam {
305
+ name: string;
306
+ label?: string;
307
+ mimeType?: string;
308
+ data?: ByteSource | string;
309
+ }
310
+ export interface PatchAttachmentsParam {
311
+ createAttachments?: CreateAttachmentParam[];
312
+ modifyAttachments?: ModifyAttachmentParam[];
313
+ removeAttachments?: string[];
314
+ }
295
315
  export interface PatchContentParams {
296
316
  key: string;
297
- patcher: (v: PatchableContent) => PatchableContent;
298
- attachments?: AddAttachmentParam[];
317
+ patcher: (v: PatchableContent) => PatchableContent | void;
318
+ attachments?: PatchAttachmentsParam;
299
319
  branches?: string[];
300
320
  skipSync?: boolean;
301
321
  }
@@ -341,6 +361,10 @@ export declare function update<Data extends Record<string, unknown> = Record<str
341
361
  * @param {object} params JSON with the parameters.
342
362
  * @param {string} params.key Path or id to the content.
343
363
  * @param {function} params.patcher Patcher callback function.
364
+ * @param {object} [params.attachments] Attachments to create, modify or remove on the patched content.
365
+ * @param {object[]} [params.attachments.createAttachments] Attachments to add to the content.
366
+ * @param {object[]} [params.attachments.modifyAttachments] Existing attachments to modify on the content.
367
+ * @param {string[]} [params.attachments.removeAttachments] Names of attachments to remove from the content.
344
368
  * @param {boolean} [params.skipSync=false] If true, the content will not be immediately synced to the child projects.
345
369
  * @param {string[]} [params.branches=[]] List of branches to patch the content in. If not specified, the context's branch is used.
346
370
  *
@@ -397,7 +421,6 @@ export declare function updateWorkflow(params: UpdateWorkflowParams): UpdateWork
397
421
  export interface PublishContentParams {
398
422
  keys: string[];
399
423
  schedule?: Schedule;
400
- includeChildren?: boolean;
401
424
  /**
402
425
  * @deprecated Use excludeDescendantsOf instead.
403
426
  */
@@ -451,7 +474,8 @@ export interface ContentExistsParams {
451
474
  *
452
475
  * @example-ref examples/content/exists.js
453
476
  *
454
- * @param {string} params.key content id.
477
+ * @param {object} params JSON with the parameters.
478
+ * @param {string} params.key Path or id of the content.
455
479
  *
456
480
  * @returns {boolean} True if exist, false otherwise.
457
481
  */
@@ -521,7 +545,7 @@ export interface ArchiveContentParams {
521
545
  export declare function archive(params: ArchiveContentParams): string[];
522
546
  export interface RestoreContentParams {
523
547
  content: string;
524
- path: string;
548
+ path?: string;
525
549
  }
526
550
  /**
527
551
  * Restore a content from the archive.
@@ -530,7 +554,7 @@ export interface RestoreContentParams {
530
554
  *
531
555
  * @param {object} params JSON with the parameters.
532
556
  * @param {string} params.content Path or id of the content to be restored.
533
- * @param {string} params.path Path of parent for restored content.
557
+ * @param {string} [params.path] Path of parent for restored content.
534
558
  *
535
559
  * @returns {string[]} List with ids of the contents that were restored.
536
560
  */
@@ -563,11 +587,11 @@ export interface Permissions {
563
587
  *
564
588
  * @param {object} params JSON parameters.
565
589
  * @param {string} params.key Path or id of the content.
566
- * @param {string} [params.scope] Scope of operation. Possible values are 'SINGE', 'TREE' or 'SUBTREE'. Default is 'SINGLE'.
590
+ * @param {string} [params.scope] Scope of operation. Possible values are 'SINGLE', 'TREE' or 'SUBTREE'. Default is 'SINGLE'.
567
591
  * @param {array} [params.permissions] Array of permissions. Cannot be used together with addPermissions and removePermissions.
568
592
  * @param {string} params.permissions.principal Principal key.
569
- * @param {array} params.permissions.allow Allowed permissions.
570
- * @param {array} params.permissions.deny Denied permissions.
593
+ * @param {array} [params.permissions.allow] Allowed permissions.
594
+ * @param {array} [params.permissions.deny] Denied permissions.
571
595
  * @param {array} [params.addPermissions] Array of permissions to add. Cannot be used together with permissions.
572
596
  * @param {array} [params.removePermissions] Array of permissions to remove. Cannot be used together with permissions.
573
597
  *
@@ -602,6 +626,7 @@ export interface Icon {
602
626
  * @property {boolean} abstract Whether or not content of this type may be instantiated.
603
627
  * @property {boolean} final Whether or not it may be used as super type of other content types.
604
628
  * @property {boolean} allowChildContent Whether or not allow creating child items on content of this type.
629
+ * @property {string} modifiedTime Modified time of the content type.
605
630
  * @property {object} [icon] Icon of the content type.
606
631
  * @property {object} [icon.data] Stream with the binary data for the icon.
607
632
  * @property {string} [icon.mimeType] Mime type of the icon image.
@@ -627,7 +652,7 @@ export interface ContentType {
627
652
  *
628
653
  * @example-ref examples/content/getType.js
629
654
  *
630
- * @param name Name of the content type, as 'app:name' (e.g. 'com.enonic.myapp:article').
655
+ * @param {string} name Name of the content type, as 'app:name' (e.g. 'com.enonic.myapp:article').
631
656
  * @returns {ContentType} The content type object if found, or null otherwise. See ContentType type definition below.
632
657
  */
633
658
  export declare function getType(name: string): ContentType | null;
@@ -647,7 +672,7 @@ export interface GetOutboundDependenciesParams {
647
672
  *
648
673
  * @param {object} params JSON parameters.
649
674
  * @param {string} params.key Path or id of the content.
650
- * @returns {object} Content Ids.
675
+ * @returns {string[]} List of content ids.
651
676
  */
652
677
  export declare function getOutboundDependencies(params: GetOutboundDependenciesParams): string[];
653
678
  export interface ResetInheritanceParams {
@@ -682,7 +707,6 @@ export interface ModifyMediaParams {
682
707
  focalX?: number;
683
708
  focalY?: number;
684
709
  tags?: string | string[];
685
- workflow?: Workflow;
686
710
  }
687
711
  export interface UpdateMediaParams {
688
712
  key: string;
@@ -694,7 +718,6 @@ export interface UpdateMediaParams {
694
718
  focalX?: number;
695
719
  focalY?: number;
696
720
  tags?: string | string[];
697
- workflow?: Workflow;
698
721
  }
699
722
  /** This function modifies a media content.
700
723
  *
@@ -708,7 +731,6 @@ export interface UpdateMediaParams {
708
731
  * @param {string} [params.caption] Caption to the content.
709
732
  * @param {string} [params.copyright] Copyright to the content.
710
733
  * @param {string|string[]} [params.tags] Tags to the content.
711
- * @param {object} [params.workflow] Workflow information to use. Default has state READY and empty check list.
712
734
  * @param {number} [params.focalX] Focal point for X axis (if it's an image).
713
735
  * @param {number} [params.focalY] Focal point for Y axis (if it's an image).
714
736
  *
@@ -727,7 +749,6 @@ export declare function modifyMedia<Data = Record<string, unknown>, Type extends
727
749
  * @param {string} [params.caption] Caption to the content.
728
750
  * @param {string} [params.copyright] Copyright to the content.
729
751
  * @param {string|string[]} [params.tags] Tags to the content.
730
- * @param {object} [params.workflow] Workflow information to use. Default has state READY and empty check list.
731
752
  * @param {number} [params.focalX] Focal point for X axis (if it's an image).
732
753
  * @param {number} [params.focalY] Focal point for Y axis (if it's an image).
733
754
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-content",
3
- "version": "8.0.0-B4",
3
+ "version": "8.0.0-B5",
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": "8.0.0-B4"
30
+ "@enonic-types/core": "8.0.0-B5"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"