New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gooddata/sdk-backend-spi

Package Overview
Dependencies
Maintainers
49
Versions
2606
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gooddata/sdk-backend-spi - npm Package Compare versions

Comparing version 8.0.0-alpha.73 to 8.0.0-alpha.74

dist/workspace/dashboards/common.d.ts

11

dist/index.d.ts

@@ -21,8 +21,11 @@ export { IAnalyticalBackend, BackendCapabilities, AnalyticalBackendConfig, AnalyticalBackendFactory, prepareExecution, } from "./backend";

export { IWorkspaceDashboards } from "./workspace/dashboards";
export { IDashboard, IDashboardDefinition, IDateFilterConfig, IListedDashboard, } from "./workspace/dashboards/dashboard";
export { IFilterContext, AbsoluteType, DateFilterType, FilterContextItem, IDashboardAttributeFilter, IDashboardDateFilter, IFilterContextDefinition, RelativeType, ITempFilterContext, ITempFilterContextDefinition, isFilterContext, isTempFilterContext, isDashboardAttributeFilter, isDashboardDateFilter, IDashboardFilterReference, IDashboardAttributeFilterReference, IDashboardDateFilterReference, isDashboardAttributeFilterReference, isDashboardDateFilterReference, } from "./workspace/dashboards/filterContext";
export { Layout, LayoutContent, ILayoutWidget, IFluidLayout, IFluidLayoutColSize, IFluidLayoutColumn, IFluidLayoutRow, IFluidLayoutSize, ISectionDescription, ISectionHeader, SectionHeader, Widget, isLayoutWidget, isFluidLayout, layoutWidgets, } from "./workspace/dashboards/layout";
export { IWidget, IWidgetDefinition, WidgetType, isWidget } from "./workspace/dashboards/widget";
export { IDashboardObjectIdentity } from "./workspace/dashboards/common";
export { DrillDefinition, DrillOrigin, DrillOriginType, DrillTransition, DrillType, IDrill, IDrillFromMeasure, IDrillOrigin, IDrillToDashboard, IDrillToInsight, IDrillToLegacyDashboard, isDrillToDashboard, isDrillToInsight, isDrillToLegacyDashboard, } from "./workspace/dashboards/drills";
export { IDashboard, IDashboardDefinition, IDateFilterConfig, IListedDashboard, IDashboardBase, } from "./workspace/dashboards/dashboard";
export { IFilterContext, AbsoluteType, DateFilterType, FilterContextItem, IDashboardAttributeFilter, IDashboardDateFilter, IFilterContextDefinition, RelativeType, ITempFilterContext, isFilterContext, isFilterContextDefinition, isTempFilterContext, isDashboardAttributeFilter, isDashboardDateFilter, IDashboardFilterReference, IDashboardAttributeFilterReference, IDashboardDateFilterReference, isDashboardAttributeFilterReference, isDashboardDateFilterReference, } from "./workspace/dashboards/filterContext";
export { Layout, LayoutContent, ILayoutWidget, IFluidLayout, IFluidLayoutColSize, IFluidLayoutColumn, IFluidLayoutRow, IFluidLayoutSize, ISectionDescription, ISectionHeader, SectionHeader, Widget, isLayoutWidget, isFluidLayout, layoutWidgets, isFluidLayoutDefinition, IFluidLayoutColumnDefinition, IFluidLayoutDefinition, IFluidLayoutRowDefinition, ILayoutWidgetDefinition, LayoutDefinition, LayoutDefinitionContent, LayoutWidgetDefinition, isLayoutWidgetDefinition, walkLayout, layoutWidgetsWithPaths, IWidgetDefinitionWithLayoutPath, IWidgetOrDefinitionWithLayoutPath, IWidgetWithLayoutPath, LayoutPath, } from "./workspace/dashboards/layout";
export { IWidget, IWidgetDefinition, WidgetType, isWidget, isWidgetDefinition, } from "./workspace/dashboards/widget";
export { ILegacyKpi, ILegacyKpiBase, ILegacyKpiComparisonDirection, ILegacyKpiComparisonTypeComparison, ILegacyKpiComparisonTypeNoComparison, ILegacyKpiWithComparison, ILegacyKpiWithoutComparison, isLegacyKpiWithComparison, isLegacyKpiWithoutComparison, } from "./workspace/dashboards/kpi";
export { IWidgetAlert, IWidgetAlertDefinition } from "./workspace/dashboards/alert";
export { AbsoluteDateFilterOption, AbsoluteFormType, AbsolutePresetType, AllTimeType, DateFilterConfigMode, DateFilterGranularity, DateFilterOption, DateFilterRelativeOptionGroup, DateString, GUID, IAbsoluteDateFilterForm, IAbsoluteDateFilterPreset, IAllTimeDateFilter, IDashboardAddedPresets, IDateFilterOption, IDateFilterOptionsByType, IExtendedDateFilterErrors, IRelativeDateFilterForm, IRelativeDateFilterPreset, IRelativeDateFilterPresetOfGranularity, OptionType, RelativeDateFilterOption, RelativeFormType, RelativeGranularityOffset, RelativePresetType, isAbsoluteDateFilterForm, isAbsoluteDateFilterOption, isAbsoluteDateFilterPreset, isAllTimeDateFilter, isRelativeDateFilterForm, isRelativeDateFilterOption, isRelativeDateFilterPreset, } from "./workspace/dashboards/extendedDateFilters";
export { IDashboardAttachment, IScheduledMail, IScheduledMailDefinition, ScheduledMailAttachment, } from "./workspace/dashboards/scheduledMail";

@@ -39,4 +39,9 @@ "use strict";

exports.AnalyticalBackendErrorTypes = errors_1.AnalyticalBackendErrorTypes;
var drills_1 = require("./workspace/dashboards/drills");
exports.isDrillToDashboard = drills_1.isDrillToDashboard;
exports.isDrillToInsight = drills_1.isDrillToInsight;
exports.isDrillToLegacyDashboard = drills_1.isDrillToLegacyDashboard;
var filterContext_1 = require("./workspace/dashboards/filterContext");
exports.isFilterContext = filterContext_1.isFilterContext;
exports.isFilterContextDefinition = filterContext_1.isFilterContextDefinition;
exports.isTempFilterContext = filterContext_1.isTempFilterContext;

@@ -51,4 +56,12 @@ exports.isDashboardAttributeFilter = filterContext_1.isDashboardAttributeFilter;

exports.layoutWidgets = layout_1.layoutWidgets;
exports.isFluidLayoutDefinition = layout_1.isFluidLayoutDefinition;
exports.isLayoutWidgetDefinition = layout_1.isLayoutWidgetDefinition;
exports.walkLayout = layout_1.walkLayout;
exports.layoutWidgetsWithPaths = layout_1.layoutWidgetsWithPaths;
var widget_1 = require("./workspace/dashboards/widget");
exports.isWidget = widget_1.isWidget;
exports.isWidgetDefinition = widget_1.isWidgetDefinition;
var kpi_1 = require("./workspace/dashboards/kpi");
exports.isLegacyKpiWithComparison = kpi_1.isLegacyKpiWithComparison;
exports.isLegacyKpiWithoutComparison = kpi_1.isLegacyKpiWithoutComparison;
var extendedDateFilters_1 = require("./workspace/dashboards/extendedDateFilters");

@@ -55,0 +68,0 @@ exports.isAbsoluteDateFilterForm = extendedDateFilters_1.isAbsoluteDateFilterForm;

