@gooddata/sdk-backend-tiger 11.62.0-alpha.1 → 11.62.0-alpha.3
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/backend/features/feature.d.ts.map +1 -1
- package/esm/backend/features/feature.js +1 -0
- package/esm/backend/localization/aggregate.d.ts +27 -0
- package/esm/backend/localization/aggregate.d.ts.map +1 -0
- package/esm/backend/localization/aggregate.js +151 -0
- package/esm/backend/localization/fixture.d.ts +21 -0
- package/esm/backend/localization/fixture.d.ts.map +1 -0
- package/esm/backend/localization/fixture.js +125 -0
- package/esm/backend/localization/index.d.ts +35 -0
- package/esm/backend/localization/index.d.ts.map +1 -0
- package/esm/backend/localization/index.js +134 -0
- package/esm/backend/organization/index.d.ts +2 -1
- package/esm/backend/organization/index.d.ts.map +1 -1
- package/esm/backend/organization/index.js +4 -0
- package/esm/backend/organization/settings.d.ts +4 -1
- package/esm/backend/organization/settings.d.ts.map +1 -1
- package/esm/backend/organization/settings.js +12 -0
- package/esm/backend/settings/mapping.d.ts.map +1 -1
- package/esm/backend/settings/mapping.js +3 -0
- package/esm/backend/tigerSpecificFunctions.js +2 -3
- package/esm/backend/uiFeatures.d.ts +3 -0
- package/esm/backend/uiFeatures.d.ts.map +1 -1
- package/esm/backend/uiFeatures.js +3 -0
- package/esm/backend/user/settings.d.ts +1 -1
- package/esm/backend/user/settings.d.ts.map +1 -1
- package/esm/backend/workspace/attributes/elements/dependentDateFilters.d.ts.map +1 -1
- package/esm/backend/workspace/attributes/elements/dependentDateFilters.js +26 -10
- package/esm/backend/workspace/dashboards/referenceAvailability.d.ts +13 -10
- package/esm/backend/workspace/dashboards/referenceAvailability.d.ts.map +1 -1
- package/esm/backend/workspace/dashboards/referenceAvailability.js +28 -13
- package/esm/backend/workspace/genAI/index.d.ts.map +1 -1
- package/esm/backend/workspace/genAI/index.js +13 -5
- package/esm/backend/workspace/index.d.ts +2 -1
- package/esm/backend/workspace/index.d.ts.map +1 -1
- package/esm/backend/workspace/index.js +4 -0
- package/esm/backend/workspace/settings/index.d.ts +1 -1
- package/esm/backend/workspace/settings/index.d.ts.map +1 -1
- package/esm/convertors/fromBackend/AutomationConverter.d.ts.map +1 -1
- package/esm/convertors/fromBackend/AutomationConverter.js +4 -2
- package/esm/convertors/fromBackend/afm/FilterConverter.d.ts.map +1 -1
- package/esm/convertors/fromBackend/afm/FilterConverter.js +42 -0
- package/esm/convertors/fromBackend/genAIConvertor.d.ts.map +1 -1
- package/esm/convertors/fromBackend/genAIConvertor.js +11 -1
- package/esm/convertors/shared/absoluteGranularityLiterals.d.ts +38 -0
- package/esm/convertors/shared/absoluteGranularityLiterals.d.ts.map +1 -0
- package/esm/convertors/shared/absoluteGranularityLiterals.js +82 -0
- package/esm/convertors/shared/storedFilterConverter.d.ts +12 -2
- package/esm/convertors/shared/storedFilterConverter.d.ts.map +1 -1
- package/esm/convertors/shared/storedFilterConverter.js +16 -5
- package/esm/convertors/toBackend/InsightConverter.d.ts.map +1 -1
- package/esm/convertors/toBackend/InsightConverter.js +6 -3
- package/esm/convertors/toBackend/afm/FilterConverter.d.ts.map +1 -1
- package/esm/convertors/toBackend/afm/FilterConverter.js +23 -2
- package/package.json +13 -13
|
@@ -547,6 +547,7 @@ function applyDashboardPatch(items, siblings, patch) {
|
|
|
547
547
|
return {
|
|
548
548
|
datasets: unique(acc?.datasets, curr?.datasets),
|
|
549
549
|
datedatasets: unique(acc?.datedatasets, curr?.datedatasets),
|
|
550
|
+
metrics: unique(getReferencedMetrics(acc), getReferencedMetrics(curr)),
|
|
550
551
|
new_visualizations: unique(acc?.new_visualizations, curr?.new_visualizations),
|
|
551
552
|
visualizations: unique(acc?.visualizations, curr?.visualizations),
|
|
552
553
|
};
|
|
@@ -627,7 +628,16 @@ function buildDatasetEntities(references) {
|
|
|
627
628
|
declarative: yamlDatasetToDeclarative(dateDatasets, data),
|
|
628
629
|
};
|
|
629
630
|
}) ?? [];
|
|
630
|
-
|
|
631
|
+
const metrics = getReferencedMetrics(references).map((data) => ({
|
|
632
|
+
data,
|
|
633
|
+
path: "",
|
|
634
|
+
type: "metric",
|
|
635
|
+
id: data.id,
|
|
636
|
+
}));
|
|
637
|
+
return [...dateDatasets, ...datasets, ...metrics];
|
|
638
|
+
}
|
|
639
|
+
function getReferencedMetrics(references) {
|
|
640
|
+
return (references?.metrics ?? []);
|
|
631
641
|
}
|
|
632
642
|
function buildDashboardReferences(aacDashboard, references, savedDashboardId) {
|
|
633
643
|
const entities = buildDatasetEntities(references);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type DateAttributeGranularity } from "@gooddata/sdk-model";
|
|
2
|
+
declare const WIRE_ABSOLUTE_GRANULARITIES: readonly ["GDC.time.date", "GDC.time.month", "GDC.time.quarter", "GDC.time.year"];
|
|
3
|
+
/**
|
|
4
|
+
* Granularities an absolute date filter can express on the wire as a period literal.
|
|
5
|
+
*/
|
|
6
|
+
export type WireAbsoluteGranularity = (typeof WIRE_ABSOLUTE_GRANULARITIES)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Granularities whose ranges can be sent as period literals rather than as days.
|
|
9
|
+
*/
|
|
10
|
+
export type PeriodLiteralGranularity = Exclude<WireAbsoluteGranularity, "GDC.time.date">;
|
|
11
|
+
export declare function isWireAbsoluteGranularity(granularity: DateAttributeGranularity | undefined): granularity is WireAbsoluteGranularity;
|
|
12
|
+
/**
|
|
13
|
+
* Tells whether an absolute date filter at the granularity can be sent as period literals rather than
|
|
14
|
+
* as its days.
|
|
15
|
+
*/
|
|
16
|
+
export declare function hasPeriodLiteral(granularity: DateAttributeGranularity | undefined): granularity is PeriodLiteralGranularity;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a day into the literal of the period of the given granularity that contains it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toPeriodLiteral(granularity: WireAbsoluteGranularity, day: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Converts a period literal into the first and the last day of that period.
|
|
23
|
+
*/
|
|
24
|
+
export declare function fromPeriodLiteral(granularity: WireAbsoluteGranularity, literal: string): {
|
|
25
|
+
first: string;
|
|
26
|
+
last: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Converts a range of days into the literals of its first and last period of the given granularity.
|
|
30
|
+
*
|
|
31
|
+
* @returns undefined when a day is not in the YYYY-MM-DD format or the range is not whole periods
|
|
32
|
+
*/
|
|
33
|
+
export declare function toWholePeriodLiterals(granularity: PeriodLiteralGranularity, from: string, to: string): {
|
|
34
|
+
from: string;
|
|
35
|
+
to: string;
|
|
36
|
+
} | undefined;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=absoluteGranularityLiterals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absoluteGranularityLiterals.d.ts","sourceRoot":"","sources":["../../../src/convertors/shared/absoluteGranularityLiterals.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAMpE,QAAA,MAAM,2BAA2B,mFAKuB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC;AAEzF,wBAAgB,yBAAyB,CACrC,WAAW,EAAE,wBAAwB,GAAG,SAAS,GAClD,WAAW,IAAI,uBAAuB,CAExC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC5B,WAAW,EAAE,wBAAwB,GAAG,SAAS,GAClD,WAAW,IAAI,wBAAwB,CAEzC;AAkBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,WAAW,EAAE,uBAAuB,EACpC,OAAO,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAuBjC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACjC,WAAW,EAAE,wBAAwB,EACrC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAe1C"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { endOfMonth, endOfQuarter, endOfYear, isValid } from "date-fns";
|
|
3
|
+
import { parseDateValue, serializeDateValue } from "../fromBackend/dateFormatting/dateValueParser.js";
|
|
4
|
+
// TODO: a week has no literal yet, because the backend numbers weeks by ISO-8601 and shifts them by the
|
|
5
|
+
// week start; support will be added later in a different PR.
|
|
6
|
+
const WIRE_ABSOLUTE_GRANULARITIES = [
|
|
7
|
+
"GDC.time.date",
|
|
8
|
+
"GDC.time.month",
|
|
9
|
+
"GDC.time.quarter",
|
|
10
|
+
"GDC.time.year",
|
|
11
|
+
];
|
|
12
|
+
export function isWireAbsoluteGranularity(granularity) {
|
|
13
|
+
return WIRE_ABSOLUTE_GRANULARITIES.some((wireGranularity) => wireGranularity === granularity);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Tells whether an absolute date filter at the granularity can be sent as period literals rather than
|
|
17
|
+
* as its days.
|
|
18
|
+
*/
|
|
19
|
+
export function hasPeriodLiteral(granularity) {
|
|
20
|
+
return isWireAbsoluteGranularity(granularity) && granularity !== "GDC.time.date";
|
|
21
|
+
}
|
|
22
|
+
function isDay(value) {
|
|
23
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(value) && isValid(parseDateValue(value, "GDC.time.date"));
|
|
24
|
+
}
|
|
25
|
+
function parseDay(day) {
|
|
26
|
+
if (!isDay(day)) {
|
|
27
|
+
throw new Error(`Not a day in the YYYY-MM-DD format: ${day}`);
|
|
28
|
+
}
|
|
29
|
+
return parseDateValue(day, "GDC.time.date");
|
|
30
|
+
}
|
|
31
|
+
function serializeDay(date) {
|
|
32
|
+
return serializeDateValue(date, "GDC.time.date");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Converts a day into the literal of the period of the given granularity that contains it.
|
|
36
|
+
*/
|
|
37
|
+
export function toPeriodLiteral(granularity, day) {
|
|
38
|
+
return serializeDateValue(parseDay(day), granularity);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Converts a period literal into the first and the last day of that period.
|
|
42
|
+
*/
|
|
43
|
+
export function fromPeriodLiteral(granularity, literal) {
|
|
44
|
+
const first = parseDateValue(literal, granularity);
|
|
45
|
+
if (!isValid(first)) {
|
|
46
|
+
throw new Error(`Not a ${granularity} literal: ${literal}`);
|
|
47
|
+
}
|
|
48
|
+
let last = first;
|
|
49
|
+
switch (granularity) {
|
|
50
|
+
case "GDC.time.month":
|
|
51
|
+
last = endOfMonth(first);
|
|
52
|
+
break;
|
|
53
|
+
case "GDC.time.quarter":
|
|
54
|
+
last = endOfQuarter(first);
|
|
55
|
+
break;
|
|
56
|
+
case "GDC.time.year":
|
|
57
|
+
last = endOfYear(first);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
first: serializeDay(first),
|
|
62
|
+
last: serializeDay(last),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Converts a range of days into the literals of its first and last period of the given granularity.
|
|
67
|
+
*
|
|
68
|
+
* @returns undefined when a day is not in the YYYY-MM-DD format or the range is not whole periods
|
|
69
|
+
*/
|
|
70
|
+
export function toWholePeriodLiterals(granularity, from, to) {
|
|
71
|
+
if (!isDay(from) || !isDay(to)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const literals = {
|
|
75
|
+
from: toPeriodLiteral(granularity, from),
|
|
76
|
+
to: toPeriodLiteral(granularity, to),
|
|
77
|
+
};
|
|
78
|
+
const isWhole = from <= to &&
|
|
79
|
+
fromPeriodLiteral(granularity, literals.from).first === from &&
|
|
80
|
+
fromPeriodLiteral(granularity, literals.to).last === to;
|
|
81
|
+
return isWhole ? literals : undefined;
|
|
82
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { type ITigerFilter, type ITigerFilterContextItem } from "@gooddata/api-client-tiger";
|
|
2
2
|
import { type FilterContextItem, type IFilter } from "@gooddata/sdk-model";
|
|
3
|
+
/**
|
|
4
|
+
* Options of the conversion of SDK filters to Tiger stored filters.
|
|
5
|
+
*/
|
|
6
|
+
export interface IStoredFilterConversionOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Removes the granularity from absolute date filters. It is kept by default.
|
|
9
|
+
*/
|
|
10
|
+
dropAbsoluteDateGranularity?: boolean;
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* Converts SDK filter to Tiger stored filter format.
|
|
5
14
|
*
|
|
@@ -8,10 +17,11 @@ import { type FilterContextItem, type IFilter } from "@gooddata/sdk-model";
|
|
|
8
17
|
* For AFM/execution filters, use the AFM filter converter instead.
|
|
9
18
|
*
|
|
10
19
|
* @param filter - SDK filter to convert
|
|
20
|
+
* @param options - conversion options
|
|
11
21
|
* @returns Tiger stored filter with sanitized IDs and converted formats
|
|
12
22
|
* @public
|
|
13
23
|
*/
|
|
14
|
-
export declare function convertSdkFilterToTigerStored(filter: IFilter): ITigerFilter;
|
|
24
|
+
export declare function convertSdkFilterToTigerStored(filter: IFilter, options?: IStoredFilterConversionOptions): ITigerFilter;
|
|
15
25
|
/**
|
|
16
26
|
* Converts SDK FilterContextItem to Tiger FilterContextItem.
|
|
17
27
|
*
|
|
@@ -31,7 +41,7 @@ export declare function convertSdkFilterContextItemToTiger(item: FilterContextIt
|
|
|
31
41
|
export declare function convertTigerStoredToSdkFilter(filter: ITigerFilter): IFilter;
|
|
32
42
|
type SdkFiltersToTigerInput = IFilter[] | FilterContextItem[] | undefined;
|
|
33
43
|
type SdkFiltersToTigerOutput<T extends SdkFiltersToTigerInput> = T extends IFilter[] ? ITigerFilter[] : T extends FilterContextItem[] ? ITigerFilterContextItem[] : undefined;
|
|
34
|
-
export declare function convertSdkFiltersToTiger<T extends SdkFiltersToTigerInput>(filters: T): SdkFiltersToTigerOutput<T>;
|
|
44
|
+
export declare function convertSdkFiltersToTiger<T extends SdkFiltersToTigerInput>(filters: T, options?: IStoredFilterConversionOptions): SdkFiltersToTigerOutput<T>;
|
|
35
45
|
type TigerToSdkFiltersInput = ITigerFilter[] | ITigerFilterContextItem[] | undefined;
|
|
36
46
|
type TigerToSdkFiltersOutput<T extends TigerToSdkFiltersInput> = T extends ITigerFilter[] ? IFilter[] : T extends ITigerFilterContextItem[] ? FilterContextItem[] : undefined;
|
|
37
47
|
export declare function convertTigerToSdkFilters<T extends TigerToSdkFiltersInput>(filters: T): TigerToSdkFiltersOutput<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storedFilterConverter.d.ts","sourceRoot":"","sources":["../../../src/convertors/shared/storedFilterConverter.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAG/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,KAAK,iBAAiB,EAEtB,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"storedFilterConverter.d.ts","sourceRoot":"","sources":["../../../src/convertors/shared/storedFilterConverter.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAG/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,KAAK,iBAAiB,EAEtB,KAAK,OAAO,EAMf,MAAM,qBAAqB,CAAC;AAW7B;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C;;OAEG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACzC;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CACzC,MAAM,EAAE,OAAO,EACf,OAAO,GAAE,8BAAmC,GAC7C,YAAY,CAId;AAaD;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,iBAAiB,GAAG,uBAAuB,CAgBnG;AA4CD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAG3E;AAmBD,KAAK,sBAAsB,GAAG,OAAO,EAAE,GAAG,iBAAiB,EAAE,GAAG,SAAS,CAAC;AAC1E,KAAK,uBAAuB,CAAC,CAAC,SAAS,sBAAsB,IAAI,CAAC,SAAS,OAAO,EAAE,GAC9E,YAAY,EAAE,GACd,CAAC,SAAS,iBAAiB,EAAE,GAC3B,uBAAuB,EAAE,GACzB,SAAS,CAAC;AAElB,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,sBAAsB,EACrE,OAAO,EAAE,CAAC,EACV,OAAO,GAAE,8BAAmC,GAC7C,uBAAuB,CAAC,CAAC,CAAC,CAoB5B;AAID,KAAK,sBAAsB,GAAG,YAAY,EAAE,GAAG,uBAAuB,EAAE,GAAG,SAAS,CAAC;AACrF,KAAK,uBAAuB,CAAC,CAAC,SAAS,sBAAsB,IAAI,CAAC,SAAS,YAAY,EAAE,GACnF,OAAO,EAAE,GACT,CAAC,SAAS,uBAAuB,EAAE,GACjC,iBAAiB,EAAE,GACnB,SAAS,CAAC;AAElB,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,sBAAsB,EACrE,OAAO,EAAE,CAAC,GACX,uBAAuB,CAAC,CAAC,CAAC,CAiC5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
2
|
import { isTigerFilterContextItems, isTigerFilters, } from "@gooddata/api-client-tiger";
|
|
3
|
-
import { isComparisonCondition, isDashboardMatchAttributeFilter, isDashboardMeasureValueFilter, } from "@gooddata/sdk-model";
|
|
3
|
+
import { isAbsoluteDateFilter, isComparisonCondition, isDashboardMatchAttributeFilter, isDashboardMeasureValueFilter, } from "@gooddata/sdk-model";
|
|
4
4
|
import { cloneWithSanitizedIdsTyped as cloneWithSanitizedIdsTypedFromBackend } from "../fromBackend/IdSanitization.js";
|
|
5
5
|
import { cloneWithSanitizedIdsTyped as cloneWithSanitizedIdsTypedToBackend } from "../toBackend/IdSanitization.js";
|
|
6
6
|
import { convertMeasureValueFilterSdkToTiger, convertMeasureValueFilterTigerToSdk, } from "./measureValueFilterConverter.js";
|
|
@@ -15,13 +15,24 @@ import { isFilterContextItems, isFilters } from "./sdkFilterTypeGuards.js";
|
|
|
15
15
|
* For AFM/execution filters, use the AFM filter converter instead.
|
|
16
16
|
*
|
|
17
17
|
* @param filter - SDK filter to convert
|
|
18
|
+
* @param options - conversion options
|
|
18
19
|
* @returns Tiger stored filter with sanitized IDs and converted formats
|
|
19
20
|
* @public
|
|
20
21
|
*/
|
|
21
|
-
export function convertSdkFilterToTigerStored(filter) {
|
|
22
|
-
const
|
|
22
|
+
export function convertSdkFilterToTigerStored(filter, options = {}) {
|
|
23
|
+
const stored = options.dropAbsoluteDateGranularity ? dropAbsoluteDateFilterGranularity(filter) : filter;
|
|
24
|
+
const sanitized = cloneWithSanitizedIdsTypedToBackend(stored);
|
|
23
25
|
return convertMeasureValueFilterSdkToTiger(sanitized);
|
|
24
26
|
}
|
|
27
|
+
// Insights store absolute date filters without the granularity. Dropping it cannot change what the
|
|
28
|
+
// filter selects, because from/to already are the first and the last day of the selected periods.
|
|
29
|
+
function dropAbsoluteDateFilterGranularity(filter) {
|
|
30
|
+
if (!isAbsoluteDateFilter(filter) || filter.absoluteDateFilter.granularity === undefined) {
|
|
31
|
+
return filter;
|
|
32
|
+
}
|
|
33
|
+
const { granularity: _granularity, ...absoluteDateFilter } = filter.absoluteDateFilter;
|
|
34
|
+
return { absoluteDateFilter };
|
|
35
|
+
}
|
|
25
36
|
/**
|
|
26
37
|
* Converts SDK FilterContextItem to Tiger FilterContextItem.
|
|
27
38
|
*
|
|
@@ -106,7 +117,7 @@ function convertDashboardFilterToSdk(item) {
|
|
|
106
117
|
}
|
|
107
118
|
return cloneWithSanitizedIdsTypedFromBackend(item);
|
|
108
119
|
}
|
|
109
|
-
export function convertSdkFiltersToTiger(filters) {
|
|
120
|
+
export function convertSdkFiltersToTiger(filters, options = {}) {
|
|
110
121
|
if (!filters) {
|
|
111
122
|
return undefined;
|
|
112
123
|
}
|
|
@@ -117,7 +128,7 @@ export function convertSdkFiltersToTiger(filters) {
|
|
|
117
128
|
return filters.map(convertSdkFilterContextItemToTiger);
|
|
118
129
|
}
|
|
119
130
|
if (isFilters(filters)) {
|
|
120
|
-
return filters.map(convertSdkFilterToTigerStored);
|
|
131
|
+
return filters.map((filter) => convertSdkFilterToTigerStored(filter, options));
|
|
121
132
|
}
|
|
122
133
|
throw new Error("Unsupported filters type");
|
|
123
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightConverter.d.ts","sourceRoot":"","sources":["../../../src/convertors/toBackend/InsightConverter.ts"],"names":[],"mappings":"AAIA,OAAO,EAOH,KAAK,0BAA0B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIH,KAAK,kBAAkB,EAO1B,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"InsightConverter.d.ts","sourceRoot":"","sources":["../../../src/convertors/toBackend/InsightConverter.ts"],"names":[],"mappings":"AAIA,OAAO,EAOH,KAAK,0BAA0B,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIH,KAAK,kBAAkB,EAO1B,MAAM,qBAAqB,CAAC;AAgC7B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,YACd,kBAAkB,KAC5B,0BAA0B,CAAC,oBA2D7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,YAAa,kBAAkB,KAAG,MACxD,CAAC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// (C) 2019-2026 GoodData Corporation
|
|
2
2
|
import { omit } from "lodash-es";
|
|
3
3
|
import { insightLayers, insightParameters, } from "@gooddata/sdk-model";
|
|
4
|
-
import { convertSdkFiltersToTiger } from "../shared/storedFilterConverter.js";
|
|
4
|
+
import { convertSdkFiltersToTiger, } from "../shared/storedFilterConverter.js";
|
|
5
5
|
import { cloneWithSanitizedIdsTyped } from "./IdSanitization.js";
|
|
6
|
+
// TODO: Analytical Designer does not support the granularity of an absolute date filter yet,
|
|
7
|
+
// so the insight and layer filters store only its days; measure filters in buckets keep it.
|
|
8
|
+
const insightFilterConversionOptions = { dropAbsoluteDateGranularity: true };
|
|
6
9
|
function removeIdentifiers(insight) {
|
|
7
10
|
const insightData = omit(insight.insight, ["ref", "uri", "identifier"]);
|
|
8
11
|
return {
|
|
@@ -32,7 +35,7 @@ export const convertInsight = (insight) => {
|
|
|
32
35
|
? {
|
|
33
36
|
layers: layers.map((layer) => {
|
|
34
37
|
const tigerLayer = cloneWithSanitizedIdsTyped(layer);
|
|
35
|
-
const convertedFilters = convertSdkFiltersToTiger(layer.filters);
|
|
38
|
+
const convertedFilters = convertSdkFiltersToTiger(layer.filters, insightFilterConversionOptions);
|
|
36
39
|
return {
|
|
37
40
|
...tigerLayer,
|
|
38
41
|
...(convertedFilters ? { filters: convertedFilters } : {}),
|
|
@@ -48,7 +51,7 @@ export const convertInsight = (insight) => {
|
|
|
48
51
|
: {};
|
|
49
52
|
return {
|
|
50
53
|
buckets: cloneWithSanitizedIdsTyped(sanitizedInsight.insight.buckets),
|
|
51
|
-
filters: convertSdkFiltersToTiger(sanitizedInsight.insight.filters),
|
|
54
|
+
filters: convertSdkFiltersToTiger(sanitizedInsight.insight.filters, insightFilterConversionOptions),
|
|
52
55
|
...(sanitizedInsight.insight.attributeFilterConfigs
|
|
53
56
|
? {
|
|
54
57
|
attributeFilterConfigs: cloneWithSanitizedIdsTyped(sanitizedInsight.insight.attributeFilterConfigs),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterConverter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/toBackend/afm/FilterConverter.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"FilterConverter.d.ts","sourceRoot":"","sources":["../../../../src/convertors/toBackend/afm/FilterConverter.ts"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,gBAAgB,EASxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAMH,KAAK,OAAO,EA2Bf,MAAM,qBAAqB,CAAC;AA+B7B;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED,wBAAgB,0BAA0B,CACtC,MAAM,EAAE,OAAO,EACf,aAAa,EAAE,OAAO,GAAG,SAAS,GACnC,wBAAwB,CAE1B;AA8XD,wBAAgB,aAAa,CACzB,OAAO,EAAE,OAAO,GAAG,wBAAwB,EAC3C,yBAAyB,GAAE,OAAe,GAC3C,gBAAgB,GAAG,IAAI,CAyBzB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// (C) 2007-2026 GoodData Corporation
|
|
2
2
|
import { filterIsEmpty, isAbsoluteDateFilter, isAllTimeDateFilter, isArbitraryAttributeFilter, isAttributeElementsByValue, isAttributeFilter, isComparisonCondition, isFilter, isLowerBound, isMatchAttributeFilter, isMeasureValueFilter, isNegativeAttributeFilter, isObjRef, isPositiveAttributeFilter, isRangeCondition, isRankingFilter, isRelativeBoundedDateFilterBody, isRelativeDateFilter, isUpperBound, } from "@gooddata/sdk-model";
|
|
3
3
|
import { toTigerGranularity } from "../../fromBackend/dateGranularityConversions.js";
|
|
4
|
+
import { hasPeriodLiteral, toWholePeriodLiterals } from "../../shared/absoluteGranularityLiterals.js";
|
|
4
5
|
import { toAfmIdentifier, toDateDataSetQualifier, toLabelQualifier, toLocalIdentifier, } from "../ObjRefConverter.js";
|
|
5
6
|
function toTigerEmptyValueHandling(emptyValues) {
|
|
6
7
|
if (emptyValues === "include") {
|
|
@@ -132,11 +133,31 @@ function convertAbsoluteDateFilter(filter, applyOnResultProp) {
|
|
|
132
133
|
const datasetRef = absoluteDateFilter.dataSet;
|
|
133
134
|
const localIdentifier = absoluteDateFilter.localIdentifier;
|
|
134
135
|
const emptyValueHandling = toTigerEmptyValueHandling(absoluteDateFilter.emptyValueHandling);
|
|
136
|
+
const from = String(absoluteDateFilter.from);
|
|
137
|
+
const to = String(absoluteDateFilter.to);
|
|
138
|
+
const granularity = absoluteDateFilter.granularity;
|
|
139
|
+
// A range of whole periods goes as period literals; any other range, which an older or an as-code
|
|
140
|
+
// dashboard can store, goes as its days, as stored.
|
|
141
|
+
if (hasPeriodLiteral(granularity)) {
|
|
142
|
+
const literals = toWholePeriodLiterals(granularity, from, to);
|
|
143
|
+
if (literals) {
|
|
144
|
+
return {
|
|
145
|
+
absoluteGranularityDateFilter: {
|
|
146
|
+
dataset: toDateDataSetQualifier(datasetRef),
|
|
147
|
+
granularity: toTigerGranularity(granularity),
|
|
148
|
+
...literals,
|
|
149
|
+
localIdentifier,
|
|
150
|
+
...(emptyValueHandling === undefined ? {} : { emptyValueHandling }),
|
|
151
|
+
...applyOnResultProp,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
135
156
|
return {
|
|
136
157
|
absoluteDateFilter: {
|
|
137
158
|
dataset: toDateDataSetQualifier(datasetRef),
|
|
138
|
-
from
|
|
139
|
-
to
|
|
159
|
+
from,
|
|
160
|
+
to,
|
|
140
161
|
localIdentifier,
|
|
141
162
|
...(emptyValueHandling === undefined ? {} : { emptyValueHandling }),
|
|
142
163
|
...applyOnResultProp,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-backend-tiger",
|
|
3
|
-
"version": "11.62.0-alpha.
|
|
3
|
+
"version": "11.62.0-alpha.3",
|
|
4
4
|
"description": "GoodData Backend SPI implementation for GoodData Cloud and GoodData.CN",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"exports": "./esm/index.js",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@gooddata/emailjs-mime-codec-new": "3.0.2",
|
|
25
|
-
"axios": "1.
|
|
25
|
+
"axios": "1.20.0",
|
|
26
26
|
"date-fns": "4.1.0",
|
|
27
27
|
"date-fns-tz": "^3.2.0",
|
|
28
28
|
"eventsource-parser": "~3.0.0",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"ts-invariant": "0.10.3",
|
|
35
35
|
"tslib": "2.8.1",
|
|
36
36
|
"uuid": "11.1.1",
|
|
37
|
-
"@gooddata/
|
|
38
|
-
"@gooddata/
|
|
39
|
-
"@gooddata/sdk-
|
|
40
|
-
"@gooddata/sdk-code-convertors": "11.62.0-alpha.
|
|
41
|
-
"@gooddata/sdk-
|
|
42
|
-
"@gooddata/util": "11.62.0-alpha.
|
|
37
|
+
"@gooddata/api-client-tiger": "11.62.0-alpha.3",
|
|
38
|
+
"@gooddata/sdk-backend-base": "11.62.0-alpha.3",
|
|
39
|
+
"@gooddata/sdk-backend-spi": "11.62.0-alpha.3",
|
|
40
|
+
"@gooddata/sdk-code-convertors": "11.62.0-alpha.3",
|
|
41
|
+
"@gooddata/sdk-model": "11.62.0-alpha.3",
|
|
42
|
+
"@gooddata/util": "11.62.0-alpha.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@gooddata/fixtures": "3.7.0",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"oxlint-plugin-eslint": "1.82.0",
|
|
64
64
|
"oxlint-tsgolint": "7.0.2001",
|
|
65
65
|
"typescript": "7.0.2",
|
|
66
|
-
"vitest": "
|
|
67
|
-
"@gooddata/catalog-export": "11.62.0-alpha.
|
|
68
|
-
"@gooddata/eslint-config": "11.62.0-alpha.
|
|
69
|
-
"@gooddata/oxlint-config": "11.62.0-alpha.
|
|
70
|
-
"@gooddata/reference-workspace": "11.62.0-alpha.
|
|
66
|
+
"vitest": "5.0.4",
|
|
67
|
+
"@gooddata/catalog-export": "11.62.0-alpha.3",
|
|
68
|
+
"@gooddata/eslint-config": "11.62.0-alpha.3",
|
|
69
|
+
"@gooddata/oxlint-config": "11.62.0-alpha.3",
|
|
70
|
+
"@gooddata/reference-workspace": "11.62.0-alpha.3"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"_phase:build": "npm run build",
|