@gooddata/typings
Advanced tools
Comparing version 0.0.3 to 0.0.4-martin.mosko-visualization-object-2017-12-11T15-59-05-420Z
@@ -108,2 +108,3 @@ export declare namespace AFM { | ||
attributeIdentifier: Identifier; | ||
aggregation?: 'sum'; | ||
}; | ||
@@ -136,2 +137,118 @@ } | ||
} | ||
export declare namespace VisualizationObject { | ||
type SortDirection = 'asc' | 'desc'; | ||
type Identifier = string; | ||
type MeasureAggregation = 'sum' | 'count' | 'avg' | 'min' | 'max' | 'median' | 'runsum'; | ||
type BucketItem = IMeasure | IVisualizationAttribute; | ||
type VisualizationObjectFilter = VisualizationObjectDateFilter | VisualizationObjectAttributeFilter; | ||
type VisualizationObjectDateFilter = IVisualizationObjectRelativeDateFilter | IVisualizationObjectAbsoluteDateFilter; | ||
type VisualizationObjectAttributeFilter = IVisualizationObjectPositiveAttributeFilter | IVisualizationObjectNegativeAttributeFilter; | ||
interface IVisualizationObjectPositiveAttributeFilter { | ||
positiveAttributeFilter: { | ||
displayForm: string; | ||
in: string[]; | ||
}; | ||
} | ||
interface IVisualizationObjectNegativeAttributeFilter { | ||
negativeAttributeFilter: { | ||
displayForm: string; | ||
notIn: string[]; | ||
}; | ||
} | ||
interface IVisualizationObjectAbsoluteDateFilter { | ||
absoluteDateFilter: { | ||
from?: string | number; | ||
to?: string | number; | ||
dataSet?: string; | ||
}; | ||
} | ||
interface IVisualizationObjectRelativeDateFilter { | ||
relativeDateFilter: { | ||
from?: number | string; | ||
to?: number | string; | ||
granularity: string; | ||
dataSet?: string; | ||
}; | ||
} | ||
interface IVisualizationObject { | ||
meta: IVisualizationObjectMeta; | ||
content: IVisualizationObjectContent; | ||
} | ||
interface IVisualization { | ||
visualization: IVisualizationObject; | ||
} | ||
interface IVisualizationObjectResponse { | ||
visualization: IVisualizationObject; | ||
} | ||
interface IVisualizationObjectMeta { | ||
author?: string; | ||
category?: string; | ||
contributor?: string; | ||
created?: Date; | ||
deprecated?: boolean; | ||
identifier?: string; | ||
isProduction?: boolean; | ||
locked?: boolean; | ||
projectTemplate?: string; | ||
sharedWithSomeone?: boolean; | ||
summary?: string; | ||
tags?: string; | ||
title: string; | ||
unlisted?: boolean; | ||
updated?: Date; | ||
uri?: string; | ||
} | ||
interface IVisualizationObjectContent { | ||
visualizationClass: string; | ||
buckets: IBucket[]; | ||
filters?: VisualizationObjectFilter[]; | ||
properties?: string; | ||
references?: IReferenceItem[]; | ||
} | ||
interface IReferenceItem { | ||
[identifier: string]: string; | ||
} | ||
interface IBucket { | ||
localIdentifier?: Identifier; | ||
items: BucketItem[]; | ||
totals?: AFM.ITotalItem[]; | ||
} | ||
interface IMeasure { | ||
measure: { | ||
localIdentifier: Identifier; | ||
definition: IMeasureDefinition | IPoPMeasureDefinition; | ||
alias?: string; | ||
title?: string; | ||
format?: string; | ||
}; | ||
} | ||
interface IVisualizationAttribute { | ||
visualizationAttribute: { | ||
localIdentifier: Identifier; | ||
displayForm: string; | ||
alias?: string; | ||
}; | ||
} | ||
interface IMeasureDefinition { | ||
measureDefinition: { | ||
item: string; | ||
aggregation?: MeasureAggregation; | ||
filters?: VisualizationObjectFilter[]; | ||
computeRatio?: boolean; | ||
}; | ||
} | ||
interface IPoPMeasureDefinition { | ||
popMeasureDefinition: { | ||
measureIdentifier: Identifier; | ||
popAttribute: string; | ||
}; | ||
} | ||
function isMeasure(bucketItem: IMeasure | IVisualizationAttribute): bucketItem is IMeasure; | ||
function isVisualizationAttribute(bucketItem: IMeasure | IVisualizationAttribute): bucketItem is IVisualizationAttribute; | ||
function isMeasureDefinition(definition: IMeasureDefinition | IPoPMeasureDefinition): definition is IMeasureDefinition; | ||
function isAttributeFilter(filter: VisualizationObjectFilter): filter is VisualizationObjectAttributeFilter; | ||
function isPositiveAttributeFilter(filter: VisualizationObjectAttributeFilter): filter is IVisualizationObjectPositiveAttributeFilter; | ||
function isAbsoluteDateFilter(filter: VisualizationObjectDateFilter): filter is IVisualizationObjectAbsoluteDateFilter; | ||
function isAttribute(bucketItem: BucketItem): bucketItem is IVisualizationAttribute; | ||
} | ||
export declare namespace Execution { | ||
@@ -204,2 +321,7 @@ interface IMeasureHeaderItem { | ||
type DataValue = null | string | number; | ||
interface Warning { | ||
warningCode: string; | ||
message: string; | ||
parameters?: any[]; | ||
} | ||
interface IExecutionResult { | ||
@@ -215,2 +337,3 @@ executionResult: { | ||
}; | ||
warnings?: Warning[]; | ||
}; | ||
@@ -217,0 +340,0 @@ } |
@@ -31,2 +31,34 @@ "use strict"; | ||
})(AFM = exports.AFM || (exports.AFM = {})); | ||
var VisualizationObject; | ||
(function (VisualizationObject) { | ||
function isMeasure(bucketItem) { | ||
return bucketItem.measure !== undefined; | ||
} | ||
VisualizationObject.isMeasure = isMeasure; | ||
function isVisualizationAttribute(bucketItem) { | ||
return bucketItem.visualizationAttribute !== undefined; | ||
} | ||
VisualizationObject.isVisualizationAttribute = isVisualizationAttribute; | ||
function isMeasureDefinition(definition) { | ||
return definition.measureDefinition !== undefined; | ||
} | ||
VisualizationObject.isMeasureDefinition = isMeasureDefinition; | ||
function isAttributeFilter(filter) { | ||
return filter.positiveAttributeFilter !== undefined || | ||
filter.negativeAttributeFilter !== undefined; | ||
} | ||
VisualizationObject.isAttributeFilter = isAttributeFilter; | ||
function isPositiveAttributeFilter(filter) { | ||
return filter.positiveAttributeFilter !== undefined; | ||
} | ||
VisualizationObject.isPositiveAttributeFilter = isPositiveAttributeFilter; | ||
function isAbsoluteDateFilter(filter) { | ||
return filter.absoluteDateFilter !== undefined; | ||
} | ||
VisualizationObject.isAbsoluteDateFilter = isAbsoluteDateFilter; | ||
function isAttribute(bucketItem) { | ||
return bucketItem.visualizationAttribute !== undefined; | ||
} | ||
VisualizationObject.isAttribute = isAttribute; | ||
})(VisualizationObject = exports.VisualizationObject || (exports.VisualizationObject = {})); | ||
//# sourceMappingURL=index.js.map |
174
index.ts
@@ -35,3 +35,3 @@ // Copyright (C) 2007-2017, GoodData(R) Corporation. All rights reserved. | ||
} | ||
export type MeasureDefinition = ISimpleMeasureDefinition | IPopMeasureDefinition; | ||
@@ -138,2 +138,3 @@ | ||
attributeIdentifier: Identifier; | ||
aggregation?: 'sum'; | ||
}; | ||
@@ -173,3 +174,3 @@ } | ||
} | ||
export function isPopMeasureDefinition( | ||
@@ -194,2 +195,164 @@ definition: AFM.ISimpleMeasureDefinition | AFM.IPopMeasureDefinition | ||
export namespace VisualizationObject { | ||
export type SortDirection = 'asc' | 'desc'; | ||
export type Identifier = string; | ||
export type MeasureAggregation = 'sum' | 'count' | 'avg' | 'min' | 'max' | 'median' | 'runsum'; | ||
export type BucketItem = IMeasure | IVisualizationAttribute; | ||
export type VisualizationObjectFilter = VisualizationObjectDateFilter | VisualizationObjectAttributeFilter; | ||
export type VisualizationObjectDateFilter = | ||
IVisualizationObjectRelativeDateFilter | IVisualizationObjectAbsoluteDateFilter; | ||
export type VisualizationObjectAttributeFilter = | ||
IVisualizationObjectPositiveAttributeFilter | IVisualizationObjectNegativeAttributeFilter; | ||
export interface IVisualizationObjectPositiveAttributeFilter { | ||
positiveAttributeFilter: { | ||
displayForm: string; | ||
in: string[]; | ||
}; | ||
} | ||
export interface IVisualizationObjectNegativeAttributeFilter { | ||
negativeAttributeFilter: { | ||
displayForm: string; | ||
notIn: string[]; | ||
}; | ||
} | ||
export interface IVisualizationObjectAbsoluteDateFilter { | ||
absoluteDateFilter: { | ||
from?: string | number; // TODO polish from/to types | ||
to?: string | number; | ||
dataSet?: string; | ||
}; | ||
} | ||
export interface IVisualizationObjectRelativeDateFilter { | ||
relativeDateFilter: { | ||
from?: number | string; | ||
to?: number | string; | ||
granularity: string; | ||
dataSet?: string; | ||
}; | ||
} | ||
export interface IVisualizationObject { | ||
meta: IVisualizationObjectMeta; | ||
content: IVisualizationObjectContent; | ||
} | ||
export interface IVisualization { | ||
visualization: IVisualizationObject; | ||
} | ||
export interface IVisualizationObjectResponse { | ||
visualization: IVisualizationObject; | ||
} | ||
export interface IVisualizationObjectMeta { | ||
author?: string; | ||
category?: string; | ||
contributor?: string; | ||
created?: Date; | ||
deprecated?: boolean; | ||
identifier?: string; | ||
isProduction?: boolean; | ||
locked?: boolean; | ||
projectTemplate?: string; | ||
sharedWithSomeone?: boolean; | ||
summary?: string; | ||
tags?: string; | ||
title: string; | ||
unlisted?: boolean; | ||
updated?: Date; | ||
uri?: string; | ||
} | ||
export interface IVisualizationObjectContent { | ||
visualizationClass: string; | ||
buckets: IBucket[]; | ||
filters?: VisualizationObjectFilter[]; | ||
properties?: string; | ||
references?: IReferenceItem[]; | ||
} | ||
export interface IReferenceItem { | ||
[identifier: string]: string; | ||
} | ||
export interface IBucket { | ||
localIdentifier?: Identifier; | ||
items: BucketItem[]; | ||
totals?: AFM.ITotalItem[]; | ||
} | ||
export interface IMeasure { | ||
measure: { | ||
localIdentifier: Identifier; | ||
definition: IMeasureDefinition | IPoPMeasureDefinition | ||
alias?: string; | ||
title?: string, | ||
format?: string; | ||
}; | ||
} | ||
export interface IVisualizationAttribute { | ||
visualizationAttribute: { | ||
localIdentifier: Identifier; | ||
displayForm: string, | ||
alias?: string | ||
}; | ||
} | ||
export interface IMeasureDefinition { | ||
measureDefinition: { | ||
item: string; // URISTRING | ||
aggregation?: MeasureAggregation; | ||
filters?: VisualizationObjectFilter[]; | ||
computeRatio?: boolean; | ||
}; | ||
} | ||
export interface IPoPMeasureDefinition { | ||
popMeasureDefinition: { | ||
measureIdentifier: Identifier; | ||
popAttribute: string; | ||
}; | ||
} | ||
export function isMeasure(bucketItem: IMeasure | IVisualizationAttribute): bucketItem is IMeasure { | ||
return (bucketItem as IMeasure).measure !== undefined; | ||
} | ||
export function isVisualizationAttribute(bucketItem: IMeasure | IVisualizationAttribute) | ||
: bucketItem is IVisualizationAttribute { | ||
return (bucketItem as IVisualizationAttribute).visualizationAttribute !== undefined; | ||
} | ||
export function isMeasureDefinition(definition: IMeasureDefinition | IPoPMeasureDefinition) | ||
: definition is IMeasureDefinition { | ||
return (definition as IMeasureDefinition).measureDefinition !== undefined; | ||
} | ||
export function isAttributeFilter(filter: VisualizationObjectFilter): filter is VisualizationObjectAttributeFilter { | ||
return (filter as IVisualizationObjectPositiveAttributeFilter).positiveAttributeFilter !== undefined || | ||
(filter as IVisualizationObjectNegativeAttributeFilter).negativeAttributeFilter !== undefined; | ||
} | ||
export function isPositiveAttributeFilter(filter: VisualizationObjectAttributeFilter): filter is IVisualizationObjectPositiveAttributeFilter { | ||
return (filter as IVisualizationObjectPositiveAttributeFilter).positiveAttributeFilter !== undefined; | ||
} | ||
export function isAbsoluteDateFilter(filter: VisualizationObjectDateFilter): filter is IVisualizationObjectAbsoluteDateFilter { | ||
return (filter as IVisualizationObjectAbsoluteDateFilter).absoluteDateFilter !== undefined; | ||
} | ||
export function isAttribute(bucketItem: BucketItem): bucketItem is IVisualizationAttribute { | ||
return (bucketItem as IVisualizationAttribute).visualizationAttribute !== undefined; | ||
} | ||
} | ||
export namespace Execution { | ||
@@ -274,2 +437,8 @@ export interface IMeasureHeaderItem { | ||
export interface Warning { | ||
warningCode: string; | ||
message: string; | ||
parameters?: any[]; | ||
} | ||
export interface IExecutionResult { | ||
@@ -285,2 +454,3 @@ executionResult: { | ||
}; | ||
warnings?: Warning[]; | ||
} | ||
@@ -287,0 +457,0 @@ } |
{ | ||
"name": "@gooddata/typings", | ||
"version": "0.0.3", | ||
"version": "0.0.4-martin.mosko-visualization-object-2017-12-11T15-59-05-420Z", | ||
"description": "TypeScript definition files for GoodData platform", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
32797
803