@enonic-types/core 7.11.2 → 7.12.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.
Files changed (2) hide show
  1. package/index.d.ts +482 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -97,6 +97,7 @@ export interface Content<
97
97
  checks?: Record<string, 'PENDING' | 'REJECTED' | 'APPROVED'>;
98
98
  };
99
99
  inherit?: ('CONTENT' | 'PARENT' | 'NAME' | 'SORT')[];
100
+ variantOf?: string;
100
101
  }
101
102
 
102
103
  // Compliant with npm module ts-brand
@@ -109,6 +110,9 @@ type Brand<
109
110
 
110
111
  export type ByteSource = Brand<object, 'ByteSource'>;
111
112
 
113
+ //
114
+ // RESOURCES
115
+ //
112
116
  export interface Resource {
113
117
  getSize(): number;
114
118
 
@@ -118,3 +122,481 @@ export interface Resource {
118
122
 
119
123
  exists(): boolean;
120
124
  }
125
+
126
+ export interface ResourceKey {
127
+ getApplicationKey(): string;
128
+ getPath(): string;
129
+ getUri(): string;
130
+ isRoot(): boolean;
131
+ getName(): string;
132
+ getExtension(): string;
133
+ }
134
+
135
+ //
136
+ // DSL QUERIES
137
+ //
138
+ export type DslQueryType = 'dateTime' | 'time';
139
+
140
+ export type DslOperator = 'OR' | 'AND';
141
+
142
+ export interface TermDslExpression {
143
+ field: string;
144
+ value: unknown;
145
+ type?: DslQueryType;
146
+ boost?: number;
147
+ }
148
+
149
+ export interface InDslExpression {
150
+ field: string;
151
+ values: unknown[];
152
+ type?: DslQueryType;
153
+ boost?: number;
154
+ }
155
+
156
+ export interface LikeDslExpression {
157
+ field: string;
158
+ value: string;
159
+ type?: DslQueryType;
160
+ boost?: number;
161
+ }
162
+
163
+ export interface RangeDslExpression {
164
+ field: string;
165
+ type?: DslQueryType;
166
+ lt?: unknown;
167
+ lte?: unknown;
168
+ gt?: unknown;
169
+ gte?: unknown;
170
+ boost?: number;
171
+ }
172
+
173
+ export interface PathMatchDslExpression {
174
+ field: string;
175
+ path: string;
176
+ minimumMatch?: number;
177
+ boost?: number;
178
+ }
179
+
180
+ export interface MatchAllDslExpression {
181
+ boost?: number;
182
+ }
183
+
184
+ export interface FulltextDslExpression {
185
+ fields: string[];
186
+ query: string;
187
+ operator?: DslOperator;
188
+ boost?: number;
189
+ }
190
+
191
+ export interface NgramDslExpression {
192
+ fields: string[];
193
+ query: string;
194
+ operator?: DslOperator;
195
+ boost?: number;
196
+ }
197
+
198
+ export interface StemmedDslExpression {
199
+ fields: string[];
200
+ query: string;
201
+ language: string;
202
+ operator?: DslOperator;
203
+ boost?: number;
204
+ }
205
+
206
+ export interface ExistsDslExpression {
207
+ field: string;
208
+ boost?: number;
209
+ }
210
+
211
+ export interface BooleanDslExpression {
212
+ should?: QueryDsl | QueryDsl[];
213
+ must?: QueryDsl | QueryDsl[];
214
+ mustNot?: QueryDsl | QueryDsl[];
215
+ filter?: QueryDsl | QueryDsl[];
216
+ boost?: number;
217
+ }
218
+
219
+ export type QueryDsl = {
220
+ boolean: BooleanDslExpression;
221
+ } | {
222
+ ngram: NgramDslExpression;
223
+ } | {
224
+ stemmed: StemmedDslExpression;
225
+ } | {
226
+ fulltext: FulltextDslExpression;
227
+ } | {
228
+ matchAll: MatchAllDslExpression;
229
+ } | {
230
+ pathMatch: PathMatchDslExpression;
231
+ } | {
232
+ range: RangeDslExpression;
233
+ } | {
234
+ like: LikeDslExpression;
235
+ } | {
236
+ in: InDslExpression;
237
+ } | {
238
+ term: TermDslExpression;
239
+ } | {
240
+ exists: ExistsDslExpression;
241
+ };
242
+
243
+ type SortDirection = 'ASC' | 'DESC';
244
+
245
+ type DistanceUnit =
246
+ | 'm'
247
+ | 'meters'
248
+ | 'in'
249
+ | 'inch'
250
+ | 'yd'
251
+ | 'yards'
252
+ | 'ft'
253
+ | 'feet'
254
+ | 'km'
255
+ | 'kilometers'
256
+ | 'NM'
257
+ | 'nmi'
258
+ | 'nauticalmiles'
259
+ | 'mm'
260
+ | 'millimeters'
261
+ | 'cm'
262
+ | 'centimeters'
263
+ | 'mi'
264
+ | 'miles';
265
+
266
+ export interface FieldSortDsl {
267
+ field: string;
268
+ direction?: SortDirection;
269
+ }
270
+
271
+ export interface GeoDistanceSortDsl
272
+ extends FieldSortDsl {
273
+
274
+ unit?: DistanceUnit;
275
+ location?: {
276
+ lat: number;
277
+ lon: number;
278
+ }
279
+ }
280
+
281
+ export type SortDsl = FieldSortDsl | GeoDistanceSortDsl;
282
+
283
+ //
284
+ // START AGGREGATIONS, FILTERS
285
+ //
286
+ export interface Bucket {
287
+ [subAggregationName: string]: AggregationsResult | string | number | undefined;
288
+
289
+ key: string;
290
+ docCount: number;
291
+ }
292
+
293
+ export interface NumericBucket
294
+ extends Bucket {
295
+ from?: number;
296
+ to?: number;
297
+ }
298
+
299
+ export interface DateBucket
300
+ extends Bucket {
301
+ from?: string;
302
+ to?: string;
303
+ }
304
+
305
+ export interface BucketsAggregationResult {
306
+ buckets: (DateBucket | NumericBucket)[];
307
+ }
308
+
309
+ export interface StatsAggregationResult {
310
+ count: number;
311
+ min: number;
312
+ max: number;
313
+ avg: number;
314
+ sum: number;
315
+ }
316
+
317
+ export interface SingleValueMetricAggregationResult {
318
+ value: number;
319
+ }
320
+
321
+ export type AggregationsResult = BucketsAggregationResult | StatsAggregationResult | SingleValueMetricAggregationResult;
322
+
323
+ export type Aggregation =
324
+ | TermsAggregation
325
+ | HistogramAggregation
326
+ | DateHistogramAggregation
327
+ | NumericRangeAggregation
328
+ | DateRangeAggregation
329
+ | StatsAggregation
330
+ | GeoDistanceAggregation
331
+ | MinAggregation
332
+ | MaxAggregation
333
+ | ValueCountAggregation;
334
+
335
+ export interface TermsAggregation {
336
+ terms: {
337
+ field: string;
338
+ order?: string;
339
+ size?: number;
340
+ minDocCount?: number;
341
+ };
342
+ aggregations?: Record<string, Aggregation>;
343
+ }
344
+
345
+ export interface HistogramAggregation {
346
+ histogram: {
347
+ field: string;
348
+ order?: string;
349
+ interval?: number;
350
+ extendedBoundMin?: number;
351
+ extendedBoundMax?: number;
352
+ minDocCount?: number;
353
+ };
354
+ aggregations?: Record<string, Aggregation>;
355
+ }
356
+
357
+ export interface DateHistogramAggregation {
358
+ dateHistogram: {
359
+ field: string;
360
+ interval?: string;
361
+ minDocCount?: number;
362
+ format: string;
363
+ };
364
+ aggregations?: Record<string, Aggregation>;
365
+ }
366
+
367
+ export interface NumericRange {
368
+ from?: number;
369
+ to?: number;
370
+ key?: string;
371
+ }
372
+
373
+ export interface NumericRangeAggregation {
374
+ range: {
375
+ field: string;
376
+ ranges?: NumericRange[];
377
+ };
378
+ aggregations?: Record<string, Aggregation>;
379
+ }
380
+
381
+ export interface DateRange {
382
+ from?: string;
383
+ to?: string;
384
+ key?: string;
385
+ }
386
+
387
+ export interface DateRangeAggregation {
388
+ dateRange: {
389
+ field: string;
390
+ format: string;
391
+ ranges: DateRange[];
392
+ };
393
+ aggregations?: Record<string, Aggregation>;
394
+ }
395
+
396
+ export interface StatsAggregation {
397
+ stats: {
398
+ field: string;
399
+ };
400
+ }
401
+
402
+ export interface GeoDistanceAggregation {
403
+ geoDistance: {
404
+ field: string;
405
+ unit?: string;
406
+ origin: {
407
+ lat: string;
408
+ lon: string;
409
+ };
410
+ ranges: NumericRange[];
411
+ };
412
+ }
413
+
414
+ export interface MinAggregation {
415
+ min: {
416
+ field: string;
417
+ };
418
+ }
419
+
420
+ export interface MaxAggregation {
421
+ max: {
422
+ field: string;
423
+ };
424
+ }
425
+
426
+ export interface ValueCountAggregation {
427
+ count: {
428
+ field: string;
429
+ };
430
+ }
431
+
432
+ export interface Highlight {
433
+ encoder?: 'default' | 'html';
434
+ tagsSchema?: 'styled';
435
+ fragmenter?: 'simple' | 'span';
436
+ fragmentSize?: number;
437
+ noMatchSize?: number;
438
+ numberOfFragments?: number;
439
+ order?: 'score' | 'none';
440
+ preTag?: string;
441
+ postTag?: string;
442
+ requireFieldMatch?: boolean;
443
+ properties?: Record<string, Highlight>;
444
+ }
445
+
446
+ export interface HighlightResult {
447
+ [highlightedFieldName: string]: string[];
448
+ }
449
+
450
+ export interface ExistsFilter {
451
+ exists: {
452
+ field: string;
453
+ };
454
+ }
455
+
456
+ export interface NotExistsFilter {
457
+ notExists: {
458
+ field: string;
459
+ };
460
+ }
461
+
462
+ export interface HasValueFilter {
463
+ hasValue: {
464
+ field: string;
465
+ values: unknown[];
466
+ };
467
+ }
468
+
469
+ export interface IdsFilter {
470
+ ids: {
471
+ values: string[];
472
+ };
473
+ }
474
+
475
+ export interface BooleanFilter {
476
+ boolean: {
477
+ must?: Filter[];
478
+ mustNot?: Filter[];
479
+ should?: Filter[];
480
+ };
481
+ }
482
+
483
+ export type Filter = ExistsFilter | NotExistsFilter | HasValueFilter | IdsFilter | BooleanFilter;
484
+
485
+ //
486
+ // FORM ITEMS
487
+ //
488
+ export type InputType =
489
+ | 'Time'
490
+ | 'DateTime'
491
+ | 'CheckBox'
492
+ | 'ComboBox'
493
+ | 'Long'
494
+ | 'Double'
495
+ | 'RadioButton'
496
+ | 'TextArea'
497
+ | 'ContentTypeFilter'
498
+ | 'GeoPoint'
499
+ | 'TextLine'
500
+ | 'Tag'
501
+ | 'CustomSelector'
502
+ | 'AttachmentUploader'
503
+ | 'ContentSelector'
504
+ | 'MediaSelector'
505
+ | 'ImageSelector'
506
+ | 'Date'
507
+ | 'MediaUploader'
508
+ | 'SiteConfigurator'
509
+ | 'HtmlArea';
510
+
511
+ export interface FormItemSet {
512
+ formItemType: 'ItemSet';
513
+ name: string;
514
+ label: string;
515
+ customText: string;
516
+ helpText: string;
517
+ maximize: boolean;
518
+ inputType: InputType;
519
+ occurrences: {
520
+ maximum: number;
521
+ minimum: number;
522
+ };
523
+ items: FormItem[];
524
+ }
525
+
526
+ export interface FormItemLayout {
527
+ formItemType: 'Layout';
528
+ name: string;
529
+ label: string;
530
+ items: FormItem[];
531
+ }
532
+
533
+ export type ValueType =
534
+ | 'BinaryReference'
535
+ | 'Boolean'
536
+ | 'DateTime'
537
+ | 'Double'
538
+ | 'GeoPoint'
539
+ | 'Link'
540
+ | 'LocalDateTime'
541
+ | 'LocalDate'
542
+ | 'LocalTime'
543
+ | 'Long'
544
+ | 'PropertySet'
545
+ | 'Reference'
546
+ | 'String'
547
+ | 'Xml';
548
+
549
+ export interface FormItemInput {
550
+ formItemType: 'Input';
551
+ name: string;
552
+ label: string;
553
+ customText: string;
554
+ helpText: string;
555
+ validationRegexp: string;
556
+ maximize: boolean;
557
+ inputType: InputType;
558
+ occurrences: {
559
+ maximum: number;
560
+ minimum: number;
561
+ };
562
+ default: {
563
+ value: string;
564
+ type: ValueType;
565
+ }
566
+ config: {
567
+ [configName: string]: {
568
+ [attributeKey: string]: string;
569
+ value: string;
570
+ }[]
571
+ }
572
+ }
573
+
574
+ export interface FormItemOptionSet {
575
+ formItemType: 'OptionSet';
576
+ name: string;
577
+ label: string;
578
+ expanded: boolean;
579
+ helpText: string;
580
+ occurrences: {
581
+ maximum: number;
582
+ minimum: number;
583
+ };
584
+ selection: {
585
+ maximum: number;
586
+ minimum: number;
587
+ };
588
+ options: {
589
+ name: string;
590
+ label: string;
591
+ helpText: string;
592
+ default: boolean;
593
+ items: FormItem[]
594
+ }[];
595
+ }
596
+
597
+ export interface FormItemInlineMixin {
598
+ formItemType: 'InlineMixin';
599
+ name: string;
600
+ }
601
+
602
+ export type FormItem = FormItemSet | FormItemLayout | FormItemOptionSet | FormItemInput | FormItemInlineMixin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/core",
3
- "version": "7.11.2",
3
+ "version": "7.12.0-B1",
4
4
  "description": "Shared type definition for core libraries.",
5
5
  "types": "index.d.ts",
6
6
  "files": [