Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gooddata/typings

Package Overview
Dependencies
Maintainers
43
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gooddata/typings - npm Package Compare versions

Comparing version 2.23.0-lanhuynh-lhq-sd-884-post-event-typings-2020-04-06T08-55-20-053Z to 2.23.0-lanhuynh-lhq-sd-884-post-event-typings-2020-04-10T02-05-34-382Z

dist/src/Export.d.ts

373

dist/src/embedding/ad.d.ts

@@ -1,30 +0,94 @@

import { CommandFailed, IObjectMeta, IGdcMessageEvent, IGdcMessageEventDataWrapper, CommandFailedData, GdcProductName } from './common';
import { CommandFailed, IObjectMeta, IGdcMessageEvent, IGdcMessageEnvelope, CommandFailedData, GdcProductName } from './common';
import { IBaseExportConfig } from '../Export';
import { VisualizationObject } from '../VisualizationObject';
export interface IBaseExportConfig {
title?: string;
format?: 'xlsx' | 'csv' | 'raw';
mergeHeaders?: boolean;
}
export interface IExportConfig extends IBaseExportConfig {
showFilters?: boolean;
}
/**
* All interface, types, type-guard related to embedded analyticalDesigner
*/
export declare namespace EmbeddedAnalyticalDesigner {
/**
* Insight Export configuration
*
* Note: AFM is ommitted on purpose; it should be added by AD itself; create new type using Omit<>
*/
interface IInsightExportConfig extends IBaseExportConfig {
/**
* Include applied filters
*/
showFilters?: boolean;
}
/**
* Base type for AD events
*/
type IADMessageEvent<T, TBody> = IGdcMessageEvent<GdcProductName.ANALYTICAL_DESIGNER, T, TBody>;
type IAdGdcMessageEventDataWrapper<T, TBody> = IGdcMessageEventDataWrapper<GdcProductName.ANALYTICAL_DESIGNER, T, TBody>;
/**
* Base type for AD event data
*/
type IAdGdcMessageEnvelope<T, TBody> = IGdcMessageEnvelope<GdcProductName.ANALYTICAL_DESIGNER, T, TBody>;
/**
* All AD command Types
*/
enum GdcAdCommandType {
/**
* The command set drillable items
*/
DrillableItems = "drillableItems",
/**
* The command open an insight
*/
OpenInsight = "openInsight",
/**
* The command save an insight
*/
Save = "saveInsight",
/**
* The command save the insight as a new one
*/
SaveAs = "saveAsInsight",
/**
* The command export an insight
*/
Export = "exportInsight",
/**
* The command undo to previous state
*/
Undo = "undo",
/**
* The command redo to next state
*/
Redo = "redo"
}
/**
* All event types on AD
*/
enum GdcAdEventType {
/**
* Type represent that Insight is saved
*/
ListeningForDrillableItems = "listeningForDrillableItems",
/**
* Type represent that a new insight is initialized
*/
NewInsightInitialized = "newInsightInitialized",
/**
* Type represent that the insight is opened
*/
InsightOpened = "insightOpened",
/**
* Type represent that the insight is saved
*
* Note: use `visualizationSaved` because of backward compatibility
* @see visualizationSaved event on https://help.gooddata.com
*/
InsightSaved = "visualizationSaved",
/**
* Type represent that the undo action is finished
*/
UndoFinished = "undoFinished",
/**
* Type represent that the redo action is finished
*/
RedoFinished = "redoFinished",
/**
* Type represent that the export action is finished
*/
ExportFinished = "exportInsightFinished"

@@ -38,37 +102,126 @@ }

type AdCommandFailed = CommandFailed<GdcProductName.ANALYTICAL_DESIGNER>;
/**
* Base type for the data of error events sent by AD
* in case command processing comes to an expected or unexpected halt.
*/
type AdCommandFailedData = CommandFailedData<GdcProductName.ANALYTICAL_DESIGNER>;
/**
* Type-guard checking whether an object is an instance of {@link AdCommandFailedData}
*
* @param obj - object to test
*/
function isAdCommandFailedData(obj: any): obj is AdCommandFailedData;
/**
* 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.
*
* Contract:
*
* - Drillable items can be set by uris or identifiers of insight's measures/attributes
*/
type DrillableItemsCommand = IADMessageEvent<GdcAdCommandType.DrillableItems, IDrillableItemsCommandBody>;
type DrillableItemsCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.DrillableItems, IDrillableItemsCommandBody>;
/**
* Type-guard checking whether object is an instance of DrillableItemsCommandData.
* Data type of drillable items command
*
* Note: The main event data was wrapped to application and product data structure
* @see IDrillableItemsCommandBody
*/
type DrillableItemsCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.DrillableItems, IDrillableItemsCommandBody>;
/**
* Type-guard checking whether an object is an instance of {@link DrillableItemsCommandData}
*
* @param obj - object to test
*/
function isDrillableItemsCommandData(obj: any): obj is DrillableItemsCommandData;
/**
* Contain the information to contruct the AD url to open an insight editor
*/
interface IOpenInsightCommandBody {
dataset?: string | null;
projectId?: string | null;
clientId?: string | null;
productId?: string | null;
reportId?: string | null;
includeObjectsWithTags?: string | null;
excludeObjectsWithTags?: string | null;
/**
* Dataset identifier - A dataset consists of attributes and facts,
* which correspond to data you want to measure and the data
* that you want to use to segment or filter those measurements.
*/
dataset?: string;
/**
* Project id
*/
projectId?: string;
/**
* Client id - Each client has an identifier unique within the domain
*
* Note: use the combination of the data product ID and client ID instead of the project ID
*/
clientId?: string;
/**
* Product id - A data product contains multiple segments. And a segment has clients assigned to it
*
* Note: use the combination of the data product ID and client ID instead of the project ID
*/
productId?: string;
/**
* Insight id - leave it empty to reset the insight editor to empty state
*/
insightId?: string;
/**
* Show only the attributes, measures, facts, and dates with the specified tag
*/
includeObjectsWithTags?: string;
/**
* Hide the attributes, measures, facts, and dates with the specified tag
*/
excludeObjectsWithTags?: string;
}
/**
* Open an insight.
*
* Contract:
*
* - if the insight could not found, then CommandFailed event will be posted
* - after the insight is opened, then InsightOpened event will be posted
*
* Note: if insightId isn't provided, the empty insight editor will be opened
*/
type OpenInsightCommand = IADMessageEvent<GdcAdCommandType.OpenInsight, IOpenInsightCommandBody>;
type OpenInsightCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.OpenInsight, IOpenInsightCommandBody>;
/**
* Type-guard checking whether object is an instance of OpenInsightCommandData.
* Data type of open insight command
*
* Note: The main event data was wrapped to application and product data structure
* @see IOpenInsightCommandBody
*/
type OpenInsightCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.OpenInsight, IOpenInsightCommandBody>;
/**
* Type-guard checking whether an object is an instance of {@link OpenInsightCommandData}
*
* @param obj - object to test
*/
function isOpenInsightCommandData(obj: any): obj is OpenInsightCommandData;
/**
* Save command body sent by outer application
*/
interface ISaveCommandBody {
/**
* Insight title - use as title of new insight or rename of saved insight
*/
title: string;

@@ -90,13 +243,25 @@ }

*
* Note: sending SaveCommand with different title means insight will be saved with that new title.
* Note: sending SaveInsightCommand with different title means insight will be saved with that new title.
*/
type SaveInsightCommand = IADMessageEvent<GdcAdCommandType.Save, ISaveCommandBody>;
type SaveInsightCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.Save, ISaveCommandBody>;
/**
* Type-guard checking whether object is an instance of SaveInsightCommandData.
* Data type of save insight command
*
* Note: The main event data was wrapped to application and product data structure
* @see ISaveCommandBody
*/
type SaveInsightCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.Save, ISaveCommandBody>;
/**
* Type-guard checking whether an object is an instance of {@link SaveInsightCommandData}
*
* @param obj - object to test
*/
function isSaveInsightCommandData(obj: any): obj is SaveInsightCommandData;
/**
* Save As command body sent by outer application
*/
interface ISaveAsInsightCommandBody {
/**
* Insight title - use as title of new insight
*/
readonly title: string;

@@ -110,11 +275,25 @@ }

type SaveAsInsightCommand = IADMessageEvent<GdcAdCommandType.SaveAs, ISaveAsInsightCommandBody>;
type SaveAsInsightCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.SaveAs, ISaveAsInsightCommandBody>;
/**
* Type-guard checking whether object is an instance of SaveAsCommand.
* Data type of save as insight command
*
* Note: The main event data was wrapped to application and product data structure
* @see ISaveAsInsightCommandBody
*/
type SaveAsInsightCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.SaveAs, ISaveAsInsightCommandBody>;
/**
* Type-guard checking whether an object is an instance of {@link SaveAsInsightCommandData}
*
* @param obj - object to test
*/
function isSaveAsInsightCommandData(obj: any): obj is SaveAsInsightCommandData;
/**
* Export command body sent by outer application
*/
interface IExportInsightCommandBody {
readonly config: IExportConfig;
/**
* Configuration for exported file.
*
* @see IInsightExportConfig for more details about possible configuration options
*/
readonly config: IInsightExportConfig;
}

@@ -136,6 +315,12 @@ /**

type ExportInsightCommand = IADMessageEvent<GdcAdCommandType.Export, IExportInsightCommandBody>;
type ExportInsightCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.Export, IExportInsightCommandBody>;
/**
* Type-guard checking whether object is an instance of ExportCommand.
* Data type of export insight command
*
* Note: The main event data was wrapped to application and product data structure
* @see IExportInsightCommandBody
*/
type ExportInsightCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.Export, IExportInsightCommandBody>;
/**
* Type-guard checking whether an object is an instance of {@link ExportInsightCommandData}
*
* @param obj - object to test

@@ -155,3 +340,13 @@ */

type UndoCommand = IADMessageEvent<GdcAdCommandType.Undo, undefined>;
type UndoCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.Undo, undefined>;
/**
* Data type of undo command
*
* Note: it has empty content and just wrapped to application and product data structure
*/
type UndoCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.Undo, undefined>;
/**
* Type-guard checking whether an object is an instance of {@link UndoCommandData}
*
* @param obj - object to test
*/
function isUndoCommandData(obj: any): obj is UndoCommandData;

@@ -169,3 +364,13 @@ /**

type RedoCommand = IADMessageEvent<GdcAdCommandType.Redo, undefined>;
type RedoCommandData = IAdGdcMessageEventDataWrapper<GdcAdCommandType.Redo, undefined>;
/**
* Data type of redo command
*
* Note: it has empty content and just wrapped to application and product data structure
*/
type RedoCommandData = IAdGdcMessageEnvelope<GdcAdCommandType.Redo, undefined>;
/**
* Type-guard checking whether an object is an instance of {@link RedoCommandData}
*
* @param obj - object to test
*/
function isRedoCommandData(obj: any): obj is RedoCommandData;

@@ -176,4 +381,10 @@ /**

interface IAvailableCommands {
/**
* Array of avaiable commands types
*/
availableCommands: GdcAdCommandType[];
}
/**
* It's main content is empty.
*/
type NewInsightInitializedBody = IAvailableCommands;

