@gooddata/typings
Advanced tools
Comparing version 2.24.1-alpha-khanh.le-kl-SD-937-2020-05-04T10-01-24-705Z to 2.24.1-alpha-khanh.le-kl-SD-937-2020-05-06T07-36-22-546Z
@@ -1,2 +0,2 @@ | ||
import { CommandFailed, IObjectMeta, IGdcMessageEvent, IGdcMessageEnvelope, CommandFailedData, GdcProductName } from './common'; | ||
import { CommandFailed, IObjectMeta, IGdcMessageEvent, IGdcMessageEnvelope, CommandFailedData, GdcProductName, IDrillableItemsCommandBody } from './common'; | ||
import { IBaseExportConfig } from '../Export'; | ||
@@ -118,24 +118,2 @@ import { VisualizationObject } from '../VisualizationObject'; | ||
/** | ||
* Base type of drillable items command body | ||
*/ | ||
interface ISimpleDrillableItemsCommandBody { | ||
/** | ||
* The array of uris of attributes or measures | ||
*/ | ||
uris?: string[]; | ||
/** | ||
* The array of identifiers of attributes or measures | ||
*/ | ||
identifiers?: string[]; | ||
} | ||
/** | ||
* The main data type for furture processing of drillable items command | ||
*/ | ||
interface IDrillableItemsCommandBody extends ISimpleDrillableItemsCommandBody { | ||
/** | ||
* Master measures items - In-case, a derived measure is composed from a master measure. | ||
*/ | ||
composedFrom?: ISimpleDrillableItemsCommandBody; | ||
} | ||
/** | ||
* Set drillable items. | ||
@@ -142,0 +120,0 @@ * |
@@ -1,2 +0,2 @@ | ||
import { IGdcMessageEvent, GdcProductName, IGdcMessageEnvelope, CommandFailed, IDrillableItemsCommandBody, IObjectMeta } from './common'; | ||
import { IGdcMessageEvent, GdcProductName, IGdcMessageEnvelope, CommandFailed, IDrillableItemsCommandBody, IObjectMeta, GdcErrorType, CommandFailedData } from './common'; | ||
export declare namespace EmbeddedKpiDashboard { | ||
@@ -40,2 +40,6 @@ /** | ||
/** | ||
* The command add widget to dashboard. | ||
*/ | ||
AddWidget = "addWidget", | ||
/** | ||
* The command set drillable items. | ||
@@ -123,21 +127,2 @@ */ | ||
} | ||
enum GdcKdErrorType { | ||
/** | ||
* The posted command is not recognized by KD. | ||
*/ | ||
InvalidCommand = "kdError:invalidCommand", | ||
/** | ||
* Argument specified in the command body is invalid; it has failed the syntactical or semantic | ||
* validation done by KD. | ||
*/ | ||
InvalidArgument = "kdError:invalidArgument", | ||
/** | ||
* Command was posted when KD is not in a state to process the command. | ||
*/ | ||
InvalidState = "kdError:invalidState", | ||
/** | ||
* The Unexpected Happened. | ||
*/ | ||
RuntimeError = "kdError:runtime" | ||
} | ||
/** | ||
@@ -155,6 +140,17 @@ * List of available commands. This is included in each event sent by KD. | ||
* | ||
* @remarks see {@link GdcKdErrorType} for types of errors that may fly | ||
* @remarks see {@link GdcErrorType} for types of errors that may fly | ||
*/ | ||
type KdCommandFailed = CommandFailed<GdcKdErrorType>; | ||
type KdCommandFailed = CommandFailed<GdcErrorType>; | ||
/** | ||
* Base type for the data of error events sent by AD | ||
* in case command processing comes to an expected or unexpected halt. | ||
*/ | ||
type KdCommandFailedData = CommandFailedData<GdcProductName.KPI_DASHBOARD>; | ||
/** | ||
* Type-guard checking whether an object is an instance of {@link KdCommandFailedData} | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAdCommandFailedData(obj: any): obj is KdCommandFailedData; | ||
/** | ||
* Save command body sent by outer application | ||
@@ -312,3 +308,51 @@ */ | ||
function isAddFilterCommandData(obj: any): obj is AddFilterCommandData; | ||
type KpiWidget = { | ||
type: 'kpi'; | ||
}; | ||
type InsightRef = { | ||
identifier: string; | ||
} | { | ||
uri: string; | ||
}; | ||
type InsightWidget = { | ||
type: 'insight'; | ||
ref: InsightRef; | ||
}; | ||
type AddWidgetBody = { | ||
payload: { | ||
widget: KpiWidget | InsightWidget; | ||
}; | ||
}; | ||
/** | ||
* Adds new widget onto dashboard. New row will be created on top of the dashboard, the widget | ||
* will be placed into its first column. | ||
* | ||
* It is currently possible to add either a KPI or an Insight. When adding either of these, KD will | ||
* scroll to top so that the newly added widget is visible. | ||
* | ||
* For KPI, the KD will start the KPI customization flow right after the KPI is placed. | ||
* Insights are placed without need for further customization | ||
* | ||
* Contract: | ||
* | ||
* - if KD is currently editing a dashboard, then depending on widget type: | ||
* - KPI is added to dashboard, customization flow is started, WidgetAdded will be posted | ||
* - Insight is added to dashboard, WidgetAdded will be posted | ||
* | ||
* - if insight reference included in command payload does not refer to a valid insight, KdCommandFailed | ||
* will be posted | ||
* | ||
* - if KD is in view mode or not showing any dashboard, then KdCommandFailed will be posted | ||
* | ||
* @remarks use {@link AddWidgetCommand} to create instances of AddWidget | ||
*/ | ||
type AddWidgetCommand = IKdMessageEvent<GdcKdCommandType.AddWidget, AddWidgetBody>; | ||
type AddWidgetCommandData = IKdGdcMessageEnvelope<GdcKdCommandType.AddWidget, AddWidgetBody>; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link isAddWidgetCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAddWidgetCommandData(obj: any): obj is AddWidgetCommandData; | ||
/** | ||
* Set drillable items. | ||
@@ -374,16 +418,21 @@ * | ||
*/ | ||
dashboardId?: string; | ||
dashboardId: string; | ||
/** | ||
* Project id | ||
*/ | ||
project?: string; | ||
project: string; | ||
/** | ||
* dashboard identifier | ||
*/ | ||
dashboard?: string; | ||
dashboard: string; | ||
/** | ||
* dashboard title - this is what users see in KD top bar (if visible) | ||
*/ | ||
title: string; | ||
} | ||
type IDashboardBody = IKdAvailableCommands & IDashboardObjectMeta; | ||
/** | ||
* Data type of event that was emit when a dashboard has been created and saved. | ||
*/ | ||
type IDashboardCreatedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardCreated, IDashboardObjectMeta>; | ||
type IDashboardCreatedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardCreated, IDashboardBody>; | ||
/** | ||
@@ -399,3 +448,3 @@ * Type-guard checking whether an object is an instance of {@link isDashboardCreatedData} | ||
*/ | ||
type IDashboardLoadedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardLoaded, IDashboardObjectMeta>; | ||
type IDashboardLoadedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardLoaded, IDashboardBody>; | ||
/** | ||
@@ -410,3 +459,3 @@ * Type-guard checking whether an object is an instance of {@link isDashboardLoadedData} | ||
*/ | ||
type IDashboardUpdatedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardUpdated, IDashboardObjectMeta>; | ||
type IDashboardUpdatedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardUpdated, IDashboardBody>; | ||
/** | ||
@@ -421,3 +470,3 @@ * Type-guard checking whether an object is an instance of {@link isDashboardUpdatedData} | ||
*/ | ||
type IDashboardSavedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardSaved, IDashboardObjectMeta>; | ||
type IDashboardSavedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardSaved, IDashboardBody>; | ||
/** | ||
@@ -432,3 +481,3 @@ * Type-guard checking whether an object is an instance of {@link isDashboardSavedData} | ||
*/ | ||
type IDashboardDeletedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardDeleted, IDashboardObjectMeta>; | ||
type IDashboardDeletedData = IKdGdcMessageEnvelope<GdcKdEventType.DashboardDeleted, IDashboardBody>; | ||
/** | ||
@@ -443,6 +492,3 @@ * Type-guard checking whether an object is an instance of {@link isDashboardDeletedData} | ||
*/ | ||
interface ISwitchedToEditBody { | ||
dashboard: IObjectMeta; | ||
} | ||
type SwitchedToEditData = IKdGdcMessageEnvelope<GdcKdEventType.SwitchedToEdit, ISwitchedToEditBody>; | ||
type SwitchedToEditData = IKdGdcMessageEnvelope<GdcKdEventType.SwitchedToEdit, IDashboardBody>; | ||
/** | ||
@@ -457,6 +503,3 @@ * Type-guard checking whether object is an instance of {@link isSwitchedToEditData}. | ||
*/ | ||
interface ISwitchedToViewBody { | ||
dashboard: IObjectMeta; | ||
} | ||
type SwitchedToViewData = IKdGdcMessageEnvelope<GdcKdEventType.SwitchedToView, ISwitchedToViewBody>; | ||
type SwitchedToViewData = IKdGdcMessageEnvelope<GdcKdEventType.SwitchedToView, IDashboardBody>; | ||
/** | ||
@@ -463,0 +506,0 @@ * Type-guard checking whether object is an instance of {@link isSwitchedToViewData}. |
@@ -37,2 +37,6 @@ "use strict"; | ||
/** | ||
* The command add widget to dashboard. | ||
*/ | ||
GdcKdCommandType["AddWidget"] = "addWidget"; | ||
/** | ||
* The command set drillable items. | ||
@@ -121,23 +125,12 @@ */ | ||
})(GdcKdEventType = EmbeddedKpiDashboard.GdcKdEventType || (EmbeddedKpiDashboard.GdcKdEventType = {})); | ||
var GdcKdErrorType; | ||
(function (GdcKdErrorType) { | ||
/** | ||
* The posted command is not recognized by KD. | ||
*/ | ||
GdcKdErrorType["InvalidCommand"] = "kdError:invalidCommand"; | ||
/** | ||
* Argument specified in the command body is invalid; it has failed the syntactical or semantic | ||
* validation done by KD. | ||
*/ | ||
GdcKdErrorType["InvalidArgument"] = "kdError:invalidArgument"; | ||
/** | ||
* Command was posted when KD is not in a state to process the command. | ||
*/ | ||
GdcKdErrorType["InvalidState"] = "kdError:invalidState"; | ||
/** | ||
* The Unexpected Happened. | ||
*/ | ||
GdcKdErrorType["RuntimeError"] = "kdError:runtime"; | ||
})(GdcKdErrorType = EmbeddedKpiDashboard.GdcKdErrorType || (EmbeddedKpiDashboard.GdcKdErrorType = {})); | ||
/** | ||
* Type-guard checking whether an object is an instance of {@link KdCommandFailedData} | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAdCommandFailedData(obj) { | ||
return common_1.isCommandFailedData(obj); | ||
} | ||
EmbeddedKpiDashboard.isAdCommandFailedData = isAdCommandFailedData; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link SaveDashboardCommandData}. | ||
@@ -197,2 +190,11 @@ * | ||
/** | ||
* Type-guard checking whether object is an instance of {@link isAddWidgetCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAddWidgetCommandData(obj) { | ||
return common_1.getEventType(obj) === GdcKdCommandType.AddWidget; | ||
} | ||
EmbeddedKpiDashboard.isAddWidgetCommandData = isAddWidgetCommandData; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link DrillableItemsCommandData}. | ||
@@ -199,0 +201,0 @@ * |
{ | ||
"name": "@gooddata/typings", | ||
"version": "2.24.1-alpha-khanh.le-kl-SD-937-2020-05-04T10-01-24-705Z", | ||
"version": "2.24.1-alpha-khanh.le-kl-SD-937-2020-05-06T07-36-22-546Z", | ||
"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
Sorry, the diff of this file is not supported yet
344298
5910