@enonic-types/lib-content 8.0.4-B2 → 8.1.0-B1
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 +66 -2
- package/package.json +2 -2
package/content.d.ts
CHANGED
|
@@ -190,6 +190,31 @@ export interface ContentsResult<Hit extends Content<unknown>, AggregationOutput
|
|
|
190
190
|
aggregations: AggregationOutput;
|
|
191
191
|
highlight?: Record<string, HighlightResult>;
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* A hit returned by {@link query} when `returns: 'ids'` is requested.
|
|
195
|
+
*/
|
|
196
|
+
export interface ContentIdHit {
|
|
197
|
+
id: string;
|
|
198
|
+
score: number;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* A hit returned by {@link query} when `returns` names content fields, which are supplied in `fields`.
|
|
202
|
+
*/
|
|
203
|
+
export interface ContentFieldsHit {
|
|
204
|
+
id: string;
|
|
205
|
+
score: number;
|
|
206
|
+
fields?: Record<string, unknown>;
|
|
207
|
+
}
|
|
208
|
+
export interface ContentHitsResult<Hit, AggregationOutput extends Record<string, AggregationsResult> | undefined = undefined> {
|
|
209
|
+
total: number;
|
|
210
|
+
count: number;
|
|
211
|
+
hits: Hit[];
|
|
212
|
+
aggregations: AggregationOutput;
|
|
213
|
+
highlight?: Record<string, HighlightResult>;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @deprecated Use {@link QueryContentParams} with `parent` instead.
|
|
217
|
+
*/
|
|
193
218
|
export interface GetChildContentParams {
|
|
194
219
|
key: string;
|
|
195
220
|
start?: number;
|
|
@@ -201,6 +226,9 @@ export interface GetChildContentParams {
|
|
|
201
226
|
*
|
|
202
227
|
* @example-ref examples/content/getChildren.js
|
|
203
228
|
*
|
|
229
|
+
* @deprecated Use {@link query} with `parent` instead. It accepts the same path or id, applies the same child order of the parent where
|
|
230
|
+
* `sort` is omitted, and additionally supports filters, content types, aggregations and highlighting.
|
|
231
|
+
*
|
|
204
232
|
* @param {object} params JSON with the parameters.
|
|
205
233
|
* @param {string} params.key Path or id to the parent content.
|
|
206
234
|
* @param {number} [params.start=0] Start index (used for paging).
|
|
@@ -259,6 +287,9 @@ export declare function create<Data = Record<string, unknown>, Type extends stri
|
|
|
259
287
|
export interface QueryContentParams<AggregationInput extends Aggregations = never> {
|
|
260
288
|
start?: number;
|
|
261
289
|
count?: number;
|
|
290
|
+
parent?: string;
|
|
291
|
+
recursive?: boolean;
|
|
292
|
+
returns?: 'contents' | 'ids' | string[];
|
|
262
293
|
query?: QueryDsl | string;
|
|
263
294
|
sort?: string | SortDsl | SortDsl[];
|
|
264
295
|
filters?: Filter | Filter[];
|
|
@@ -270,10 +301,23 @@ export interface QueryContentParams<AggregationInput extends Aggregations = neve
|
|
|
270
301
|
* This command queries content.
|
|
271
302
|
*
|
|
272
303
|
* @example-ref examples/content/query.js
|
|
304
|
+
* @example-ref examples/content/queryChildren.js
|
|
273
305
|
*
|
|
274
306
|
* @param {object} params JSON with the parameters.
|
|
275
307
|
* @param {number} [params.start=0] Start index (used for paging).
|
|
276
308
|
* @param {number} [params.count=10] Number of contents to fetch.
|
|
309
|
+
* @param {string} [params.parent] Path or id of a content to whose direct children the query is restricted. Where `sort` is not
|
|
310
|
+
* specified, the children are returned in the child order of the parent. A parent that does not exist matches nothing. A path is relative
|
|
311
|
+
* to the content root of the calling context; as the same API also serves the archive, an identical path denotes a different content
|
|
312
|
+
* depending on the context.
|
|
313
|
+
* @param {boolean} [params.recursive=false] Matches every descendant of `parent` rather than its direct children only. Requires
|
|
314
|
+
* `parent`. The child order of the parent is not applied to a subtree, since it orders siblings rather than levels, so specify `sort`
|
|
315
|
+
* where the order of a recursive result is significant.
|
|
316
|
+
* @param {string|string[]} [params.returns='contents'] Determines what each hit carries: `'contents'` for the whole content, which is
|
|
317
|
+
* the default, `'ids'` for id and score, or a list of content field names — `_name`, `_path`, `displayName`, `type`, `creator`,
|
|
318
|
+
* `modifier`, `createdTime`, `modifiedTime`, `owner`, `language` — supplied as `fields` on the hit. Any other name is an error, as is an
|
|
319
|
+
* empty list; request `'ids'` where no fields are required. Only fields a content exposes are available, so a hit returns exactly what
|
|
320
|
+
* the content would return. Every shape other than the default is answered without reading the contents at all.
|
|
277
321
|
* @param {string|object} [params.query] Query expression.
|
|
278
322
|
* @param {object|object[]} [params.filters] Filters to apply to query result
|
|
279
323
|
* @param {string|object|object[]} [params.sort] Sorting expression.
|
|
@@ -283,6 +327,12 @@ export interface QueryContentParams<AggregationInput extends Aggregations = neve
|
|
|
283
327
|
*
|
|
284
328
|
* @returns {object} Result of query.
|
|
285
329
|
*/
|
|
330
|
+
export declare function query<Hit extends Content<unknown> = Content, AggregationInput extends Aggregations = never>(params: QueryContentParams<AggregationInput> & {
|
|
331
|
+
returns: 'ids';
|
|
332
|
+
}): ContentHitsResult<ContentIdHit, AggregationsToAggregationResults<AggregationInput>>;
|
|
333
|
+
export declare function query<Hit extends Content<unknown> = Content, AggregationInput extends Aggregations = never>(params: QueryContentParams<AggregationInput> & {
|
|
334
|
+
returns: string[];
|
|
335
|
+
}): ContentHitsResult<ContentFieldsHit, AggregationsToAggregationResults<AggregationInput>>;
|
|
286
336
|
export declare function query<Hit extends Content<unknown> = Content, AggregationInput extends Aggregations = never>(params: QueryContentParams<AggregationInput>): ContentsResult<Hit, AggregationsToAggregationResults<AggregationInput>>;
|
|
287
337
|
/**
|
|
288
338
|
* @deprecated Use {@link UpdateContentParams} instead.
|
|
@@ -636,6 +686,12 @@ export declare function getPermissions(params: GetPermissionsParams): Permission
|
|
|
636
686
|
export interface Icon {
|
|
637
687
|
data: ByteSource;
|
|
638
688
|
mimeType: string;
|
|
689
|
+
/**
|
|
690
|
+
* @deprecated Not a dependable measure of when the icon last changed, and unsuitable for cache
|
|
691
|
+
* invalidation. Icons are loaded from application resources, so this derives from a jar entry timestamp
|
|
692
|
+
* that build tools normalize to a constant for reproducibility, from the install time of the bundle
|
|
693
|
+
* providing the icon, or from the time the icon happened to be read.
|
|
694
|
+
*/
|
|
639
695
|
modifiedTime: string;
|
|
640
696
|
}
|
|
641
697
|
/**
|
|
@@ -648,11 +704,13 @@ export interface Icon {
|
|
|
648
704
|
* @property {boolean} abstract Whether or not content of this type may be instantiated.
|
|
649
705
|
* @property {boolean} final Whether or not it may be used as super type of other content types.
|
|
650
706
|
* @property {boolean} allowChildContent Whether or not allow creating child items on content of this type.
|
|
651
|
-
* @property {string} modifiedTime Modified time of the content type.
|
|
707
|
+
* @property {string} modifiedTime Modified time of the content type. Deprecated: derives from the build
|
|
708
|
+
* rather than from an edit whenever the content type comes from an application.
|
|
652
709
|
* @property {object} [icon] Icon of the content type.
|
|
653
710
|
* @property {object} [icon.data] Stream with the binary data for the icon.
|
|
654
711
|
* @property {string} [icon.mimeType] Mime type of the icon image.
|
|
655
|
-
* @property {string} [icon.modifiedTime] Modified time of the icon.
|
|
712
|
+
* @property {string} [icon.modifiedTime] Modified time of the icon. Deprecated: derives from the build
|
|
713
|
+
* rather than from an edit to the icon, so it must not be used for caching.
|
|
656
714
|
* @property {object[]} form Form schema represented as an array of form items: Input, ItemSet, Layout, OptionSet.
|
|
657
715
|
* @property {object} config Custom schema configuration for the descriptor.
|
|
658
716
|
*/
|
|
@@ -664,6 +722,12 @@ export interface ContentType {
|
|
|
664
722
|
abstract: boolean;
|
|
665
723
|
final: boolean;
|
|
666
724
|
allowChildContent: boolean;
|
|
725
|
+
/**
|
|
726
|
+
* @deprecated Not a dependable measure of when the content type last changed. Read from an application
|
|
727
|
+
* resource, this derives from a jar entry timestamp that build tools normalize to a constant for
|
|
728
|
+
* reproducibility; only a dynamic schema stored in a repository node carries a genuine time, and the two
|
|
729
|
+
* cannot be told apart here.
|
|
730
|
+
*/
|
|
667
731
|
modifiedTime: string;
|
|
668
732
|
icon?: Icon;
|
|
669
733
|
form: FormItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-content",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0-B1",
|
|
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
|
|
30
|
+
"@enonic-types/core": "8.1.0-B1"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|