@@ -184,5 +395,21 @@ /**

type NewInsightInitialized = IADMessageEvent<GdcAdEventType.NewInsightInitialized, NewInsightInitializedBody>;
type NewInsightInitializedData = IAdGdcMessageEventDataWrapper<GdcAdEventType.NewInsightInitialized, undefined>;
/**
* Data type of event that was emit when the new insight initialized
*
* Note: it has empty content and just wrapped to application and product data structure
*/
type NewInsightInitializedData = IAdGdcMessageEnvelope<GdcAdEventType.NewInsightInitialized, undefined>;
/**
* Type-guard checking whether an object is an instance of {@link NewInsightInitializedData}
*
* @param obj - object to test
*/
function isNewInsightInitializedData(obj: any): obj is NewInsightInitializedData;
/**
* Main data of InsightOpened event
*/
type InsightOpenedBody = IAvailableCommands & {
/**
* The minimal opened insight information
*/
insight: IObjectMeta;

@@ -195,5 +422,24 @@ };

type InsightOpened = IADMessageEvent<GdcAdEventType.InsightOpened, InsightOpenedBody>;
type InsightOpenedData = IAdGdcMessageEventDataWrapper<GdcAdEventType.InsightOpened, InsightOpenedBody>;
/**
* Data type of event that was emit when an insight is opened
*
* Note: The main event data was wrapped to application and product data structure
* @see InsightOpenedBody
*/
type InsightOpenedData = IAdGdcMessageEnvelope<GdcAdEventType.InsightOpened, InsightOpenedBody>;
/**
* Type-guard checking whether an object is an instance of {@link InsightOpenedData}
*
* @param obj - object to test
*/
function isInsightOpenedData(obj: any): obj is InsightOpenedData;
/**
* Main data of InsightSaved event
*
* Note: `visualizationObject` is keeped because of backward compatibility
*/
type InsightSavedBody = IAvailableCommands & VisualizationObject.IVisualization & {
/**
* The minimal saved insight information
*/
insight: IObjectMeta;

@@ -205,4 +451,18 @@ };

