@sisense/sdk-data 1.18.1 → 1.19.0
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/dist/cjs/dimensional-model/attributes.js +1 -1
- package/dist/cjs/dimensional-model/dimensions.js +9 -8
- package/dist/cjs/dimensional-model/filters/factory.d.ts +9 -9
- package/dist/cjs/dimensional-model/filters/factory.js +9 -9
- package/dist/cjs/dimensional-model/filters/filters.d.ts +79 -1
- package/dist/cjs/dimensional-model/filters/filters.js +115 -4
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.d.ts +3 -2
- package/dist/cjs/dimensional-model/filters/utils/attribute-measure-util.js +9 -8
- package/dist/cjs/dimensional-model/interfaces.d.ts +4 -0
- package/dist/cjs/dimensional-model/measures/factory.d.ts +1 -1
- package/dist/cjs/dimensional-model/measures/factory.js +1 -1
- package/dist/cjs/dimensional-model/types.d.ts +5 -0
- package/dist/dimensional-model/attributes.js +1 -1
- package/dist/dimensional-model/dimensions.js +9 -8
- package/dist/dimensional-model/filters/factory.d.ts +9 -9
- package/dist/dimensional-model/filters/factory.js +9 -9
- package/dist/dimensional-model/filters/filters.d.ts +79 -1
- package/dist/dimensional-model/filters/filters.js +103 -3
- package/dist/dimensional-model/filters/utils/attribute-measure-util.d.ts +3 -2
- package/dist/dimensional-model/filters/utils/attribute-measure-util.js +9 -8
- package/dist/dimensional-model/interfaces.d.ts +4 -0
- package/dist/dimensional-model/measures/factory.d.ts +1 -1
- package/dist/dimensional-model/measures/factory.js +1 -1
- package/dist/dimensional-model/types.d.ts +5 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -562,7 +562,7 @@ export declare function measureBase(attribute: Attribute, measure: Measure, oper
|
|
|
562
562
|
* Filter for categories that have an average revenue equal 50 in the Sample ECommerce data model.
|
|
563
563
|
* ```ts
|
|
564
564
|
* filterFactory.measureEquals(
|
|
565
|
-
*
|
|
565
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
566
566
|
* 50
|
|
567
567
|
* )
|
|
568
568
|
* ```
|
|
@@ -580,7 +580,7 @@ export declare function measureEquals(measure: BaseMeasure, value: number, guid?
|
|
|
580
580
|
* to 50 in the Sample ECommerce data model.
|
|
581
581
|
* ```ts
|
|
582
582
|
* filterFactory.measureGreaterThan(
|
|
583
|
-
*
|
|
583
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
584
584
|
* 50
|
|
585
585
|
* )
|
|
586
586
|
* ```
|
|
@@ -598,7 +598,7 @@ export declare function measureGreaterThan(measure: BaseMeasure, value: number,
|
|
|
598
598
|
* or equal to 50 in the Sample ECommerce data model.
|
|
599
599
|
* ```ts
|
|
600
600
|
* filterFactory.measureGreaterThanOrEqual(
|
|
601
|
-
*
|
|
601
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
602
602
|
* 50
|
|
603
603
|
* )
|
|
604
604
|
* ```
|
|
@@ -616,7 +616,7 @@ export declare function measureGreaterThanOrEqual(measure: BaseMeasure, value: n
|
|
|
616
616
|
* or equal to 100 in the Sample ECommerce data model.
|
|
617
617
|
* ```ts
|
|
618
618
|
* filterFactory.measureLessThanOrEqual(
|
|
619
|
-
*
|
|
619
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
620
620
|
* 100
|
|
621
621
|
* )
|
|
622
622
|
* ```
|
|
@@ -633,7 +633,7 @@ export declare function measureLessThanOrEqual(measure: BaseMeasure, value: numb
|
|
|
633
633
|
* Filter for categories that have an average revenue less than 100 in the Sample ECommerce data model.
|
|
634
634
|
* ```ts
|
|
635
635
|
* filterFactory.measureLessThan(
|
|
636
|
-
*
|
|
636
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
637
637
|
* 100
|
|
638
638
|
* )
|
|
639
639
|
* ```
|
|
@@ -651,7 +651,7 @@ export declare function measureLessThan(measure: BaseMeasure, value: number, gui
|
|
|
651
651
|
* or equal to 100 in the Sample ECommerce data model.
|
|
652
652
|
* ```ts
|
|
653
653
|
* filterFactory.measureBetween(
|
|
654
|
-
*
|
|
654
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
655
655
|
* 50,
|
|
656
656
|
* 100
|
|
657
657
|
* )
|
|
@@ -671,7 +671,7 @@ export declare function measureBetween(measure: BaseMeasure, valueA: number, val
|
|
|
671
671
|
* 100 in the Sample ECommerce data model.
|
|
672
672
|
* ```ts
|
|
673
673
|
* filterFactory.measureBetweenNotEqual(
|
|
674
|
-
*
|
|
674
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
675
675
|
* 50,
|
|
676
676
|
* 100
|
|
677
677
|
* )
|
|
@@ -691,7 +691,7 @@ export declare function measureBetweenNotEqual(measure: BaseMeasure, valueA: num
|
|
|
691
691
|
* ```ts
|
|
692
692
|
* filterFactory.topRanking(
|
|
693
693
|
* DM.Commerce.AgeRange,
|
|
694
|
-
*
|
|
694
|
+
* measureFactory.sum(DM.Commerce.Revenue),
|
|
695
695
|
* 3
|
|
696
696
|
* )
|
|
697
697
|
* ```
|
|
@@ -710,7 +710,7 @@ export declare function topRanking(attribute: Attribute, measure: Measure, count
|
|
|
710
710
|
* ```ts
|
|
711
711
|
* filterFactory.bottomRanking(
|
|
712
712
|
* DM.Commerce.AgeRange,
|
|
713
|
-
*
|
|
713
|
+
* measureFactory.sum(DM.Commerce.Revenue),
|
|
714
714
|
* 3
|
|
715
715
|
* )
|
|
716
716
|
* ```
|
|
@@ -638,7 +638,7 @@ export function measureBase(attribute, measure, operatorA, valueA, operatorB, va
|
|
|
638
638
|
* Filter for categories that have an average revenue equal 50 in the Sample ECommerce data model.
|
|
639
639
|
* ```ts
|
|
640
640
|
* filterFactory.measureEquals(
|
|
641
|
-
*
|
|
641
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
642
642
|
* 50
|
|
643
643
|
* )
|
|
644
644
|
* ```
|
|
@@ -658,7 +658,7 @@ export function measureEquals(measure, value, guid) {
|
|
|
658
658
|
* to 50 in the Sample ECommerce data model.
|
|
659
659
|
* ```ts
|
|
660
660
|
* filterFactory.measureGreaterThan(
|
|
661
|
-
*
|
|
661
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
662
662
|
* 50
|
|
663
663
|
* )
|
|
664
664
|
* ```
|
|
@@ -678,7 +678,7 @@ export function measureGreaterThan(measure, value, guid) {
|
|
|
678
678
|
* or equal to 50 in the Sample ECommerce data model.
|
|
679
679
|
* ```ts
|
|
680
680
|
* filterFactory.measureGreaterThanOrEqual(
|
|
681
|
-
*
|
|
681
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
682
682
|
* 50
|
|
683
683
|
* )
|
|
684
684
|
* ```
|
|
@@ -698,7 +698,7 @@ export function measureGreaterThanOrEqual(measure, value, guid) {
|
|
|
698
698
|
* or equal to 100 in the Sample ECommerce data model.
|
|
699
699
|
* ```ts
|
|
700
700
|
* filterFactory.measureLessThanOrEqual(
|
|
701
|
-
*
|
|
701
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
702
702
|
* 100
|
|
703
703
|
* )
|
|
704
704
|
* ```
|
|
@@ -717,7 +717,7 @@ export function measureLessThanOrEqual(measure, value, guid) {
|
|
|
717
717
|
* Filter for categories that have an average revenue less than 100 in the Sample ECommerce data model.
|
|
718
718
|
* ```ts
|
|
719
719
|
* filterFactory.measureLessThan(
|
|
720
|
-
*
|
|
720
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
721
721
|
* 100
|
|
722
722
|
* )
|
|
723
723
|
* ```
|
|
@@ -737,7 +737,7 @@ export function measureLessThan(measure, value, guid) {
|
|
|
737
737
|
* or equal to 100 in the Sample ECommerce data model.
|
|
738
738
|
* ```ts
|
|
739
739
|
* filterFactory.measureBetween(
|
|
740
|
-
*
|
|
740
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
741
741
|
* 50,
|
|
742
742
|
* 100
|
|
743
743
|
* )
|
|
@@ -759,7 +759,7 @@ export function measureBetween(measure, valueA, valueB, guid) {
|
|
|
759
759
|
* 100 in the Sample ECommerce data model.
|
|
760
760
|
* ```ts
|
|
761
761
|
* filterFactory.measureBetweenNotEqual(
|
|
762
|
-
*
|
|
762
|
+
* measureFactory.average(DM.Commerce.Revenue),
|
|
763
763
|
* 50,
|
|
764
764
|
* 100
|
|
765
765
|
* )
|
|
@@ -782,7 +782,7 @@ export function measureBetweenNotEqual(measure, valueA, valueB, guid) {
|
|
|
782
782
|
* ```ts
|
|
783
783
|
* filterFactory.topRanking(
|
|
784
784
|
* DM.Commerce.AgeRange,
|
|
785
|
-
*
|
|
785
|
+
* measureFactory.sum(DM.Commerce.Revenue),
|
|
786
786
|
* 3
|
|
787
787
|
* )
|
|
788
788
|
* ```
|
|
@@ -803,7 +803,7 @@ export function topRanking(attribute, measure, count, guid) {
|
|
|
803
803
|
* ```ts
|
|
804
804
|
* filterFactory.bottomRanking(
|
|
805
805
|
* DM.Commerce.AgeRange,
|
|
806
|
-
*
|
|
806
|
+
* measureFactory.sum(DM.Commerce.Revenue),
|
|
807
807
|
* 3
|
|
808
808
|
* )
|
|
809
809
|
* ```
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LevelAttribute, Attribute, Measure, Filter } from '../interfaces.js';
|
|
2
2
|
import { DimensionalElement } from '../base.js';
|
|
3
|
+
import { AnyObject } from '../types.js';
|
|
3
4
|
/**
|
|
4
5
|
* Different text operators that can be used with text filters
|
|
5
6
|
*
|
|
@@ -71,7 +72,7 @@ export declare const FilterTypes: {
|
|
|
71
72
|
ranking: string;
|
|
72
73
|
text: string;
|
|
73
74
|
numeric: string;
|
|
74
|
-
|
|
75
|
+
dateRange: string;
|
|
75
76
|
relativeDate: string;
|
|
76
77
|
cascading: string;
|
|
77
78
|
advanced: string;
|
|
@@ -350,6 +351,83 @@ export declare class CustomFilter extends AbstractFilter {
|
|
|
350
351
|
*/
|
|
351
352
|
filterJaql(): any;
|
|
352
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Checks if a filter is a CustomFilter.
|
|
356
|
+
*
|
|
357
|
+
* @param filter - The filter to check.
|
|
358
|
+
* @internal
|
|
359
|
+
*/
|
|
360
|
+
export declare function isCustomFilter(filter: Filter & AnyObject): filter is CustomFilter;
|
|
361
|
+
/**
|
|
362
|
+
* Checks if a filter is a MembersFilter.
|
|
363
|
+
*
|
|
364
|
+
* @param filter - The filter to check.
|
|
365
|
+
* @internal
|
|
366
|
+
*/
|
|
367
|
+
export declare function isMembersFilter(filter: Filter & AnyObject): filter is MembersFilter;
|
|
368
|
+
/**
|
|
369
|
+
* Checks if a filter is a NumericFilter.
|
|
370
|
+
*
|
|
371
|
+
* @param filter - The filter to check.
|
|
372
|
+
* @internal
|
|
373
|
+
*/
|
|
374
|
+
export declare function isNumericFilter(filter: Filter & AnyObject): filter is NumericFilter;
|
|
375
|
+
/**
|
|
376
|
+
* Checks if a filter is a TextFilter.
|
|
377
|
+
*
|
|
378
|
+
* @param filter - The filter to check.
|
|
379
|
+
* @internal
|
|
380
|
+
*/
|
|
381
|
+
export declare function isRankingFilter(filter: Filter & AnyObject): filter is RankingFilter;
|
|
382
|
+
/**
|
|
383
|
+
* Checks if a filter is a MeasureFilter.
|
|
384
|
+
*
|
|
385
|
+
* @param filter - The filter to check.
|
|
386
|
+
* @internal
|
|
387
|
+
*/
|
|
388
|
+
export declare function isMeasureFilter(filter: Filter & AnyObject): filter is MeasureFilter;
|
|
389
|
+
/**
|
|
390
|
+
* Checks if a filter is a ExcludeFilter.
|
|
391
|
+
*
|
|
392
|
+
* @param filter - The filter to check.
|
|
393
|
+
* @internal
|
|
394
|
+
*/
|
|
395
|
+
export declare function isExcludeFilter(filter: Filter & AnyObject): filter is ExcludeFilter;
|
|
396
|
+
/**
|
|
397
|
+
* Checks if a filter is a LogicalAttributeFilter.
|
|
398
|
+
*
|
|
399
|
+
* @param filter - The filter to check.
|
|
400
|
+
* @internal
|
|
401
|
+
*/
|
|
402
|
+
export declare function isLogicalAttributeFilter(filter: Filter & AnyObject): filter is LogicalAttributeFilter;
|
|
403
|
+
/**
|
|
404
|
+
* Checks if a filter is a CascadingFilter.
|
|
405
|
+
*
|
|
406
|
+
* @param filter - The filter to check.
|
|
407
|
+
* @internal
|
|
408
|
+
*/
|
|
409
|
+
export declare function isCascadingFilter(filter: Filter & AnyObject): filter is CascadingFilter;
|
|
410
|
+
/**
|
|
411
|
+
* Checks if a filter is a RelativeDateFilter.
|
|
412
|
+
*
|
|
413
|
+
* @param filter - The filter to check.
|
|
414
|
+
* @internal
|
|
415
|
+
*/
|
|
416
|
+
export declare function isRelativeDateFilter(filter: Filter & AnyObject): filter is RelativeDateFilter;
|
|
417
|
+
/**
|
|
418
|
+
* Checks if a filter is a TextFilter.
|
|
419
|
+
*
|
|
420
|
+
* @param filter - The filter to check.
|
|
421
|
+
* @internal
|
|
422
|
+
*/
|
|
423
|
+
export declare function isTextFilter(filter: Filter & AnyObject): filter is TextFilter;
|
|
424
|
+
/**
|
|
425
|
+
* Checks if a filter is a DateRangeFilter.
|
|
426
|
+
*
|
|
427
|
+
* @param filter - The filter to check.
|
|
428
|
+
* @internal
|
|
429
|
+
*/
|
|
430
|
+
export declare function isDateRangeFilter(filter: Filter & AnyObject): filter is DateRangeFilter;
|
|
353
431
|
/**
|
|
354
432
|
* @param json - Filter JSON representation
|
|
355
433
|
* @internal
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
1
2
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
4
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
@@ -83,7 +84,7 @@ export const FilterTypes = {
|
|
|
83
84
|
ranking: 'ranking',
|
|
84
85
|
text: 'text',
|
|
85
86
|
numeric: 'numeric',
|
|
86
|
-
|
|
87
|
+
dateRange: 'dateRange',
|
|
87
88
|
relativeDate: 'relativeDate',
|
|
88
89
|
cascading: 'cascading',
|
|
89
90
|
advanced: 'advanced',
|
|
@@ -531,7 +532,7 @@ export class TextFilter extends DoubleOperatorFilter {
|
|
|
531
532
|
*/
|
|
532
533
|
export class DateRangeFilter extends DoubleOperatorFilter {
|
|
533
534
|
constructor(l, valueFrom, valueTo, guid) {
|
|
534
|
-
super(l, FilterTypes.
|
|
535
|
+
super(l, FilterTypes.dateRange, DateOperators.From, valueFrom, DateOperators.To, valueTo, guid);
|
|
535
536
|
if (typeof valueFrom === 'object') {
|
|
536
537
|
this.valueA = valueFrom.toISOString();
|
|
537
538
|
}
|
|
@@ -645,6 +646,105 @@ export class CustomFilter extends AbstractFilter {
|
|
|
645
646
|
return this.jaqlExpression;
|
|
646
647
|
}
|
|
647
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Checks if a filter is a CustomFilter.
|
|
651
|
+
*
|
|
652
|
+
* @param filter - The filter to check.
|
|
653
|
+
* @internal
|
|
654
|
+
*/
|
|
655
|
+
export function isCustomFilter(filter) {
|
|
656
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.advanced;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Checks if a filter is a MembersFilter.
|
|
660
|
+
*
|
|
661
|
+
* @param filter - The filter to check.
|
|
662
|
+
* @internal
|
|
663
|
+
*/
|
|
664
|
+
export function isMembersFilter(filter) {
|
|
665
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.members;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Checks if a filter is a NumericFilter.
|
|
669
|
+
*
|
|
670
|
+
* @param filter - The filter to check.
|
|
671
|
+
* @internal
|
|
672
|
+
*/
|
|
673
|
+
export function isNumericFilter(filter) {
|
|
674
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.numeric;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Checks if a filter is a TextFilter.
|
|
678
|
+
*
|
|
679
|
+
* @param filter - The filter to check.
|
|
680
|
+
* @internal
|
|
681
|
+
*/
|
|
682
|
+
export function isRankingFilter(filter) {
|
|
683
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.ranking;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Checks if a filter is a MeasureFilter.
|
|
687
|
+
*
|
|
688
|
+
* @param filter - The filter to check.
|
|
689
|
+
* @internal
|
|
690
|
+
*/
|
|
691
|
+
export function isMeasureFilter(filter) {
|
|
692
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.measure;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Checks if a filter is a ExcludeFilter.
|
|
696
|
+
*
|
|
697
|
+
* @param filter - The filter to check.
|
|
698
|
+
* @internal
|
|
699
|
+
*/
|
|
700
|
+
export function isExcludeFilter(filter) {
|
|
701
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.exclude;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Checks if a filter is a LogicalAttributeFilter.
|
|
705
|
+
*
|
|
706
|
+
* @param filter - The filter to check.
|
|
707
|
+
* @internal
|
|
708
|
+
*/
|
|
709
|
+
export function isLogicalAttributeFilter(filter) {
|
|
710
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.logicalAttribute;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Checks if a filter is a CascadingFilter.
|
|
714
|
+
*
|
|
715
|
+
* @param filter - The filter to check.
|
|
716
|
+
* @internal
|
|
717
|
+
*/
|
|
718
|
+
export function isCascadingFilter(filter) {
|
|
719
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.cascading;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Checks if a filter is a RelativeDateFilter.
|
|
723
|
+
*
|
|
724
|
+
* @param filter - The filter to check.
|
|
725
|
+
* @internal
|
|
726
|
+
*/
|
|
727
|
+
export function isRelativeDateFilter(filter) {
|
|
728
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.relativeDate;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Checks if a filter is a TextFilter.
|
|
732
|
+
*
|
|
733
|
+
* @param filter - The filter to check.
|
|
734
|
+
* @internal
|
|
735
|
+
*/
|
|
736
|
+
export function isTextFilter(filter) {
|
|
737
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.text;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Checks if a filter is a DateRangeFilter.
|
|
741
|
+
*
|
|
742
|
+
* @param filter - The filter to check.
|
|
743
|
+
* @internal
|
|
744
|
+
*/
|
|
745
|
+
export function isDateRangeFilter(filter) {
|
|
746
|
+
return 'filterType' in filter && filter.filterType === FilterTypes.dateRange;
|
|
747
|
+
}
|
|
648
748
|
/**
|
|
649
749
|
* @param json - Filter JSON representation
|
|
650
750
|
* @internal
|
|
@@ -675,7 +775,7 @@ export function createFilter(json) {
|
|
|
675
775
|
case FilterTypes.relativeDate:
|
|
676
776
|
return new RelativeDateFilter(create(json.attribute), json.offset, json.count, json.operator, json.anchor);
|
|
677
777
|
break;
|
|
678
|
-
case FilterTypes.
|
|
778
|
+
case FilterTypes.dateRange:
|
|
679
779
|
return new DateRangeFilter(create(json.attribute), json.valueA, json.valueB);
|
|
680
780
|
break;
|
|
681
781
|
}
|
|
@@ -9,9 +9,10 @@ import { FilterJaqlInternal, RankingFilterJaql } from './types.js';
|
|
|
9
9
|
* @param column - Column name
|
|
10
10
|
* @param level - Date level
|
|
11
11
|
* @param dataType - Data type
|
|
12
|
+
* @param title - Attribute title
|
|
12
13
|
* @returns attribute or level attribute
|
|
13
14
|
*/
|
|
14
|
-
export declare const createAttributeHelper: (dim: string, table: string | undefined, column: string, level: string | undefined, dataType: string) => Attribute | LevelAttribute;
|
|
15
|
+
export declare const createAttributeHelper: (dim: string, table: string | undefined, column: string, level: string | undefined, dataType: string, title?: string) => Attribute | LevelAttribute;
|
|
15
16
|
/**
|
|
16
17
|
* Creates an attribute or level attribute from the provided filter JAQL object
|
|
17
18
|
*
|
|
@@ -30,7 +31,7 @@ export declare const createAttributeFromFilterJaql: (jaql: FilterJaql | FilterJa
|
|
|
30
31
|
* @param agg - Aggregation function
|
|
31
32
|
* @returns measure
|
|
32
33
|
*/
|
|
33
|
-
export declare const createMeasureHelper: (dim: string, table: string | undefined, column: string, level: string | undefined, dataType: string, agg: string) => BaseMeasure;
|
|
34
|
+
export declare const createMeasureHelper: (dim: string, table: string | undefined, column: string, level: string | undefined, dataType: string, agg: string, title?: string) => BaseMeasure;
|
|
34
35
|
/**
|
|
35
36
|
* Creates a measure from the provided filter JAQL object
|
|
36
37
|
*
|
|
@@ -11,22 +11,23 @@ const DATA_MODEL_MODULE_NAME = 'DM';
|
|
|
11
11
|
* @param column - Column name
|
|
12
12
|
* @param level - Date level
|
|
13
13
|
* @param dataType - Data type
|
|
14
|
+
* @param title - Attribute title
|
|
14
15
|
* @returns attribute or level attribute
|
|
15
16
|
*/
|
|
16
|
-
export const createAttributeHelper = (dim, table, column, level, dataType) => {
|
|
17
|
+
export const createAttributeHelper = (dim, table, column, level, dataType, title) => {
|
|
17
18
|
// if table is undefined, extract it from dim
|
|
18
19
|
const dimTable = table !== null && table !== void 0 ? table : dim.slice(1, -1).split('.')[0];
|
|
19
20
|
if (level) {
|
|
20
21
|
const dateLevel = DimensionalLevelAttribute.translateJaqlToGranularity({ level });
|
|
21
22
|
const format = DimensionalLevelAttribute.getDefaultFormatForGranularity(dateLevel);
|
|
22
|
-
const levelAttribute = new DimensionalLevelAttribute(column, dim, dateLevel, format);
|
|
23
|
+
const levelAttribute = new DimensionalLevelAttribute(title !== null && title !== void 0 ? title : column, dim, dateLevel, format);
|
|
23
24
|
levelAttribute.composeCode = normalizeAttributeName(dimTable, column, level, DATA_MODEL_MODULE_NAME);
|
|
24
25
|
return levelAttribute;
|
|
25
26
|
}
|
|
26
27
|
const attributeType = isNumber(dataType)
|
|
27
28
|
? MetadataTypes.NumericAttribute
|
|
28
29
|
: MetadataTypes.TextAttribute;
|
|
29
|
-
const attribute = new DimensionalAttribute(column, dim, attributeType);
|
|
30
|
+
const attribute = new DimensionalAttribute(title !== null && title !== void 0 ? title : column, dim, attributeType);
|
|
30
31
|
attribute.composeCode = normalizeAttributeName(dimTable, column, undefined, DATA_MODEL_MODULE_NAME);
|
|
31
32
|
return attribute;
|
|
32
33
|
};
|
|
@@ -37,7 +38,7 @@ export const createAttributeHelper = (dim, table, column, level, dataType) => {
|
|
|
37
38
|
* @returns attribute or level attribute
|
|
38
39
|
*/
|
|
39
40
|
export const createAttributeFromFilterJaql = (jaql) => {
|
|
40
|
-
return createAttributeHelper(jaql.dim, jaql.table, jaql.column, jaql.level, jaql.datatype);
|
|
41
|
+
return createAttributeHelper(jaql.dim, jaql.table, jaql.column, jaql.level, jaql.datatype, jaql.title);
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
44
|
* Creates a measure from the provided parameters
|
|
@@ -50,8 +51,8 @@ export const createAttributeFromFilterJaql = (jaql) => {
|
|
|
50
51
|
* @param agg - Aggregation function
|
|
51
52
|
* @returns measure
|
|
52
53
|
*/
|
|
53
|
-
export const createMeasureHelper = (dim, table, column, level, dataType, agg) => {
|
|
54
|
-
const attribute = createAttributeHelper(dim, table, column, level, dataType);
|
|
54
|
+
export const createMeasureHelper = (dim, table, column, level, dataType, agg, title) => {
|
|
55
|
+
const attribute = createAttributeHelper(dim, table, column, level, dataType, title);
|
|
55
56
|
const measure = measureFactory.aggregate(attribute, agg);
|
|
56
57
|
measure.composeCode = `measureFactory.${agg}(${attribute.composeCode})`;
|
|
57
58
|
return measure;
|
|
@@ -63,10 +64,10 @@ export const createMeasureHelper = (dim, table, column, level, dataType, agg) =>
|
|
|
63
64
|
* @returns Measure
|
|
64
65
|
*/
|
|
65
66
|
export const createMeasureFromFilterJaql = (jaql) => {
|
|
66
|
-
const { dim, table, column, level, datatype: dataType, agg } = jaql;
|
|
67
|
+
const { dim, table, column, title, level, datatype: dataType, agg } = jaql;
|
|
67
68
|
if (!agg)
|
|
68
69
|
return undefined;
|
|
69
|
-
return createMeasureHelper(dim, table, column, level, dataType, agg);
|
|
70
|
+
return createMeasureHelper(dim, table, column, level, dataType, agg, title);
|
|
70
71
|
};
|
|
71
72
|
/**
|
|
72
73
|
* Creates a measure from the provided ranking filter JAQL object
|
|
@@ -344,6 +344,10 @@ export interface Filter extends Element {
|
|
|
344
344
|
* Attribute this filter instance is filtering
|
|
345
345
|
*/
|
|
346
346
|
readonly attribute: Attribute;
|
|
347
|
+
/**
|
|
348
|
+
* Filter type
|
|
349
|
+
*/
|
|
350
|
+
readonly filterType: string;
|
|
347
351
|
/**
|
|
348
352
|
* Boolean flag whether the filter is a scope filter
|
|
349
353
|
*/
|
|
@@ -258,7 +258,7 @@ export declare function countDistinct(attribute: Attribute, name?: string, forma
|
|
|
258
258
|
* ```ts
|
|
259
259
|
* measureFactory.measuredValue(
|
|
260
260
|
* measureFactory.sum(DM.Commerce.Cost),
|
|
261
|
-
* [
|
|
261
|
+
* [filterFactory.greaterThan(DM.Commerce.Cost, 100)],
|
|
262
262
|
* 'Cost Greater Than 100'
|
|
263
263
|
* ),
|
|
264
264
|
* ```
|
|
@@ -381,7 +381,7 @@ export function countDistinct(attribute, name, format) {
|
|
|
381
381
|
* ```ts
|
|
382
382
|
* measureFactory.measuredValue(
|
|
383
383
|
* measureFactory.sum(DM.Commerce.Cost),
|
|
384
|
-
* [
|
|
384
|
+
* [filterFactory.greaterThan(DM.Commerce.Cost, 100)],
|
|
385
385
|
* 'Cost Greater Than 100'
|
|
386
386
|
* ),
|
|
387
387
|
* ```
|
|
@@ -190,6 +190,7 @@ export declare type BaseJaql = {
|
|
|
190
190
|
jaql: FilterJaql;
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
|
+
merged?: boolean;
|
|
193
194
|
};
|
|
194
195
|
/** @internal */
|
|
195
196
|
export declare type FormulaID = string;
|
|
@@ -255,4 +256,8 @@ declare type AndFilter<FilterItem> = {
|
|
|
255
256
|
export declare type OrFilter<FilterItem> = {
|
|
256
257
|
or: FilterItem[];
|
|
257
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* Abstract object with any unknown values
|
|
261
|
+
*/
|
|
262
|
+
export declare type AnyObject = Record<string, any>;
|
|
258
263
|
export {};
|