How to use @gooddata/typings - 10 common examples

To help you get started, we’ve selected a few @gooddata/typings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gooddata / gooddata-js / src / report / report.ts View on Github external
private sanitizeFilter(filter: AFM.CompatibilityFilter): ExecuteAFM.CompatibilityFilter | null {
        if (AFM.isAttributeFilter(filter)) {
            return convertAttributeFilter(filter);
        } else if (AFM.isAbsoluteDateFilter(filter)) {
            return convertAbsoluteDateFilter(filter);
        } else if (AFM.isRelativeDateFilter(filter)) {
            return convertRelativeDateFilter(filter);
        }
        return filter;
    }
}
github gooddata / gooddata-js / src / DataLayer / utils / AfmUtils.ts View on Github external
function isDateFilterAllTime(dateFilter: AFM.DateFilterItem): boolean {
    if (AFM.isRelativeDateFilter(dateFilter)) {
        return dateFilter.relativeDateFilter.granularity === ALL_TIME_GRANULARITY;
    }
    return false;
}
github gooddata / gooddata-js / src / DataLayer / utils / AfmUtils.ts View on Github external
export function getDateFilterDateDataSet(filter: AFM.DateFilterItem): AFM.ObjQualifier {
    if (AFM.isRelativeDateFilter(filter)) {
        return filter.relativeDateFilter.dataSet;
    }
    if (AFM.isAbsoluteDateFilter(filter)) {
        return filter.absoluteDateFilter.dataSet;
    }
    throw new Error("Unsupported type of date filter");
}
github gooddata / gooddata-js / src / DataLayer / utils / AfmUtils.ts View on Github external
export function getDateFilterDateDataSet(filter: AFM.DateFilterItem): AFM.ObjQualifier {
    if (AFM.isRelativeDateFilter(filter)) {
        return filter.relativeDateFilter.dataSet;
    }
    if (AFM.isAbsoluteDateFilter(filter)) {
        return filter.absoluteDateFilter.dataSet;
    }
    throw new Error("Unsupported type of date filter");
}
github gooddata / gooddata-js / src / report / report.ts View on Github external
private sanitizeFilter(filter: AFM.CompatibilityFilter): ExecuteAFM.CompatibilityFilter | null {
        if (AFM.isAttributeFilter(filter)) {
            return convertAttributeFilter(filter);
        } else if (AFM.isAbsoluteDateFilter(filter)) {
            return convertAbsoluteDateFilter(filter);
        } else if (AFM.isRelativeDateFilter(filter)) {
            return convertRelativeDateFilter(filter);
        }
        return filter;
    }
}
github gooddata / gooddata-js / src / DataLayer / converters / MeasureConverter.ts View on Github external
function getFormat(measure: IMeasure): string | undefined {
    const {
        measure: { definition },
    } = measure;
    const measureFormat = get(measure.measure, "format");

    if (VisualizationObject.isArithmeticMeasureDefinition(definition)) {
        if (definition.arithmeticMeasure.operator === "change") {
            return "#,##0.00%";
        }
    }

    const predefinedFormat = VisualizationObject.isMeasureDefinition(definition)
        ? getPredefinedFormat(definition)
        : undefined;

    return predefinedFormat || measureFormat;
}
github gooddata / gooddata-js / src / DataLayer / converters / MeasureConverter.ts View on Github external
function convertMeasureDefinition(definition: IMeasureDefinitionType): AFM.MeasureDefinition {
    if (VisualizationObject.isMeasureDefinition(definition)) {
        return convertSimpleMeasureDefinition(definition);
    } else if (VisualizationObject.isPopMeasureDefinition(definition)) {
        return convertPopMeasureDefinition(definition);
    } else if (VisualizationObject.isPreviousPeriodMeasureDefinition(definition)) {
        return convertPreviousPeriodMeasureDefinition(definition);
    } else if (VisualizationObject.isArithmeticMeasureDefinition(definition)) {
        return convertArithmeticMeasureDefinition(definition);
    } else {
        throw Error("The measure definition is not supported: " + JSON.stringify(definition));
    }
}
github gooddata / gooddata-js / src / DataLayer / converters / MeasureConverter.ts View on Github external
function convertMeasureDefinition(definition: IMeasureDefinitionType): AFM.MeasureDefinition {
    if (VisualizationObject.isMeasureDefinition(definition)) {
        return convertSimpleMeasureDefinition(definition);
    } else if (VisualizationObject.isPopMeasureDefinition(definition)) {
        return convertPopMeasureDefinition(definition);
    } else if (VisualizationObject.isPreviousPeriodMeasureDefinition(definition)) {
        return convertPreviousPeriodMeasureDefinition(definition);
    } else if (VisualizationObject.isArithmeticMeasureDefinition(definition)) {
        return convertArithmeticMeasureDefinition(definition);
    } else {
        throw Error("The measure definition is not supported: " + JSON.stringify(definition));
    }
}
github gooddata / gooddata-js / src / DataLayer / converters / MeasureConverter.ts View on Github external
function getFormat(measure: IMeasure): string | undefined {
    const {
        measure: { definition },
    } = measure;
    const measureFormat = get(measure.measure, "format");

    if (VisualizationObject.isArithmeticMeasureDefinition(definition)) {
        if (definition.arithmeticMeasure.operator === "change") {
            return "#,##0.00%";
        }
    }

    const predefinedFormat = VisualizationObject.isMeasureDefinition(definition)
        ? getPredefinedFormat(definition)
        : undefined;

    return predefinedFormat || measureFormat;
}
github gooddata / gooddata-js / src / DataLayer / utils / AfmUtils.ts View on Github external
afmFilters = afmFilters.filter(filter => {
            if (AFM.isDateFilter(filter)) {
                return !dateFiltersDataSetsMatch(filter, dateFilter);
            }
            return true;
        });
    }