type InsightSaved = IADMessageEvent<GdcAdEventType.InsightSaved, InsightSavedBody>;
type InsightSavedData = IAdGdcMessageEventDataWrapper<GdcAdEventType.InsightSaved, InsightSavedBody>;
/**
* Data type of event that was emit when an insight is saved
*
* Note: The main event data was wrapped to application and product data structure
* @see InsightSavedBody
*/
type InsightSavedData = IAdGdcMessageEnvelope<GdcAdEventType.InsightSaved, InsightSavedBody>;
/**
* Type-guard checking whether an object is an instance of {@link InsightSavedData}
*
* @param obj - object to test
*/
function isInsightSavedData(obj: any): obj is InsightSavedData;
/**
* Main data of ExportFinished event
*/
type ExportFinishedBody = IAvailableCommands & {

@@ -218,4 +478,18 @@ /**

type ExportFinished = IADMessageEvent<GdcAdEventType.ExportFinished, ExportFinishedBody>;
type ExportFinishedData = IAdGdcMessageEventDataWrapper<GdcAdEventType.ExportFinished, ExportFinishedBody>;
/**
* Data type of event that was emit after an insight was exported
*
* Note: The main event data was wrapped to application and product data structure
* @see ExportFinishedBody
*/
type ExportFinishedData = IAdGdcMessageEnvelope<GdcAdEventType.ExportFinished, ExportFinishedBody>;
/**
* Type-guard checking whether an object is an instance of {@link ExportFinishedData}
*
* @param obj - object to test
*/
function isExportFinishedData(obj: any): obj is ExportFinishedData;
/**
* It's main content is empty.
*/
type UndoFinishedBody = IAvailableCommands;

@@ -226,4 +500,18 @@ /**

type UndoFinished = IADMessageEvent<GdcAdEventType.UndoFinished, UndoFinishedBody>;
type UndoFinishedData = IAdGdcMessageEventDataWrapper<GdcAdEventType.UndoFinished, UndoFinishedBody>;
/**
* Data type of event that was emit after finish undo action
*
* Note: The main event data was wrapped to application and product data structure
* @see UndoFinishedBody
*/
type UndoFinishedData = IAdGdcMessageEnvelope<GdcAdEventType.UndoFinished, UndoFinishedBody>;
/**
* Type-guard checking whether an object is an instance of {@link UndoFinishedData}
*
* @param obj - object to test
*/
function isUndoFinishedData(obj: any): obj is UndoFinishedData;
/**
* It's main content is empty.
*/
type RedoFinishedBody = IAvailableCommands;

@@ -234,4 +522,15 @@ /**

type RedoFinished = IADMessageEvent<GdcAdEventType.RedoFinished, RedoFinishedBody>;
type RedoFinishedData = IAdGdcMessageEventDataWrapper<GdcAdEventType.RedoFinished, RedoFinishedBody>;
/**
* Data type of event that was emit after finish redo action
*
* Note: The main event data was wrapped to application and product data structure
* @see RedoFinishedBody
*/
type RedoFinishedData = IAdGdcMessageEnvelope<GdcAdEventType.RedoFinished, RedoFinishedBody>;
/**
* Type-guard checking whether an object is an instance of {@link RedoFinishedData}
*
* @param obj - object to test
*/
function isRedoFinishedData(obj: any): obj is RedoFinishedData;
}
"use strict";
exports.__esModule = true;
// (C) 2020 GoodData Corporation
var lodash_1 = require("lodash");
var common_1 = require("./common");
/**
* All interface, types, type-guard related to embedded analyticalDesigner
*/
var EmbeddedAnalyticalDesigner;
(function (EmbeddedAnalyticalDesigner) {
/**
* All AD command Types
*/
var GdcAdCommandType;
(function (GdcAdCommandType) {
/**
* The command set drillable items
*/
GdcAdCommandType["DrillableItems"] = "drillableItems";
/**
* The command open an insight
*/
GdcAdCommandType["OpenInsight"] = "openInsight";
/**
* The command save an insight
*/
GdcAdCommandType["Save"] = "saveInsight";
/**
* The command save the insight as a new one
*/
GdcAdCommandType["SaveAs"] = "saveAsInsight";
/**
* The command export an insight
*/
GdcAdCommandType["Export"] = "exportInsight";
/**
* The command undo to previous state
*/
GdcAdCommandType["Undo"] = "undo";
/**
* The command redo to next state
*/
GdcAdCommandType["Redo"] = "redo";
})(GdcAdCommandType = EmbeddedAnalyticalDesigner.GdcAdCommandType || (EmbeddedAnalyticalDesigner.GdcAdCommandType = {}));
/**
* All event types on AD
*/
var GdcAdEventType;
(function (GdcAdEventType) {
/**
* Type represent that Insight is saved
*/
GdcAdEventType["ListeningForDrillableItems"] = "listeningForDrillableItems";
/**
* Type represent that a new insight is initialized
*/
GdcAdEventType["NewInsightInitialized"] = "newInsightInitialized";
/**
* Type represent that the insight is opened
*/
GdcAdEventType["InsightOpened"] = "insightOpened";
// use `visualizationSaved` because of backward compatibility
/**
* Type represent that the insight is saved
*
* Note: use `visualizationSaved` because of backward compatibility
* @see visualizationSaved event on https://help.gooddata.com
*/
GdcAdEventType["InsightSaved"] = "visualizationSaved";
/**
* Type represent that the undo action is finished
*/
GdcAdEventType["UndoFinished"] = "undoFinished";
/**
* Type represent that the redo action is finished
*/
GdcAdEventType["RedoFinished"] = "redoFinished";
/**
* Type represent that the export action is finished
*/
GdcAdEventType["ExportFinished"] = "exportInsightFinished";
})(GdcAdEventType = EmbeddedAnalyticalDesigner.GdcAdEventType || (EmbeddedAnalyticalDesigner.GdcAdEventType = {}));
/**
* Type-guard checking whether an object is an instance of {@link AdCommandFailedData}
*
* @param obj - object to test
*/
function isAdCommandFailedData(obj) {

@@ -34,3 +91,3 @@ return common_1.isCommandFailedData(obj);

/**
* Type-guard checking whether object is an instance of DrillableItemsCommandData.
* Type-guard checking whether an object is an instance of {@link DrillableItemsCommandData}
*

@@ -40,7 +97,7 @@ * @param obj - object to test

function isDrillableItemsCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.DrillableItems;
return common_1.getEventType(obj) === GdcAdCommandType.DrillableItems;
}
EmbeddedAnalyticalDesigner.isDrillableItemsCommandData = isDrillableItemsCommandData;
/**
* Type-guard checking whether object is an instance of OpenInsightCommandData.
* Type-guard checking whether an object is an instance of {@link OpenInsightCommandData}
*

@@ -50,7 +107,7 @@ * @param obj - object to test

function isOpenInsightCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.OpenInsight;
return common_1.getEventType(obj) === GdcAdCommandType.OpenInsight;
}
EmbeddedAnalyticalDesigner.isOpenInsightCommandData = isOpenInsightCommandData;
/**
* Type-guard checking whether object is an instance of SaveInsightCommandData.
* Type-guard checking whether an object is an instance of {@link SaveInsightCommandData}
*

@@ -60,7 +117,7 @@ * @param obj - object to test

function isSaveInsightCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.Save;
return common_1.getEventType(obj) === GdcAdCommandType.Save;
}
EmbeddedAnalyticalDesigner.isSaveInsightCommandData = isSaveInsightCommandData;
/**
* Type-guard checking whether object is an instance of SaveAsCommand.
* Type-guard checking whether an object is an instance of {@link SaveAsInsightCommandData}
*

@@ -70,7 +127,7 @@ * @param obj - object to test

function isSaveAsInsightCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.SaveAs;
return common_1.getEventType(obj) === GdcAdCommandType.SaveAs;
}
EmbeddedAnalyticalDesigner.isSaveAsInsightCommandData = isSaveAsInsightCommandData;
/**
* Type-guard checking whether object is an instance of ExportCommand.
* Type-guard checking whether an object is an instance of {@link ExportInsightCommandData}
*

@@ -80,35 +137,75 @@ * @param obj - object to test

function isExportInsightCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.Export;
return common_1.getEventType(obj) === GdcAdCommandType.Export;
}
EmbeddedAnalyticalDesigner.isExportInsightCommandData = isExportInsightCommandData;
/**
* Type-guard checking whether an object is an instance of {@link UndoCommandData}
*
* @param obj - object to test
*/
function isUndoCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.Undo;
return common_1.getEventType(obj) === GdcAdCommandType.Undo;
}
EmbeddedAnalyticalDesigner.isUndoCommandData = isUndoCommandData;
/**
* Type-guard checking whether an object is an instance of {@link RedoCommandData}
*
* @param obj - object to test
*/
function isRedoCommandData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdCommandType.Redo;
return common_1.getEventType(obj) === GdcAdCommandType.Redo;
}
EmbeddedAnalyticalDesigner.isRedoCommandData = isRedoCommandData;
/**
* Type-guard checking whether an object is an instance of {@link NewInsightInitializedData}
*
* @param obj - object to test
*/
function isNewInsightInitializedData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdEventType.NewInsightInitialized;
return common_1.getEventType(obj) === GdcAdEventType.NewInsightInitialized;
}
EmbeddedAnalyticalDesigner.isNewInsightInitializedData = isNewInsightInitializedData;
/**
* Type-guard checking whether an object is an instance of {@link InsightOpenedData}
*
* @param obj - object to test
*/
function isInsightOpenedData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdEventType.InsightOpened;
return common_1.getEventType(obj) === GdcAdEventType.InsightOpened;
}
EmbeddedAnalyticalDesigner.isInsightOpenedData = isInsightOpenedData;
/**
* Type-guard checking whether an object is an instance of {@link InsightSavedData}
*
* @param obj - object to test
*/
function isInsightSavedData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdEventType.InsightSaved;
return common_1.getEventType(obj) === GdcAdEventType.InsightSaved;
}
EmbeddedAnalyticalDesigner.isInsightSavedData = isInsightSavedData;
/**
* Type-guard checking whether an object is an instance of {@link ExportFinishedData}
*
* @param obj - object to test
*/
function isExportFinishedData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdEventType.ExportFinished;
return common_1.getEventType(obj) === GdcAdEventType.ExportFinished;
}
EmbeddedAnalyticalDesigner.isExportFinishedData = isExportFinishedData;
/**
* Type-guard checking whether an object is an instance of {@link UndoFinishedData}
*
* @param obj - object to test
*/
function isUndoFinishedData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdEventType.UndoFinished;
return common_1.getEventType(obj) === GdcAdEventType.UndoFinished;
}
EmbeddedAnalyticalDesigner.isUndoFinishedData = isUndoFinishedData;
/**
* Type-guard checking whether an object is an instance of {@link RedoFinishedData}
*
* @param obj - object to test
*/
function isRedoFinishedData(obj) {
return lodash_1.get(obj, 'gdc.event.name') === GdcAdEventType.RedoFinished;
return common_1.getEventType(obj) === GdcAdEventType.RedoFinished;
}