import { ObjRef } from "@gooddata/sdk-model";
import { IFilterContext } from "./filterContext";
import { IFilterContext, IFilterContextDefinition } from "./filterContext";
import { IDashboardObjectIdentity } from "./common";
/**
* With widget alert, user can be notified to his email according to provided rules
* (e.g. when some measure exceeds/drops below the set value)
* Common widget alert properties
* @alpha
*/
export interface IWidgetAlertDefinition {
export interface IWidgetAlertBase {
/**

@@ -30,6 +30,13 @@ * Kpi ref (currently only kpi widget alerts are supported)

readonly whenTriggered: "underThreshold" | "aboveThreshold";
}
/**
* With widget alert, user can be notified to his email according to provided rules
* (e.g. when some measure exceeds/drops below the set value)
* @alpha
*/
export interface IWidgetAlertDefinition extends IWidgetAlertBase, Partial<IDashboardObjectIdentity> {
/**
* Alert filter context
*/
readonly filterContext?: IFilterContext;
readonly filterContext?: IFilterContext | IFilterContextDefinition;
}

@@ -40,7 +47,7 @@ /**

*/
export declare type IWidgetAlert = IWidgetAlertDefinition & {
export interface IWidgetAlert extends IWidgetAlertBase, IDashboardObjectIdentity {
/**
* Alert object ref
* Alert filter context
*/
readonly ref: ObjRef;
};
readonly filterContext?: IFilterContext;
}
import { ObjRef } from "@gooddata/sdk-model";
import { Layout } from "./layout";
import { IFilterContext, ITempFilterContext } from "./filterContext";
import { Layout, LayoutDefinition } from "./layout";
import { IFilterContext, ITempFilterContext, IFilterContextDefinition } from "./filterContext";
import { GUID, DateFilterConfigMode, DateFilterGranularity, IDashboardAddedPresets } from "./extendedDateFilters";
import { IScheduledMail } from "./scheduledMail";
import { IScheduledMail, IScheduledMailDefinition } from "./scheduledMail";
import { IDashboardObjectIdentity } from "./common";
/**

@@ -33,12 +34,6 @@ * Extended date filter config

/**
* Analytical dashboard consists of widgets
* (widgets are kpis or insights with additional settings - drilling and alerting),
* layout (which defines rendering and ordering of these widgets),
* and filter context (configured attribute and date filters).
* It's also possible to setup scheduled emails for the dashboard
* (user will receive an email with the exported dashboard attached at the specified time interval),
* and optionally extended date filter config.
* Dashboard common properties
* @alpha
*/
export interface IDashboardDefinition {
export interface IDashboardBase {
/**

@@ -52,2 +47,14 @@ * Dashboard title

readonly description: string;
}
/**
* Analytical dashboard consists of widgets
* (widgets are kpis or insights with additional settings - drilling and alerting),
* layout (which defines rendering and ordering of these widgets),
* and filter context (configured attribute and date filters).
* It's also possible to setup scheduled emails for the dashboard
* (user will receive an email with the exported dashboard attached at the specified time interval),
* and optionally extended date filter config.
* @alpha
*/
export interface IDashboard extends IDashboardBase, IDashboardObjectIdentity {
/**

@@ -80,2 +87,26 @@ * Created date

/**
* Dashboard definition represents modified or created dashboard
*
* @alpha
*/
export interface IDashboardDefinition extends IDashboardBase, Partial<IDashboardObjectIdentity> {
/**
* The layout of the dashboard determines the dashboard widgets {@link IWidget} and where they are rendered
*/
readonly layout?: Layout | LayoutDefinition;
/**
* Dashboard scheduled emails
*/
readonly scheduledMails: Array<IScheduledMail | IScheduledMailDefinition>;
/**
* Dashboard filter context, or temporary filter context
* (temporary filter context is used to override original filter context during the export)
*/
readonly filterContext?: IFilterContext | ITempFilterContext | IFilterContextDefinition;
/**
* Dashboard extended date filter config
*/
readonly dateFilterConfig?: IDateFilterConfig;
}
/**
* Listed dashboard - to display the dashboard in the list

@@ -116,19 +147,1 @@ * Only a subset of dashboard data is available,

}
/**
* See {@link IDashboardDefinition}
* @alpha
*/
export interface IDashboard extends IDashboardDefinition {
/**
* Dashboard object ref
*/
readonly ref: ObjRef;
/**
* Dashboard uri
*/
readonly uri: string;
/**
* Dashboard identifier
*/
readonly identifier: string;
}

@@ -123,21 +123,21 @@ /**

/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAllTimeDateFilter}.
* @alpha
*/
export declare const isAllTimeDateFilter: (option: DateFilterOption) => option is IAllTimeDateFilter;
export declare const isAllTimeDateFilter: (obj: any) => obj is IAllTimeDateFilter;
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAbsoluteDateFilterForm}.
* @alpha
*/
export declare const isAbsoluteDateFilterForm: (option: DateFilterOption) => option is IAbsoluteDateFilterForm;
export declare const isAbsoluteDateFilterForm: (obj: any) => obj is IAbsoluteDateFilterForm;
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAbsoluteDateFilterPreset}.
* @alpha
*/
export declare const isAbsoluteDateFilterPreset: (option: DateFilterOption) => option is IAbsoluteDateFilterPreset;
export declare const isAbsoluteDateFilterPreset: (obj: any) => obj is IAbsoluteDateFilterPreset;
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link AbsoluteDateFilterOption}.
* @alpha
*/
export declare const isAbsoluteDateFilterOption: (option: DateFilterOption) => option is AbsoluteDateFilterOption;
export declare const isAbsoluteDateFilterOption: (obj: any) => obj is AbsoluteDateFilterOption;
/**

@@ -149,16 +149,16 @@ * TODO: docs

/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IRelativeDateFilterForm}.
* @alpha
*/
export declare const isRelativeDateFilterForm: (option: DateFilterOption) => option is IRelativeDateFilterForm;
export declare const isRelativeDateFilterForm: (obj: any) => obj is IRelativeDateFilterForm;
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IRelativeDateFilterPreset}.
* @alpha
*/
export declare const isRelativeDateFilterPreset: (option: DateFilterOption) => option is IRelativeDateFilterPreset;
export declare const isRelativeDateFilterPreset: (obj: any) => obj is IRelativeDateFilterPreset;
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link RelativeDateFilterOption}.
* @alpha
*/
export declare const isRelativeDateFilterOption: (option: DateFilterOption) => option is RelativeDateFilterOption;
export declare const isRelativeDateFilterOption: (obj: any) => obj is RelativeDateFilterOption;
/**

@@ -165,0 +165,0 @@ * TODO: docs

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2007-2020 GoodData Corporation
Object.defineProperty(exports, "__esModule", { value: true });
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAllTimeDateFilter}.
* @alpha
*/
exports.isAllTimeDateFilter = function (option) {
return option ? option.type === "allTime" : false;
exports.isAllTimeDateFilter = function (obj) {
return !isEmpty_1.default(obj) && obj.type === "allTime";
};
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAbsoluteDateFilterForm}.
* @alpha
*/
exports.isAbsoluteDateFilterForm = function (option) {
return option ? option.type === "absoluteForm" : false;
exports.isAbsoluteDateFilterForm = function (obj) {
return !isEmpty_1.default(obj) && obj.type === "absoluteForm";
};
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAbsoluteDateFilterPreset}.
* @alpha
*/
exports.isAbsoluteDateFilterPreset = function (option) {
return option ? option.type === "absolutePreset" : false;
exports.isAbsoluteDateFilterPreset = function (obj) {
return !isEmpty_1.default(obj) && obj.type === "absolutePreset";
};
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link AbsoluteDateFilterOption}.
* @alpha
*/
exports.isAbsoluteDateFilterOption = function (option) {
return exports.isAbsoluteDateFilterForm(option) || exports.isAbsoluteDateFilterPreset(option);
exports.isAbsoluteDateFilterOption = function (obj) {
return exports.isAbsoluteDateFilterForm(obj) || exports.isAbsoluteDateFilterPreset(obj);
};
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IRelativeDateFilterForm}.
* @alpha
*/
exports.isRelativeDateFilterForm = function (option) {
return option ? option.type === "relativeForm" : false;
exports.isRelativeDateFilterForm = function (obj) {
return !isEmpty_1.default(obj) && obj.type === "relativeForm";
};
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IRelativeDateFilterPreset}.
* @alpha
*/
exports.isRelativeDateFilterPreset = function (option) {
return option ? option.type === "relativePreset" : false;
exports.isRelativeDateFilterPreset = function (obj) {
return !isEmpty_1.default(obj) && obj.type === "relativePreset";
};
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link RelativeDateFilterOption}.
* @alpha
*/
exports.isRelativeDateFilterOption = function (option) {
return exports.isRelativeDateFilterForm(option) || exports.isRelativeDateFilterPreset(option);
exports.isRelativeDateFilterOption = function (obj) {
return exports.isRelativeDateFilterForm(obj) || exports.isRelativeDateFilterPreset(obj);
};
import { ObjRef } from "@gooddata/sdk-model";
import { DateString, DateFilterGranularity } from "./extendedDateFilters";
import { IDashboardObjectIdentity } from "./common";
/**

@@ -86,8 +87,7 @@ * Date filter type - relative

/**
* Filter context consists of configured attribute and date filters
* (which could be applyied to the dashboard, widget alert, or scheduled email)
* Common filter context properties
*
* @alpha
*/
export interface IFilterContextDefinition {
export interface IFilterContextBase {
/**

@@ -107,11 +107,22 @@ * Filter context title

/**
* See {@link IFilterContextDefinition}
* Filter context definition represents modifier or created filter context
*
* @alpha
*/
export interface IFilterContext extends IFilterContextDefinition {
readonly ref: ObjRef;
readonly uri: string;
readonly identifier: string;
export interface IFilterContextDefinition extends IFilterContextBase, Partial<IDashboardObjectIdentity> {
}
/**
* Type-guard testing whether the provided object is an instance of {@link IFilterContextDefinition}.
* @alpha
*/
export declare function isFilterContextDefinition(obj: any): obj is IFilterContextDefinition;
/**
* Filter context consists of configured attribute and date filters
* (which could be applyied to the dashboard, widget alert, or scheduled email)
*
* @alpha
*/
export interface IFilterContext extends IFilterContextBase, IDashboardObjectIdentity {
}
/**
* Type-guard testing whether the provided object is an instance of {@link IFilterContext}.

@@ -126,3 +137,3 @@ * @alpha

*/
export interface ITempFilterContextDefinition {
export interface ITempFilterContext {
/**

@@ -137,9 +148,9 @@ * Filter context created time

readonly filters: FilterContextItem[];
}
/**
* See {@link ITempFilterContextDefinition}
* @alpha
*/
export interface ITempFilterContext extends ITempFilterContextDefinition {
/**
* Temp filter context ref
*/
readonly ref: ObjRef;
/**
* Temp filter context uri
*/
readonly uri: string;

@@ -146,0 +157,0 @@ }

@@ -24,2 +24,11 @@ "use strict";

/**
* Type-guard testing whether the provided object is an instance of {@link IFilterContextDefinition}.
* @alpha
*/
function isFilterContextDefinition(obj) {
// Currently, we have no better way to distinguish between IFilterContext and ITempFilterContext
return !isEmpty_1.default(obj) && !!obj.filters && !obj.ref;
}
exports.isFilterContextDefinition = isFilterContextDefinition;
/**
* Type-guard testing whether the provided object is an instance of {@link IFilterContext}.

@@ -30,3 +39,3 @@ * @alpha

// Currently, we have no better way to distinguish between IFilterContext and ITempFilterContext
return !isEmpty_1.default(obj) && !!obj.filters && !obj.description;
return !isEmpty_1.default(obj) && !!obj.filters && !!obj.ref;
}

@@ -40,3 +49,6 @@ exports.isFilterContext = isFilterContext;

// Currently, we have no better way to distinguish between IFilterContext and ITempFilterContext
return !isEmpty_1.default(obj) && !!obj.filters && !!obj.created;
return (!isEmpty_1.default(obj) &&
!!obj.filters &&
!obj.identifier &&
!obj.title);
}

@@ -43,0 +55,0 @@ exports.isTempFilterContext = isTempFilterContext;

import { ObjRef } from "@gooddata/sdk-model";
import { IDashboard, IDashboardDefinition, IListedDashboard } from "./dashboard";
import { IListedDashboard, IDashboard, IDashboardDefinition } from "./dashboard";
/**

@@ -41,3 +41,3 @@ * Service to list, create and update analytical dashboards

*/
updateDashboard(dashboard: IDashboard, updatedDashboard: IDashboard): Promise<IDashboard>;
updateDashboard(dashboard: IDashboard, updatedDashboard: IDashboardDefinition): Promise<IDashboard>;
/**

@@ -44,0 +44,0 @@ * Delete dashboard

@@ -1,2 +0,2 @@

import { IWidget } from "./widget";
import { IWidget, IWidgetDefinition } from "./widget";
/**

@@ -58,2 +58,7 @@ * Dashboard layout

/**
* Type-guard testing whether the provided object is an instance of {@link IFluidLayoutDefinition}.
* @alpha
*/
export declare function isFluidLayoutDefinition(obj: any): obj is IFluidLayoutDefinition;
/**
* Fluid layout row definition

@@ -164,9 +169,143 @@ * @alpha

/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
* Dashboard layout definition
* @alpha
*/
export declare type LayoutDefinition = IFluidLayoutDefinition;
/**
* Layout widget definition
* @alpha
*/
export declare type LayoutWidgetDefinition = ILayoutWidgetDefinition;
/**
* Layout definition content - widget or another layout
* @alpha
*/
export declare type LayoutDefinitionContent = Widget | Layout | LayoutDefinition | LayoutWidgetDefinition;
/**
* Fluid layout definition
* @alpha
*/
export interface IFluidLayoutDefinition {
fluidLayout: {
/**
* Layout rows
*/
rows: IFluidLayoutRowDefinition[];
/**
* Layout size
*/
size?: IFluidLayoutSize;
/**
* Layout style
*/
style?: string;
};
}
/**
* Fluid layout row definition
* @alpha
*/
export interface IFluidLayoutRowDefinition {
/**
* Row columns
*/
columns: IFluidLayoutColumnDefinition[];
/**
* Row style
*/
style?: string;
/**
* Row header
*/
header?: SectionHeader;
}
/**
* Fluid layout column definition
* @alpha
*/
export interface IFluidLayoutColumnDefinition {
/**
* Column content - widget or another layout
*/
content?: LayoutDefinitionContent;
/**
* Column size
*/
size: IFluidLayoutColSize;
/**
* Column style
*/
style?: string;
}
/**
* Layout reference to the widget
* @alpha
*/
export interface ILayoutWidgetDefinition {
/**
* Widget object reference
*/
widget: IWidget | IWidgetDefinition;
}
/**
* Type-guard testing whether the provided object is an instance of {@link ILayoutWidgetDefinition}.
* @alpha
*/
export declare function isLayoutWidgetDefinition(obj: any): obj is ILayoutWidgetDefinition;
/**
* Represents nested path in layout
* It's useful to track the layout location of the widget
* @alpha
*/
export declare type LayoutPath = Array<string | number>;
/**
* Walk dashboard layout
* This is useful to collect widgets from the layout or perform transforms on the layout
*
* @alpha
* @param layout - dashboard layout
* @param collectedWidgets - bag for collecting widgets recursively from the layout
* @param callbacks - walk callbacks
* @returns void
*/
export declare const layoutWidgets: (layout: IFluidLayout, collectedWidgets?: IWidget[]) => IWidget[];
export declare function walkLayout(layout: Layout | LayoutDefinition, { rowCallback, columnCallback, widgetCallback, }: {
rowCallback?: (row: IFluidLayoutRow | IFluidLayoutRowDefinition, rowPath: LayoutPath) => void;
columnCallback?: (column: IFluidLayoutColumn | IFluidLayoutColumnDefinition, columnPath: LayoutPath) => void;
widgetCallback?: (widget: IWidget | IWidgetDefinition, widgetPath: LayoutPath) => void;
}, path?: LayoutPath): void;
/**
* Widget with it's layout path
* @alpha
*/
export interface IWidgetWithLayoutPath {
path: LayoutPath;
widget: IWidget;
}
/**
* Widget definition with it's layout path
* @alpha
*/
export interface IWidgetDefinitionWithLayoutPath {
path: LayoutPath;
widget: IWidgetDefinition;
}
/**
* Widget definition or widget with it's layout path
* @alpha
*/
export declare type IWidgetOrDefinitionWithLayoutPath = IWidgetWithLayoutPath | IWidgetDefinitionWithLayoutPath;
/**
* @alpha
*/
export declare function layoutWidgetsWithPaths(layout: Layout): IWidgetWithLayoutPath[];
/**
* @alpha
*/
export declare function layoutWidgetsWithPaths(layout: LayoutDefinition): IWidgetOrDefinitionWithLayoutPath[];
/**
* @alpha
*/
export declare function layoutWidgets(layout: Layout): IWidget[];
/**
* @alpha
*/
export declare function layoutWidgets(layout: LayoutDefinition): Array<IWidgetDefinition | IWidget>;
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -6,3 +13,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2019-2020 GoodData Corporation
var widget_1 = require("./widget");
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
var noop_1 = __importDefault(require("lodash/noop"));
/**

@@ -13,3 +23,3 @@ * Type-guard testing whether the provided object is an instance of {@link ILayoutWidget}.

function isLayoutWidget(obj) {
return !isEmpty_1.default(obj) && !!obj.widget;
return !isEmpty_1.default(obj) && !!obj.widget && widget_1.isWidget(obj.widget);
}

@@ -26,23 +36,88 @@ exports.isLayoutWidget = isLayoutWidget;

/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
* Type-guard testing whether the provided object is an instance of {@link IFluidLayoutDefinition}.
* @alpha
*/
function isFluidLayoutDefinition(obj) {
return !isEmpty_1.default(obj) && !!obj.fluidLayout;
}
exports.isFluidLayoutDefinition = isFluidLayoutDefinition;
/**
* Type-guard testing whether the provided object is an instance of {@link ILayoutWidgetDefinition}.
* @alpha
*/
function isLayoutWidgetDefinition(obj) {
return !isEmpty_1.default(obj) && !!obj.widget && widget_1.isWidgetDefinition(obj.widget);
}
exports.isLayoutWidgetDefinition = isLayoutWidgetDefinition;
/**
* Walk dashboard layout
* This is useful to collect widgets from the layout or perform transforms on the layout
*
* @alpha
* @param layout - dashboard layout
* @param collectedWidgets - bag for collecting widgets recursively from the layout
* @param callbacks - walk callbacks
* @returns void
*/
exports.layoutWidgets = function (layout, collectedWidgets) {
if (collectedWidgets === void 0) { collectedWidgets = []; }
layout.fluidLayout.rows.forEach(function (row) {
row.columns.forEach(function (column) {
if (isLayoutWidget(column.content)) {
collectedWidgets.push(column.content.widget);
function walkLayout(layout, _a, path) {
var _b = _a.rowCallback, rowCallback = _b === void 0 ? noop_1.default : _b, _c = _a.columnCallback, columnCallback = _c === void 0 ? noop_1.default : _c, _d = _a.widgetCallback, widgetCallback = _d === void 0 ? noop_1.default : _d;
if (path === void 0) { path = ["fluidLayout", "rows"]; }
layout.fluidLayout.rows.forEach(function (row, rowIndex) {
var rowPath = __spreadArrays(path, [rowIndex]);
rowCallback(row, rowPath);
row.columns.forEach(function (column, columnIndex) {
var columnPath = __spreadArrays(rowPath, ["columns", columnIndex]);
columnCallback(column, columnPath);
if (isLayoutWidget(column.content) || isLayoutWidgetDefinition(column.content)) {
var widgetPath = __spreadArrays(columnPath, ["content", "widget"]);
widgetCallback(column.content.widget, widgetPath);
}
else if (isFluidLayout(column.content)) {
else if (isFluidLayout(column.content) || isFluidLayoutDefinition(column.content)) {
// is another layout
exports.layoutWidgets(column.content);
walkLayout(column.content, {
rowCallback: rowCallback,
columnCallback: columnCallback,
widgetCallback: widgetCallback,
}, __spreadArrays(columnPath, ["content", "fluidLayout", "rows"]));
}
});
});
}
exports.walkLayout = walkLayout;
/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
*
* @alpha
* @param layout - dashboard layout
* @param collectedWidgets - bag for collecting widgets recursively from the layout
* @returns - widgets with layout paths
*/
function layoutWidgetsWithPaths(layout) {
var collectedWidgets = [];
walkLayout(layout, {
widgetCallback: function (widget, path) {
return collectedWidgets.push({
widget: widget,
path: path,
});
},
});
return collectedWidgets;
};
}
exports.layoutWidgetsWithPaths = layoutWidgetsWithPaths;
/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
*
* @alpha
* @param layout - dashboard layout
* @returns - widgets
*/
function layoutWidgets(layout) {
var collectedWidgets = [];
walkLayout(layout, {
widgetCallback: function (widget) { return collectedWidgets.push(widget); },
});
return collectedWidgets;
}
exports.layoutWidgets = layoutWidgets;
import { ObjRef } from "@gooddata/sdk-model";
import { IDashboardObjectIdentity } from "./common";
/**
* A scheduled email is used to notify a user with an exported dashboard according to a specified time interval
* A scheduled email common properties
* @alpha
*/
export interface IScheduledMailDefinition {
export interface IScheduledMailBase {
/**
* Scheduled email object reference
*/
ref: ObjRef;
/**
* Scheduled email job interval

@@ -66,2 +63,8 @@ */

/**
* A scheduled email is used to notify a user with an exported dashboard according to a specified time interval
* @alpha
*/
export interface IScheduledMailDefinition extends IScheduledMailBase, Partial<IDashboardObjectIdentity> {
}
/**
* Supported email attachments

@@ -94,7 +97,3 @@ * @alpha

*/
export declare type IScheduledMail = IScheduledMailDefinition & {
/**
* Scheduled email object reference
*/
ref: ObjRef;
};
export interface IScheduledMail extends IScheduledMailBase, IDashboardObjectIdentity {
}
import { ObjRef } from "@gooddata/sdk-model";
import { IWidgetAlert } from "./alert";
import { IDashboardFilterReference } from "./filterContext";
import { DrillDefinition } from "./drills";
import { ILegacyKpi } from "./kpi";
import { IDashboardObjectIdentity } from "./common";
/**
* Widget drill definition
* @alpha
*/
export declare type DrillDefinition = IDrillToInsight | IDrillToDashboard;
/**
* Drill origin type
* @alpha
*/
export declare type DrillOriginType = "drillFromMeasure";
/**
* Drill origin
* @alpha
*/
export declare type DrillOrigin = IDrillFromMeasure;
/**
* Drill transition
* @alpha
*/
export declare type DrillTransition = "pop-up" | "in-place";
/**
* Drill type
* @alpha
*/
export declare type DrillType = "drillToInsight" | "drillToDashboard" | "drillToLegacyDashboard";
/**
* Drill origin base type
* @alpha
*/
export interface IDrillOrigin {
/**
* Drill origin type
*/
type: DrillOriginType;
}
/**
* Drill from measure
* @alpha
*/
export interface IDrillFromMeasure extends IDrillOrigin {
/**
* Drill origin type
*/
type: "drillFromMeasure";
/**
* Measure object ref
*/
measure: ObjRef;
}
/**
* Drill base type
* @alpha
*/
export interface IDrill {
/**
* Drill type
*/
type: DrillType;
/**
* Drill transition
*/
transition: DrillTransition;
/**
* Drill origin
*/
origin: DrillOrigin;
/**
* Drill target object ref
*/
target: ObjRef;
}
/**
* Drill to PP dashboard
* @alpha
*/
export interface IDrillToLegacyDashboard extends IDrill {
/**
* Drill type
*/
type: "drillToLegacyDashboard";
/**
* Drill transition
*/
transition: "pop-up";
}
/**
* Drill to dashboard
* @alpha
*/
export interface IDrillToDashboard extends IDrill {
/**
* Drill type
*/
type: "drillToDashboard";
/**
* Drill transition
*/
transition: "in-place";
}
/**
* Drill to insight
* @alpha
*/
export interface IDrillToInsight extends IDrill {
/**
* Drill type
*/
type: "drillToInsight";
/**
* Drill transition
*/
transition: "pop-up";
}
/**
* Temporary type to distinguish between kpi and insight

@@ -126,3 +16,3 @@ * @alpha

*/
export interface IWidgetDefinition {
export interface IWidgetBase {
/**

@@ -153,2 +43,6 @@ * Widget title

/**
* Temporary place for legacy kpi properties
*/
readonly kpi?: ILegacyKpi;
/**
* Widget drills

@@ -163,20 +57,18 @@ */

/**
* See {@link IWidgetDefinition}]
* See {@link IWidget}]
* @alpha
*/
export interface IWidget extends IWidgetDefinition {
/**
* Visualization widget or kpi object ref
*/
readonly ref: ObjRef;
/**
* Visualization widget or kpi uri
*/
readonly uri: string;
/**
* Visualization widget or kpi identifier
*/
readonly identifier: string;
export interface IWidgetDefinition extends IWidgetBase, Partial<IDashboardObjectIdentity> {
}
/**
* @alpha
*/
export interface IWidget extends IWidgetBase, IDashboardObjectIdentity {
}
/**
* Type-guard testing whether the provided object is an instance of {@link IWidgetDefinition}.
* @alpha
*/
export declare function isWidgetDefinition(obj: any): obj is IWidgetDefinition;
/**
* Type-guard testing whether the provided object is an instance of {@link IWidget}.

@@ -183,0 +75,0 @@ * @alpha

@@ -8,2 +8,12 @@ "use strict";

/**
* Type-guard testing whether the provided object is an instance of {@link IWidgetDefinition}.
* @alpha
*/
function isWidgetDefinition(obj) {
return (!isEmpty_1.default(obj) &&
(obj.type === "kpi" || obj.type === "insight") &&
!obj.ref);
}
exports.isWidgetDefinition = isWidgetDefinition;
/**
* Type-guard testing whether the provided object is an instance of {@link IWidget}.

@@ -13,4 +23,6 @@ * @alpha

function isWidget(obj) {
return !isEmpty_1.default(obj) && (obj.type === "kpi" || obj.type === "insight");
return (!isEmpty_1.default(obj) &&
(obj.type === "kpi" || obj.type === "insight") &&
!!obj.ref);
}
exports.isWidget = isWidget;
{
"name": "@gooddata/sdk-backend-spi",
"version": "8.0.0-alpha.73",
"version": "8.0.0-alpha.74",
"author": "GoodData",

@@ -36,3 +36,3 @@ "description": "GoodData Backend SPI abstraction interfaces",

"dependencies": {
"@gooddata/sdk-model": "^8.0.0-alpha.73",
"@gooddata/sdk-model": "^8.0.0-alpha.74",
"lodash": "^4.17.15",

@@ -39,0 +39,0 @@ "spark-md5": "^3.0.0",

@@ -120,3 +120,20 @@ // (C) 2019-2020 GoodData Corporation

export { IWorkspaceDashboards } from "./workspace/dashboards";
export { IDashboardObjectIdentity } from "./workspace/dashboards/common";
export {
DrillDefinition,
DrillOrigin,
DrillOriginType,
DrillTransition,
DrillType,
IDrill,
IDrillFromMeasure,
IDrillOrigin,
IDrillToDashboard,
IDrillToInsight,
IDrillToLegacyDashboard,
isDrillToDashboard,
isDrillToInsight,
isDrillToLegacyDashboard,
} from "./workspace/dashboards/drills";
export {
IDashboard,

@@ -126,2 +143,3 @@ IDashboardDefinition,

IListedDashboard,
IDashboardBase,
} from "./workspace/dashboards/dashboard";

@@ -138,4 +156,4 @@ export {

ITempFilterContext,
ITempFilterContextDefinition,
isFilterContext,
isFilterContextDefinition,
isTempFilterContext,

@@ -166,4 +184,36 @@ isDashboardAttributeFilter,

layoutWidgets,
isFluidLayoutDefinition,
IFluidLayoutColumnDefinition,
IFluidLayoutDefinition,
IFluidLayoutRowDefinition,
ILayoutWidgetDefinition,
LayoutDefinition,
LayoutDefinitionContent,
LayoutWidgetDefinition,
isLayoutWidgetDefinition,
walkLayout,
layoutWidgetsWithPaths,
IWidgetDefinitionWithLayoutPath,
IWidgetOrDefinitionWithLayoutPath,
IWidgetWithLayoutPath,
LayoutPath,
} from "./workspace/dashboards/layout";
export { IWidget, IWidgetDefinition, WidgetType, isWidget } from "./workspace/dashboards/widget";
export {
IWidget,
IWidgetDefinition,
WidgetType,
isWidget,
isWidgetDefinition,
} from "./workspace/dashboards/widget";
export {
ILegacyKpi,
ILegacyKpiBase,
ILegacyKpiComparisonDirection,
ILegacyKpiComparisonTypeComparison,
ILegacyKpiComparisonTypeNoComparison,
ILegacyKpiWithComparison,
ILegacyKpiWithoutComparison,
isLegacyKpiWithComparison,
isLegacyKpiWithoutComparison,
} from "./workspace/dashboards/kpi";
export { IWidgetAlert, IWidgetAlertDefinition } from "./workspace/dashboards/alert";

@@ -170,0 +220,0 @@ export {

// (C) 2019-2020 GoodData Corporation
import { ObjRef } from "@gooddata/sdk-model";
import { IFilterContext } from "./filterContext";
import { IFilterContext, IFilterContextDefinition } from "./filterContext";
import { IDashboardObjectIdentity } from "./common";
/**
* With widget alert, user can be notified to his email according to provided rules
* (e.g. when some measure exceeds/drops below the set value)
* Common widget alert properties
* @alpha
*/
export interface IWidgetAlertDefinition {
export interface IWidgetAlertBase {
/**

@@ -36,7 +36,14 @@ * Kpi ref (currently only kpi widget alerts are supported)

readonly whenTriggered: "underThreshold" | "aboveThreshold";
}
/**
* With widget alert, user can be notified to his email according to provided rules
* (e.g. when some measure exceeds/drops below the set value)
* @alpha
*/
export interface IWidgetAlertDefinition extends IWidgetAlertBase, Partial<IDashboardObjectIdentity> {
/**
* Alert filter context
*/
readonly filterContext?: IFilterContext;
readonly filterContext?: IFilterContext | IFilterContextDefinition;
}

@@ -48,7 +55,7 @@

*/
export type IWidgetAlert = IWidgetAlertDefinition & {
export interface IWidgetAlert extends IWidgetAlertBase, IDashboardObjectIdentity {
/**
* Alert object ref
* Alert filter context
*/
readonly ref: ObjRef;
};
readonly filterContext?: IFilterContext;
}
// (C) 2019-2020 GoodData Corporation
import { ObjRef } from "@gooddata/sdk-model";
import { Layout } from "./layout";
import { IFilterContext, ITempFilterContext } from "./filterContext";
import { Layout, LayoutDefinition } from "./layout";
import { IFilterContext, ITempFilterContext, IFilterContextDefinition } from "./filterContext";
import {

@@ -11,3 +11,4 @@ GUID,

} from "./extendedDateFilters";
import { IScheduledMail } from "./scheduledMail";
import { IScheduledMail, IScheduledMailDefinition } from "./scheduledMail";
import { IDashboardObjectIdentity } from "./common";

@@ -46,12 +47,6 @@ /**

/**
* Analytical dashboard consists of widgets
* (widgets are kpis or insights with additional settings - drilling and alerting),
* layout (which defines rendering and ordering of these widgets),
* and filter context (configured attribute and date filters).
* It's also possible to setup scheduled emails for the dashboard
* (user will receive an email with the exported dashboard attached at the specified time interval),
* and optionally extended date filter config.
* Dashboard common properties
* @alpha
*/
export interface IDashboardDefinition {
export interface IDashboardBase {
/**

@@ -66,3 +61,15 @@ * Dashboard title

readonly description: string;
}
/**
* Analytical dashboard consists of widgets
* (widgets are kpis or insights with additional settings - drilling and alerting),
* layout (which defines rendering and ordering of these widgets),
* and filter context (configured attribute and date filters).
* It's also possible to setup scheduled emails for the dashboard
* (user will receive an email with the exported dashboard attached at the specified time interval),
* and optionally extended date filter config.
* @alpha
*/
export interface IDashboard extends IDashboardBase, IDashboardObjectIdentity {
/**

@@ -101,2 +108,30 @@ * Created date

/**
* Dashboard definition represents modified or created dashboard
*
* @alpha
*/
export interface IDashboardDefinition extends IDashboardBase, Partial<IDashboardObjectIdentity> {
/**
* The layout of the dashboard determines the dashboard widgets {@link IWidget} and where they are rendered
*/
readonly layout?: Layout | LayoutDefinition;
/**
* Dashboard scheduled emails
*/
readonly scheduledMails: Array<IScheduledMail | IScheduledMailDefinition>;
/**
* Dashboard filter context, or temporary filter context
* (temporary filter context is used to override original filter context during the export)
*/
readonly filterContext?: IFilterContext | ITempFilterContext | IFilterContextDefinition;
/**
* Dashboard extended date filter config
*/
readonly dateFilterConfig?: IDateFilterConfig;
}
/**
* Listed dashboard - to display the dashboard in the list

@@ -143,22 +178,1 @@ * Only a subset of dashboard data is available,

}
/**
* See {@link IDashboardDefinition}
* @alpha
*/
export interface IDashboard extends IDashboardDefinition {
/**
* Dashboard object ref
*/
readonly ref: ObjRef;
/**
* Dashboard uri
*/
readonly uri: string;
/**
* Dashboard identifier
*/
readonly identifier: string;
}
// (C) 2007-2020 GoodData Corporation
import isEmpty from "lodash/isEmpty";

@@ -155,28 +156,28 @@ /**

/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAllTimeDateFilter}.
* @alpha
*/
export const isAllTimeDateFilter = (option: DateFilterOption): option is IAllTimeDateFilter =>
option ? option.type === "allTime" : false;
export const isAllTimeDateFilter = (obj: any): obj is IAllTimeDateFilter =>
!isEmpty(obj) && (obj as IAllTimeDateFilter).type === "allTime";
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAbsoluteDateFilterForm}.
* @alpha
*/
export const isAbsoluteDateFilterForm = (option: DateFilterOption): option is IAbsoluteDateFilterForm =>
option ? option.type === "absoluteForm" : false;
export const isAbsoluteDateFilterForm = (obj: any): obj is IAbsoluteDateFilterForm =>
!isEmpty(obj) && (obj as IAbsoluteDateFilterForm).type === "absoluteForm";
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IAbsoluteDateFilterPreset}.
* @alpha
*/
export const isAbsoluteDateFilterPreset = (option: DateFilterOption): option is IAbsoluteDateFilterPreset =>
option ? option.type === "absolutePreset" : false;
export const isAbsoluteDateFilterPreset = (obj: any): obj is IAbsoluteDateFilterPreset =>
!isEmpty(obj) && (obj as IAbsoluteDateFilterPreset).type === "absolutePreset";
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link AbsoluteDateFilterOption}.
* @alpha
*/
export const isAbsoluteDateFilterOption = (option: DateFilterOption): option is AbsoluteDateFilterOption =>
isAbsoluteDateFilterForm(option) || isAbsoluteDateFilterPreset(option);
export const isAbsoluteDateFilterOption = (obj: any): obj is AbsoluteDateFilterOption =>
isAbsoluteDateFilterForm(obj) || isAbsoluteDateFilterPreset(obj);

@@ -190,21 +191,21 @@ /**

/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IRelativeDateFilterForm}.
* @alpha
*/
export const isRelativeDateFilterForm = (option: DateFilterOption): option is IRelativeDateFilterForm =>
option ? option.type === "relativeForm" : false;
export const isRelativeDateFilterForm = (obj: any): obj is IRelativeDateFilterForm =>
!isEmpty(obj) && (obj as IRelativeDateFilterForm).type === "relativeForm";
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link IRelativeDateFilterPreset}.
* @alpha
*/
export const isRelativeDateFilterPreset = (option: DateFilterOption): option is IRelativeDateFilterPreset =>
option ? option.type === "relativePreset" : false;
export const isRelativeDateFilterPreset = (obj: any): obj is IRelativeDateFilterPreset =>
!isEmpty(obj) && (obj as IRelativeDateFilterPreset).type === "relativePreset";
/**
* TODO: docs
* @public
* Type-guard testing whether the provided object is an instance of {@link RelativeDateFilterOption}.
* @alpha
*/
export const isRelativeDateFilterOption = (option: DateFilterOption): option is RelativeDateFilterOption =>
isRelativeDateFilterForm(option) || isRelativeDateFilterPreset(option);
export const isRelativeDateFilterOption = (obj: any): obj is RelativeDateFilterOption =>
isRelativeDateFilterForm(obj) || isRelativeDateFilterPreset(obj);

@@ -211,0 +212,0 @@ /**

@@ -5,2 +5,3 @@ // (C) 2019-2020 GoodData Corporation

import isEmpty from "lodash/isEmpty";
import { IDashboardObjectIdentity } from "./common";

@@ -109,8 +110,7 @@ /**

/**
* Filter context consists of configured attribute and date filters
* (which could be applyied to the dashboard, widget alert, or scheduled email)
* Common filter context properties
*
* @alpha
*/
export interface IFilterContextDefinition {
export interface IFilterContextBase {
/**

@@ -133,14 +133,26 @@ * Filter context title

/**
* See {@link IFilterContextDefinition}
* Filter context definition represents modifier or created filter context
*
* @alpha
*/
export interface IFilterContext extends IFilterContextDefinition {
readonly ref: ObjRef;
export interface IFilterContextDefinition extends IFilterContextBase, Partial<IDashboardObjectIdentity> {}
readonly uri: string;
readonly identifier: string;
/**
* Type-guard testing whether the provided object is an instance of {@link IFilterContextDefinition}.
* @alpha
*/
export function isFilterContextDefinition(obj: any): obj is IFilterContextDefinition {
// Currently, we have no better way to distinguish between IFilterContext and ITempFilterContext
return !isEmpty(obj) && !!(obj as IFilterContextDefinition).filters && !(obj as IFilterContext).ref;
}
/**
* Filter context consists of configured attribute and date filters
* (which could be applyied to the dashboard, widget alert, or scheduled email)
*
* @alpha
*/
export interface IFilterContext extends IFilterContextBase, IDashboardObjectIdentity {}
/**
* Type-guard testing whether the provided object is an instance of {@link IFilterContext}.

@@ -151,3 +163,3 @@ * @alpha

// Currently, we have no better way to distinguish between IFilterContext and ITempFilterContext
return !isEmpty(obj) && !!(obj as IFilterContext).filters && !(obj as IFilterContext).description;
return !isEmpty(obj) && !!(obj as IFilterContext).filters && !!(obj as IFilterContext).ref;
}

@@ -160,3 +172,3 @@

*/
export interface ITempFilterContextDefinition {
export interface ITempFilterContext {
/**

@@ -172,11 +184,11 @@ * Filter context created time

readonly filters: FilterContextItem[];
}
/**
* See {@link ITempFilterContextDefinition}
* @alpha
*/
export interface ITempFilterContext extends ITempFilterContextDefinition {
/**
* Temp filter context ref
*/
readonly ref: ObjRef;
/**
* Temp filter context uri
*/
readonly uri: string;

@@ -191,3 +203,8 @@ }

// Currently, we have no better way to distinguish between IFilterContext and ITempFilterContext
return !isEmpty(obj) && !!(obj as ITempFilterContext).filters && !!(obj as ITempFilterContext).created;
return (
!isEmpty(obj) &&
!!(obj as ITempFilterContext).filters &&
!(obj as IFilterContext).identifier &&
!(obj as IFilterContext).title
);
}

@@ -194,0 +211,0 @@

// (C) 2019-2020 GoodData Corporation
import { ObjRef } from "@gooddata/sdk-model";
import { IDashboard, IDashboardDefinition, IListedDashboard } from "./dashboard";
import { IListedDashboard, IDashboard, IDashboardDefinition } from "./dashboard";

@@ -47,3 +47,3 @@ /**

*/
updateDashboard(dashboard: IDashboard, updatedDashboard: IDashboard): Promise<IDashboard>;
updateDashboard(dashboard: IDashboard, updatedDashboard: IDashboardDefinition): Promise<IDashboard>;

@@ -50,0 +50,0 @@ /**

// (C) 2019-2020 GoodData Corporation
import { IWidget } from "./widget";
import { IWidget, IWidgetDefinition, isWidget, isWidgetDefinition } from "./widget";
import isEmpty from "lodash/isEmpty";
import noop from "lodash/noop";

@@ -39,3 +40,3 @@ /**

export function isLayoutWidget(obj: any): obj is ILayoutWidget {
return !isEmpty(obj) && !!(obj as ILayoutWidget).widget;
return !isEmpty(obj) && !!(obj as ILayoutWidget).widget && isWidget(obj.widget);
}

@@ -75,2 +76,10 @@

/**
* Type-guard testing whether the provided object is an instance of {@link IFluidLayoutDefinition}.
* @alpha
*/
export function isFluidLayoutDefinition(obj: any): obj is IFluidLayoutDefinition {
return !isEmpty(obj) && !!(obj as IFluidLayoutDefinition).fluidLayout;
}
/**
* Fluid layout row definition

@@ -198,22 +207,239 @@ * @alpha

/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
* Dashboard layout definition
* @alpha
*/
export type LayoutDefinition = IFluidLayoutDefinition;
/**
* Layout widget definition
* @alpha
*/
export type LayoutWidgetDefinition = ILayoutWidgetDefinition;
/**
* Layout definition content - widget or another layout
* @alpha
*/
export type LayoutDefinitionContent = Widget | Layout | LayoutDefinition | LayoutWidgetDefinition;
/**
* Fluid layout definition
* @alpha
*/
export interface IFluidLayoutDefinition {
fluidLayout: {
/**
* Layout rows
*/
rows: IFluidLayoutRowDefinition[];
/**
* Layout size
*/
size?: IFluidLayoutSize;
/**
* Layout style
*/
style?: string;
};
}
/**
* Fluid layout row definition
* @alpha
*/
export interface IFluidLayoutRowDefinition {
/**
* Row columns
*/
columns: IFluidLayoutColumnDefinition[];
/**
* Row style
*/
style?: string;
/**
* Row header
*/
header?: SectionHeader;
}
/**
* Fluid layout column definition
* @alpha
*/
export interface IFluidLayoutColumnDefinition {
/**
* Column content - widget or another layout
*/
content?: LayoutDefinitionContent;
/**
* Column size
*/
size: IFluidLayoutColSize;
/**
* Column style
*/
style?: string;
}
/**
* Layout reference to the widget
* @alpha
*/
export interface ILayoutWidgetDefinition {
/**
* Widget object reference
*/
widget: IWidget | IWidgetDefinition;
}
/**
* Type-guard testing whether the provided object is an instance of {@link ILayoutWidgetDefinition}.
* @alpha
*/
export function isLayoutWidgetDefinition(obj: any): obj is ILayoutWidgetDefinition {
return !isEmpty(obj) && !!(obj as ILayoutWidgetDefinition).widget && isWidgetDefinition(obj.widget);
}
/**
* Represents nested path in layout
* It's useful to track the layout location of the widget
* @alpha
*/
export type LayoutPath = Array<string | number>;
/**
* Walk dashboard layout
* This is useful to collect widgets from the layout or perform transforms on the layout
*
* @alpha
* @param layout - dashboard layout
* @param collectedWidgets - bag for collecting widgets recursively from the layout
* @param callbacks - walk callbacks
* @returns void
*/
export const layoutWidgets = (layout: Layout, collectedWidgets: IWidget[] = []): IWidget[] => {
layout.fluidLayout.rows.forEach(row => {
row.columns.forEach(column => {
if (isLayoutWidget(column.content)) {
collectedWidgets.push(column.content.widget);
} else if (isFluidLayout(column.content)) {
export function walkLayout(
layout: Layout | LayoutDefinition,
{
rowCallback = noop,
columnCallback = noop,
widgetCallback = noop,
}: {
rowCallback?: (row: IFluidLayoutRow | IFluidLayoutRowDefinition, rowPath: LayoutPath) => void;
columnCallback?: (
column: IFluidLayoutColumn | IFluidLayoutColumnDefinition,
columnPath: LayoutPath,
) => void;
widgetCallback?: (widget: IWidget | IWidgetDefinition, widgetPath: LayoutPath) => void;
},
path: LayoutPath = ["fluidLayout", "rows"],
): void {
layout.fluidLayout.rows.forEach((row, rowIndex) => {
const rowPath = [...path, rowIndex];
rowCallback(row, rowPath);
row.columns.forEach((column, columnIndex) => {
const columnPath = [...rowPath, "columns", columnIndex];
columnCallback(column, columnPath);
if (isLayoutWidget(column.content) || isLayoutWidgetDefinition(column.content)) {
const widgetPath = [...columnPath, "content", "widget"];
widgetCallback(column.content.widget, widgetPath);
} else if (isFluidLayout(column.content) || isFluidLayoutDefinition(column.content)) {
// is another layout
layoutWidgets(column.content);
walkLayout(
column.content,
{
rowCallback,
columnCallback,
widgetCallback,
},
[...columnPath, "content", "fluidLayout", "rows"],
);
}
});
});
}
/**
* Widget with it's layout path
* @alpha
*/
export interface IWidgetWithLayoutPath {
path: LayoutPath;
widget: IWidget;
}
/**
* Widget definition with it's layout path
* @alpha
*/
export interface IWidgetDefinitionWithLayoutPath {
path: LayoutPath;
widget: IWidgetDefinition;
}
/**
* Widget definition or widget with it's layout path
* @alpha
*/
export type IWidgetOrDefinitionWithLayoutPath = IWidgetWithLayoutPath | IWidgetDefinitionWithLayoutPath;
/**
* @alpha
*/
export function layoutWidgetsWithPaths(layout: Layout): IWidgetWithLayoutPath[];
/**
* @alpha
*/
export function layoutWidgetsWithPaths(layout: LayoutDefinition): IWidgetOrDefinitionWithLayoutPath[];
/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
*
* @alpha
* @param layout - dashboard layout
* @param collectedWidgets - bag for collecting widgets recursively from the layout
* @returns - widgets with layout paths
*/
export function layoutWidgetsWithPaths(
layout: Layout | LayoutDefinition,
): IWidgetOrDefinitionWithLayoutPath[] {
const collectedWidgets: IWidgetOrDefinitionWithLayoutPath[] = [];
walkLayout(layout, {
widgetCallback: (widget, path) =>
collectedWidgets.push({
widget,
path,
}),
});
return collectedWidgets;
};
}
/**
* @alpha
*/
export function layoutWidgets(layout: Layout): IWidget[];
/**
* @alpha
*/
export function layoutWidgets(layout: LayoutDefinition): Array<IWidgetDefinition | IWidget>;
/**
* Get all dashboard widgets
* (layout does not only specify rendering, but also all used widgets)
*
* @alpha
* @param layout - dashboard layout
* @returns - widgets
*/
export function layoutWidgets(layout: Layout | LayoutDefinition): Array<IWidgetDefinition | IWidget> {
const collectedWidgets: Array<IWidgetDefinition | IWidget> = [];
walkLayout(layout, {
widgetCallback: widget => collectedWidgets.push(widget),
});
return collectedWidgets;
}
// (C) 2020 GoodData Corporation
import { ObjRef } from "@gooddata/sdk-model";
import { IDashboardObjectIdentity } from "./common";
/**
* A scheduled email is used to notify a user with an exported dashboard according to a specified time interval
* A scheduled email common properties
* @alpha
*/
export interface IScheduledMailDefinition {
export interface IScheduledMailBase {
/**
* Scheduled email object reference
*/
ref: ObjRef;
/**
* Scheduled email job interval

@@ -80,2 +76,8 @@ */

/**
* A scheduled email is used to notify a user with an exported dashboard according to a specified time interval
* @alpha
*/
export interface IScheduledMailDefinition extends IScheduledMailBase, Partial<IDashboardObjectIdentity> {}
/**
* Supported email attachments

@@ -112,7 +114,2 @@ * @alpha

*/
export type IScheduledMail = IScheduledMailDefinition & {
/**
* Scheduled email object reference
*/
ref: ObjRef;
};
export interface IScheduledMail extends IScheduledMailBase, IDashboardObjectIdentity {}

@@ -6,135 +6,7 @@ // (C) 2020 GoodData Corporation

import { IDashboardFilterReference } from "./filterContext";
import { DrillDefinition } from "./drills";
import { ILegacyKpi } from "./kpi";
import { IDashboardObjectIdentity } from "./common";
/**
* Widget drill definition
* @alpha
*/
export type DrillDefinition = IDrillToInsight | IDrillToDashboard;
/**
* Drill origin type
* @alpha
*/
export type DrillOriginType = "drillFromMeasure";
/**
* Drill origin
* @alpha
*/
export type DrillOrigin = IDrillFromMeasure;
/**
* Drill transition
* @alpha
*/
export type DrillTransition = "pop-up" | "in-place";
/**
* Drill type
* @alpha
*/
export type DrillType = "drillToInsight" | "drillToDashboard" | "drillToLegacyDashboard";
/**
* Drill origin base type
* @alpha
*/
export interface IDrillOrigin {
/**
* Drill origin type
*/
type: DrillOriginType;
}
/**
* Drill from measure
* @alpha
*/
export interface IDrillFromMeasure extends IDrillOrigin {
/**
* Drill origin type
*/
type: "drillFromMeasure";
/**
* Measure object ref
*/
measure: ObjRef;
}
/**
* Drill base type
* @alpha
*/
export interface IDrill {
/**
* Drill type
*/
type: DrillType;
/**
* Drill transition
*/
transition: DrillTransition;
/**
* Drill origin
*/
origin: DrillOrigin;
/**
* Drill target object ref
*/
target: ObjRef;
}
/**
* Drill to PP dashboard
* @alpha
*/
export interface IDrillToLegacyDashboard extends IDrill {
/**
* Drill type
*/
type: "drillToLegacyDashboard";
/**
* Drill transition
*/
transition: "pop-up";
}
/**
* Drill to dashboard
* @alpha
*/
export interface IDrillToDashboard extends IDrill {
/**
* Drill type
*/
type: "drillToDashboard";
/**
* Drill transition
*/
transition: "in-place";
}
/**
* Drill to insight
* @alpha
*/
export interface IDrillToInsight extends IDrill {
/**
* Drill type
*/
type: "drillToInsight";
/**
* Drill transition
*/
transition: "pop-up";
}
/**
* Temporary type to distinguish between kpi and insight

@@ -149,3 +21,3 @@ * @alpha

*/
export interface IWidgetDefinition {
export interface IWidgetBase {
/**

@@ -182,2 +54,7 @@ * Widget title

/**
* Temporary place for legacy kpi properties
*/
readonly kpi?: ILegacyKpi;
/**
* Widget drills

@@ -194,20 +71,22 @@ */

/**
* See {@link IWidgetDefinition}]
* See {@link IWidget}]
* @alpha
*/
export interface IWidget extends IWidgetDefinition {
/**
* Visualization widget or kpi object ref
*/
readonly ref: ObjRef;
export interface IWidgetDefinition extends IWidgetBase, Partial<IDashboardObjectIdentity> {}
/**
* Visualization widget or kpi uri
*/
readonly uri: string;
/**
* @alpha
*/
export interface IWidget extends IWidgetBase, IDashboardObjectIdentity {}
/**
* Visualization widget or kpi identifier
*/
readonly identifier: string;
/**
* Type-guard testing whether the provided object is an instance of {@link IWidgetDefinition}.
* @alpha
*/
export function isWidgetDefinition(obj: any): obj is IWidgetDefinition {
return (
!isEmpty(obj) &&
((obj as IWidgetDefinition).type === "kpi" || (obj as IWidgetDefinition).type === "insight") &&
!(obj as IWidget).ref
);
}

@@ -220,3 +99,7 @@

export function isWidget(obj: any): obj is IWidget {
return !isEmpty(obj) && ((obj as IWidget).type === "kpi" || (obj as IWidget).type === "insight");
return (
!isEmpty(obj) &&
((obj as IWidget).type === "kpi" || (obj as IWidget).type === "insight") &&
!!(obj as IWidget).ref
);
}

Sorry, the diff of this file is too big to display

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