import {z} from 'zod' export type PickCompiledDimensionLabelOrNameOrTable = {name: string, label: string, table: string}; export type FieldId = string; export type CustomFormatType = 'default' | 'percent' | 'currency' | 'number' | 'id' | 'date' | 'timestamp' | 'bytes_si' | 'bytes_iec' | 'custom'; export type NumberSeparator = 'default' | 'commaPeriod' | 'spacePeriod' | 'periodComma' | 'noSeparatorPeriod' | 'apostrophePeriod'; export type Compact = 'auto' | 'thousands' | 'millions' | 'billions' | 'trillions' | 'kilobytes' | 'megabytes' | 'gigabytes' | 'terabytes' | 'petabytes' | 'kibibytes' | 'mebibytes' | 'gibibytes' | 'tebibytes' | 'pebibytes'; export type CompactOrAlias = Compact | 'K' | 'thousand' | 'M' | 'million' | 'B' | 'billion' | 'T' | 'trillion' | 'KB' | 'kilobyte' | 'MB' | 'megabyte' | 'GB' | 'gigabyte' | 'TB' | 'terabyte' | 'PB' | 'petabyte' | 'KiB' | 'kibibyte' | 'MiB' | 'mebibyte' | 'GiB' | 'gibibyte' | 'TiB' | 'tebibyte' | 'PiB' | 'pebibyte'; export type TimeFrames = 'RAW' | 'YEAR' | 'QUARTER' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | 'MINUTE' | 'SECOND' | 'MILLISECOND' | 'DAY_OF_WEEK_INDEX' | 'DAY_OF_MONTH_NUM' | 'DAY_OF_YEAR_NUM' | 'WEEK_NUM' | 'MONTH_NUM' | 'QUARTER_NUM' | 'YEAR_NUM' | 'DAY_OF_WEEK_NAME' | 'MONTH_NAME' | 'QUARTER_NAME' | 'HOUR_OF_DAY_NUM' | 'MINUTE_OF_HOUR_NUM'; export type CustomFormat = {type: CustomFormatType, round?: number | undefined, separator?: NumberSeparator | undefined, currency?: string | undefined, compact?: CompactOrAlias | undefined, prefix?: string | undefined, suffix?: string | undefined, timeInterval?: TimeFrames | undefined, custom?: string | undefined} | {[key: string]: unknown}; export type PickDimensionFormatOptions = {formatOptions?: CustomFormat | undefined}; export type DimensionOverrides = {[key: string]: PickDimensionFormatOptions}; export type PickMetricFormatOptions = {formatOptions?: CustomFormat | undefined}; export type MetricOverrides = {[key: string]: PickMetricFormatOptions}; export type CustomDimensionTypeBIN = 'bin'; export type BinTypeFIXEDNUMBER = 'fixed_number'; export type FixedNumberBinDimension = {id: string, name: string, table: string, type: CustomDimensionTypeBIN, dimensionId: FieldId, binType: BinTypeFIXEDNUMBER, binNumber: number} | {[key: string]: unknown}; export type BinTypeFIXEDWIDTH = 'fixed_width'; export type FixedWidthBinDimension = {id: string, name: string, table: string, type: CustomDimensionTypeBIN, dimensionId: FieldId, binType: BinTypeFIXEDWIDTH, binWidth: number} | {[key: string]: unknown}; export type BinTypeCUSTOMRANGE = 'custom_range'; export type BinRange = {to?: number | undefined, from?: number | undefined}; export type CustomRangeBinDimension = {id: string, name: string, table: string, type: CustomDimensionTypeBIN, dimensionId: FieldId, binType: BinTypeCUSTOMRANGE, customRange: Array} | {[key: string]: unknown}; export type BinTypeCUSTOMGROUP = 'custom_group'; export type GroupValueMatchType = 'exact' | 'startsWith' | 'endsWith' | 'includes'; export type GroupValueRule = {value: string, matchType: GroupValueMatchType}; export type BinGroup = {values: Array, name: string}; export type CustomGroupBinDimension = {id: string, name: string, table: string, type: CustomDimensionTypeBIN, dimensionId: FieldId, binType: BinTypeCUSTOMGROUP, customGroups: Array} | {[key: string]: unknown}; export type CustomBinDimension = FixedNumberBinDimension | FixedWidthBinDimension | CustomRangeBinDimension | CustomGroupBinDimension; export type CustomDimensionTypeSQL = 'sql'; export type DimensionType = 'string' | 'number' | 'timestamp' | 'date' | 'boolean'; export type CustomSqlDimension = {id: string, name: string, table: string, type: CustomDimensionTypeSQL, sql: string, dimensionType: DimensionType} | {[key: string]: unknown}; export type CustomDimension = CustomBinDimension | CustomSqlDimension; export type MetricType = 'percentile' | 'average' | 'count' | 'count_distinct' | 'sum' | 'sum_distinct' | 'average_distinct' | 'min' | 'max' | 'percent_of_previous' | 'percent_of_total' | 'running_total' | 'number' | 'median' | 'string' | 'date' | 'timestamp' | 'boolean'; export type Format = 'km' | 'mi' | 'si' | 'usd' | 'gbp' | 'eur' | 'jpy' | 'dkk' | 'id' | 'percent'; export type AnyType = unknown; export type FilterOperator = 'isNull' | 'notNull' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'include' | 'doesNotInclude' | 'lessThan' | 'lessThanOrEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'inThePast' | 'notInThePast' | 'inTheNext' | 'inTheCurrent' | 'notInTheCurrent' | 'inBetween' | 'notInBetween' | 'inPeriodToDate'; export type MetricFilterRule = {includeNull?: boolean | undefined, values?: Array | undefined, operator: FilterOperator, id: string, target: {fieldRef: string}, settings?: AnyType | undefined, disabled?: boolean | undefined, required?: boolean | undefined, caseSensitive?: boolean | undefined} | {[key: string]: unknown}; export type AdditionalMetric = {label?: string | undefined, type: MetricType, description?: string | undefined, sql: string, hidden?: boolean | undefined, round?: number | undefined, compact?: CompactOrAlias | undefined, format?: (Format | string) | undefined, separator?: NumberSeparator | undefined, table: string, name: string, index?: number | undefined, filters?: Array | undefined, baseDimensionName?: string | undefined, baseMetricName?: string | undefined, uuid?: (string | null) | undefined, percentile?: number | undefined, distinctKeys?: Array | undefined, formatOptions?: CustomFormat | undefined, generationType?: 'periodOverPeriod' | undefined, baseMetricId?: FieldId | undefined, timeDimensionId?: FieldId | undefined, granularity?: TimeFrames | undefined, periodOffset?: number | undefined} | {[key: string]: unknown}; export type TableCalculationTotalMode = 'formula' | 'sum_of_rows' | 'none'; export type TableCalculationType = 'number' | 'string' | 'date' | 'timestamp' | 'boolean'; export type SqlTableCalculation = {totalMode?: TableCalculationTotalMode | undefined, type?: TableCalculationType | undefined, format?: CustomFormat | undefined, displayName: string, name: string, index?: number | undefined, sql: string}; export type TableCalculationTemplateTypePERCENTCHANGEFROMPREVIOUS = 'percent_change_from_previous'; export type TableCalculationTemplateTypePERCENTOFPREVIOUSVALUE = 'percent_of_previous_value'; export type TableCalculationTemplateTypePERCENTOFCOLUMNTOTAL = 'percent_of_column_total'; export type TableCalculationTemplateTypeRANKINCOLUMN = 'rank_in_column'; export type TableCalculationTemplateTypeRUNNINGTOTAL = 'running_total'; export type FrameBoundaryType = 'unbounded_preceding' | 'preceding' | 'current_row' | 'following' | 'unbounded_following'; export type FrameBoundary = {offset?: number | undefined, type: FrameBoundaryType}; export type FrameType = 'rows' | 'range'; export type FrameClause = {end: FrameBoundary, start?: FrameBoundary | undefined, frameType: FrameType}; export type WindowFunctionType = 'row_number' | 'percent_rank' | 'cume_dist' | 'rank' | 'sum' | 'avg' | 'count' | 'min' | 'max'; export type TableCalculationTemplateTypeWINDOWFUNCTION = 'window_function'; export type TableCalculationTemplate = {partitionBy?: Array | undefined, orderBy: Array<{order: 'asc' | 'desc' | 'null' | null, fieldId: string}>, fieldId: string, type: TableCalculationTemplateTypePERCENTCHANGEFROMPREVIOUS} | {partitionBy?: Array | undefined, orderBy: Array<{order: 'asc' | 'desc' | 'null' | null, fieldId: string}>, fieldId: string, type: TableCalculationTemplateTypePERCENTOFPREVIOUSVALUE} | {partitionBy?: Array | undefined, fieldId: string, type: TableCalculationTemplateTypePERCENTOFCOLUMNTOTAL} | {fieldId: string, type: TableCalculationTemplateTypeRANKINCOLUMN} | {fieldId: string, type: TableCalculationTemplateTypeRUNNINGTOTAL} | {frame?: FrameClause | undefined, partitionBy: Array, orderBy: Array<{order: 'asc' | 'desc' | 'null' | null, fieldId: string}>, fieldId: string | null, windowFunction: WindowFunctionType, type: TableCalculationTemplateTypeWINDOWFUNCTION}; export type TemplateTableCalculation = {totalMode?: TableCalculationTotalMode | undefined, type?: TableCalculationType | undefined, format?: CustomFormat | undefined, displayName: string, name: string, index?: number | undefined, template: TableCalculationTemplate}; export type FormulaTableCalculation = {totalMode?: TableCalculationTotalMode | undefined, type?: TableCalculationType | undefined, format?: CustomFormat | undefined, displayName: string, name: string, index?: number | undefined, formula: string}; export type TableCalculation = SqlTableCalculation | TemplateTableCalculation | FormulaTableCalculation; export type PivotSortAnchor = {value: string | number | boolean | null, reference: string}; export type SortField = {pivotValues?: Array | undefined, nullsFirst?: boolean | undefined, descending: boolean, fieldId: string}; export type FieldTarget = {fieldId: string}; export type FilterRule = {includeNull?: boolean | undefined, values?: Array | undefined, operator: FilterOperator, id: string, target: FieldTarget, settings?: AnyType | undefined, disabled?: boolean | undefined, required?: boolean | undefined, caseSensitive?: boolean | undefined} | {[key: string]: unknown}; export type FilterGroupItem = FilterGroup | FilterRule; export type OrFilterGroup = {or: Array, id: string}; export type AndFilterGroup = {and: Array, id: string}; export type FilterGroup = OrFilterGroup | AndFilterGroup; export type Filters = {tableCalculations?: FilterGroup | undefined, metrics?: FilterGroup | undefined, dimensions?: FilterGroup | undefined}; export type MetricQuery = {metadata?: {hasADateDimension: PickCompiledDimensionLabelOrNameOrTable} | undefined, pivotDimensions?: Array | undefined, timezone?: string | undefined, dimensionOverrides?: DimensionOverrides | undefined, metricOverrides?: MetricOverrides | undefined, customDimensions?: Array | undefined, additionalMetrics?: Array | undefined, tableCalculations: Array, limit: number, sorts: Array, filters: Filters, metrics: Array, dimensions: Array, exploreName: string}; export type ConditionalFormattingTextStyle = {underline?: boolean | undefined, italic?: boolean | undefined, bold?: boolean | undefined}; export type ConditionalFormattingColorApplyTo = 'cell' | 'text' | 'row'; export type ConditionalFormattingWithValuesNumberOrString = {includeNull?: boolean | undefined, values: Array, operator: FilterOperator, id: string}; export type ConditionalFormattingWithCompareTargetNumberOrString = {includeNull?: boolean | undefined, values?: (Array) | undefined, operator: FilterOperator, id: string, compareTarget: FieldTarget | null}; export type ConditionalFormattingWithFilterOperator = ConditionalFormattingWithValuesNumberOrString | ConditionalFormattingWithCompareTargetNumberOrString; export type ConditionalFormattingConfigWithSingleColor = {textStyle?: ConditionalFormattingTextStyle | undefined, applyTo?: ConditionalFormattingColorApplyTo | undefined, rules: Array, darkColor?: string | undefined, color: string, target: FieldTarget | null}; export type ConditionalFormattingMinMaxNumberOrAuto = {max: number | 'auto', min: number | 'auto'}; export type ConditionalFormattingColorRange = {end: string, start: string}; export type ConditionalFormattingConfigWithColorRange = {textStyle?: ConditionalFormattingTextStyle | undefined, applyTo?: ConditionalFormattingColorApplyTo | undefined, rule: ConditionalFormattingMinMaxNumberOrAuto, color: ConditionalFormattingColorRange, target: FieldTarget | null}; export type ConditionalFormattingConfig = ConditionalFormattingConfigWithSingleColor | ConditionalFormattingConfigWithColorRange; export type ComparisonFormatTypes = 'raw' | 'percentage'; export type BigNumber = {comparisonField?: string | undefined, conditionalFormattings?: Array | undefined, comparisonLabel?: string | undefined, flipColors?: boolean | undefined, comparisonFormat?: ComparisonFormatTypes | undefined, showComparison?: boolean | undefined, showTableNamesInLabel?: boolean | undefined, showBigNumberLabel?: boolean | undefined, selectedField?: string | undefined, style?: CompactOrAlias | undefined, label?: string | undefined}; export type ChartTypeBIGNUMBER = 'big_number'; export type BigNumberConfig = {config?: BigNumber | undefined, type: ChartTypeBIGNUMBER}; export type RowLimit = {count: number, direction: 'first' | 'last', mode: 'show' | 'hide'}; export type SeriesMetadata = {color: string}; export type RecordStringSeriesMetadata = {[key: string]: SeriesMetadata}; export type RecordStringBoolean = {[key: string]: boolean}; export type LegendPlacement = 'custom' | 'outsideRight' | 'outsideLeft'; export type EchartsLegend = {selected?: RecordStringBoolean | undefined, placement?: LegendPlacement | undefined, icon?: ('circle' | 'rect' | 'roundRect' | 'triangle' | 'diamond' | 'pin' | 'arrow' | 'none') | undefined, align?: ('auto' | 'left' | 'right') | undefined, height?: string | undefined, width?: string | undefined, left?: string | undefined, bottom?: string | undefined, right?: string | undefined, top?: string | undefined, orient?: ('horizontal' | 'vertical') | undefined, type?: ('plain' | 'scroll') | undefined, show?: boolean | undefined}; export type EchartsGrid = {height?: string | undefined, width?: string | undefined, left?: string | undefined, bottom?: string | undefined, right?: string | undefined, top?: string | undefined, containLabel?: boolean | undefined}; export type MarkLineData = {dynamicValue?: 'average' | undefined, label?: ({position?: ('start' | 'middle' | 'end') | undefined, formatter?: string | undefined}) | undefined, lineStyle?: {color: string} | undefined, uuid: string, type?: string | undefined, value?: string | undefined, name?: string | undefined, xAxis?: string | undefined, yAxis?: string | undefined}; export type MarkLine = {label?: ({formatter?: string | undefined}) | undefined, lineStyle?: {type: string, width: number, color: string} | undefined, symbol?: string | undefined, data: Array}; export type RecordStringUnknown = {[key: string]: unknown}; export type CartesianSeriesType = 'line' | 'bar' | 'scatter' | 'area'; export type PivotValue = {value: unknown, field: string}; export type PivotReference = {pivotValues?: Array | undefined, field: string}; export type Series = {isFilteredOut?: boolean | undefined, markLine?: MarkLine | undefined, smooth?: boolean | undefined, showSymbol?: boolean | undefined, areaStyle?: RecordStringUnknown | undefined, hidden?: boolean | undefined, label?: ({showSeriesName?: boolean | undefined, showLabel?: boolean | undefined, showValue?: boolean | undefined, showOverlappingLabels?: boolean | undefined, position?: ('left' | 'top' | 'right' | 'bottom' | 'inside') | undefined, show?: boolean | undefined}) | undefined, yAxisIndex?: number | undefined, color?: string | undefined, name?: string | undefined, stackLabel?: ({show?: boolean | undefined}) | undefined, stack?: string | undefined, type: CartesianSeriesType, encode: {y?: string | undefined, x?: string | undefined, yRef: PivotReference, xRef: PivotReference}}; export type XAxisSortType = 'default' | 'category' | 'bar_totals'; export type XAxis = {rotate?: number | undefined, inverse?: boolean | undefined, maxOffset?: string | undefined, minOffset?: string | undefined, minInterval?: number | undefined, max?: string | undefined, min?: string | undefined, name?: string | undefined, dataZoomItemCount?: number | undefined, dataZoomAnchor?: ('start' | 'end') | undefined, enableDataZoom?: boolean | undefined, sortType?: XAxisSortType | undefined}; export type Axis = {rotate?: number | undefined, inverse?: boolean | undefined, maxOffset?: string | undefined, minOffset?: string | undefined, minInterval?: number | undefined, max?: string | undefined, min?: string | undefined, name?: string | undefined}; export type TooltipSortBy = 'default' | 'alphabetical' | 'value_ascending' | 'value_descending'; export type EChartsConfig = {legend?: EchartsLegend | undefined, grid?: EchartsGrid | undefined, series?: Array | undefined, xAxis?: Array | undefined, yAxis?: Array | undefined, tooltip?: string | undefined, tooltipSort?: TooltipSortBy | undefined, showAxisTicks?: boolean | undefined, axisLabelFontSize?: number | undefined, axisTitleFontSize?: number | undefined}; export type RecordStringString = Record; export type CartesianChartLayout = {xField?: string | undefined, yField?: Array | undefined, flipAxes?: boolean | undefined, showGridX?: boolean | undefined, showGridY?: boolean | undefined, showXAxis?: boolean | undefined, showYAxis?: boolean | undefined, showLeftYAxis?: boolean | undefined, showRightYAxis?: boolean | undefined, stack?: (string | boolean) | undefined, connectNulls?: boolean | undefined, colorByCategory?: boolean | undefined, categoryColorOverrides?: RecordStringString | undefined}; export type CartesianChart = {columnLimit?: number | undefined, rowLimit?: RowLimit | undefined, metadata?: RecordStringSeriesMetadata | undefined, conditionalFormattings?: Array | undefined, eChartsConfig: EChartsConfig, layout: CartesianChartLayout}; export type ChartTypeCARTESIAN = 'cartesian'; export type CartesianChartConfig = {config?: CartesianChart | undefined, type: ChartTypeCARTESIAN}; export type CustomVis = {spec?: RecordStringUnknown | undefined}; export type ChartTypeCUSTOM = 'custom'; export type CustomVisConfig = {config?: CustomVis | undefined, type: ChartTypeCUSTOM}; export type PieChartLegendPosition = 'horizontal' | 'vertical'; export type PartialPieChartValueOptions = {valueLabel?: ('hidden' | 'inside' | 'outside') | undefined, showValue?: boolean | undefined, showPercentage?: boolean | undefined}; export type RecordStringPartialPieChartValueOptions = {[key: string]: PartialPieChartValueOptions}; export type PieChartValueLabel = 'hidden' | 'inside' | 'outside'; export type PieChart = {metadata?: RecordStringSeriesMetadata | undefined, legendMaxItemLength?: number | undefined, legendPosition?: PieChartLegendPosition | undefined, showLegend?: boolean | undefined, groupSortOverrides?: Array | undefined, groupValueOptionOverrides?: RecordStringPartialPieChartValueOptions | undefined, groupColorOverrides?: RecordStringString | undefined, groupLabelOverrides?: RecordStringString | undefined, showPercentage?: boolean | undefined, showValue?: boolean | undefined, valueLabel?: PieChartValueLabel | undefined, isDonut?: boolean | undefined, metricId?: string | undefined, groupFieldIds?: Array | undefined}; export type ChartTypePIE = 'pie'; export type PieChartConfig = {config?: PieChart | undefined, type: ChartTypePIE}; export type FunnelChartLegendPosition = 'horizontal' | 'vertical'; export type FunnelChartLabelPosition = 'inside' | 'left' | 'right' | 'hidden'; export type FunnelChartDataInput = 'row' | 'column'; export type FunnelChart = {legendPosition?: FunnelChartLegendPosition | undefined, showLegend?: boolean | undefined, labels?: ({showPercentage?: boolean | undefined, showValue?: boolean | undefined, position?: FunnelChartLabelPosition | undefined}) | undefined, colorOverrides?: RecordStringString | undefined, labelOverrides?: RecordStringString | undefined, metadata?: RecordStringSeriesMetadata | undefined, fieldId?: string | undefined, dataInput?: FunnelChartDataInput | undefined}; export type ChartTypeFUNNEL = 'funnel'; export type FunnelChartConfig = {config?: FunnelChart | undefined, type: ChartTypeFUNNEL}; export type ColumnProperties = {width?: number | undefined, color?: string | undefined, displayStyle?: ('text' | 'bar') | undefined, frozen?: boolean | undefined, name?: string | undefined, visible?: boolean | undefined}; export type RecordStringColumnProperties = {[key: string]: ColumnProperties}; export type TableChart = {rowLimit?: RowLimit | undefined, metricsAsRows?: boolean | undefined, conditionalFormattings?: Array | undefined, columns?: RecordStringColumnProperties | undefined, showRowGrouping?: boolean | undefined, showSubtotalsExpanded?: boolean | undefined, showSubtotals?: boolean | undefined, showResultsTotal?: boolean | undefined, hideRowNumbers?: boolean | undefined, showTableNames?: boolean | undefined, showRowCalculation?: boolean | undefined, showColumnCalculation?: boolean | undefined}; export type ChartTypeTABLE = 'table'; export type TableChartConfig = {config?: TableChart | undefined, type: ChartTypeTABLE}; export type TreemapChart = {endColorThreshold?: number | undefined, startColorThreshold?: number | undefined, useDynamicColors?: boolean | undefined, endColor?: string | undefined, startColor?: string | undefined, colorMetricId?: string | undefined, sizeMetricId?: string | undefined, groupFieldIds?: Array | undefined, leafDepth?: number | undefined, visibleMin?: number | undefined}; export type ChartTypeTREEMAP = 'treemap'; export type TreemapChartConfig = {config?: TreemapChart | undefined, type: ChartTypeTREEMAP}; export type GaugeSection = {color: string, maxFieldId?: string | undefined, minFieldId?: string | undefined, max: number, min: number}; export type GaugeChart = {customPercentageLabel?: string | undefined, showPercentage?: boolean | undefined, customLabel?: string | undefined, sections?: Array | undefined, showAxisLabels?: boolean | undefined, maxFieldId?: string | undefined, max?: number | undefined, min?: number | undefined, selectedField?: string | undefined}; export type ChartTypeGAUGE = 'gauge'; export type GaugeChartConfig = {config?: GaugeChart | undefined, type: ChartTypeGAUGE}; export type DataAppVizFieldMapping = Record; export type DataAppVizChart = {fieldMapping: DataAppVizFieldMapping, dataAppVizUuid: string}; export type ChartTypeDATAAPPVIZ = 'data_app_viz'; export type DataAppVizChartConfig = {config?: DataAppVizChart | undefined, type: ChartTypeDATAAPPVIZ}; export type MapFieldConfig = {label?: string | undefined, visible?: boolean | undefined}; export type RecordStringMapFieldConfig = {[key: string]: MapFieldConfig}; export type MapTileBackground = 'none' | 'openstreetmap' | 'light' | 'dark' | 'satellite' | 'voyager'; export type MapHexbinAggregation = 'sum' | 'avg' | 'min' | 'max'; export type MapHexbinValueBasis = 'count' | 'field'; export type MapHexbinSizingMode = 'dynamic' | 'fixed'; export type MapChartType = 'scatter' | 'area' | 'heatmap' | 'hexbin'; export type MapChartLocation = 'USA' | 'world' | 'europe' | 'custom'; export type MapChart = {saveMapExtent?: boolean | undefined, fieldConfig?: RecordStringMapFieldConfig | undefined, noDataColor?: string | undefined, backgroundColor?: string | undefined, darkModeTileBackground?: MapTileBackground | undefined, tileBackground?: MapTileBackground | undefined, dataLayerOpacity?: number | undefined, hexbinConfig?: ({emptyBinColor?: (string | null) | undefined, showEmptyBins?: boolean | undefined, aggregation?: MapHexbinAggregation | undefined, valueBasis?: MapHexbinValueBasis | undefined, fixedResolution?: number | undefined, sizingMode?: MapHexbinSizingMode | undefined, opacity?: number | undefined}) | undefined, heatmapConfig?: ({opacity?: number | undefined, blur?: number | undefined, radius?: number | undefined}) | undefined, sizeFieldId?: string | undefined, maxBubbleSize?: number | undefined, minBubbleSize?: number | undefined, defaultCenterLon?: number | undefined, defaultCenterLat?: number | undefined, defaultZoom?: number | undefined, colorOverrides?: RecordStringString | undefined, colorRange?: Array | undefined, showLegend?: boolean | undefined, valueFieldId?: string | undefined, geoJsonPropertyKey?: string | undefined, locationFieldId?: string | undefined, longitudeFieldId?: string | undefined, latitudeFieldId?: string | undefined, locationType?: MapChartType | undefined, customGeoJsonUrl?: string | undefined, mapType?: MapChartLocation | undefined}; export type ChartTypeMAP = 'map'; export type MapChartConfig = {config?: MapChart | undefined, type: ChartTypeMAP}; export type SankeyNodeLayout = 'multi-step' | 'merged' | 'direct'; export type SankeyChart = {nodeLayout?: SankeyNodeLayout | undefined, orient?: ('horizontal' | 'vertical') | undefined, nodeAlign?: ('left' | 'right' | 'justify') | undefined, metricFieldId?: string | undefined, targetFieldId?: string | undefined, sourceFieldId?: string | undefined}; export type ChartTypeSANKEY = 'sankey'; export type SankeyChartConfig = {config?: SankeyChart | undefined, type: ChartTypeSANKEY}; export type ChartConfig = BigNumberConfig | CartesianChartConfig | CustomVisConfig | PieChartConfig | FunnelChartConfig | TableChartConfig | TreemapChartConfig | GaugeChartConfig | DataAppVizChartConfig | MapChartConfig | SankeyChartConfig; export type ParameterValue = string | number | Array | Array; export type ParametersValuesMap = {[key: string]: ParameterValue}; export type CreateChartInSpace = {name: string, description?: string | undefined, tableName: string, metricQuery: MetricQuery, chartConfig: ChartConfig, pivotConfig?: ({rows?: Array | undefined, columns: Array}) | undefined, parameters?: ParametersValuesMap | undefined, tableConfig: {columnOrder: Array}, dashboardUuid?: (number | null) | undefined, spaceUuid?: string | undefined}; export type CreateChartInDashboard = {name: string, description?: string | undefined, tableName: string, metricQuery: MetricQuery, chartConfig: ChartConfig, pivotConfig?: ({rows?: Array | undefined, columns: Array}) | undefined, parameters?: ParametersValuesMap | undefined, tableConfig: {columnOrder: Array}, spaceUuid?: (number | null) | undefined, dashboardUuid: string}; export type CreateSavedChart = CreateChartInSpace | CreateChartInDashboard; export type CreateDashboardWithCharts = {charts: Array, spaceUuid: string, description?: string | undefined, name: string}; export type CreateApiApiV1ProjectsProjectUuidDashboardsWithChartsArgs = {projectUuid: string, body: CreateDashboardWithCharts}; export type CreateApiApiV1ProjectsProjectUuidDashboardsWithChartsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; export const dateZoomTileTarget = z.object({tableName: z.string().nullable(), fieldId: z.string().nullable(), controlUuid: z.string()}); export const recordStringDateZoomTileTarget = z.record(z.string(), dateZoomTileTarget); export const dateGranularity = z.enum(["Second", "Minute", "Hour", "Day", "Week", "Month", "Quarter", "Year"]); export const dateZoomControl = z.object({hidden: z.boolean().optional(), granularity: z.union([dateGranularity, z.string()]), name: z.string(), uuid: z.string()}); export const dateZoomConfig = z.object({tileTargets: recordStringDateZoomTileTarget, controls: z.array(dateZoomControl)}); export const dashboardConfig = z.object({requiredFiltersNote: z.string().optional(), dateZoomConfig: dateZoomConfig.optional(), defaultDateZoomGranularity: z.union([dateGranularity, z.string()]).optional(), dateZoomGranularities: z.array(z.union([dateGranularity, z.string()])).optional(), parameterOrder: z.array(z.string()).optional(), pinnedParameters: z.array(z.string()).optional(), isAddFilterDisabled: z.boolean().optional(), isDateZoomDisabled: z.boolean()}); export const organizationMemberRole = z.enum(["member", "viewer", "interactive_viewer", "editor", "developer", "admin"]); export const projectMemberRole = z.enum(["viewer", "interactive_viewer", "editor", "developer", "admin"]); export const spaceMemberRole = z.enum(["viewer", "editor", "admin"]); export const spaceAccess = z.object({inheritedFrom: z.enum(["organization", "project", "group", "space_group", "parent_space"]).optional(), inheritedRole: z.union([organizationMemberRole, projectMemberRole]).optional(), projectRole: projectMemberRole.optional(), hasDirectAccess: z.boolean(), role: spaceMemberRole, userUuid: z.string()}); export const dashboardTab = z.object({hidden: z.boolean().optional(), order: z.number().gte(0), name: z.string().min(1), uuid: z.string()}); export const updatedByUser = z.object({userUuid: z.string(), firstName: z.string(), lastName: z.string()}).and(z.record(z.string(), z.unknown())); export const parameterValue = z.union([z.string(), z.number(), z.array(z.string()), z.array(z.number())]); export const dashboardParameterValue = z.object({value: parameterValue, parameterName: z.string()}); export const dashboardParameters = z.record(z.string(), dashboardParameterValue); export const anyType = z.unknown(); export const filterOperator = z.enum(["isNull", "notNull", "equals", "notEquals", "startsWith", "endsWith", "include", "doesNotInclude", "lessThan", "lessThanOrEqual", "greaterThan", "greaterThanOrEqual", "inThePast", "notInThePast", "inTheNext", "inTheCurrent", "notInTheCurrent", "inBetween", "notInBetween", "inPeriodToDate"]); export const dimensionType = z.enum(["string", "number", "timestamp", "date", "boolean"]); export const dashboardFieldTarget = z.object({fallbackType: dimensionType.optional(), isSqlColumn: z.boolean().optional(), tableName: z.string(), fieldId: z.string()}); export const dashboardTileTarget = z.union([dashboardFieldTarget, z.literal(false)]); export const dashboardTileTargets = z.record(z.string(), dashboardTileTarget); export const dashboardFilterRule = z.object({includeNull: z.boolean().optional(), values: z.array(anyType).optional(), operator: filterOperator, id: z.string(), target: dashboardFieldTarget, settings: anyType.optional(), disabled: z.boolean().optional(), required: z.boolean().optional(), caseSensitive: z.boolean().optional(), lockedTabUuids: z.array(z.string()).optional(), requiredGroupId: z.string().optional(), singleValue: z.boolean().optional(), label: z.string().optional(), tileTargets: dashboardTileTargets.optional()}).and(z.record(z.string(), z.unknown())); export const dashboardFilters = z.object({tableCalculations: z.array(dashboardFilterRule), metrics: z.array(dashboardFilterRule), dimensions: z.array(dashboardFilterRule)}); export const chartKind = z.enum(["line", "horizontal_bar", "vertical_bar", "scatter", "area", "mixed", "pie", "table", "big_number", "funnel", "custom", "treemap", "gauge", "map", "sankey", "data_app_viz"]); export const dashboardChartTile = z.object({uuid: z.string(), type: z.literal("saved_chart"), x: z.number(), y: z.number(), h: z.number(), w: z.number(), tabUuid: z.string().nullable().optional(), properties: z.object({chartSlug: z.string().nullable().optional(), lastVersionChartKind: chartKind.nullable().optional(), chartName: z.string().nullable().optional(), belongsToDashboard: z.boolean().optional(), savedChartUuid: z.string().nullable(), hideTitle: z.boolean().optional(), title: z.string().optional()})}); export const dashboardMarkdownTile = z.object({uuid: z.string(), type: z.literal("markdown"), x: z.number(), y: z.number(), h: z.number(), w: z.number(), tabUuid: z.string().nullable().optional(), properties: z.object({hideFrame: z.boolean().optional(), content: z.string(), title: z.string()})}); export const dashboardLoomTile = z.object({uuid: z.string(), type: z.literal("loom"), x: z.number(), y: z.number(), h: z.number(), w: z.number(), tabUuid: z.string().nullable().optional(), properties: z.object({url: z.string(), hideTitle: z.boolean().optional(), title: z.string()})}); export const dashboardSqlChartTile = z.object({uuid: z.string(), type: z.literal("sql_chart"), x: z.number(), y: z.number(), h: z.number(), w: z.number(), tabUuid: z.string().nullable().optional(), properties: z.object({chartSlug: z.string().nullable().optional(), hideTitle: z.boolean().optional(), chartName: z.string(), savedSqlUuid: z.string().nullable(), title: z.string().optional()})}); export const dashboardHeadingTile = z.object({uuid: z.string(), type: z.literal("heading"), x: z.number(), y: z.number(), h: z.number(), w: z.number(), tabUuid: z.string().nullable().optional(), properties: z.object({showDivider: z.boolean().optional(), text: z.string(), title: z.unknown()})}); export const dashboardDataAppTile = z.object({uuid: z.string(), type: z.literal("data_app"), x: z.number(), y: z.number(), h: z.number(), w: z.number(), tabUuid: z.string().nullable().optional(), properties: z.object({appDeletedAt: z.string().nullable().optional(), appUuid: z.string(), hideTitle: z.boolean().optional(), title: z.string()})}); export const dashboardTile = z.union([dashboardChartTile, dashboardMarkdownTile, dashboardLoomTile, dashboardSqlChartTile, dashboardHeadingTile, dashboardDataAppTile]); export const contentVerificationInfo = z.object({verifiedAt: z.string(), verifiedBy: z.object({lastName: z.string(), firstName: z.string(), userUuid: z.string()})}); export const dashboard = z.object({deletedBy: z.object({lastName: z.string(), firstName: z.string(), userUuid: z.string()}).nullable().optional(), deletedAt: z.string().optional(), colorPaletteUuid: z.string().nullable(), config: dashboardConfig.optional(), slug: z.string(), access: z.array(spaceAccess).nullable(), inheritsFromOrgOrProject: z.boolean(), tabs: z.array(dashboardTab), pinnedListOrder: z.number().nullable(), pinnedListUuid: z.string().nullable(), firstViewedAt: z.union([z.string(), z.string()]).nullable(), views: z.number(), spaceName: z.string(), spaceUuid: z.string(), updatedByUser: updatedByUser.optional(), parameters: dashboardParameters.optional(), filters: dashboardFilters, tiles: z.array(dashboardTile), updatedAt: z.string(), description: z.string().optional(), verification: contentVerificationInfo.nullable(), name: z.string(), uuid: z.string(), versionUuid: z.string(), dashboardVersionId: z.number(), projectUuid: z.string(), organizationUuid: z.string()}); export const apiCreateDashboardWithChartsResponse = z.object({results: dashboard, status: z.literal("ok")}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Create dashboard with charts * * POST /api/v1/projects/{projectUuid}/dashboards/with-charts */ export const createApiApiV1ProjectsProjectUuidDashboardsWithCharts = async (args: CreateApiApiV1ProjectsProjectUuidDashboardsWithChartsArgs, options: CreateApiApiV1ProjectsProjectUuidDashboardsWithChartsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/projects/${encodeURIComponent(String(args.projectUuid))}/dashboards/with-charts${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(apiCreateDashboardWithChartsResponse, await res.json()) };