@@ -115,0 +212,0 @@ EmbeddedAnalyticalDesigner.isRedoFinishedData = isRedoFinishedData;

@@ -0,9 +1,27 @@

/**
* List of products using post events
*/
export declare enum GdcProductName {
/**
* AD product name
*/
ANALYTICAL_DESIGNER = "analyticalDesigner",
/**
* KD product name
*/
KPI_DASHBOARDS = "dashboards"
}
/**
* Common event types in application
*/
export declare enum GdcEventType {
/**
* Event to notify outer application that the command is invalid or have errors while processing
*/
AppCommandFailed = "appCommandFailed"
}
export interface IGdcMessageEventData<Product, T, TBody> {
/**
* Base type for event content
*/
export interface IGdcMessage<Product, T, TBody> {
readonly product: Product;

@@ -16,11 +34,33 @@ readonly event: {

}
export interface IGdcMessageEventDataWrapper<Product, T, TBody> {
readonly gdc: IGdcMessageEventData<Product, T, TBody>;
/**
* Base type for gdc event data
*/
export interface IGdcMessageEnvelope<Product, T, TBody> {
readonly gdc: IGdcMessage<Product, T, TBody>;
}
/**
* Base type for events
*/
export interface IGdcMessageEvent<Product, T, TBody> extends MessageEvent {
readonly data: IGdcMessageEventDataWrapper<Product, T, TBody>;
readonly data: IGdcMessageEnvelope<Product, T, TBody>;
}
/**
* Type for event listener
*
* Note: using by @gooddata/js-utils
*/
export declare type GdcMessageEventListener = (event: IGdcMessageEvent<string, string, any>) => boolean;
/**
* Config type use to setup the message event listeners
*
* Note: using by @gooddata/js-utils
*/
export interface IGdcMessageEventListenerConfig {
/**
* The product name where the postmessages are sent/received
*/
product: string;
/**
* The list of events is allowed for processing
*/
validReceivedPostEvents: string[];

@@ -30,12 +70,12 @@ }

/**
* The posted command is not recognized by AD.
* The posted command is not recognized.
*/
InvalidCommand = "error:invalidCommand",
/**
* Argument specified in the command body is invalid; it has failed the syntactical or semantic
* validation done by AD.
* Argument specified in the command body is invalid; it has failed the syntactical
* or semantic validation.
*/
InvalidArgument = "error:invalidArgument",
/**
* Command was posted when AD is not in a state to process the command. For instance:
* Command was posted when the app is not in a state to process the command. For instance:
*

@@ -60,4 +100,4 @@ * - trying to do save/save-as on new, empty insight

/**
* Error message includes descriptive information about the error. E.g.
* "Insight title must not contain newline character"
* Error message includes descriptive information about the error.
* E.g. "Insight title must not contain newline character"
*/

@@ -67,9 +107,13 @@ errorMessage: string;

/**
* Base type for error events sent by application in case command processing comes to an expected or
* unexpected halt.
* Base type for error events sent by application in case command processing comes to an expected
* or unexpected halt.
*/
export declare type CommandFailed<Product> = IGdcMessageEvent<Product, GdcEventType.AppCommandFailed, ICommandFailedBody>;
export declare type CommandFailedData<Product> = IGdcMessageEventDataWrapper<Product, GdcEventType.AppCommandFailed, ICommandFailedBody>;
/**
* Type-guard checking whether an object is an instance of {@link CommandFailed}
* Base type for the data of error events sent by application
* in case command processing comes to an expected or unexpected halt.
*/
export declare type CommandFailedData<Product> = IGdcMessageEnvelope<Product, GdcEventType.AppCommandFailed, ICommandFailedBody>;
/**
* Type-guard checking whether an object is an instance of {@link CommandFailedData}
*

@@ -96,5 +140,10 @@ * @param obj - object to test

/**
* Insight title - this is what users see in AD top bar (if visible) or
* Insight title - this is what users see in AD top bar (if visible)
*/
title: string;
}
/**
* Get event type of event from event data
* @param obj the event data object
*/
export declare function getEventType(obj: any): string;
"use strict";
// (C) 2020 GoodData Corporation
exports.__esModule = true;
var isEmpty = require("lodash/isEmpty");
/**
* List of products using post events
*/
var GdcProductName;
(function (GdcProductName) {
/**
* AD product name
*/
GdcProductName["ANALYTICAL_DESIGNER"] = "analyticalDesigner";
/**
* KD product name
*/
GdcProductName["KPI_DASHBOARDS"] = "dashboards";
})(GdcProductName = exports.GdcProductName || (exports.GdcProductName = {}));
/**
* Common event types in application
*/
var GdcEventType;
(function (GdcEventType) {
/**
* Event to notify outer application that the command is invalid or have errors while processing
*/
GdcEventType["AppCommandFailed"] = "appCommandFailed";

@@ -17,12 +31,12 @@ })(GdcEventType = exports.GdcEventType || (exports.GdcEventType = {}));

/**
* The posted command is not recognized by AD.
* The posted command is not recognized.
*/
GdcErrorType["InvalidCommand"] = "error:invalidCommand";
/**
* Argument specified in the command body is invalid; it has failed the syntactical or semantic
* validation done by AD.
* Argument specified in the command body is invalid; it has failed the syntactical
* or semantic validation.
*/
GdcErrorType["InvalidArgument"] = "error:invalidArgument";
/**
* Command was posted when AD is not in a state to process the command. For instance:
* Command was posted when the app is not in a state to process the command. For instance:
*

@@ -41,3 +55,3 @@ * - trying to do save/save-as on new, empty insight

/**
* Type-guard checking whether an object is an instance of {@link CommandFailed}
* Type-guard checking whether an object is an instance of {@link CommandFailedData}
*

@@ -47,5 +61,14 @@ * @param obj - object to test

function isCommandFailedData(obj) {
return !isEmpty(obj) && obj.gdc.event.name === GdcEventType.AppCommandFailed;
return getEventType(obj) === GdcEventType.AppCommandFailed;
}
exports.isCommandFailedData = isCommandFailedData;
/**
* Get event type of event from event data
* @param obj the event data object
*/
function getEventType(obj) {
var _a = (obj || {}).gdc, _b = (_a === void 0 ? {} : _a).event, _c = (_b === void 0 ? {} : _b).name, name = _c === void 0 ? '' : _c;
return name;
}
exports.getEventType = getEventType;
//# sourceMappingURL=common.js.map

2

package.json
{
"name": "@gooddata/typings",
"version": "2.23.0-lanhuynh-lhq-sd-884-post-event-typings-2020-04-06T08-55-20-053Z",
"version": "2.23.0-lanhuynh-lhq-sd-884-post-event-typings-2020-04-10T02-05-34-382Z",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc