From aff0ad1ca0d012aaadc0ec30527b8976c6eed17b Mon Sep 17 00:00:00 2001 From: Nerya Cohen Date: Sun, 18 Oct 2020 10:00:09 +0000 Subject: [PATCH 01/23] Merged PR 119925: Add support for bookmark capture options Add support for bookmark capture options so users will be able to save changes to visuals (personalized visuals). --- dist/powerbi-client.d.ts | 14 ++- dist/powerbi.js | 96 +++++++++++++-- dist/powerbi.min.js | 12 +- package.json | 4 +- src/bookmarksManager.ts | 245 ++++++++++++++++++++------------------- src/config.ts | 2 +- 6 files changed, 231 insertions(+), 142 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 865d5df8..a795e3b5 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.14.1 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.0 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** @@ -1812,7 +1812,7 @@ declare module "bookmarksManager" { getBookmarks(): Promise; apply(bookmarkName: string): Promise; play(playMode: models.BookmarksPlayMode): Promise; - capture(): Promise; + capture(options?: models.ICaptureBookmarkOptions): Promise; applyState(state: string): Promise; } /** @@ -1851,6 +1851,7 @@ declare module "bookmarksManager" { * bookmarksManager.apply(bookmarkName) * ``` * + * @param {string} bookmarkName The name of the bookmark to be applied * @returns {Promise} */ apply(bookmarkName: string): Promise; @@ -1859,9 +1860,10 @@ declare module "bookmarksManager" { * * ```javascript * // Enter presentation mode. - * bookmarksManager.play(true) + * bookmarksManager.play(models.BookmarksPlayMode.Presentation) * ``` * + * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` * @returns {Promise} */ play(playMode: models.BookmarksPlayMode): Promise; @@ -1869,12 +1871,13 @@ declare module "bookmarksManager" { * Capture bookmark from current state. * * ```javascript - * bookmarksManager.capture() + * bookmarksManager.capture(options) * ``` * + * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing * @returns {Promise} */ - capture(): Promise; + capture(options?: models.ICaptureBookmarkOptions): Promise; /** * Apply bookmark state. * @@ -1882,6 +1885,7 @@ declare module "bookmarksManager" { * bookmarksManager.applyState(bookmarkState) * ``` * + * @param {string} state A base64 bookmark state to be applied * @returns {Promise} */ applyState(state: string): Promise; diff --git a/dist/powerbi.js b/dist/powerbi.js index bb9dc4b0..928dee71 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.14.1 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.0 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -1303,7 +1303,7 @@ return /******/ (function(modules) { // webpackBootstrap /** @ignore */ /** */ var config = { - version: '2.14.1', + version: '2.15.0', type: 'js' }; Object.defineProperty(exports, "__esModule", { value: true }); @@ -1314,7 +1314,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 5 */ /***/ (function(module, exports, __webpack_require__) { - /*! powerbi-models v1.4.0 | (c) 2016 Microsoft Corporation MIT */ + /*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); @@ -1429,7 +1429,7 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = exports.Validators = void 0; + exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = exports.Validators = void 0; exports.Validators = __webpack_require__(1).Validators; var TraceType; (function (TraceType) { @@ -1857,6 +1857,11 @@ return /******/ (function(modules) { // webpackBootstrap return !!(arg.table && arg.column && arg.aggregationFunction); } exports.isColumnAggr = isColumnAggr; + var PageNavigationPosition; + (function (PageNavigationPosition) { + PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; + PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; + })(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); var QnaMode; (function (QnaMode) { QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; @@ -2047,6 +2052,11 @@ return /******/ (function(modules) { // webpackBootstrap return errors ? errors.map(normalizeError) : undefined; } exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; + function validateCaptureBookmarkRequest(input) { + var errors = exports.Validators.captureBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; function validateSettings(input) { var errors = exports.Validators.settingsValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; @@ -2222,6 +2232,8 @@ return /******/ (function(modules) { // webpackBootstrap booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), booleanValidator: new typeValidator_1.BooleanValidator(), bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), + captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), + captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), @@ -2264,6 +2276,7 @@ return /******/ (function(modules) { // webpackBootstrap numberValidator: new typeValidator_1.NumberValidator(), pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), + pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), pageSizeValidator: new pageValidator_1.PageSizeValidator(), pageValidator: new pageValidator_1.PageValidator(), @@ -2839,6 +2852,10 @@ return /******/ (function(modules) { // webpackBootstrap field: "panes", validators: [validator_1.Validators.reportPanesValidator] }, + { + field: "personalBookmarksEnabled", + validators: [validator_1.Validators.booleanValidator] + }, { field: "persistentFiltersEnabled", validators: [validator_1.Validators.booleanValidator] @@ -2874,7 +2891,7 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; + exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; var validator_1 = __webpack_require__(1); var multipleFieldsValidator_1 = __webpack_require__(4); var typeValidator_1 = __webpack_require__(2); @@ -2986,6 +3003,56 @@ return /******/ (function(modules) { // webpackBootstrap return ApplyBookmarkStateRequestValidator; }(typeValidator_1.ObjectValidator)); exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; + var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkOptionsValidator, _super); + function CaptureBookmarkOptionsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "personalizeVisuals", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkOptionsValidator; + }(typeValidator_1.ObjectValidator)); + exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; + var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkRequestValidator, _super); + function CaptureBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "options", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; /***/ }), @@ -5102,6 +5169,10 @@ return /******/ (function(modules) { // webpackBootstrap field: "visible", validators: [validator_1.Validators.booleanValidator] }, + { + field: "position", + validators: [validator_1.Validators.pageNavigationPositionValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); @@ -6174,6 +6245,7 @@ return /******/ (function(modules) { // webpackBootstrap * bookmarksManager.apply(bookmarkName) * ``` * + * @param {string} bookmarkName The name of the bookmark to be applied * @returns {Promise} */ BookmarksManager.prototype.apply = function (bookmarkName) { @@ -6193,9 +6265,10 @@ return /******/ (function(modules) { // webpackBootstrap * * ```javascript * // Enter presentation mode. - * bookmarksManager.play(true) + * bookmarksManager.play(models.BookmarksPlayMode.Presentation) * ``` * + * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` * @returns {Promise} */ BookmarksManager.prototype.play = function (playMode) { @@ -6214,16 +6287,20 @@ return /******/ (function(modules) { // webpackBootstrap * Capture bookmark from current state. * * ```javascript - * bookmarksManager.capture() + * bookmarksManager.capture(options) * ``` * + * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing * @returns {Promise} */ - BookmarksManager.prototype.capture = function () { + BookmarksManager.prototype.capture = function (options) { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.service.hpm.post("/report/bookmarks/capture", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + var request = { + options: options + }; + return this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) .then(function (response) { return response.body; }, function (response) { throw response.body; }); @@ -6235,6 +6312,7 @@ return /******/ (function(modules) { // webpackBootstrap * bookmarksManager.applyState(bookmarkState) * ``` * + * @param {string} state A base64 bookmark state to be applied * @returns {Promise} */ BookmarksManager.prototype.applyState = function (state) { diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index ba276eea..acad7c24 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,9 +1,9 @@ -/*! powerbi-client v2.14.1 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.14.1",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.4.0 | (c) 2016 Microsoft Corporation MIT */ -!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===ot.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?ot.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?ot.Advanced:ot.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var H=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var z;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(z=e.TraceType||(e.TraceType={}));var J;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(J=e.PageSizeType||(e.PageSizeType={}));var Q;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Q=e.DisplayOption||(e.DisplayOption={}));var Y;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(Y=e.BackgroundType||(e.BackgroundType={}));var K;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(K=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var G;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(G=e.LayoutType||(e.LayoutType={}));var $;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}($=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var X;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(X=e.SectionVisibility||(e.SectionVisibility={}));var Z;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(Z=e.Permissions||(e.Permissions={}));var tt;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(tt=e.ViewMode||(e.ViewMode={}));var et;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(et=e.TokenType||(e.TokenType={}));var rt;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(rt=e.ContrastMode||(e.ContrastMode={}));var at;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(at=e.MenuLocation||(e.MenuLocation={}));var it;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(it=e.FiltersLevel||(e.FiltersLevel={}));var ot;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(ot=e.FilterType||(e.FilterType={}));var nt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(nt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var lt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(lt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var dt=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=dt;var st=function(t){function e(r,a,i){var o=t.call(this,r,ot.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(dt);e.NotSupportedFilter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,ot.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(dt);e.IncludeExcludeFilter=ut;var pt=function(t){function e(r,a,i,o){var n=t.call(this,r,ot.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(dt);e.TopNFilter=pt;var ct=function(t){function e(r,a,i,o,n){var l=t.call(this,r,ot.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(dt);e.RelativeDateFilter=ct;var ft=function(t){function e(r,a,i,o){var n=t.call(this,r,ot.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(dt);e.RelativeTimeFilter=ft;var vt=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(dt);e.AdvancedFilter=mt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var Vt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(Vt=e.QnaMode||(e.QnaMode={}));var gt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(gt=e.ExportDataType||(e.ExportDataType={}));var wt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(wt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var bt;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(bt=e.SortDirection||(e.SortDirection={}));var Pt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Pt;var St=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Pt);e.PageSelector=St;var Tt=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Pt);e.VisualSelector=Tt;var Et=function(t){function e(e){var r=t.call(this,Tt.schemaUrl)||this;return r.visualType=e,r}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Pt);e.VisualTypeSelector=Et;var Ot=function(t){function e(e){var r=t.call(this,Tt.schemaUrl)||this;return r.target=e,r}return H(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Pt);e.SlicerTargetSelector=Ot;var _t;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(_t=e.CommandDisplayOption||(e.CommandDisplayOption={}));var Ft;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(Ft=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Rt;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Rt=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateSettings=g,e.validatePanes=w,e.validateBookmarksPane=b,e.validateFiltersPane=P,e.validateFieldsPane=S,e.validatePageNavigationPane=T,e.validateSelectionPane=E,e.validateSyncSlicersPane=O,e.validateVisualizationsPane=_,e.validateCustomPageSize=F,e.validateExtension=R,e.validateReportLoad=A,e.validateCreateReport=k,e.validateDashboardLoad=C,e.validateTileLoad=x,e.validatePage=M,e.validateFilter=I,e.validateSaveAsParameters=q,e.validateLoadQnaConfiguration=L,e.validateQnaInterpretInputData=j,e.validateExportDataRequest=N,e.validateVisualHeader=D,e.validateVisualSettings=U,e.validateCommandsSettings=B,e.validateCustomTheme=W},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.0",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ +!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var At;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(At=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=A,e.validateCreateReport=C,e.validateDashboardLoad=x,e.validateTileLoad=M,e.validatePage=q,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a2&&"[]"===n.slice(l-2)&&(d=!0,n=n.slice(0,l-2),r[n]||(r[n]=[])),i=o[1]?w(o[1]):""),d?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(a=t.indexOf("?"),a!==-1){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r; - apply(bookmarkName: string): Promise; - play(playMode: models.BookmarksPlayMode): Promise; - - capture(): Promise; - applyState(state: string): Promise; + getBookmarks(): Promise; + apply(bookmarkName: string): Promise; + play(playMode: models.BookmarksPlayMode): Promise; + capture(options?: models.ICaptureBookmarkOptions): Promise; + applyState(state: string): Promise; } /** @@ -27,128 +26,136 @@ export interface IBookmarksManager { * @implements {IBookmarksManager} */ export class BookmarksManager implements IBookmarksManager { - /** - * @hidden - */ - constructor(private service: service.Service, private config: embed.IEmbedConfigurationBase, private iframe?: HTMLIFrameElement) { + /** + * @hidden + */ + constructor(private service: service.Service, private config: embed.IEmbedConfigurationBase, private iframe?: HTMLIFrameElement) { + } + + /** + * Gets bookmarks that are defined in the report. + * + * ```javascript + * // Gets bookmarks that are defined in the report + * bookmarksManager.getBookmarks() + * .then(bookmarks => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + getBookmarks(): Promise { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); } - /** - * Gets bookmarks that are defined in the report. - * - * ```javascript - * // Gets bookmarks that are defined in the report - * bookmarksManager.getBookmarks() - * .then(bookmarks => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - getBookmarks(): Promise { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - - return this.service.hpm.get(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + return this.service.hpm.get(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(response => response.body, + response => { + throw response.body; + }); + } + + /** + * Apply bookmark by name. + * + * ```javascript + * bookmarksManager.apply(bookmarkName) + * ``` + * + * @param {string} bookmarkName The name of the bookmark to be applied + * @returns {Promise} + */ + apply(bookmarkName: string): Promise { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); } - /** - * Apply bookmark by name. - * - * ```javascript - * bookmarksManager.apply(bookmarkName) - * ``` - * - * @returns {Promise} - */ - apply(bookmarkName: string): Promise { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - - var request: models.IApplyBookmarkByNameRequest = { - name: bookmarkName - }; - - return this.service.hpm.post(`/report/bookmarks/applyByName`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + var request: models.IApplyBookmarkByNameRequest = { + name: bookmarkName + }; + + return this.service.hpm.post(`/report/bookmarks/applyByName`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(response => { + throw response.body; + }); + } + + /** + * Play bookmarks: Enter or Exit bookmarks presentation mode. + * + * ```javascript + * // Enter presentation mode. + * bookmarksManager.play(models.BookmarksPlayMode.Presentation) + * ``` + * + * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` + * @returns {Promise} + */ + play(playMode: models.BookmarksPlayMode): Promise { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); } - /** - * Play bookmarks: Enter or Exit bookmarks presentation mode. - * - * ```javascript - * // Enter presentation mode. - * bookmarksManager.play(true) - * ``` - * - * @returns {Promise} - */ - play(playMode: models.BookmarksPlayMode): Promise { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - - var playBookmarkRequest: models.IPlayBookmarkRequest = { - playMode: playMode - }; - - return this.service.hpm.post(`/report/bookmarks/play`, playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + var playBookmarkRequest: models.IPlayBookmarkRequest = { + playMode: playMode + }; + + return this.service.hpm.post(`/report/bookmarks/play`, playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(response => { + throw response.body; + }); + } + + /** + * Capture bookmark from current state. + * + * ```javascript + * bookmarksManager.capture(options) + * ``` + * + * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing + * @returns {Promise} + */ + capture(options?: models.ICaptureBookmarkOptions): Promise { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); } - /** - * Capture bookmark from current state. - * - * ```javascript - * bookmarksManager.capture() - * ``` - * - * @returns {Promise} - */ - capture(): Promise { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - - return this.service.hpm.post(`/report/bookmarks/capture`, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); - } + var request: models.ICaptureBookmarkRequest = { + options: options + }; - /** - * Apply bookmark state. - * - * ```javascript - * bookmarksManager.applyState(bookmarkState) - * ``` - * - * @returns {Promise} - */ - applyState(state: string): Promise { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - - var request: models.IApplyBookmarkStateRequest = { - state: state - }; - - return this.service.hpm.post(`/report/bookmarks/applyState`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { + return this.service.hpm.post(`/report/bookmarks/capture`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(response => response.body, + response => { throw response.body; - }); + }); + } + + /** + * Apply bookmark state. + * + * ```javascript + * bookmarksManager.applyState(bookmarkState) + * ``` + * + * @param {string} state A base64 bookmark state to be applied + * @returns {Promise} + */ + applyState(state: string): Promise { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); } + + var request: models.IApplyBookmarkStateRequest = { + state: state + }; + + return this.service.hpm.post(`/report/bookmarks/applyState`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(response => { + throw response.body; + }); + } } diff --git a/src/config.ts b/src/config.ts index 14cb1aee..4413bc5c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,6 @@ /** @ignore *//** */ const config = { - version: '2.14.1', + version: '2.15.0', type: 'js' }; From 24dd64d37b4d7c7216ef3ee7612fc4d6ad46d1eb Mon Sep 17 00:00:00 2001 From: Anant Singh Date: Wed, 21 Oct 2020 13:38:31 +0000 Subject: [PATCH 02/23] Merged PR 121530: Added missing properties from IReportLoadConfig in IEmbedConfig Updated IEmbedConfiguration interface: 1. Added _datasetBinding_, _contrastMode_, _slicers_ and _bookmark_ properties --- dist/powerbi-client.d.ts | 4 ++++ src/embed.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index a795e3b5..a1232011 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -173,6 +173,10 @@ declare module "embed" { height?: number; width?: number; theme?: models.IReportTheme; + slicers?: models.ISlicer[]; + bookmark?: models.IApplyBookmarkRequest; + datasetBinding?: models.IDatasetBinding; + contrastMode?: models.ContrastMode; } export interface IVisualEmbedConfiguration extends IEmbedConfiguration { visualName: string; diff --git a/src/embed.ts b/src/embed.ts index 13c422e4..dcdd47e6 100644 --- a/src/embed.ts +++ b/src/embed.ts @@ -72,6 +72,10 @@ export interface IEmbedConfiguration extends IEmbedConfigurationBase { height?: number; width?: number; theme?: models.IReportTheme; + slicers?: models.ISlicer[]; + bookmark?: models.IApplyBookmarkRequest; + datasetBinding?: models.IDatasetBinding; + contrastMode?: models.ContrastMode; } export interface IVisualEmbedConfiguration extends IEmbedConfiguration { From 8118a1343e389907423a944460c00748465f7728 Mon Sep 17 00:00:00 2001 From: Guy Moses Date: Tue, 10 Nov 2020 10:15:25 +0000 Subject: [PATCH 03/23] Merged PR 126401: [JS samples][minor] Fixed error/errors typo In several places in our samples, the error handling code uses different names for the same variable (`error` vs. `errors`): ``` .catch(function (error) { Log.log(errors); }); ``` This causes an exception if there's an error --- demo/v2-demo/scripts/codesamples.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/demo/v2-demo/scripts/codesamples.js b/demo/v2-demo/scripts/codesamples.js index 7f2c0553..c7cd743d 100644 --- a/demo/v2-demo/scripts/codesamples.js +++ b/demo/v2-demo/scripts/codesamples.js @@ -891,7 +891,7 @@ function _Report_UpdateSettings() { Log.logText("Filter pane was removed."); }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -1342,7 +1342,7 @@ function _Report_ApplyCustomLayout() { Log.logText("Custom layout applied, to remove custom layout, reload the report using 'Reload' API.") }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -1374,7 +1374,7 @@ function _Report_HideAllVisualHeaders() { Log.logText("Visual header was successfully hidden for all the visuals in the report."); }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -1406,7 +1406,7 @@ function _Report_ShowAllVisualHeaders() { Log.logText("Visual header was successfully shown for all the visuals in the report."); }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -1450,7 +1450,7 @@ function _Report_HideSingleVisualHeader() { Log.logText("Visual header was successfully hidden for 'Category Breakdown' visual."); }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -1598,7 +1598,7 @@ function _Report_Extensions_OptionsMenu() { // Update the settings by passing in the new settings you have configured. report.updateSettings(newSettings) .catch(function (error) { - Log.log(errors); + Log.log(error); }); // Report.on will add an event handler to commandTriggered event which prints to console window. @@ -1644,7 +1644,7 @@ function _Report_Extensions_ContextMenu() { // Update the settings by passing in the new settings you have configured. report.updateSettings(newSettings) .catch(function (error) { - Log.log(errors); + Log.log(error); }); // Report.on will add an event handler to commandTriggered event which prints to console window. @@ -2231,7 +2231,7 @@ function _Bookmarks_Enable() { // Update the settings by passing in the new settings you have configured. report.updateSettings(newSettings) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -2254,7 +2254,7 @@ function _Bookmarks_Disable() { // Update the settings by passing in the new settings you have configured. report.updateSettings(newSettings) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -2726,7 +2726,7 @@ function _ReportVisual_UpdateSettings() { Log.logText("Filter pane was added."); }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } @@ -2769,7 +2769,7 @@ function _ReportVisual_HideSingleVisualHeader() { Log.logText("Visual header was successfully hidden for 'Sentiment by Year and Months' visual."); }) .catch(function (error) { - Log.log(errors); + Log.log(error); }); } From cab823b42e69013b68846342b4c3ff7fa7799d8f Mon Sep 17 00:00:00 2001 From: Shahak Yosef Date: Tue, 10 Nov 2020 11:41:49 +0000 Subject: [PATCH 04/23] Merged PR 126402: Add Visual clicked and selection changed events Add Visual clicked and selection changed events --- dist/powerbi.js | 2 +- dist/powerbi.min.js | 4 ++-- src/report.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/powerbi.js b/dist/powerbi.js index 928dee71..d49725ed 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -5854,7 +5854,7 @@ return /******/ (function(modules) { // webpackBootstrap return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); }; /** @hidden */ - Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered"]; + Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; /** @hidden */ Report.reportIdAttribute = 'powerbi-report-id'; /** @hidden */ diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index acad7c24..9e18aac7 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,8 +1,8 @@ /*! powerbi-client v2.15.0 | (c) 2016 Microsoft Corporation MIT */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.0",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ -!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var At;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(At=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=A,e.validateCreateReport=C,e.validateDashboardLoad=x,e.validateTileLoad=M,e.validatePage=q,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=M,e.validatePage=q,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a Date: Thu, 12 Nov 2020 09:51:18 +0000 Subject: [PATCH 05/23] Merged PR 127127: [Release] version 2.15.1 Bug fix - !126401 And some minor changes - !126402 - !121530 --- dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 4 ++-- dist/powerbi.min.js | 4 ++-- package.json | 2 +- src/config.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index a1232011..c1dd08e0 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.15.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index d49725ed..d149d6c1 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.15.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -1303,7 +1303,7 @@ return /******/ (function(modules) { // webpackBootstrap /** @ignore */ /** */ var config = { - version: '2.15.0', + version: '2.15.1', type: 'js' }; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 9e18aac7..e0f193dd 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,5 +1,5 @@ -/*! powerbi-client v2.15.0 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.0",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.1",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ !function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=M,e.validatePage=q,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a Date: Sun, 15 Nov 2020 15:42:16 +0000 Subject: [PATCH 06/23] Merged PR 127536: Adds getVisualDetails API Added getVisualDetails API to get the visual descriptor object for the embedded visual --- dist/powerbi-client.d.ts | 12 +++++++++ dist/powerbi.js | 33 ++++++++++++++++++++++++ dist/powerbi.min.js | 2 +- src/visual.ts | 39 ++++++++++++++++++++++++++++ test/test.spec.ts | 55 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+), 1 deletion(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index c1dd08e0..9129749a 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1475,6 +1475,7 @@ declare module "visual" { import * as models from 'powerbi-models'; import { Report } from "report"; import { Page } from "page"; + import { VisualDescriptor } from "visualDescriptor"; /** * The Power BI Visual embed component * @@ -1511,6 +1512,17 @@ declare module "visual" { * @returns {Promise} */ setPage(pageName: string): Promise; + /** + * Gets the embedded visual descriptor object that contains the visual name, type, etc. + * + * ```javascript + * visual.getVisualDescriptor() + * .then(visualDetails => { ... }); + * ``` + * + * @returns {Promise} + */ + getVisualDescriptor(): Promise; /** * Gets filters that are applied to the filter level. * Default filter level is visual level. diff --git a/dist/powerbi.js b/dist/powerbi.js index d149d6c1..4e8eb474 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -6747,6 +6747,7 @@ return /******/ (function(modules) { // webpackBootstrap }; var models = __webpack_require__(5); var report_1 = __webpack_require__(7); + var visualDescriptor_1 = __webpack_require__(9); /** * The Power BI Visual embed component * @@ -6834,6 +6835,38 @@ return /******/ (function(modules) { // webpackBootstrap Visual.prototype.setPage = function (pageName) { throw Visual.SetPageNotSupportedError; }; + /** + * Gets the embedded visual descriptor object that contains the visual name, type, etc. + * + * ```javascript + * visual.getVisualDescriptor() + * .then(visualDetails => { ... }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getVisualDescriptor = function () { + var _this = this; + var config = this.config; + return this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + // Find the embedded visual from visuals of this page + // TODO: Use the Array.find method when ES6 is available + var embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); + if (embeddedVisuals.length === 0) { + var visualNotFoundError = { + message: "visualNotFound", + detailedMessage: "Visual not found" + }; + throw visualNotFoundError; + } + var embeddedVisual = embeddedVisuals[0]; + var currentPage = _this.page(config.pageName); + return new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); + }, function (response) { + throw response.body; + }); + }; /** * Gets filters that are applied to the filter level. * Default filter level is visual level. diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index e0f193dd..2391ed50 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -3,7 +3,7 @@ !function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=M,e.validatePage=q,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a2&&"[]"===n.slice(l-2)&&(d=!0,n=n.slice(0,l-2),r[n]||(r[n]=[])),i=o[1]?w(o[1]):""),d?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(a=t.indexOf("?"),a!==-1){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r { ... }); + * ``` + * + * @returns {Promise} + */ + getVisualDescriptor(): Promise { + const config = this.config; + + return this.service.hpm.get(`/report/pages/${config.pageName}/visuals`, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(response => { + // Find the embedded visual from visuals of this page + // TODO: Use the Array.find method when ES6 is available + const embeddedVisuals = response.body.filter(pageVisual => pageVisual.name === config.visualName); + + if (embeddedVisuals.length === 0) { + const visualNotFoundError: models.IError = { + message: "visualNotFound", + detailedMessage: "Visual not found" + }; + + throw visualNotFoundError; + } + + const embeddedVisual = embeddedVisuals[0]; + const currentPage = this.page(config.pageName); + return new VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); + }, response => { + throw response.body; + }); + } + /** * Gets filters that are applied to the filter level. * Default filter level is visual level. diff --git a/test/test.spec.ts b/test/test.spec.ts index dc0f584c..0ad7df85 100644 --- a/test/test.spec.ts +++ b/test/test.spec.ts @@ -3132,6 +3132,61 @@ describe('SDK-to-HPM', function () { // Assert expect(attempt).toThrow(visual.Visual.SetPageNotSupportedError); }); + + describe('getVisualDescriptor', function () { + it('embeddedVisual.getVisualDescriptor() sends GET /report/pages/xyz/visuals', function () { + // Arrange + + // Act + embeddedVisual.getVisualDescriptor(); + + // Assert + expect(spyHpm.get).toHaveBeenCalledWith(`/report/pages/ReportSection1/visuals`, { uid: visualUniqueId }, visualFrame.contentWindow); + }); + + it('embeddedVisual.getVisualDescriptor() returns promise that rejects with server error if there was error getting visual details', function (done) { + // Arrange + const testData = { + expectedError: { + body: { + message: 'internal server error' + } + } + }; + + spyHpm.get.and.returnValue(Promise.reject(testData.expectedError)); + + // Act + embeddedVisual.getVisualDescriptor() + .catch(error => { + // Assert + expect(spyHpm.get).toHaveBeenCalledWith(`/report/pages/ReportSection1/visuals`, { uid: visualUniqueId }, visualFrame.contentWindow); + expect(error).toEqual(testData.expectedError.body); + done(); + }); + }); + + it('embeddedVisual.getVisualDescriptor() returns promise that resolves with visual details', function (done) { + // Arrange + const fakeVisualDescriptor = new visualDescriptor.VisualDescriptor(page1, visualEmbedConfiguration.visualName, 'title', 'type', {}); + const testData = { + expectedResponse: { + body: [fakeVisualDescriptor] + } + }; + + spyHpm.get.and.returnValue(Promise.resolve(testData.expectedResponse)); + + // Act + embeddedVisual.getVisualDescriptor() + .then(visualDescriptor => { + // Assert + expect(spyHpm.get).toHaveBeenCalledWith(`/report/pages/ReportSection1/visuals`, { uid: visualUniqueId }, visualFrame.contentWindow); + expect(visualDescriptor.name).toEqual(fakeVisualDescriptor.name); + done(); + }); + }); + }); }); describe('pages', function () { From 7bb83ed2c2f4e3679b94c9124c6a1d0c44d71951 Mon Sep 17 00:00:00 2001 From: Hyunmo Kang Date: Tue, 17 Nov 2020 13:19:44 +0000 Subject: [PATCH 07/23] Merged PR 126990: Add a page renaming api to both report and page - add renamePage api in report - add setName api to page.ts; update renamePage to PUT REST api call; - update tests for page.setName and report.renamePage Related work items: #442373 --- dist/powerbi-client.d.ts | 25 +- dist/powerbi.js | 13660 +++++++++++++++++++------------------ dist/powerbi.min.js | 6 +- src/page.ts | 21 + src/report.ts | 29 +- test/test.spec.ts | 41 +- 6 files changed, 6965 insertions(+), 6817 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 9129749a..77f7970d 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -889,6 +889,16 @@ declare module "page" { * @returns {Promise} */ setFilters(filters: models.IFilter[]): Promise; + /** + * Set displayName to the current page. + * + * ```javascript + * page.setName(displayName); + * ``` + * + * @returns {Promise} + */ + setDisplayName(displayName: string): Promise; /** * Gets all the visuals on the page. * @@ -1007,12 +1017,23 @@ declare module "report" { * * ```javascript * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) - * report.deletePage("Sales145"); + * report.deletePage("ReportSection145"); + * ``` + * + * @returns {Promise} + */ + deletePage(pageName: string): Promise; + /** + * Rename a page from a report + * + * ```javascript + * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) + * report.renamePage("ReportSection145", "Sales"); * ``` * * @returns {Promise} */ - deletePage(pageName?: string): Promise; + renamePage(pageName: string, displayName: string): Promise; /** * Gets filters that are applied at the report level. * diff --git a/dist/powerbi.js b/dist/powerbi.js index 4e8eb474..990f29dd 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -55,1259 +55,1259 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, exports, __webpack_require__) { - /** - * @hidden - */ - var service = __webpack_require__(1); - exports.service = service; - var factories = __webpack_require__(16); - exports.factories = factories; - var models = __webpack_require__(5); - exports.models = models; - var report_1 = __webpack_require__(7); - exports.Report = report_1.Report; - var dashboard_1 = __webpack_require__(12); - exports.Dashboard = dashboard_1.Dashboard; - var tile_1 = __webpack_require__(13); - exports.Tile = tile_1.Tile; - var embed_1 = __webpack_require__(2); - exports.Embed = embed_1.Embed; - var page_1 = __webpack_require__(8); - exports.Page = page_1.Page; - var qna_1 = __webpack_require__(14); - exports.Qna = qna_1.Qna; - var visual_1 = __webpack_require__(15); - exports.Visual = visual_1.Visual; - var visualDescriptor_1 = __webpack_require__(9); - exports.VisualDescriptor = visualDescriptor_1.VisualDescriptor; - /** - * Makes Power BI available to the global object for use in applications that don't have module loading support. - * - * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service. - */ - var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); - window.powerbi = powerbi; + /** + * @hidden + */ + var service = __webpack_require__(1); + exports.service = service; + var factories = __webpack_require__(16); + exports.factories = factories; + var models = __webpack_require__(5); + exports.models = models; + var report_1 = __webpack_require__(7); + exports.Report = report_1.Report; + var dashboard_1 = __webpack_require__(12); + exports.Dashboard = dashboard_1.Dashboard; + var tile_1 = __webpack_require__(13); + exports.Tile = tile_1.Tile; + var embed_1 = __webpack_require__(2); + exports.Embed = embed_1.Embed; + var page_1 = __webpack_require__(8); + exports.Page = page_1.Page; + var qna_1 = __webpack_require__(14); + exports.Qna = qna_1.Qna; + var visual_1 = __webpack_require__(15); + exports.Visual = visual_1.Visual; + var visualDescriptor_1 = __webpack_require__(9); + exports.VisualDescriptor = visualDescriptor_1.VisualDescriptor; + /** + * Makes Power BI available to the global object for use in applications that don't have module loading support. + * + * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service. + */ + var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); + window.powerbi = powerbi; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { - var embed = __webpack_require__(2); - var report_1 = __webpack_require__(7); - var create_1 = __webpack_require__(11); - var dashboard_1 = __webpack_require__(12); - var tile_1 = __webpack_require__(13); - var page_1 = __webpack_require__(8); - var qna_1 = __webpack_require__(14); - var visual_1 = __webpack_require__(15); - var utils = __webpack_require__(3); - /** - * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application - * - * @export - * @class Service - * @implements {IService} - */ - var Service = (function () { - /** - * Creates an instance of a Power BI Service. - * - * @param {IHpmFactory} hpmFactory The http post message factory used in the postMessage communication layer - * @param {IWpmpFactory} wpmpFactory The window post message factory used in the postMessage communication layer - * @param {IRouterFactory} routerFactory The router factory used in the postMessage communication layer - * @param {IServiceConfiguration} [config={}] - * @hidden - */ - function Service(hpmFactory, wpmpFactory, routerFactory, config) { - var _this = this; - if (config === void 0) { config = {}; } - this.wpmp = wpmpFactory(config.wpmpName, config.logMessages); - this.hpm = hpmFactory(this.wpmp, null, config.version, config.type); - this.router = routerFactory(this.wpmp); - this.uniqueSessionId = utils.generateUUID(); - /** - * Adds handler for report events. - */ - this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'dashboard', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'tile', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - /** - * Adds handler for Q&A events. - */ - this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'qna', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - /** - * Adds handler for front load 'ready' message. - */ - this.router.post("/ready/:uniqueId", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: 'ready', - value: req.body - }; - _this.handleEvent(event); - }); - this.embeds = []; - // TODO: Change when Object.assign is available. - this.config = utils.assign({}, Service.defaultConfig, config); - if (this.config.autoEmbedOnContentLoaded) { - this.enableAutoEmbed(); - } - } - /** - * Creates new report - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.createReport = function (element, config) { - config.type = 'create'; - var powerBiElement = element; - var component = new create_1.Create(this, powerBiElement, config); - powerBiElement.powerBiEmbed = component; - this.addOrOverwriteEmbed(component, element); - return component; - }; - /** - * TODO: Add a description here - * - * @param {HTMLElement} [container] - * @param {embed.IEmbedConfiguration} [config=undefined] - * @returns {embed.Embed[]} - * @hidden - */ - Service.prototype.init = function (container, config) { - var _this = this; - if (config === void 0) { config = undefined; } - container = (container && container instanceof HTMLElement) ? container : document.body; - var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]")); - return elements.map(function (element) { return _this.embed(element, config); }); - }; - /** - * Given a configuration based on an HTML element, - * if the component has already been created and attached to the element, reuses the component instance and existing iframe, - * otherwise creates a new component instance. - * - * @param {HTMLElement} element - * @param {embed.IEmbedConfigurationBase} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.embed = function (element, config) { - if (config === void 0) { config = {}; } - return this.embedInternal(element, config); - }; - /** - * Given a configuration based on an HTML element, - * if the component has already been created and attached to the element, reuses the component instance and existing iframe, - * otherwise creates a new component instance. - * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. - * - * @param {HTMLElement} element - * @param {embed.IEmbedConfigurationBase} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.load = function (element, config) { - if (config === void 0) { config = {}; } - return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); - }; - /** - * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. - * - * @param {HTMLElement} element - * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. - */ - Service.prototype.bootstrap = function (element, config) { - return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); - }; - /** @hidden */ - Service.prototype.embedInternal = function (element, config, phasedRender, isBootstrap) { - if (config === void 0) { config = {}; } - var component; - var powerBiElement = element; - if (powerBiElement.powerBiEmbed) { - if (isBootstrap) { - throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element."); - } - component = this.embedExisting(powerBiElement, config, phasedRender); - } - else { - component = this.embedNew(powerBiElement, config, phasedRender, isBootstrap); - } - return component; - }; - /** @hidden */ - Service.prototype.getNumberOfComponents = function () { - if (!this.embeds) { - return 0; - } - return this.embeds.length; - }; - /** @hidden */ - Service.prototype.getSdkSessionId = function () { - return this.uniqueSessionId; - }; - /** - * Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup. - * - * @private - * @param {IPowerBiElement} element - * @param {embed.IEmbedConfigurationBase} config - * @returns {embed.Embed} - * @hidden - */ - Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) { - var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); - if (!componentType) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'."); - } - // Saves the type as part of the configuration so that it can be referenced later at a known location. - config.type = componentType; - var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components); - if (!Component) { - throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended."); - } - var component = new Component(this, element, config, phasedRender, isBootstrap); - element.powerBiEmbed = component; - this.addOrOverwriteEmbed(component, element); - return component; - }; - /** - * Given an element that already contains an embed component, load with a new configuration. - * - * @private - * @param {IPowerBiElement} element - * @param {embed.IEmbedConfigurationBase} config - * @returns {embed.Embed} - * @hidden - */ - Service.prototype.embedExisting = function (element, config, phasedRender) { - var component = utils.find(function (x) { return x.element === element; }, this.embeds); - if (!component) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); - } - // TODO: Multiple embedding to the same iframe is not supported in QnA - if (config.type && config.type.toLowerCase() === "qna") { - return this.embedNew(element, config); - } - /** - * TODO: Dynamic embed type switching could be supported but there is work needed to prepare the service state and DOM cleanup. - * remove all event handlers from the DOM, then reset the element to initial state which removes iframe, and removes from list of embeds - * then we can call the embedNew function which would allow setting the proper embedUrl and construction of object based on the new type. - */ - if (typeof config.type === "string" && config.type !== component.config.type) { - /** - * When loading report after create we want to use existing Iframe to optimize load period - */ - if (config.type === "report" && component.config.type === "create") { - var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe); - component.populateConfig(config, /* isBootstrap */ false); - report.load(); - element.powerBiEmbed = report; - this.addOrOverwriteEmbed(component, element); - return report; - } - throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type); - } - component.populateConfig(config, /* isBootstrap */ false); - component.load(phasedRender); - return component; - }; - /** - * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, - * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. - * - * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. - * This handler is typically useful only for applications that are rendered on the server so that all required data is available when the handler is called. - * - * @hidden - */ - Service.prototype.enableAutoEmbed = function () { - var _this = this; - window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false); - }; - /** - * Returns an instance of the component associated with the element. - * - * @param {HTMLElement} element - * @returns {(Report | Tile)} - */ - Service.prototype.get = function (element) { - var powerBiElement = element; - if (!powerBiElement.powerBiEmbed) { - throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance."); - } - return powerBiElement.powerBiEmbed; - }; - /** - * Finds an embed instance by the name or unique ID that is provided. - * - * @param {string} uniqueId - * @returns {(Report | Tile)} - * @hidden - */ - Service.prototype.find = function (uniqueId) { - return utils.find(function (x) { return x.config.uniqueId === uniqueId; }, this.embeds); - }; - /** - * Removes embed components whose container element is same as the given element - * - * @param {Embed} component - * @param {HTMLElement} element - * @returns {void} - * @hidden - */ - Service.prototype.addOrOverwriteEmbed = function (component, element) { - // remove embeds over the same div element. - this.embeds = this.embeds.filter(function (embed) { - return embed.element !== element; - }); - this.embeds.push(component); - }; - /** - * Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe. - * - * @param {HTMLElement} element - * @returns {void} - */ - Service.prototype.reset = function (element) { - var powerBiElement = element; - if (!powerBiElement.powerBiEmbed) { - return; - } - /** Removes the element frontLoad listener if exists. */ - var embedElement = powerBiElement.powerBiEmbed; - if (embedElement.frontLoadHandler) { - embedElement.element.removeEventListener('ready', embedElement.frontLoadHandler, false); - } - /** Removes the component from an internal list of components. */ - utils.remove(function (x) { return x === powerBiElement.powerBiEmbed; }, this.embeds); - /** Deletes a property from the HTML element. */ - delete powerBiElement.powerBiEmbed; - /** Removes the iframe from the element. */ - var iframe = element.querySelector('iframe'); - if (iframe) { - if (iframe.remove !== undefined) { - iframe.remove(); - } - else { - /** Workaround for IE: unhandled rejection TypeError: object doesn't support propert or method 'remove' */ - iframe.parentElement.removeChild(iframe); - } - } - }; - /** - * handles tile events - * - * @param {IEvent} event - * @hidden - */ - Service.prototype.handleTileEvents = function (event) { - if (event.type === 'tile') { - this.handleEvent(event); - } - }; - /** - * Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object. - * - * @private - * @param {IEvent} event - * @hidden - */ - Service.prototype.handleEvent = function (event) { - var embed = utils.find(function (embed) { - return (embed.config.uniqueId === event.id); - }, this.embeds); - if (embed) { - var value = event.value; - if (event.name === 'pageChanged') { - var pageKey = 'newPage'; - var page = value[pageKey]; - if (!page) { - throw new Error("Page model not found at 'event.value." + pageKey + "'."); - } - value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */); - } - utils.raiseCustomEvent(embed.element, event.name, value); - } - }; - /** - * API for warm starting powerbi embedded endpoints. - * Use this API to preload Power BI Embedded in the background. - * - * @public - * @param {embed.IEmbedConfigurationBase} [config={}] - * @param {HTMLElement} [element=undefined] - */ - Service.prototype.preload = function (config, element) { - var iframeContent = document.createElement("iframe"); - iframeContent.setAttribute("style", "display:none;"); - iframeContent.setAttribute("src", config.embedUrl); - iframeContent.setAttribute("scrolling", "no"); - iframeContent.setAttribute("allowfullscreen", "false"); - var node = element; - if (!node) { - node = document.getElementsByTagName("body")[0]; - } - node.appendChild(iframeContent); - iframeContent.onload = function () { - utils.raiseCustomEvent(iframeContent, "preloaded", {}); - }; - return iframeContent; - }; - /** - * A list of components that this service can embed - */ - Service.components = [ - tile_1.Tile, - report_1.Report, - dashboard_1.Dashboard, - qna_1.Qna, - visual_1.Visual - ]; - /** - * The default configuration for the service - */ - Service.defaultConfig = { - autoEmbedOnContentLoaded: false, - onError: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return console.log(args[0], args.slice(1)); - } - }; - return Service; - }()); - exports.Service = Service; + var embed = __webpack_require__(2); + var report_1 = __webpack_require__(7); + var create_1 = __webpack_require__(11); + var dashboard_1 = __webpack_require__(12); + var tile_1 = __webpack_require__(13); + var page_1 = __webpack_require__(8); + var qna_1 = __webpack_require__(14); + var visual_1 = __webpack_require__(15); + var utils = __webpack_require__(3); + /** + * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application + * + * @export + * @class Service + * @implements {IService} + */ + var Service = (function () { + /** + * Creates an instance of a Power BI Service. + * + * @param {IHpmFactory} hpmFactory The http post message factory used in the postMessage communication layer + * @param {IWpmpFactory} wpmpFactory The window post message factory used in the postMessage communication layer + * @param {IRouterFactory} routerFactory The router factory used in the postMessage communication layer + * @param {IServiceConfiguration} [config={}] + * @hidden + */ + function Service(hpmFactory, wpmpFactory, routerFactory, config) { + var _this = this; + if (config === void 0) { config = {}; } + this.wpmp = wpmpFactory(config.wpmpName, config.logMessages); + this.hpm = hpmFactory(this.wpmp, null, config.version, config.type); + this.router = routerFactory(this.wpmp); + this.uniqueSessionId = utils.generateUUID(); + /** + * Adds handler for report events. + */ + this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'dashboard', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'tile', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + /** + * Adds handler for Q&A events. + */ + this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'qna', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + /** + * Adds handler for front load 'ready' message. + */ + this.router.post("/ready/:uniqueId", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: 'ready', + value: req.body + }; + _this.handleEvent(event); + }); + this.embeds = []; + // TODO: Change when Object.assign is available. + this.config = utils.assign({}, Service.defaultConfig, config); + if (this.config.autoEmbedOnContentLoaded) { + this.enableAutoEmbed(); + } + } + /** + * Creates new report + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.createReport = function (element, config) { + config.type = 'create'; + var powerBiElement = element; + var component = new create_1.Create(this, powerBiElement, config); + powerBiElement.powerBiEmbed = component; + this.addOrOverwriteEmbed(component, element); + return component; + }; + /** + * TODO: Add a description here + * + * @param {HTMLElement} [container] + * @param {embed.IEmbedConfiguration} [config=undefined] + * @returns {embed.Embed[]} + * @hidden + */ + Service.prototype.init = function (container, config) { + var _this = this; + if (config === void 0) { config = undefined; } + container = (container && container instanceof HTMLElement) ? container : document.body; + var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]")); + return elements.map(function (element) { return _this.embed(element, config); }); + }; + /** + * Given a configuration based on an HTML element, + * if the component has already been created and attached to the element, reuses the component instance and existing iframe, + * otherwise creates a new component instance. + * + * @param {HTMLElement} element + * @param {embed.IEmbedConfigurationBase} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.embed = function (element, config) { + if (config === void 0) { config = {}; } + return this.embedInternal(element, config); + }; + /** + * Given a configuration based on an HTML element, + * if the component has already been created and attached to the element, reuses the component instance and existing iframe, + * otherwise creates a new component instance. + * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. + * + * @param {HTMLElement} element + * @param {embed.IEmbedConfigurationBase} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.load = function (element, config) { + if (config === void 0) { config = {}; } + return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); + }; + /** + * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. + * + * @param {HTMLElement} element + * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. + */ + Service.prototype.bootstrap = function (element, config) { + return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); + }; + /** @hidden */ + Service.prototype.embedInternal = function (element, config, phasedRender, isBootstrap) { + if (config === void 0) { config = {}; } + var component; + var powerBiElement = element; + if (powerBiElement.powerBiEmbed) { + if (isBootstrap) { + throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element."); + } + component = this.embedExisting(powerBiElement, config, phasedRender); + } + else { + component = this.embedNew(powerBiElement, config, phasedRender, isBootstrap); + } + return component; + }; + /** @hidden */ + Service.prototype.getNumberOfComponents = function () { + if (!this.embeds) { + return 0; + } + return this.embeds.length; + }; + /** @hidden */ + Service.prototype.getSdkSessionId = function () { + return this.uniqueSessionId; + }; + /** + * Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup. + * + * @private + * @param {IPowerBiElement} element + * @param {embed.IEmbedConfigurationBase} config + * @returns {embed.Embed} + * @hidden + */ + Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) { + var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); + if (!componentType) { + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'."); + } + // Saves the type as part of the configuration so that it can be referenced later at a known location. + config.type = componentType; + var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components); + if (!Component) { + throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended."); + } + var component = new Component(this, element, config, phasedRender, isBootstrap); + element.powerBiEmbed = component; + this.addOrOverwriteEmbed(component, element); + return component; + }; + /** + * Given an element that already contains an embed component, load with a new configuration. + * + * @private + * @param {IPowerBiElement} element + * @param {embed.IEmbedConfigurationBase} config + * @returns {embed.Embed} + * @hidden + */ + Service.prototype.embedExisting = function (element, config, phasedRender) { + var component = utils.find(function (x) { return x.element === element; }, this.embeds); + if (!component) { + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); + } + // TODO: Multiple embedding to the same iframe is not supported in QnA + if (config.type && config.type.toLowerCase() === "qna") { + return this.embedNew(element, config); + } + /** + * TODO: Dynamic embed type switching could be supported but there is work needed to prepare the service state and DOM cleanup. + * remove all event handlers from the DOM, then reset the element to initial state which removes iframe, and removes from list of embeds + * then we can call the embedNew function which would allow setting the proper embedUrl and construction of object based on the new type. + */ + if (typeof config.type === "string" && config.type !== component.config.type) { + /** + * When loading report after create we want to use existing Iframe to optimize load period + */ + if (config.type === "report" && component.config.type === "create") { + var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe); + component.populateConfig(config, /* isBootstrap */ false); + report.load(); + element.powerBiEmbed = report; + this.addOrOverwriteEmbed(component, element); + return report; + } + throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type); + } + component.populateConfig(config, /* isBootstrap */ false); + component.load(phasedRender); + return component; + }; + /** + * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, + * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. + * + * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. + * This handler is typically useful only for applications that are rendered on the server so that all required data is available when the handler is called. + * + * @hidden + */ + Service.prototype.enableAutoEmbed = function () { + var _this = this; + window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false); + }; + /** + * Returns an instance of the component associated with the element. + * + * @param {HTMLElement} element + * @returns {(Report | Tile)} + */ + Service.prototype.get = function (element) { + var powerBiElement = element; + if (!powerBiElement.powerBiEmbed) { + throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance."); + } + return powerBiElement.powerBiEmbed; + }; + /** + * Finds an embed instance by the name or unique ID that is provided. + * + * @param {string} uniqueId + * @returns {(Report | Tile)} + * @hidden + */ + Service.prototype.find = function (uniqueId) { + return utils.find(function (x) { return x.config.uniqueId === uniqueId; }, this.embeds); + }; + /** + * Removes embed components whose container element is same as the given element + * + * @param {Embed} component + * @param {HTMLElement} element + * @returns {void} + * @hidden + */ + Service.prototype.addOrOverwriteEmbed = function (component, element) { + // remove embeds over the same div element. + this.embeds = this.embeds.filter(function (embed) { + return embed.element !== element; + }); + this.embeds.push(component); + }; + /** + * Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe. + * + * @param {HTMLElement} element + * @returns {void} + */ + Service.prototype.reset = function (element) { + var powerBiElement = element; + if (!powerBiElement.powerBiEmbed) { + return; + } + /** Removes the element frontLoad listener if exists. */ + var embedElement = powerBiElement.powerBiEmbed; + if (embedElement.frontLoadHandler) { + embedElement.element.removeEventListener('ready', embedElement.frontLoadHandler, false); + } + /** Removes the component from an internal list of components. */ + utils.remove(function (x) { return x === powerBiElement.powerBiEmbed; }, this.embeds); + /** Deletes a property from the HTML element. */ + delete powerBiElement.powerBiEmbed; + /** Removes the iframe from the element. */ + var iframe = element.querySelector('iframe'); + if (iframe) { + if (iframe.remove !== undefined) { + iframe.remove(); + } + else { + /** Workaround for IE: unhandled rejection TypeError: object doesn't support propert or method 'remove' */ + iframe.parentElement.removeChild(iframe); + } + } + }; + /** + * handles tile events + * + * @param {IEvent} event + * @hidden + */ + Service.prototype.handleTileEvents = function (event) { + if (event.type === 'tile') { + this.handleEvent(event); + } + }; + /** + * Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object. + * + * @private + * @param {IEvent} event + * @hidden + */ + Service.prototype.handleEvent = function (event) { + var embed = utils.find(function (embed) { + return (embed.config.uniqueId === event.id); + }, this.embeds); + if (embed) { + var value = event.value; + if (event.name === 'pageChanged') { + var pageKey = 'newPage'; + var page = value[pageKey]; + if (!page) { + throw new Error("Page model not found at 'event.value." + pageKey + "'."); + } + value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */); + } + utils.raiseCustomEvent(embed.element, event.name, value); + } + }; + /** + * API for warm starting powerbi embedded endpoints. + * Use this API to preload Power BI Embedded in the background. + * + * @public + * @param {embed.IEmbedConfigurationBase} [config={}] + * @param {HTMLElement} [element=undefined] + */ + Service.prototype.preload = function (config, element) { + var iframeContent = document.createElement("iframe"); + iframeContent.setAttribute("style", "display:none;"); + iframeContent.setAttribute("src", config.embedUrl); + iframeContent.setAttribute("scrolling", "no"); + iframeContent.setAttribute("allowfullscreen", "false"); + var node = element; + if (!node) { + node = document.getElementsByTagName("body")[0]; + } + node.appendChild(iframeContent); + iframeContent.onload = function () { + utils.raiseCustomEvent(iframeContent, "preloaded", {}); + }; + return iframeContent; + }; + /** + * A list of components that this service can embed + */ + Service.components = [ + tile_1.Tile, + report_1.Report, + dashboard_1.Dashboard, + qna_1.Qna, + visual_1.Visual + ]; + /** + * The default configuration for the service + */ + Service.defaultConfig = { + autoEmbedOnContentLoaded: false, + onError: function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return console.log(args[0], args.slice(1)); + } + }; + return Service; + }()); + exports.Service = Service; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { - var utils = __webpack_require__(3); - var sdkConfig = __webpack_require__(4); - var models = __webpack_require__(5); - var errors_1 = __webpack_require__(6); - /** - * Base class for all Power BI embed components - * - * @export - * @abstract - * @hidden - * @class Embed - */ - var Embed = (function () { - /** - * Creates an instance of Embed. - * - * Note: there is circular reference between embeds and the service, because - * the service has a list of all embeds on the host page, and each embed has a reference to the service that created it. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {IEmbedConfigurationBase} config - * @hidden - */ - function Embed(service, element, config, iframe, phasedRender, isBootstrap) { - /** @hidden */ - this.allowedEvents = []; - if (utils.autoAuthInEmbedUrl(config.embedUrl)) { - throw new Error(errors_1.EmbedUrlNotSupported); - } - Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents); - this.eventHandlers = []; - this.service = service; - this.element = element; - this.iframe = iframe; - this.iframeLoaded = false; - this.embedtype = config.type.toLowerCase(); - this.populateConfig(config, isBootstrap); - if (this.embedtype === 'create') { - this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap); - } - else { - this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap); - } - } - /** - * Sends createReport configuration data. - * - * ```javascript - * createReport({ - * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', - * accessToken: 'eyJ0eXA ... TaE2rTSbmg', - * ``` - * @hidden - * @param {models.IReportCreateConfiguration} config - * @returns {Promise} - */ - Embed.prototype.createReport = function (config) { - var errors = models.validateCreateReport(config); - if (errors) { - throw errors; - } - return this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }, function (response) { - throw response.body; - }); - }; - /** - * Saves Report. - * - * @returns {Promise} - */ - Embed.prototype.save = function () { - return this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * SaveAs Report. - * - * @returns {Promise} - */ - Embed.prototype.saveAs = function (saveAsParameters) { - return this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Get the correlationId for the current embed session. - * - * ```javascript - * // Get the correlationId for the current embed session - * report.getCorrelationId() - * .then(correlationId => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Embed.prototype.getCorrelationId = function () { - return this.service.hpm.get("/getCorrelationId", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Sends load configuration data. - * - * ```javascript - * report.load({ - * type: 'report', - * id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', - * accessToken: 'eyJ0eXA ... TaE2rTSbmg', - * settings: { - * navContentPaneEnabled: false - * }, - * pageName: "DefaultPage", - * filters: [ - * { - * ... DefaultReportFilter ... - * } - * ] - * }) - * .catch(error => { ... }); - * ``` - * @hidden - * @param {models.ILoadConfiguration} config - * @param {boolean} phasedRender - * @returns {Promise} - */ - Embed.prototype.load = function (phasedRender) { - if (!this.config.accessToken) { - console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); - return; - } - if (!this.iframeLoaded) { - console.debug("Power BI SDK is trying to post /report/load before iframe is ready."); - return; - } - var path = phasedRender && this.config.type === 'report' ? this.phasedLoadPath : this.loadPath; - var headers = { - uid: this.config.uniqueId, - sdkSessionId: this.service.getSdkSessionId(), - bootstrapped: this.config.bootstrapped, - sdkVersion: sdkConfig.default.version - }; - var timeNow = new Date(); - if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) { - console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval."); - return; - } - this.lastLoadRequest = timeNow; - return this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }, function (response) { - throw response.body; - }); - }; - /** - * Removes one or more event handlers from the list of handlers. - * If a reference to the existing handle function is specified, remove the specific handler. - * If the handler is not specified, remove all handlers for the event name specified. - * - * ```javascript - * report.off('pageChanged') - * - * or - * - * const logHandler = function (event) { - * console.log(event); - * }; - * - * report.off('pageChanged', logHandler); - * ``` - * - * @template T - * @param {string} eventName - * @param {service.IEventHandler} [handler] - */ - Embed.prototype.off = function (eventName, handler) { - var _this = this; - var fakeEvent = { name: eventName, type: null, id: null, value: null }; - if (handler) { - utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers); - this.element.removeEventListener(eventName, handler); - } - else { - var eventHandlersToRemove = this.eventHandlers - .filter(function (eventHandler) { return eventHandler.test(fakeEvent); }); - eventHandlersToRemove - .forEach(function (eventHandlerToRemove) { - utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers); - _this.element.removeEventListener(eventName, eventHandlerToRemove.handle); - }); - } - }; - /** - * Adds an event handler for a specific event. - * - * ```javascript - * report.on('pageChanged', (event) => { - * console.log('PageChanged: ', event.page.name); - * }); - * ``` - * - * @template T - * @param {string} eventName - * @param {service.IEventHandler} handler - */ - Embed.prototype.on = function (eventName, handler) { - if (this.allowedEvents.indexOf(eventName) === -1) { - throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName); - } - this.eventHandlers.push({ - test: function (event) { return event.name === eventName; }, - handle: handler - }); - this.element.addEventListener(eventName, handler); - }; - /** - * Reloads embed using existing configuration. - * E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. - * - * ```javascript - * report.reload(); - * ``` - */ - Embed.prototype.reload = function () { - return this.load(); - }; - /** - * Set accessToken. - * - * @returns {Promise} - */ - Embed.prototype.setAccessToken = function (accessToken) { - var _this = this; - var embedType = this.config.type; - embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; - return this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - _this.config.accessToken = accessToken; - _this.element.setAttribute(Embed.accessTokenAttribute, accessToken); - _this.service.accessToken = accessToken; - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Gets an access token from the first available location: config, attribute, global. - * - * @private - * @param {string} globalAccessToken - * @returns {string} - * @hidden - */ - Embed.prototype.getAccessToken = function (globalAccessToken) { - var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken; - if (!accessToken) { - throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken."); - } - return accessToken; - }; - /** - * Populate config for create and load - * - * @hidden - * @param {IEmbedConfiguration} - * @returns {void} - */ - Embed.prototype.populateConfig = function (config, isBootstrap) { - if (this.bootstrapConfig) { - this.config = utils.assign({}, this.bootstrapConfig, config); - // reset bootstrapConfig because we do not want to merge it in re-embed scenario. - this.bootstrapConfig = null; - } - else { - // Copy config - important for multiple iframe scenario. - // Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes. - this.config = utils.assign({}, config); - } - this.config.embedUrl = this.getEmbedUrl(isBootstrap); - this.config.groupId = this.getGroupId(); - this.addLocaleToEmbedUrl(config); - this.config.uniqueId = this.getUniqueId(); - if (isBootstrap) { - // save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed - this.bootstrapConfig = this.config; - this.bootstrapConfig.bootstrapped = true; - } - else { - this.config.accessToken = this.getAccessToken(this.service.accessToken); - } - this.configChanged(isBootstrap); - }; - /** - * Adds locale parameters to embedUrl - * - * @private - * @param {IEmbedConfiguration} config - * @hidden - */ - Embed.prototype.addLocaleToEmbedUrl = function (config) { - if (!config.settings) { - return; - } - var localeSettings = config.settings.localeSettings; - if (localeSettings && localeSettings.language) { - this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language); - } - if (localeSettings && localeSettings.formatLocale) { - this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale); - } - }; - /** - * Gets an embed url from the first available location: options, attribute. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getEmbedUrl = function (isBootstrap) { - var embedUrl = this.config.embedUrl || this.element.getAttribute(Embed.embedUrlAttribute); - if (isBootstrap && !embedUrl) { - // Prepare flow, embed url was not provided, use hostname to build embed url. - embedUrl = this.getDefaultEmbedUrl(this.config.hostname); - } - if (typeof embedUrl !== 'string' || embedUrl.length === 0) { - throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'."); - } - return embedUrl; - }; - /** - * @hidden - */ - Embed.prototype.getDefaultEmbedUrl = function (hostname) { - if (!hostname) { - hostname = Embed.defaultEmbedHostName; - } - var endpoint = this.getDefaultEmbedUrlEndpoint(); - // Trim spaces to fix user mistakes. - hostname = hostname.toLowerCase().trim(); - if (hostname.indexOf("http://") === 0) { - throw new Error("HTTP is not allowed. HTTPS is required"); - } - if (hostname.indexOf("https://") === 0) { - return hostname + "/" + endpoint; - } - return "https://" + hostname + "/" + endpoint; - }; - /** - * Gets a unique ID from the first available location: options, attribute. - * If neither is provided generate a unique string. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getUniqueId = function () { - return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString(); - }; - /** - * Gets the group ID from the first available location: options, embeddedUrl. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getGroupId = function () { - return this.config.groupId || Embed.findGroupIdFromEmbedUrl(this.config.embedUrl); - }; - /** - * Requests the browser to render the component's iframe in fullscreen mode. - */ - Embed.prototype.fullscreen = function () { - var requestFullScreen = this.iframe.requestFullscreen || this.iframe.msRequestFullscreen || this.iframe.mozRequestFullScreen || this.iframe.webkitRequestFullscreen; - requestFullScreen.call(this.iframe); - }; - /** - * Requests the browser to exit fullscreen mode. - */ - Embed.prototype.exitFullscreen = function () { - if (!this.isFullscreen(this.iframe)) { - return; - } - var exitFullscreen = document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen; - exitFullscreen.call(document); - }; - /** - * Returns true if the iframe is rendered in fullscreen mode, - * otherwise returns false. - * - * @private - * @param {HTMLIFrameElement} iframe - * @returns {boolean} - * @hidden - */ - Embed.prototype.isFullscreen = function (iframe) { - var options = ['fullscreenElement', 'webkitFullscreenElement', 'mozFullscreenScreenElement', 'msFullscreenElement']; - return options.some(function (option) { return document[option] === iframe; }); - }; - /** - * Sets Iframe for embed - * @hidden - */ - Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) { - var _this = this; - if (!this.iframe) { - var iframeContent = document.createElement("iframe"); - var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl; - iframeContent.style.width = '100%'; - iframeContent.style.height = '100%'; - iframeContent.setAttribute("src", embedUrl); - iframeContent.setAttribute("scrolling", "no"); - iframeContent.setAttribute("allowfullscreen", "true"); - var node = this.element; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(iframeContent); - this.iframe = node.firstChild; - } - if (isLoad) { - if (!isBootstrap) { - // Validate config if it's not a bootstrap case. - var errors = this.validate(this.config); - if (errors) { - throw errors; - } - } - this.iframe.addEventListener('load', function () { - _this.iframeLoaded = true; - _this.load(phasedRender); - }, false); - if (this.service.getNumberOfComponents() <= Embed.maxFrontLoadTimes) { - this.frontLoadHandler = function () { - _this.frontLoadSendConfig(_this.config); - }; - // 'ready' event is fired by the embedded element (not by the iframe) - this.element.addEventListener('ready', this.frontLoadHandler, false); - } - } - else { - this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false); - } - }; - /** - * Set the component title for accessibility. In case of iframes, this method will change the iframe title. - */ - Embed.prototype.setComponentTitle = function (title) { - if (!this.iframe) { - return; - } - if (title == null) { - this.iframe.removeAttribute("title"); - } - else { - this.iframe.setAttribute("title", title); - } - }; - /** - * Sets element's tabindex attribute - */ - Embed.prototype.setComponentTabIndex = function (tabIndex) { - if (!this.element) { - return; - } - this.element.setAttribute("tabindex", (tabIndex == null) ? "0" : tabIndex.toString()); - }; - /** - * Removes element's tabindex attribute - */ - Embed.prototype.removeComponentTabIndex = function (tabIndex) { - if (!this.element) { - return; - } - this.element.removeAttribute("tabindex"); - }; - /** - * Adds the ability to get groupId from url. - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Embed.findGroupIdFromEmbedUrl = function (url) { - var groupIdRegEx = /groupId="?([^&]+)"?/; - var groupIdMatch = url.match(groupIdRegEx); - var groupId; - if (groupIdMatch) { - groupId = groupIdMatch[1]; - } - return groupId; - }; - /** - * Sends the config for front load calls, after 'ready' message is received from the iframe - * @hidden - */ - Embed.prototype.frontLoadSendConfig = function (config) { - if (!config.accessToken) { - return; - } - var errors = this.validate(config); - if (errors) { - throw errors; - } - // contentWindow must be initialized - if (this.iframe.contentWindow == null) - return; - return this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow).then(function (response) { - return response.body; - }, function (response) { - throw response.body; - }); - }; - /** @hidden */ - Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"]; - /** @hidden */ - Embed.accessTokenAttribute = 'powerbi-access-token'; - /** @hidden */ - Embed.embedUrlAttribute = 'powerbi-embed-url'; - /** @hidden */ - Embed.nameAttribute = 'powerbi-name'; - /** @hidden */ - Embed.typeAttribute = 'powerbi-type'; - /** @hidden */ - Embed.defaultEmbedHostName = "https://app.powerbi.com"; - /** @hidden */ - Embed.maxFrontLoadTimes = 2; - return Embed; - }()); - exports.Embed = Embed; + var utils = __webpack_require__(3); + var sdkConfig = __webpack_require__(4); + var models = __webpack_require__(5); + var errors_1 = __webpack_require__(6); + /** + * Base class for all Power BI embed components + * + * @export + * @abstract + * @hidden + * @class Embed + */ + var Embed = (function () { + /** + * Creates an instance of Embed. + * + * Note: there is circular reference between embeds and the service, because + * the service has a list of all embeds on the host page, and each embed has a reference to the service that created it. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {IEmbedConfigurationBase} config + * @hidden + */ + function Embed(service, element, config, iframe, phasedRender, isBootstrap) { + /** @hidden */ + this.allowedEvents = []; + if (utils.autoAuthInEmbedUrl(config.embedUrl)) { + throw new Error(errors_1.EmbedUrlNotSupported); + } + Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents); + this.eventHandlers = []; + this.service = service; + this.element = element; + this.iframe = iframe; + this.iframeLoaded = false; + this.embedtype = config.type.toLowerCase(); + this.populateConfig(config, isBootstrap); + if (this.embedtype === 'create') { + this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap); + } + else { + this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap); + } + } + /** + * Sends createReport configuration data. + * + * ```javascript + * createReport({ + * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', + * accessToken: 'eyJ0eXA ... TaE2rTSbmg', + * ``` + * @hidden + * @param {models.IReportCreateConfiguration} config + * @returns {Promise} + */ + Embed.prototype.createReport = function (config) { + var errors = models.validateCreateReport(config); + if (errors) { + throw errors; + } + return this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }, function (response) { + throw response.body; + }); + }; + /** + * Saves Report. + * + * @returns {Promise} + */ + Embed.prototype.save = function () { + return this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * SaveAs Report. + * + * @returns {Promise} + */ + Embed.prototype.saveAs = function (saveAsParameters) { + return this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Get the correlationId for the current embed session. + * + * ```javascript + * // Get the correlationId for the current embed session + * report.getCorrelationId() + * .then(correlationId => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Embed.prototype.getCorrelationId = function () { + return this.service.hpm.get("/getCorrelationId", { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Sends load configuration data. + * + * ```javascript + * report.load({ + * type: 'report', + * id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', + * accessToken: 'eyJ0eXA ... TaE2rTSbmg', + * settings: { + * navContentPaneEnabled: false + * }, + * pageName: "DefaultPage", + * filters: [ + * { + * ... DefaultReportFilter ... + * } + * ] + * }) + * .catch(error => { ... }); + * ``` + * @hidden + * @param {models.ILoadConfiguration} config + * @param {boolean} phasedRender + * @returns {Promise} + */ + Embed.prototype.load = function (phasedRender) { + if (!this.config.accessToken) { + console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); + return; + } + if (!this.iframeLoaded) { + console.debug("Power BI SDK is trying to post /report/load before iframe is ready."); + return; + } + var path = phasedRender && this.config.type === 'report' ? this.phasedLoadPath : this.loadPath; + var headers = { + uid: this.config.uniqueId, + sdkSessionId: this.service.getSdkSessionId(), + bootstrapped: this.config.bootstrapped, + sdkVersion: sdkConfig.default.version + }; + var timeNow = new Date(); + if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) { + console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval."); + return; + } + this.lastLoadRequest = timeNow; + return this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }, function (response) { + throw response.body; + }); + }; + /** + * Removes one or more event handlers from the list of handlers. + * If a reference to the existing handle function is specified, remove the specific handler. + * If the handler is not specified, remove all handlers for the event name specified. + * + * ```javascript + * report.off('pageChanged') + * + * or + * + * const logHandler = function (event) { + * console.log(event); + * }; + * + * report.off('pageChanged', logHandler); + * ``` + * + * @template T + * @param {string} eventName + * @param {service.IEventHandler} [handler] + */ + Embed.prototype.off = function (eventName, handler) { + var _this = this; + var fakeEvent = { name: eventName, type: null, id: null, value: null }; + if (handler) { + utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers); + this.element.removeEventListener(eventName, handler); + } + else { + var eventHandlersToRemove = this.eventHandlers + .filter(function (eventHandler) { return eventHandler.test(fakeEvent); }); + eventHandlersToRemove + .forEach(function (eventHandlerToRemove) { + utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers); + _this.element.removeEventListener(eventName, eventHandlerToRemove.handle); + }); + } + }; + /** + * Adds an event handler for a specific event. + * + * ```javascript + * report.on('pageChanged', (event) => { + * console.log('PageChanged: ', event.page.name); + * }); + * ``` + * + * @template T + * @param {string} eventName + * @param {service.IEventHandler} handler + */ + Embed.prototype.on = function (eventName, handler) { + if (this.allowedEvents.indexOf(eventName) === -1) { + throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName); + } + this.eventHandlers.push({ + test: function (event) { return event.name === eventName; }, + handle: handler + }); + this.element.addEventListener(eventName, handler); + }; + /** + * Reloads embed using existing configuration. + * E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. + * + * ```javascript + * report.reload(); + * ``` + */ + Embed.prototype.reload = function () { + return this.load(); + }; + /** + * Set accessToken. + * + * @returns {Promise} + */ + Embed.prototype.setAccessToken = function (accessToken) { + var _this = this; + var embedType = this.config.type; + embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; + return this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + _this.config.accessToken = accessToken; + _this.element.setAttribute(Embed.accessTokenAttribute, accessToken); + _this.service.accessToken = accessToken; + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Gets an access token from the first available location: config, attribute, global. + * + * @private + * @param {string} globalAccessToken + * @returns {string} + * @hidden + */ + Embed.prototype.getAccessToken = function (globalAccessToken) { + var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken; + if (!accessToken) { + throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken."); + } + return accessToken; + }; + /** + * Populate config for create and load + * + * @hidden + * @param {IEmbedConfiguration} + * @returns {void} + */ + Embed.prototype.populateConfig = function (config, isBootstrap) { + if (this.bootstrapConfig) { + this.config = utils.assign({}, this.bootstrapConfig, config); + // reset bootstrapConfig because we do not want to merge it in re-embed scenario. + this.bootstrapConfig = null; + } + else { + // Copy config - important for multiple iframe scenario. + // Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes. + this.config = utils.assign({}, config); + } + this.config.embedUrl = this.getEmbedUrl(isBootstrap); + this.config.groupId = this.getGroupId(); + this.addLocaleToEmbedUrl(config); + this.config.uniqueId = this.getUniqueId(); + if (isBootstrap) { + // save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed + this.bootstrapConfig = this.config; + this.bootstrapConfig.bootstrapped = true; + } + else { + this.config.accessToken = this.getAccessToken(this.service.accessToken); + } + this.configChanged(isBootstrap); + }; + /** + * Adds locale parameters to embedUrl + * + * @private + * @param {IEmbedConfiguration} config + * @hidden + */ + Embed.prototype.addLocaleToEmbedUrl = function (config) { + if (!config.settings) { + return; + } + var localeSettings = config.settings.localeSettings; + if (localeSettings && localeSettings.language) { + this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language); + } + if (localeSettings && localeSettings.formatLocale) { + this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale); + } + }; + /** + * Gets an embed url from the first available location: options, attribute. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getEmbedUrl = function (isBootstrap) { + var embedUrl = this.config.embedUrl || this.element.getAttribute(Embed.embedUrlAttribute); + if (isBootstrap && !embedUrl) { + // Prepare flow, embed url was not provided, use hostname to build embed url. + embedUrl = this.getDefaultEmbedUrl(this.config.hostname); + } + if (typeof embedUrl !== 'string' || embedUrl.length === 0) { + throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'."); + } + return embedUrl; + }; + /** + * @hidden + */ + Embed.prototype.getDefaultEmbedUrl = function (hostname) { + if (!hostname) { + hostname = Embed.defaultEmbedHostName; + } + var endpoint = this.getDefaultEmbedUrlEndpoint(); + // Trim spaces to fix user mistakes. + hostname = hostname.toLowerCase().trim(); + if (hostname.indexOf("http://") === 0) { + throw new Error("HTTP is not allowed. HTTPS is required"); + } + if (hostname.indexOf("https://") === 0) { + return hostname + "/" + endpoint; + } + return "https://" + hostname + "/" + endpoint; + }; + /** + * Gets a unique ID from the first available location: options, attribute. + * If neither is provided generate a unique string. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getUniqueId = function () { + return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString(); + }; + /** + * Gets the group ID from the first available location: options, embeddedUrl. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getGroupId = function () { + return this.config.groupId || Embed.findGroupIdFromEmbedUrl(this.config.embedUrl); + }; + /** + * Requests the browser to render the component's iframe in fullscreen mode. + */ + Embed.prototype.fullscreen = function () { + var requestFullScreen = this.iframe.requestFullscreen || this.iframe.msRequestFullscreen || this.iframe.mozRequestFullScreen || this.iframe.webkitRequestFullscreen; + requestFullScreen.call(this.iframe); + }; + /** + * Requests the browser to exit fullscreen mode. + */ + Embed.prototype.exitFullscreen = function () { + if (!this.isFullscreen(this.iframe)) { + return; + } + var exitFullscreen = document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen; + exitFullscreen.call(document); + }; + /** + * Returns true if the iframe is rendered in fullscreen mode, + * otherwise returns false. + * + * @private + * @param {HTMLIFrameElement} iframe + * @returns {boolean} + * @hidden + */ + Embed.prototype.isFullscreen = function (iframe) { + var options = ['fullscreenElement', 'webkitFullscreenElement', 'mozFullscreenScreenElement', 'msFullscreenElement']; + return options.some(function (option) { return document[option] === iframe; }); + }; + /** + * Sets Iframe for embed + * @hidden + */ + Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) { + var _this = this; + if (!this.iframe) { + var iframeContent = document.createElement("iframe"); + var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl; + iframeContent.style.width = '100%'; + iframeContent.style.height = '100%'; + iframeContent.setAttribute("src", embedUrl); + iframeContent.setAttribute("scrolling", "no"); + iframeContent.setAttribute("allowfullscreen", "true"); + var node = this.element; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + node.appendChild(iframeContent); + this.iframe = node.firstChild; + } + if (isLoad) { + if (!isBootstrap) { + // Validate config if it's not a bootstrap case. + var errors = this.validate(this.config); + if (errors) { + throw errors; + } + } + this.iframe.addEventListener('load', function () { + _this.iframeLoaded = true; + _this.load(phasedRender); + }, false); + if (this.service.getNumberOfComponents() <= Embed.maxFrontLoadTimes) { + this.frontLoadHandler = function () { + _this.frontLoadSendConfig(_this.config); + }; + // 'ready' event is fired by the embedded element (not by the iframe) + this.element.addEventListener('ready', this.frontLoadHandler, false); + } + } + else { + this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false); + } + }; + /** + * Set the component title for accessibility. In case of iframes, this method will change the iframe title. + */ + Embed.prototype.setComponentTitle = function (title) { + if (!this.iframe) { + return; + } + if (title == null) { + this.iframe.removeAttribute("title"); + } + else { + this.iframe.setAttribute("title", title); + } + }; + /** + * Sets element's tabindex attribute + */ + Embed.prototype.setComponentTabIndex = function (tabIndex) { + if (!this.element) { + return; + } + this.element.setAttribute("tabindex", (tabIndex == null) ? "0" : tabIndex.toString()); + }; + /** + * Removes element's tabindex attribute + */ + Embed.prototype.removeComponentTabIndex = function (tabIndex) { + if (!this.element) { + return; + } + this.element.removeAttribute("tabindex"); + }; + /** + * Adds the ability to get groupId from url. + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Embed.findGroupIdFromEmbedUrl = function (url) { + var groupIdRegEx = /groupId="?([^&]+)"?/; + var groupIdMatch = url.match(groupIdRegEx); + var groupId; + if (groupIdMatch) { + groupId = groupIdMatch[1]; + } + return groupId; + }; + /** + * Sends the config for front load calls, after 'ready' message is received from the iframe + * @hidden + */ + Embed.prototype.frontLoadSendConfig = function (config) { + if (!config.accessToken) { + return; + } + var errors = this.validate(config); + if (errors) { + throw errors; + } + // contentWindow must be initialized + if (this.iframe.contentWindow == null) + return; + return this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow).then(function (response) { + return response.body; + }, function (response) { + throw response.body; + }); + }; + /** @hidden */ + Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"]; + /** @hidden */ + Embed.accessTokenAttribute = 'powerbi-access-token'; + /** @hidden */ + Embed.embedUrlAttribute = 'powerbi-embed-url'; + /** @hidden */ + Embed.nameAttribute = 'powerbi-name'; + /** @hidden */ + Embed.typeAttribute = 'powerbi-type'; + /** @hidden */ + Embed.defaultEmbedHostName = "https://app.powerbi.com"; + /** @hidden */ + Embed.maxFrontLoadTimes = 2; + return Embed; + }()); + exports.Embed = Embed; /***/ }), /* 3 */ /***/ (function(module, exports) { - /** - * Raises a custom event with event data on the specified HTML element. - * - * @export - * @param {HTMLElement} element - * @param {string} eventName - * @param {*} eventData - */ - function raiseCustomEvent(element, eventName, eventData) { - var customEvent; - if (typeof CustomEvent === 'function') { - customEvent = new CustomEvent(eventName, { - detail: eventData, - bubbles: true, - cancelable: true - }); - } - else { - customEvent = document.createEvent('CustomEvent'); - customEvent.initCustomEvent(eventName, true, true, eventData); - } - element.dispatchEvent(customEvent); - } - exports.raiseCustomEvent = raiseCustomEvent; - /** - * Finds the index of the first value in an array that matches the specified predicate. - * - * @export - * @template T - * @param {(x: T) => boolean} predicate - * @param {T[]} xs - * @returns {number} - */ - function findIndex(predicate, xs) { - if (!Array.isArray(xs)) { - throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs); - } - var index; - xs.some(function (x, i) { - if (predicate(x)) { - index = i; - return true; - } - }); - return index; - } - exports.findIndex = findIndex; - /** - * Finds the first value in an array that matches the specified predicate. - * - * @export - * @template T - * @param {(x: T) => boolean} predicate - * @param {T[]} xs - * @returns {T} - */ - function find(predicate, xs) { - var index = findIndex(predicate, xs); - return xs[index]; - } - exports.find = find; - function remove(predicate, xs) { - var index = findIndex(predicate, xs); - xs.splice(index, 1); - } - exports.remove = remove; - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - // TODO: replace in favor of using polyfill - /** - * Copies the values of all enumerable properties from one or more source objects to a target object, and returns the target object. - * - * @export - * @param {any} args - * @returns - */ - function assign() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var target = args[0]; - 'use strict'; - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - } - exports.assign = assign; - /** - * Generates a random 5 to 6 character string. - * - * @export - * @returns {string} - */ - function createRandomString() { - return getRandomValue().toString(36).substring(1); - } - exports.createRandomString = createRandomString; - /** - * Generates a 20 charachter uuid. - * - * @export - * @returns {string} - */ - function generateUUID() { - var d = new Date().getTime(); - if (typeof performance !== 'undefined' && typeof performance.now === 'function') { - d += performance.now(); - } - return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - // Generate a random number, scaled from 0 to 15. - var r = (getRandomValue() % 16); - // Shift 4 times to divide by 16 - d >>= 4; - return r.toString(16); - }); - } - exports.generateUUID = generateUUID; - /** - * Adds a parameter to the given url - * - * @export - * @param {string} url - * @param {string} paramName - * @param {string} value - * @returns {string} - */ - function addParamToUrl(url, paramName, value) { - var parameterPrefix = url.indexOf('?') > 0 ? '&' : '?'; - url += parameterPrefix + paramName + '=' + value; - return url; - } - exports.addParamToUrl = addParamToUrl; - /** - * Checks if the report is saved. - * - * @export - * @param {HttpPostMessage} hpm - * @param {string} uid - * @param {Window} contentWindow - * @returns {Promise} - */ - function isSavedInternal(hpm, uid, contentWindow) { - return hpm.get('/report/hasUnsavedChanges', { uid: uid }, contentWindow) - .then(function (response) { return !response.body; }, function (response) { - throw response.body; - }); - } - exports.isSavedInternal = isSavedInternal; - /** - * Checks if the embed url is for RDL report. - * - * @export - * @param {string} embedUrl - * @returns {boolean} - */ - function isRDLEmbed(embedUrl) { - return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0; - } - exports.isRDLEmbed = isRDLEmbed; - /** - * Checks if the embed url contains autoAuth=true. - * - * @export - * @param {string} embedUrl - * @returns {boolean} - */ - function autoAuthInEmbedUrl(embedUrl) { - return embedUrl && decodeURIComponent(embedUrl).toLowerCase().indexOf("autoauth=true") >= 0; - } - exports.autoAuthInEmbedUrl = autoAuthInEmbedUrl; - /** - * Returns random number - */ - function getRandomValue() { - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - return randomValueArray[0]; - } - exports.getRandomValue = getRandomValue; - /** - * Returns the time interval between two dates in milliseconds - * @export - * @param {Date} start - * @param {Date} end - * @returns {number} - */ - function getTimeDiffInMilliseconds(start, end) { - return Math.abs(start.getTime() - end.getTime()); - } - exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; + /** + * Raises a custom event with event data on the specified HTML element. + * + * @export + * @param {HTMLElement} element + * @param {string} eventName + * @param {*} eventData + */ + function raiseCustomEvent(element, eventName, eventData) { + var customEvent; + if (typeof CustomEvent === 'function') { + customEvent = new CustomEvent(eventName, { + detail: eventData, + bubbles: true, + cancelable: true + }); + } + else { + customEvent = document.createEvent('CustomEvent'); + customEvent.initCustomEvent(eventName, true, true, eventData); + } + element.dispatchEvent(customEvent); + } + exports.raiseCustomEvent = raiseCustomEvent; + /** + * Finds the index of the first value in an array that matches the specified predicate. + * + * @export + * @template T + * @param {(x: T) => boolean} predicate + * @param {T[]} xs + * @returns {number} + */ + function findIndex(predicate, xs) { + if (!Array.isArray(xs)) { + throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs); + } + var index; + xs.some(function (x, i) { + if (predicate(x)) { + index = i; + return true; + } + }); + return index; + } + exports.findIndex = findIndex; + /** + * Finds the first value in an array that matches the specified predicate. + * + * @export + * @template T + * @param {(x: T) => boolean} predicate + * @param {T[]} xs + * @returns {T} + */ + function find(predicate, xs) { + var index = findIndex(predicate, xs); + return xs[index]; + } + exports.find = find; + function remove(predicate, xs) { + var index = findIndex(predicate, xs); + xs.splice(index, 1); + } + exports.remove = remove; + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign + // TODO: replace in favor of using polyfill + /** + * Copies the values of all enumerable properties from one or more source objects to a target object, and returns the target object. + * + * @export + * @param {any} args + * @returns + */ + function assign() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + var target = args[0]; + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; + } + exports.assign = assign; + /** + * Generates a random 5 to 6 character string. + * + * @export + * @returns {string} + */ + function createRandomString() { + return getRandomValue().toString(36).substring(1); + } + exports.createRandomString = createRandomString; + /** + * Generates a 20 charachter uuid. + * + * @export + * @returns {string} + */ + function generateUUID() { + var d = new Date().getTime(); + if (typeof performance !== 'undefined' && typeof performance.now === 'function') { + d += performance.now(); + } + return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + // Generate a random number, scaled from 0 to 15. + var r = (getRandomValue() % 16); + // Shift 4 times to divide by 16 + d >>= 4; + return r.toString(16); + }); + } + exports.generateUUID = generateUUID; + /** + * Adds a parameter to the given url + * + * @export + * @param {string} url + * @param {string} paramName + * @param {string} value + * @returns {string} + */ + function addParamToUrl(url, paramName, value) { + var parameterPrefix = url.indexOf('?') > 0 ? '&' : '?'; + url += parameterPrefix + paramName + '=' + value; + return url; + } + exports.addParamToUrl = addParamToUrl; + /** + * Checks if the report is saved. + * + * @export + * @param {HttpPostMessage} hpm + * @param {string} uid + * @param {Window} contentWindow + * @returns {Promise} + */ + function isSavedInternal(hpm, uid, contentWindow) { + return hpm.get('/report/hasUnsavedChanges', { uid: uid }, contentWindow) + .then(function (response) { return !response.body; }, function (response) { + throw response.body; + }); + } + exports.isSavedInternal = isSavedInternal; + /** + * Checks if the embed url is for RDL report. + * + * @export + * @param {string} embedUrl + * @returns {boolean} + */ + function isRDLEmbed(embedUrl) { + return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0; + } + exports.isRDLEmbed = isRDLEmbed; + /** + * Checks if the embed url contains autoAuth=true. + * + * @export + * @param {string} embedUrl + * @returns {boolean} + */ + function autoAuthInEmbedUrl(embedUrl) { + return embedUrl && decodeURIComponent(embedUrl).toLowerCase().indexOf("autoauth=true") >= 0; + } + exports.autoAuthInEmbedUrl = autoAuthInEmbedUrl; + /** + * Returns random number + */ + function getRandomValue() { + // window.msCrypto for IE + var cryptoObj = window.crypto || window.msCrypto; + var randomValueArray = new Uint32Array(1); + cryptoObj.getRandomValues(randomValueArray); + return randomValueArray[0]; + } + exports.getRandomValue = getRandomValue; + /** + * Returns the time interval between two dates in milliseconds + * @export + * @param {Date} start + * @param {Date} end + * @returns {number} + */ + function getTimeDiffInMilliseconds(start, end) { + return Math.abs(start.getTime() - end.getTime()); + } + exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; /***/ }), /* 4 */ /***/ (function(module, exports) { - /** @ignore */ /** */ - var config = { - version: '2.15.1', - type: 'js' - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = config; + /** @ignore */ /** */ + var config = { + version: '2.15.1', + type: 'js' + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = config; /***/ }), @@ -1415,3920 +1415,3920 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = exports.Validators = void 0; - exports.Validators = __webpack_require__(1).Validators; - var TraceType; - (function (TraceType) { - TraceType[TraceType["Information"] = 0] = "Information"; - TraceType[TraceType["Verbose"] = 1] = "Verbose"; - TraceType[TraceType["Warning"] = 2] = "Warning"; - TraceType[TraceType["Error"] = 3] = "Error"; - TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError"; - TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError"; - TraceType[TraceType["Fatal"] = 6] = "Fatal"; - })(TraceType = exports.TraceType || (exports.TraceType = {})); - var PageSizeType; - (function (PageSizeType) { - PageSizeType[PageSizeType["Widescreen"] = 0] = "Widescreen"; - PageSizeType[PageSizeType["Standard"] = 1] = "Standard"; - PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana"; - PageSizeType[PageSizeType["Letter"] = 3] = "Letter"; - PageSizeType[PageSizeType["Custom"] = 4] = "Custom"; - })(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {})); - var DisplayOption; - (function (DisplayOption) { - DisplayOption[DisplayOption["FitToPage"] = 0] = "FitToPage"; - DisplayOption[DisplayOption["FitToWidth"] = 1] = "FitToWidth"; - DisplayOption[DisplayOption["ActualSize"] = 2] = "ActualSize"; - })(DisplayOption = exports.DisplayOption || (exports.DisplayOption = {})); - var BackgroundType; - (function (BackgroundType) { - BackgroundType[BackgroundType["Default"] = 0] = "Default"; - BackgroundType[BackgroundType["Transparent"] = 1] = "Transparent"; - })(BackgroundType = exports.BackgroundType || (exports.BackgroundType = {})); - var VisualContainerDisplayMode; - (function (VisualContainerDisplayMode) { - VisualContainerDisplayMode[VisualContainerDisplayMode["Visible"] = 0] = "Visible"; - VisualContainerDisplayMode[VisualContainerDisplayMode["Hidden"] = 1] = "Hidden"; - })(VisualContainerDisplayMode = exports.VisualContainerDisplayMode || (exports.VisualContainerDisplayMode = {})); - var LayoutType; - (function (LayoutType) { - LayoutType[LayoutType["Master"] = 0] = "Master"; - LayoutType[LayoutType["Custom"] = 1] = "Custom"; - LayoutType[LayoutType["MobilePortrait"] = 2] = "MobilePortrait"; - LayoutType[LayoutType["MobileLandscape"] = 3] = "MobileLandscape"; - })(LayoutType = exports.LayoutType || (exports.LayoutType = {})); - var HyperlinkClickBehavior; - (function (HyperlinkClickBehavior) { - HyperlinkClickBehavior[HyperlinkClickBehavior["Navigate"] = 0] = "Navigate"; - HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent"; - HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent"; - })(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {})); - var SectionVisibility; - (function (SectionVisibility) { - SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible"; - SectionVisibility[SectionVisibility["HiddenInViewMode"] = 1] = "HiddenInViewMode"; - })(SectionVisibility = exports.SectionVisibility || (exports.SectionVisibility = {})); - var Permissions; - (function (Permissions) { - Permissions[Permissions["Read"] = 0] = "Read"; - Permissions[Permissions["ReadWrite"] = 1] = "ReadWrite"; - Permissions[Permissions["Copy"] = 2] = "Copy"; - Permissions[Permissions["Create"] = 4] = "Create"; - Permissions[Permissions["All"] = 7] = "All"; - })(Permissions = exports.Permissions || (exports.Permissions = {})); - var ViewMode; - (function (ViewMode) { - ViewMode[ViewMode["View"] = 0] = "View"; - ViewMode[ViewMode["Edit"] = 1] = "Edit"; - })(ViewMode = exports.ViewMode || (exports.ViewMode = {})); - var TokenType; - (function (TokenType) { - TokenType[TokenType["Aad"] = 0] = "Aad"; - TokenType[TokenType["Embed"] = 1] = "Embed"; - })(TokenType = exports.TokenType || (exports.TokenType = {})); - var ContrastMode; - (function (ContrastMode) { - ContrastMode[ContrastMode["None"] = 0] = "None"; - ContrastMode[ContrastMode["HighContrast1"] = 1] = "HighContrast1"; - ContrastMode[ContrastMode["HighContrast2"] = 2] = "HighContrast2"; - ContrastMode[ContrastMode["HighContrastBlack"] = 3] = "HighContrastBlack"; - ContrastMode[ContrastMode["HighContrastWhite"] = 4] = "HighContrastWhite"; - })(ContrastMode = exports.ContrastMode || (exports.ContrastMode = {})); - var MenuLocation; - (function (MenuLocation) { - MenuLocation[MenuLocation["Bottom"] = 0] = "Bottom"; - MenuLocation[MenuLocation["Top"] = 1] = "Top"; - })(MenuLocation = exports.MenuLocation || (exports.MenuLocation = {})); - var FiltersLevel; - (function (FiltersLevel) { - FiltersLevel[FiltersLevel["Report"] = 0] = "Report"; - FiltersLevel[FiltersLevel["Page"] = 1] = "Page"; - FiltersLevel[FiltersLevel["Visual"] = 2] = "Visual"; - })(FiltersLevel = exports.FiltersLevel || (exports.FiltersLevel = {})); - var FilterType; - (function (FilterType) { - FilterType[FilterType["Advanced"] = 0] = "Advanced"; - FilterType[FilterType["Basic"] = 1] = "Basic"; - FilterType[FilterType["Unknown"] = 2] = "Unknown"; - FilterType[FilterType["IncludeExclude"] = 3] = "IncludeExclude"; - FilterType[FilterType["RelativeDate"] = 4] = "RelativeDate"; - FilterType[FilterType["TopN"] = 5] = "TopN"; - FilterType[FilterType["Tuple"] = 6] = "Tuple"; - FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime"; - })(FilterType = exports.FilterType || (exports.FilterType = {})); - var RelativeDateFilterTimeUnit; - (function (RelativeDateFilterTimeUnit) { - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Days"] = 0] = "Days"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Weeks"] = 1] = "Weeks"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarWeeks"] = 2] = "CalendarWeeks"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Months"] = 3] = "Months"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarMonths"] = 4] = "CalendarMonths"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Years"] = 5] = "Years"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarYears"] = 6] = "CalendarYears"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Minutes"] = 7] = "Minutes"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Hours"] = 8] = "Hours"; - })(RelativeDateFilterTimeUnit = exports.RelativeDateFilterTimeUnit || (exports.RelativeDateFilterTimeUnit = {})); - var RelativeDateOperators; - (function (RelativeDateOperators) { - RelativeDateOperators[RelativeDateOperators["InLast"] = 0] = "InLast"; - RelativeDateOperators[RelativeDateOperators["InThis"] = 1] = "InThis"; - RelativeDateOperators[RelativeDateOperators["InNext"] = 2] = "InNext"; - })(RelativeDateOperators = exports.RelativeDateOperators || (exports.RelativeDateOperators = {})); - var Filter = /** @class */ (function () { - function Filter(target, filterType) { - this.target = target; - this.filterType = filterType; - } - Filter.prototype.toJSON = function () { - var filter = { - $schema: this.schemaUrl, - target: this.target, - filterType: this.filterType - }; - // Add displaySettings only when defined - if (this.displaySettings !== undefined) { - filter.displaySettings = this.displaySettings; - } - return filter; - }; - ; - return Filter; - }()); - exports.Filter = Filter; - var NotSupportedFilter = /** @class */ (function (_super) { - __extends(NotSupportedFilter, _super); - function NotSupportedFilter(target, message, notSupportedTypeName) { - var _this = _super.call(this, target, FilterType.Unknown) || this; - _this.message = message; - _this.notSupportedTypeName = notSupportedTypeName; - _this.schemaUrl = NotSupportedFilter.schemaUrl; - return _this; - } - NotSupportedFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.message = this.message; - filter.notSupportedTypeName = this.notSupportedTypeName; - return filter; - }; - NotSupportedFilter.schemaUrl = "http://powerbi.com/product/schema#notSupported"; - return NotSupportedFilter; - }(Filter)); - exports.NotSupportedFilter = NotSupportedFilter; - var IncludeExcludeFilter = /** @class */ (function (_super) { - __extends(IncludeExcludeFilter, _super); - function IncludeExcludeFilter(target, isExclude, values) { - var _this = _super.call(this, target, FilterType.IncludeExclude) || this; - _this.values = values; - _this.isExclude = isExclude; - _this.schemaUrl = IncludeExcludeFilter.schemaUrl; - return _this; - } - IncludeExcludeFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.isExclude = this.isExclude; - filter.values = this.values; - return filter; - }; - IncludeExcludeFilter.schemaUrl = "http://powerbi.com/product/schema#includeExclude"; - return IncludeExcludeFilter; - }(Filter)); - exports.IncludeExcludeFilter = IncludeExcludeFilter; - var TopNFilter = /** @class */ (function (_super) { - __extends(TopNFilter, _super); - function TopNFilter(target, operator, itemCount, orderBy) { - var _this = _super.call(this, target, FilterType.TopN) || this; - _this.operator = operator; - _this.itemCount = itemCount; - _this.schemaUrl = TopNFilter.schemaUrl; - _this.orderBy = orderBy; - return _this; - } - TopNFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.itemCount = this.itemCount; - filter.orderBy = this.orderBy; - return filter; - }; - TopNFilter.schemaUrl = "http://powerbi.com/product/schema#topN"; - return TopNFilter; - }(Filter)); - exports.TopNFilter = TopNFilter; - var RelativeDateFilter = /** @class */ (function (_super) { - __extends(RelativeDateFilter, _super); - function RelativeDateFilter(target, operator, timeUnitsCount, timeUnitType, includeToday) { - var _this = _super.call(this, target, FilterType.RelativeDate) || this; - _this.operator = operator; - _this.timeUnitsCount = timeUnitsCount; - _this.timeUnitType = timeUnitType; - _this.includeToday = includeToday; - _this.schemaUrl = RelativeDateFilter.schemaUrl; - return _this; - } - RelativeDateFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.timeUnitsCount = this.timeUnitsCount; - filter.timeUnitType = this.timeUnitType; - filter.includeToday = this.includeToday; - return filter; - }; - RelativeDateFilter.schemaUrl = "http://powerbi.com/product/schema#relativeDate"; - return RelativeDateFilter; - }(Filter)); - exports.RelativeDateFilter = RelativeDateFilter; - var RelativeTimeFilter = /** @class */ (function (_super) { - __extends(RelativeTimeFilter, _super); - function RelativeTimeFilter(target, operator, timeUnitsCount, timeUnitType) { - var _this = _super.call(this, target, FilterType.RelativeTime) || this; - _this.operator = operator; - _this.timeUnitsCount = timeUnitsCount; - _this.timeUnitType = timeUnitType; - _this.schemaUrl = RelativeTimeFilter.schemaUrl; - return _this; - } - RelativeTimeFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.timeUnitsCount = this.timeUnitsCount; - filter.timeUnitType = this.timeUnitType; - return filter; - }; - RelativeTimeFilter.schemaUrl = "http://powerbi.com/product/schema#relativeTime"; - return RelativeTimeFilter; - }(Filter)); - exports.RelativeTimeFilter = RelativeTimeFilter; - var BasicFilter = /** @class */ (function (_super) { - __extends(BasicFilter, _super); - function BasicFilter(target, operator) { - var values = []; - for (var _i = 2; _i < arguments.length; _i++) { - values[_i - 2] = arguments[_i]; - } - var _this = _super.call(this, target, FilterType.Basic) || this; - _this.operator = operator; - _this.schemaUrl = BasicFilter.schemaUrl; - if (values.length === 0 && operator !== "All") { - throw new Error("values must be a non-empty array unless your operator is \"All\"."); - } - /** - * Accept values as array instead of as individual arguments - * new BasicFilter('a', 'b', 1, 2); - * new BasicFilter('a', 'b', [1,2]); - */ - if (Array.isArray(values[0])) { - _this.values = values[0]; - } - else { - _this.values = values; - } - return _this; - } - BasicFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.values = this.values; - filter.requireSingleSelection = !!this.requireSingleSelection; - return filter; - }; - BasicFilter.schemaUrl = "http://powerbi.com/product/schema#basic"; - return BasicFilter; - }(Filter)); - exports.BasicFilter = BasicFilter; - var BasicFilterWithKeys = /** @class */ (function (_super) { - __extends(BasicFilterWithKeys, _super); - function BasicFilterWithKeys(target, operator, values, keyValues) { - var _this = _super.call(this, target, operator, values) || this; - _this.keyValues = keyValues; - _this.target = target; - var numberOfKeys = target.keys ? target.keys.length : 0; - if (numberOfKeys > 0 && !keyValues) { - throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys"); - } - if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { - throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); - } - for (var i = 0; i < _this.keyValues.length; i++) { - if (_this.keyValues[i]) { - var lengthOfArray = _this.keyValues[i].length; - if (lengthOfArray !== numberOfKeys) { - throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); - } - } - } - return _this; - } - BasicFilterWithKeys.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.keyValues = this.keyValues; - return filter; - }; - return BasicFilterWithKeys; - }(BasicFilter)); - exports.BasicFilterWithKeys = BasicFilterWithKeys; - var TupleFilter = /** @class */ (function (_super) { - __extends(TupleFilter, _super); - function TupleFilter(target, operator, values) { - var _this = _super.call(this, target, FilterType.Tuple) || this; - _this.operator = operator; - _this.schemaUrl = TupleFilter.schemaUrl; - _this.values = values; - return _this; - } - TupleFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.values = this.values; - filter.target = this.target; - return filter; - }; - TupleFilter.schemaUrl = "http://powerbi.com/product/schema#tuple"; - return TupleFilter; - }(Filter)); - exports.TupleFilter = TupleFilter; - var AdvancedFilter = /** @class */ (function (_super) { - __extends(AdvancedFilter, _super); - function AdvancedFilter(target, logicalOperator) { - var conditions = []; - for (var _i = 2; _i < arguments.length; _i++) { - conditions[_i - 2] = arguments[_i]; - } - var _this = _super.call(this, target, FilterType.Advanced) || this; - _this.schemaUrl = AdvancedFilter.schemaUrl; - // Guard statements - if (typeof logicalOperator !== "string" || logicalOperator.length === 0) { - // TODO: It would be nicer to list out the possible logical operators. - throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator); - } - _this.logicalOperator = logicalOperator; - var extractedConditions; - /** - * Accept conditions as array instead of as individual arguments - * new AdvancedFilter('a', 'b', "And", { value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }); - * new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]); - */ - if (Array.isArray(conditions[0])) { - extractedConditions = conditions[0]; - } - else { - extractedConditions = conditions; - } - if (extractedConditions.length === 0) { - throw new Error("conditions must be a non-empty array. You passed: " + conditions); - } - if (extractedConditions.length > 2) { - throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length); - } - if (extractedConditions.length === 1 && logicalOperator !== "And") { - throw new Error("Logical Operator must be \"And\" when there is only one condition provided"); - } - _this.conditions = extractedConditions; - return _this; - } - AdvancedFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.logicalOperator = this.logicalOperator; - filter.conditions = this.conditions; - return filter; - }; - AdvancedFilter.schemaUrl = "http://powerbi.com/product/schema#advanced"; - return AdvancedFilter; - }(Filter)); - exports.AdvancedFilter = AdvancedFilter; - function isFilterKeyColumnsTarget(target) { - return isColumn(target) && !!target.keys; - } - exports.isFilterKeyColumnsTarget = isFilterKeyColumnsTarget; - function isBasicFilterWithKeys(filter) { - return getFilterType(filter) === FilterType.Basic && !!filter.keyValues; - } - exports.isBasicFilterWithKeys = isBasicFilterWithKeys; - function getFilterType(filter) { - if (filter.filterType) { - return filter.filterType; - } - var basicFilter = filter; - var advancedFilter = filter; - if ((typeof basicFilter.operator === "string") - && (Array.isArray(basicFilter.values))) { - return FilterType.Basic; - } - else if ((typeof advancedFilter.logicalOperator === "string") - && (Array.isArray(advancedFilter.conditions))) { - return FilterType.Advanced; - } - else { - return FilterType.Unknown; - } - } - exports.getFilterType = getFilterType; - function isMeasure(arg) { - return arg.table !== undefined && arg.measure !== undefined; - } - exports.isMeasure = isMeasure; - function isColumn(arg) { - return !!(arg.table && arg.column && !arg.aggregationFunction); - } - exports.isColumn = isColumn; - function isHierarchyLevel(arg) { - return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && !arg.aggregationFunction); - } - exports.isHierarchyLevel = isHierarchyLevel; - function isHierarchyLevelAggr(arg) { - return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && arg.aggregationFunction); - } - exports.isHierarchyLevelAggr = isHierarchyLevelAggr; - function isColumnAggr(arg) { - return !!(arg.table && arg.column && arg.aggregationFunction); - } - exports.isColumnAggr = isColumnAggr; - var PageNavigationPosition; - (function (PageNavigationPosition) { - PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; - PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; - })(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); - var QnaMode; - (function (QnaMode) { - QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; - QnaMode[QnaMode["ResultOnly"] = 1] = "ResultOnly"; - })(QnaMode = exports.QnaMode || (exports.QnaMode = {})); - var ExportDataType; - (function (ExportDataType) { - ExportDataType[ExportDataType["Summarized"] = 0] = "Summarized"; - ExportDataType[ExportDataType["Underlying"] = 1] = "Underlying"; - })(ExportDataType = exports.ExportDataType || (exports.ExportDataType = {})); - var BookmarksPlayMode; - (function (BookmarksPlayMode) { - BookmarksPlayMode[BookmarksPlayMode["Off"] = 0] = "Off"; - BookmarksPlayMode[BookmarksPlayMode["Presentation"] = 1] = "Presentation"; - })(BookmarksPlayMode = exports.BookmarksPlayMode || (exports.BookmarksPlayMode = {})); - // This is not an enum because enum strings require - // us to upgrade typeScript version and change SDK build definition - exports.CommonErrorCodes = { - TokenExpired: 'TokenExpired', - NotFound: 'PowerBIEntityNotFound', - InvalidParameters: 'Invalid parameters', - LoadReportFailed: 'LoadReportFailed', - NotAuthorized: 'PowerBINotAuthorizedException', - FailedToLoadModel: 'ExplorationContainer_FailedToLoadModel_DefaultDetails', - }; - exports.TextAlignment = { - Left: 'left', - Center: 'center', - Right: 'right', - }; - exports.LegendPosition = { - Top: 'Top', - Bottom: 'Bottom', - Right: 'Right', - Left: 'Left', - TopCenter: 'TopCenter', - BottomCenter: 'BottomCenter', - RightCenter: 'RightCenter', - LeftCenter: 'LeftCenter', - }; - var SortDirection; - (function (SortDirection) { - SortDirection[SortDirection["Ascending"] = 1] = "Ascending"; - SortDirection[SortDirection["Descending"] = 2] = "Descending"; - })(SortDirection = exports.SortDirection || (exports.SortDirection = {})); - var Selector = /** @class */ (function () { - function Selector(schema) { - this.$schema = schema; - } - Selector.prototype.toJSON = function () { - return { - $schema: this.$schema - }; - }; - ; - return Selector; - }()); - exports.Selector = Selector; - var PageSelector = /** @class */ (function (_super) { - __extends(PageSelector, _super); - function PageSelector(pageName) { - var _this = _super.call(this, PageSelector.schemaUrl) || this; - _this.pageName = pageName; - return _this; - } - PageSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.pageName = this.pageName; - return selector; - }; - PageSelector.schemaUrl = "http://powerbi.com/product/schema#pageSelector"; - return PageSelector; - }(Selector)); - exports.PageSelector = PageSelector; - var VisualSelector = /** @class */ (function (_super) { - __extends(VisualSelector, _super); - function VisualSelector(visualName) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.visualName = visualName; - return _this; - } - VisualSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.visualName = this.visualName; - return selector; - }; - VisualSelector.schemaUrl = "http://powerbi.com/product/schema#visualSelector"; - return VisualSelector; - }(Selector)); - exports.VisualSelector = VisualSelector; - var VisualTypeSelector = /** @class */ (function (_super) { - __extends(VisualTypeSelector, _super); - function VisualTypeSelector(visualType) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.visualType = visualType; - return _this; - } - VisualTypeSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.visualType = this.visualType; - return selector; - }; - VisualTypeSelector.schemaUrl = "http://powerbi.com/product/schema#visualTypeSelector"; - return VisualTypeSelector; - }(Selector)); - exports.VisualTypeSelector = VisualTypeSelector; - var SlicerTargetSelector = /** @class */ (function (_super) { - __extends(SlicerTargetSelector, _super); - function SlicerTargetSelector(target) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.target = target; - return _this; - } - SlicerTargetSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.target = this.target; - return selector; - }; - SlicerTargetSelector.schemaUrl = "http://powerbi.com/product/schema#slicerTargetSelector"; - return SlicerTargetSelector; - }(Selector)); - exports.SlicerTargetSelector = SlicerTargetSelector; - var CommandDisplayOption; - (function (CommandDisplayOption) { - CommandDisplayOption[CommandDisplayOption["Enabled"] = 0] = "Enabled"; - CommandDisplayOption[CommandDisplayOption["Disabled"] = 1] = "Disabled"; - CommandDisplayOption[CommandDisplayOption["Hidden"] = 2] = "Hidden"; - })(CommandDisplayOption = exports.CommandDisplayOption || (exports.CommandDisplayOption = {})); - /* - * Visual CRUD - */ - var VisualDataRoleKind; - (function (VisualDataRoleKind) { - // Indicates that the role should be bound to something that evaluates to a grouping of values. - VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping"; - // Indicates that the role should be bound to something that evaluates to a single value in a scope. - VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure"; - // Indicates that the role can be bound to either Grouping or Measure. - VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure"; - })(VisualDataRoleKind = exports.VisualDataRoleKind || (exports.VisualDataRoleKind = {})); - // Indicates the visual preference on Grouping or Measure. Only applicable if kind is GroupingOrMeasure. - var VisualDataRoleKindPreference; - (function (VisualDataRoleKindPreference) { - VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; - VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; - })(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); - function normalizeError(error) { - var message = error.message; - if (!message) { - message = error.path + " is invalid. Not meeting " + error.keyword + " constraint"; - } - return { - message: message - }; - } - function validateVisualSelector(input) { - var errors = exports.Validators.visualSelectorValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualSelector = validateVisualSelector; - function validateSlicer(input) { - var errors = exports.Validators.slicerValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSlicer = validateSlicer; - function validateSlicerState(input) { - var errors = exports.Validators.slicerStateValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSlicerState = validateSlicerState; - function validatePlayBookmarkRequest(input) { - var errors = exports.Validators.playBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; - function validateAddBookmarkRequest(input) { - var errors = exports.Validators.addBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateAddBookmarkRequest = validateAddBookmarkRequest; - function validateApplyBookmarkByNameRequest(input) { - var errors = exports.Validators.applyBookmarkByNameRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; - function validateApplyBookmarkStateRequest(input) { - var errors = exports.Validators.applyBookmarkStateRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; - function validateCaptureBookmarkRequest(input) { - var errors = exports.Validators.captureBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; - function validateSettings(input) { - var errors = exports.Validators.settingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSettings = validateSettings; - function validatePanes(input) { - var errors = exports.Validators.reportPanesValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePanes = validatePanes; - function validateBookmarksPane(input) { - var errors = exports.Validators.bookmarksPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateBookmarksPane = validateBookmarksPane; - function validateFiltersPane(input) { - var errors = exports.Validators.filtersPanesValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateFiltersPane = validateFiltersPane; - function validateFieldsPane(input) { - var errors = exports.Validators.fieldsPanesValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateFieldsPane = validateFieldsPane; - function validatePageNavigationPane(input) { - var errors = exports.Validators.pageNavigationPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePageNavigationPane = validatePageNavigationPane; - function validateSelectionPane(input) { - var errors = exports.Validators.selectionPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSelectionPane = validateSelectionPane; - function validateSyncSlicersPane(input) { - var errors = exports.Validators.syncSlicersPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSyncSlicersPane = validateSyncSlicersPane; - function validateVisualizationsPane(input) { - var errors = exports.Validators.visualizationsPanesValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualizationsPane = validateVisualizationsPane; - function validateCustomPageSize(input) { - var errors = exports.Validators.customPageSizeValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCustomPageSize = validateCustomPageSize; - function validateExtension(input) { - var errors = exports.Validators.extensionValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateExtension = validateExtension; - function validateReportLoad(input) { - var errors = exports.Validators.reportLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateReportLoad = validateReportLoad; - function validateCreateReport(input) { - var errors = exports.Validators.reportCreateValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCreateReport = validateCreateReport; - function validateDashboardLoad(input) { - var errors = exports.Validators.dashboardLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateDashboardLoad = validateDashboardLoad; - function validateTileLoad(input) { - var errors = exports.Validators.tileLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateTileLoad = validateTileLoad; - function validatePage(input) { - var errors = exports.Validators.pageValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePage = validatePage; - function validateFilter(input) { - var errors = exports.Validators.filtersValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateFilter = validateFilter; - function validateSaveAsParameters(input) { - var errors = exports.Validators.saveAsParametersValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSaveAsParameters = validateSaveAsParameters; - function validateLoadQnaConfiguration(input) { - var errors = exports.Validators.loadQnaValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; - function validateQnaInterpretInputData(input) { - var errors = exports.Validators.qnaInterpretInputDataValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateQnaInterpretInputData = validateQnaInterpretInputData; - function validateExportDataRequest(input) { - var errors = exports.Validators.exportDataRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateExportDataRequest = validateExportDataRequest; - function validateVisualHeader(input) { - var errors = exports.Validators.visualHeaderValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualHeader = validateVisualHeader; - function validateVisualSettings(input) { - var errors = exports.Validators.visualSettingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualSettings = validateVisualSettings; - function validateCommandsSettings(input) { - var errors = exports.Validators.commandsSettingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCommandsSettings = validateCommandsSettings; - function validateCustomTheme(input) { - var errors = exports.Validators.customThemeValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCustomTheme = validateCustomTheme; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = exports.Validators = void 0; + exports.Validators = __webpack_require__(1).Validators; + var TraceType; + (function (TraceType) { + TraceType[TraceType["Information"] = 0] = "Information"; + TraceType[TraceType["Verbose"] = 1] = "Verbose"; + TraceType[TraceType["Warning"] = 2] = "Warning"; + TraceType[TraceType["Error"] = 3] = "Error"; + TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError"; + TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError"; + TraceType[TraceType["Fatal"] = 6] = "Fatal"; + })(TraceType = exports.TraceType || (exports.TraceType = {})); + var PageSizeType; + (function (PageSizeType) { + PageSizeType[PageSizeType["Widescreen"] = 0] = "Widescreen"; + PageSizeType[PageSizeType["Standard"] = 1] = "Standard"; + PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana"; + PageSizeType[PageSizeType["Letter"] = 3] = "Letter"; + PageSizeType[PageSizeType["Custom"] = 4] = "Custom"; + })(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {})); + var DisplayOption; + (function (DisplayOption) { + DisplayOption[DisplayOption["FitToPage"] = 0] = "FitToPage"; + DisplayOption[DisplayOption["FitToWidth"] = 1] = "FitToWidth"; + DisplayOption[DisplayOption["ActualSize"] = 2] = "ActualSize"; + })(DisplayOption = exports.DisplayOption || (exports.DisplayOption = {})); + var BackgroundType; + (function (BackgroundType) { + BackgroundType[BackgroundType["Default"] = 0] = "Default"; + BackgroundType[BackgroundType["Transparent"] = 1] = "Transparent"; + })(BackgroundType = exports.BackgroundType || (exports.BackgroundType = {})); + var VisualContainerDisplayMode; + (function (VisualContainerDisplayMode) { + VisualContainerDisplayMode[VisualContainerDisplayMode["Visible"] = 0] = "Visible"; + VisualContainerDisplayMode[VisualContainerDisplayMode["Hidden"] = 1] = "Hidden"; + })(VisualContainerDisplayMode = exports.VisualContainerDisplayMode || (exports.VisualContainerDisplayMode = {})); + var LayoutType; + (function (LayoutType) { + LayoutType[LayoutType["Master"] = 0] = "Master"; + LayoutType[LayoutType["Custom"] = 1] = "Custom"; + LayoutType[LayoutType["MobilePortrait"] = 2] = "MobilePortrait"; + LayoutType[LayoutType["MobileLandscape"] = 3] = "MobileLandscape"; + })(LayoutType = exports.LayoutType || (exports.LayoutType = {})); + var HyperlinkClickBehavior; + (function (HyperlinkClickBehavior) { + HyperlinkClickBehavior[HyperlinkClickBehavior["Navigate"] = 0] = "Navigate"; + HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent"; + HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent"; + })(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {})); + var SectionVisibility; + (function (SectionVisibility) { + SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible"; + SectionVisibility[SectionVisibility["HiddenInViewMode"] = 1] = "HiddenInViewMode"; + })(SectionVisibility = exports.SectionVisibility || (exports.SectionVisibility = {})); + var Permissions; + (function (Permissions) { + Permissions[Permissions["Read"] = 0] = "Read"; + Permissions[Permissions["ReadWrite"] = 1] = "ReadWrite"; + Permissions[Permissions["Copy"] = 2] = "Copy"; + Permissions[Permissions["Create"] = 4] = "Create"; + Permissions[Permissions["All"] = 7] = "All"; + })(Permissions = exports.Permissions || (exports.Permissions = {})); + var ViewMode; + (function (ViewMode) { + ViewMode[ViewMode["View"] = 0] = "View"; + ViewMode[ViewMode["Edit"] = 1] = "Edit"; + })(ViewMode = exports.ViewMode || (exports.ViewMode = {})); + var TokenType; + (function (TokenType) { + TokenType[TokenType["Aad"] = 0] = "Aad"; + TokenType[TokenType["Embed"] = 1] = "Embed"; + })(TokenType = exports.TokenType || (exports.TokenType = {})); + var ContrastMode; + (function (ContrastMode) { + ContrastMode[ContrastMode["None"] = 0] = "None"; + ContrastMode[ContrastMode["HighContrast1"] = 1] = "HighContrast1"; + ContrastMode[ContrastMode["HighContrast2"] = 2] = "HighContrast2"; + ContrastMode[ContrastMode["HighContrastBlack"] = 3] = "HighContrastBlack"; + ContrastMode[ContrastMode["HighContrastWhite"] = 4] = "HighContrastWhite"; + })(ContrastMode = exports.ContrastMode || (exports.ContrastMode = {})); + var MenuLocation; + (function (MenuLocation) { + MenuLocation[MenuLocation["Bottom"] = 0] = "Bottom"; + MenuLocation[MenuLocation["Top"] = 1] = "Top"; + })(MenuLocation = exports.MenuLocation || (exports.MenuLocation = {})); + var FiltersLevel; + (function (FiltersLevel) { + FiltersLevel[FiltersLevel["Report"] = 0] = "Report"; + FiltersLevel[FiltersLevel["Page"] = 1] = "Page"; + FiltersLevel[FiltersLevel["Visual"] = 2] = "Visual"; + })(FiltersLevel = exports.FiltersLevel || (exports.FiltersLevel = {})); + var FilterType; + (function (FilterType) { + FilterType[FilterType["Advanced"] = 0] = "Advanced"; + FilterType[FilterType["Basic"] = 1] = "Basic"; + FilterType[FilterType["Unknown"] = 2] = "Unknown"; + FilterType[FilterType["IncludeExclude"] = 3] = "IncludeExclude"; + FilterType[FilterType["RelativeDate"] = 4] = "RelativeDate"; + FilterType[FilterType["TopN"] = 5] = "TopN"; + FilterType[FilterType["Tuple"] = 6] = "Tuple"; + FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime"; + })(FilterType = exports.FilterType || (exports.FilterType = {})); + var RelativeDateFilterTimeUnit; + (function (RelativeDateFilterTimeUnit) { + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Days"] = 0] = "Days"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Weeks"] = 1] = "Weeks"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarWeeks"] = 2] = "CalendarWeeks"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Months"] = 3] = "Months"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarMonths"] = 4] = "CalendarMonths"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Years"] = 5] = "Years"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarYears"] = 6] = "CalendarYears"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Minutes"] = 7] = "Minutes"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Hours"] = 8] = "Hours"; + })(RelativeDateFilterTimeUnit = exports.RelativeDateFilterTimeUnit || (exports.RelativeDateFilterTimeUnit = {})); + var RelativeDateOperators; + (function (RelativeDateOperators) { + RelativeDateOperators[RelativeDateOperators["InLast"] = 0] = "InLast"; + RelativeDateOperators[RelativeDateOperators["InThis"] = 1] = "InThis"; + RelativeDateOperators[RelativeDateOperators["InNext"] = 2] = "InNext"; + })(RelativeDateOperators = exports.RelativeDateOperators || (exports.RelativeDateOperators = {})); + var Filter = /** @class */ (function () { + function Filter(target, filterType) { + this.target = target; + this.filterType = filterType; + } + Filter.prototype.toJSON = function () { + var filter = { + $schema: this.schemaUrl, + target: this.target, + filterType: this.filterType + }; + // Add displaySettings only when defined + if (this.displaySettings !== undefined) { + filter.displaySettings = this.displaySettings; + } + return filter; + }; + ; + return Filter; + }()); + exports.Filter = Filter; + var NotSupportedFilter = /** @class */ (function (_super) { + __extends(NotSupportedFilter, _super); + function NotSupportedFilter(target, message, notSupportedTypeName) { + var _this = _super.call(this, target, FilterType.Unknown) || this; + _this.message = message; + _this.notSupportedTypeName = notSupportedTypeName; + _this.schemaUrl = NotSupportedFilter.schemaUrl; + return _this; + } + NotSupportedFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.message = this.message; + filter.notSupportedTypeName = this.notSupportedTypeName; + return filter; + }; + NotSupportedFilter.schemaUrl = "http://powerbi.com/product/schema#notSupported"; + return NotSupportedFilter; + }(Filter)); + exports.NotSupportedFilter = NotSupportedFilter; + var IncludeExcludeFilter = /** @class */ (function (_super) { + __extends(IncludeExcludeFilter, _super); + function IncludeExcludeFilter(target, isExclude, values) { + var _this = _super.call(this, target, FilterType.IncludeExclude) || this; + _this.values = values; + _this.isExclude = isExclude; + _this.schemaUrl = IncludeExcludeFilter.schemaUrl; + return _this; + } + IncludeExcludeFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.isExclude = this.isExclude; + filter.values = this.values; + return filter; + }; + IncludeExcludeFilter.schemaUrl = "http://powerbi.com/product/schema#includeExclude"; + return IncludeExcludeFilter; + }(Filter)); + exports.IncludeExcludeFilter = IncludeExcludeFilter; + var TopNFilter = /** @class */ (function (_super) { + __extends(TopNFilter, _super); + function TopNFilter(target, operator, itemCount, orderBy) { + var _this = _super.call(this, target, FilterType.TopN) || this; + _this.operator = operator; + _this.itemCount = itemCount; + _this.schemaUrl = TopNFilter.schemaUrl; + _this.orderBy = orderBy; + return _this; + } + TopNFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.itemCount = this.itemCount; + filter.orderBy = this.orderBy; + return filter; + }; + TopNFilter.schemaUrl = "http://powerbi.com/product/schema#topN"; + return TopNFilter; + }(Filter)); + exports.TopNFilter = TopNFilter; + var RelativeDateFilter = /** @class */ (function (_super) { + __extends(RelativeDateFilter, _super); + function RelativeDateFilter(target, operator, timeUnitsCount, timeUnitType, includeToday) { + var _this = _super.call(this, target, FilterType.RelativeDate) || this; + _this.operator = operator; + _this.timeUnitsCount = timeUnitsCount; + _this.timeUnitType = timeUnitType; + _this.includeToday = includeToday; + _this.schemaUrl = RelativeDateFilter.schemaUrl; + return _this; + } + RelativeDateFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.timeUnitsCount = this.timeUnitsCount; + filter.timeUnitType = this.timeUnitType; + filter.includeToday = this.includeToday; + return filter; + }; + RelativeDateFilter.schemaUrl = "http://powerbi.com/product/schema#relativeDate"; + return RelativeDateFilter; + }(Filter)); + exports.RelativeDateFilter = RelativeDateFilter; + var RelativeTimeFilter = /** @class */ (function (_super) { + __extends(RelativeTimeFilter, _super); + function RelativeTimeFilter(target, operator, timeUnitsCount, timeUnitType) { + var _this = _super.call(this, target, FilterType.RelativeTime) || this; + _this.operator = operator; + _this.timeUnitsCount = timeUnitsCount; + _this.timeUnitType = timeUnitType; + _this.schemaUrl = RelativeTimeFilter.schemaUrl; + return _this; + } + RelativeTimeFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.timeUnitsCount = this.timeUnitsCount; + filter.timeUnitType = this.timeUnitType; + return filter; + }; + RelativeTimeFilter.schemaUrl = "http://powerbi.com/product/schema#relativeTime"; + return RelativeTimeFilter; + }(Filter)); + exports.RelativeTimeFilter = RelativeTimeFilter; + var BasicFilter = /** @class */ (function (_super) { + __extends(BasicFilter, _super); + function BasicFilter(target, operator) { + var values = []; + for (var _i = 2; _i < arguments.length; _i++) { + values[_i - 2] = arguments[_i]; + } + var _this = _super.call(this, target, FilterType.Basic) || this; + _this.operator = operator; + _this.schemaUrl = BasicFilter.schemaUrl; + if (values.length === 0 && operator !== "All") { + throw new Error("values must be a non-empty array unless your operator is \"All\"."); + } + /** + * Accept values as array instead of as individual arguments + * new BasicFilter('a', 'b', 1, 2); + * new BasicFilter('a', 'b', [1,2]); + */ + if (Array.isArray(values[0])) { + _this.values = values[0]; + } + else { + _this.values = values; + } + return _this; + } + BasicFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.values = this.values; + filter.requireSingleSelection = !!this.requireSingleSelection; + return filter; + }; + BasicFilter.schemaUrl = "http://powerbi.com/product/schema#basic"; + return BasicFilter; + }(Filter)); + exports.BasicFilter = BasicFilter; + var BasicFilterWithKeys = /** @class */ (function (_super) { + __extends(BasicFilterWithKeys, _super); + function BasicFilterWithKeys(target, operator, values, keyValues) { + var _this = _super.call(this, target, operator, values) || this; + _this.keyValues = keyValues; + _this.target = target; + var numberOfKeys = target.keys ? target.keys.length : 0; + if (numberOfKeys > 0 && !keyValues) { + throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys"); + } + if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { + throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); + } + for (var i = 0; i < _this.keyValues.length; i++) { + if (_this.keyValues[i]) { + var lengthOfArray = _this.keyValues[i].length; + if (lengthOfArray !== numberOfKeys) { + throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); + } + } + } + return _this; + } + BasicFilterWithKeys.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.keyValues = this.keyValues; + return filter; + }; + return BasicFilterWithKeys; + }(BasicFilter)); + exports.BasicFilterWithKeys = BasicFilterWithKeys; + var TupleFilter = /** @class */ (function (_super) { + __extends(TupleFilter, _super); + function TupleFilter(target, operator, values) { + var _this = _super.call(this, target, FilterType.Tuple) || this; + _this.operator = operator; + _this.schemaUrl = TupleFilter.schemaUrl; + _this.values = values; + return _this; + } + TupleFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.values = this.values; + filter.target = this.target; + return filter; + }; + TupleFilter.schemaUrl = "http://powerbi.com/product/schema#tuple"; + return TupleFilter; + }(Filter)); + exports.TupleFilter = TupleFilter; + var AdvancedFilter = /** @class */ (function (_super) { + __extends(AdvancedFilter, _super); + function AdvancedFilter(target, logicalOperator) { + var conditions = []; + for (var _i = 2; _i < arguments.length; _i++) { + conditions[_i - 2] = arguments[_i]; + } + var _this = _super.call(this, target, FilterType.Advanced) || this; + _this.schemaUrl = AdvancedFilter.schemaUrl; + // Guard statements + if (typeof logicalOperator !== "string" || logicalOperator.length === 0) { + // TODO: It would be nicer to list out the possible logical operators. + throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator); + } + _this.logicalOperator = logicalOperator; + var extractedConditions; + /** + * Accept conditions as array instead of as individual arguments + * new AdvancedFilter('a', 'b', "And", { value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }); + * new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]); + */ + if (Array.isArray(conditions[0])) { + extractedConditions = conditions[0]; + } + else { + extractedConditions = conditions; + } + if (extractedConditions.length === 0) { + throw new Error("conditions must be a non-empty array. You passed: " + conditions); + } + if (extractedConditions.length > 2) { + throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length); + } + if (extractedConditions.length === 1 && logicalOperator !== "And") { + throw new Error("Logical Operator must be \"And\" when there is only one condition provided"); + } + _this.conditions = extractedConditions; + return _this; + } + AdvancedFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.logicalOperator = this.logicalOperator; + filter.conditions = this.conditions; + return filter; + }; + AdvancedFilter.schemaUrl = "http://powerbi.com/product/schema#advanced"; + return AdvancedFilter; + }(Filter)); + exports.AdvancedFilter = AdvancedFilter; + function isFilterKeyColumnsTarget(target) { + return isColumn(target) && !!target.keys; + } + exports.isFilterKeyColumnsTarget = isFilterKeyColumnsTarget; + function isBasicFilterWithKeys(filter) { + return getFilterType(filter) === FilterType.Basic && !!filter.keyValues; + } + exports.isBasicFilterWithKeys = isBasicFilterWithKeys; + function getFilterType(filter) { + if (filter.filterType) { + return filter.filterType; + } + var basicFilter = filter; + var advancedFilter = filter; + if ((typeof basicFilter.operator === "string") + && (Array.isArray(basicFilter.values))) { + return FilterType.Basic; + } + else if ((typeof advancedFilter.logicalOperator === "string") + && (Array.isArray(advancedFilter.conditions))) { + return FilterType.Advanced; + } + else { + return FilterType.Unknown; + } + } + exports.getFilterType = getFilterType; + function isMeasure(arg) { + return arg.table !== undefined && arg.measure !== undefined; + } + exports.isMeasure = isMeasure; + function isColumn(arg) { + return !!(arg.table && arg.column && !arg.aggregationFunction); + } + exports.isColumn = isColumn; + function isHierarchyLevel(arg) { + return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && !arg.aggregationFunction); + } + exports.isHierarchyLevel = isHierarchyLevel; + function isHierarchyLevelAggr(arg) { + return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && arg.aggregationFunction); + } + exports.isHierarchyLevelAggr = isHierarchyLevelAggr; + function isColumnAggr(arg) { + return !!(arg.table && arg.column && arg.aggregationFunction); + } + exports.isColumnAggr = isColumnAggr; + var PageNavigationPosition; + (function (PageNavigationPosition) { + PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; + PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; + })(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); + var QnaMode; + (function (QnaMode) { + QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; + QnaMode[QnaMode["ResultOnly"] = 1] = "ResultOnly"; + })(QnaMode = exports.QnaMode || (exports.QnaMode = {})); + var ExportDataType; + (function (ExportDataType) { + ExportDataType[ExportDataType["Summarized"] = 0] = "Summarized"; + ExportDataType[ExportDataType["Underlying"] = 1] = "Underlying"; + })(ExportDataType = exports.ExportDataType || (exports.ExportDataType = {})); + var BookmarksPlayMode; + (function (BookmarksPlayMode) { + BookmarksPlayMode[BookmarksPlayMode["Off"] = 0] = "Off"; + BookmarksPlayMode[BookmarksPlayMode["Presentation"] = 1] = "Presentation"; + })(BookmarksPlayMode = exports.BookmarksPlayMode || (exports.BookmarksPlayMode = {})); + // This is not an enum because enum strings require + // us to upgrade typeScript version and change SDK build definition + exports.CommonErrorCodes = { + TokenExpired: 'TokenExpired', + NotFound: 'PowerBIEntityNotFound', + InvalidParameters: 'Invalid parameters', + LoadReportFailed: 'LoadReportFailed', + NotAuthorized: 'PowerBINotAuthorizedException', + FailedToLoadModel: 'ExplorationContainer_FailedToLoadModel_DefaultDetails', + }; + exports.TextAlignment = { + Left: 'left', + Center: 'center', + Right: 'right', + }; + exports.LegendPosition = { + Top: 'Top', + Bottom: 'Bottom', + Right: 'Right', + Left: 'Left', + TopCenter: 'TopCenter', + BottomCenter: 'BottomCenter', + RightCenter: 'RightCenter', + LeftCenter: 'LeftCenter', + }; + var SortDirection; + (function (SortDirection) { + SortDirection[SortDirection["Ascending"] = 1] = "Ascending"; + SortDirection[SortDirection["Descending"] = 2] = "Descending"; + })(SortDirection = exports.SortDirection || (exports.SortDirection = {})); + var Selector = /** @class */ (function () { + function Selector(schema) { + this.$schema = schema; + } + Selector.prototype.toJSON = function () { + return { + $schema: this.$schema + }; + }; + ; + return Selector; + }()); + exports.Selector = Selector; + var PageSelector = /** @class */ (function (_super) { + __extends(PageSelector, _super); + function PageSelector(pageName) { + var _this = _super.call(this, PageSelector.schemaUrl) || this; + _this.pageName = pageName; + return _this; + } + PageSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.pageName = this.pageName; + return selector; + }; + PageSelector.schemaUrl = "http://powerbi.com/product/schema#pageSelector"; + return PageSelector; + }(Selector)); + exports.PageSelector = PageSelector; + var VisualSelector = /** @class */ (function (_super) { + __extends(VisualSelector, _super); + function VisualSelector(visualName) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.visualName = visualName; + return _this; + } + VisualSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.visualName = this.visualName; + return selector; + }; + VisualSelector.schemaUrl = "http://powerbi.com/product/schema#visualSelector"; + return VisualSelector; + }(Selector)); + exports.VisualSelector = VisualSelector; + var VisualTypeSelector = /** @class */ (function (_super) { + __extends(VisualTypeSelector, _super); + function VisualTypeSelector(visualType) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.visualType = visualType; + return _this; + } + VisualTypeSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.visualType = this.visualType; + return selector; + }; + VisualTypeSelector.schemaUrl = "http://powerbi.com/product/schema#visualTypeSelector"; + return VisualTypeSelector; + }(Selector)); + exports.VisualTypeSelector = VisualTypeSelector; + var SlicerTargetSelector = /** @class */ (function (_super) { + __extends(SlicerTargetSelector, _super); + function SlicerTargetSelector(target) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.target = target; + return _this; + } + SlicerTargetSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.target = this.target; + return selector; + }; + SlicerTargetSelector.schemaUrl = "http://powerbi.com/product/schema#slicerTargetSelector"; + return SlicerTargetSelector; + }(Selector)); + exports.SlicerTargetSelector = SlicerTargetSelector; + var CommandDisplayOption; + (function (CommandDisplayOption) { + CommandDisplayOption[CommandDisplayOption["Enabled"] = 0] = "Enabled"; + CommandDisplayOption[CommandDisplayOption["Disabled"] = 1] = "Disabled"; + CommandDisplayOption[CommandDisplayOption["Hidden"] = 2] = "Hidden"; + })(CommandDisplayOption = exports.CommandDisplayOption || (exports.CommandDisplayOption = {})); + /* + * Visual CRUD + */ + var VisualDataRoleKind; + (function (VisualDataRoleKind) { + // Indicates that the role should be bound to something that evaluates to a grouping of values. + VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping"; + // Indicates that the role should be bound to something that evaluates to a single value in a scope. + VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure"; + // Indicates that the role can be bound to either Grouping or Measure. + VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure"; + })(VisualDataRoleKind = exports.VisualDataRoleKind || (exports.VisualDataRoleKind = {})); + // Indicates the visual preference on Grouping or Measure. Only applicable if kind is GroupingOrMeasure. + var VisualDataRoleKindPreference; + (function (VisualDataRoleKindPreference) { + VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; + VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; + })(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); + function normalizeError(error) { + var message = error.message; + if (!message) { + message = error.path + " is invalid. Not meeting " + error.keyword + " constraint"; + } + return { + message: message + }; + } + function validateVisualSelector(input) { + var errors = exports.Validators.visualSelectorValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateVisualSelector = validateVisualSelector; + function validateSlicer(input) { + var errors = exports.Validators.slicerValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateSlicer = validateSlicer; + function validateSlicerState(input) { + var errors = exports.Validators.slicerStateValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateSlicerState = validateSlicerState; + function validatePlayBookmarkRequest(input) { + var errors = exports.Validators.playBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; + function validateAddBookmarkRequest(input) { + var errors = exports.Validators.addBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateAddBookmarkRequest = validateAddBookmarkRequest; + function validateApplyBookmarkByNameRequest(input) { + var errors = exports.Validators.applyBookmarkByNameRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; + function validateApplyBookmarkStateRequest(input) { + var errors = exports.Validators.applyBookmarkStateRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; + function validateCaptureBookmarkRequest(input) { + var errors = exports.Validators.captureBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; + function validateSettings(input) { + var errors = exports.Validators.settingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateSettings = validateSettings; + function validatePanes(input) { + var errors = exports.Validators.reportPanesValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validatePanes = validatePanes; + function validateBookmarksPane(input) { + var errors = exports.Validators.bookmarksPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateBookmarksPane = validateBookmarksPane; + function validateFiltersPane(input) { + var errors = exports.Validators.filtersPanesValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateFiltersPane = validateFiltersPane; + function validateFieldsPane(input) { + var errors = exports.Validators.fieldsPanesValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateFieldsPane = validateFieldsPane; + function validatePageNavigationPane(input) { + var errors = exports.Validators.pageNavigationPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validatePageNavigationPane = validatePageNavigationPane; + function validateSelectionPane(input) { + var errors = exports.Validators.selectionPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateSelectionPane = validateSelectionPane; + function validateSyncSlicersPane(input) { + var errors = exports.Validators.syncSlicersPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateSyncSlicersPane = validateSyncSlicersPane; + function validateVisualizationsPane(input) { + var errors = exports.Validators.visualizationsPanesValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateVisualizationsPane = validateVisualizationsPane; + function validateCustomPageSize(input) { + var errors = exports.Validators.customPageSizeValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateCustomPageSize = validateCustomPageSize; + function validateExtension(input) { + var errors = exports.Validators.extensionValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateExtension = validateExtension; + function validateReportLoad(input) { + var errors = exports.Validators.reportLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateReportLoad = validateReportLoad; + function validateCreateReport(input) { + var errors = exports.Validators.reportCreateValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateCreateReport = validateCreateReport; + function validateDashboardLoad(input) { + var errors = exports.Validators.dashboardLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateDashboardLoad = validateDashboardLoad; + function validateTileLoad(input) { + var errors = exports.Validators.tileLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateTileLoad = validateTileLoad; + function validatePage(input) { + var errors = exports.Validators.pageValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validatePage = validatePage; + function validateFilter(input) { + var errors = exports.Validators.filtersValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateFilter = validateFilter; + function validateSaveAsParameters(input) { + var errors = exports.Validators.saveAsParametersValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateSaveAsParameters = validateSaveAsParameters; + function validateLoadQnaConfiguration(input) { + var errors = exports.Validators.loadQnaValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; + function validateQnaInterpretInputData(input) { + var errors = exports.Validators.qnaInterpretInputDataValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateQnaInterpretInputData = validateQnaInterpretInputData; + function validateExportDataRequest(input) { + var errors = exports.Validators.exportDataRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateExportDataRequest = validateExportDataRequest; + function validateVisualHeader(input) { + var errors = exports.Validators.visualHeaderValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateVisualHeader = validateVisualHeader; + function validateVisualSettings(input) { + var errors = exports.Validators.visualSettingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateVisualSettings = validateVisualSettings; + function validateCommandsSettings(input) { + var errors = exports.Validators.commandsSettingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateCommandsSettings = validateCommandsSettings; + function validateCustomTheme(input) { + var errors = exports.Validators.customThemeValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateCustomTheme = validateCustomTheme; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Validators = void 0; - var typeValidator_1 = __webpack_require__(2); - var extensionsValidator_1 = __webpack_require__(3); - var settingsValidator_1 = __webpack_require__(5); - var bookmarkValidator_1 = __webpack_require__(6); - var filtersValidator_1 = __webpack_require__(7); - var fieldRequiredValidator_1 = __webpack_require__(8); - var anyOfValidator_1 = __webpack_require__(9); - var reportLoadValidator_1 = __webpack_require__(10); - var reportCreateValidator_1 = __webpack_require__(11); - var dashboardLoadValidator_1 = __webpack_require__(12); - var tileLoadValidator_1 = __webpack_require__(13); - var pageValidator_1 = __webpack_require__(14); - var qnaValidator_1 = __webpack_require__(15); - var saveAsParametersValidator_1 = __webpack_require__(16); - var mapValidator_1 = __webpack_require__(17); - var layoutValidator_1 = __webpack_require__(18); - var exportDataValidator_1 = __webpack_require__(19); - var selectorsValidator_1 = __webpack_require__(20); - var slicersValidator_1 = __webpack_require__(21); - var visualSettingsValidator_1 = __webpack_require__(22); - var commandsSettingsValidator_1 = __webpack_require__(23); - var customThemeValidator_1 = __webpack_require__(24); - var datasetBindingValidator_1 = __webpack_require__(25); - var panesValidator_1 = __webpack_require__(26); - var barsValidator_1 = __webpack_require__(27); - exports.Validators = { - addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), - advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), - advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(), - anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]), - anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]), - anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]), - actionBarValidator: new barsValidator_1.ActionBarValidator(), - applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), - applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(), - applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]), - backgroundValidator: new typeValidator_1.EnumValidator([0, 1]), - basicFilterTypeValidator: new typeValidator_1.EnumValidator([1]), - basicFilterValidator: new filtersValidator_1.BasicFilterValidator(), - booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), - booleanValidator: new typeValidator_1.BooleanValidator(), - bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), - captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), - captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), - commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), - commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), - commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), - conditionItemValidator: new filtersValidator_1.ConditionItemValidator(), - contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]), - customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(), - customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(), - customThemeValidator: new customThemeValidator_1.CustomThemeValidator(), - dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(), - datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(), - displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]), - displayStateValidator: new layoutValidator_1.DisplayStateValidator(), - exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), - extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), - extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), - extensionValidator: new extensionsValidator_1.ExtensionValidator(), - fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), - fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), - filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), - filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]), - filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(), - filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(), - filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]), - filtersArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()])]), - filtersValidator: new filtersValidator_1.FilterValidator(), - filtersPaneValidator: new panesValidator_1.FiltersPaneValidator(), - hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(), - includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), - layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), - loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), - menuExtensionValidator: new extensionsValidator_1.MenuExtensionValidator(), - menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), - notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), - notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), - numberArrayValidator: new typeValidator_1.NumberArrayValidator(), - numberValidator: new typeValidator_1.NumberValidator(), - pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), - pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), - pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), - pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), - pageSizeValidator: new pageValidator_1.PageSizeValidator(), - pageValidator: new pageValidator_1.PageValidator(), - pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(), - pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]), - reportBarsValidator: new barsValidator_1.ReportBarsValidator(), - reportPanesValidator: new panesValidator_1.ReportPanesValidator(), - permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]), - playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(), - qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(), - qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(), - relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]), - relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]), - relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(), - relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]), - relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]), - relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(), - reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(), - reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(), - saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(), - selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(), - settingsValidator: new settingsValidator_1.SettingsValidator(), - singleCommandSettingsValidator: new commandsSettingsValidator_1.SingleCommandSettingsValidator(), - slicerSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.SlicerTargetSelectorValidator()]), - slicerStateValidator: new slicersValidator_1.SlicerStateValidator(), - slicerTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()]), - slicerValidator: new slicersValidator_1.SlicerValidator(), - stringArrayValidator: new typeValidator_1.StringArrayValidator(), - stringValidator: new typeValidator_1.StringValidator(), - syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(), - tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(), - tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]), - topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]), - topNFilterValidator: new filtersValidator_1.TopNFilterValidator(), - viewModeValidator: new typeValidator_1.EnumValidator([0, 1]), - visualCommandSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - visualHeaderSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - visualHeaderSettingsValidator: new visualSettingsValidator_1.VisualHeaderSettingsValidator(), - visualHeaderValidator: new visualSettingsValidator_1.VisualHeaderValidator(), - visualHeadersValidator: new typeValidator_1.ArrayValidator([new visualSettingsValidator_1.VisualHeaderValidator()]), - visualizationsPaneValidator: new panesValidator_1.VisualizationsPaneValidator(), - visualLayoutValidator: new layoutValidator_1.VisualLayoutValidator(), - visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(), - visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(), - visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(), - }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Validators = void 0; + var typeValidator_1 = __webpack_require__(2); + var extensionsValidator_1 = __webpack_require__(3); + var settingsValidator_1 = __webpack_require__(5); + var bookmarkValidator_1 = __webpack_require__(6); + var filtersValidator_1 = __webpack_require__(7); + var fieldRequiredValidator_1 = __webpack_require__(8); + var anyOfValidator_1 = __webpack_require__(9); + var reportLoadValidator_1 = __webpack_require__(10); + var reportCreateValidator_1 = __webpack_require__(11); + var dashboardLoadValidator_1 = __webpack_require__(12); + var tileLoadValidator_1 = __webpack_require__(13); + var pageValidator_1 = __webpack_require__(14); + var qnaValidator_1 = __webpack_require__(15); + var saveAsParametersValidator_1 = __webpack_require__(16); + var mapValidator_1 = __webpack_require__(17); + var layoutValidator_1 = __webpack_require__(18); + var exportDataValidator_1 = __webpack_require__(19); + var selectorsValidator_1 = __webpack_require__(20); + var slicersValidator_1 = __webpack_require__(21); + var visualSettingsValidator_1 = __webpack_require__(22); + var commandsSettingsValidator_1 = __webpack_require__(23); + var customThemeValidator_1 = __webpack_require__(24); + var datasetBindingValidator_1 = __webpack_require__(25); + var panesValidator_1 = __webpack_require__(26); + var barsValidator_1 = __webpack_require__(27); + exports.Validators = { + addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), + advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), + advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(), + anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]), + anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]), + anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]), + actionBarValidator: new barsValidator_1.ActionBarValidator(), + applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), + applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(), + applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]), + backgroundValidator: new typeValidator_1.EnumValidator([0, 1]), + basicFilterTypeValidator: new typeValidator_1.EnumValidator([1]), + basicFilterValidator: new filtersValidator_1.BasicFilterValidator(), + booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), + booleanValidator: new typeValidator_1.BooleanValidator(), + bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), + captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), + captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), + commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), + commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), + commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), + conditionItemValidator: new filtersValidator_1.ConditionItemValidator(), + contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]), + customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(), + customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(), + customThemeValidator: new customThemeValidator_1.CustomThemeValidator(), + dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(), + datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(), + displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]), + displayStateValidator: new layoutValidator_1.DisplayStateValidator(), + exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), + extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), + extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), + extensionValidator: new extensionsValidator_1.ExtensionValidator(), + fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), + fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), + filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), + filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]), + filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(), + filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(), + filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]), + filtersArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()])]), + filtersValidator: new filtersValidator_1.FilterValidator(), + filtersPaneValidator: new panesValidator_1.FiltersPaneValidator(), + hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(), + includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), + layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), + loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), + menuExtensionValidator: new extensionsValidator_1.MenuExtensionValidator(), + menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), + notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), + notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), + numberArrayValidator: new typeValidator_1.NumberArrayValidator(), + numberValidator: new typeValidator_1.NumberValidator(), + pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), + pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), + pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), + pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), + pageSizeValidator: new pageValidator_1.PageSizeValidator(), + pageValidator: new pageValidator_1.PageValidator(), + pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(), + pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]), + reportBarsValidator: new barsValidator_1.ReportBarsValidator(), + reportPanesValidator: new panesValidator_1.ReportPanesValidator(), + permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]), + playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(), + qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(), + qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(), + relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]), + relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]), + relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(), + relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]), + relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]), + relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(), + reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(), + reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(), + saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(), + selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(), + settingsValidator: new settingsValidator_1.SettingsValidator(), + singleCommandSettingsValidator: new commandsSettingsValidator_1.SingleCommandSettingsValidator(), + slicerSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.SlicerTargetSelectorValidator()]), + slicerStateValidator: new slicersValidator_1.SlicerStateValidator(), + slicerTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()]), + slicerValidator: new slicersValidator_1.SlicerValidator(), + stringArrayValidator: new typeValidator_1.StringArrayValidator(), + stringValidator: new typeValidator_1.StringValidator(), + syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(), + tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(), + tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]), + topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]), + topNFilterValidator: new filtersValidator_1.TopNFilterValidator(), + viewModeValidator: new typeValidator_1.EnumValidator([0, 1]), + visualCommandSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + visualHeaderSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + visualHeaderSettingsValidator: new visualSettingsValidator_1.VisualHeaderSettingsValidator(), + visualHeaderValidator: new visualSettingsValidator_1.VisualHeaderValidator(), + visualHeadersValidator: new typeValidator_1.ArrayValidator([new visualSettingsValidator_1.VisualHeaderValidator()]), + visualizationsPaneValidator: new panesValidator_1.VisualizationsPaneValidator(), + visualLayoutValidator: new layoutValidator_1.VisualLayoutValidator(), + visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(), + visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(), + visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(), + }; /***/ }), /* 2 */ /***/ (function(module, exports) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0; - var ObjectValidator = /** @class */ (function () { - function ObjectValidator() { - } - ObjectValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (typeof input !== "object" || Array.isArray(input)) { - return [{ - message: field !== undefined ? field + " must be an object" : "input must be an object", - path: path, - keyword: "type" - }]; - } - return null; - }; - return ObjectValidator; - }()); - exports.ObjectValidator = ObjectValidator; - var ArrayValidator = /** @class */ (function () { - function ArrayValidator(itemValidators) { - this.itemValidators = itemValidators; - } - ArrayValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (!(Array.isArray(input))) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - for (var i = 0; i < input.length; i++) { - var fieldsPath = (path ? path + "." : "") + field + "." + i; - for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) { - var validator = _a[_i]; - var errors = validator.validate(input[i], fieldsPath, field); - if (errors) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - } - } - return null; - }; - return ArrayValidator; - }()); - exports.ArrayValidator = ArrayValidator; - var TypeValidator = /** @class */ (function () { - function TypeValidator(expectedType) { - this.expectedType = expectedType; - } - TypeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (!(typeof input === this.expectedType)) { - return [{ - message: field + " must be a " + this.expectedType, - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return TypeValidator; - }()); - exports.TypeValidator = TypeValidator; - var StringValidator = /** @class */ (function (_super) { - __extends(StringValidator, _super); - function StringValidator() { - return _super.call(this, "string") || this; - } - return StringValidator; - }(TypeValidator)); - exports.StringValidator = StringValidator; - var BooleanValidator = /** @class */ (function (_super) { - __extends(BooleanValidator, _super); - function BooleanValidator() { - return _super.call(this, "boolean") || this; - } - return BooleanValidator; - }(TypeValidator)); - exports.BooleanValidator = BooleanValidator; - var NumberValidator = /** @class */ (function (_super) { - __extends(NumberValidator, _super); - function NumberValidator() { - return _super.call(this, "number") || this; - } - return NumberValidator; - }(TypeValidator)); - exports.NumberValidator = NumberValidator; - var ValueValidator = /** @class */ (function () { - function ValueValidator(possibleValues) { - this.possibleValues = possibleValues; - } - ValueValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (this.possibleValues.indexOf(input) < 0) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return ValueValidator; - }()); - exports.ValueValidator = ValueValidator; - var SchemaValidator = /** @class */ (function (_super) { - __extends(SchemaValidator, _super); - function SchemaValidator(schemaValue) { - var _this = _super.call(this, [schemaValue]) || this; - _this.schemaValue = schemaValue; - return _this; - } - SchemaValidator.prototype.validate = function (input, path, field) { - return _super.prototype.validate.call(this, input, path, field); - }; - return SchemaValidator; - }(ValueValidator)); - exports.SchemaValidator = SchemaValidator; - var EnumValidator = /** @class */ (function (_super) { - __extends(EnumValidator, _super); - function EnumValidator(possibleValues) { - var _this = _super.call(this) || this; - _this.possibleValues = possibleValues; - return _this; - } - EnumValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var valueValidator = new ValueValidator(this.possibleValues); - return valueValidator.validate(input, path, field); - }; - return EnumValidator; - }(NumberValidator)); - exports.EnumValidator = EnumValidator; - var StringArrayValidator = /** @class */ (function (_super) { - __extends(StringArrayValidator, _super); - function StringArrayValidator() { - return _super.call(this, [new StringValidator()]) || this; - } - StringArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of strings", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return StringArrayValidator; - }(ArrayValidator)); - exports.StringArrayValidator = StringArrayValidator; - var BooleanArrayValidator = /** @class */ (function (_super) { - __extends(BooleanArrayValidator, _super); - function BooleanArrayValidator() { - return _super.call(this, [new BooleanValidator()]) || this; - } - BooleanArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of booleans", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return BooleanArrayValidator; - }(ArrayValidator)); - exports.BooleanArrayValidator = BooleanArrayValidator; - var NumberArrayValidator = /** @class */ (function (_super) { - __extends(NumberArrayValidator, _super); - function NumberArrayValidator() { - return _super.call(this, [new NumberValidator()]) || this; - } - NumberArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of numbers", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return NumberArrayValidator; - }(ArrayValidator)); - exports.NumberArrayValidator = NumberArrayValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0; + var ObjectValidator = /** @class */ (function () { + function ObjectValidator() { + } + ObjectValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (typeof input !== "object" || Array.isArray(input)) { + return [{ + message: field !== undefined ? field + " must be an object" : "input must be an object", + path: path, + keyword: "type" + }]; + } + return null; + }; + return ObjectValidator; + }()); + exports.ObjectValidator = ObjectValidator; + var ArrayValidator = /** @class */ (function () { + function ArrayValidator(itemValidators) { + this.itemValidators = itemValidators; + } + ArrayValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (!(Array.isArray(input))) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + for (var i = 0; i < input.length; i++) { + var fieldsPath = (path ? path + "." : "") + field + "." + i; + for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input[i], fieldsPath, field); + if (errors) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + } + } + return null; + }; + return ArrayValidator; + }()); + exports.ArrayValidator = ArrayValidator; + var TypeValidator = /** @class */ (function () { + function TypeValidator(expectedType) { + this.expectedType = expectedType; + } + TypeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (!(typeof input === this.expectedType)) { + return [{ + message: field + " must be a " + this.expectedType, + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return TypeValidator; + }()); + exports.TypeValidator = TypeValidator; + var StringValidator = /** @class */ (function (_super) { + __extends(StringValidator, _super); + function StringValidator() { + return _super.call(this, "string") || this; + } + return StringValidator; + }(TypeValidator)); + exports.StringValidator = StringValidator; + var BooleanValidator = /** @class */ (function (_super) { + __extends(BooleanValidator, _super); + function BooleanValidator() { + return _super.call(this, "boolean") || this; + } + return BooleanValidator; + }(TypeValidator)); + exports.BooleanValidator = BooleanValidator; + var NumberValidator = /** @class */ (function (_super) { + __extends(NumberValidator, _super); + function NumberValidator() { + return _super.call(this, "number") || this; + } + return NumberValidator; + }(TypeValidator)); + exports.NumberValidator = NumberValidator; + var ValueValidator = /** @class */ (function () { + function ValueValidator(possibleValues) { + this.possibleValues = possibleValues; + } + ValueValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (this.possibleValues.indexOf(input) < 0) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return ValueValidator; + }()); + exports.ValueValidator = ValueValidator; + var SchemaValidator = /** @class */ (function (_super) { + __extends(SchemaValidator, _super); + function SchemaValidator(schemaValue) { + var _this = _super.call(this, [schemaValue]) || this; + _this.schemaValue = schemaValue; + return _this; + } + SchemaValidator.prototype.validate = function (input, path, field) { + return _super.prototype.validate.call(this, input, path, field); + }; + return SchemaValidator; + }(ValueValidator)); + exports.SchemaValidator = SchemaValidator; + var EnumValidator = /** @class */ (function (_super) { + __extends(EnumValidator, _super); + function EnumValidator(possibleValues) { + var _this = _super.call(this) || this; + _this.possibleValues = possibleValues; + return _this; + } + EnumValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var valueValidator = new ValueValidator(this.possibleValues); + return valueValidator.validate(input, path, field); + }; + return EnumValidator; + }(NumberValidator)); + exports.EnumValidator = EnumValidator; + var StringArrayValidator = /** @class */ (function (_super) { + __extends(StringArrayValidator, _super); + function StringArrayValidator() { + return _super.call(this, [new StringValidator()]) || this; + } + StringArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of strings", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return StringArrayValidator; + }(ArrayValidator)); + exports.StringArrayValidator = StringArrayValidator; + var BooleanArrayValidator = /** @class */ (function (_super) { + __extends(BooleanArrayValidator, _super); + function BooleanArrayValidator() { + return _super.call(this, [new BooleanValidator()]) || this; + } + BooleanArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of booleans", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return BooleanArrayValidator; + }(ArrayValidator)); + exports.BooleanArrayValidator = BooleanArrayValidator; + var NumberArrayValidator = /** @class */ (function (_super) { + __extends(NumberArrayValidator, _super); + function NumberArrayValidator() { + return _super.call(this, [new NumberValidator()]) || this; + } + NumberArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of numbers", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return NumberArrayValidator; + }(ArrayValidator)); + exports.NumberArrayValidator = NumberArrayValidator; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.MenuExtensionValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var MenuExtensionValidator = /** @class */ (function (_super) { - __extends(MenuExtensionValidator, _super); - function MenuExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - MenuExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "title", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "menuLocation", - validators: [validator_1.Validators.menuLocationValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return MenuExtensionValidator; - }(typeValidator_1.ObjectValidator)); - exports.MenuExtensionValidator = MenuExtensionValidator; - var ExtensionPointsValidator = /** @class */ (function (_super) { - __extends(ExtensionPointsValidator, _super); - function ExtensionPointsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionPointsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualContextMenu", - validators: [validator_1.Validators.menuExtensionValidator] - }, - { - field: "visualOptionsMenu", - validators: [validator_1.Validators.menuExtensionValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionPointsValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionPointsValidator = ExtensionPointsValidator; - var ExtensionItemValidator = /** @class */ (function (_super) { - __extends(ExtensionItemValidator, _super); - function ExtensionItemValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionItemValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "extend", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionItemValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionItemValidator = ExtensionItemValidator; - var CommandExtensionValidator = /** @class */ (function (_super) { - __extends(CommandExtensionValidator, _super); - function CommandExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "title", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.commandExtensionSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CommandExtensionValidator; - }(ExtensionItemValidator)); - exports.CommandExtensionValidator = CommandExtensionValidator; - var ExtensionValidator = /** @class */ (function (_super) { - __extends(ExtensionValidator, _super); - function ExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "command", - validators: [validator_1.Validators.commandExtensionValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionValidator = ExtensionValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.MenuExtensionValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var MenuExtensionValidator = /** @class */ (function (_super) { + __extends(MenuExtensionValidator, _super); + function MenuExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + MenuExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "title", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "icon", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return MenuExtensionValidator; + }(typeValidator_1.ObjectValidator)); + exports.MenuExtensionValidator = MenuExtensionValidator; + var ExtensionPointsValidator = /** @class */ (function (_super) { + __extends(ExtensionPointsValidator, _super); + function ExtensionPointsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionPointsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualContextMenu", + validators: [validator_1.Validators.menuExtensionValidator] + }, + { + field: "visualOptionsMenu", + validators: [validator_1.Validators.menuExtensionValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionPointsValidator; + }(typeValidator_1.ObjectValidator)); + exports.ExtensionPointsValidator = ExtensionPointsValidator; + var ExtensionItemValidator = /** @class */ (function (_super) { + __extends(ExtensionItemValidator, _super); + function ExtensionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionItemValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "extend", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionItemValidator; + }(typeValidator_1.ObjectValidator)); + exports.ExtensionItemValidator = ExtensionItemValidator; + var CommandExtensionValidator = /** @class */ (function (_super) { + __extends(CommandExtensionValidator, _super); + function CommandExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "title", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "icon", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.commandExtensionSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandExtensionValidator; + }(ExtensionItemValidator)); + exports.CommandExtensionValidator = CommandExtensionValidator; + var ExtensionValidator = /** @class */ (function (_super) { + __extends(ExtensionValidator, _super); + function ExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "command", + validators: [validator_1.Validators.commandExtensionValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionValidator; + }(typeValidator_1.ObjectValidator)); + exports.ExtensionValidator = ExtensionValidator; /***/ }), /* 4 */ /***/ (function(module, exports) { - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MultipleFieldsValidator = void 0; - var MultipleFieldsValidator = /** @class */ (function () { - function MultipleFieldsValidator(fieldValidatorsPairs) { - this.fieldValidatorsPairs = fieldValidatorsPairs; - } - MultipleFieldsValidator.prototype.validate = function (input, path, field) { - if (!this.fieldValidatorsPairs) { - return null; - } - var fieldsPath = path ? path + "." + field : field; - for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { - var fieldValidators = _a[_i]; - for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { - var validator = _c[_b]; - var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); - if (errors) { - return errors; - } - } - } - return null; - }; - return MultipleFieldsValidator; - }()); - exports.MultipleFieldsValidator = MultipleFieldsValidator; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MultipleFieldsValidator = void 0; + var MultipleFieldsValidator = /** @class */ (function () { + function MultipleFieldsValidator(fieldValidatorsPairs) { + this.fieldValidatorsPairs = fieldValidatorsPairs; + } + MultipleFieldsValidator.prototype.validate = function (input, path, field) { + if (!this.fieldValidatorsPairs) { + return null; + } + var fieldsPath = path ? path + "." + field : field; + for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { + var fieldValidators = _a[_i]; + for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { + var validator = _c[_b]; + var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); + if (errors) { + return errors; + } + } + } + return null; + }; + return MultipleFieldsValidator; + }()); + exports.MultipleFieldsValidator = MultipleFieldsValidator; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SettingsValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var SettingsValidator = /** @class */ (function (_super) { - __extends(SettingsValidator, _super); - function SettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "navContentPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "bookmarksPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "useCustomSaveAsDialog", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "extensions", - validators: [validator_1.Validators.extensionArrayValidator] - }, - { - field: "layoutType", - validators: [validator_1.Validators.layoutTypeValidator] - }, - { - field: "customLayout", - validators: [validator_1.Validators.customLayoutValidator] - }, - { - field: "background", - validators: [validator_1.Validators.backgroundValidator] - }, - { - field: "visualSettings", - validators: [validator_1.Validators.visualSettingsValidator] - }, - { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "commands", - validators: [validator_1.Validators.commandsSettingsArrayValidator] - }, - { - field: "hyperlinkClickBehavior", - validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] - }, - { - field: "bars", - validators: [validator_1.Validators.reportBarsValidator] - }, - { - field: "panes", - validators: [validator_1.Validators.reportPanesValidator] - }, - { - field: "personalBookmarksEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "persistentFiltersEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "visualRenderedEvents", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.SettingsValidator = SettingsValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SettingsValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var SettingsValidator = /** @class */ (function (_super) { + __extends(SettingsValidator, _super); + function SettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "navContentPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "bookmarksPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "useCustomSaveAsDialog", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "extensions", + validators: [validator_1.Validators.extensionArrayValidator] + }, + { + field: "layoutType", + validators: [validator_1.Validators.layoutTypeValidator] + }, + { + field: "customLayout", + validators: [validator_1.Validators.customLayoutValidator] + }, + { + field: "background", + validators: [validator_1.Validators.backgroundValidator] + }, + { + field: "visualSettings", + validators: [validator_1.Validators.visualSettingsValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "commands", + validators: [validator_1.Validators.commandsSettingsArrayValidator] + }, + { + field: "hyperlinkClickBehavior", + validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] + }, + { + field: "bars", + validators: [validator_1.Validators.reportBarsValidator] + }, + { + field: "panes", + validators: [validator_1.Validators.reportPanesValidator] + }, + { + field: "personalBookmarksEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "persistentFiltersEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "visualRenderedEvents", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.SettingsValidator = SettingsValidator; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var PlayBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(PlayBookmarkRequestValidator, _super); - function PlayBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "playMode", - validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PlayBookmarkRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; - var AddBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(AddBookmarkRequestValidator, _super); - function AddBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "displayName", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "apply", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return AddBookmarkRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; - var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkByNameRequestValidator, _super); - function ApplyBookmarkByNameRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ApplyBookmarkByNameRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; - var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkStateRequestValidator, _super); - function ApplyBookmarkStateRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ApplyBookmarkStateRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; - var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkOptionsValidator, _super); - function CaptureBookmarkOptionsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "personalizeVisuals", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CaptureBookmarkOptionsValidator; - }(typeValidator_1.ObjectValidator)); - exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; - var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkRequestValidator, _super); - function CaptureBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "options", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CaptureBookmarkRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var PlayBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(PlayBookmarkRequestValidator, _super); + function PlayBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "playMode", + validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PlayBookmarkRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; + var AddBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(AddBookmarkRequestValidator, _super); + function AddBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "displayName", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "apply", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return AddBookmarkRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; + var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkByNameRequestValidator, _super); + function ApplyBookmarkByNameRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ApplyBookmarkByNameRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; + var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkStateRequestValidator, _super); + function ApplyBookmarkStateRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ApplyBookmarkStateRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; + var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkOptionsValidator, _super); + function CaptureBookmarkOptionsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "personalizeVisuals", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkOptionsValidator; + }(typeValidator_1.ObjectValidator)); + exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; + var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkRequestValidator, _super); + function CaptureBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "options", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var FilterColumnTargetValidator = /** @class */ (function (_super) { - __extends(FilterColumnTargetValidator, _super); - function FilterColumnTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterColumnTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "column", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterColumnTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterColumnTargetValidator = FilterColumnTargetValidator; - var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyColumnsTargetValidator, _super); - function FilterKeyColumnsTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterKeyColumnsTargetValidator; - }(FilterColumnTargetValidator)); - exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; - var FilterHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterHierarchyTargetValidator, _super); - function FilterHierarchyTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "hierarchy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "hierarchyLevel", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterHierarchyTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; - var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyHierarchyTargetValidator, _super); - function FilterKeyHierarchyTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterKeyHierarchyTargetValidator; - }(FilterHierarchyTargetValidator)); - exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; - var FilterMeasureTargetValidator = /** @class */ (function (_super) { - __extends(FilterMeasureTargetValidator, _super); - function FilterMeasureTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "measure", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterMeasureTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; - var BasicFilterValidator = /** @class */ (function (_super) { - __extends(BasicFilterValidator, _super); - function BasicFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BasicFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.basicFilterTypeValidator] - }, - { - field: "requireSingleSelection", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return BasicFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.BasicFilterValidator = BasicFilterValidator; - var AdvancedFilterValidator = /** @class */ (function (_super) { - __extends(AdvancedFilterValidator, _super); - function AdvancedFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - AdvancedFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "logicalOperator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "conditions", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.advancedFilterTypeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return AdvancedFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.AdvancedFilterValidator = AdvancedFilterValidator; - var RelativeDateFilterValidator = /** @class */ (function (_super) { - __extends(RelativeDateFilterValidator, _super); - function RelativeDateFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - RelativeDateFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] - }, - { - field: "includeToday", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeDateFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return RelativeDateFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.RelativeDateFilterValidator = RelativeDateFilterValidator; - var RelativeTimeFilterValidator = /** @class */ (function (_super) { - __extends(RelativeTimeFilterValidator, _super); - function RelativeTimeFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeTimeFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return RelativeTimeFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; - var TopNFilterValidator = /** @class */ (function (_super) { - __extends(TopNFilterValidator, _super); - function TopNFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - TopNFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "itemCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.topNFilterTypeValidator] - }, - { - field: "orderBy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return TopNFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.TopNFilterValidator = TopNFilterValidator; - var NotSupportedFilterValidator = /** @class */ (function (_super) { - __extends(NotSupportedFilterValidator, _super); - function NotSupportedFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - NotSupportedFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.filterTargetValidator] - }, - { - field: "message", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "notSupportedTypeName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.notSupportedFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return NotSupportedFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.NotSupportedFilterValidator = NotSupportedFilterValidator; - var IncludeExcludeFilterValidator = /** @class */ (function (_super) { - __extends(IncludeExcludeFilterValidator, _super); - function IncludeExcludeFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "isExclude", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.includeExludeFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return IncludeExcludeFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; - var FilterValidator = /** @class */ (function (_super) { - __extends(FilterValidator, _super); - function FilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - return validator_1.Validators.anyFilterValidator.validate(input, path, field); - }; - return FilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterValidator = FilterValidator; - var ConditionItemValidator = /** @class */ (function (_super) { - __extends(ConditionItemValidator, _super); - function ConditionItemValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ConditionItemValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "value", - validators: [validator_1.Validators.anyValueValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ConditionItemValidator; - }(typeValidator_1.ObjectValidator)); - exports.ConditionItemValidator = ConditionItemValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var FilterColumnTargetValidator = /** @class */ (function (_super) { + __extends(FilterColumnTargetValidator, _super); + function FilterColumnTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterColumnTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "column", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterColumnTargetValidator; + }(typeValidator_1.ObjectValidator)); + exports.FilterColumnTargetValidator = FilterColumnTargetValidator; + var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyColumnsTargetValidator, _super); + function FilterKeyColumnsTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyColumnsTargetValidator; + }(FilterColumnTargetValidator)); + exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; + var FilterHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterHierarchyTargetValidator, _super); + function FilterHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "hierarchy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "hierarchyLevel", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterHierarchyTargetValidator; + }(typeValidator_1.ObjectValidator)); + exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; + var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyHierarchyTargetValidator, _super); + function FilterKeyHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyHierarchyTargetValidator; + }(FilterHierarchyTargetValidator)); + exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; + var FilterMeasureTargetValidator = /** @class */ (function (_super) { + __extends(FilterMeasureTargetValidator, _super); + function FilterMeasureTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "measure", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterMeasureTargetValidator; + }(typeValidator_1.ObjectValidator)); + exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; + var BasicFilterValidator = /** @class */ (function (_super) { + __extends(BasicFilterValidator, _super); + function BasicFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + BasicFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.basicFilterTypeValidator] + }, + { + field: "requireSingleSelection", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return BasicFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.BasicFilterValidator = BasicFilterValidator; + var AdvancedFilterValidator = /** @class */ (function (_super) { + __extends(AdvancedFilterValidator, _super); + function AdvancedFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AdvancedFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "logicalOperator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "conditions", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.advancedFilterTypeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return AdvancedFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.AdvancedFilterValidator = AdvancedFilterValidator; + var RelativeDateFilterValidator = /** @class */ (function (_super) { + __extends(RelativeDateFilterValidator, _super); + function RelativeDateFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelativeDateFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] + }, + { + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] + }, + { + field: "includeToday", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.relativeDateFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeDateFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.RelativeDateFilterValidator = RelativeDateFilterValidator; + var RelativeTimeFilterValidator = /** @class */ (function (_super) { + __extends(RelativeTimeFilterValidator, _super); + function RelativeTimeFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] + }, + { + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.relativeTimeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeTimeFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; + var TopNFilterValidator = /** @class */ (function (_super) { + __extends(TopNFilterValidator, _super); + function TopNFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + TopNFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "itemCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.topNFilterTypeValidator] + }, + { + field: "orderBy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return TopNFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.TopNFilterValidator = TopNFilterValidator; + var NotSupportedFilterValidator = /** @class */ (function (_super) { + __extends(NotSupportedFilterValidator, _super); + function NotSupportedFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + NotSupportedFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.filterTargetValidator] + }, + { + field: "message", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "notSupportedTypeName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.notSupportedFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return NotSupportedFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.NotSupportedFilterValidator = NotSupportedFilterValidator; + var IncludeExcludeFilterValidator = /** @class */ (function (_super) { + __extends(IncludeExcludeFilterValidator, _super); + function IncludeExcludeFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "isExclude", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.includeExludeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return IncludeExcludeFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; + var FilterValidator = /** @class */ (function (_super) { + __extends(FilterValidator, _super); + function FilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + return validator_1.Validators.anyFilterValidator.validate(input, path, field); + }; + return FilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.FilterValidator = FilterValidator; + var ConditionItemValidator = /** @class */ (function (_super) { + __extends(ConditionItemValidator, _super); + function ConditionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConditionItemValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "value", + validators: [validator_1.Validators.anyValueValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ConditionItemValidator; + }(typeValidator_1.ObjectValidator)); + exports.ConditionItemValidator = ConditionItemValidator; /***/ }), /* 8 */ /***/ (function(module, exports) { - Object.defineProperty(exports, "__esModule", { value: true }); - exports.FieldRequiredValidator = void 0; - var FieldRequiredValidator = /** @class */ (function () { - function FieldRequiredValidator() { - } - FieldRequiredValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return [{ - message: field + " is required", - path: (path ? path + "." : "") + field, - keyword: "required" - }]; - } - return null; - }; - return FieldRequiredValidator; - }()); - exports.FieldRequiredValidator = FieldRequiredValidator; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.FieldRequiredValidator = void 0; + var FieldRequiredValidator = /** @class */ (function () { + function FieldRequiredValidator() { + } + FieldRequiredValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return [{ + message: field + " is required", + path: (path ? path + "." : "") + field, + keyword: "required" + }]; + } + return null; + }; + return FieldRequiredValidator; + }()); + exports.FieldRequiredValidator = FieldRequiredValidator; /***/ }), /* 9 */ /***/ (function(module, exports) { - Object.defineProperty(exports, "__esModule", { value: true }); - exports.AnyOfValidator = void 0; - var AnyOfValidator = /** @class */ (function () { - function AnyOfValidator(validators) { - this.validators = validators; - } - AnyOfValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var valid = false; - for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { - var validator = _a[_i]; - var errors = validator.validate(input, path, field); - if (!errors) { - valid = true; - break; - } - } - if (!valid) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return AnyOfValidator; - }()); - exports.AnyOfValidator = AnyOfValidator; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AnyOfValidator = void 0; + var AnyOfValidator = /** @class */ (function () { + function AnyOfValidator(validators) { + this.validators = validators; + } + AnyOfValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var valid = false; + for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input, path, field); + if (!errors) { + valid = true; + break; + } + } + if (!valid) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return AnyOfValidator; + }()); + exports.AnyOfValidator = AnyOfValidator; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReportLoadValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportLoadValidator = /** @class */ (function (_super) { - __extends(ReportLoadValidator, _super); - function ReportLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "settings", - validators: [validator_1.Validators.settingsValidator] - }, - { - field: "pageName", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "filters", - validators: [validator_1.Validators.filtersArrayValidator] - }, - { - field: "permissions", - validators: [validator_1.Validators.permissionsValidator] - }, - { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "bookmark", - validators: [validator_1.Validators.applyBookmarkValidator] - }, - { - field: "theme", - validators: [validator_1.Validators.customThemeValidator] - }, - { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "datasetBinding", - validators: [validator_1.Validators.datasetBindingValidator] - }, - { - field: "contrastMode", - validators: [validator_1.Validators.contrastModeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportLoadValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportLoadValidator = ReportLoadValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReportLoadValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var ReportLoadValidator = /** @class */ (function (_super) { + __extends(ReportLoadValidator, _super); + function ReportLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.settingsValidator] + }, + { + field: "pageName", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + }, + { + field: "permissions", + validators: [validator_1.Validators.permissionsValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "bookmark", + validators: [validator_1.Validators.applyBookmarkValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "datasetBinding", + validators: [validator_1.Validators.datasetBindingValidator] + }, + { + field: "contrastMode", + validators: [validator_1.Validators.contrastModeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportLoadValidator; + }(typeValidator_1.ObjectValidator)); + exports.ReportLoadValidator = ReportLoadValidator; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReportCreateValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportCreateValidator = /** @class */ (function (_super) { - __extends(ReportCreateValidator, _super); - function ReportCreateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportCreateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "theme", - validators: [validator_1.Validators.customThemeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportCreateValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportCreateValidator = ReportCreateValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ReportCreateValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var ReportCreateValidator = /** @class */ (function (_super) { + __extends(ReportCreateValidator, _super); + function ReportCreateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportCreateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportCreateValidator; + }(typeValidator_1.ObjectValidator)); + exports.ReportCreateValidator = ReportCreateValidator; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DashboardLoadValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var DashboardLoadValidator = /** @class */ (function (_super) { - __extends(DashboardLoadValidator, _super); - function DashboardLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DashboardLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "pageView", - validators: [validator_1.Validators.pageViewFieldValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DashboardLoadValidator; - }(typeValidator_1.ObjectValidator)); - exports.DashboardLoadValidator = DashboardLoadValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DashboardLoadValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var DashboardLoadValidator = /** @class */ (function (_super) { + __extends(DashboardLoadValidator, _super); + function DashboardLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DashboardLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.pageViewFieldValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DashboardLoadValidator; + }(typeValidator_1.ObjectValidator)); + exports.DashboardLoadValidator = DashboardLoadValidator; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TileLoadValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var TileLoadValidator = /** @class */ (function (_super) { - __extends(TileLoadValidator, _super); - function TileLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - TileLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "dashboardId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "pageView", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return TileLoadValidator; - }(typeValidator_1.ObjectValidator)); - exports.TileLoadValidator = TileLoadValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TileLoadValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var TileLoadValidator = /** @class */ (function (_super) { + __extends(TileLoadValidator, _super); + function TileLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + TileLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "dashboardId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return TileLoadValidator; + }(typeValidator_1.ObjectValidator)); + exports.TileLoadValidator = TileLoadValidator; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var PageSizeValidator = /** @class */ (function (_super) { - __extends(PageSizeValidator, _super); - function PageSizeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageSizeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "type", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageSizeValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageSizeValidator = PageSizeValidator; - var CustomPageSizeValidator = /** @class */ (function (_super) { - __extends(CustomPageSizeValidator, _super); - function CustomPageSizeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomPageSizeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomPageSizeValidator; - }(PageSizeValidator)); - exports.CustomPageSizeValidator = CustomPageSizeValidator; - var PageValidator = /** @class */ (function (_super) { - __extends(PageValidator, _super); - function PageValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageValidator = PageValidator; - var PageViewFieldValidator = /** @class */ (function (_super) { - __extends(PageViewFieldValidator, _super); - function PageViewFieldValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageViewFieldValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; - if (possibleValues.indexOf(input) < 0) { - return [{ - message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" - }]; - } - return null; - }; - return PageViewFieldValidator; - }(typeValidator_1.StringValidator)); - exports.PageViewFieldValidator = PageViewFieldValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var PageSizeValidator = /** @class */ (function (_super) { + __extends(PageSizeValidator, _super); + function PageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "type", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageSizeValidator; + }(typeValidator_1.ObjectValidator)); + exports.PageSizeValidator = PageSizeValidator; + var CustomPageSizeValidator = /** @class */ (function (_super) { + __extends(CustomPageSizeValidator, _super); + function CustomPageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomPageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomPageSizeValidator; + }(PageSizeValidator)); + exports.CustomPageSizeValidator = CustomPageSizeValidator; + var PageValidator = /** @class */ (function (_super) { + __extends(PageValidator, _super); + function PageValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageValidator; + }(typeValidator_1.ObjectValidator)); + exports.PageValidator = PageValidator; + var PageViewFieldValidator = /** @class */ (function (_super) { + __extends(PageViewFieldValidator, _super); + function PageViewFieldValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageViewFieldValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; + if (possibleValues.indexOf(input) < 0) { + return [{ + message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" + }]; + } + return null; + }; + return PageViewFieldValidator; + }(typeValidator_1.StringValidator)); + exports.PageViewFieldValidator = PageViewFieldValidator; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var LoadQnaValidator = /** @class */ (function (_super) { - __extends(LoadQnaValidator, _super); - function LoadQnaValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - LoadQnaValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "datasetIds", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - { - field: "question", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] - }, - { - field: "settings", - validators: [validator_1.Validators.qnaSettingValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return LoadQnaValidator; - }(typeValidator_1.ObjectValidator)); - exports.LoadQnaValidator = LoadQnaValidator; - var QnaSettingsValidator = /** @class */ (function (_super) { - __extends(QnaSettingsValidator, _super); - function QnaSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - QnaSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return QnaSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.QnaSettingsValidator = QnaSettingsValidator; - var QnaInterpretInputDataValidator = /** @class */ (function (_super) { - __extends(QnaInterpretInputDataValidator, _super); - function QnaInterpretInputDataValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "datasetIds", - validators: [validator_1.Validators.stringArrayValidator] - }, - { - field: "question", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return QnaInterpretInputDataValidator; - }(typeValidator_1.ObjectValidator)); - exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var LoadQnaValidator = /** @class */ (function (_super) { + __extends(LoadQnaValidator, _super); + function LoadQnaValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + LoadQnaValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "datasetIds", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.qnaSettingValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return LoadQnaValidator; + }(typeValidator_1.ObjectValidator)); + exports.LoadQnaValidator = LoadQnaValidator; + var QnaSettingsValidator = /** @class */ (function (_super) { + __extends(QnaSettingsValidator, _super); + function QnaSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.QnaSettingsValidator = QnaSettingsValidator; + var QnaInterpretInputDataValidator = /** @class */ (function (_super) { + __extends(QnaInterpretInputDataValidator, _super); + function QnaInterpretInputDataValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "datasetIds", + validators: [validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaInterpretInputDataValidator; + }(typeValidator_1.ObjectValidator)); + exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SaveAsParametersValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var SaveAsParametersValidator = /** @class */ (function (_super) { - __extends(SaveAsParametersValidator, _super); - function SaveAsParametersValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SaveAsParametersValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SaveAsParametersValidator; - }(typeValidator_1.ObjectValidator)); - exports.SaveAsParametersValidator = SaveAsParametersValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SaveAsParametersValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var SaveAsParametersValidator = /** @class */ (function (_super) { + __extends(SaveAsParametersValidator, _super); + function SaveAsParametersValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SaveAsParametersValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SaveAsParametersValidator; + }(typeValidator_1.ObjectValidator)); + exports.SaveAsParametersValidator = SaveAsParametersValidator; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MapValidator = void 0; - var typeValidator_1 = __webpack_require__(2); - var MapValidator = /** @class */ (function (_super) { - __extends(MapValidator, _super); - function MapValidator(keyValidators, valueValidators) { - var _this = _super.call(this) || this; - _this.keyValidators = keyValidators; - _this.valueValidators = valueValidators; - return _this; - } - MapValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - for (var key in input) { - if (input.hasOwnProperty(key)) { - var fieldsPath = (path ? path + "." : "") + field + "." + key; - for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { - var keyValidator = _a[_i]; - errors = keyValidator.validate(key, fieldsPath, field); - if (errors) { - return errors; - } - } - for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { - var valueValidator = _c[_b]; - errors = valueValidator.validate(input[key], fieldsPath, field); - if (errors) { - return errors; - } - } - } - } - return null; - }; - return MapValidator; - }(typeValidator_1.ObjectValidator)); - exports.MapValidator = MapValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MapValidator = void 0; + var typeValidator_1 = __webpack_require__(2); + var MapValidator = /** @class */ (function (_super) { + __extends(MapValidator, _super); + function MapValidator(keyValidators, valueValidators) { + var _this = _super.call(this) || this; + _this.keyValidators = keyValidators; + _this.valueValidators = valueValidators; + return _this; + } + MapValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + for (var key in input) { + if (input.hasOwnProperty(key)) { + var fieldsPath = (path ? path + "." : "") + field + "." + key; + for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { + var keyValidator = _a[_i]; + errors = keyValidator.validate(key, fieldsPath, field); + if (errors) { + return errors; + } + } + for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { + var valueValidator = _c[_b]; + errors = valueValidator.validate(input[key], fieldsPath, field); + if (errors) { + return errors; + } + } + } + } + return null; + }; + return MapValidator; + }(typeValidator_1.ObjectValidator)); + exports.MapValidator = MapValidator; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var CustomLayoutValidator = /** @class */ (function (_super) { - __extends(CustomLayoutValidator, _super); - function CustomLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "pageSize", - validators: [validator_1.Validators.pageSizeValidator] - }, - { - field: "displayOption", - validators: [validator_1.Validators.customLayoutDisplayOptionValidator] - }, - { - field: "pagesLayout", - validators: [validator_1.Validators.pagesLayoutValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomLayoutValidator; - }(typeValidator_1.ObjectValidator)); - exports.CustomLayoutValidator = CustomLayoutValidator; - var VisualLayoutValidator = /** @class */ (function (_super) { - __extends(VisualLayoutValidator, _super); - function VisualLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "x", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "y", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "z", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "displayState", - validators: [validator_1.Validators.displayStateValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualLayoutValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualLayoutValidator = VisualLayoutValidator; - var DisplayStateValidator = /** @class */ (function (_super) { - __extends(DisplayStateValidator, _super); - function DisplayStateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DisplayStateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "mode", - validators: [validator_1.Validators.displayStateModeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DisplayStateValidator; - }(typeValidator_1.ObjectValidator)); - exports.DisplayStateValidator = DisplayStateValidator; - var PageLayoutValidator = /** @class */ (function (_super) { - __extends(PageLayoutValidator, _super); - function PageLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualsLayout", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] - }, - { - field: "defaultLayout", - validators: [validator_1.Validators.visualLayoutValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageLayoutValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageLayoutValidator = PageLayoutValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var CustomLayoutValidator = /** @class */ (function (_super) { + __extends(CustomLayoutValidator, _super); + function CustomLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "pageSize", + validators: [validator_1.Validators.pageSizeValidator] + }, + { + field: "displayOption", + validators: [validator_1.Validators.customLayoutDisplayOptionValidator] + }, + { + field: "pagesLayout", + validators: [validator_1.Validators.pagesLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomLayoutValidator; + }(typeValidator_1.ObjectValidator)); + exports.CustomLayoutValidator = CustomLayoutValidator; + var VisualLayoutValidator = /** @class */ (function (_super) { + __extends(VisualLayoutValidator, _super); + function VisualLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "x", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "y", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "z", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "displayState", + validators: [validator_1.Validators.displayStateValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualLayoutValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualLayoutValidator = VisualLayoutValidator; + var DisplayStateValidator = /** @class */ (function (_super) { + __extends(DisplayStateValidator, _super); + function DisplayStateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DisplayStateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "mode", + validators: [validator_1.Validators.displayStateModeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DisplayStateValidator; + }(typeValidator_1.ObjectValidator)); + exports.DisplayStateValidator = DisplayStateValidator; + var PageLayoutValidator = /** @class */ (function (_super) { + __extends(PageLayoutValidator, _super); + function PageLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualsLayout", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] + }, + { + field: "defaultLayout", + validators: [validator_1.Validators.visualLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageLayoutValidator; + }(typeValidator_1.ObjectValidator)); + exports.PageLayoutValidator = PageLayoutValidator; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExportDataRequestValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ExportDataRequestValidator = /** @class */ (function (_super) { - __extends(ExportDataRequestValidator, _super); - function ExportDataRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExportDataRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "rows", - validators: [new typeValidator_1.NumberValidator()] - }, - { - field: "exportDataType", - validators: [new typeValidator_1.EnumValidator([0, 1])] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExportDataRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExportDataRequestValidator = ExportDataRequestValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExportDataRequestValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var ExportDataRequestValidator = /** @class */ (function (_super) { + __extends(ExportDataRequestValidator, _super); + function ExportDataRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExportDataRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "rows", + validators: [new typeValidator_1.NumberValidator()] + }, + { + field: "exportDataType", + validators: [new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExportDataRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.ExportDataRequestValidator = ExportDataRequestValidator; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var typeValidator_2 = __webpack_require__(2); - var VisualSelectorValidator = /** @class */ (function (_super) { - __extends(VisualSelectorValidator, _super); - function VisualSelectorValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualSelectorValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - // Not required for this selector only - Backward compatibility - field: "$schema", - validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] - }, - { - field: "visualName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualSelectorValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualSelectorValidator = VisualSelectorValidator; - var VisualTypeSelectorValidator = /** @class */ (function (_super) { - __extends(VisualTypeSelectorValidator, _super); - function VisualTypeSelectorValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "$schema", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] - }, - { - field: "visualType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualTypeSelectorValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; - var SlicerTargetSelectorValidator = /** @class */ (function (_super) { - __extends(SlicerTargetSelectorValidator, _super); - function SlicerTargetSelectorValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "$schema", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] - }, - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SlicerTargetSelectorValidator; - }(typeValidator_1.ObjectValidator)); - exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var typeValidator_2 = __webpack_require__(2); + var VisualSelectorValidator = /** @class */ (function (_super) { + __extends(VisualSelectorValidator, _super); + function VisualSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + // Not required for this selector only - Backward compatibility + field: "$schema", + validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] + }, + { + field: "visualName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSelectorValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualSelectorValidator = VisualSelectorValidator; + var VisualTypeSelectorValidator = /** @class */ (function (_super) { + __extends(VisualTypeSelectorValidator, _super); + function VisualTypeSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] + }, + { + field: "visualType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualTypeSelectorValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; + var SlicerTargetSelectorValidator = /** @class */ (function (_super) { + __extends(SlicerTargetSelectorValidator, _super); + function SlicerTargetSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] + }, + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerTargetSelectorValidator; + }(typeValidator_1.ObjectValidator)); + exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SlicerStateValidator = exports.SlicerValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var SlicerValidator = /** @class */ (function (_super) { - __extends(SlicerValidator, _super); - function SlicerValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlicerValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "selector", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] - }, - { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SlicerValidator; - }(typeValidator_1.ObjectValidator)); - exports.SlicerValidator = SlicerValidator; - var SlicerStateValidator = /** @class */ (function (_super) { - __extends(SlicerStateValidator, _super); - function SlicerStateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlicerStateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "filters", - validators: [validator_1.Validators.filtersArrayValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SlicerStateValidator; - }(typeValidator_1.ObjectValidator)); - exports.SlicerStateValidator = SlicerStateValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SlicerStateValidator = exports.SlicerValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var SlicerValidator = /** @class */ (function (_super) { + __extends(SlicerValidator, _super); + function SlicerValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "selector", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] + }, + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerValidator; + }(typeValidator_1.ObjectValidator)); + exports.SlicerValidator = SlicerValidator; + var SlicerStateValidator = /** @class */ (function (_super) { + __extends(SlicerStateValidator, _super); + function SlicerStateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerStateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerStateValidator; + }(typeValidator_1.ObjectValidator)); + exports.SlicerStateValidator = SlicerStateValidator; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var VisualSettingsValidator = /** @class */ (function (_super) { - __extends(VisualSettingsValidator, _super); - function VisualSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualHeaders", - validators: [validator_1.Validators.visualHeadersValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualSettingsValidator = VisualSettingsValidator; - var VisualHeaderSettingsValidator = /** @class */ (function (_super) { - __extends(VisualHeaderSettingsValidator, _super); - function VisualHeaderSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualHeaderSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; - var VisualHeaderValidator = /** @class */ (function (_super) { - __extends(VisualHeaderValidator, _super); - function VisualHeaderValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualHeaderValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "settings", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.visualHeaderSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualHeaderValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualHeaderValidator = VisualHeaderValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var VisualSettingsValidator = /** @class */ (function (_super) { + __extends(VisualSettingsValidator, _super); + function VisualSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualHeaders", + validators: [validator_1.Validators.visualHeadersValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualSettingsValidator = VisualSettingsValidator; + var VisualHeaderSettingsValidator = /** @class */ (function (_super) { + __extends(VisualHeaderSettingsValidator, _super); + function VisualHeaderSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualHeaderSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; + var VisualHeaderValidator = /** @class */ (function (_super) { + __extends(VisualHeaderValidator, _super); + function VisualHeaderValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualHeaderValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "settings", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualHeaderSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualHeaderValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualHeaderValidator = VisualHeaderValidator; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var CommandsSettingsValidator = /** @class */ (function (_super) { - __extends(CommandsSettingsValidator, _super); - function CommandsSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandsSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "copy", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "drill", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "drillthrough", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "expandCollapse", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "exportData", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "includeExclude", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "removeVisual", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "search", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "seeData", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "sort", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "spotlight", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CommandsSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.CommandsSettingsValidator = CommandsSettingsValidator; - var SingleCommandSettingsValidator = /** @class */ (function (_super) { - __extends(SingleCommandSettingsValidator, _super); - function SingleCommandSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "displayOption", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.visualCommandSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SingleCommandSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var CommandsSettingsValidator = /** @class */ (function (_super) { + __extends(CommandsSettingsValidator, _super); + function CommandsSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandsSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "copy", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "drill", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "drillthrough", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "expandCollapse", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "exportData", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "includeExclude", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "removeVisual", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "search", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "seeData", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "sort", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "spotlight", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandsSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.CommandsSettingsValidator = CommandsSettingsValidator; + var SingleCommandSettingsValidator = /** @class */ (function (_super) { + __extends(SingleCommandSettingsValidator, _super); + function SingleCommandSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "displayOption", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualCommandSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SingleCommandSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.CustomThemeValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var CustomThemeValidator = /** @class */ (function (_super) { - __extends(CustomThemeValidator, _super); - function CustomThemeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomThemeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "themeJson", - validators: [new typeValidator_1.ObjectValidator()] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomThemeValidator; - }(typeValidator_1.ObjectValidator)); - exports.CustomThemeValidator = CustomThemeValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CustomThemeValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var CustomThemeValidator = /** @class */ (function (_super) { + __extends(CustomThemeValidator, _super); + function CustomThemeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomThemeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "themeJson", + validators: [new typeValidator_1.ObjectValidator()] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomThemeValidator; + }(typeValidator_1.ObjectValidator)); + exports.CustomThemeValidator = CustomThemeValidator; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DatasetBindingValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var DatasetBindingValidator = /** @class */ (function (_super) { - __extends(DatasetBindingValidator, _super); - function DatasetBindingValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DatasetBindingValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DatasetBindingValidator; - }(typeValidator_1.ObjectValidator)); - exports.DatasetBindingValidator = DatasetBindingValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DatasetBindingValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var DatasetBindingValidator = /** @class */ (function (_super) { + __extends(DatasetBindingValidator, _super); + function DatasetBindingValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DatasetBindingValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DatasetBindingValidator; + }(typeValidator_1.ObjectValidator)); + exports.DatasetBindingValidator = DatasetBindingValidator; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportPanesValidator = /** @class */ (function (_super) { - __extends(ReportPanesValidator, _super); - function ReportPanesValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportPanesValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "bookmarks", - validators: [validator_1.Validators.bookmarksPaneValidator] - }, - { - field: "fields", - validators: [validator_1.Validators.fieldsPaneValidator] - }, - { - field: "filters", - validators: [validator_1.Validators.filtersPaneValidator] - }, - { - field: "pageNavigation", - validators: [validator_1.Validators.pageNavigationPaneValidator] - }, - { - field: "selection", - validators: [validator_1.Validators.selectionPaneValidator] - }, - { - field: "syncSlicers", - validators: [validator_1.Validators.syncSlicersPaneValidator] - }, - { - field: "visualizations", - validators: [validator_1.Validators.visualizationsPaneValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportPanesValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportPanesValidator = ReportPanesValidator; - var BookmarksPaneValidator = /** @class */ (function (_super) { - __extends(BookmarksPaneValidator, _super); - function BookmarksPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BookmarksPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return BookmarksPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.BookmarksPaneValidator = BookmarksPaneValidator; - var FieldsPaneValidator = /** @class */ (function (_super) { - __extends(FieldsPaneValidator, _super); - function FieldsPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FieldsPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FieldsPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.FieldsPaneValidator = FieldsPaneValidator; - var FiltersPaneValidator = /** @class */ (function (_super) { - __extends(FiltersPaneValidator, _super); - function FiltersPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FiltersPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FiltersPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.FiltersPaneValidator = FiltersPaneValidator; - var PageNavigationPaneValidator = /** @class */ (function (_super) { - __extends(PageNavigationPaneValidator, _super); - function PageNavigationPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageNavigationPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "position", - validators: [validator_1.Validators.pageNavigationPositionValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageNavigationPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageNavigationPaneValidator = PageNavigationPaneValidator; - var SelectionPaneValidator = /** @class */ (function (_super) { - __extends(SelectionPaneValidator, _super); - function SelectionPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SelectionPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SelectionPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.SelectionPaneValidator = SelectionPaneValidator; - var SyncSlicersPaneValidator = /** @class */ (function (_super) { - __extends(SyncSlicersPaneValidator, _super); - function SyncSlicersPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SyncSlicersPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; - var VisualizationsPaneValidator = /** @class */ (function (_super) { - __extends(VisualizationsPaneValidator, _super); - function VisualizationsPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualizationsPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualizationsPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualizationsPaneValidator = VisualizationsPaneValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var ReportPanesValidator = /** @class */ (function (_super) { + __extends(ReportPanesValidator, _super); + function ReportPanesValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportPanesValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "bookmarks", + validators: [validator_1.Validators.bookmarksPaneValidator] + }, + { + field: "fields", + validators: [validator_1.Validators.fieldsPaneValidator] + }, + { + field: "filters", + validators: [validator_1.Validators.filtersPaneValidator] + }, + { + field: "pageNavigation", + validators: [validator_1.Validators.pageNavigationPaneValidator] + }, + { + field: "selection", + validators: [validator_1.Validators.selectionPaneValidator] + }, + { + field: "syncSlicers", + validators: [validator_1.Validators.syncSlicersPaneValidator] + }, + { + field: "visualizations", + validators: [validator_1.Validators.visualizationsPaneValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportPanesValidator; + }(typeValidator_1.ObjectValidator)); + exports.ReportPanesValidator = ReportPanesValidator; + var BookmarksPaneValidator = /** @class */ (function (_super) { + __extends(BookmarksPaneValidator, _super); + function BookmarksPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + BookmarksPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return BookmarksPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.BookmarksPaneValidator = BookmarksPaneValidator; + var FieldsPaneValidator = /** @class */ (function (_super) { + __extends(FieldsPaneValidator, _super); + function FieldsPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FieldsPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FieldsPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.FieldsPaneValidator = FieldsPaneValidator; + var FiltersPaneValidator = /** @class */ (function (_super) { + __extends(FiltersPaneValidator, _super); + function FiltersPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FiltersPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FiltersPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.FiltersPaneValidator = FiltersPaneValidator; + var PageNavigationPaneValidator = /** @class */ (function (_super) { + __extends(PageNavigationPaneValidator, _super); + function PageNavigationPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageNavigationPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "position", + validators: [validator_1.Validators.pageNavigationPositionValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageNavigationPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.PageNavigationPaneValidator = PageNavigationPaneValidator; + var SelectionPaneValidator = /** @class */ (function (_super) { + __extends(SelectionPaneValidator, _super); + function SelectionPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SelectionPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SelectionPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.SelectionPaneValidator = SelectionPaneValidator; + var SyncSlicersPaneValidator = /** @class */ (function (_super) { + __extends(SyncSlicersPaneValidator, _super); + function SyncSlicersPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SyncSlicersPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; + var VisualizationsPaneValidator = /** @class */ (function (_super) { + __extends(VisualizationsPaneValidator, _super); + function VisualizationsPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualizationsPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualizationsPaneValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualizationsPaneValidator = VisualizationsPaneValidator; /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ActionBarValidator = exports.ReportBarsValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportBarsValidator = /** @class */ (function (_super) { - __extends(ReportBarsValidator, _super); - function ReportBarsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportBarsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "actionBar", - validators: [validator_1.Validators.actionBarValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportBarsValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportBarsValidator = ReportBarsValidator; - var ActionBarValidator = /** @class */ (function (_super) { - __extends(ActionBarValidator, _super); - function ActionBarValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionBarValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ActionBarValidator; - }(typeValidator_1.ObjectValidator)); - exports.ActionBarValidator = ActionBarValidator; + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ActionBarValidator = exports.ReportBarsValidator = void 0; + var validator_1 = __webpack_require__(1); + var multipleFieldsValidator_1 = __webpack_require__(4); + var typeValidator_1 = __webpack_require__(2); + var ReportBarsValidator = /** @class */ (function (_super) { + __extends(ReportBarsValidator, _super); + function ReportBarsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportBarsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "actionBar", + validators: [validator_1.Validators.actionBarValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportBarsValidator; + }(typeValidator_1.ObjectValidator)); + exports.ReportBarsValidator = ReportBarsValidator; + var ActionBarValidator = /** @class */ (function (_super) { + __extends(ActionBarValidator, _super); + function ActionBarValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ActionBarValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ActionBarValidator; + }(typeValidator_1.ObjectValidator)); + exports.ActionBarValidator = ActionBarValidator; /***/ }) @@ -5340,1648 +5340,1690 @@ return /******/ (function(modules) { // webpackBootstrap /* 6 */ /***/ (function(module, exports) { - exports.APINotSupportedForRDLError = "This API is currently not supported for RDL reports"; - exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"; + exports.APINotSupportedForRDLError = "This API is currently not supported for RDL reports"; + exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var embed = __webpack_require__(2); - var models = __webpack_require__(5); - var utils = __webpack_require__(3); - var errors = __webpack_require__(6); - var page_1 = __webpack_require__(8); - var bookmarksManager_1 = __webpack_require__(10); - /** - * The Power BI Report embed component - * - * @export - * @class Report - * @extends {embed.Embed} - * @implements {IReportNode} - * @implements {IFilterable} - */ - var Report = (function (_super) { - __extends(Report, _super); - /** - * Creates an instance of a Power BI Report. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} config - * @hidden - */ - function Report(service, element, baseConfig, phasedRender, isBootstrap, iframe) { - var config = baseConfig; - _super.call(this, service, element, config, iframe, phasedRender, isBootstrap); - this.loadPath = "/report/load"; - this.phasedLoadPath = "/report/prepare"; - Array.prototype.push.apply(this.allowedEvents, Report.allowedEvents); - this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, this.iframe); - } - /** - * Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID - * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1). - * - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Report.findIdFromEmbedUrl = function (url) { - var reportIdRegEx = /reportId="?([^&]+)"?/; - var reportIdMatch = url.match(reportIdRegEx); - var reportId; - if (reportIdMatch) { - reportId = reportIdMatch[1]; - } - return reportId; - }; - /** - * Render a preloaded report, using phased embedding API - * - * ```javascript - * // Load report - * var report = powerbi.load(element, config); - * - * ... - * - * // Render report - * report.render() - * ``` - * - * @returns {Promise} - */ - Report.prototype.render = function (config) { - return this.service.hpm.post("/report/render", config, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Add an empty page to the report - * - * ```javascript - * // Add a page to the report with "Sales" as the page display name - * report.addPage("Sales"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.addPage = function (displayName) { - var _this = this; - var request = { - displayName: displayName - }; - return this.service.hpm.post("/report/addPage", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - var page = response.body; - return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - }, function (response) { - throw response.body; - }); - }; - /** - * Delete a page from a report - * - * ```javascript - * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) - * report.deletePage("Sales145"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.deletePage = function (pageName) { - return this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Gets filters that are applied at the report level. - * - * ```javascript - * // Get filters applied at report level - * report.getFilters() - * .then(filters => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Report.prototype.getFilters = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.get("/report/filters", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Gets the report ID from the first available location: options, attribute, embed url. - * - * @returns {string} - */ - Report.prototype.getId = function () { - var config = this.config; - var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); - if (typeof reportId !== 'string' || reportId.length === 0) { - throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'."); - } - return reportId; - }; - /** - * Gets the list of pages within the report. - * - * ```javascript - * report.getPages() - * .then(pages => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Report.prototype.getPages = function () { - var _this = this; - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body - .map(function (page) { - return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - }); - }, function (response) { - throw response.body; - }); - }; - /** - * Creates an instance of a Page. - * - * Normally you would get Page objects by calling `report.getPages()`, but in the case - * that the page name is known and you want to perform an action on a page without having to retrieve it - * you can create it directly. - * - * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. - * - * ```javascript - * const page = report.page('ReportSection1'); - * page.setActive(); - * ``` - * - * @param {string} name - * @param {string} [displayName] - * @param {boolean} [isActive] - * @returns {Page} - */ - Report.prototype.page = function (name, displayName, isActive, visibility) { - return new page_1.Page(this, name, displayName, isActive, visibility); - }; - /** - * Prints the active page of the report by invoking `window.print()` on the embed iframe component. - */ - Report.prototype.print = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Removes all filters at the report level. - * - * ```javascript - * report.removeFilters(); - * ``` - * - * @returns {Promise} - */ - Report.prototype.removeFilters = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.setFilters([]); - }; - /** - * Sets the active page of the report. - * - * ```javascript - * report.setPage("page2") - * .catch(error => { ... }); - * ``` - * - * @param {string} pageName - * @returns {Promise} - */ - Report.prototype.setPage = function (pageName) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var page = { - name: pageName, - displayName: null, - isActive: true - }; - return this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Sets filters at the report level. - * - * ```javascript - * const filters: [ - * ... - * ]; - * - * report.setFilters(filters) - * .catch(errors => { - * ... - * }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - Report.prototype.setFilters = function (filters) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.put("/report/filters", filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Updates visibility settings for the filter pane and the page navigation pane. - * - * ```javascript - * const newSettings = { - * navContentPaneEnabled: true, - * filterPaneEnabled: false - * }; - * - * report.updateSettings(newSettings) - * .catch(error => { ... }); - * ``` - * - * @param {models.ISettings} settings - * @returns {Promise} - */ - Report.prototype.updateSettings = function (settings) { - if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Validate load configuration. - * - * @hidden - */ - Report.prototype.validate = function (config) { - return models.validateReportLoad(config); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Report.prototype.configChanged = function (isBootstrap) { - var config = this.config; - if (this.isMobileSettings(config.settings)) - config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); - // Calculate settings from HTML element attributes if available. - var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute); - var navContentPaneEnabledAttribute = this.element.getAttribute(Report.navContentPaneEnabledAttribute); - var elementAttrSettings = { - filterPaneEnabled: (filterPaneEnabledAttribute == null) ? undefined : (filterPaneEnabledAttribute !== "false"), - navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false") - }; - // Set the settings back into the config. - this.config.settings = utils.assign({}, elementAttrSettings, config.settings); - if (isBootstrap) { - return; - } - config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Report.prototype.getDefaultEmbedUrlEndpoint = function () { - return "reportEmbed"; - }; - /** - * Switch Report view mode. - * - * @returns {Promise} - */ - Report.prototype.switchMode = function (viewMode) { - var newMode; - if (typeof viewMode === "string") { - newMode = viewMode; - } - else { - newMode = this.viewModeToString(viewMode); - } - var url = '/report/switchMode/' + newMode; - return this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Refreshes data sources for the report. - * - * ```javascript - * report.refresh(); - * ``` - */ - Report.prototype.refresh = function () { - return this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * checks if the report is saved. - * - * ```javascript - * report.isSaved() - * ``` - * - * @returns {Promise} - */ - Report.prototype.isSaved = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); - }; - /** - * Apply a theme to the report - * - * ```javascript - * report.applyTheme(theme); - * ``` - */ - Report.prototype.applyTheme = function (theme) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.applyThemeInternal(theme); - }; - /** - * Reset and apply the default theme of the report - * - * ```javascript - * report.resetTheme(); - * ``` - */ - Report.prototype.resetTheme = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.applyThemeInternal({}); - }; - /** - * Reset user's filters, slicers, and other data view changes to the default state of the report - * - * ```javascript - * report.resetPersistentFilters(); - * ``` - */ - Report.prototype.resetPersistentFilters = function () { - return this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Save user's filters, slicers, and other data view changes of the report - * - * ```javascript - * report.savePersistentFilters(); - * ``` - */ - Report.prototype.savePersistentFilters = function () { - return this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Returns if there are user's filters, slicers, or other data view changes applied on the report. - * If persistent filters is disable, returns false. - * - * ```javascript - * report.arePersistentFiltersApplied(); - * ``` - * - * @returns {Promise} - */ - Report.prototype.arePersistentFiltersApplied = function () { - return this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * @hidden - */ - Report.prototype.applyThemeInternal = function (theme) { - return this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * @hidden - */ - Report.prototype.viewModeToString = function (viewMode) { - var mode; - switch (viewMode) { - case models.ViewMode.Edit: - mode = "edit"; - break; - case models.ViewMode.View: - mode = "view"; - break; - } - return mode; - }; - /** - * @hidden - */ - Report.prototype.isMobileSettings = function (settings) { - return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); - }; - /** @hidden */ - Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; - /** @hidden */ - Report.reportIdAttribute = 'powerbi-report-id'; - /** @hidden */ - Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled'; - /** @hidden */ - Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled'; - /** @hidden */ - Report.typeAttribute = 'powerbi-type'; - /** @hidden */ - Report.type = "Report"; - return Report; - }(embed.Embed)); - exports.Report = Report; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var embed = __webpack_require__(2); + var models = __webpack_require__(5); + var utils = __webpack_require__(3); + var errors = __webpack_require__(6); + var page_1 = __webpack_require__(8); + var bookmarksManager_1 = __webpack_require__(10); + /** + * The Power BI Report embed component + * + * @export + * @class Report + * @extends {embed.Embed} + * @implements {IReportNode} + * @implements {IFilterable} + */ + var Report = (function (_super) { + __extends(Report, _super); + /** + * Creates an instance of a Power BI Report. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} config + * @hidden + */ + function Report(service, element, baseConfig, phasedRender, isBootstrap, iframe) { + var config = baseConfig; + _super.call(this, service, element, config, iframe, phasedRender, isBootstrap); + this.loadPath = "/report/load"; + this.phasedLoadPath = "/report/prepare"; + Array.prototype.push.apply(this.allowedEvents, Report.allowedEvents); + this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, this.iframe); + } + /** + * Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID + * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1). + * + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Report.findIdFromEmbedUrl = function (url) { + var reportIdRegEx = /reportId="?([^&]+)"?/; + var reportIdMatch = url.match(reportIdRegEx); + var reportId; + if (reportIdMatch) { + reportId = reportIdMatch[1]; + } + return reportId; + }; + /** + * Render a preloaded report, using phased embedding API + * + * ```javascript + * // Load report + * var report = powerbi.load(element, config); + * + * ... + * + * // Render report + * report.render() + * ``` + * + * @returns {Promise} + */ + Report.prototype.render = function (config) { + return this.service.hpm.post("/report/render", config, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Add an empty page to the report + * + * ```javascript + * // Add a page to the report with "Sales" as the page display name + * report.addPage("Sales"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.addPage = function (displayName) { + var _this = this; + var request = { + displayName: displayName + }; + return this.service.hpm.post("/report/addPage", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + var page = response.body; + return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); + }, function (response) { + throw response.body; + }); + }; + /** + * Delete a page from a report + * + * ```javascript + * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) + * report.deletePage("ReportSection145"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.deletePage = function (pageName) { + return this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Rename a page from a report + * + * ```javascript + * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) + * report.renamePage("ReportSection145", "Sales"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.renamePage = function (pageName, displayName) { + var page = { + name: pageName, + displayName: displayName, + }; + return this.service.hpm.put("/report/pages/" + pageName + "/name", page, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Gets filters that are applied at the report level. + * + * ```javascript + * // Get filters applied at report level + * report.getFilters() + * .then(filters => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Report.prototype.getFilters = function () { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.service.hpm.get("/report/filters", { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Gets the report ID from the first available location: options, attribute, embed url. + * + * @returns {string} + */ + Report.prototype.getId = function () { + var config = this.config; + var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); + if (typeof reportId !== 'string' || reportId.length === 0) { + throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'."); + } + return reportId; + }; + /** + * Gets the list of pages within the report. + * + * ```javascript + * report.getPages() + * .then(pages => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Report.prototype.getPages = function () { + var _this = this; + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body + .map(function (page) { + return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); + }); + }, function (response) { + throw response.body; + }); + }; + /** + * Creates an instance of a Page. + * + * Normally you would get Page objects by calling `report.getPages()`, but in the case + * that the page name is known and you want to perform an action on a page without having to retrieve it + * you can create it directly. + * + * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. + * + * ```javascript + * const page = report.page('ReportSection1'); + * page.setActive(); + * ``` + * + * @param {string} name + * @param {string} [displayName] + * @param {boolean} [isActive] + * @returns {Page} + */ + Report.prototype.page = function (name, displayName, isActive, visibility) { + return new page_1.Page(this, name, displayName, isActive, visibility); + }; + /** + * Prints the active page of the report by invoking `window.print()` on the embed iframe component. + */ + Report.prototype.print = function () { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Removes all filters at the report level. + * + * ```javascript + * report.removeFilters(); + * ``` + * + * @returns {Promise} + */ + Report.prototype.removeFilters = function () { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.setFilters([]); + }; + /** + * Sets the active page of the report. + * + * ```javascript + * report.setPage("page2") + * .catch(error => { ... }); + * ``` + * + * @param {string} pageName + * @returns {Promise} + */ + Report.prototype.setPage = function (pageName) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + var page = { + name: pageName, + displayName: null, + isActive: true + }; + return this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Sets filters at the report level. + * + * ```javascript + * const filters: [ + * ... + * ]; + * + * report.setFilters(filters) + * .catch(errors => { + * ... + * }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise} + */ + Report.prototype.setFilters = function (filters) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.service.hpm.put("/report/filters", filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Updates visibility settings for the filter pane and the page navigation pane. + * + * ```javascript + * const newSettings = { + * navContentPaneEnabled: true, + * filterPaneEnabled: false + * }; + * + * report.updateSettings(newSettings) + * .catch(error => { ... }); + * ``` + * + * @param {models.ISettings} settings + * @returns {Promise} + */ + Report.prototype.updateSettings = function (settings) { + if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Validate load configuration. + * + * @hidden + */ + Report.prototype.validate = function (config) { + return models.validateReportLoad(config); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Report.prototype.configChanged = function (isBootstrap) { + var config = this.config; + if (this.isMobileSettings(config.settings)) + config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); + // Calculate settings from HTML element attributes if available. + var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute); + var navContentPaneEnabledAttribute = this.element.getAttribute(Report.navContentPaneEnabledAttribute); + var elementAttrSettings = { + filterPaneEnabled: (filterPaneEnabledAttribute == null) ? undefined : (filterPaneEnabledAttribute !== "false"), + navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false") + }; + // Set the settings back into the config. + this.config.settings = utils.assign({}, elementAttrSettings, config.settings); + if (isBootstrap) { + return; + } + config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Report.prototype.getDefaultEmbedUrlEndpoint = function () { + return "reportEmbed"; + }; + /** + * Switch Report view mode. + * + * @returns {Promise} + */ + Report.prototype.switchMode = function (viewMode) { + var newMode; + if (typeof viewMode === "string") { + newMode = viewMode; + } + else { + newMode = this.viewModeToString(viewMode); + } + var url = '/report/switchMode/' + newMode; + return this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Refreshes data sources for the report. + * + * ```javascript + * report.refresh(); + * ``` + */ + Report.prototype.refresh = function () { + return this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * checks if the report is saved. + * + * ```javascript + * report.isSaved() + * ``` + * + * @returns {Promise} + */ + Report.prototype.isSaved = function () { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); + }; + /** + * Apply a theme to the report + * + * ```javascript + * report.applyTheme(theme); + * ``` + */ + Report.prototype.applyTheme = function (theme) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.applyThemeInternal(theme); + }; + /** + * Reset and apply the default theme of the report + * + * ```javascript + * report.resetTheme(); + * ``` + */ + Report.prototype.resetTheme = function () { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.applyThemeInternal({}); + }; + /** + * Reset user's filters, slicers, and other data view changes to the default state of the report + * + * ```javascript + * report.resetPersistentFilters(); + * ``` + */ + Report.prototype.resetPersistentFilters = function () { + return this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Save user's filters, slicers, and other data view changes of the report + * + * ```javascript + * report.savePersistentFilters(); + * ``` + */ + Report.prototype.savePersistentFilters = function () { + return this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Returns if there are user's filters, slicers, or other data view changes applied on the report. + * If persistent filters is disable, returns false. + * + * ```javascript + * report.arePersistentFiltersApplied(); + * ``` + * + * @returns {Promise} + */ + Report.prototype.arePersistentFiltersApplied = function () { + return this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * @hidden + */ + Report.prototype.applyThemeInternal = function (theme) { + return this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * @hidden + */ + Report.prototype.viewModeToString = function (viewMode) { + var mode; + switch (viewMode) { + case models.ViewMode.Edit: + mode = "edit"; + break; + case models.ViewMode.View: + mode = "view"; + break; + } + return mode; + }; + /** + * @hidden + */ + Report.prototype.isMobileSettings = function (settings) { + return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); + }; + /** @hidden */ + Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; + /** @hidden */ + Report.reportIdAttribute = 'powerbi-report-id'; + /** @hidden */ + Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled'; + /** @hidden */ + Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled'; + /** @hidden */ + Report.typeAttribute = 'powerbi-type'; + /** @hidden */ + Report.type = "Report"; + return Report; + }(embed.Embed)); + exports.Report = Report; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { - var visualDescriptor_1 = __webpack_require__(9); - var models = __webpack_require__(5); - var utils = __webpack_require__(3); - var errors = __webpack_require__(6); - /** - * A Power BI report page - * - * @export - * @class Page - * @implements {IPageNode} - * @implements {IFilterable} - */ - var Page = (function () { - /** - * Creates an instance of a Power BI report page. - * - * @param {IReportNode} report - * @param {string} name - * @param {string} [displayName] - * @param {boolean} [isActivePage] - * @param {models.SectionVisibility} [visibility] - * @hidden - */ - function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) { - this.report = report; - this.name = name; - this.displayName = displayName; - this.isActive = isActivePage; - this.visibility = visibility; - this.defaultSize = defaultSize; - this.defaultDisplayOption = defaultDisplayOption; - } - /** - * Gets all page level filters within the report. - * - * ```javascript - * page.getFilters() - * .then(filters => { ... }); - * ``` - * - * @returns {(Promise)} - */ - Page.prototype.getFilters = function () { - return this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Delete the page from the report - * - * ```javascript - * // Delete the page from the report - * page.delete(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.delete = function () { - return this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Removes all filters from this page of the report. - * - * ```javascript - * page.removeFilters(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.removeFilters = function () { - return this.setFilters([]); - }; - /** - * Makes the current page the active page of the report. - * - * ```javascripot - * page.setActive(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.setActive = function () { - var page = { - name: this.name, - displayName: null, - isActive: true - }; - return this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Sets all filters on the current page. - * - * ```javascript - * page.setFilters(filters); - * .catch(errors => { ... }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - Page.prototype.setFilters = function (filters) { - return this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Gets all the visuals on the page. - * - * ```javascript - * page.getVisuals() - * .then(visuals => { ... }); - * ``` - * - * @returns {Promise} - */ - Page.prototype.getVisuals = function () { - var _this = this; - if (utils.isRDLEmbed(this.report.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { - return response.body - .map(function (visual) { - return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); - }); - }, function (response) { - throw response.body; - }); - }; - /** - * Checks if page has layout. - * - * ```javascript - * page.hasLayout(layoutType) - * .then(hasLayout: boolean => { ... }); - * ``` - * - * @returns {(Promise)} - */ - Page.prototype.hasLayout = function (layoutType) { - if (utils.isRDLEmbed(this.report.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var layoutTypeEnum = models.LayoutType[layoutType]; - return this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - return Page; - }()); - exports.Page = Page; + var visualDescriptor_1 = __webpack_require__(9); + var models = __webpack_require__(5); + var utils = __webpack_require__(3); + var errors = __webpack_require__(6); + /** + * A Power BI report page + * + * @export + * @class Page + * @implements {IPageNode} + * @implements {IFilterable} + */ + var Page = (function () { + /** + * Creates an instance of a Power BI report page. + * + * @param {IReportNode} report + * @param {string} name + * @param {string} [displayName] + * @param {boolean} [isActivePage] + * @param {models.SectionVisibility} [visibility] + * @hidden + */ + function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) { + this.report = report; + this.name = name; + this.displayName = displayName; + this.isActive = isActivePage; + this.visibility = visibility; + this.defaultSize = defaultSize; + this.defaultDisplayOption = defaultDisplayOption; + } + /** + * Gets all page level filters within the report. + * + * ```javascript + * page.getFilters() + * .then(filters => { ... }); + * ``` + * + * @returns {(Promise)} + */ + Page.prototype.getFilters = function () { + return this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Delete the page from the report + * + * ```javascript + * // Delete the page from the report + * page.delete(); + * ``` + * + * @returns {Promise} + */ + Page.prototype.delete = function () { + return this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .then(function (response) { + return response.body; + }) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Removes all filters from this page of the report. + * + * ```javascript + * page.removeFilters(); + * ``` + * + * @returns {Promise} + */ + Page.prototype.removeFilters = function () { + return this.setFilters([]); + }; + /** + * Makes the current page the active page of the report. + * + * ```javascripot + * page.setActive(); + * ``` + * + * @returns {Promise} + */ + Page.prototype.setActive = function () { + var page = { + name: this.name, + displayName: null, + isActive: true + }; + return this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Sets all filters on the current page. + * + * ```javascript + * page.setFilters(filters); + * .catch(errors => { ... }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise} + */ + Page.prototype.setFilters = function (filters) { + return this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Set displayName to the current page. + * + * ```javascript + * page.setName(displayName); + * ``` + * + * @returns {Promise} + */ + Page.prototype.setDisplayName = function (displayName) { + var page = { + name: this.name, + displayName: displayName, + }; + return this.report.service.hpm.put("/report/pages/" + this.name + "/name", page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Gets all the visuals on the page. + * + * ```javascript + * page.getVisuals() + * .then(visuals => { ... }); + * ``` + * + * @returns {Promise} + */ + Page.prototype.getVisuals = function () { + var _this = this; + if (utils.isRDLEmbed(this.report.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .then(function (response) { + return response.body + .map(function (visual) { + return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); + }); + }, function (response) { + throw response.body; + }); + }; + /** + * Checks if page has layout. + * + * ```javascript + * page.hasLayout(layoutType) + * .then(hasLayout: boolean => { ... }); + * ``` + * + * @returns {(Promise)} + */ + Page.prototype.hasLayout = function (layoutType) { + if (utils.isRDLEmbed(this.report.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + var layoutTypeEnum = models.LayoutType[layoutType]; + return this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + return Page; + }()); + exports.Page = Page; /***/ }), /* 9 */ /***/ (function(module, exports) { - /** - * A Power BI visual within a page - * - * @export - * @class VisualDescriptor - * @implements {IVisualNode} - */ - var VisualDescriptor = (function () { - /** - * @hidden - */ - function VisualDescriptor(page, name, title, type, layout) { - this.name = name; - this.title = title; - this.type = type; - this.layout = layout; - this.page = page; - } - /** - * Gets all visual level filters of the current visual. - * - * ```javascript - * visual.getFilters() - * .then(filters => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.getFilters = function () { - return this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Removes all filters from the current visual. - * - * ```javascript - * visual.removeFilters(); - * ``` - * - * @returns {Promise} - */ - VisualDescriptor.prototype.removeFilters = function () { - return this.setFilters([]); - }; - /** - * Sets the filters on the current visual to 'filters'. - * - * ```javascript - * visual.setFilters(filters); - * .catch(errors => { ... }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - VisualDescriptor.prototype.setFilters = function (filters) { - return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Exports Visual data. - * Can export up to 30K rows. - * @param rows: Optional. Default value is 30K, maximum value is 30K as well. - * @param exportDataType: Optional. Default is models.ExportDataType.Summarized. - * ```javascript - * visual.exportData() - * .then(data => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.exportData = function (exportDataType, rows) { - var exportDataRequestBody = { - rows: rows, - exportDataType: exportDataType - }; - return this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Set slicer state. - * Works only for visuals of type slicer. - * @param state: A new state which contains the slicer filters. - * ```javascript - * visual.setSlicerState() - * .then(() => { ... }); - * ``` - */ - VisualDescriptor.prototype.setSlicerState = function (state) { - return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Get slicer state. - * Works only for visuals of type slicer. - * - * ```javascript - * visual.getSlicerState() - * .then(state => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.getSlicerState = function () { - return this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Clone existing visual to a new instance. - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.clone = function (request) { - if (request === void 0) { request = {}; } - return this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Sort a visual by dataField and direction. - * - * @param request: Sort by visual request. - * - * ```javascript - * visual.sortBy(request) - * .then(() => { ... }); - * ``` - */ - VisualDescriptor.prototype.sortBy = function (request) { - return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - return VisualDescriptor; - }()); - exports.VisualDescriptor = VisualDescriptor; + /** + * A Power BI visual within a page + * + * @export + * @class VisualDescriptor + * @implements {IVisualNode} + */ + var VisualDescriptor = (function () { + /** + * @hidden + */ + function VisualDescriptor(page, name, title, type, layout) { + this.name = name; + this.title = title; + this.type = type; + this.layout = layout; + this.page = page; + } + /** + * Gets all visual level filters of the current visual. + * + * ```javascript + * visual.getFilters() + * .then(filters => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.getFilters = function () { + return this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Removes all filters from the current visual. + * + * ```javascript + * visual.removeFilters(); + * ``` + * + * @returns {Promise} + */ + VisualDescriptor.prototype.removeFilters = function () { + return this.setFilters([]); + }; + /** + * Sets the filters on the current visual to 'filters'. + * + * ```javascript + * visual.setFilters(filters); + * .catch(errors => { ... }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise} + */ + VisualDescriptor.prototype.setFilters = function (filters) { + return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Exports Visual data. + * Can export up to 30K rows. + * @param rows: Optional. Default value is 30K, maximum value is 30K as well. + * @param exportDataType: Optional. Default is models.ExportDataType.Summarized. + * ```javascript + * visual.exportData() + * .then(data => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.exportData = function (exportDataType, rows) { + var exportDataRequestBody = { + rows: rows, + exportDataType: exportDataType + }; + return this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Set slicer state. + * Works only for visuals of type slicer. + * @param state: A new state which contains the slicer filters. + * ```javascript + * visual.setSlicerState() + * .then(() => { ... }); + * ``` + */ + VisualDescriptor.prototype.setSlicerState = function (state) { + return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Get slicer state. + * Works only for visuals of type slicer. + * + * ```javascript + * visual.getSlicerState() + * .then(state => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.getSlicerState = function () { + return this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Clone existing visual to a new instance. + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.clone = function (request) { + if (request === void 0) { request = {}; } + return this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Sort a visual by dataField and direction. + * + * @param request: Sort by visual request. + * + * ```javascript + * visual.sortBy(request) + * .then(() => { ... }); + * ``` + */ + VisualDescriptor.prototype.sortBy = function (request) { + return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + return VisualDescriptor; + }()); + exports.VisualDescriptor = VisualDescriptor; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { - var utils = __webpack_require__(3); - var errors = __webpack_require__(6); - /** - * Manages report bookmarks. - * - * @export - * @class BookmarksManager - * @implements {IBookmarksManager} - */ - var BookmarksManager = (function () { - /** - * @hidden - */ - function BookmarksManager(service, config, iframe) { - this.service = service; - this.config = config; - this.iframe = iframe; - } - /** - * Gets bookmarks that are defined in the report. - * - * ```javascript - * // Gets bookmarks that are defined in the report - * bookmarksManager.getBookmarks() - * .then(bookmarks => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - BookmarksManager.prototype.getBookmarks = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Apply bookmark by name. - * - * ```javascript - * bookmarksManager.apply(bookmarkName) - * ``` - * - * @param {string} bookmarkName The name of the bookmark to be applied - * @returns {Promise} - */ - BookmarksManager.prototype.apply = function (bookmarkName) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var request = { - name: bookmarkName - }; - return this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Play bookmarks: Enter or Exit bookmarks presentation mode. - * - * ```javascript - * // Enter presentation mode. - * bookmarksManager.play(models.BookmarksPlayMode.Presentation) - * ``` - * - * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` - * @returns {Promise} - */ - BookmarksManager.prototype.play = function (playMode) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var playBookmarkRequest = { - playMode: playMode - }; - return this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Capture bookmark from current state. - * - * ```javascript - * bookmarksManager.capture(options) - * ``` - * - * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing - * @returns {Promise} - */ - BookmarksManager.prototype.capture = function (options) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var request = { - options: options - }; - return this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Apply bookmark state. - * - * ```javascript - * bookmarksManager.applyState(bookmarkState) - * ``` - * - * @param {string} state A base64 bookmark state to be applied - * @returns {Promise} - */ - BookmarksManager.prototype.applyState = function (state) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var request = { - state: state - }; - return this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - return BookmarksManager; - }()); - exports.BookmarksManager = BookmarksManager; + var utils = __webpack_require__(3); + var errors = __webpack_require__(6); + /** + * Manages report bookmarks. + * + * @export + * @class BookmarksManager + * @implements {IBookmarksManager} + */ + var BookmarksManager = (function () { + /** + * @hidden + */ + function BookmarksManager(service, config, iframe) { + this.service = service; + this.config = config; + this.iframe = iframe; + } + /** + * Gets bookmarks that are defined in the report. + * + * ```javascript + * // Gets bookmarks that are defined in the report + * bookmarksManager.getBookmarks() + * .then(bookmarks => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + BookmarksManager.prototype.getBookmarks = function () { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + return this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Apply bookmark by name. + * + * ```javascript + * bookmarksManager.apply(bookmarkName) + * ``` + * + * @param {string} bookmarkName The name of the bookmark to be applied + * @returns {Promise} + */ + BookmarksManager.prototype.apply = function (bookmarkName) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + var request = { + name: bookmarkName + }; + return this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Play bookmarks: Enter or Exit bookmarks presentation mode. + * + * ```javascript + * // Enter presentation mode. + * bookmarksManager.play(models.BookmarksPlayMode.Presentation) + * ``` + * + * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` + * @returns {Promise} + */ + BookmarksManager.prototype.play = function (playMode) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + var playBookmarkRequest = { + playMode: playMode + }; + return this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Capture bookmark from current state. + * + * ```javascript + * bookmarksManager.capture(options) + * ``` + * + * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing + * @returns {Promise} + */ + BookmarksManager.prototype.capture = function (options) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + var request = { + options: options + }; + return this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Apply bookmark state. + * + * ```javascript + * bookmarksManager.applyState(bookmarkState) + * ``` + * + * @param {string} state A base64 bookmark state to be applied + * @returns {Promise} + */ + BookmarksManager.prototype.applyState = function (state) { + if (utils.isRDLEmbed(this.config.embedUrl)) { + return Promise.reject(errors.APINotSupportedForRDLError); + } + var request = { + state: state + }; + return this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + return BookmarksManager; + }()); + exports.BookmarksManager = BookmarksManager; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var embed = __webpack_require__(2); - var utils = __webpack_require__(3); - /** - * A Power BI Report creator component - * - * @export - * @class Create - * @extends {embed.Embed} - */ - var Create = (function (_super) { - __extends(Create, _super); - /* - * @hidden - */ - function Create(service, element, config, phasedRender, isBootstrap) { - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - } - /** - * Gets the dataset ID from the first available location: createConfig or embed url. - * - * @returns {string} - */ - Create.prototype.getId = function () { - var datasetId = (this.createConfig && this.createConfig.datasetId) ? this.createConfig.datasetId : Create.findIdFromEmbedUrl(this.config.embedUrl); - if (typeof datasetId !== 'string' || datasetId.length === 0) { - throw new Error('Dataset id is required, but it was not found. You must provide an id either as part of embed configuration.'); - } - return datasetId; - }; - /** - * Validate create report configuration. - */ - Create.prototype.validate = function (config) { - return models.validateCreateReport(config); - }; - /** - * Handle config changes. - * - * @hidden - * @returns {void} - */ - Create.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - var config = this.config; - this.createConfig = { - accessToken: config.accessToken, - datasetId: config.datasetId || this.getId(), - groupId: config.groupId, - settings: config.settings, - tokenType: config.tokenType, - theme: config.theme - }; - }; - /** - * @hidden - * @returns {string} - */ - Create.prototype.getDefaultEmbedUrlEndpoint = function () { - return "reportEmbed"; - }; - /** - * checks if the report is saved. - * - * ```javascript - * report.isSaved() - * ``` - * - * @returns {Promise} - */ - Create.prototype.isSaved = function () { - return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); - }; - /** - * Adds the ability to get datasetId from url. - * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1). - * - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration. - * - * @static - * @param {string} url - * @returns {string} - * @hidden - */ - Create.findIdFromEmbedUrl = function (url) { - var datasetIdRegEx = /datasetId="?([^&]+)"?/; - var datasetIdMatch = url.match(datasetIdRegEx); - var datasetId; - if (datasetIdMatch) { - datasetId = datasetIdMatch[1]; - } - return datasetId; - }; - return Create; - }(embed.Embed)); - exports.Create = Create; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var models = __webpack_require__(5); + var embed = __webpack_require__(2); + var utils = __webpack_require__(3); + /** + * A Power BI Report creator component + * + * @export + * @class Create + * @extends {embed.Embed} + */ + var Create = (function (_super) { + __extends(Create, _super); + /* + * @hidden + */ + function Create(service, element, config, phasedRender, isBootstrap) { + _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); + } + /** + * Gets the dataset ID from the first available location: createConfig or embed url. + * + * @returns {string} + */ + Create.prototype.getId = function () { + var datasetId = (this.createConfig && this.createConfig.datasetId) ? this.createConfig.datasetId : Create.findIdFromEmbedUrl(this.config.embedUrl); + if (typeof datasetId !== 'string' || datasetId.length === 0) { + throw new Error('Dataset id is required, but it was not found. You must provide an id either as part of embed configuration.'); + } + return datasetId; + }; + /** + * Validate create report configuration. + */ + Create.prototype.validate = function (config) { + return models.validateCreateReport(config); + }; + /** + * Handle config changes. + * + * @hidden + * @returns {void} + */ + Create.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + var config = this.config; + this.createConfig = { + accessToken: config.accessToken, + datasetId: config.datasetId || this.getId(), + groupId: config.groupId, + settings: config.settings, + tokenType: config.tokenType, + theme: config.theme + }; + }; + /** + * @hidden + * @returns {string} + */ + Create.prototype.getDefaultEmbedUrlEndpoint = function () { + return "reportEmbed"; + }; + /** + * checks if the report is saved. + * + * ```javascript + * report.isSaved() + * ``` + * + * @returns {Promise} + */ + Create.prototype.isSaved = function () { + return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); + }; + /** + * Adds the ability to get datasetId from url. + * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1). + * + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration. + * + * @static + * @param {string} url + * @returns {string} + * @hidden + */ + Create.findIdFromEmbedUrl = function (url) { + var datasetIdRegEx = /datasetId="?([^&]+)"?/; + var datasetIdMatch = url.match(datasetIdRegEx); + var datasetId; + if (datasetIdMatch) { + datasetId = datasetIdMatch[1]; + } + return datasetId; + }; + return Create; + }(embed.Embed)); + exports.Create = Create; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var embed = __webpack_require__(2); - var models = __webpack_require__(5); - /** - * A Power BI Dashboard embed component - * - * @export - * @class Dashboard - * @extends {embed.Embed} - * @implements {IDashboardNode} - * @implements {IFilterable} - */ - var Dashboard = (function (_super) { - __extends(Dashboard, _super); - /** - * Creates an instance of a Power BI Dashboard. - * - * @param {service.Service} service - * @hidden - * @param {HTMLElement} element - */ - function Dashboard(service, element, config, phasedRender, isBootstrap) { - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - this.loadPath = "/dashboard/load"; - this.phasedLoadPath = "/dashboard/prepare"; - Array.prototype.push.apply(this.allowedEvents, Dashboard.allowedEvents); - } - /** - * This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id. - * E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e - * - * By extracting the id we can ensure id is always explicitly provided as part of the load configuration. - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Dashboard.findIdFromEmbedUrl = function (url) { - var dashboardIdRegEx = /dashboardId="?([^&]+)"?/; - var dashboardIdMatch = url.match(dashboardIdRegEx); - var dashboardId; - if (dashboardIdMatch) { - dashboardId = dashboardIdMatch[1]; - } - return dashboardId; - }; - /** - * Get dashboard id from first available location: options, attribute, embed url. - * - * @returns {string} - */ - Dashboard.prototype.getId = function () { - var config = this.config; - var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); - if (typeof dashboardId !== 'string' || dashboardId.length === 0) { - throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'."); - } - return dashboardId; - }; - /** - * Validate load configuration. - * - * @hidden - */ - Dashboard.prototype.validate = function (baseConfig) { - var config = baseConfig; - var error = models.validateDashboardLoad(config); - return error ? error : this.ValidatePageView(config.pageView); - }; - /** - * Handle config changes. - * @hidden - * @returns {void} - */ - Dashboard.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - // Populate dashboard id into config object. - this.config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Dashboard.prototype.getDefaultEmbedUrlEndpoint = function () { - return "dashboardEmbed"; - }; - /** - * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView - * @hidden - */ - Dashboard.prototype.ValidatePageView = function (pageView) { - if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") { - return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }]; - } - }; - /** @hidden */ - Dashboard.allowedEvents = ["tileClicked", "error"]; - /** @hidden */ - Dashboard.dashboardIdAttribute = 'powerbi-dashboard-id'; - /** @hidden */ - Dashboard.typeAttribute = 'powerbi-type'; - /** @hidden */ - Dashboard.type = "Dashboard"; - return Dashboard; - }(embed.Embed)); - exports.Dashboard = Dashboard; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var embed = __webpack_require__(2); + var models = __webpack_require__(5); + /** + * A Power BI Dashboard embed component + * + * @export + * @class Dashboard + * @extends {embed.Embed} + * @implements {IDashboardNode} + * @implements {IFilterable} + */ + var Dashboard = (function (_super) { + __extends(Dashboard, _super); + /** + * Creates an instance of a Power BI Dashboard. + * + * @param {service.Service} service + * @hidden + * @param {HTMLElement} element + */ + function Dashboard(service, element, config, phasedRender, isBootstrap) { + _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); + this.loadPath = "/dashboard/load"; + this.phasedLoadPath = "/dashboard/prepare"; + Array.prototype.push.apply(this.allowedEvents, Dashboard.allowedEvents); + } + /** + * This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id. + * E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e + * + * By extracting the id we can ensure id is always explicitly provided as part of the load configuration. + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Dashboard.findIdFromEmbedUrl = function (url) { + var dashboardIdRegEx = /dashboardId="?([^&]+)"?/; + var dashboardIdMatch = url.match(dashboardIdRegEx); + var dashboardId; + if (dashboardIdMatch) { + dashboardId = dashboardIdMatch[1]; + } + return dashboardId; + }; + /** + * Get dashboard id from first available location: options, attribute, embed url. + * + * @returns {string} + */ + Dashboard.prototype.getId = function () { + var config = this.config; + var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); + if (typeof dashboardId !== 'string' || dashboardId.length === 0) { + throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'."); + } + return dashboardId; + }; + /** + * Validate load configuration. + * + * @hidden + */ + Dashboard.prototype.validate = function (baseConfig) { + var config = baseConfig; + var error = models.validateDashboardLoad(config); + return error ? error : this.ValidatePageView(config.pageView); + }; + /** + * Handle config changes. + * @hidden + * @returns {void} + */ + Dashboard.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + // Populate dashboard id into config object. + this.config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Dashboard.prototype.getDefaultEmbedUrlEndpoint = function () { + return "dashboardEmbed"; + }; + /** + * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView + * @hidden + */ + Dashboard.prototype.ValidatePageView = function (pageView) { + if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") { + return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }]; + } + }; + /** @hidden */ + Dashboard.allowedEvents = ["tileClicked", "error"]; + /** @hidden */ + Dashboard.dashboardIdAttribute = 'powerbi-dashboard-id'; + /** @hidden */ + Dashboard.typeAttribute = 'powerbi-type'; + /** @hidden */ + Dashboard.type = "Dashboard"; + return Dashboard; + }(embed.Embed)); + exports.Dashboard = Dashboard; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var embed = __webpack_require__(2); - /** - * The Power BI tile embed component - * - * @export - * @class Tile - * @extends {Embed} - */ - var Tile = (function (_super) { - __extends(Tile, _super); - /** - * @hidden - */ - function Tile(service, element, baseConfig, phasedRender, isBootstrap) { - var config = baseConfig; - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - this.loadPath = "/tile/load"; - Array.prototype.push.apply(this.allowedEvents, Tile.allowedEvents); - } - /** - * The ID of the tile - * - * @returns {string} - */ - Tile.prototype.getId = function () { - var config = this.config; - var tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); - if (typeof tileId !== 'string' || tileId.length === 0) { - throw new Error("Tile id is required, but it was not found. You must provide an id either as part of embed configuration."); - } - return tileId; - }; - /** - * Validate load configuration. - */ - Tile.prototype.validate = function (config) { - var embedConfig = config; - return models.validateTileLoad(embedConfig); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Tile.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - // Populate tile id into config object. - this.config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Tile.prototype.getDefaultEmbedUrlEndpoint = function () { - return "tileEmbed"; - }; - /** - * Adds the ability to get tileId from url. - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Tile.findIdFromEmbedUrl = function (url) { - var tileIdRegEx = /tileId="?([^&]+)"?/; - var tileIdMatch = url.match(tileIdRegEx); - var tileId; - if (tileIdMatch) { - tileId = tileIdMatch[1]; - } - return tileId; - }; - /** @hidden */ - Tile.type = "Tile"; - /** @hidden */ - Tile.allowedEvents = ["tileClicked", "tileLoaded"]; - return Tile; - }(embed.Embed)); - exports.Tile = Tile; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var models = __webpack_require__(5); + var embed = __webpack_require__(2); + /** + * The Power BI tile embed component + * + * @export + * @class Tile + * @extends {Embed} + */ + var Tile = (function (_super) { + __extends(Tile, _super); + /** + * @hidden + */ + function Tile(service, element, baseConfig, phasedRender, isBootstrap) { + var config = baseConfig; + _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); + this.loadPath = "/tile/load"; + Array.prototype.push.apply(this.allowedEvents, Tile.allowedEvents); + } + /** + * The ID of the tile + * + * @returns {string} + */ + Tile.prototype.getId = function () { + var config = this.config; + var tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); + if (typeof tileId !== 'string' || tileId.length === 0) { + throw new Error("Tile id is required, but it was not found. You must provide an id either as part of embed configuration."); + } + return tileId; + }; + /** + * Validate load configuration. + */ + Tile.prototype.validate = function (config) { + var embedConfig = config; + return models.validateTileLoad(embedConfig); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Tile.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + // Populate tile id into config object. + this.config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Tile.prototype.getDefaultEmbedUrlEndpoint = function () { + return "tileEmbed"; + }; + /** + * Adds the ability to get tileId from url. + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Tile.findIdFromEmbedUrl = function (url) { + var tileIdRegEx = /tileId="?([^&]+)"?/; + var tileIdMatch = url.match(tileIdRegEx); + var tileId; + if (tileIdMatch) { + tileId = tileIdMatch[1]; + } + return tileId; + }; + /** @hidden */ + Tile.type = "Tile"; + /** @hidden */ + Tile.allowedEvents = ["tileClicked", "tileLoaded"]; + return Tile; + }(embed.Embed)); + exports.Tile = Tile; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var embed = __webpack_require__(2); - /** - * The Power BI Q&A embed component - * - * @export - * @class Qna - * @extends {Embed} - */ - var Qna = (function (_super) { - __extends(Qna, _super); - /** - * @hidden - */ - function Qna(service, element, config, phasedRender, isBootstrap) { - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - this.loadPath = "/qna/load"; - this.phasedLoadPath = "/qna/prepare"; - Array.prototype.push.apply(this.allowedEvents, Qna.allowedEvents); - } - /** - * The ID of the Q&A embed component - * - * @returns {string} - */ - Qna.prototype.getId = function () { - return null; - }; - /** - * Change the question of the Q&A embed component - * - * @param question - question which will render Q&A data - * @returns {string} - */ - Qna.prototype.setQuestion = function (question) { - var qnaData = { - question: question - }; - return this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Qna.prototype.configChanged = function (isBootstrap) { - // Nothing to do in Q&A embed. - }; - /** - * @hidden - * @returns {string} - */ - Qna.prototype.getDefaultEmbedUrlEndpoint = function () { - return "qnaEmbed"; - }; - /** - * Validate load configuration. - */ - Qna.prototype.validate = function (config) { - return models.validateLoadQnaConfiguration(config); - }; - /** @hidden */ - Qna.type = "Qna"; - /** @hidden */ - Qna.allowedEvents = ["loaded", "visualRendered"]; - return Qna; - }(embed.Embed)); - exports.Qna = Qna; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var models = __webpack_require__(5); + var embed = __webpack_require__(2); + /** + * The Power BI Q&A embed component + * + * @export + * @class Qna + * @extends {Embed} + */ + var Qna = (function (_super) { + __extends(Qna, _super); + /** + * @hidden + */ + function Qna(service, element, config, phasedRender, isBootstrap) { + _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); + this.loadPath = "/qna/load"; + this.phasedLoadPath = "/qna/prepare"; + Array.prototype.push.apply(this.allowedEvents, Qna.allowedEvents); + } + /** + * The ID of the Q&A embed component + * + * @returns {string} + */ + Qna.prototype.getId = function () { + return null; + }; + /** + * Change the question of the Q&A embed component + * + * @param question - question which will render Q&A data + * @returns {string} + */ + Qna.prototype.setQuestion = function (question) { + var qnaData = { + question: question + }; + return this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Qna.prototype.configChanged = function (isBootstrap) { + // Nothing to do in Q&A embed. + }; + /** + * @hidden + * @returns {string} + */ + Qna.prototype.getDefaultEmbedUrlEndpoint = function () { + return "qnaEmbed"; + }; + /** + * Validate load configuration. + */ + Qna.prototype.validate = function (config) { + return models.validateLoadQnaConfiguration(config); + }; + /** @hidden */ + Qna.type = "Qna"; + /** @hidden */ + Qna.allowedEvents = ["loaded", "visualRendered"]; + return Qna; + }(embed.Embed)); + exports.Qna = Qna; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var report_1 = __webpack_require__(7); - var visualDescriptor_1 = __webpack_require__(9); - /** - * The Power BI Visual embed component - * - * @export - * @class Visual - */ - var Visual = (function (_super) { - __extends(Visual, _super); - /** - * Creates an instance of a Power BI Single Visual. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} config - * @hidden - */ - function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { - _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe); - } - Visual.prototype.load = function (phasedRender) { - var config = this.config; - if (!config.accessToken) { - // bootstrap flow. - return; - } - if (typeof config.pageName !== 'string' || config.pageName.length === 0) { - throw new Error("Page name is required when embedding a visual."); - } - if (typeof config.visualName !== 'string' || config.visualName.length === 0) { - throw new Error("Visual name is required, but it was not found. You must provide a visual name as part of embed configuration."); - } - // calculate custom layout settings and override config. - var width = config.width ? config.width : this.iframe.offsetWidth; - var height = config.height ? config.height : this.iframe.offsetHeight; - var pageSize = { - type: models.PageSizeType.Custom, - width: width, - height: height, - }; - var pagesLayout = {}; - pagesLayout[config.pageName] = { - defaultLayout: { - displayState: { - mode: models.VisualContainerDisplayMode.Hidden - } - }, - visualsLayout: {} - }; - pagesLayout[config.pageName].visualsLayout[config.visualName] = { - displayState: { - mode: models.VisualContainerDisplayMode.Visible - }, - x: 1, - y: 1, - z: 1, - width: pageSize.width, - height: pageSize.height - }; - config.settings = config.settings || {}; - config.settings.filterPaneEnabled = false; - config.settings.navContentPaneEnabled = false; - config.settings.layoutType = models.LayoutType.Custom; - config.settings.customLayout = { - displayOption: models.DisplayOption.FitToPage, - pageSize: pageSize, - pagesLayout: pagesLayout - }; - this.config = config; - return _super.prototype.load.call(this, phasedRender); - }; - /** - * Gets the list of pages within the report - not supported in visual embed. - * - * @returns {Promise} - */ - Visual.prototype.getPages = function () { - throw Visual.GetPagesNotSupportedError; - }; - /** - * Sets the active page of the report - not supported in visual embed. - * - * @param {string} pageName - * @returns {Promise} - */ - Visual.prototype.setPage = function (pageName) { - throw Visual.SetPageNotSupportedError; - }; - /** - * Gets the embedded visual descriptor object that contains the visual name, type, etc. - * - * ```javascript - * visual.getVisualDescriptor() - * .then(visualDetails => { ... }); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.getVisualDescriptor = function () { - var _this = this; - var config = this.config; - return this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - // Find the embedded visual from visuals of this page - // TODO: Use the Array.find method when ES6 is available - var embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); - if (embeddedVisuals.length === 0) { - var visualNotFoundError = { - message: "visualNotFound", - detailedMessage: "Visual not found" - }; - throw visualNotFoundError; - } - var embeddedVisual = embeddedVisuals[0]; - var currentPage = _this.page(config.pageName); - return new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); - }, function (response) { - throw response.body; - }); - }; - /** - * Gets filters that are applied to the filter level. - * Default filter level is visual level. - * - * ```javascript - * visual.getFilters(filtersLevel) - * .then(filters => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.getFilters = function (filtersLevel) { - var url = this.getFiltersLevelUrl(filtersLevel); - return this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Sets filters at the filter level. - * Default filter level is visual level. - * - * ```javascript - * const filters: [ - * ... - * ]; - * - * visual.setFilters(filters, filtersLevel) - * .catch(errors => { - * ... - * }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - Visual.prototype.setFilters = function (filters, filtersLevel) { - var url = this.getFiltersLevelUrl(filtersLevel); - return this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Removes all filters from the current filter level. - * Default filter level is visual level. - * - * ```javascript - * visual.removeFilters(filtersLevel); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.removeFilters = function (filtersLevel) { - return this.setFilters([], filtersLevel); - }; - /** - * @hidden - */ - Visual.prototype.getFiltersLevelUrl = function (filtersLevel) { - var config = this.config; - switch (filtersLevel) { - case models.FiltersLevel.Report: - return "/report/filters"; - case models.FiltersLevel.Page: - return "/report/pages/" + config.pageName + "/filters"; - default: - return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters"; - } - }; - /** @hidden */ - Visual.type = "visual"; - /** @hidden */ - Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; - /** @hidden */ - Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; - return Visual; - }(report_1.Report)); - exports.Visual = Visual; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var models = __webpack_require__(5); + var report_1 = __webpack_require__(7); + var visualDescriptor_1 = __webpack_require__(9); + /** + * The Power BI Visual embed component + * + * @export + * @class Visual + */ + var Visual = (function (_super) { + __extends(Visual, _super); + /** + * Creates an instance of a Power BI Single Visual. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} config + * @hidden + */ + function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { + _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe); + } + Visual.prototype.load = function (phasedRender) { + var config = this.config; + if (!config.accessToken) { + // bootstrap flow. + return; + } + if (typeof config.pageName !== 'string' || config.pageName.length === 0) { + throw new Error("Page name is required when embedding a visual."); + } + if (typeof config.visualName !== 'string' || config.visualName.length === 0) { + throw new Error("Visual name is required, but it was not found. You must provide a visual name as part of embed configuration."); + } + // calculate custom layout settings and override config. + var width = config.width ? config.width : this.iframe.offsetWidth; + var height = config.height ? config.height : this.iframe.offsetHeight; + var pageSize = { + type: models.PageSizeType.Custom, + width: width, + height: height, + }; + var pagesLayout = {}; + pagesLayout[config.pageName] = { + defaultLayout: { + displayState: { + mode: models.VisualContainerDisplayMode.Hidden + } + }, + visualsLayout: {} + }; + pagesLayout[config.pageName].visualsLayout[config.visualName] = { + displayState: { + mode: models.VisualContainerDisplayMode.Visible + }, + x: 1, + y: 1, + z: 1, + width: pageSize.width, + height: pageSize.height + }; + config.settings = config.settings || {}; + config.settings.filterPaneEnabled = false; + config.settings.navContentPaneEnabled = false; + config.settings.layoutType = models.LayoutType.Custom; + config.settings.customLayout = { + displayOption: models.DisplayOption.FitToPage, + pageSize: pageSize, + pagesLayout: pagesLayout + }; + this.config = config; + return _super.prototype.load.call(this, phasedRender); + }; + /** + * Gets the list of pages within the report - not supported in visual embed. + * + * @returns {Promise} + */ + Visual.prototype.getPages = function () { + throw Visual.GetPagesNotSupportedError; + }; + /** + * Sets the active page of the report - not supported in visual embed. + * + * @param {string} pageName + * @returns {Promise} + */ + Visual.prototype.setPage = function (pageName) { + throw Visual.SetPageNotSupportedError; + }; + /** + * Gets the embedded visual descriptor object that contains the visual name, type, etc. + * + * ```javascript + * visual.getVisualDescriptor() + * .then(visualDetails => { ... }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getVisualDescriptor = function () { + var _this = this; + var config = this.config; + return this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { + // Find the embedded visual from visuals of this page + // TODO: Use the Array.find method when ES6 is available + var embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); + if (embeddedVisuals.length === 0) { + var visualNotFoundError = { + message: "visualNotFound", + detailedMessage: "Visual not found" + }; + throw visualNotFoundError; + } + var embeddedVisual = embeddedVisuals[0]; + var currentPage = _this.page(config.pageName); + return new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); + }, function (response) { + throw response.body; + }); + }; + /** + * Gets filters that are applied to the filter level. + * Default filter level is visual level. + * + * ```javascript + * visual.getFilters(filtersLevel) + * .then(filters => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getFilters = function (filtersLevel) { + var url = this.getFiltersLevelUrl(filtersLevel); + return this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(function (response) { return response.body; }, function (response) { + throw response.body; + }); + }; + /** + * Sets filters at the filter level. + * Default filter level is visual level. + * + * ```javascript + * const filters: [ + * ... + * ]; + * + * visual.setFilters(filters, filtersLevel) + * .catch(errors => { + * ... + * }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise} + */ + Visual.prototype.setFilters = function (filters, filtersLevel) { + var url = this.getFiltersLevelUrl(filtersLevel); + return this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .catch(function (response) { + throw response.body; + }); + }; + /** + * Removes all filters from the current filter level. + * Default filter level is visual level. + * + * ```javascript + * visual.removeFilters(filtersLevel); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.removeFilters = function (filtersLevel) { + return this.setFilters([], filtersLevel); + }; + /** + * @hidden + */ + Visual.prototype.getFiltersLevelUrl = function (filtersLevel) { + var config = this.config; + switch (filtersLevel) { + case models.FiltersLevel.Report: + return "/report/filters"; + case models.FiltersLevel.Page: + return "/report/pages/" + config.pageName + "/filters"; + default: + return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters"; + } + }; + /** @hidden */ + Visual.type = "visual"; + /** @hidden */ + Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; + /** @hidden */ + Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; + return Visual; + }(report_1.Report)); + exports.Visual = Visual; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { - var config_1 = __webpack_require__(4); - var wpmp = __webpack_require__(17); - var hpm = __webpack_require__(18); - var router = __webpack_require__(19); - exports.hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) { - if (sdkVersion === void 0) { sdkVersion = config_1.default.version; } - if (sdkType === void 0) { sdkType = config_1.default.type; } - return new hpm.HttpPostMessage(wpmp, { - 'x-sdk-type': sdkType, - 'x-sdk-version': sdkVersion - }, defaultTargetWindow); - }; - exports.wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) { - return new wpmp.WindowPostMessageProxy({ - processTrackingProperties: { - addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties, - getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties, - }, - isErrorMessage: hpm.HttpPostMessage.isErrorMessage, - suppressWarnings: true, - name: name, - logMessages: logMessages, - eventSourceOverrideWindow: eventSourceOverrideWindow - }); - }; - exports.routerFactory = function (wpmp) { - return new router.Router(wpmp); - }; + var config_1 = __webpack_require__(4); + var wpmp = __webpack_require__(17); + var hpm = __webpack_require__(18); + var router = __webpack_require__(19); + exports.hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) { + if (sdkVersion === void 0) { sdkVersion = config_1.default.version; } + if (sdkType === void 0) { sdkType = config_1.default.type; } + return new hpm.HttpPostMessage(wpmp, { + 'x-sdk-type': sdkType, + 'x-sdk-version': sdkVersion + }, defaultTargetWindow); + }; + exports.wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) { + return new wpmp.WindowPostMessageProxy({ + processTrackingProperties: { + addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties, + getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties, + }, + isErrorMessage: hpm.HttpPostMessage.isErrorMessage, + suppressWarnings: true, + name: name, + logMessages: logMessages, + eventSourceOverrideWindow: eventSourceOverrideWindow + }); + }; + exports.routerFactory = function (wpmp) { + return new router.Router(wpmp); + }; /***/ }), @@ -7045,241 +7087,241 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, exports) { - "use strict"; - var WindowPostMessageProxy = (function () { - function WindowPostMessageProxy(options) { - var _this = this; - if (options === void 0) { options = { - processTrackingProperties: { - addTrackingProperties: WindowPostMessageProxy.defaultAddTrackingProperties, - getTrackingProperties: WindowPostMessageProxy.defaultGetTrackingProperties - }, - isErrorMessage: WindowPostMessageProxy.defaultIsErrorMessage, - receiveWindow: window, - name: WindowPostMessageProxy.createRandomString() - }; } - this.pendingRequestPromises = {}; - // save options with defaults - this.addTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.addTrackingProperties) || WindowPostMessageProxy.defaultAddTrackingProperties; - this.getTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.getTrackingProperties) || WindowPostMessageProxy.defaultGetTrackingProperties; - this.isErrorMessage = options.isErrorMessage || WindowPostMessageProxy.defaultIsErrorMessage; - this.receiveWindow = options.receiveWindow || window; - this.name = options.name || WindowPostMessageProxy.createRandomString(); - this.logMessages = options.logMessages || false; - this.eventSourceOverrideWindow = options.eventSourceOverrideWindow; - this.suppressWarnings = options.suppressWarnings || false; - if (this.logMessages) { - console.log("new WindowPostMessageProxy created with name: " + this.name + " receiving on window: " + this.receiveWindow.document.title); - } - // Initialize - this.handlers = []; - this.windowMessageHandler = function (event) { return _this.onMessageReceived(event); }; - this.start(); - } - // Static - WindowPostMessageProxy.defaultAddTrackingProperties = function (message, trackingProperties) { - message[WindowPostMessageProxy.messagePropertyName] = trackingProperties; - return message; - }; - WindowPostMessageProxy.defaultGetTrackingProperties = function (message) { - return message[WindowPostMessageProxy.messagePropertyName]; - }; - WindowPostMessageProxy.defaultIsErrorMessage = function (message) { - return !!message.error; - }; - /** - * Utility to create a deferred object. - */ - // TODO: Look to use RSVP library instead of doing this manually. - // From what I searched RSVP would work better because it has .finally and .deferred; however, it doesn't have Typings information. - WindowPostMessageProxy.createDeferred = function () { - var deferred = { - resolve: null, - reject: null, - promise: null - }; - var promise = new Promise(function (resolve, reject) { - deferred.resolve = resolve; - deferred.reject = reject; - }); - deferred.promise = promise; - return deferred; - }; - /** - * Utility to generate random sequence of characters used as tracking id for promises. - */ - WindowPostMessageProxy.createRandomString = function () { - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - return randomValueArray[0].toString(36).substring(1); - }; - /** - * Adds handler. - * If the first handler whose test method returns true will handle the message and provide a response. - */ - WindowPostMessageProxy.prototype.addHandler = function (handler) { - this.handlers.push(handler); - }; - /** - * Removes handler. - * The reference must match the original object that was provided when adding the handler. - */ - WindowPostMessageProxy.prototype.removeHandler = function (handler) { - var handlerIndex = this.handlers.indexOf(handler); - if (handlerIndex === -1) { - throw new Error("You attempted to remove a handler but no matching handler was found."); - } - this.handlers.splice(handlerIndex, 1); - }; - /** - * Start listening to message events. - */ - WindowPostMessageProxy.prototype.start = function () { - this.receiveWindow.addEventListener('message', this.windowMessageHandler); - }; - /** - * Stops listening to message events. - */ - WindowPostMessageProxy.prototype.stop = function () { - this.receiveWindow.removeEventListener('message', this.windowMessageHandler); - }; - /** - * Post message to target window with tracking properties added and save deferred object referenced by tracking id. - */ - WindowPostMessageProxy.prototype.postMessage = function (targetWindow, message) { - // Add tracking properties to indicate message came from this proxy - var trackingProperties = { id: WindowPostMessageProxy.createRandomString() }; - this.addTrackingProperties(message, trackingProperties); - if (this.logMessages) { - console.log(this.name + " Posting message:"); - console.log(JSON.stringify(message, null, ' ')); - } - targetWindow.postMessage(message, "*"); - var deferred = WindowPostMessageProxy.createDeferred(); - this.pendingRequestPromises[trackingProperties.id] = deferred; - return deferred.promise; - }; - /** - * Send response message to target window. - * Response messages re-use tracking properties from a previous request message. - */ - WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) { - this.addTrackingProperties(message, trackingProperties); - if (this.logMessages) { - console.log(this.name + " Sending response:"); - console.log(JSON.stringify(message, null, ' ')); - } - targetWindow.postMessage(message, "*"); - }; - /** - * Message handler. - */ - WindowPostMessageProxy.prototype.onMessageReceived = function (event) { - var _this = this; - if (this.logMessages) { - console.log(this.name + " Received message:"); - console.log("type: " + event.type); - console.log(JSON.stringify(event.data, null, ' ')); - } - var sendingWindow = this.eventSourceOverrideWindow || event.source; - var message = event.data; - if (typeof message !== "object") { - if (!this.suppressWarnings) { - console.warn("Proxy(" + this.name + "): Received message that was not an object. Discarding message"); - } - return; - } - var trackingProperties; - try { - trackingProperties = this.getTrackingProperties(message); - } - catch (e) { - if (!this.suppressWarnings) { - console.warn("Proxy(" + this.name + "): Error occurred when attempting to get tracking properties from incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - } - var deferred; - if (trackingProperties) { - deferred = this.pendingRequestPromises[trackingProperties.id]; - } - // If message does not have a known ID, treat it as a request - // Otherwise, treat message as response - if (!deferred) { - var handled = this.handlers.some(function (handler) { - var canMessageBeHandled = false; - try { - canMessageBeHandled = handler.test(message); - } - catch (e) { - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): Error occurred when handler was testing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - } - if (canMessageBeHandled) { - var responseMessagePromise = void 0; - try { - responseMessagePromise = Promise.resolve(handler.handle(message)); - } - catch (e) { - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): Error occurred when handler was processing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - responseMessagePromise = Promise.resolve(); - } - responseMessagePromise - .then(function (responseMessage) { - if (!responseMessage) { - var warningMessage = "Handler for message: " + JSON.stringify(message, null, ' ') + " did not return a response message. The default response message will be returned instead."; - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): " + warningMessage); - } - responseMessage = { - warning: warningMessage - }; - } - _this.sendResponse(sendingWindow, responseMessage, trackingProperties); - }); - return true; - } - }); - /** - * TODO: Consider returning an error message if nothing handled the message. - * In the case of the Report receiving messages all of them should be handled, - * however, in the case of the SDK receiving messages it's likely it won't register handlers - * for all events. Perhaps make this an option at construction time. - */ - if (!handled && !this.suppressWarnings) { - console.warn("Proxy(" + this.name + ") did not handle message. Handlers: " + this.handlers.length + " Message: " + JSON.stringify(message, null, '') + "."); - } - } - else { - /** - * If error message reject promise, - * Otherwise, resolve promise - */ - var isErrorMessage = true; - try { - isErrorMessage = this.isErrorMessage(message); - } - catch (e) { - console.warn("Proxy(" + this.name + ") Error occurred when trying to determine if message is consider an error response. Message: ", JSON.stringify(message, null, ''), 'Error: ', e); - } - if (isErrorMessage) { - deferred.reject(message); - } - else { - deferred.resolve(message); - } - // TODO: Move to .finally clause up where promise is created for better maitenance like original proxy code. - delete this.pendingRequestPromises[trackingProperties.id]; - } - }; - WindowPostMessageProxy.messagePropertyName = "windowPostMessageProxy"; - return WindowPostMessageProxy; - }()); - exports.WindowPostMessageProxy = WindowPostMessageProxy; + "use strict"; + var WindowPostMessageProxy = (function () { + function WindowPostMessageProxy(options) { + var _this = this; + if (options === void 0) { options = { + processTrackingProperties: { + addTrackingProperties: WindowPostMessageProxy.defaultAddTrackingProperties, + getTrackingProperties: WindowPostMessageProxy.defaultGetTrackingProperties + }, + isErrorMessage: WindowPostMessageProxy.defaultIsErrorMessage, + receiveWindow: window, + name: WindowPostMessageProxy.createRandomString() + }; } + this.pendingRequestPromises = {}; + // save options with defaults + this.addTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.addTrackingProperties) || WindowPostMessageProxy.defaultAddTrackingProperties; + this.getTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.getTrackingProperties) || WindowPostMessageProxy.defaultGetTrackingProperties; + this.isErrorMessage = options.isErrorMessage || WindowPostMessageProxy.defaultIsErrorMessage; + this.receiveWindow = options.receiveWindow || window; + this.name = options.name || WindowPostMessageProxy.createRandomString(); + this.logMessages = options.logMessages || false; + this.eventSourceOverrideWindow = options.eventSourceOverrideWindow; + this.suppressWarnings = options.suppressWarnings || false; + if (this.logMessages) { + console.log("new WindowPostMessageProxy created with name: " + this.name + " receiving on window: " + this.receiveWindow.document.title); + } + // Initialize + this.handlers = []; + this.windowMessageHandler = function (event) { return _this.onMessageReceived(event); }; + this.start(); + } + // Static + WindowPostMessageProxy.defaultAddTrackingProperties = function (message, trackingProperties) { + message[WindowPostMessageProxy.messagePropertyName] = trackingProperties; + return message; + }; + WindowPostMessageProxy.defaultGetTrackingProperties = function (message) { + return message[WindowPostMessageProxy.messagePropertyName]; + }; + WindowPostMessageProxy.defaultIsErrorMessage = function (message) { + return !!message.error; + }; + /** + * Utility to create a deferred object. + */ + // TODO: Look to use RSVP library instead of doing this manually. + // From what I searched RSVP would work better because it has .finally and .deferred; however, it doesn't have Typings information. + WindowPostMessageProxy.createDeferred = function () { + var deferred = { + resolve: null, + reject: null, + promise: null + }; + var promise = new Promise(function (resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + deferred.promise = promise; + return deferred; + }; + /** + * Utility to generate random sequence of characters used as tracking id for promises. + */ + WindowPostMessageProxy.createRandomString = function () { + // window.msCrypto for IE + var cryptoObj = window.crypto || window.msCrypto; + var randomValueArray = new Uint32Array(1); + cryptoObj.getRandomValues(randomValueArray); + return randomValueArray[0].toString(36).substring(1); + }; + /** + * Adds handler. + * If the first handler whose test method returns true will handle the message and provide a response. + */ + WindowPostMessageProxy.prototype.addHandler = function (handler) { + this.handlers.push(handler); + }; + /** + * Removes handler. + * The reference must match the original object that was provided when adding the handler. + */ + WindowPostMessageProxy.prototype.removeHandler = function (handler) { + var handlerIndex = this.handlers.indexOf(handler); + if (handlerIndex === -1) { + throw new Error("You attempted to remove a handler but no matching handler was found."); + } + this.handlers.splice(handlerIndex, 1); + }; + /** + * Start listening to message events. + */ + WindowPostMessageProxy.prototype.start = function () { + this.receiveWindow.addEventListener('message', this.windowMessageHandler); + }; + /** + * Stops listening to message events. + */ + WindowPostMessageProxy.prototype.stop = function () { + this.receiveWindow.removeEventListener('message', this.windowMessageHandler); + }; + /** + * Post message to target window with tracking properties added and save deferred object referenced by tracking id. + */ + WindowPostMessageProxy.prototype.postMessage = function (targetWindow, message) { + // Add tracking properties to indicate message came from this proxy + var trackingProperties = { id: WindowPostMessageProxy.createRandomString() }; + this.addTrackingProperties(message, trackingProperties); + if (this.logMessages) { + console.log(this.name + " Posting message:"); + console.log(JSON.stringify(message, null, ' ')); + } + targetWindow.postMessage(message, "*"); + var deferred = WindowPostMessageProxy.createDeferred(); + this.pendingRequestPromises[trackingProperties.id] = deferred; + return deferred.promise; + }; + /** + * Send response message to target window. + * Response messages re-use tracking properties from a previous request message. + */ + WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) { + this.addTrackingProperties(message, trackingProperties); + if (this.logMessages) { + console.log(this.name + " Sending response:"); + console.log(JSON.stringify(message, null, ' ')); + } + targetWindow.postMessage(message, "*"); + }; + /** + * Message handler. + */ + WindowPostMessageProxy.prototype.onMessageReceived = function (event) { + var _this = this; + if (this.logMessages) { + console.log(this.name + " Received message:"); + console.log("type: " + event.type); + console.log(JSON.stringify(event.data, null, ' ')); + } + var sendingWindow = this.eventSourceOverrideWindow || event.source; + var message = event.data; + if (typeof message !== "object") { + if (!this.suppressWarnings) { + console.warn("Proxy(" + this.name + "): Received message that was not an object. Discarding message"); + } + return; + } + var trackingProperties; + try { + trackingProperties = this.getTrackingProperties(message); + } + catch (e) { + if (!this.suppressWarnings) { + console.warn("Proxy(" + this.name + "): Error occurred when attempting to get tracking properties from incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); + } + } + var deferred; + if (trackingProperties) { + deferred = this.pendingRequestPromises[trackingProperties.id]; + } + // If message does not have a known ID, treat it as a request + // Otherwise, treat message as response + if (!deferred) { + var handled = this.handlers.some(function (handler) { + var canMessageBeHandled = false; + try { + canMessageBeHandled = handler.test(message); + } + catch (e) { + if (!_this.suppressWarnings) { + console.warn("Proxy(" + _this.name + "): Error occurred when handler was testing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); + } + } + if (canMessageBeHandled) { + var responseMessagePromise = void 0; + try { + responseMessagePromise = Promise.resolve(handler.handle(message)); + } + catch (e) { + if (!_this.suppressWarnings) { + console.warn("Proxy(" + _this.name + "): Error occurred when handler was processing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); + } + responseMessagePromise = Promise.resolve(); + } + responseMessagePromise + .then(function (responseMessage) { + if (!responseMessage) { + var warningMessage = "Handler for message: " + JSON.stringify(message, null, ' ') + " did not return a response message. The default response message will be returned instead."; + if (!_this.suppressWarnings) { + console.warn("Proxy(" + _this.name + "): " + warningMessage); + } + responseMessage = { + warning: warningMessage + }; + } + _this.sendResponse(sendingWindow, responseMessage, trackingProperties); + }); + return true; + } + }); + /** + * TODO: Consider returning an error message if nothing handled the message. + * In the case of the Report receiving messages all of them should be handled, + * however, in the case of the SDK receiving messages it's likely it won't register handlers + * for all events. Perhaps make this an option at construction time. + */ + if (!handled && !this.suppressWarnings) { + console.warn("Proxy(" + this.name + ") did not handle message. Handlers: " + this.handlers.length + " Message: " + JSON.stringify(message, null, '') + "."); + } + } + else { + /** + * If error message reject promise, + * Otherwise, resolve promise + */ + var isErrorMessage = true; + try { + isErrorMessage = this.isErrorMessage(message); + } + catch (e) { + console.warn("Proxy(" + this.name + ") Error occurred when trying to determine if message is consider an error response. Message: ", JSON.stringify(message, null, ''), 'Error: ', e); + } + if (isErrorMessage) { + deferred.reject(message); + } + else { + deferred.resolve(message); + } + // TODO: Move to .finally clause up where promise is created for better maitenance like original proxy code. + delete this.pendingRequestPromises[trackingProperties.id]; + } + }; + WindowPostMessageProxy.messagePropertyName = "windowPostMessageProxy"; + return WindowPostMessageProxy; + }()); + exports.WindowPostMessageProxy = WindowPostMessageProxy; /***/ }) @@ -8270,23 +8312,23 @@ return /******/ (function(modules) { // webpackBootstrap /* 2 */ /***/ function(module, exports) { - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } /***/ }, /* 3 */ /***/ function(module, exports) { - module.exports = function() { throw new Error("define cannot be used indirect"); }; + module.exports = function() { throw new Error("define cannot be used indirect"); }; /***/ } diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 2391ed50..7063ae2e 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,9 +1,9 @@ /*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.1",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ -!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=M,e.validatePage=q,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=q,e.validatePage=M,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a2&&"[]"===n.slice(l-2)&&(d=!0,n=n.slice(0,l-2),r[n]||(r[n]=[])),i=o[1]?w(o[1]):""),d?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(a=t.indexOf("?"),a!==-1){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r} + */ + setDisplayName(displayName: string): Promise { + const page: models.IPage = { + name: this.name, + displayName, + }; + + return this.report.service.hpm.put(`/report/pages/${this.name}/name`, page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) + .catch(response => { + throw response.body; + }); + } + /** * Gets all the visuals on the page. * diff --git a/src/report.ts b/src/report.ts index caa3b976..d18fb96f 100644 --- a/src/report.ts +++ b/src/report.ts @@ -140,12 +140,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * ```javascript * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) - * report.deletePage("Sales145"); + * report.deletePage("ReportSection145"); * ``` * * @returns {Promise} */ - deletePage(pageName?: string): Promise { + deletePage(pageName: string): Promise { return this.service.hpm.delete(`/report/pages/${pageName}`, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow) .then(response => { return response.body; @@ -155,6 +155,31 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { }); } + /** + * Rename a page from a report + * + * ```javascript + * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) + * report.renamePage("ReportSection145", "Sales"); + * ``` + * + * @returns {Promise} + */ + renamePage(pageName: string, displayName: string): Promise { + const page: models.IPage = { + name: pageName, + displayName, + }; + + return this.service.hpm.put(`/report/pages/${pageName}/name`, page, { uid: this.config.uniqueId }, this.iframe.contentWindow) + .then(response => { + return response.body; + }) + .catch(response => { + throw response.body; + }); + } + /** * Gets filters that are applied at the report level. * diff --git a/test/test.spec.ts b/test/test.spec.ts index 0ad7df85..4a9e8fba 100644 --- a/test/test.spec.ts +++ b/test/test.spec.ts @@ -3278,7 +3278,25 @@ describe('SDK-to-HPM', function () { expect(spyHpm.post).toHaveBeenCalledWith('/report/addPage', expectedRequest, expectedHeaders, iframe.contentWindow); }); - it('report.deletePage() sends POST /report/addPage with displayName', function () { + it('report.renamePage() sends PUT /report/pages/{name} with displayName', function () { + // Arrange + const name = "testName"; + const displayName = "newName"; + const expectedHeaders = { uid: uniqueId }; + const expectedRequest = { + name, + displayName + }; + + spyHpm.put.and.returnValue(Promise.resolve(null)); + + // Act + report.renamePage(name, displayName); + + expect(spyHpm.put).toHaveBeenCalledWith(`/report/pages/${name}/name`, expectedRequest, expectedHeaders, iframe.contentWindow); + }); + + it('report.deletePage() sends DELETE /report/pages/{name}', function () { // Arrange const name = "testName"; const expectedHeaders = { uid: uniqueId }; @@ -4064,6 +4082,27 @@ describe('SDK-to-HPM', function () { }); }); + describe('setDisplayName', function () { + it('page.setDisplayName(displayName) sends PUT /report/pages/{pageName}/name', function () { + // Arrange + const displayName = "newName"; + const testData = { + page: { + name: page1.name, + displayName, + } + }; + + spyHpm.put.and.returnValue(Promise.resolve(null)); + + // Act + page1.setDisplayName(displayName); + + // Assert + expect(spyHpm.put).toHaveBeenCalledWith(`/report/pages/${page1.name}/name`, testData.page, { uid: uniqueId }, iframe.contentWindow); + }); + }); + describe('visual', function () { describe('filters', function () { it('visual.getFilters() sends GET /report/pages/xyz/visuals/uvw/filters', function () { From a4c83015183beba7cedea5f0c8c9ffa66a149f39 Mon Sep 17 00:00:00 2001 From: Shahak Yosef Date: Wed, 18 Nov 2020 10:26:33 +0000 Subject: [PATCH 08/23] Merged PR 128410: Release version 2.15.2 Updating the minor version because it is only intended to be published internally for product insights to test rename page in DXT. When the change reaches PROD we will release version 2.16.0 together with MAQ changes. --- dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 4 ++-- dist/powerbi.min.js | 4 ++-- package.json | 2 +- src/config.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 77f7970d..7ea35f93 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index 990f29dd..45af69f3 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -1303,7 +1303,7 @@ return /******/ (function(modules) { // webpackBootstrap /** @ignore */ /** */ var config = { - version: '2.15.1', + version: '2.15.2', type: 'js' }; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 7063ae2e..0637ccbf 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,5 +1,5 @@ -/*! powerbi-client v2.15.1 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.1",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.2",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ !function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=q,e.validatePage=M,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a Date: Thu, 19 Nov 2020 09:05:02 +0000 Subject: [PATCH 09/23] Merged PR 128710: Hide unnecessary function Page is a weird function that creates a Page object with just the name, there is no guarantee that the Page actually exists. We don't want it to appear in the documentation as it can be confusing. --- dist/powerbi-client.d.ts | 6 +----- dist/powerbi.js | 6 +----- src/report.ts | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 7ea35f93..72e498e8 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1076,15 +1076,11 @@ declare module "report" { * * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. * - * ```javascript - * const page = report.page('ReportSection1'); - * page.setActive(); - * ``` - * * @param {string} name * @param {string} [displayName] * @param {boolean} [isActive] * @returns {Page} + * @hidden */ page(name: string, displayName?: string, isActive?: boolean, visibility?: models.SectionVisibility): Page; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index 45af69f3..c2a7ab51 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -5565,15 +5565,11 @@ return /******/ (function(modules) { // webpackBootstrap * * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. * - * ```javascript - * const page = report.page('ReportSection1'); - * page.setActive(); - * ``` - * * @param {string} name * @param {string} [displayName] * @param {boolean} [isActive] * @returns {Page} + * @hidden */ Report.prototype.page = function (name, displayName, isActive, visibility) { return new page_1.Page(this, name, displayName, isActive, visibility); diff --git a/src/report.ts b/src/report.ts index d18fb96f..75405a04 100644 --- a/src/report.ts +++ b/src/report.ts @@ -258,15 +258,11 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. * - * ```javascript - * const page = report.page('ReportSection1'); - * page.setActive(); - * ``` - * * @param {string} name * @param {string} [displayName] * @param {boolean} [isActive] * @returns {Page} + * @hidden */ page(name: string, displayName?: string, isActive?: boolean, visibility?: models.SectionVisibility): Page { return new Page(this, name, displayName, isActive, visibility); From 9d19361a7faa24733c686be6caeea60df08c784f Mon Sep 17 00:00:00 2001 From: Anant Singh Date: Thu, 3 Dec 2020 13:34:18 +0000 Subject: [PATCH 10/23] Merged PR 131439: Make master up to date with beta We want to deploy to NPM as beta version --- dist/powerbi-client.d.ts | 114 +- dist/powerbi.js | 3143 ++++++++++++++++++++------------------ dist/powerbi.min.js | 12 +- package.json | 2 +- src/create.ts | 4 +- src/dashboard.ts | 7 +- src/embed.ts | 95 +- src/powerbi-client.ts | 3 + src/report.ts | 12 +- src/service.ts | 18 +- src/tile.ts | 8 +- 11 files changed, 1732 insertions(+), 1686 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 72e498e8..0b4b35cd 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -127,82 +127,17 @@ declare module "embed" { msRequestFullscreen: Function; } } - /** - * Prepare configuration for Power BI embed components. - * - * @export - * @interface IBootstrapEmbedConfiguration - */ - export interface IBootstrapEmbedConfiguration { - hostname?: string; - embedUrl?: string; - settings?: ISettings; - uniqueId?: string; - type?: string; - groupId?: string; - bootstrapped?: boolean; - } - /** - * Base Configuration settings for Power BI embed components - * - * @export - * @interface IEmbedConfigurationBase - * @extends IBootstrapEmbedConfiguration - */ - export interface IEmbedConfigurationBase extends IBootstrapEmbedConfiguration { - accessToken?: string; - tokenType?: models.TokenType; - } - /** - * Configuration settings for Power BI embed components - * - * @export - * @interface IEmbedConfiguration - */ - export interface IEmbedConfiguration extends IEmbedConfigurationBase { - id?: string; - settings?: IEmbedSettings; - pageName?: string; - filters?: models.IFilter[]; - pageView?: models.PageView; - datasetId?: string; - permissions?: models.Permissions; - viewMode?: models.ViewMode; - action?: string; - dashboardId?: string; - height?: number; - width?: number; - theme?: models.IReportTheme; - slicers?: models.ISlicer[]; - bookmark?: models.IApplyBookmarkRequest; - datasetBinding?: models.IDatasetBinding; - contrastMode?: models.ContrastMode; - } - export interface IVisualEmbedConfiguration extends IEmbedConfiguration { - visualName: string; - } - /** - * Configuration settings for Power BI Q&A embed component - * - * @export - * @interface IEmbedConfiguration - */ - export interface IQnaEmbedConfiguration extends IEmbedConfigurationBase { - datasetIds: string[]; - question?: string; - viewMode?: models.QnaMode; - } - export interface ILocaleSettings { - language?: string; - formatLocale?: string; - } - export interface ISettings { - localeSettings?: ILocaleSettings; - } - export interface IEmbedSettings extends models.ISettings, ISettings { - } - export interface IQnaSettings extends models.IQnaSettings, ISettings { - } + export type IBootstrapEmbedConfiguration = models.IBootstrapEmbedConfiguration; + export type IEmbedConfigurationBase = models.IEmbedConfigurationBase; + export type IEmbedConfiguration = models.IEmbedConfiguration; + export type IVisualEmbedConfiguration = models.IVisualEmbedConfiguration; + export type IReportEmbedConfiguration = models.IReportEmbedConfiguration; + export type IDashboardEmbedConfiguration = models.IDashboardEmbedConfiguration; + export type ITileEmbedConfiguration = models.ITileEmbedConfiguration; + export type IQnaEmbedConfiguration = models.IQnaEmbedConfiguration; + export type ILocaleSettings = models.ILocaleSettings; + export type IQnaSettings = models.IQnaSettings; + export type IEmbedSettings = models.ISettings; /** @hidden */ export interface IInternalEventHandler { test(event: service.IEvent): boolean; @@ -467,7 +402,7 @@ declare module "embed" { * Adds locale parameters to embedUrl * * @private - * @param {IEmbedConfiguration} config + * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config * @hidden */ private addLocaleToEmbedUrl(config); @@ -929,7 +864,7 @@ declare module "report" { import * as models from 'powerbi-models'; import { IFilterable } from "ifilterable"; import { Page } from "page"; - import { IReportLoadConfiguration } from 'powerbi-models'; + import { IReportLoadConfiguration, IReportEmbedConfiguration } from 'powerbi-models'; import { BookmarksManager } from "bookmarksManager"; /** * A Report node within a report hierarchy @@ -940,7 +875,7 @@ declare module "report" { export interface IReportNode { iframe: HTMLIFrameElement; service: service.IService; - config: embed.IEmbedConfiguration; + config: embed.IEmbedConfiguration | IReportEmbedConfiguration; } /** * The Power BI Report embed component @@ -1000,7 +935,7 @@ declare module "report" { * * @returns {Promise} */ - render(config?: IReportLoadConfiguration): Promise; + render(config?: IReportLoadConfiguration | embed.IReportEmbedConfiguration): Promise; /** * Add an empty page to the report * @@ -1254,7 +1189,7 @@ declare module "create" { * @extends {embed.Embed} */ export class Create extends embed.Embed { - constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration, phasedRender?: boolean, isBootstrap?: boolean); + constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration | models.IReportCreateConfiguration, phasedRender?: boolean, isBootstrap?: boolean); /** * Gets the dataset ID from the first available location: createConfig or embed url. * @@ -1323,7 +1258,6 @@ declare module "dashboard" { * @class Dashboard * @extends {embed.Embed} * @implements {IDashboardNode} - * @implements {IFilterable} */ export class Dashboard extends embed.Embed implements IDashboardNode { /** @hidden */ @@ -1595,6 +1529,7 @@ declare module "service" { import * as wpmp from 'window-post-message-proxy'; import * as hpm from 'http-post-message'; import * as router from 'powerbi-router'; + import * as models from 'powerbi-models'; export interface IEvent { type: string; id: string; @@ -1647,6 +1582,7 @@ declare module "service" { export interface IService { hpm: hpm.HttpPostMessage; } + export type IComponentEmbedConfiguration = embed.IReportEmbedConfiguration | embed.IDashboardEmbedConfiguration | embed.ITileEmbedConfiguration | embed.IVisualEmbedConfiguration | embed.IQnaEmbedConfiguration; /** * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application * @@ -1700,7 +1636,7 @@ declare module "service" { * @param {embed.IEmbedConfiguration} [config={}] * @returns {embed.Embed} */ - createReport(element: HTMLElement, config: embed.IEmbedConfiguration): embed.Embed; + createReport(element: HTMLElement, config: embed.IEmbedConfiguration | models.IReportCreateConfiguration): embed.Embed; /** * TODO: Add a description here * @@ -1719,7 +1655,7 @@ declare module "service" { * @param {embed.IEmbedConfigurationBase} [config={}] * @returns {embed.Embed} */ - embed(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed; + embed(element: HTMLElement, config?: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase): embed.Embed; /** * Given a configuration based on an HTML element, * if the component has already been created and attached to the element, reuses the component instance and existing iframe, @@ -1730,16 +1666,16 @@ declare module "service" { * @param {embed.IEmbedConfigurationBase} [config={}] * @returns {embed.Embed} */ - load(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed; + load(element: HTMLElement, config?: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase): embed.Embed; /** * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. * * @param {HTMLElement} element * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. */ - bootstrap(element: HTMLElement, config: embed.IBootstrapEmbedConfiguration): embed.Embed; + bootstrap(element: HTMLElement, config: IComponentEmbedConfiguration | embed.IBootstrapEmbedConfiguration): embed.Embed; /** @hidden */ - embedInternal(element: HTMLElement, config?: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed; + embedInternal(element: HTMLElement, config?: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed; /** @hidden */ getNumberOfComponents(): number; /** @hidden */ @@ -1828,7 +1764,7 @@ declare module "service" { * @param {embed.IEmbedConfigurationBase} [config={}] * @param {HTMLElement} [element=undefined] */ - preload(config: embed.IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement; + preload(config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement; } } declare module "bookmarksManager" { @@ -1946,7 +1882,7 @@ declare module "powerbi-client" { export { Report } from "report"; export { Dashboard } from "dashboard"; export { Tile } from "tile"; - export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings, IQnaSettings } from "embed"; + export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, IReportEmbedConfiguration, IDashboardEmbedConfiguration, ITileEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings, IQnaSettings } from "embed"; export { Page } from "page"; export { Qna } from "qna"; export { Visual } from "visual"; diff --git a/dist/powerbi.js b/dist/powerbi.js index c2a7ab51..5d6b6979 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -850,7 +850,7 @@ return /******/ (function(modules) { // webpackBootstrap * Adds locale parameters to embedUrl * * @private - * @param {IEmbedConfiguration} config + * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config * @hidden */ Embed.prototype.addLocaleToEmbedUrl = function (config) { @@ -1314,7 +1314,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 5 */ /***/ (function(module, exports, __webpack_require__) { - /*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ + /*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); @@ -1429,8 +1429,8 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = exports.Validators = void 0; - exports.Validators = __webpack_require__(1).Validators; + exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0; + var validator_1 = __webpack_require__(1); var TraceType; (function (TraceType) { TraceType[TraceType["Information"] = 0] = "Information"; @@ -1566,7 +1566,6 @@ return /******/ (function(modules) { // webpackBootstrap } return filter; }; - ; return Filter; }()); exports.Filter = Filter; @@ -1723,9 +1722,10 @@ return /******/ (function(modules) { // webpackBootstrap if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); } - for (var i = 0; i < _this.keyValues.length; i++) { - if (_this.keyValues[i]) { - var lengthOfArray = _this.keyValues[i].length; + for (var _i = 0, _a = _this.keyValues; _i < _a.length; _i++) { + var keyValue = _a[_i]; + if (keyValue) { + var lengthOfArray = keyValue.length; if (lengthOfArray !== numberOfKeys) { throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); } @@ -1916,7 +1916,6 @@ return /******/ (function(modules) { // webpackBootstrap $schema: this.$schema }; }; - ; return Selector; }()); exports.Selector = Selector; @@ -2008,6 +2007,22 @@ return /******/ (function(modules) { // webpackBootstrap VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; })(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); + function isFlatMenuExtension(menuExtension) { + return menuExtension && !isGroupedMenuExtension(menuExtension); + } + exports.isFlatMenuExtension = isFlatMenuExtension; + function isGroupedMenuExtension(menuExtension) { + return menuExtension && !!menuExtension.groupName; + } + exports.isGroupedMenuExtension = isGroupedMenuExtension; + function isIExtensions(extensions) { + return extensions && !isIExtensionArray(extensions); + } + exports.isIExtensions = isIExtensions; + function isIExtensionArray(extensions) { + return Array.isArray(extensions); + } + exports.isIExtensionArray = isIExtensionArray; function normalizeError(error) { var message = error.message; if (!message) { @@ -2018,167 +2033,172 @@ return /******/ (function(modules) { // webpackBootstrap }; } function validateVisualSelector(input) { - var errors = exports.Validators.visualSelectorValidator.validate(input); + var errors = validator_1.Validators.visualSelectorValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateVisualSelector = validateVisualSelector; function validateSlicer(input) { - var errors = exports.Validators.slicerValidator.validate(input); + var errors = validator_1.Validators.slicerValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateSlicer = validateSlicer; function validateSlicerState(input) { - var errors = exports.Validators.slicerStateValidator.validate(input); + var errors = validator_1.Validators.slicerStateValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateSlicerState = validateSlicerState; function validatePlayBookmarkRequest(input) { - var errors = exports.Validators.playBookmarkRequestValidator.validate(input); + var errors = validator_1.Validators.playBookmarkRequestValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; function validateAddBookmarkRequest(input) { - var errors = exports.Validators.addBookmarkRequestValidator.validate(input); + var errors = validator_1.Validators.addBookmarkRequestValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateAddBookmarkRequest = validateAddBookmarkRequest; function validateApplyBookmarkByNameRequest(input) { - var errors = exports.Validators.applyBookmarkByNameRequestValidator.validate(input); + var errors = validator_1.Validators.applyBookmarkByNameRequestValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; function validateApplyBookmarkStateRequest(input) { - var errors = exports.Validators.applyBookmarkStateRequestValidator.validate(input); + var errors = validator_1.Validators.applyBookmarkStateRequestValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; function validateCaptureBookmarkRequest(input) { - var errors = exports.Validators.captureBookmarkRequestValidator.validate(input); + var errors = validator_1.Validators.captureBookmarkRequestValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; function validateSettings(input) { - var errors = exports.Validators.settingsValidator.validate(input); + var errors = validator_1.Validators.settingsValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateSettings = validateSettings; function validatePanes(input) { - var errors = exports.Validators.reportPanesValidator.validate(input); + var errors = validator_1.Validators.reportPanesValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validatePanes = validatePanes; function validateBookmarksPane(input) { - var errors = exports.Validators.bookmarksPaneValidator.validate(input); + var errors = validator_1.Validators.bookmarksPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateBookmarksPane = validateBookmarksPane; function validateFiltersPane(input) { - var errors = exports.Validators.filtersPanesValidator.validate(input); + var errors = validator_1.Validators.filtersPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateFiltersPane = validateFiltersPane; function validateFieldsPane(input) { - var errors = exports.Validators.fieldsPanesValidator.validate(input); + var errors = validator_1.Validators.fieldsPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateFieldsPane = validateFieldsPane; function validatePageNavigationPane(input) { - var errors = exports.Validators.pageNavigationPaneValidator.validate(input); + var errors = validator_1.Validators.pageNavigationPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validatePageNavigationPane = validatePageNavigationPane; function validateSelectionPane(input) { - var errors = exports.Validators.selectionPaneValidator.validate(input); + var errors = validator_1.Validators.selectionPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateSelectionPane = validateSelectionPane; function validateSyncSlicersPane(input) { - var errors = exports.Validators.syncSlicersPaneValidator.validate(input); + var errors = validator_1.Validators.syncSlicersPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateSyncSlicersPane = validateSyncSlicersPane; function validateVisualizationsPane(input) { - var errors = exports.Validators.visualizationsPanesValidator.validate(input); + var errors = validator_1.Validators.visualizationsPaneValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateVisualizationsPane = validateVisualizationsPane; function validateCustomPageSize(input) { - var errors = exports.Validators.customPageSizeValidator.validate(input); + var errors = validator_1.Validators.customPageSizeValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateCustomPageSize = validateCustomPageSize; function validateExtension(input) { - var errors = exports.Validators.extensionValidator.validate(input); + var errors = validator_1.Validators.extensionValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateExtension = validateExtension; + function validateMenuGroupExtension(input) { + var errors = validator_1.Validators.menuGroupExtensionValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; + } + exports.validateMenuGroupExtension = validateMenuGroupExtension; function validateReportLoad(input) { - var errors = exports.Validators.reportLoadValidator.validate(input); + var errors = validator_1.Validators.reportLoadValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateReportLoad = validateReportLoad; function validateCreateReport(input) { - var errors = exports.Validators.reportCreateValidator.validate(input); + var errors = validator_1.Validators.reportCreateValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateCreateReport = validateCreateReport; function validateDashboardLoad(input) { - var errors = exports.Validators.dashboardLoadValidator.validate(input); + var errors = validator_1.Validators.dashboardLoadValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateDashboardLoad = validateDashboardLoad; function validateTileLoad(input) { - var errors = exports.Validators.tileLoadValidator.validate(input); + var errors = validator_1.Validators.tileLoadValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateTileLoad = validateTileLoad; function validatePage(input) { - var errors = exports.Validators.pageValidator.validate(input); + var errors = validator_1.Validators.pageValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validatePage = validatePage; function validateFilter(input) { - var errors = exports.Validators.filtersValidator.validate(input); + var errors = validator_1.Validators.filtersValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateFilter = validateFilter; function validateSaveAsParameters(input) { - var errors = exports.Validators.saveAsParametersValidator.validate(input); + var errors = validator_1.Validators.saveAsParametersValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateSaveAsParameters = validateSaveAsParameters; function validateLoadQnaConfiguration(input) { - var errors = exports.Validators.loadQnaValidator.validate(input); + var errors = validator_1.Validators.loadQnaValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; function validateQnaInterpretInputData(input) { - var errors = exports.Validators.qnaInterpretInputDataValidator.validate(input); + var errors = validator_1.Validators.qnaInterpretInputDataValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateQnaInterpretInputData = validateQnaInterpretInputData; function validateExportDataRequest(input) { - var errors = exports.Validators.exportDataRequestValidator.validate(input); + var errors = validator_1.Validators.exportDataRequestValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateExportDataRequest = validateExportDataRequest; function validateVisualHeader(input) { - var errors = exports.Validators.visualHeaderValidator.validate(input); + var errors = validator_1.Validators.visualHeaderValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateVisualHeader = validateVisualHeader; function validateVisualSettings(input) { - var errors = exports.Validators.visualSettingsValidator.validate(input); + var errors = validator_1.Validators.visualSettingsValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateVisualSettings = validateVisualSettings; function validateCommandsSettings(input) { - var errors = exports.Validators.commandsSettingsValidator.validate(input); + var errors = validator_1.Validators.commandsSettingsValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateCommandsSettings = validateCommandsSettings; function validateCustomTheme(input) { - var errors = exports.Validators.customThemeValidator.validate(input); + var errors = validator_1.Validators.customThemeValidator.validate(input); return errors ? errors.map(normalizeError) : undefined; } exports.validateCustomTheme = validateCustomTheme; @@ -2190,31 +2210,32 @@ return /******/ (function(modules) { // webpackBootstrap Object.defineProperty(exports, "__esModule", { value: true }); exports.Validators = void 0; - var typeValidator_1 = __webpack_require__(2); - var extensionsValidator_1 = __webpack_require__(3); - var settingsValidator_1 = __webpack_require__(5); - var bookmarkValidator_1 = __webpack_require__(6); - var filtersValidator_1 = __webpack_require__(7); - var fieldRequiredValidator_1 = __webpack_require__(8); - var anyOfValidator_1 = __webpack_require__(9); - var reportLoadValidator_1 = __webpack_require__(10); - var reportCreateValidator_1 = __webpack_require__(11); - var dashboardLoadValidator_1 = __webpack_require__(12); - var tileLoadValidator_1 = __webpack_require__(13); + var barsValidator_1 = __webpack_require__(2); + var bookmarkValidator_1 = __webpack_require__(5); + var commandsSettingsValidator_1 = __webpack_require__(6); + var customThemeValidator_1 = __webpack_require__(7); + var dashboardLoadValidator_1 = __webpack_require__(8); + var datasetBindingValidator_1 = __webpack_require__(9); + var exportDataValidator_1 = __webpack_require__(10); + var extensionsValidator_1 = __webpack_require__(11); + var filtersValidator_1 = __webpack_require__(12); + var layoutValidator_1 = __webpack_require__(13); var pageValidator_1 = __webpack_require__(14); - var qnaValidator_1 = __webpack_require__(15); - var saveAsParametersValidator_1 = __webpack_require__(16); - var mapValidator_1 = __webpack_require__(17); - var layoutValidator_1 = __webpack_require__(18); - var exportDataValidator_1 = __webpack_require__(19); + var panesValidator_1 = __webpack_require__(15); + var qnaValidator_1 = __webpack_require__(16); + var reportCreateValidator_1 = __webpack_require__(17); + var reportLoadValidator_1 = __webpack_require__(18); + var saveAsParametersValidator_1 = __webpack_require__(19); var selectorsValidator_1 = __webpack_require__(20); - var slicersValidator_1 = __webpack_require__(21); - var visualSettingsValidator_1 = __webpack_require__(22); - var commandsSettingsValidator_1 = __webpack_require__(23); - var customThemeValidator_1 = __webpack_require__(24); - var datasetBindingValidator_1 = __webpack_require__(25); - var panesValidator_1 = __webpack_require__(26); - var barsValidator_1 = __webpack_require__(27); + var settingsValidator_1 = __webpack_require__(21); + var slicersValidator_1 = __webpack_require__(22); + var tileLoadValidator_1 = __webpack_require__(23); + var visualSettingsValidator_1 = __webpack_require__(24); + var anyOfValidator_1 = __webpack_require__(25); + var fieldForbiddenValidator_1 = __webpack_require__(26); + var fieldRequiredValidator_1 = __webpack_require__(27); + var mapValidator_1 = __webpack_require__(28); + var typeValidator_1 = __webpack_require__(4); exports.Validators = { addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), @@ -2236,6 +2257,7 @@ return /******/ (function(modules) { // webpackBootstrap captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + commandExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.CommandExtensionValidator()]), commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), @@ -2251,8 +2273,10 @@ return /******/ (function(modules) { // webpackBootstrap displayStateValidator: new layoutValidator_1.DisplayStateValidator(), exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), + extensionsValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), new extensionsValidator_1.ExtensionsValidator()]), extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), extensionValidator: new extensionsValidator_1.ExtensionValidator(), + fieldForbiddenValidator: new fieldForbiddenValidator_1.FieldForbiddenValidator(), fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), @@ -2268,7 +2292,9 @@ return /******/ (function(modules) { // webpackBootstrap includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), - menuExtensionValidator: new extensionsValidator_1.MenuExtensionValidator(), + menuExtensionValidator: new anyOfValidator_1.AnyOfValidator([new extensionsValidator_1.FlatMenuExtensionValidator(), new extensionsValidator_1.GroupedMenuExtensionValidator()]), + menuGroupExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.MenuGroupExtensionValidator()]), + menuGroupExtensionValidator: new extensionsValidator_1.MenuGroupExtensionValidator(), menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), @@ -2328,6 +2354,112 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 2 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ActionBarValidator = exports.ReportBarsValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var ReportBarsValidator = /** @class */ (function (_super) { + __extends(ReportBarsValidator, _super); + function ReportBarsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportBarsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "actionBar", + validators: [validator_1.Validators.actionBarValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportBarsValidator; + }(typeValidator_1.ObjectValidator)); + exports.ReportBarsValidator = ReportBarsValidator; + var ActionBarValidator = /** @class */ (function (_super) { + __extends(ActionBarValidator, _super); + function ActionBarValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ActionBarValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ActionBarValidator; + }(typeValidator_1.ObjectValidator)); + exports.ActionBarValidator = ActionBarValidator; + + + /***/ }), + /* 3 */ + /***/ (function(module, exports) { + + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MultipleFieldsValidator = void 0; + var MultipleFieldsValidator = /** @class */ (function () { + function MultipleFieldsValidator(fieldValidatorsPairs) { + this.fieldValidatorsPairs = fieldValidatorsPairs; + } + MultipleFieldsValidator.prototype.validate = function (input, path, field) { + if (!this.fieldValidatorsPairs) { + return null; + } + var fieldsPath = path ? path + "." + field : field; + for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { + var fieldValidators = _a[_i]; + for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { + var validator = _c[_b]; + var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); + if (errors) { + return errors; + } + } + } + return null; + }; + return MultipleFieldsValidator; + }()); + exports.MultipleFieldsValidator = MultipleFieldsValidator; + + + /***/ }), + /* 4 */ /***/ (function(module, exports) { var __extends = (this && this.__extends) || (function () { @@ -2556,7 +2688,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), - /* 3 */ + /* 5 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -2573,16 +2705,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.MenuExtensionValidator = void 0; + exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var MenuExtensionValidator = /** @class */ (function (_super) { - __extends(MenuExtensionValidator, _super); - function MenuExtensionValidator() { + var PlayBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(PlayBookmarkRequestValidator, _super); + function PlayBookmarkRequestValidator() { return _super !== null && _super.apply(this, arguments) || this; } - MenuExtensionValidator.prototype.validate = function (input, path, field) { + PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2592,30 +2724,55 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "title", + field: "playMode", + validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PlayBookmarkRequestValidator; + }(typeValidator_1.ObjectValidator)); + exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; + var AddBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(AddBookmarkRequestValidator, _super); + function AddBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", validators: [validator_1.Validators.stringValidator] }, { - field: "icon", + field: "displayName", validators: [validator_1.Validators.stringValidator] }, { - field: "menuLocation", - validators: [validator_1.Validators.menuLocationValidator] - } + field: "apply", + validators: [validator_1.Validators.booleanValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return MenuExtensionValidator; + return AddBookmarkRequestValidator; }(typeValidator_1.ObjectValidator)); - exports.MenuExtensionValidator = MenuExtensionValidator; - var ExtensionPointsValidator = /** @class */ (function (_super) { - __extends(ExtensionPointsValidator, _super); - function ExtensionPointsValidator() { + exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; + var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkByNameRequestValidator, _super); + function ApplyBookmarkByNameRequestValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ExtensionPointsValidator.prototype.validate = function (input, path, field) { + ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2625,26 +2782,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "visualContextMenu", - validators: [validator_1.Validators.menuExtensionValidator] - }, - { - field: "visualOptionsMenu", - validators: [validator_1.Validators.menuExtensionValidator] + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ExtensionPointsValidator; + return ApplyBookmarkByNameRequestValidator; }(typeValidator_1.ObjectValidator)); - exports.ExtensionPointsValidator = ExtensionPointsValidator; - var ExtensionItemValidator = /** @class */ (function (_super) { - __extends(ExtensionItemValidator, _super); - function ExtensionItemValidator() { + exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; + var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkStateRequestValidator, _super); + function ApplyBookmarkStateRequestValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ExtensionItemValidator.prototype.validate = function (input, path, field) { + ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2654,26 +2807,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "name", + field: "state", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "extend", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ExtensionItemValidator; + return ApplyBookmarkStateRequestValidator; }(typeValidator_1.ObjectValidator)); - exports.ExtensionItemValidator = ExtensionItemValidator; - var CommandExtensionValidator = /** @class */ (function (_super) { - __extends(CommandExtensionValidator, _super); - function CommandExtensionValidator() { + exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; + var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkOptionsValidator, _super); + function CaptureBookmarkOptionsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - CommandExtensionValidator.prototype.validate = function (input, path, field) { + CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2683,30 +2832,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "title", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.commandExtensionSelectorValidator] - }, + field: "personalizeVisuals", + validators: [validator_1.Validators.booleanValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return CommandExtensionValidator; - }(ExtensionItemValidator)); - exports.CommandExtensionValidator = CommandExtensionValidator; - var ExtensionValidator = /** @class */ (function (_super) { - __extends(ExtensionValidator, _super); - function ExtensionValidator() { + return CaptureBookmarkOptionsValidator; + }(typeValidator_1.ObjectValidator)); + exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; + var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkRequestValidator, _super); + function CaptureBookmarkRequestValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ExtensionValidator.prototype.validate = function (input, path, field) { + CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2716,78 +2857,46 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "command", - validators: [validator_1.Validators.commandExtensionValidator] + field: "options", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ExtensionValidator; + return CaptureBookmarkRequestValidator; }(typeValidator_1.ObjectValidator)); - exports.ExtensionValidator = ExtensionValidator; + exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; /***/ }), - /* 4 */ - /***/ (function(module, exports) { + /* 6 */ + /***/ (function(module, exports, __webpack_require__) { + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.MultipleFieldsValidator = void 0; - var MultipleFieldsValidator = /** @class */ (function () { - function MultipleFieldsValidator(fieldValidatorsPairs) { - this.fieldValidatorsPairs = fieldValidatorsPairs; - } - MultipleFieldsValidator.prototype.validate = function (input, path, field) { - if (!this.fieldValidatorsPairs) { - return null; - } - var fieldsPath = path ? path + "." + field : field; - for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { - var fieldValidators = _a[_i]; - for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { - var validator = _c[_b]; - var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); - if (errors) { - return errors; - } - } - } - return null; - }; - return MultipleFieldsValidator; - }()); - exports.MultipleFieldsValidator = MultipleFieldsValidator; - - - /***/ }), - /* 5 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SettingsValidator = void 0; + exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var SettingsValidator = /** @class */ (function (_super) { - __extends(SettingsValidator, _super); - function SettingsValidator() { + var CommandsSettingsValidator = /** @class */ (function (_super) { + __extends(CommandsSettingsValidator, _super); + function CommandsSettingsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SettingsValidator.prototype.validate = function (input, path, field) { + CommandsSettingsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2797,84 +2906,89 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "navContentPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "bookmarksPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "useCustomSaveAsDialog", - validators: [validator_1.Validators.booleanValidator] + field: "copy", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "extensions", - validators: [validator_1.Validators.extensionArrayValidator] + field: "drill", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "layoutType", - validators: [validator_1.Validators.layoutTypeValidator] + field: "drillthrough", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "customLayout", - validators: [validator_1.Validators.customLayoutValidator] + field: "expandCollapse", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "background", - validators: [validator_1.Validators.backgroundValidator] + field: "exportData", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "visualSettings", - validators: [validator_1.Validators.visualSettingsValidator] + field: "includeExclude", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] + field: "removeVisual", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "commands", - validators: [validator_1.Validators.commandsSettingsArrayValidator] + field: "search", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "hyperlinkClickBehavior", - validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] + field: "seeData", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "bars", - validators: [validator_1.Validators.reportBarsValidator] + field: "sort", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, { - field: "panes", - validators: [validator_1.Validators.reportPanesValidator] + field: "spotlight", + validators: [validator_1.Validators.singleCommandSettingsValidator] }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandsSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.CommandsSettingsValidator = CommandsSettingsValidator; + var SingleCommandSettingsValidator = /** @class */ (function (_super) { + __extends(SingleCommandSettingsValidator, _super); + function SingleCommandSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ { - field: "personalBookmarksEnabled", - validators: [validator_1.Validators.booleanValidator] + field: "displayOption", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] }, { - field: "persistentFiltersEnabled", - validators: [validator_1.Validators.booleanValidator] + field: "selector", + validators: [validator_1.Validators.visualCommandSelectorValidator] }, - { - field: "visualRenderedEvents", - validators: [validator_1.Validators.booleanValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SettingsValidator; + return SingleCommandSettingsValidator; }(typeValidator_1.ObjectValidator)); - exports.SettingsValidator = SettingsValidator; + exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; /***/ }), - /* 6 */ + /* 7 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -2891,16 +3005,15 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var PlayBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(PlayBookmarkRequestValidator, _super); - function PlayBookmarkRequestValidator() { + exports.CustomThemeValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var CustomThemeValidator = /** @class */ (function (_super) { + __extends(CustomThemeValidator, _super); + function CustomThemeValidator() { return _super !== null && _super.apply(this, arguments) || this; } - PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { + CustomThemeValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2910,22 +3023,46 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "playMode", - validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] + field: "themeJson", + validators: [new typeValidator_1.ObjectValidator()] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return PlayBookmarkRequestValidator; + return CustomThemeValidator; }(typeValidator_1.ObjectValidator)); - exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; - var AddBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(AddBookmarkRequestValidator, _super); - function AddBookmarkRequestValidator() { + exports.CustomThemeValidator = CustomThemeValidator; + + + /***/ }), + /* 8 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DashboardLoadValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var DashboardLoadValidator = /** @class */ (function (_super) { + __extends(DashboardLoadValidator, _super); + function DashboardLoadValidator() { return _super !== null && _super.apply(this, arguments) || this; } - AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { + DashboardLoadValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2935,30 +3072,66 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "state", - validators: [validator_1.Validators.stringValidator] + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "displayName", + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", validators: [validator_1.Validators.stringValidator] }, { - field: "apply", - validators: [validator_1.Validators.booleanValidator] + field: "pageView", + validators: [validator_1.Validators.pageViewFieldValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return AddBookmarkRequestValidator; + return DashboardLoadValidator; }(typeValidator_1.ObjectValidator)); - exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; - var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkByNameRequestValidator, _super); - function ApplyBookmarkByNameRequestValidator() { + exports.DashboardLoadValidator = DashboardLoadValidator; + + + /***/ }), + /* 9 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DatasetBindingValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var DatasetBindingValidator = /** @class */ (function (_super) { + __extends(DatasetBindingValidator, _super); + function DatasetBindingValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { + DatasetBindingValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -2968,72 +3141,45 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "name", + field: "datasetId", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ApplyBookmarkByNameRequestValidator; + return DatasetBindingValidator; }(typeValidator_1.ObjectValidator)); - exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; - var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkStateRequestValidator, _super); - function ApplyBookmarkStateRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + exports.DatasetBindingValidator = DatasetBindingValidator; + + + /***/ }), + /* 10 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); }; - return ApplyBookmarkStateRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; - var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkOptionsValidator, _super); - function CaptureBookmarkOptionsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "personalizeVisuals", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; - return CaptureBookmarkOptionsValidator; - }(typeValidator_1.ObjectValidator)); - exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; - var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkRequestValidator, _super); - function CaptureBookmarkRequestValidator() { + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExportDataRequestValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var ExportDataRequestValidator = /** @class */ (function (_super) { + __extends(ExportDataRequestValidator, _super); + function ExportDataRequestValidator() { return _super !== null && _super.apply(this, arguments) || this; } - CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { + ExportDataRequestValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3043,20 +3189,24 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "options", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] + field: "rows", + validators: [new typeValidator_1.NumberValidator()] + }, + { + field: "exportDataType", + validators: [new typeValidator_1.EnumValidator([0, 1])] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return CaptureBookmarkRequestValidator; + return ExportDataRequestValidator; }(typeValidator_1.ObjectValidator)); - exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; + exports.ExportDataRequestValidator = ExportDataRequestValidator; /***/ }), - /* 7 */ + /* 11 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -3073,16 +3223,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; + exports.ExtensionsValidator = exports.MenuGroupExtensionValidator = exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.GroupedMenuExtensionValidator = exports.FlatMenuExtensionValidator = exports.MenuExtensionBaseValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var FilterColumnTargetValidator = /** @class */ (function (_super) { - __extends(FilterColumnTargetValidator, _super); - function FilterColumnTargetValidator() { + var MenuExtensionBaseValidator = /** @class */ (function (_super) { + __extends(MenuExtensionBaseValidator, _super); + function MenuExtensionBaseValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FilterColumnTargetValidator.prototype.validate = function (input, path, field) { + MenuExtensionBaseValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3092,26 +3242,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "title", + validators: [validator_1.Validators.stringValidator] }, { - field: "column", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "icon", + validators: [validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FilterColumnTargetValidator; + return MenuExtensionBaseValidator; }(typeValidator_1.ObjectValidator)); - exports.FilterColumnTargetValidator = FilterColumnTargetValidator; - var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyColumnsTargetValidator, _super); - function FilterKeyColumnsTargetValidator() { + exports.MenuExtensionBaseValidator = MenuExtensionBaseValidator; + var FlatMenuExtensionValidator = /** @class */ (function (_super) { + __extends(FlatMenuExtensionValidator, _super); + function FlatMenuExtensionValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { + FlatMenuExtensionValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3121,22 +3271,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] + }, + { + field: "groupName", + validators: [validator_1.Validators.fieldForbiddenValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FilterKeyColumnsTargetValidator; - }(FilterColumnTargetValidator)); - exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; - var FilterHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterHierarchyTargetValidator, _super); - function FilterHierarchyTargetValidator() { + return FlatMenuExtensionValidator; + }(MenuExtensionBaseValidator)); + exports.FlatMenuExtensionValidator = FlatMenuExtensionValidator; + var GroupedMenuExtensionValidator = /** @class */ (function (_super) { + __extends(GroupedMenuExtensionValidator, _super); + function GroupedMenuExtensionValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { + GroupedMenuExtensionValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3146,30 +3300,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "table", + field: "groupName", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "hierarchy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "menuLocation", + validators: [validator_1.Validators.fieldForbiddenValidator] }, - { - field: "hierarchyLevel", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FilterHierarchyTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; - var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyHierarchyTargetValidator, _super); - function FilterKeyHierarchyTargetValidator() { + return GroupedMenuExtensionValidator; + }(MenuExtensionBaseValidator)); + exports.GroupedMenuExtensionValidator = GroupedMenuExtensionValidator; + var ExtensionPointsValidator = /** @class */ (function (_super) { + __extends(ExtensionPointsValidator, _super); + function ExtensionPointsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { + ExtensionPointsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3179,22 +3329,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + field: "visualContextMenu", + validators: [validator_1.Validators.menuExtensionValidator] }, + { + field: "visualOptionsMenu", + validators: [validator_1.Validators.menuExtensionValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FilterKeyHierarchyTargetValidator; - }(FilterHierarchyTargetValidator)); - exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; - var FilterMeasureTargetValidator = /** @class */ (function (_super) { - __extends(FilterMeasureTargetValidator, _super); - function FilterMeasureTargetValidator() { + return ExtensionPointsValidator; + }(typeValidator_1.ObjectValidator)); + exports.ExtensionPointsValidator = ExtensionPointsValidator; + var ExtensionItemValidator = /** @class */ (function (_super) { + __extends(ExtensionItemValidator, _super); + function ExtensionItemValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { + ExtensionItemValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3204,26 +3358,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "table", + field: "name", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "measure", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "extend", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FilterMeasureTargetValidator; + return ExtensionItemValidator; }(typeValidator_1.ObjectValidator)); - exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; - var BasicFilterValidator = /** @class */ (function (_super) { - __extends(BasicFilterValidator, _super); - function BasicFilterValidator() { + exports.ExtensionItemValidator = ExtensionItemValidator; + var CommandExtensionValidator = /** @class */ (function (_super) { + __extends(CommandExtensionValidator, _super); + function CommandExtensionValidator() { return _super !== null && _super.apply(this, arguments) || this; } - BasicFilterValidator.prototype.validate = function (input, path, field) { + CommandExtensionValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3233,38 +3387,55 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", + field: "title", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + field: "icon", + validators: [validator_1.Validators.stringValidator] }, { - field: "filterType", - validators: [validator_1.Validators.basicFilterTypeValidator] + field: "selector", + validators: [validator_1.Validators.commandExtensionSelectorValidator] }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandExtensionValidator; + }(ExtensionItemValidator)); + exports.CommandExtensionValidator = CommandExtensionValidator; + var ExtensionValidator = /** @class */ (function (_super) { + __extends(ExtensionValidator, _super); + function ExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ { - field: "requireSingleSelection", - validators: [validator_1.Validators.booleanValidator] - }, + field: "command", + validators: [validator_1.Validators.commandExtensionValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return BasicFilterValidator; + return ExtensionValidator; }(typeValidator_1.ObjectValidator)); - exports.BasicFilterValidator = BasicFilterValidator; - var AdvancedFilterValidator = /** @class */ (function (_super) { - __extends(AdvancedFilterValidator, _super); - function AdvancedFilterValidator() { + exports.ExtensionValidator = ExtensionValidator; + var MenuGroupExtensionValidator = /** @class */ (function (_super) { + __extends(MenuGroupExtensionValidator, _super); + function MenuGroupExtensionValidator() { return _super !== null && _super.apply(this, arguments) || this; } - AdvancedFilterValidator.prototype.validate = function (input, path, field) { + MenuGroupExtensionValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3274,34 +3445,30 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "logicalOperator", + field: "title", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "conditions", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] }, - { - field: "filterType", - validators: [validator_1.Validators.advancedFilterTypeValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return AdvancedFilterValidator; + return MenuGroupExtensionValidator; }(typeValidator_1.ObjectValidator)); - exports.AdvancedFilterValidator = AdvancedFilterValidator; - var RelativeDateFilterValidator = /** @class */ (function (_super) { - __extends(RelativeDateFilterValidator, _super); - function RelativeDateFilterValidator() { + exports.MenuGroupExtensionValidator = MenuGroupExtensionValidator; + var ExtensionsValidator = /** @class */ (function (_super) { + __extends(ExtensionsValidator, _super); + function ExtensionsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - RelativeDateFilterValidator.prototype.validate = function (input, path, field) { + ExtensionsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3311,42 +3478,50 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + field: "commands", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandExtensionArrayValidator] }, { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] - }, - { - field: "includeToday", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeDateFilterTypeValidator] - }, + field: "groups", + validators: [validator_1.Validators.menuGroupExtensionArrayValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return RelativeDateFilterValidator; + return ExtensionsValidator; }(typeValidator_1.ObjectValidator)); - exports.RelativeDateFilterValidator = RelativeDateFilterValidator; - var RelativeTimeFilterValidator = /** @class */ (function (_super) { - __extends(RelativeTimeFilterValidator, _super); - function RelativeTimeFilterValidator() { + exports.ExtensionsValidator = ExtensionsValidator; + + + /***/ }), + /* 12 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var FilterColumnTargetValidator = /** @class */ (function (_super) { + __extends(FilterColumnTargetValidator, _super); + function FilterColumnTargetValidator() { return _super !== null && _super.apply(this, arguments) || this; } - RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { + FilterColumnTargetValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3356,38 +3531,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "filterType", - validators: [validator_1.Validators.relativeTimeFilterTypeValidator] - }, + field: "column", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return RelativeTimeFilterValidator; + return FilterColumnTargetValidator; }(typeValidator_1.ObjectValidator)); - exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; - var TopNFilterValidator = /** @class */ (function (_super) { - __extends(TopNFilterValidator, _super); - function TopNFilterValidator() { + exports.FilterColumnTargetValidator = FilterColumnTargetValidator; + var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyColumnsTargetValidator, _super); + function FilterKeyColumnsTargetValidator() { return _super !== null && _super.apply(this, arguments) || this; } - TopNFilterValidator.prototype.validate = function (input, path, field) { + FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3397,38 +3560,55 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyColumnsTargetValidator; + }(FilterColumnTargetValidator)); + exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; + var FilterHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterHierarchyTargetValidator, _super); + function FilterHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ { - field: "operator", + field: "table", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "itemCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.topNFilterTypeValidator] + field: "hierarchy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "orderBy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + field: "hierarchyLevel", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return TopNFilterValidator; + return FilterHierarchyTargetValidator; }(typeValidator_1.ObjectValidator)); - exports.TopNFilterValidator = TopNFilterValidator; - var NotSupportedFilterValidator = /** @class */ (function (_super) { - __extends(NotSupportedFilterValidator, _super); - function NotSupportedFilterValidator() { + exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; + var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyHierarchyTargetValidator, _super); + function FilterKeyHierarchyTargetValidator() { return _super !== null && _super.apply(this, arguments) || this; } - NotSupportedFilterValidator.prototype.validate = function (input, path, field) { + FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3438,34 +3618,51 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "target", - validators: [validator_1.Validators.filterTargetValidator] + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyHierarchyTargetValidator; + }(FilterHierarchyTargetValidator)); + exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; + var FilterMeasureTargetValidator = /** @class */ (function (_super) { + __extends(FilterMeasureTargetValidator, _super); + function FilterMeasureTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ { - field: "message", + field: "table", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "notSupportedTypeName", + field: "measure", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.notSupportedFilterTypeValidator] - }, + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return NotSupportedFilterValidator; + return FilterMeasureTargetValidator; }(typeValidator_1.ObjectValidator)); - exports.NotSupportedFilterValidator = NotSupportedFilterValidator; - var IncludeExcludeFilterValidator = /** @class */ (function (_super) { - __extends(IncludeExcludeFilterValidator, _super); - function IncludeExcludeFilterValidator() { + exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; + var BasicFilterValidator = /** @class */ (function (_super) { + __extends(BasicFilterValidator, _super); + function BasicFilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { + BasicFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3479,8 +3676,8 @@ return /******/ (function(modules) { // webpackBootstrap validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] }, { - field: "isExclude", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { field: "values", @@ -3488,35 +3685,25 @@ return /******/ (function(modules) { // webpackBootstrap }, { field: "filterType", - validators: [validator_1.Validators.includeExludeFilterTypeValidator] + validators: [validator_1.Validators.basicFilterTypeValidator] + }, + { + field: "requireSingleSelection", + validators: [validator_1.Validators.booleanValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return IncludeExcludeFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; - var FilterValidator = /** @class */ (function (_super) { - __extends(FilterValidator, _super); - function FilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - return validator_1.Validators.anyFilterValidator.validate(input, path, field); - }; - return FilterValidator; + return BasicFilterValidator; }(typeValidator_1.ObjectValidator)); - exports.FilterValidator = FilterValidator; - var ConditionItemValidator = /** @class */ (function (_super) { - __extends(ConditionItemValidator, _super); - function ConditionItemValidator() { + exports.BasicFilterValidator = BasicFilterValidator; + var AdvancedFilterValidator = /** @class */ (function (_super) { + __extends(AdvancedFilterValidator, _super); + function AdvancedFilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ConditionItemValidator.prototype.validate = function (input, path, field) { + AdvancedFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3526,111 +3713,34 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "value", - validators: [validator_1.Validators.anyValueValidator] + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] }, { - field: "operator", + field: "logicalOperator", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "conditions", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.advancedFilterTypeValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ConditionItemValidator; + return AdvancedFilterValidator; }(typeValidator_1.ObjectValidator)); - exports.ConditionItemValidator = ConditionItemValidator; - - - /***/ }), - /* 8 */ - /***/ (function(module, exports) { - - Object.defineProperty(exports, "__esModule", { value: true }); - exports.FieldRequiredValidator = void 0; - var FieldRequiredValidator = /** @class */ (function () { - function FieldRequiredValidator() { + exports.AdvancedFilterValidator = AdvancedFilterValidator; + var RelativeDateFilterValidator = /** @class */ (function (_super) { + __extends(RelativeDateFilterValidator, _super); + function RelativeDateFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; } - FieldRequiredValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return [{ - message: field + " is required", - path: (path ? path + "." : "") + field, - keyword: "required" - }]; - } - return null; - }; - return FieldRequiredValidator; - }()); - exports.FieldRequiredValidator = FieldRequiredValidator; - - - /***/ }), - /* 9 */ - /***/ (function(module, exports) { - - Object.defineProperty(exports, "__esModule", { value: true }); - exports.AnyOfValidator = void 0; - var AnyOfValidator = /** @class */ (function () { - function AnyOfValidator(validators) { - this.validators = validators; - } - AnyOfValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var valid = false; - for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { - var validator = _a[_i]; - var errors = validator.validate(input, path, field); - if (!errors) { - valid = true; - break; - } - } - if (!valid) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return AnyOfValidator; - }()); - exports.AnyOfValidator = AnyOfValidator; - - - /***/ }), - /* 10 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReportLoadValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportLoadValidator = /** @class */ (function (_super) { - __extends(ReportLoadValidator, _super); - function ReportLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportLoadValidator.prototype.validate = function (input, path, field) { + RelativeDateFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3640,163 +3750,42 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "settings", - validators: [validator_1.Validators.settingsValidator] - }, - { - field: "pageName", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "filters", - validators: [validator_1.Validators.filtersArrayValidator] - }, - { - field: "permissions", - validators: [validator_1.Validators.permissionsValidator] - }, - { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "bookmark", - validators: [validator_1.Validators.applyBookmarkValidator] - }, - { - field: "theme", - validators: [validator_1.Validators.customThemeValidator] - }, - { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "datasetBinding", - validators: [validator_1.Validators.datasetBindingValidator] - }, - { - field: "contrastMode", - validators: [validator_1.Validators.contrastModeValidator] + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportLoadValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportLoadValidator = ReportLoadValidator; - - - /***/ }), - /* 11 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ReportCreateValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportCreateValidator = /** @class */ (function (_super) { - __extends(ReportCreateValidator, _super); - function ReportCreateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportCreateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] }, { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] }, { - field: "groupId", - validators: [validator_1.Validators.stringValidator] + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] }, { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] + field: "includeToday", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] }, { - field: "theme", - validators: [validator_1.Validators.customThemeValidator] + field: "filterType", + validators: [validator_1.Validators.relativeDateFilterTypeValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ReportCreateValidator; + return RelativeDateFilterValidator; }(typeValidator_1.ObjectValidator)); - exports.ReportCreateValidator = ReportCreateValidator; - - - /***/ }), - /* 12 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DashboardLoadValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var DashboardLoadValidator = /** @class */ (function (_super) { - __extends(DashboardLoadValidator, _super); - function DashboardLoadValidator() { + exports.RelativeDateFilterValidator = RelativeDateFilterValidator; + var RelativeTimeFilterValidator = /** @class */ (function (_super) { + __extends(RelativeTimeFilterValidator, _super); + function RelativeTimeFilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - DashboardLoadValidator.prototype.validate = function (input, path, field) { + RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3806,66 +3795,38 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] }, { - field: "groupId", - validators: [validator_1.Validators.stringValidator] + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] }, { - field: "pageView", - validators: [validator_1.Validators.pageViewFieldValidator] + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] }, { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] }, { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DashboardLoadValidator; - }(typeValidator_1.ObjectValidator)); - exports.DashboardLoadValidator = DashboardLoadValidator; - - - /***/ }), - /* 13 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TileLoadValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var TileLoadValidator = /** @class */ (function (_super) { - __extends(TileLoadValidator, _super); - function TileLoadValidator() { + field: "filterType", + validators: [validator_1.Validators.relativeTimeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeTimeFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; + var TopNFilterValidator = /** @class */ (function (_super) { + __extends(TopNFilterValidator, _super); + function TopNFilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - TileLoadValidator.prototype.validate = function (input, path, field) { + TopNFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3875,74 +3836,38 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] }, { - field: "dashboardId", + field: "operator", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "pageView", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] + field: "itemCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] }, { - field: "width", - validators: [validator_1.Validators.numberValidator] + field: "filterType", + validators: [validator_1.Validators.topNFilterTypeValidator] }, { - field: "height", - validators: [validator_1.Validators.numberValidator] + field: "orderBy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return TileLoadValidator; + return TopNFilterValidator; }(typeValidator_1.ObjectValidator)); - exports.TileLoadValidator = TileLoadValidator; - - - /***/ }), - /* 14 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var PageSizeValidator = /** @class */ (function (_super) { - __extends(PageSizeValidator, _super); - function PageSizeValidator() { + exports.TopNFilterValidator = TopNFilterValidator; + var NotSupportedFilterValidator = /** @class */ (function (_super) { + __extends(NotSupportedFilterValidator, _super); + function NotSupportedFilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - PageSizeValidator.prototype.validate = function (input, path, field) { + NotSupportedFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3952,22 +3877,34 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "type", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] - } + field: "target", + validators: [validator_1.Validators.filterTargetValidator] + }, + { + field: "message", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "notSupportedTypeName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.notSupportedFilterTypeValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return PageSizeValidator; + return NotSupportedFilterValidator; }(typeValidator_1.ObjectValidator)); - exports.PageSizeValidator = PageSizeValidator; - var CustomPageSizeValidator = /** @class */ (function (_super) { - __extends(CustomPageSizeValidator, _super); - function CustomPageSizeValidator() { + exports.NotSupportedFilterValidator = NotSupportedFilterValidator; + var IncludeExcludeFilterValidator = /** @class */ (function (_super) { + __extends(IncludeExcludeFilterValidator, _super); + function IncludeExcludeFilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - CustomPageSizeValidator.prototype.validate = function (input, path, field) { + IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -3977,26 +3914,48 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "width", - validators: [validator_1.Validators.numberValidator] + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] }, { - field: "height", - validators: [validator_1.Validators.numberValidator] - } + field: "isExclude", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.includeExludeFilterTypeValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return CustomPageSizeValidator; - }(PageSizeValidator)); - exports.CustomPageSizeValidator = CustomPageSizeValidator; - var PageValidator = /** @class */ (function (_super) { - __extends(PageValidator, _super); - function PageValidator() { + return IncludeExcludeFilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; + var FilterValidator = /** @class */ (function (_super) { + __extends(FilterValidator, _super); + function FilterValidator() { return _super !== null && _super.apply(this, arguments) || this; } - PageValidator.prototype.validate = function (input, path, field) { + FilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + return validator_1.Validators.anyFilterValidator.validate(input, path, field); + }; + return FilterValidator; + }(typeValidator_1.ObjectValidator)); + exports.FilterValidator = FilterValidator; + var ConditionItemValidator = /** @class */ (function (_super) { + __extends(ConditionItemValidator, _super); + function ConditionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConditionItemValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4006,44 +3965,24 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "name", + field: "value", + validators: [validator_1.Validators.anyValueValidator] + }, + { + field: "operator", validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return PageValidator; + return ConditionItemValidator; }(typeValidator_1.ObjectValidator)); - exports.PageValidator = PageValidator; - var PageViewFieldValidator = /** @class */ (function (_super) { - __extends(PageViewFieldValidator, _super); - function PageViewFieldValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageViewFieldValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; - if (possibleValues.indexOf(input) < 0) { - return [{ - message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" - }]; - } - return null; - }; - return PageViewFieldValidator; - }(typeValidator_1.StringValidator)); - exports.PageViewFieldValidator = PageViewFieldValidator; + exports.ConditionItemValidator = ConditionItemValidator; /***/ }), - /* 15 */ + /* 13 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4060,16 +3999,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; + exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var LoadQnaValidator = /** @class */ (function (_super) { - __extends(LoadQnaValidator, _super); - function LoadQnaValidator() { + var CustomLayoutValidator = /** @class */ (function (_super) { + __extends(CustomLayoutValidator, _super); + function CustomLayoutValidator() { return _super !== null && _super.apply(this, arguments) || this; } - LoadQnaValidator.prototype.validate = function (input, path, field) { + CustomLayoutValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4079,46 +4018,75 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "pageSize", + validators: [validator_1.Validators.pageSizeValidator] }, { - field: "datasetIds", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + field: "displayOption", + validators: [validator_1.Validators.customLayoutDisplayOptionValidator] }, { - field: "question", - validators: [validator_1.Validators.stringValidator] + field: "pagesLayout", + validators: [validator_1.Validators.pagesLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomLayoutValidator; + }(typeValidator_1.ObjectValidator)); + exports.CustomLayoutValidator = CustomLayoutValidator; + var VisualLayoutValidator = /** @class */ (function (_super) { + __extends(VisualLayoutValidator, _super); + function VisualLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "x", + validators: [validator_1.Validators.numberValidator] }, { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] + field: "y", + validators: [validator_1.Validators.numberValidator] }, { - field: "settings", - validators: [validator_1.Validators.qnaSettingValidator] + field: "z", + validators: [validator_1.Validators.numberValidator] }, { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] + field: "width", + validators: [validator_1.Validators.numberValidator] }, { - field: "groupId", - validators: [validator_1.Validators.stringValidator] + field: "height", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "displayState", + validators: [validator_1.Validators.displayStateValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return LoadQnaValidator; + return VisualLayoutValidator; }(typeValidator_1.ObjectValidator)); - exports.LoadQnaValidator = LoadQnaValidator; - var QnaSettingsValidator = /** @class */ (function (_super) { - __extends(QnaSettingsValidator, _super); - function QnaSettingsValidator() { + exports.VisualLayoutValidator = VisualLayoutValidator; + var DisplayStateValidator = /** @class */ (function (_super) { + __extends(DisplayStateValidator, _super); + function DisplayStateValidator() { return _super !== null && _super.apply(this, arguments) || this; } - QnaSettingsValidator.prototype.validate = function (input, path, field) { + DisplayStateValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4128,26 +4096,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] - }, + field: "mode", + validators: [validator_1.Validators.displayStateModeValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return QnaSettingsValidator; + return DisplayStateValidator; }(typeValidator_1.ObjectValidator)); - exports.QnaSettingsValidator = QnaSettingsValidator; - var QnaInterpretInputDataValidator = /** @class */ (function (_super) { - __extends(QnaInterpretInputDataValidator, _super); - function QnaInterpretInputDataValidator() { + exports.DisplayStateValidator = DisplayStateValidator; + var PageLayoutValidator = /** @class */ (function (_super) { + __extends(PageLayoutValidator, _super); + function PageLayoutValidator() { return _super !== null && _super.apply(this, arguments) || this; } - QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { + PageLayoutValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4157,24 +4121,24 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "datasetIds", - validators: [validator_1.Validators.stringArrayValidator] + field: "visualsLayout", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] }, { - field: "question", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, + field: "defaultLayout", + validators: [validator_1.Validators.visualLayoutValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return QnaInterpretInputDataValidator; + return PageLayoutValidator; }(typeValidator_1.ObjectValidator)); - exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; + exports.PageLayoutValidator = PageLayoutValidator; /***/ }), - /* 16 */ + /* 14 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4191,16 +4155,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.SaveAsParametersValidator = void 0; + exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var SaveAsParametersValidator = /** @class */ (function (_super) { - __extends(SaveAsParametersValidator, _super); - function SaveAsParametersValidator() { + var PageSizeValidator = /** @class */ (function (_super) { + __extends(PageSizeValidator, _super); + function PageSizeValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SaveAsParametersValidator.prototype.validate = function (input, path, field) { + PageSizeValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4210,47 +4174,51 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "type", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SaveAsParametersValidator; + return PageSizeValidator; }(typeValidator_1.ObjectValidator)); - exports.SaveAsParametersValidator = SaveAsParametersValidator; - - - /***/ }), - /* 17 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + exports.PageSizeValidator = PageSizeValidator; + var CustomPageSizeValidator = /** @class */ (function (_super) { + __extends(CustomPageSizeValidator, _super); + function CustomPageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomPageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MapValidator = void 0; - var typeValidator_1 = __webpack_require__(2); - var MapValidator = /** @class */ (function (_super) { - __extends(MapValidator, _super); - function MapValidator(keyValidators, valueValidators) { - var _this = _super.call(this) || this; - _this.keyValidators = keyValidators; - _this.valueValidators = valueValidators; - return _this; + return CustomPageSizeValidator; + }(PageSizeValidator)); + exports.CustomPageSizeValidator = CustomPageSizeValidator; + var PageValidator = /** @class */ (function (_super) { + __extends(PageValidator, _super); + function PageValidator() { + return _super !== null && _super.apply(this, arguments) || this; } - MapValidator.prototype.validate = function (input, path, field) { + PageValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4258,34 +4226,46 @@ return /******/ (function(modules) { // webpackBootstrap if (errors) { return errors; } - for (var key in input) { - if (input.hasOwnProperty(key)) { - var fieldsPath = (path ? path + "." : "") + field + "." + key; - for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { - var keyValidator = _a[_i]; - errors = keyValidator.validate(key, fieldsPath, field); - if (errors) { - return errors; - } - } - for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { - var valueValidator = _c[_b]; - errors = valueValidator.validate(input[key], fieldsPath, field); - if (errors) { - return errors; - } - } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageValidator; + }(typeValidator_1.ObjectValidator)); + exports.PageValidator = PageValidator; + var PageViewFieldValidator = /** @class */ (function (_super) { + __extends(PageViewFieldValidator, _super); + function PageViewFieldValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageViewFieldValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; + if (possibleValues.indexOf(input) < 0) { + return [{ + message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" + }]; } return null; }; - return MapValidator; - }(typeValidator_1.ObjectValidator)); - exports.MapValidator = MapValidator; + return PageViewFieldValidator; + }(typeValidator_1.StringValidator)); + exports.PageViewFieldValidator = PageViewFieldValidator; /***/ }), - /* 18 */ + /* 15 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4302,16 +4282,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; + exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var CustomLayoutValidator = /** @class */ (function (_super) { - __extends(CustomLayoutValidator, _super); - function CustomLayoutValidator() { + var ReportPanesValidator = /** @class */ (function (_super) { + __extends(ReportPanesValidator, _super); + function ReportPanesValidator() { return _super !== null && _super.apply(this, arguments) || this; } - CustomLayoutValidator.prototype.validate = function (input, path, field) { + ReportPanesValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4321,75 +4301,71 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "pageSize", - validators: [validator_1.Validators.pageSizeValidator] + field: "bookmarks", + validators: [validator_1.Validators.bookmarksPaneValidator] }, { - field: "displayOption", - validators: [validator_1.Validators.customLayoutDisplayOptionValidator] + field: "fields", + validators: [validator_1.Validators.fieldsPaneValidator] }, { - field: "pagesLayout", - validators: [validator_1.Validators.pagesLayoutValidator] + field: "filters", + validators: [validator_1.Validators.filtersPaneValidator] + }, + { + field: "pageNavigation", + validators: [validator_1.Validators.pageNavigationPaneValidator] + }, + { + field: "selection", + validators: [validator_1.Validators.selectionPaneValidator] + }, + { + field: "syncSlicers", + validators: [validator_1.Validators.syncSlicersPaneValidator] + }, + { + field: "visualizations", + validators: [validator_1.Validators.visualizationsPaneValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return CustomLayoutValidator; + return ReportPanesValidator; }(typeValidator_1.ObjectValidator)); - exports.CustomLayoutValidator = CustomLayoutValidator; - var VisualLayoutValidator = /** @class */ (function (_super) { - __extends(VisualLayoutValidator, _super); - function VisualLayoutValidator() { + exports.ReportPanesValidator = ReportPanesValidator; + var BookmarksPaneValidator = /** @class */ (function (_super) { + __extends(BookmarksPaneValidator, _super); + function BookmarksPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - VisualLayoutValidator.prototype.validate = function (input, path, field) { + BookmarksPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "x", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "y", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "z", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ { - field: "height", - validators: [validator_1.Validators.numberValidator] + field: "visible", + validators: [validator_1.Validators.booleanValidator] }, - { - field: "displayState", - validators: [validator_1.Validators.displayStateValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return VisualLayoutValidator; + return BookmarksPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.VisualLayoutValidator = VisualLayoutValidator; - var DisplayStateValidator = /** @class */ (function (_super) { - __extends(DisplayStateValidator, _super); - function DisplayStateValidator() { + exports.BookmarksPaneValidator = BookmarksPaneValidator; + var FieldsPaneValidator = /** @class */ (function (_super) { + __extends(FieldsPaneValidator, _super); + function FieldsPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - DisplayStateValidator.prototype.validate = function (input, path, field) { + FieldsPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4399,22 +4375,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "mode", - validators: [validator_1.Validators.displayStateModeValidator] - } + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return DisplayStateValidator; + return FieldsPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.DisplayStateValidator = DisplayStateValidator; - var PageLayoutValidator = /** @class */ (function (_super) { - __extends(PageLayoutValidator, _super); - function PageLayoutValidator() { + exports.FieldsPaneValidator = FieldsPaneValidator; + var FiltersPaneValidator = /** @class */ (function (_super) { + __extends(FiltersPaneValidator, _super); + function FiltersPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - PageLayoutValidator.prototype.validate = function (input, path, field) { + FiltersPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4424,49 +4400,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "visualsLayout", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] + field: "visible", + validators: [validator_1.Validators.booleanValidator] }, { - field: "defaultLayout", - validators: [validator_1.Validators.visualLayoutValidator] - } + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return PageLayoutValidator; + return FiltersPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.PageLayoutValidator = PageLayoutValidator; - - - /***/ }), - /* 19 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExportDataRequestValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ExportDataRequestValidator = /** @class */ (function (_super) { - __extends(ExportDataRequestValidator, _super); - function ExportDataRequestValidator() { + exports.FiltersPaneValidator = FiltersPaneValidator; + var PageNavigationPaneValidator = /** @class */ (function (_super) { + __extends(PageNavigationPaneValidator, _super); + function PageNavigationPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ExportDataRequestValidator.prototype.validate = function (input, path, field) { + PageNavigationPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4476,51 +4429,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "rows", - validators: [new typeValidator_1.NumberValidator()] + field: "visible", + validators: [validator_1.Validators.booleanValidator] }, { - field: "exportDataType", - validators: [new typeValidator_1.EnumValidator([0, 1])] - } + field: "position", + validators: [validator_1.Validators.pageNavigationPositionValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return ExportDataRequestValidator; + return PageNavigationPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.ExportDataRequestValidator = ExportDataRequestValidator; - - - /***/ }), - /* 20 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var typeValidator_2 = __webpack_require__(2); - var VisualSelectorValidator = /** @class */ (function (_super) { - __extends(VisualSelectorValidator, _super); - function VisualSelectorValidator() { + exports.PageNavigationPaneValidator = PageNavigationPaneValidator; + var SelectionPaneValidator = /** @class */ (function (_super) { + __extends(SelectionPaneValidator, _super); + function SelectionPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - VisualSelectorValidator.prototype.validate = function (input, path, field) { + SelectionPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4530,27 +4458,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - // Not required for this selector only - Backward compatibility - field: "$schema", - validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] + field: "visible", + validators: [validator_1.Validators.booleanValidator] }, - { - field: "visualName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return VisualSelectorValidator; + return SelectionPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.VisualSelectorValidator = VisualSelectorValidator; - var VisualTypeSelectorValidator = /** @class */ (function (_super) { - __extends(VisualTypeSelectorValidator, _super); - function VisualTypeSelectorValidator() { + exports.SelectionPaneValidator = SelectionPaneValidator; + var SyncSlicersPaneValidator = /** @class */ (function (_super) { + __extends(SyncSlicersPaneValidator, _super); + function SyncSlicersPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { + SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4560,26 +4483,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "$schema", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] + field: "visible", + validators: [validator_1.Validators.booleanValidator] }, - { - field: "visualType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return VisualTypeSelectorValidator; + return SyncSlicersPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; - var SlicerTargetSelectorValidator = /** @class */ (function (_super) { - __extends(SlicerTargetSelectorValidator, _super); - function SlicerTargetSelectorValidator() { + exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; + var VisualizationsPaneValidator = /** @class */ (function (_super) { + __extends(VisualizationsPaneValidator, _super); + function VisualizationsPaneValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { + VisualizationsPaneValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4589,24 +4508,20 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "$schema", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] + field: "expanded", + validators: [validator_1.Validators.booleanValidator] }, - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] - } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SlicerTargetSelectorValidator; + return VisualizationsPaneValidator; }(typeValidator_1.ObjectValidator)); - exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; + exports.VisualizationsPaneValidator = VisualizationsPaneValidator; /***/ }), - /* 21 */ + /* 16 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4623,16 +4538,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.SlicerStateValidator = exports.SlicerValidator = void 0; + exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var SlicerValidator = /** @class */ (function (_super) { - __extends(SlicerValidator, _super); - function SlicerValidator() { + var LoadQnaValidator = /** @class */ (function (_super) { + __extends(LoadQnaValidator, _super); + function LoadQnaValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SlicerValidator.prototype.validate = function (input, path, field) { + LoadQnaValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4642,26 +4557,75 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "selector", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] + field: "datasetIds", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.qnaSettingValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SlicerValidator; + return LoadQnaValidator; }(typeValidator_1.ObjectValidator)); - exports.SlicerValidator = SlicerValidator; - var SlicerStateValidator = /** @class */ (function (_super) { - __extends(SlicerStateValidator, _super); - function SlicerStateValidator() { + exports.LoadQnaValidator = LoadQnaValidator; + var QnaSettingsValidator = /** @class */ (function (_super) { + __extends(QnaSettingsValidator, _super); + function QnaSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaSettingsValidator; + }(typeValidator_1.ObjectValidator)); + exports.QnaSettingsValidator = QnaSettingsValidator; + var QnaInterpretInputDataValidator = /** @class */ (function (_super) { + __extends(QnaInterpretInputDataValidator, _super); + function QnaInterpretInputDataValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SlicerStateValidator.prototype.validate = function (input, path, field) { + QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4671,20 +4635,24 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "filters", - validators: [validator_1.Validators.filtersArrayValidator] - } + field: "datasetIds", + validators: [validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SlicerStateValidator; + return QnaInterpretInputDataValidator; }(typeValidator_1.ObjectValidator)); - exports.SlicerStateValidator = SlicerStateValidator; + exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; /***/ }), - /* 22 */ + /* 17 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4701,16 +4669,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; + exports.ReportCreateValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var VisualSettingsValidator = /** @class */ (function (_super) { - __extends(VisualSettingsValidator, _super); - function VisualSettingsValidator() { + var ReportCreateValidator = /** @class */ (function (_super) { + __extends(ReportCreateValidator, _super); + function ReportCreateValidator() { return _super !== null && _super.apply(this, arguments) || this; } - VisualSettingsValidator.prototype.validate = function (input, path, field) { + ReportCreateValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4720,74 +4688,36 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "visualHeaders", - validators: [validator_1.Validators.visualHeadersValidator] + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualSettingsValidator = VisualSettingsValidator; - var VisualHeaderSettingsValidator = /** @class */ (function (_super) { - __extends(VisualHeaderSettingsValidator, _super); - function VisualHeaderSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualHeaderSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; - var VisualHeaderValidator = /** @class */ (function (_super) { - __extends(VisualHeaderValidator, _super); - function VisualHeaderValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualHeaderValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, { - field: "settings", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] + field: "groupId", + validators: [validator_1.Validators.stringValidator] }, { - field: "selector", - validators: [validator_1.Validators.visualHeaderSelectorValidator] + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return VisualHeaderValidator; + return ReportCreateValidator; }(typeValidator_1.ObjectValidator)); - exports.VisualHeaderValidator = VisualHeaderValidator; + exports.ReportCreateValidator = ReportCreateValidator; /***/ }), - /* 23 */ + /* 18 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4804,16 +4734,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; + exports.ReportLoadValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var CommandsSettingsValidator = /** @class */ (function (_super) { - __extends(CommandsSettingsValidator, _super); - function CommandsSettingsValidator() { + var ReportLoadValidator = /** @class */ (function (_super) { + __extends(ReportLoadValidator, _super); + function ReportLoadValidator() { return _super !== null && _super.apply(this, arguments) || this; } - CommandsSettingsValidator.prototype.validate = function (input, path, field) { + ReportLoadValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4823,62 +4753,98 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "copy", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "drill", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "drillthrough", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "groupId", + validators: [validator_1.Validators.stringValidator] }, { - field: "expandCollapse", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "settings", + validators: [validator_1.Validators.settingsValidator] }, { - field: "exportData", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "pageName", + validators: [validator_1.Validators.stringValidator] }, { - field: "includeExclude", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] }, { - field: "removeVisual", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "permissions", + validators: [validator_1.Validators.permissionsValidator] }, { - field: "search", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] }, { - field: "seeData", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] }, { - field: "sort", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "bookmark", + validators: [validator_1.Validators.applyBookmarkValidator] }, { - field: "spotlight", - validators: [validator_1.Validators.singleCommandSettingsValidator] + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "datasetBinding", + validators: [validator_1.Validators.datasetBindingValidator] + }, + { + field: "contrastMode", + validators: [validator_1.Validators.contrastModeValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return CommandsSettingsValidator; + return ReportLoadValidator; }(typeValidator_1.ObjectValidator)); - exports.CommandsSettingsValidator = CommandsSettingsValidator; - var SingleCommandSettingsValidator = /** @class */ (function (_super) { - __extends(SingleCommandSettingsValidator, _super); - function SingleCommandSettingsValidator() { + exports.ReportLoadValidator = ReportLoadValidator; + + + /***/ }), + /* 19 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SaveAsParametersValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var SaveAsParametersValidator = /** @class */ (function (_super) { + __extends(SaveAsParametersValidator, _super); + function SaveAsParametersValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { + SaveAsParametersValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4888,24 +4854,20 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "displayOption", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.visualCommandSelectorValidator] - }, + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SingleCommandSettingsValidator; + return SaveAsParametersValidator; }(typeValidator_1.ObjectValidator)); - exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; + exports.SaveAsParametersValidator = SaveAsParametersValidator; /***/ }), - /* 24 */ + /* 20 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -4922,15 +4884,47 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.CustomThemeValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var CustomThemeValidator = /** @class */ (function (_super) { - __extends(CustomThemeValidator, _super); - function CustomThemeValidator() { + exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var typeValidator_2 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var VisualSelectorValidator = /** @class */ (function (_super) { + __extends(VisualSelectorValidator, _super); + function VisualSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + // Not required for this selector only - Backward compatibility + field: "$schema", + validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] + }, + { + field: "visualName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSelectorValidator; + }(typeValidator_1.ObjectValidator)); + exports.VisualSelectorValidator = VisualSelectorValidator; + var VisualTypeSelectorValidator = /** @class */ (function (_super) { + __extends(VisualTypeSelectorValidator, _super); + function VisualTypeSelectorValidator() { return _super !== null && _super.apply(this, arguments) || this; } - CustomThemeValidator.prototype.validate = function (input, path, field) { + VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4940,46 +4934,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "themeJson", - validators: [new typeValidator_1.ObjectValidator()] + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] + }, + { + field: "visualType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return CustomThemeValidator; + return VisualTypeSelectorValidator; }(typeValidator_1.ObjectValidator)); - exports.CustomThemeValidator = CustomThemeValidator; - - - /***/ }), - /* 25 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DatasetBindingValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var DatasetBindingValidator = /** @class */ (function (_super) { - __extends(DatasetBindingValidator, _super); - function DatasetBindingValidator() { + exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; + var SlicerTargetSelectorValidator = /** @class */ (function (_super) { + __extends(SlicerTargetSelectorValidator, _super); + function SlicerTargetSelectorValidator() { return _super !== null && _super.apply(this, arguments) || this; } - DatasetBindingValidator.prototype.validate = function (input, path, field) { + SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -4989,20 +4963,24 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] + }, + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return DatasetBindingValidator; + return SlicerTargetSelectorValidator; }(typeValidator_1.ObjectValidator)); - exports.DatasetBindingValidator = DatasetBindingValidator; + exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; /***/ }), - /* 26 */ + /* 21 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -5019,16 +4997,16 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; + exports.SettingsValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportPanesValidator = /** @class */ (function (_super) { - __extends(ReportPanesValidator, _super); - function ReportPanesValidator() { + var SettingsValidator = /** @class */ (function (_super) { + __extends(SettingsValidator, _super); + function SettingsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - ReportPanesValidator.prototype.validate = function (input, path, field) { + SettingsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5038,71 +5016,114 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "bookmarks", - validators: [validator_1.Validators.bookmarksPaneValidator] + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] }, { - field: "fields", - validators: [validator_1.Validators.fieldsPaneValidator] + field: "navContentPaneEnabled", + validators: [validator_1.Validators.booleanValidator] }, { - field: "filters", - validators: [validator_1.Validators.filtersPaneValidator] + field: "bookmarksPaneEnabled", + validators: [validator_1.Validators.booleanValidator] }, { - field: "pageNavigation", - validators: [validator_1.Validators.pageNavigationPaneValidator] + field: "useCustomSaveAsDialog", + validators: [validator_1.Validators.booleanValidator] }, { - field: "selection", - validators: [validator_1.Validators.selectionPaneValidator] + field: "extensions", + validators: [validator_1.Validators.extensionsValidator] }, { - field: "syncSlicers", - validators: [validator_1.Validators.syncSlicersPaneValidator] + field: "layoutType", + validators: [validator_1.Validators.layoutTypeValidator] }, { - field: "visualizations", - validators: [validator_1.Validators.visualizationsPaneValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportPanesValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportPanesValidator = ReportPanesValidator; - var BookmarksPaneValidator = /** @class */ (function (_super) { - __extends(BookmarksPaneValidator, _super); - function BookmarksPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BookmarksPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ + field: "customLayout", + validators: [validator_1.Validators.customLayoutValidator] + }, { - field: "visible", + field: "background", + validators: [validator_1.Validators.backgroundValidator] + }, + { + field: "visualSettings", + validators: [validator_1.Validators.visualSettingsValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "commands", + validators: [validator_1.Validators.commandsSettingsArrayValidator] + }, + { + field: "hyperlinkClickBehavior", + validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] + }, + { + field: "bars", + validators: [validator_1.Validators.reportBarsValidator] + }, + { + field: "panes", + validators: [validator_1.Validators.reportPanesValidator] + }, + { + field: "personalBookmarksEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "persistentFiltersEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "visualRenderedEvents", validators: [validator_1.Validators.booleanValidator] }, + { + field: "authoringHintsEnabled", + validators: [validator_1.Validators.booleanValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return BookmarksPaneValidator; + return SettingsValidator; }(typeValidator_1.ObjectValidator)); - exports.BookmarksPaneValidator = BookmarksPaneValidator; - var FieldsPaneValidator = /** @class */ (function (_super) { - __extends(FieldsPaneValidator, _super); - function FieldsPaneValidator() { + exports.SettingsValidator = SettingsValidator; + + + /***/ }), + /* 22 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SlicerStateValidator = exports.SlicerValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var SlicerValidator = /** @class */ (function (_super) { + __extends(SlicerValidator, _super); + function SlicerValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FieldsPaneValidator.prototype.validate = function (input, path, field) { + SlicerValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5112,22 +5133,26 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] + field: "selector", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] }, + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FieldsPaneValidator; + return SlicerValidator; }(typeValidator_1.ObjectValidator)); - exports.FieldsPaneValidator = FieldsPaneValidator; - var FiltersPaneValidator = /** @class */ (function (_super) { - __extends(FiltersPaneValidator, _super); - function FiltersPaneValidator() { + exports.SlicerValidator = SlicerValidator; + var SlicerStateValidator = /** @class */ (function (_super) { + __extends(SlicerStateValidator, _super); + function SlicerStateValidator() { return _super !== null && _super.apply(this, arguments) || this; } - FiltersPaneValidator.prototype.validate = function (input, path, field) { + SlicerStateValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5137,26 +5162,46 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return FiltersPaneValidator; + return SlicerStateValidator; }(typeValidator_1.ObjectValidator)); - exports.FiltersPaneValidator = FiltersPaneValidator; - var PageNavigationPaneValidator = /** @class */ (function (_super) { - __extends(PageNavigationPaneValidator, _super); - function PageNavigationPaneValidator() { + exports.SlicerStateValidator = SlicerStateValidator; + + + /***/ }), + /* 23 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TileLoadValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var TileLoadValidator = /** @class */ (function (_super) { + __extends(TileLoadValidator, _super); + function TileLoadValidator() { return _super !== null && _super.apply(this, arguments) || this; } - PageNavigationPaneValidator.prototype.validate = function (input, path, field) { + TileLoadValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5166,26 +5211,74 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "visible", - validators: [validator_1.Validators.booleanValidator] + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] }, { - field: "position", - validators: [validator_1.Validators.pageNavigationPositionValidator] + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "dashboardId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return PageNavigationPaneValidator; + return TileLoadValidator; }(typeValidator_1.ObjectValidator)); - exports.PageNavigationPaneValidator = PageNavigationPaneValidator; - var SelectionPaneValidator = /** @class */ (function (_super) { - __extends(SelectionPaneValidator, _super); - function SelectionPaneValidator() { + exports.TileLoadValidator = TileLoadValidator; + + + /***/ }), + /* 24 */ + /***/ (function(module, exports, __webpack_require__) { + + var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; + var multipleFieldsValidator_1 = __webpack_require__(3); + var typeValidator_1 = __webpack_require__(4); + var validator_1 = __webpack_require__(1); + var VisualSettingsValidator = /** @class */ (function (_super) { + __extends(VisualSettingsValidator, _super); + function VisualSettingsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SelectionPaneValidator.prototype.validate = function (input, path, field) { + VisualSettingsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5195,22 +5288,22 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "visible", - validators: [validator_1.Validators.booleanValidator] + field: "visualHeaders", + validators: [validator_1.Validators.visualHeadersValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SelectionPaneValidator; + return VisualSettingsValidator; }(typeValidator_1.ObjectValidator)); - exports.SelectionPaneValidator = SelectionPaneValidator; - var SyncSlicersPaneValidator = /** @class */ (function (_super) { - __extends(SyncSlicersPaneValidator, _super); - function SyncSlicersPaneValidator() { + exports.VisualSettingsValidator = VisualSettingsValidator; + var VisualHeaderSettingsValidator = /** @class */ (function (_super) { + __extends(VisualHeaderSettingsValidator, _super); + function VisualHeaderSettingsValidator() { return _super !== null && _super.apply(this, arguments) || this; } - SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { + VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5222,20 +5315,20 @@ return /******/ (function(modules) { // webpackBootstrap { field: "visible", validators: [validator_1.Validators.booleanValidator] - }, + } ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return SyncSlicersPaneValidator; + return VisualHeaderSettingsValidator; }(typeValidator_1.ObjectValidator)); - exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; - var VisualizationsPaneValidator = /** @class */ (function (_super) { - __extends(VisualizationsPaneValidator, _super); - function VisualizationsPaneValidator() { + exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; + var VisualHeaderValidator = /** @class */ (function (_super) { + __extends(VisualHeaderValidator, _super); + function VisualHeaderValidator() { return _super !== null && _super.apply(this, arguments) || this; } - VisualizationsPaneValidator.prototype.validate = function (input, path, field) { + VisualHeaderValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5245,20 +5338,109 @@ return /******/ (function(modules) { // webpackBootstrap } var fields = [ { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] + field: "settings", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualHeaderSelectorValidator] }, ]; var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); return multipleFieldsValidator.validate(input, path, field); }; - return VisualizationsPaneValidator; + return VisualHeaderValidator; }(typeValidator_1.ObjectValidator)); - exports.VisualizationsPaneValidator = VisualizationsPaneValidator; + exports.VisualHeaderValidator = VisualHeaderValidator; + + + /***/ }), + /* 25 */ + /***/ (function(module, exports) { + + Object.defineProperty(exports, "__esModule", { value: true }); + exports.AnyOfValidator = void 0; + var AnyOfValidator = /** @class */ (function () { + function AnyOfValidator(validators) { + this.validators = validators; + } + AnyOfValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var valid = false; + for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input, path, field); + if (!errors) { + valid = true; + break; + } + } + if (!valid) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return AnyOfValidator; + }()); + exports.AnyOfValidator = AnyOfValidator; + + + /***/ }), + /* 26 */ + /***/ (function(module, exports) { + + Object.defineProperty(exports, "__esModule", { value: true }); + exports.FieldForbiddenValidator = void 0; + var FieldForbiddenValidator = /** @class */ (function () { + function FieldForbiddenValidator() { + } + FieldForbiddenValidator.prototype.validate = function (input, path, field) { + if (input !== undefined) { + return [{ + message: field + " is forbidden", + path: (path ? path + "." : "") + field, + keyword: "forbidden" + }]; + } + return null; + }; + return FieldForbiddenValidator; + }()); + exports.FieldForbiddenValidator = FieldForbiddenValidator; /***/ }), /* 27 */ + /***/ (function(module, exports) { + + Object.defineProperty(exports, "__esModule", { value: true }); + exports.FieldRequiredValidator = void 0; + var FieldRequiredValidator = /** @class */ (function () { + function FieldRequiredValidator() { + } + FieldRequiredValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return [{ + message: field + " is required", + path: (path ? path + "." : "") + field, + keyword: "required" + }]; + } + return null; + }; + return FieldRequiredValidator; + }()); + exports.FieldRequiredValidator = FieldRequiredValidator; + + + /***/ }), + /* 28 */ /***/ (function(module, exports, __webpack_require__) { var __extends = (this && this.__extends) || (function () { @@ -5275,16 +5457,17 @@ return /******/ (function(modules) { // webpackBootstrap }; })(); Object.defineProperty(exports, "__esModule", { value: true }); - exports.ActionBarValidator = exports.ReportBarsValidator = void 0; - var validator_1 = __webpack_require__(1); - var multipleFieldsValidator_1 = __webpack_require__(4); - var typeValidator_1 = __webpack_require__(2); - var ReportBarsValidator = /** @class */ (function (_super) { - __extends(ReportBarsValidator, _super); - function ReportBarsValidator() { - return _super !== null && _super.apply(this, arguments) || this; + exports.MapValidator = void 0; + var typeValidator_1 = __webpack_require__(4); + var MapValidator = /** @class */ (function (_super) { + __extends(MapValidator, _super); + function MapValidator(keyValidators, valueValidators) { + var _this = _super.call(this) || this; + _this.keyValidators = keyValidators; + _this.valueValidators = valueValidators; + return _this; } - ReportBarsValidator.prototype.validate = function (input, path, field) { + MapValidator.prototype.validate = function (input, path, field) { if (input == null) { return null; } @@ -5292,43 +5475,30 @@ return /******/ (function(modules) { // webpackBootstrap if (errors) { return errors; } - var fields = [ - { - field: "actionBar", - validators: [validator_1.Validators.actionBarValidator] + for (var key in input) { + if (input.hasOwnProperty(key)) { + var fieldsPath = (path ? path + "." : "") + field + "." + key; + for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { + var keyValidator = _a[_i]; + errors = keyValidator.validate(key, fieldsPath, field); + if (errors) { + return errors; + } + } + for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { + var valueValidator = _c[_b]; + errors = valueValidator.validate(input[key], fieldsPath, field); + if (errors) { + return errors; + } + } } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportBarsValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportBarsValidator = ReportBarsValidator; - var ActionBarValidator = /** @class */ (function (_super) { - __extends(ActionBarValidator, _super); - function ActionBarValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionBarValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + return null; }; - return ActionBarValidator; + return MapValidator; }(typeValidator_1.ObjectValidator)); - exports.ActionBarValidator = ActionBarValidator; + exports.MapValidator = MapValidator; /***/ }) @@ -6497,7 +6667,6 @@ return /******/ (function(modules) { // webpackBootstrap * @class Dashboard * @extends {embed.Embed} * @implements {IDashboardNode} - * @implements {IFilterable} */ var Dashboard = (function (_super) { __extends(Dashboard, _super); diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 0637ccbf..a3222a9d 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,9 +1,9 @@ /*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.2",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.6.0 | (c) 2016 Microsoft Corporation MIT */ -!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===nt.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?nt.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?nt.Advanced:nt.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function c(t){var r=e.Validators.visualSelectorValidator.validate(t);return r?r.map(p):void 0}function f(t){var r=e.Validators.slicerValidator.validate(t);return r?r.map(p):void 0}function v(t){var r=e.Validators.slicerStateValidator.validate(t);return r?r.map(p):void 0}function h(t){var r=e.Validators.playBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function y(t){var r=e.Validators.addBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function m(t){var r=e.Validators.applyBookmarkByNameRequestValidator.validate(t);return r?r.map(p):void 0}function V(t){var r=e.Validators.applyBookmarkStateRequestValidator.validate(t);return r?r.map(p):void 0}function g(t){var r=e.Validators.captureBookmarkRequestValidator.validate(t);return r?r.map(p):void 0}function w(t){var r=e.Validators.settingsValidator.validate(t);return r?r.map(p):void 0}function b(t){var r=e.Validators.reportPanesValidator.validate(t);return r?r.map(p):void 0}function P(t){var r=e.Validators.bookmarksPaneValidator.validate(t);return r?r.map(p):void 0}function S(t){var r=e.Validators.filtersPanesValidator.validate(t);return r?r.map(p):void 0}function T(t){var r=e.Validators.fieldsPanesValidator.validate(t);return r?r.map(p):void 0}function E(t){var r=e.Validators.pageNavigationPaneValidator.validate(t);return r?r.map(p):void 0}function O(t){var r=e.Validators.selectionPaneValidator.validate(t);return r?r.map(p):void 0}function _(t){var r=e.Validators.syncSlicersPaneValidator.validate(t);return r?r.map(p):void 0}function R(t){var r=e.Validators.visualizationsPanesValidator.validate(t);return r?r.map(p):void 0}function F(t){var r=e.Validators.customPageSizeValidator.validate(t);return r?r.map(p):void 0}function k(t){var r=e.Validators.extensionValidator.validate(t);return r?r.map(p):void 0}function C(t){var r=e.Validators.reportLoadValidator.validate(t);return r?r.map(p):void 0}function A(t){var r=e.Validators.reportCreateValidator.validate(t);return r?r.map(p):void 0}function x(t){var r=e.Validators.dashboardLoadValidator.validate(t);return r?r.map(p):void 0}function q(t){var r=e.Validators.tileLoadValidator.validate(t);return r?r.map(p):void 0}function M(t){var r=e.Validators.pageValidator.validate(t);return r?r.map(p):void 0}function I(t){var r=e.Validators.filtersValidator.validate(t);return r?r.map(p):void 0}function L(t){var r=e.Validators.saveAsParametersValidator.validate(t);return r?r.map(p):void 0}function j(t){var r=e.Validators.loadQnaValidator.validate(t);return r?r.map(p):void 0}function N(t){var r=e.Validators.qnaInterpretInputDataValidator.validate(t);return r?r.map(p):void 0}function D(t){var r=e.Validators.exportDataRequestValidator.validate(t);return r?r.map(p):void 0}function U(t){var r=e.Validators.visualHeaderValidator.validate(t);return r?r.map(p):void 0}function B(t){var r=e.Validators.visualSettingsValidator.validate(t);return r?r.map(p):void 0}function W(t){var r=e.Validators.commandsSettingsValidator.validate(t);return r?r.map(p):void 0}function H(t){var r=e.Validators.customThemeValidator.validate(t);return r?r.map(p):void 0}var z=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=e.Validators=void 0,e.Validators=r(1).Validators;var J;!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(J=e.TraceType||(e.TraceType={}));var Q;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Q=e.PageSizeType||(e.PageSizeType={}));var Y;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(Y=e.DisplayOption||(e.DisplayOption={}));var K;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(K=e.BackgroundType||(e.BackgroundType={}));var G;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(G=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var $;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}($=e.LayoutType||(e.LayoutType={}));var X;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(X=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var Z;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(Z=e.SectionVisibility||(e.SectionVisibility={}));var tt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(tt=e.Permissions||(e.Permissions={}));var et;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(et=e.ViewMode||(e.ViewMode={}));var rt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(rt=e.TokenType||(e.TokenType={}));var at;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(at=e.ContrastMode||(e.ContrastMode={}));var it;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(it=e.MenuLocation||(e.MenuLocation={}));var ot;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(ot=e.FiltersLevel||(e.FiltersLevel={}));var nt;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(nt=e.FilterType||(e.FilterType={}));var lt;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(lt=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var dt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(dt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var st=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=st;var ut=function(t){function e(r,a,i){var o=t.call(this,r,nt.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(st);e.NotSupportedFilter=ut;var pt=function(t){function e(r,a,i){var o=t.call(this,r,nt.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(st);e.IncludeExcludeFilter=pt;var ct=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(st);e.TopNFilter=ct;var ft=function(t){function e(r,a,i,o,n){var l=t.call(this,r,nt.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(st);e.RelativeDateFilter=ft;var vt=function(t){function e(r,a,i,o){var n=t.call(this,r,nt.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(st);e.RelativeTimeFilter=vt;var ht=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(st);e.AdvancedFilter=Vt,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var gt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(gt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var wt;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(wt=e.QnaMode||(e.QnaMode={}));var bt;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(bt=e.ExportDataType||(e.ExportDataType={}));var Pt;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Pt=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var St;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(St=e.SortDirection||(e.SortDirection={}));var Tt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=Tt;var Et=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(Tt);e.PageSelector=Et;var Ot=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(Tt);e.VisualSelector=Ot;var _t=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.visualType=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(Tt);e.VisualTypeSelector=_t;var Rt=function(t){function e(e){var r=t.call(this,Ot.schemaUrl)||this;return r.target=e,r}return z(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(Tt);e.SlicerTargetSelector=Rt;var Ft;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(Ft=e.CommandDisplayOption||(e.CommandDisplayOption={}));var kt;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(kt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Ct;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Ct=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.validateVisualSelector=c,e.validateSlicer=f,e.validateSlicerState=v,e.validatePlayBookmarkRequest=h,e.validateAddBookmarkRequest=y,e.validateApplyBookmarkByNameRequest=m,e.validateApplyBookmarkStateRequest=V,e.validateCaptureBookmarkRequest=g,e.validateSettings=w,e.validatePanes=b,e.validateBookmarksPane=P,e.validateFiltersPane=S,e.validateFieldsPane=T,e.validatePageNavigationPane=E,e.validateSelectionPane=O,e.validateSyncSlicersPane=_,e.validateVisualizationsPane=R,e.validateCustomPageSize=F,e.validateExtension=k,e.validateReportLoad=C,e.validateCreateReport=A,e.validateDashboardLoad=x,e.validateTileLoad=q,e.validatePage=M,e.validateFilter=I,e.validateSaveAsParameters=L,e.validateLoadQnaConfiguration=j,e.validateQnaInterpretInputData=N,e.validateExportDataRequest=D,e.validateVisualHeader=U,e.validateVisualSettings=B,e.validateCommandsSettings=W,e.validateCustomTheme=H},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(3),o=r(5),n=r(6),l=r(7),d=r(8),s=r(9),u=r(10),p=r(11),c=r(12),f=r(13),v=r(14),h=r(15),y=r(16),m=r(17),V=r(18),g=r(19),w=r(20),b=r(21),P=r(22),S=r(23),T=r(24),E=r(25),O=r(26),_=r(27);e.Validators={addBookmarkRequestValidator:new n.AddBookmarkRequestValidator,advancedFilterTypeValidator:new a.EnumValidator([0]),advancedFilterValidator:new l.AdvancedFilterValidator,anyArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator])]),anyFilterValidator:new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.IncludeExcludeFilterValidator,new l.NotSupportedFilterValidator,new l.RelativeDateFilterValidator,new l.TopNFilterValidator,new l.RelativeTimeFilterValidator]),anyValueValidator:new s.AnyOfValidator([new a.StringValidator,new a.NumberValidator,new a.BooleanValidator]),actionBarValidator:new _.ActionBarValidator,applyBookmarkByNameRequestValidator:new n.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new n.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new s.AnyOfValidator([new n.ApplyBookmarkByNameRequestValidator,new n.ApplyBookmarkStateRequestValidator]),backgroundValidator:new a.EnumValidator([0,1]),basicFilterTypeValidator:new a.EnumValidator([1]),basicFilterValidator:new l.BasicFilterValidator,booleanArrayValidator:new a.BooleanArrayValidator,booleanValidator:new a.BooleanValidator,bookmarksPaneValidator:new O.BookmarksPaneValidator,captureBookmarkOptionsValidator:new n.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new n.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new a.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),commandExtensionValidator:new i.CommandExtensionValidator,commandsSettingsArrayValidator:new a.ArrayValidator([new S.CommandsSettingsValidator]),commandsSettingsValidator:new S.CommandsSettingsValidator,conditionItemValidator:new l.ConditionItemValidator,contrastModeValidator:new a.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new a.EnumValidator([0,1,2]),customLayoutValidator:new V.CustomLayoutValidator,customPageSizeValidator:new v.CustomPageSizeValidator,customThemeValidator:new T.CustomThemeValidator,dashboardLoadValidator:new c.DashboardLoadValidator,datasetBindingValidator:new E.DatasetBindingValidator,displayStateModeValidator:new a.EnumValidator([0,1]),displayStateValidator:new V.DisplayStateValidator,exportDataRequestValidator:new g.ExportDataRequestValidator,extensionArrayValidator:new a.ArrayValidator([new i.ExtensionValidator]),extensionPointsValidator:new i.ExtensionPointsValidator,extensionValidator:new i.ExtensionValidator,fieldRequiredValidator:new d.FieldRequiredValidator,fieldsPaneValidator:new O.FieldsPaneValidator,filterColumnTargetValidator:new l.FilterColumnTargetValidator,filterConditionsValidator:new a.ArrayValidator([new l.ConditionItemValidator]),filterHierarchyTargetValidator:new l.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new l.FilterMeasureTargetValidator,filterTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator]),filtersArrayValidator:new a.ArrayValidator([new s.AnyOfValidator([new l.BasicFilterValidator,new l.AdvancedFilterValidator,new l.RelativeDateFilterValidator,new l.RelativeTimeFilterValidator])]),filtersValidator:new l.FilterValidator,filtersPaneValidator:new O.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new a.EnumValidator([0,1,2]),includeExcludeFilterValidator:new l.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new a.EnumValidator([3]),layoutTypeValidator:new a.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new i.MenuExtensionValidator,menuLocationValidator:new a.EnumValidator([0,1]),notSupportedFilterTypeValidator:new a.EnumValidator([2]),notSupportedFilterValidator:new l.NotSupportedFilterValidator,numberArrayValidator:new a.NumberArrayValidator,numberValidator:new a.NumberValidator,pageLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.VisualLayoutValidator]),pageNavigationPaneValidator:new O.PageNavigationPaneValidator,pageNavigationPositionValidator:new a.EnumValidator([0,1]),pageSizeTypeValidator:new a.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new v.PageSizeValidator,pageValidator:new v.PageValidator,pageViewFieldValidator:new v.PageViewFieldValidator,pagesLayoutValidator:new m.MapValidator([new a.StringValidator],[new V.PageLayoutValidator]),reportBarsValidator:new _.ReportBarsValidator,reportPanesValidator:new O.ReportPanesValidator,permissionsValidator:new a.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new n.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new a.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new a.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new a.EnumValidator([4]),relativeDateFilterValidator:new l.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new a.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new a.EnumValidator([7]),relativeTimeFilterValidator:new l.RelativeTimeFilterValidator,reportCreateValidator:new p.ReportCreateValidator,reportLoadValidator:new u.ReportLoadValidator,saveAsParametersValidator:new y.SaveAsParametersValidator,selectionPaneValidator:new O.SelectionPaneValidator,settingsValidator:new o.SettingsValidator,singleCommandSettingsValidator:new S.SingleCommandSettingsValidator,slicerSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new s.AnyOfValidator([new l.FilterColumnTargetValidator,new l.FilterHierarchyTargetValidator,new l.FilterMeasureTargetValidator,new l.FilterKeyColumnsTargetValidator,new l.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new a.StringArrayValidator,stringValidator:new a.StringValidator,syncSlicersPaneValidator:new O.SyncSlicersPaneValidator,tileLoadValidator:new f.TileLoadValidator,tokenTypeValidator:new a.EnumValidator([0,1]),topNFilterTypeValidator:new a.EnumValidator([5]),topNFilterValidator:new l.TopNFilterValidator,viewModeValidator:new a.EnumValidator([0,1]),visualCommandSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new s.AnyOfValidator([new w.VisualSelectorValidator,new w.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new P.VisualHeaderSettingsValidator,visualHeaderValidator:new P.VisualHeaderValidator,visualHeadersValidator:new a.ArrayValidator([new P.VisualHeaderValidator]),visualizationsPaneValidator:new O.VisualizationsPaneValidator,visualLayoutValidator:new V.VisualLayoutValidator,visualSelectorValidator:new w.VisualSelectorValidator,visualSettingsValidator:new P.VisualSettingsValidator,visualTypeSelectorValidator:new w.VisualTypeSelectorValidator}},function(t,e){var r=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.NumberArrayValidator=e.BooleanArrayValidator=e.StringArrayValidator=e.EnumValidator=e.SchemaValidator=e.ValueValidator=e.NumberValidator=e.BooleanValidator=e.StringValidator=e.TypeValidator=e.ArrayValidator=e.ObjectValidator=void 0;var a=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?null:"object"!=typeof t||Array.isArray(t)?[{message:void 0!==r?r+" must be an object":"input must be an object",path:e,keyword:"type"}]:null},t}();e.ObjectValidator=a;var i=function(){function t(t){this.itemValidators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;if(!Array.isArray(t))return[{message:r+" property is invalid",path:(e?e+".":"")+r,keyword:"type"}];for(var a=0;a>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.2",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ +!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===ct.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?ct.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?ct.Advanced:ct.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){return t&&!c(t)}function c(t){return t&&!!t.groupName}function f(t){return t&&!v(t)}function v(t){return Array.isArray(t)}function h(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function y(t){var e=X.Validators.visualSelectorValidator.validate(t);return e?e.map(h):void 0}function V(t){var e=X.Validators.slicerValidator.validate(t);return e?e.map(h):void 0}function m(t){var e=X.Validators.slicerStateValidator.validate(t);return e?e.map(h):void 0}function g(t){var e=X.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(h):void 0}function w(t){var e=X.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(h):void 0}function b(t){var e=X.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(h):void 0}function P(t){var e=X.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(h):void 0}function S(t){var e=X.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(h):void 0}function E(t){var e=X.Validators.settingsValidator.validate(t);return e?e.map(h):void 0}function T(t){var e=X.Validators.reportPanesValidator.validate(t);return e?e.map(h):void 0}function O(t){var e=X.Validators.bookmarksPaneValidator.validate(t);return e?e.map(h):void 0}function _(t){var e=X.Validators.filtersPaneValidator.validate(t);return e?e.map(h):void 0}function F(t){var e=X.Validators.fieldsPaneValidator.validate(t);return e?e.map(h):void 0}function R(t){var e=X.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(h):void 0}function k(t){var e=X.Validators.selectionPaneValidator.validate(t);return e?e.map(h):void 0}function A(t){var e=X.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(h):void 0}function C(t){var e=X.Validators.visualizationsPaneValidator.validate(t);return e?e.map(h):void 0}function x(t){var e=X.Validators.customPageSizeValidator.validate(t);return e?e.map(h):void 0}function M(t){var e=X.Validators.extensionValidator.validate(t);return e?e.map(h):void 0}function q(t){var e=X.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(h):void 0}function I(t){var e=X.Validators.reportLoadValidator.validate(t);return e?e.map(h):void 0}function L(t){var e=X.Validators.reportCreateValidator.validate(t);return e?e.map(h):void 0}function j(t){var e=X.Validators.dashboardLoadValidator.validate(t);return e?e.map(h):void 0}function N(t){var e=X.Validators.tileLoadValidator.validate(t);return e?e.map(h):void 0}function D(t){var e=X.Validators.pageValidator.validate(t);return e?e.map(h):void 0}function U(t){var e=X.Validators.filtersValidator.validate(t);return e?e.map(h):void 0}function B(t){var e=X.Validators.saveAsParametersValidator.validate(t);return e?e.map(h):void 0}function W(t){var e=X.Validators.loadQnaValidator.validate(t);return e?e.map(h):void 0}function H(t){var e=X.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(h):void 0}function z(t){var e=X.Validators.exportDataRequestValidator.validate(t);return e?e.map(h):void 0}function J(t){var e=X.Validators.visualHeaderValidator.validate(t);return e?e.map(h):void 0}function G(t){var e=X.Validators.visualSettingsValidator.validate(t);return e?e.map(h):void 0}function Q(t){var e=X.Validators.commandsSettingsValidator.validate(t);return e?e.map(h):void 0}function Y(t){var e=X.Validators.customThemeValidator.validate(t);return e?e.map(h):void 0}var K=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var $,X=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}($=e.TraceType||(e.TraceType={}));var Z;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Z=e.PageSizeType||(e.PageSizeType={}));var tt;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(tt=e.DisplayOption||(e.DisplayOption={}));var et;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(et=e.BackgroundType||(e.BackgroundType={}));var rt;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(rt=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var at;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(at=e.LayoutType||(e.LayoutType={}));var it;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(it=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var ot;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(ot=e.SectionVisibility||(e.SectionVisibility={}));var nt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(nt=e.Permissions||(e.Permissions={}));var lt;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(lt=e.ViewMode||(e.ViewMode={}));var dt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(dt=e.TokenType||(e.TokenType={}));var st;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(st=e.ContrastMode||(e.ContrastMode={}));var ut;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(ut=e.MenuLocation||(e.MenuLocation={}));var pt;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(pt=e.FiltersLevel||(e.FiltersLevel={}));var ct;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(ct=e.FilterType||(e.FilterType={}));var ft;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(ft=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var vt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(vt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var ht=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=ht;var yt=function(t){function e(r,a,i){var o=t.call(this,r,ct.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(ht);e.NotSupportedFilter=yt;var Vt=function(t){function e(r,a,i){var o=t.call(this,r,ct.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(ht);e.IncludeExcludeFilter=Vt;var mt=function(t){function e(r,a,i,o){var n=t.call(this,r,ct.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(ht);e.TopNFilter=mt;var gt=function(t){function e(r,a,i,o,n){var l=t.call(this,r,ct.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(ht);e.RelativeDateFilter=gt;var wt=function(t){function e(r,a,i,o){var n=t.call(this,r,ct.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(ht);e.RelativeTimeFilter=wt;var bt=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,d=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(ht);e.AdvancedFilter=Et,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var Tt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(Tt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var Ot;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(Ot=e.QnaMode||(e.QnaMode={}));var _t;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(_t=e.ExportDataType||(e.ExportDataType={}));var Ft;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Ft=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var Rt;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(Rt=e.SortDirection||(e.SortDirection={}));var kt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=kt;var At=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(kt);e.PageSelector=At;var Ct=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(kt);e.VisualSelector=Ct;var xt=function(t){function e(e){var r=t.call(this,Ct.schemaUrl)||this;return r.visualType=e,r}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(kt);e.VisualTypeSelector=xt;var Mt=function(t){function e(e){var r=t.call(this,Ct.schemaUrl)||this;return r.target=e,r}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(kt);e.SlicerTargetSelector=Mt;var qt;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(qt=e.CommandDisplayOption||(e.CommandDisplayOption={}));var It;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(It=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Lt;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Lt=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=p,e.isGroupedMenuExtension=c,e.isIExtensions=f,e.isIExtensionArray=v,e.validateVisualSelector=y,e.validateSlicer=V,e.validateSlicerState=m,e.validatePlayBookmarkRequest=g,e.validateAddBookmarkRequest=w,e.validateApplyBookmarkByNameRequest=b,e.validateApplyBookmarkStateRequest=P,e.validateCaptureBookmarkRequest=S,e.validateSettings=E,e.validatePanes=T,e.validateBookmarksPane=O,e.validateFiltersPane=_,e.validateFieldsPane=F,e.validatePageNavigationPane=R,e.validateSelectionPane=k,e.validateSyncSlicersPane=A,e.validateVisualizationsPane=C,e.validateCustomPageSize=x,e.validateExtension=M,e.validateMenuGroupExtension=q,e.validateReportLoad=I,e.validateCreateReport=L,e.validateDashboardLoad=j,e.validateTileLoad=N,e.validatePage=D,e.validateFilter=U,e.validateSaveAsParameters=B,e.validateLoadQnaConfiguration=W,e.validateQnaInterpretInputData=H,e.validateExportDataRequest=z,e.validateVisualHeader=J,e.validateVisualSettings=G,e.validateCommandsSettings=Q,e.validateCustomTheme=Y},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),d=r(9),s=r(10),u=r(11),p=r(12),c=r(13),f=r(14),v=r(15),h=r(16),y=r(17),V=r(18),m=r(19),g=r(20),w=r(21),b=r(22),P=r(23),S=r(24),E=r(25),T=r(26),O=r(27),_=r(28),F=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new F.EnumValidator([0]),advancedFilterValidator:new p.AdvancedFilterValidator,anyArrayValidator:new F.ArrayValidator([new E.AnyOfValidator([new F.StringValidator,new F.NumberValidator,new F.BooleanValidator])]),anyFilterValidator:new E.AnyOfValidator([new p.BasicFilterValidator,new p.AdvancedFilterValidator,new p.IncludeExcludeFilterValidator,new p.NotSupportedFilterValidator,new p.RelativeDateFilterValidator,new p.TopNFilterValidator,new p.RelativeTimeFilterValidator]),anyValueValidator:new E.AnyOfValidator([new F.StringValidator,new F.NumberValidator,new F.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new E.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new F.EnumValidator([0,1]),basicFilterTypeValidator:new F.EnumValidator([1]),basicFilterValidator:new p.BasicFilterValidator,booleanArrayValidator:new F.BooleanArrayValidator,booleanValidator:new F.BooleanValidator,bookmarksPaneValidator:new v.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new F.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new F.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new F.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new p.ConditionItemValidator,contrastModeValidator:new F.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new F.EnumValidator([0,1,2]),customLayoutValidator:new c.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new d.DatasetBindingValidator,displayStateModeValidator:new F.EnumValidator([0,1]),displayStateValidator:new c.DisplayStateValidator,exportDataRequestValidator:new s.ExportDataRequestValidator,extensionArrayValidator:new F.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new E.AnyOfValidator([new F.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new T.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new v.FieldsPaneValidator,filterColumnTargetValidator:new p.FilterColumnTargetValidator,filterConditionsValidator:new F.ArrayValidator([new p.ConditionItemValidator]),filterHierarchyTargetValidator:new p.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new p.FilterMeasureTargetValidator,filterTargetValidator:new E.AnyOfValidator([new p.FilterColumnTargetValidator,new p.FilterHierarchyTargetValidator,new p.FilterMeasureTargetValidator]),filtersArrayValidator:new F.ArrayValidator([new E.AnyOfValidator([new p.BasicFilterValidator,new p.AdvancedFilterValidator,new p.RelativeDateFilterValidator,new p.RelativeTimeFilterValidator])]),filtersValidator:new p.FilterValidator,filtersPaneValidator:new v.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new F.EnumValidator([0,1,2]),includeExcludeFilterValidator:new p.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new F.EnumValidator([3]),layoutTypeValidator:new F.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new E.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new F.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new F.EnumValidator([0,1]),notSupportedFilterTypeValidator:new F.EnumValidator([2]),notSupportedFilterValidator:new p.NotSupportedFilterValidator,numberArrayValidator:new F.NumberArrayValidator,numberValidator:new F.NumberValidator,pageLayoutValidator:new _.MapValidator([new F.StringValidator],[new c.VisualLayoutValidator]),pageNavigationPaneValidator:new v.PageNavigationPaneValidator,pageNavigationPositionValidator:new F.EnumValidator([0,1]),pageSizeTypeValidator:new F.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new _.MapValidator([new F.StringValidator],[new c.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new v.ReportPanesValidator,permissionsValidator:new F.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new F.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new F.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new F.EnumValidator([4]),relativeDateFilterValidator:new p.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new F.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new F.EnumValidator([7]),relativeTimeFilterValidator:new p.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new V.ReportLoadValidator,saveAsParametersValidator:new m.SaveAsParametersValidator,selectionPaneValidator:new v.SelectionPaneValidator,settingsValidator:new w.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new E.AnyOfValidator([new p.FilterColumnTargetValidator,new p.FilterHierarchyTargetValidator,new p.FilterMeasureTargetValidator,new p.FilterKeyColumnsTargetValidator,new p.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new F.StringArrayValidator,stringValidator:new F.StringValidator,syncSlicersPaneValidator:new v.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new F.EnumValidator([0,1]),topNFilterTypeValidator:new F.EnumValidator([5]),topNFilterValidator:new p.TopNFilterValidator,viewModeValidator:new F.EnumValidator([0,1]),visualCommandSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new S.VisualHeaderSettingsValidator,visualHeaderValidator:new S.VisualHeaderValidator,visualHeadersValidator:new F.ArrayValidator([new S.VisualHeaderValidator]),visualizationsPaneValidator:new v.VisualizationsPaneValidator,visualLayoutValidator:new c.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new S.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var i=r(3),o=r(4),n=r(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var o=t.prototype.validate.call(this,e,r,a);if(o)return o;var l=[{field:"actionBar",validators:[n.Validators.actionBarValidator]}],d=new i.MultipleFieldsValidator(l);return d.validate(e,r,a)},e}(o.ObjectValidator);e.ReportBarsValidator=l;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var o=t.prototype.validate.call(this,e,r,a);if(o)return o;var l=[{field:"visible",validators:[n.Validators.booleanValidator]}],d=new i.MultipleFieldsValidator(l);return d.validate(e,r,a)},e}(o.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i2&&"[]"===n.slice(l-2)&&(d=!0,n=n.slice(0,l-2),r[n]||(r[n]=[])),i=o[1]?w(o[1]):""),d?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(a=t.indexOf("?"),a!==-1){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r2&&"[]"===n.slice(l-2)&&(d=!0,n=n.slice(0,l-2),r[n]||(r[n]=[])),i=o[1]?w(o[1]):""),d?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(a=t.indexOf("?"),a!==-1){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;rthis.config; + const config = this.config; this.createConfig = { accessToken: config.accessToken, diff --git a/src/dashboard.ts b/src/dashboard.ts index e79881a9..b32e54f7 100644 --- a/src/dashboard.ts +++ b/src/dashboard.ts @@ -21,7 +21,6 @@ export interface IDashboardNode { * @class Dashboard * @extends {embed.Embed} * @implements {IDashboardNode} - * @implements {IFilterable} */ export class Dashboard extends embed.Embed implements IDashboardNode { /** @hidden */ @@ -76,7 +75,7 @@ export class Dashboard extends embed.Embed implements IDashboardNode { * @returns {string} */ getId(): string { - let config = this.config; + let config = this.config; const dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); if (typeof dashboardId !== 'string' || dashboardId.length === 0) { @@ -92,7 +91,7 @@ export class Dashboard extends embed.Embed implements IDashboardNode { * @hidden */ validate(baseConfig: embed.IEmbedConfigurationBase): models.IError[] { - const config = baseConfig as embed.IEmbedConfiguration; + const config = baseConfig as embed.IDashboardEmbedConfiguration; let error = models.validateDashboardLoad(config); return error ? error : this.ValidatePageView(config.pageView); } @@ -108,7 +107,7 @@ export class Dashboard extends embed.Embed implements IDashboardNode { } // Populate dashboard id into config object. - (this.config).id = this.getId(); + (this.config).id = this.getId(); } /** diff --git a/src/embed.ts b/src/embed.ts index dcdd47e6..bea6d11a 100644 --- a/src/embed.ts +++ b/src/embed.ts @@ -22,92 +22,29 @@ declare global { } } -/** - * Prepare configuration for Power BI embed components. - * - * @export - * @interface IBootstrapEmbedConfiguration - */ -export interface IBootstrapEmbedConfiguration { - hostname?: string; - embedUrl?: string; - settings?: ISettings; - uniqueId?: string; - type?: string; - groupId?: string; - bootstrapped?: boolean; -} +//TODO: Require a specific version of powerbi-models in package.json +export type IBootstrapEmbedConfiguration = models.IBootstrapEmbedConfiguration; -/** - * Base Configuration settings for Power BI embed components - * - * @export - * @interface IEmbedConfigurationBase - * @extends IBootstrapEmbedConfiguration - */ -export interface IEmbedConfigurationBase extends IBootstrapEmbedConfiguration { - accessToken?: string; - tokenType?: models.TokenType; -} +export type IEmbedConfigurationBase = models.IEmbedConfigurationBase; // TODO: Re-use ILoadConfiguration interface to prevent duplicating properties. -// Current issue is that they are optional when embedding since they can be specificed as attributes but they are required when loading. -/** - * Configuration settings for Power BI embed components - * - * @export - * @interface IEmbedConfiguration - */ -export interface IEmbedConfiguration extends IEmbedConfigurationBase { - id?: string; - settings?: IEmbedSettings; - pageName?: string; - filters?: models.IFilter[]; - pageView?: models.PageView; - datasetId?: string; - permissions?: models.Permissions; - viewMode?: models.ViewMode; - action?: string; - dashboardId?: string; - height?: number; - width?: number; - theme?: models.IReportTheme; - slicers?: models.ISlicer[]; - bookmark?: models.IApplyBookmarkRequest; - datasetBinding?: models.IDatasetBinding; - contrastMode?: models.ContrastMode; -} +export type IEmbedConfiguration = models.IEmbedConfiguration; -export interface IVisualEmbedConfiguration extends IEmbedConfiguration { - visualName: string; -} +export type IVisualEmbedConfiguration = models.IVisualEmbedConfiguration; -/** - * Configuration settings for Power BI Q&A embed component - * - * @export - * @interface IEmbedConfiguration - */ -export interface IQnaEmbedConfiguration extends IEmbedConfigurationBase { - datasetIds: string[]; - question?: string; - viewMode?: models.QnaMode; -} +export type IReportEmbedConfiguration = models.IReportEmbedConfiguration; -export interface ILocaleSettings { - language?: string; - formatLocale?: string; -} +export type IDashboardEmbedConfiguration = models.IDashboardEmbedConfiguration ; -export interface ISettings { - localeSettings?: ILocaleSettings; -} +export type ITileEmbedConfiguration = models.ITileEmbedConfiguration; -export interface IEmbedSettings extends models.ISettings, ISettings { -} +export type IQnaEmbedConfiguration = models.IQnaEmbedConfiguration; -export interface IQnaSettings extends models.IQnaSettings, ISettings { -} +export type ILocaleSettings = models.ILocaleSettings; + +export type IQnaSettings = models.IQnaSettings; + +export type IEmbedSettings = models.ISettings; /** @hidden */ export interface IInternalEventHandler { @@ -570,10 +507,10 @@ export abstract class Embed { * Adds locale parameters to embedUrl * * @private - * @param {IEmbedConfiguration} config + * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config * @hidden */ - private addLocaleToEmbedUrl(config: IEmbedConfiguration): void { + private addLocaleToEmbedUrl(config: IEmbedConfiguration | models.ICommonEmbedConfiguration): void { if (!config.settings) { return; } diff --git a/src/powerbi-client.ts b/src/powerbi-client.ts index c53de9b8..bff6fa8c 100644 --- a/src/powerbi-client.ts +++ b/src/powerbi-client.ts @@ -25,6 +25,9 @@ export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, + IReportEmbedConfiguration, + IDashboardEmbedConfiguration, + ITileEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings, diff --git a/src/report.ts b/src/report.ts index 75405a04..b919106d 100644 --- a/src/report.ts +++ b/src/report.ts @@ -5,7 +5,7 @@ import * as utils from './util'; import * as errors from './errors'; import { IFilterable } from './ifilterable'; import { Page } from './page'; -import { IReportLoadConfiguration } from 'powerbi-models'; +import { IReportLoadConfiguration, IReportEmbedConfiguration } from 'powerbi-models'; import { BookmarksManager } from './bookmarksManager'; /** @@ -17,7 +17,7 @@ import { BookmarksManager } from './bookmarksManager'; export interface IReportNode { iframe: HTMLIFrameElement; service: service.IService; - config: embed.IEmbedConfiguration + config: embed.IEmbedConfiguration | IReportEmbedConfiguration } /** @@ -54,7 +54,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * @hidden */ constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean, iframe?: HTMLIFrameElement) { - const config = baseConfig; + const config = baseConfig; super(service, element, config, iframe, phasedRender, isBootstrap); this.loadPath = "/report/load"; this.phasedLoadPath = "/report/prepare"; @@ -101,7 +101,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - render(config?: IReportLoadConfiguration): Promise { + render(config?: IReportLoadConfiguration | embed.IReportEmbedConfiguration): Promise { return this.service.hpm.post(`/report/render`, config, { uid: this.config.uniqueId }, this.iframe.contentWindow) .then(response => { return response.body; @@ -211,7 +211,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * @returns {string} */ getId(): string { - let config = this.config; + let config = this.config; const reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); if (typeof reportId !== 'string' || reportId.length === 0) { @@ -401,7 +401,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * @returns {void} */ configChanged(isBootstrap: boolean): void { - let config = this.config; + let config = this.config; if (this.isMobileSettings(config.settings)) config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); diff --git a/src/service.ts b/src/service.ts index 28be3bdc..24c3c3a0 100644 --- a/src/service.ts +++ b/src/service.ts @@ -74,6 +74,8 @@ export interface IService { hpm: hpm.HttpPostMessage; } +export type IComponentEmbedConfiguration = embed.IReportEmbedConfiguration | embed.IDashboardEmbedConfiguration | embed.ITileEmbedConfiguration| embed.IVisualEmbedConfiguration | embed.IQnaEmbedConfiguration; + /** * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application * @@ -244,7 +246,7 @@ export class Service implements IService { * @param {embed.IEmbedConfiguration} [config={}] * @returns {embed.Embed} */ - createReport(element: HTMLElement, config: embed.IEmbedConfiguration): embed.Embed { + createReport(element: HTMLElement, config: embed.IEmbedConfiguration | models.IReportCreateConfiguration): embed.Embed { config.type = 'create'; let powerBiElement = element; const component = new Create(this, powerBiElement, config); @@ -278,7 +280,7 @@ export class Service implements IService { * @param {embed.IEmbedConfigurationBase} [config={}] * @returns {embed.Embed} */ - embed(element: HTMLElement, config: embed.IEmbedConfigurationBase = {}): embed.Embed { + embed(element: HTMLElement, config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase = {}): embed.Embed { return this.embedInternal(element, config); } @@ -292,7 +294,7 @@ export class Service implements IService { * @param {embed.IEmbedConfigurationBase} [config={}] * @returns {embed.Embed} */ - load(element: HTMLElement, config: embed.IEmbedConfigurationBase = {}): embed.Embed { + load(element: HTMLElement, config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase = {}): embed.Embed { return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); } @@ -302,12 +304,12 @@ export class Service implements IService { * @param {HTMLElement} element * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. */ - bootstrap(element: HTMLElement, config: embed.IBootstrapEmbedConfiguration): embed.Embed { + bootstrap(element: HTMLElement, config: IComponentEmbedConfiguration | embed.IBootstrapEmbedConfiguration): embed.Embed { return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); } /** @hidden */ - embedInternal(element: HTMLElement, config: embed.IEmbedConfigurationBase = {}, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed { + embedInternal(element: HTMLElement, config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase = {}, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed { let component: embed.Embed; let powerBiElement = element; @@ -348,7 +350,7 @@ export class Service implements IService { * @returns {embed.Embed} * @hidden */ - private embedNew(element: IPowerBiElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed { + private embedNew(element: IPowerBiElement, config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed { const componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); if (!componentType) { throw new Error(`Attempted to embed using config ${JSON.stringify(config)} on element ${element.outerHTML}, but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '${embed.Embed.typeAttribute}="${Report.type.toLowerCase()}"'.`); @@ -378,7 +380,7 @@ export class Service implements IService { * @returns {embed.Embed} * @hidden */ - private embedExisting(element: IPowerBiElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean): embed.Embed { + private embedExisting(element: IPowerBiElement, config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, phasedRender?: boolean): embed.Embed { const component = utils.find(x => x.element === element, this.embeds); if (!component) { throw new Error(`Attempted to embed using config ${JSON.stringify(config)} on element ${element.outerHTML} which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.`); @@ -560,7 +562,7 @@ export class Service implements IService { * @param {embed.IEmbedConfigurationBase} [config={}] * @param {HTMLElement} [element=undefined] */ - preload(config: embed.IEmbedConfigurationBase, element?: HTMLElement) { + preload(config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, element?: HTMLElement) { var iframeContent = document.createElement("iframe"); iframeContent.setAttribute("style", "display:none;"); iframeContent.setAttribute("src", config.embedUrl); diff --git a/src/tile.ts b/src/tile.ts index 11afb6e8..45781221 100644 --- a/src/tile.ts +++ b/src/tile.ts @@ -19,7 +19,7 @@ export class Tile extends embed.Embed { * @hidden */ constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean) { - let config = baseConfig; + let config = baseConfig; super(service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); this.loadPath = "/tile/load"; Array.prototype.push.apply(this.allowedEvents, Tile.allowedEvents); @@ -31,7 +31,7 @@ export class Tile extends embed.Embed { * @returns {string} */ getId(): string { - let config = this.config; + let config = this.config; const tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); if (typeof tileId !== 'string' || tileId.length === 0) { @@ -45,7 +45,7 @@ export class Tile extends embed.Embed { * Validate load configuration. */ validate(config: embed.IEmbedConfigurationBase): models.IError[] { - let embedConfig = config; + let embedConfig = config; return models.validateTileLoad(embedConfig); } @@ -60,7 +60,7 @@ export class Tile extends embed.Embed { } // Populate tile id into config object. - (this.config).id = this.getId(); + (this.config).id = this.getId(); } /** From a721ad036ecde409de20611bc10384aab23d4efa Mon Sep 17 00:00:00 2001 From: Parth Mangukiya Date: Fri, 4 Dec 2020 05:37:17 +0000 Subject: [PATCH 11/23] Merged PR 125682: Resolve npm audit vulnerabilities, TS v3, migrated to @types ## Changes in this PR 1. Resolved all npm audit vulnerabilities (except 1 low severity vulnerability in _gulp-gh-pages_, no fix available for that) 1. Upgraded to TS 3.9 1. Migrated from typings to @types 1. Used async/await to align with the return types of methods 1. Minor docs fixes 1. Fixed types of all methods Related work items: #323592, #323972, #326488, #327505, #330227, #331107, #331778, #331837, #459272, #459826, #460523, #461075, #462110, #462652, #463184, #463185, #463806, #463807, #464436, #468356, #468867 --- dist/powerbi-client.d.ts | 147 +- dist/powerbi.js | 17706 +++++++++++++++++++---------------- dist/powerbi.min.js | 19 +- gulpfile.js | 36 +- package.json | 42 +- src/bookmarksManager.ts | 72 +- src/config.ts | 2 +- src/create.ts | 4 +- src/embed.ts | 118 +- src/ifilterable.ts | 10 +- src/page.ts | 95 +- src/qna.ts | 16 +- src/report.ts | 250 +- src/util.ts | 13 +- src/visual.ts | 83 +- src/visualDescriptor.ts | 94 +- test/test.spec.ts | 30 +- tsconfig.json | 5 - typings.json | 11 - webpack.config.js | 4 +- webpack.test.config.js | 17 +- webpack.test.tsconfig.json | 5 - 22 files changed, 10010 insertions(+), 8769 deletions(-) delete mode 100644 typings.json diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 0b4b35cd..8a49ada6 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.0 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** @@ -117,14 +117,18 @@ declare module "errors" { declare module "embed" { import * as service from "service"; import * as models from 'powerbi-models'; - global { + global { interface Document { mozCancelFullScreen: any; msExitFullscreen: any; + webkitExitFullscreen: void; } interface HTMLIFrameElement { mozRequestFullScreen: Function; msRequestFullscreen: Function; + webkitRequestFullscreen: { + (): void; + }; } } export type IBootstrapEmbedConfiguration = models.IBootstrapEmbedConfiguration; @@ -389,7 +393,7 @@ declare module "embed" { * @returns {string} * @hidden */ - private getAccessToken(globalAccessToken); + private getAccessToken; /** * Populate config for create and load * @@ -405,7 +409,7 @@ declare module "embed" { * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config * @hidden */ - private addLocaleToEmbedUrl(config); + private addLocaleToEmbedUrl; /** * Gets an embed url from the first available location: options, attribute. * @@ -413,11 +417,11 @@ declare module "embed" { * @returns {string} * @hidden */ - private getEmbedUrl(isBootstrap); + private getEmbedUrl; /** * @hidden */ - private getDefaultEmbedUrl(hostname); + private getDefaultEmbedUrl; /** * Gets a unique ID from the first available location: options, attribute. * If neither is provided generate a unique string. @@ -426,7 +430,7 @@ declare module "embed" { * @returns {string} * @hidden */ - private getUniqueId(); + private getUniqueId; /** * Gets the group ID from the first available location: options, embeddedUrl. * @@ -434,7 +438,7 @@ declare module "embed" { * @returns {string} * @hidden */ - private getGroupId(); + private getGroupId; /** * Gets the report ID from the first available location: options, attribute. * @@ -475,7 +479,7 @@ declare module "embed" { * @returns {boolean} * @hidden */ - private isFullscreen(iframe); + private isFullscreen; /** * Validate load and create configuration. * @@ -486,7 +490,7 @@ declare module "embed" { * Sets Iframe for embed * @hidden */ - private setIframe(isLoad, phasedRender?, isBootstrap?); + private setIframe; /** * Set the component title for accessibility. In case of iframes, this method will change the iframe title. */ @@ -513,11 +517,12 @@ declare module "embed" { * Sends the config for front load calls, after 'ready' message is received from the iframe * @hidden */ - private frontLoadSendConfig(config); + private frontLoadSendConfig; } } declare module "ifilterable" { import * as models from 'powerbi-models'; + import { IHttpPostMessageResponse } from 'http-post-message'; /** * Decorates embed components that support filters * Examples include reports and pages @@ -536,21 +541,22 @@ declare module "ifilterable" { * Replaces all filters on the current object with the specified filter values. * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise; + setFilters(filters: models.IFilter[]): Promise>; /** * Removes all filters from the current object. * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise; + removeFilters(): Promise>; } } declare module "visualDescriptor" { import * as models from 'powerbi-models'; import { IFilterable } from "ifilterable"; import { IPageNode } from "page"; + import { IHttpPostMessageResponse } from 'http-post-message'; /** * A Visual node within a report hierarchy * @@ -624,9 +630,9 @@ declare module "visualDescriptor" { * visual.removeFilters(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise; + removeFilters(): Promise>; /** * Sets the filters on the current visual to 'filters'. * @@ -636,9 +642,9 @@ declare module "visualDescriptor" { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise; + setFilters(filters: models.IFilter[]): Promise>; /** * Exports Visual data. * Can export up to 30K rows. @@ -661,7 +667,7 @@ declare module "visualDescriptor" { * .then(() => { ... }); * ``` */ - setSlicerState(state: models.ISlicerState): Promise; + setSlicerState(state: models.ISlicerState): Promise>; /** * Get slicer state. * Works only for visuals of type slicer. @@ -690,10 +696,11 @@ declare module "visualDescriptor" { * .then(() => { ... }); * ``` */ - sortBy(request: models.ISortByVisualRequest): Promise; + sortBy(request: models.ISortByVisualRequest): Promise>; } } declare module "page" { + import { IHttpPostMessageResponse } from 'http-post-message'; import { IFilterable } from "ifilterable"; import { IReportNode } from "report"; import { VisualDescriptor } from "visualDescriptor"; @@ -799,9 +806,9 @@ declare module "page" { * page.removeFilters(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise; + removeFilters(): Promise>; /** * Makes the current page the active page of the report. * @@ -809,9 +816,9 @@ declare module "page" { * page.setActive(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - setActive(): Promise; + setActive(): Promise>; /** * Sets all filters on the current page. * @@ -821,9 +828,9 @@ declare module "page" { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise; + setFilters(filters: models.IFilter[]): Promise>; /** * Set displayName to the current page. * @@ -831,9 +838,9 @@ declare module "page" { * page.setName(displayName); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - setDisplayName(displayName: string): Promise; + setDisplayName(displayName: string): Promise>; /** * Gets all the visuals on the page. * @@ -866,6 +873,7 @@ declare module "report" { import { Page } from "page"; import { IReportLoadConfiguration, IReportEmbedConfiguration } from 'powerbi-models'; import { BookmarksManager } from "bookmarksManager"; + import { IHttpPostMessageResponse } from 'http-post-message'; /** * A Report node within a report hierarchy * @@ -1029,9 +1037,9 @@ declare module "report" { * report.removeFilters(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise; + removeFilters(): Promise>; /** * Sets the active page of the report. * @@ -1041,9 +1049,9 @@ declare module "report" { * ``` * * @param {string} pageName - * @returns {Promise} + * @returns {Promise>} */ - setPage(pageName: string): Promise; + setPage(pageName: string): Promise>; /** * Sets filters at the report level. * @@ -1059,9 +1067,9 @@ declare module "report" { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise; + setFilters(filters: models.IFilter[]): Promise>; /** * Updates visibility settings for the filter pane and the page navigation pane. * @@ -1076,9 +1084,9 @@ declare module "report" { * ``` * * @param {models.ISettings} settings - * @returns {Promise} + * @returns {Promise>} */ - updateSettings(settings: models.ISettings): Promise; + updateSettings(settings: models.ISettings): Promise>; /** * Validate load configuration. * @@ -1143,7 +1151,7 @@ declare module "report" { * report.resetPersistentFilters(); * ``` */ - resetPersistentFilters(): Promise; + resetPersistentFilters(): Promise>; /** * Save user's filters, slicers, and other data view changes of the report * @@ -1151,7 +1159,7 @@ declare module "report" { * report.savePersistentFilters(); * ``` */ - savePersistentFilters(): Promise; + savePersistentFilters(): Promise>; /** * Returns if there are user's filters, slicers, or other data view changes applied on the report. * If persistent filters is disable, returns false. @@ -1166,15 +1174,15 @@ declare module "report" { /** * @hidden */ - private applyThemeInternal(theme); + private applyThemeInternal; /** * @hidden */ - private viewModeToString(viewMode); + private viewModeToString; /** * @hidden */ - private isMobileSettings(settings); + private isMobileSettings; } } declare module "create" { @@ -1314,7 +1322,7 @@ declare module "dashboard" { * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView * @hidden */ - private ValidatePageView(pageView); + private ValidatePageView; } } declare module "tile" { @@ -1374,6 +1382,7 @@ declare module "qna" { import * as service from "service"; import * as models from 'powerbi-models'; import * as embed from "embed"; + import { IHttpPostMessageResponse } from 'http-post-message'; /** * The Power BI Q&A embed component * @@ -1399,10 +1408,10 @@ declare module "qna" { /** * Change the question of the Q&A embed component * - * @param question - question which will render Q&A data - * @returns {string} + * @param {string} question - question which will render Q&A data + * @returns {Promise>} */ - setQuestion(question: string): Promise; + setQuestion(question: string): Promise>; /** * Handle config changes. * @@ -1427,6 +1436,7 @@ declare module "visual" { import { Report } from "report"; import { Page } from "page"; import { VisualDescriptor } from "visualDescriptor"; + import { IHttpPostMessageResponse } from 'http-post-message'; /** * The Power BI Visual embed component * @@ -1460,9 +1470,9 @@ declare module "visual" { * Sets the active page of the report - not supported in visual embed. * * @param {string} pageName - * @returns {Promise} + * @returns {Promise>} */ - setPage(pageName: string): Promise; + setPage(pageName: string): Promise>; /** * Gets the embedded visual descriptor object that contains the visual name, type, etc. * @@ -1504,9 +1514,9 @@ declare module "visual" { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[], filtersLevel?: models.FiltersLevel): Promise; + setFilters(filters: models.IFilter[], filtersLevel?: models.FiltersLevel): Promise>; /** * Removes all filters from the current filter level. * Default filter level is visual level. @@ -1515,13 +1525,13 @@ declare module "visual" { * visual.removeFilters(filtersLevel); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(filtersLevel?: models.FiltersLevel): Promise; + removeFilters(filtersLevel?: models.FiltersLevel): Promise>; /** * @hidden */ - private getFiltersLevelUrl(filtersLevel); + private getFiltersLevelUrl; } } declare module "service" { @@ -1689,7 +1699,7 @@ declare module "service" { * @returns {embed.Embed} * @hidden */ - private embedNew(element, config, phasedRender?, isBootstrap?); + private embedNew; /** * Given an element that already contains an embed component, load with a new configuration. * @@ -1699,7 +1709,7 @@ declare module "service" { * @returns {embed.Embed} * @hidden */ - private embedExisting(element, config, phasedRender?); + private embedExisting; /** * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. @@ -1755,7 +1765,7 @@ declare module "service" { * @param {IEvent} event * @hidden */ - private handleEvent(event); + private handleEvent; /** * API for warm starting powerbi embedded endpoints. * Use this API to preload Power BI Embedded in the background. @@ -1771,6 +1781,7 @@ declare module "bookmarksManager" { import * as service from "service"; import * as embed from "embed"; import * as models from 'powerbi-models'; + import { IHttpPostMessageResponse } from 'http-post-message'; /** * APIs for managing the report bookmarks. * @@ -1779,10 +1790,10 @@ declare module "bookmarksManager" { */ export interface IBookmarksManager { getBookmarks(): Promise; - apply(bookmarkName: string): Promise; - play(playMode: models.BookmarksPlayMode): Promise; + apply(bookmarkName: string): Promise>; + play(playMode: models.BookmarksPlayMode): Promise>; capture(options?: models.ICaptureBookmarkOptions): Promise; - applyState(state: string): Promise; + applyState(state: string): Promise>; } /** * Manages report bookmarks. @@ -1794,7 +1805,7 @@ declare module "bookmarksManager" { export class BookmarksManager implements IBookmarksManager { private service; private config; - private iframe; + private iframe?; /** * @hidden */ @@ -1821,9 +1832,9 @@ declare module "bookmarksManager" { * ``` * * @param {string} bookmarkName The name of the bookmark to be applied - * @returns {Promise} + * @returns {Promise>} */ - apply(bookmarkName: string): Promise; + apply(bookmarkName: string): Promise>; /** * Play bookmarks: Enter or Exit bookmarks presentation mode. * @@ -1833,9 +1844,9 @@ declare module "bookmarksManager" { * ``` * * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` - * @returns {Promise} + * @returns {Promise>} */ - play(playMode: models.BookmarksPlayMode): Promise; + play(playMode: models.BookmarksPlayMode): Promise>; /** * Capture bookmark from current state. * @@ -1855,9 +1866,9 @@ declare module "bookmarksManager" { * ``` * * @param {string} state A base64 bookmark state to be applied - * @returns {Promise} + * @returns {Promise>} */ - applyState(state: string): Promise; + applyState(state: string): Promise>; } } declare module "factories" { @@ -1882,12 +1893,12 @@ declare module "powerbi-client" { export { Report } from "report"; export { Dashboard } from "dashboard"; export { Tile } from "tile"; - export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, IReportEmbedConfiguration, IDashboardEmbedConfiguration, ITileEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings, IQnaSettings } from "embed"; + export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, IReportEmbedConfiguration, IDashboardEmbedConfiguration, ITileEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings, IQnaSettings, } from "embed"; export { Page } from "page"; export { Qna } from "qna"; export { Visual } from "visual"; export { VisualDescriptor } from "visualDescriptor"; - global { + global { interface Window { powerbi: service.Service; } diff --git a/dist/powerbi.js b/dist/powerbi.js index 5d6b6979..52083736 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.0 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -8,6 +8,107 @@ exports["powerbi-client"] = factory(); else root["powerbi-client"] = factory(); +})(window, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./src/powerbi-client.ts"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./node_modules/http-post-message/dist/httpPostMessage.js": +/*!****************************************************************!*\ + !*** ./node_modules/http-post-message/dist/httpPostMessage.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/*! http-post-message v0.2.3 | (c) 2016 Microsoft Corporation MIT */ +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else {} })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache @@ -53,8457 +154,9536 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /** - * @hidden - */ - var service = __webpack_require__(1); - exports.service = service; - var factories = __webpack_require__(16); - exports.factories = factories; - var models = __webpack_require__(5); - exports.models = models; - var report_1 = __webpack_require__(7); - exports.Report = report_1.Report; - var dashboard_1 = __webpack_require__(12); - exports.Dashboard = dashboard_1.Dashboard; - var tile_1 = __webpack_require__(13); - exports.Tile = tile_1.Tile; - var embed_1 = __webpack_require__(2); - exports.Embed = embed_1.Embed; - var page_1 = __webpack_require__(8); - exports.Page = page_1.Page; - var qna_1 = __webpack_require__(14); - exports.Qna = qna_1.Qna; - var visual_1 = __webpack_require__(15); - exports.Visual = visual_1.Visual; - var visualDescriptor_1 = __webpack_require__(9); - exports.VisualDescriptor = visualDescriptor_1.VisualDescriptor; - /** - * Makes Power BI available to the global object for use in applications that don't have module loading support. - * - * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service. - */ - var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); - window.powerbi = powerbi; +/***/ function(module, exports) { - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - var embed = __webpack_require__(2); - var report_1 = __webpack_require__(7); - var create_1 = __webpack_require__(11); - var dashboard_1 = __webpack_require__(12); - var tile_1 = __webpack_require__(13); - var page_1 = __webpack_require__(8); - var qna_1 = __webpack_require__(14); - var visual_1 = __webpack_require__(15); - var utils = __webpack_require__(3); - /** - * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application - * - * @export - * @class Service - * @implements {IService} - */ - var Service = (function () { - /** - * Creates an instance of a Power BI Service. - * - * @param {IHpmFactory} hpmFactory The http post message factory used in the postMessage communication layer - * @param {IWpmpFactory} wpmpFactory The window post message factory used in the postMessage communication layer - * @param {IRouterFactory} routerFactory The router factory used in the postMessage communication layer - * @param {IServiceConfiguration} [config={}] - * @hidden - */ - function Service(hpmFactory, wpmpFactory, routerFactory, config) { - var _this = this; - if (config === void 0) { config = {}; } - this.wpmp = wpmpFactory(config.wpmpName, config.logMessages); - this.hpm = hpmFactory(this.wpmp, null, config.version, config.type); - this.router = routerFactory(this.wpmp); - this.uniqueSessionId = utils.generateUUID(); - /** - * Adds handler for report events. - */ - this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'dashboard', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'tile', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - /** - * Adds handler for Q&A events. - */ - this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'qna', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - /** - * Adds handler for front load 'ready' message. - */ - this.router.post("/ready/:uniqueId", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: 'ready', - value: req.body - }; - _this.handleEvent(event); - }); - this.embeds = []; - // TODO: Change when Object.assign is available. - this.config = utils.assign({}, Service.defaultConfig, config); - if (this.config.autoEmbedOnContentLoaded) { - this.enableAutoEmbed(); - } + "use strict"; + var HttpPostMessage = (function () { + function HttpPostMessage(windowPostMessageProxy, defaultHeaders, defaultTargetWindow) { + if (defaultHeaders === void 0) { defaultHeaders = {}; } + this.defaultHeaders = defaultHeaders; + this.defaultTargetWindow = defaultTargetWindow; + this.windowPostMessageProxy = windowPostMessageProxy; } - /** - * Creates new report - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.createReport = function (element, config) { - config.type = 'create'; - var powerBiElement = element; - var component = new create_1.Create(this, powerBiElement, config); - powerBiElement.powerBiEmbed = component; - this.addOrOverwriteEmbed(component, element); - return component; - }; - /** - * TODO: Add a description here - * - * @param {HTMLElement} [container] - * @param {embed.IEmbedConfiguration} [config=undefined] - * @returns {embed.Embed[]} - * @hidden - */ - Service.prototype.init = function (container, config) { - var _this = this; - if (config === void 0) { config = undefined; } - container = (container && container instanceof HTMLElement) ? container : document.body; - var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]")); - return elements.map(function (element) { return _this.embed(element, config); }); - }; - /** - * Given a configuration based on an HTML element, - * if the component has already been created and attached to the element, reuses the component instance and existing iframe, - * otherwise creates a new component instance. - * - * @param {HTMLElement} element - * @param {embed.IEmbedConfigurationBase} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.embed = function (element, config) { - if (config === void 0) { config = {}; } - return this.embedInternal(element, config); - }; - /** - * Given a configuration based on an HTML element, - * if the component has already been created and attached to the element, reuses the component instance and existing iframe, - * otherwise creates a new component instance. - * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. - * - * @param {HTMLElement} element - * @param {embed.IEmbedConfigurationBase} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.load = function (element, config) { - if (config === void 0) { config = {}; } - return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); - }; - /** - * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. - * - * @param {HTMLElement} element - * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. - */ - Service.prototype.bootstrap = function (element, config) { - return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); - }; - /** @hidden */ - Service.prototype.embedInternal = function (element, config, phasedRender, isBootstrap) { - if (config === void 0) { config = {}; } - var component; - var powerBiElement = element; - if (powerBiElement.powerBiEmbed) { - if (isBootstrap) { - throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element."); - } - component = this.embedExisting(powerBiElement, config, phasedRender); - } - else { - component = this.embedNew(powerBiElement, config, phasedRender, isBootstrap); - } - return component; - }; - /** @hidden */ - Service.prototype.getNumberOfComponents = function () { - if (!this.embeds) { - return 0; - } - return this.embeds.length; - }; - /** @hidden */ - Service.prototype.getSdkSessionId = function () { - return this.uniqueSessionId; - }; - /** - * Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup. - * - * @private - * @param {IPowerBiElement} element - * @param {embed.IEmbedConfigurationBase} config - * @returns {embed.Embed} - * @hidden - */ - Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) { - var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); - if (!componentType) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'."); - } - // Saves the type as part of the configuration so that it can be referenced later at a known location. - config.type = componentType; - var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components); - if (!Component) { - throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended."); - } - var component = new Component(this, element, config, phasedRender, isBootstrap); - element.powerBiEmbed = component; - this.addOrOverwriteEmbed(component, element); - return component; - }; - /** - * Given an element that already contains an embed component, load with a new configuration. - * - * @private - * @param {IPowerBiElement} element - * @param {embed.IEmbedConfigurationBase} config - * @returns {embed.Embed} - * @hidden - */ - Service.prototype.embedExisting = function (element, config, phasedRender) { - var component = utils.find(function (x) { return x.element === element; }, this.embeds); - if (!component) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); - } - // TODO: Multiple embedding to the same iframe is not supported in QnA - if (config.type && config.type.toLowerCase() === "qna") { - return this.embedNew(element, config); - } - /** - * TODO: Dynamic embed type switching could be supported but there is work needed to prepare the service state and DOM cleanup. - * remove all event handlers from the DOM, then reset the element to initial state which removes iframe, and removes from list of embeds - * then we can call the embedNew function which would allow setting the proper embedUrl and construction of object based on the new type. - */ - if (typeof config.type === "string" && config.type !== component.config.type) { - /** - * When loading report after create we want to use existing Iframe to optimize load period - */ - if (config.type === "report" && component.config.type === "create") { - var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe); - component.populateConfig(config, /* isBootstrap */ false); - report.load(); - element.powerBiEmbed = report; - this.addOrOverwriteEmbed(component, element); - return report; - } - throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type); - } - component.populateConfig(config, /* isBootstrap */ false); - component.load(phasedRender); - return component; - }; - /** - * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, - * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. - * - * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. - * This handler is typically useful only for applications that are rendered on the server so that all required data is available when the handler is called. - * - * @hidden - */ - Service.prototype.enableAutoEmbed = function () { - var _this = this; - window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false); - }; - /** - * Returns an instance of the component associated with the element. - * - * @param {HTMLElement} element - * @returns {(Report | Tile)} - */ - Service.prototype.get = function (element) { - var powerBiElement = element; - if (!powerBiElement.powerBiEmbed) { - throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance."); - } - return powerBiElement.powerBiEmbed; - }; - /** - * Finds an embed instance by the name or unique ID that is provided. - * - * @param {string} uniqueId - * @returns {(Report | Tile)} - * @hidden - */ - Service.prototype.find = function (uniqueId) { - return utils.find(function (x) { return x.config.uniqueId === uniqueId; }, this.embeds); - }; - /** - * Removes embed components whose container element is same as the given element - * - * @param {Embed} component - * @param {HTMLElement} element - * @returns {void} - * @hidden - */ - Service.prototype.addOrOverwriteEmbed = function (component, element) { - // remove embeds over the same div element. - this.embeds = this.embeds.filter(function (embed) { - return embed.element !== element; - }); - this.embeds.push(component); - }; - /** - * Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe. - * - * @param {HTMLElement} element - * @returns {void} - */ - Service.prototype.reset = function (element) { - var powerBiElement = element; - if (!powerBiElement.powerBiEmbed) { - return; - } - /** Removes the element frontLoad listener if exists. */ - var embedElement = powerBiElement.powerBiEmbed; - if (embedElement.frontLoadHandler) { - embedElement.element.removeEventListener('ready', embedElement.frontLoadHandler, false); - } - /** Removes the component from an internal list of components. */ - utils.remove(function (x) { return x === powerBiElement.powerBiEmbed; }, this.embeds); - /** Deletes a property from the HTML element. */ - delete powerBiElement.powerBiEmbed; - /** Removes the iframe from the element. */ - var iframe = element.querySelector('iframe'); - if (iframe) { - if (iframe.remove !== undefined) { - iframe.remove(); - } - else { - /** Workaround for IE: unhandled rejection TypeError: object doesn't support propert or method 'remove' */ - iframe.parentElement.removeChild(iframe); - } - } - }; - /** - * handles tile events - * - * @param {IEvent} event - * @hidden - */ - Service.prototype.handleTileEvents = function (event) { - if (event.type === 'tile') { - this.handleEvent(event); - } - }; - /** - * Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object. - * - * @private - * @param {IEvent} event - * @hidden - */ - Service.prototype.handleEvent = function (event) { - var embed = utils.find(function (embed) { - return (embed.config.uniqueId === event.id); - }, this.embeds); - if (embed) { - var value = event.value; - if (event.name === 'pageChanged') { - var pageKey = 'newPage'; - var page = value[pageKey]; - if (!page) { - throw new Error("Page model not found at 'event.value." + pageKey + "'."); - } - value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */); - } - utils.raiseCustomEvent(embed.element, event.name, value); - } - }; - /** - * API for warm starting powerbi embedded endpoints. - * Use this API to preload Power BI Embedded in the background. - * - * @public - * @param {embed.IEmbedConfigurationBase} [config={}] - * @param {HTMLElement} [element=undefined] - */ - Service.prototype.preload = function (config, element) { - var iframeContent = document.createElement("iframe"); - iframeContent.setAttribute("style", "display:none;"); - iframeContent.setAttribute("src", config.embedUrl); - iframeContent.setAttribute("scrolling", "no"); - iframeContent.setAttribute("allowfullscreen", "false"); - var node = element; - if (!node) { - node = document.getElementsByTagName("body")[0]; - } - node.appendChild(iframeContent); - iframeContent.onload = function () { - utils.raiseCustomEvent(iframeContent, "preloaded", {}); + // TODO: See if it's possible to share tracking properties interface? + // The responsibility of knowing how to configure windowPostMessageProxy for http should + // live in this http class, but the configuration would need ITrackingProperties + // interface which lives in WindowPostMessageProxy. Use type as workaround + HttpPostMessage.addTrackingProperties = function (message, trackingProperties) { + message.headers = message.headers || {}; + if (trackingProperties && trackingProperties.id) { + message.headers.id = trackingProperties.id; + } + return message; + }; + HttpPostMessage.getTrackingProperties = function (message) { + return { + id: message.headers && message.headers.id }; - return iframeContent; }; - /** - * A list of components that this service can embed - */ - Service.components = [ - tile_1.Tile, - report_1.Report, - dashboard_1.Dashboard, - qna_1.Qna, - visual_1.Visual - ]; - /** - * The default configuration for the service + HttpPostMessage.isErrorMessage = function (message) { + if (typeof (message && message.statusCode) !== 'number') { + return false; + } + return !(200 <= message.statusCode && message.statusCode < 300); + }; + HttpPostMessage.prototype.get = function (url, headers, targetWindow) { + if (headers === void 0) { headers = {}; } + if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } + return this.send({ + method: "GET", + url: url, + headers: headers + }, targetWindow); + }; + HttpPostMessage.prototype.post = function (url, body, headers, targetWindow) { + if (headers === void 0) { headers = {}; } + if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } + return this.send({ + method: "POST", + url: url, + headers: headers, + body: body + }, targetWindow); + }; + HttpPostMessage.prototype.put = function (url, body, headers, targetWindow) { + if (headers === void 0) { headers = {}; } + if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } + return this.send({ + method: "PUT", + url: url, + headers: headers, + body: body + }, targetWindow); + }; + HttpPostMessage.prototype.patch = function (url, body, headers, targetWindow) { + if (headers === void 0) { headers = {}; } + if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } + return this.send({ + method: "PATCH", + url: url, + headers: headers, + body: body + }, targetWindow); + }; + HttpPostMessage.prototype.delete = function (url, body, headers, targetWindow) { + if (body === void 0) { body = null; } + if (headers === void 0) { headers = {}; } + if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } + return this.send({ + method: "DELETE", + url: url, + headers: headers, + body: body + }, targetWindow); + }; + HttpPostMessage.prototype.send = function (request, targetWindow) { + if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } + request.headers = this.assign({}, this.defaultHeaders, request.headers); + if (!targetWindow) { + throw new Error("target window is not provided. You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class."); + } + return this.windowPostMessageProxy.postMessage(targetWindow, request); + }; + /** + * Object.assign() polyfill + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign */ - Service.defaultConfig = { - autoEmbedOnContentLoaded: false, - onError: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; + HttpPostMessage.prototype.assign = function (target) { + var sources = []; + for (var _i = 1; _i < arguments.length; _i++) { + sources[_i - 1] = arguments[_i]; + } + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + sources.forEach(function (source) { + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (Object.prototype.hasOwnProperty.call(source, nextKey)) { + output[nextKey] = source[nextKey]; + } + } } - return console.log(args[0], args.slice(1)); - } + }); + return output; }; - return Service; + return HttpPostMessage; }()); - exports.Service = Service; + exports.HttpPostMessage = HttpPostMessage; + + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=httpPostMessage.js.map + +/***/ }), + +/***/ "./node_modules/powerbi-models/dist/models.js": +/*!****************************************************!*\ + !*** ./node_modules/powerbi-models/dist/models.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else {} +})(window, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0; +var validator_1 = __webpack_require__(1); +var TraceType; +(function (TraceType) { + TraceType[TraceType["Information"] = 0] = "Information"; + TraceType[TraceType["Verbose"] = 1] = "Verbose"; + TraceType[TraceType["Warning"] = 2] = "Warning"; + TraceType[TraceType["Error"] = 3] = "Error"; + TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError"; + TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError"; + TraceType[TraceType["Fatal"] = 6] = "Fatal"; +})(TraceType = exports.TraceType || (exports.TraceType = {})); +var PageSizeType; +(function (PageSizeType) { + PageSizeType[PageSizeType["Widescreen"] = 0] = "Widescreen"; + PageSizeType[PageSizeType["Standard"] = 1] = "Standard"; + PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana"; + PageSizeType[PageSizeType["Letter"] = 3] = "Letter"; + PageSizeType[PageSizeType["Custom"] = 4] = "Custom"; +})(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {})); +var DisplayOption; +(function (DisplayOption) { + DisplayOption[DisplayOption["FitToPage"] = 0] = "FitToPage"; + DisplayOption[DisplayOption["FitToWidth"] = 1] = "FitToWidth"; + DisplayOption[DisplayOption["ActualSize"] = 2] = "ActualSize"; +})(DisplayOption = exports.DisplayOption || (exports.DisplayOption = {})); +var BackgroundType; +(function (BackgroundType) { + BackgroundType[BackgroundType["Default"] = 0] = "Default"; + BackgroundType[BackgroundType["Transparent"] = 1] = "Transparent"; +})(BackgroundType = exports.BackgroundType || (exports.BackgroundType = {})); +var VisualContainerDisplayMode; +(function (VisualContainerDisplayMode) { + VisualContainerDisplayMode[VisualContainerDisplayMode["Visible"] = 0] = "Visible"; + VisualContainerDisplayMode[VisualContainerDisplayMode["Hidden"] = 1] = "Hidden"; +})(VisualContainerDisplayMode = exports.VisualContainerDisplayMode || (exports.VisualContainerDisplayMode = {})); +var LayoutType; +(function (LayoutType) { + LayoutType[LayoutType["Master"] = 0] = "Master"; + LayoutType[LayoutType["Custom"] = 1] = "Custom"; + LayoutType[LayoutType["MobilePortrait"] = 2] = "MobilePortrait"; + LayoutType[LayoutType["MobileLandscape"] = 3] = "MobileLandscape"; +})(LayoutType = exports.LayoutType || (exports.LayoutType = {})); +var HyperlinkClickBehavior; +(function (HyperlinkClickBehavior) { + HyperlinkClickBehavior[HyperlinkClickBehavior["Navigate"] = 0] = "Navigate"; + HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent"; + HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent"; +})(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {})); +var SectionVisibility; +(function (SectionVisibility) { + SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible"; + SectionVisibility[SectionVisibility["HiddenInViewMode"] = 1] = "HiddenInViewMode"; +})(SectionVisibility = exports.SectionVisibility || (exports.SectionVisibility = {})); +var Permissions; +(function (Permissions) { + Permissions[Permissions["Read"] = 0] = "Read"; + Permissions[Permissions["ReadWrite"] = 1] = "ReadWrite"; + Permissions[Permissions["Copy"] = 2] = "Copy"; + Permissions[Permissions["Create"] = 4] = "Create"; + Permissions[Permissions["All"] = 7] = "All"; +})(Permissions = exports.Permissions || (exports.Permissions = {})); +var ViewMode; +(function (ViewMode) { + ViewMode[ViewMode["View"] = 0] = "View"; + ViewMode[ViewMode["Edit"] = 1] = "Edit"; +})(ViewMode = exports.ViewMode || (exports.ViewMode = {})); +var TokenType; +(function (TokenType) { + TokenType[TokenType["Aad"] = 0] = "Aad"; + TokenType[TokenType["Embed"] = 1] = "Embed"; +})(TokenType = exports.TokenType || (exports.TokenType = {})); +var ContrastMode; +(function (ContrastMode) { + ContrastMode[ContrastMode["None"] = 0] = "None"; + ContrastMode[ContrastMode["HighContrast1"] = 1] = "HighContrast1"; + ContrastMode[ContrastMode["HighContrast2"] = 2] = "HighContrast2"; + ContrastMode[ContrastMode["HighContrastBlack"] = 3] = "HighContrastBlack"; + ContrastMode[ContrastMode["HighContrastWhite"] = 4] = "HighContrastWhite"; +})(ContrastMode = exports.ContrastMode || (exports.ContrastMode = {})); +var MenuLocation; +(function (MenuLocation) { + MenuLocation[MenuLocation["Bottom"] = 0] = "Bottom"; + MenuLocation[MenuLocation["Top"] = 1] = "Top"; +})(MenuLocation = exports.MenuLocation || (exports.MenuLocation = {})); +var FiltersLevel; +(function (FiltersLevel) { + FiltersLevel[FiltersLevel["Report"] = 0] = "Report"; + FiltersLevel[FiltersLevel["Page"] = 1] = "Page"; + FiltersLevel[FiltersLevel["Visual"] = 2] = "Visual"; +})(FiltersLevel = exports.FiltersLevel || (exports.FiltersLevel = {})); +var FilterType; +(function (FilterType) { + FilterType[FilterType["Advanced"] = 0] = "Advanced"; + FilterType[FilterType["Basic"] = 1] = "Basic"; + FilterType[FilterType["Unknown"] = 2] = "Unknown"; + FilterType[FilterType["IncludeExclude"] = 3] = "IncludeExclude"; + FilterType[FilterType["RelativeDate"] = 4] = "RelativeDate"; + FilterType[FilterType["TopN"] = 5] = "TopN"; + FilterType[FilterType["Tuple"] = 6] = "Tuple"; + FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime"; +})(FilterType = exports.FilterType || (exports.FilterType = {})); +var RelativeDateFilterTimeUnit; +(function (RelativeDateFilterTimeUnit) { + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Days"] = 0] = "Days"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Weeks"] = 1] = "Weeks"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarWeeks"] = 2] = "CalendarWeeks"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Months"] = 3] = "Months"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarMonths"] = 4] = "CalendarMonths"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Years"] = 5] = "Years"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarYears"] = 6] = "CalendarYears"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Minutes"] = 7] = "Minutes"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Hours"] = 8] = "Hours"; +})(RelativeDateFilterTimeUnit = exports.RelativeDateFilterTimeUnit || (exports.RelativeDateFilterTimeUnit = {})); +var RelativeDateOperators; +(function (RelativeDateOperators) { + RelativeDateOperators[RelativeDateOperators["InLast"] = 0] = "InLast"; + RelativeDateOperators[RelativeDateOperators["InThis"] = 1] = "InThis"; + RelativeDateOperators[RelativeDateOperators["InNext"] = 2] = "InNext"; +})(RelativeDateOperators = exports.RelativeDateOperators || (exports.RelativeDateOperators = {})); +var Filter = /** @class */ (function () { + function Filter(target, filterType) { + this.target = target; + this.filterType = filterType; + } + Filter.prototype.toJSON = function () { + var filter = { + $schema: this.schemaUrl, + target: this.target, + filterType: this.filterType + }; + // Add displaySettings only when defined + if (this.displaySettings !== undefined) { + filter.displaySettings = this.displaySettings; + } + return filter; + }; + return Filter; +}()); +exports.Filter = Filter; +var NotSupportedFilter = /** @class */ (function (_super) { + __extends(NotSupportedFilter, _super); + function NotSupportedFilter(target, message, notSupportedTypeName) { + var _this = _super.call(this, target, FilterType.Unknown) || this; + _this.message = message; + _this.notSupportedTypeName = notSupportedTypeName; + _this.schemaUrl = NotSupportedFilter.schemaUrl; + return _this; + } + NotSupportedFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.message = this.message; + filter.notSupportedTypeName = this.notSupportedTypeName; + return filter; + }; + NotSupportedFilter.schemaUrl = "http://powerbi.com/product/schema#notSupported"; + return NotSupportedFilter; +}(Filter)); +exports.NotSupportedFilter = NotSupportedFilter; +var IncludeExcludeFilter = /** @class */ (function (_super) { + __extends(IncludeExcludeFilter, _super); + function IncludeExcludeFilter(target, isExclude, values) { + var _this = _super.call(this, target, FilterType.IncludeExclude) || this; + _this.values = values; + _this.isExclude = isExclude; + _this.schemaUrl = IncludeExcludeFilter.schemaUrl; + return _this; + } + IncludeExcludeFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.isExclude = this.isExclude; + filter.values = this.values; + return filter; + }; + IncludeExcludeFilter.schemaUrl = "http://powerbi.com/product/schema#includeExclude"; + return IncludeExcludeFilter; +}(Filter)); +exports.IncludeExcludeFilter = IncludeExcludeFilter; +var TopNFilter = /** @class */ (function (_super) { + __extends(TopNFilter, _super); + function TopNFilter(target, operator, itemCount, orderBy) { + var _this = _super.call(this, target, FilterType.TopN) || this; + _this.operator = operator; + _this.itemCount = itemCount; + _this.schemaUrl = TopNFilter.schemaUrl; + _this.orderBy = orderBy; + return _this; + } + TopNFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.itemCount = this.itemCount; + filter.orderBy = this.orderBy; + return filter; + }; + TopNFilter.schemaUrl = "http://powerbi.com/product/schema#topN"; + return TopNFilter; +}(Filter)); +exports.TopNFilter = TopNFilter; +var RelativeDateFilter = /** @class */ (function (_super) { + __extends(RelativeDateFilter, _super); + function RelativeDateFilter(target, operator, timeUnitsCount, timeUnitType, includeToday) { + var _this = _super.call(this, target, FilterType.RelativeDate) || this; + _this.operator = operator; + _this.timeUnitsCount = timeUnitsCount; + _this.timeUnitType = timeUnitType; + _this.includeToday = includeToday; + _this.schemaUrl = RelativeDateFilter.schemaUrl; + return _this; + } + RelativeDateFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.timeUnitsCount = this.timeUnitsCount; + filter.timeUnitType = this.timeUnitType; + filter.includeToday = this.includeToday; + return filter; + }; + RelativeDateFilter.schemaUrl = "http://powerbi.com/product/schema#relativeDate"; + return RelativeDateFilter; +}(Filter)); +exports.RelativeDateFilter = RelativeDateFilter; +var RelativeTimeFilter = /** @class */ (function (_super) { + __extends(RelativeTimeFilter, _super); + function RelativeTimeFilter(target, operator, timeUnitsCount, timeUnitType) { + var _this = _super.call(this, target, FilterType.RelativeTime) || this; + _this.operator = operator; + _this.timeUnitsCount = timeUnitsCount; + _this.timeUnitType = timeUnitType; + _this.schemaUrl = RelativeTimeFilter.schemaUrl; + return _this; + } + RelativeTimeFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.timeUnitsCount = this.timeUnitsCount; + filter.timeUnitType = this.timeUnitType; + return filter; + }; + RelativeTimeFilter.schemaUrl = "http://powerbi.com/product/schema#relativeTime"; + return RelativeTimeFilter; +}(Filter)); +exports.RelativeTimeFilter = RelativeTimeFilter; +var BasicFilter = /** @class */ (function (_super) { + __extends(BasicFilter, _super); + function BasicFilter(target, operator) { + var values = []; + for (var _i = 2; _i < arguments.length; _i++) { + values[_i - 2] = arguments[_i]; + } + var _this = _super.call(this, target, FilterType.Basic) || this; + _this.operator = operator; + _this.schemaUrl = BasicFilter.schemaUrl; + if (values.length === 0 && operator !== "All") { + throw new Error("values must be a non-empty array unless your operator is \"All\"."); + } + /** + * Accept values as array instead of as individual arguments + * new BasicFilter('a', 'b', 1, 2); + * new BasicFilter('a', 'b', [1,2]); + */ + if (Array.isArray(values[0])) { + _this.values = values[0]; + } + else { + _this.values = values; + } + return _this; + } + BasicFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.values = this.values; + filter.requireSingleSelection = !!this.requireSingleSelection; + return filter; + }; + BasicFilter.schemaUrl = "http://powerbi.com/product/schema#basic"; + return BasicFilter; +}(Filter)); +exports.BasicFilter = BasicFilter; +var BasicFilterWithKeys = /** @class */ (function (_super) { + __extends(BasicFilterWithKeys, _super); + function BasicFilterWithKeys(target, operator, values, keyValues) { + var _this = _super.call(this, target, operator, values) || this; + _this.keyValues = keyValues; + _this.target = target; + var numberOfKeys = target.keys ? target.keys.length : 0; + if (numberOfKeys > 0 && !keyValues) { + throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys"); + } + if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { + throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); + } + for (var _i = 0, _a = _this.keyValues; _i < _a.length; _i++) { + var keyValue = _a[_i]; + if (keyValue) { + var lengthOfArray = keyValue.length; + if (lengthOfArray !== numberOfKeys) { + throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); + } + } + } + return _this; + } + BasicFilterWithKeys.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.keyValues = this.keyValues; + return filter; + }; + return BasicFilterWithKeys; +}(BasicFilter)); +exports.BasicFilterWithKeys = BasicFilterWithKeys; +var TupleFilter = /** @class */ (function (_super) { + __extends(TupleFilter, _super); + function TupleFilter(target, operator, values) { + var _this = _super.call(this, target, FilterType.Tuple) || this; + _this.operator = operator; + _this.schemaUrl = TupleFilter.schemaUrl; + _this.values = values; + return _this; + } + TupleFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.values = this.values; + filter.target = this.target; + return filter; + }; + TupleFilter.schemaUrl = "http://powerbi.com/product/schema#tuple"; + return TupleFilter; +}(Filter)); +exports.TupleFilter = TupleFilter; +var AdvancedFilter = /** @class */ (function (_super) { + __extends(AdvancedFilter, _super); + function AdvancedFilter(target, logicalOperator) { + var conditions = []; + for (var _i = 2; _i < arguments.length; _i++) { + conditions[_i - 2] = arguments[_i]; + } + var _this = _super.call(this, target, FilterType.Advanced) || this; + _this.schemaUrl = AdvancedFilter.schemaUrl; + // Guard statements + if (typeof logicalOperator !== "string" || logicalOperator.length === 0) { + // TODO: It would be nicer to list out the possible logical operators. + throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator); + } + _this.logicalOperator = logicalOperator; + var extractedConditions; + /** + * Accept conditions as array instead of as individual arguments + * new AdvancedFilter('a', 'b', "And", { value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }); + * new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]); + */ + if (Array.isArray(conditions[0])) { + extractedConditions = conditions[0]; + } + else { + extractedConditions = conditions; + } + if (extractedConditions.length === 0) { + throw new Error("conditions must be a non-empty array. You passed: " + conditions); + } + if (extractedConditions.length > 2) { + throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length); + } + if (extractedConditions.length === 1 && logicalOperator !== "And") { + throw new Error("Logical Operator must be \"And\" when there is only one condition provided"); + } + _this.conditions = extractedConditions; + return _this; + } + AdvancedFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.logicalOperator = this.logicalOperator; + filter.conditions = this.conditions; + return filter; + }; + AdvancedFilter.schemaUrl = "http://powerbi.com/product/schema#advanced"; + return AdvancedFilter; +}(Filter)); +exports.AdvancedFilter = AdvancedFilter; +function isFilterKeyColumnsTarget(target) { + return isColumn(target) && !!target.keys; +} +exports.isFilterKeyColumnsTarget = isFilterKeyColumnsTarget; +function isBasicFilterWithKeys(filter) { + return getFilterType(filter) === FilterType.Basic && !!filter.keyValues; +} +exports.isBasicFilterWithKeys = isBasicFilterWithKeys; +function getFilterType(filter) { + if (filter.filterType) { + return filter.filterType; + } + var basicFilter = filter; + var advancedFilter = filter; + if ((typeof basicFilter.operator === "string") + && (Array.isArray(basicFilter.values))) { + return FilterType.Basic; + } + else if ((typeof advancedFilter.logicalOperator === "string") + && (Array.isArray(advancedFilter.conditions))) { + return FilterType.Advanced; + } + else { + return FilterType.Unknown; + } +} +exports.getFilterType = getFilterType; +function isMeasure(arg) { + return arg.table !== undefined && arg.measure !== undefined; +} +exports.isMeasure = isMeasure; +function isColumn(arg) { + return !!(arg.table && arg.column && !arg.aggregationFunction); +} +exports.isColumn = isColumn; +function isHierarchyLevel(arg) { + return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && !arg.aggregationFunction); +} +exports.isHierarchyLevel = isHierarchyLevel; +function isHierarchyLevelAggr(arg) { + return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && arg.aggregationFunction); +} +exports.isHierarchyLevelAggr = isHierarchyLevelAggr; +function isColumnAggr(arg) { + return !!(arg.table && arg.column && arg.aggregationFunction); +} +exports.isColumnAggr = isColumnAggr; +var PageNavigationPosition; +(function (PageNavigationPosition) { + PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; + PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; +})(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); +var QnaMode; +(function (QnaMode) { + QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; + QnaMode[QnaMode["ResultOnly"] = 1] = "ResultOnly"; +})(QnaMode = exports.QnaMode || (exports.QnaMode = {})); +var ExportDataType; +(function (ExportDataType) { + ExportDataType[ExportDataType["Summarized"] = 0] = "Summarized"; + ExportDataType[ExportDataType["Underlying"] = 1] = "Underlying"; +})(ExportDataType = exports.ExportDataType || (exports.ExportDataType = {})); +var BookmarksPlayMode; +(function (BookmarksPlayMode) { + BookmarksPlayMode[BookmarksPlayMode["Off"] = 0] = "Off"; + BookmarksPlayMode[BookmarksPlayMode["Presentation"] = 1] = "Presentation"; +})(BookmarksPlayMode = exports.BookmarksPlayMode || (exports.BookmarksPlayMode = {})); +// This is not an enum because enum strings require +// us to upgrade typeScript version and change SDK build definition +exports.CommonErrorCodes = { + TokenExpired: 'TokenExpired', + NotFound: 'PowerBIEntityNotFound', + InvalidParameters: 'Invalid parameters', + LoadReportFailed: 'LoadReportFailed', + NotAuthorized: 'PowerBINotAuthorizedException', + FailedToLoadModel: 'ExplorationContainer_FailedToLoadModel_DefaultDetails', +}; +exports.TextAlignment = { + Left: 'left', + Center: 'center', + Right: 'right', +}; +exports.LegendPosition = { + Top: 'Top', + Bottom: 'Bottom', + Right: 'Right', + Left: 'Left', + TopCenter: 'TopCenter', + BottomCenter: 'BottomCenter', + RightCenter: 'RightCenter', + LeftCenter: 'LeftCenter', +}; +var SortDirection; +(function (SortDirection) { + SortDirection[SortDirection["Ascending"] = 1] = "Ascending"; + SortDirection[SortDirection["Descending"] = 2] = "Descending"; +})(SortDirection = exports.SortDirection || (exports.SortDirection = {})); +var Selector = /** @class */ (function () { + function Selector(schema) { + this.$schema = schema; + } + Selector.prototype.toJSON = function () { + return { + $schema: this.$schema + }; + }; + return Selector; +}()); +exports.Selector = Selector; +var PageSelector = /** @class */ (function (_super) { + __extends(PageSelector, _super); + function PageSelector(pageName) { + var _this = _super.call(this, PageSelector.schemaUrl) || this; + _this.pageName = pageName; + return _this; + } + PageSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.pageName = this.pageName; + return selector; + }; + PageSelector.schemaUrl = "http://powerbi.com/product/schema#pageSelector"; + return PageSelector; +}(Selector)); +exports.PageSelector = PageSelector; +var VisualSelector = /** @class */ (function (_super) { + __extends(VisualSelector, _super); + function VisualSelector(visualName) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.visualName = visualName; + return _this; + } + VisualSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.visualName = this.visualName; + return selector; + }; + VisualSelector.schemaUrl = "http://powerbi.com/product/schema#visualSelector"; + return VisualSelector; +}(Selector)); +exports.VisualSelector = VisualSelector; +var VisualTypeSelector = /** @class */ (function (_super) { + __extends(VisualTypeSelector, _super); + function VisualTypeSelector(visualType) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.visualType = visualType; + return _this; + } + VisualTypeSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.visualType = this.visualType; + return selector; + }; + VisualTypeSelector.schemaUrl = "http://powerbi.com/product/schema#visualTypeSelector"; + return VisualTypeSelector; +}(Selector)); +exports.VisualTypeSelector = VisualTypeSelector; +var SlicerTargetSelector = /** @class */ (function (_super) { + __extends(SlicerTargetSelector, _super); + function SlicerTargetSelector(target) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.target = target; + return _this; + } + SlicerTargetSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.target = this.target; + return selector; + }; + SlicerTargetSelector.schemaUrl = "http://powerbi.com/product/schema#slicerTargetSelector"; + return SlicerTargetSelector; +}(Selector)); +exports.SlicerTargetSelector = SlicerTargetSelector; +var CommandDisplayOption; +(function (CommandDisplayOption) { + CommandDisplayOption[CommandDisplayOption["Enabled"] = 0] = "Enabled"; + CommandDisplayOption[CommandDisplayOption["Disabled"] = 1] = "Disabled"; + CommandDisplayOption[CommandDisplayOption["Hidden"] = 2] = "Hidden"; +})(CommandDisplayOption = exports.CommandDisplayOption || (exports.CommandDisplayOption = {})); +/* + * Visual CRUD + */ +var VisualDataRoleKind; +(function (VisualDataRoleKind) { + // Indicates that the role should be bound to something that evaluates to a grouping of values. + VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping"; + // Indicates that the role should be bound to something that evaluates to a single value in a scope. + VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure"; + // Indicates that the role can be bound to either Grouping or Measure. + VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure"; +})(VisualDataRoleKind = exports.VisualDataRoleKind || (exports.VisualDataRoleKind = {})); +// Indicates the visual preference on Grouping or Measure. Only applicable if kind is GroupingOrMeasure. +var VisualDataRoleKindPreference; +(function (VisualDataRoleKindPreference) { + VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; + VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; +})(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); +function isFlatMenuExtension(menuExtension) { + return menuExtension && !isGroupedMenuExtension(menuExtension); +} +exports.isFlatMenuExtension = isFlatMenuExtension; +function isGroupedMenuExtension(menuExtension) { + return menuExtension && !!menuExtension.groupName; +} +exports.isGroupedMenuExtension = isGroupedMenuExtension; +function isIExtensions(extensions) { + return extensions && !isIExtensionArray(extensions); +} +exports.isIExtensions = isIExtensions; +function isIExtensionArray(extensions) { + return Array.isArray(extensions); +} +exports.isIExtensionArray = isIExtensionArray; +function normalizeError(error) { + var message = error.message; + if (!message) { + message = error.path + " is invalid. Not meeting " + error.keyword + " constraint"; + } + return { + message: message + }; +} +function validateVisualSelector(input) { + var errors = validator_1.Validators.visualSelectorValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualSelector = validateVisualSelector; +function validateSlicer(input) { + var errors = validator_1.Validators.slicerValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSlicer = validateSlicer; +function validateSlicerState(input) { + var errors = validator_1.Validators.slicerStateValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSlicerState = validateSlicerState; +function validatePlayBookmarkRequest(input) { + var errors = validator_1.Validators.playBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; +function validateAddBookmarkRequest(input) { + var errors = validator_1.Validators.addBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateAddBookmarkRequest = validateAddBookmarkRequest; +function validateApplyBookmarkByNameRequest(input) { + var errors = validator_1.Validators.applyBookmarkByNameRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; +function validateApplyBookmarkStateRequest(input) { + var errors = validator_1.Validators.applyBookmarkStateRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; +function validateCaptureBookmarkRequest(input) { + var errors = validator_1.Validators.captureBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; +function validateSettings(input) { + var errors = validator_1.Validators.settingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSettings = validateSettings; +function validatePanes(input) { + var errors = validator_1.Validators.reportPanesValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePanes = validatePanes; +function validateBookmarksPane(input) { + var errors = validator_1.Validators.bookmarksPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateBookmarksPane = validateBookmarksPane; +function validateFiltersPane(input) { + var errors = validator_1.Validators.filtersPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateFiltersPane = validateFiltersPane; +function validateFieldsPane(input) { + var errors = validator_1.Validators.fieldsPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateFieldsPane = validateFieldsPane; +function validatePageNavigationPane(input) { + var errors = validator_1.Validators.pageNavigationPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePageNavigationPane = validatePageNavigationPane; +function validateSelectionPane(input) { + var errors = validator_1.Validators.selectionPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSelectionPane = validateSelectionPane; +function validateSyncSlicersPane(input) { + var errors = validator_1.Validators.syncSlicersPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSyncSlicersPane = validateSyncSlicersPane; +function validateVisualizationsPane(input) { + var errors = validator_1.Validators.visualizationsPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualizationsPane = validateVisualizationsPane; +function validateCustomPageSize(input) { + var errors = validator_1.Validators.customPageSizeValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCustomPageSize = validateCustomPageSize; +function validateExtension(input) { + var errors = validator_1.Validators.extensionValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateExtension = validateExtension; +function validateMenuGroupExtension(input) { + var errors = validator_1.Validators.menuGroupExtensionValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateMenuGroupExtension = validateMenuGroupExtension; +function validateReportLoad(input) { + var errors = validator_1.Validators.reportLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateReportLoad = validateReportLoad; +function validateCreateReport(input) { + var errors = validator_1.Validators.reportCreateValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCreateReport = validateCreateReport; +function validateDashboardLoad(input) { + var errors = validator_1.Validators.dashboardLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateDashboardLoad = validateDashboardLoad; +function validateTileLoad(input) { + var errors = validator_1.Validators.tileLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateTileLoad = validateTileLoad; +function validatePage(input) { + var errors = validator_1.Validators.pageValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePage = validatePage; +function validateFilter(input) { + var errors = validator_1.Validators.filtersValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateFilter = validateFilter; +function validateSaveAsParameters(input) { + var errors = validator_1.Validators.saveAsParametersValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSaveAsParameters = validateSaveAsParameters; +function validateLoadQnaConfiguration(input) { + var errors = validator_1.Validators.loadQnaValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; +function validateQnaInterpretInputData(input) { + var errors = validator_1.Validators.qnaInterpretInputDataValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateQnaInterpretInputData = validateQnaInterpretInputData; +function validateExportDataRequest(input) { + var errors = validator_1.Validators.exportDataRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateExportDataRequest = validateExportDataRequest; +function validateVisualHeader(input) { + var errors = validator_1.Validators.visualHeaderValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualHeader = validateVisualHeader; +function validateVisualSettings(input) { + var errors = validator_1.Validators.visualSettingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualSettings = validateVisualSettings; +function validateCommandsSettings(input) { + var errors = validator_1.Validators.commandsSettingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCommandsSettings = validateCommandsSettings; +function validateCustomTheme(input) { + var errors = validator_1.Validators.customThemeValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCustomTheme = validateCustomTheme; + + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Validators = void 0; +var barsValidator_1 = __webpack_require__(2); +var bookmarkValidator_1 = __webpack_require__(5); +var commandsSettingsValidator_1 = __webpack_require__(6); +var customThemeValidator_1 = __webpack_require__(7); +var dashboardLoadValidator_1 = __webpack_require__(8); +var datasetBindingValidator_1 = __webpack_require__(9); +var exportDataValidator_1 = __webpack_require__(10); +var extensionsValidator_1 = __webpack_require__(11); +var filtersValidator_1 = __webpack_require__(12); +var layoutValidator_1 = __webpack_require__(13); +var pageValidator_1 = __webpack_require__(14); +var panesValidator_1 = __webpack_require__(15); +var qnaValidator_1 = __webpack_require__(16); +var reportCreateValidator_1 = __webpack_require__(17); +var reportLoadValidator_1 = __webpack_require__(18); +var saveAsParametersValidator_1 = __webpack_require__(19); +var selectorsValidator_1 = __webpack_require__(20); +var settingsValidator_1 = __webpack_require__(21); +var slicersValidator_1 = __webpack_require__(22); +var tileLoadValidator_1 = __webpack_require__(23); +var visualSettingsValidator_1 = __webpack_require__(24); +var anyOfValidator_1 = __webpack_require__(25); +var fieldForbiddenValidator_1 = __webpack_require__(26); +var fieldRequiredValidator_1 = __webpack_require__(27); +var mapValidator_1 = __webpack_require__(28); +var typeValidator_1 = __webpack_require__(4); +exports.Validators = { + addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), + advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), + advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(), + anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]), + anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]), + anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]), + actionBarValidator: new barsValidator_1.ActionBarValidator(), + applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), + applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(), + applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]), + backgroundValidator: new typeValidator_1.EnumValidator([0, 1]), + basicFilterTypeValidator: new typeValidator_1.EnumValidator([1]), + basicFilterValidator: new filtersValidator_1.BasicFilterValidator(), + booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), + booleanValidator: new typeValidator_1.BooleanValidator(), + bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), + captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), + captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), + commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + commandExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.CommandExtensionValidator()]), + commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), + commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), + commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), + conditionItemValidator: new filtersValidator_1.ConditionItemValidator(), + contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]), + customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(), + customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(), + customThemeValidator: new customThemeValidator_1.CustomThemeValidator(), + dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(), + datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(), + displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]), + displayStateValidator: new layoutValidator_1.DisplayStateValidator(), + exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), + extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), + extensionsValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), new extensionsValidator_1.ExtensionsValidator()]), + extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), + extensionValidator: new extensionsValidator_1.ExtensionValidator(), + fieldForbiddenValidator: new fieldForbiddenValidator_1.FieldForbiddenValidator(), + fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), + fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), + filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), + filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]), + filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(), + filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(), + filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]), + filtersArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()])]), + filtersValidator: new filtersValidator_1.FilterValidator(), + filtersPaneValidator: new panesValidator_1.FiltersPaneValidator(), + hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(), + includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), + layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), + loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), + menuExtensionValidator: new anyOfValidator_1.AnyOfValidator([new extensionsValidator_1.FlatMenuExtensionValidator(), new extensionsValidator_1.GroupedMenuExtensionValidator()]), + menuGroupExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.MenuGroupExtensionValidator()]), + menuGroupExtensionValidator: new extensionsValidator_1.MenuGroupExtensionValidator(), + menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), + notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), + notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), + numberArrayValidator: new typeValidator_1.NumberArrayValidator(), + numberValidator: new typeValidator_1.NumberValidator(), + pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), + pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), + pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), + pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), + pageSizeValidator: new pageValidator_1.PageSizeValidator(), + pageValidator: new pageValidator_1.PageValidator(), + pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(), + pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]), + reportBarsValidator: new barsValidator_1.ReportBarsValidator(), + reportPanesValidator: new panesValidator_1.ReportPanesValidator(), + permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]), + playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(), + qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(), + qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(), + relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]), + relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]), + relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(), + relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]), + relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]), + relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(), + reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(), + reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(), + saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(), + selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(), + settingsValidator: new settingsValidator_1.SettingsValidator(), + singleCommandSettingsValidator: new commandsSettingsValidator_1.SingleCommandSettingsValidator(), + slicerSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.SlicerTargetSelectorValidator()]), + slicerStateValidator: new slicersValidator_1.SlicerStateValidator(), + slicerTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()]), + slicerValidator: new slicersValidator_1.SlicerValidator(), + stringArrayValidator: new typeValidator_1.StringArrayValidator(), + stringValidator: new typeValidator_1.StringValidator(), + syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(), + tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(), + tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]), + topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]), + topNFilterValidator: new filtersValidator_1.TopNFilterValidator(), + viewModeValidator: new typeValidator_1.EnumValidator([0, 1]), + visualCommandSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + visualHeaderSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + visualHeaderSettingsValidator: new visualSettingsValidator_1.VisualHeaderSettingsValidator(), + visualHeaderValidator: new visualSettingsValidator_1.VisualHeaderValidator(), + visualHeadersValidator: new typeValidator_1.ArrayValidator([new visualSettingsValidator_1.VisualHeaderValidator()]), + visualizationsPaneValidator: new panesValidator_1.VisualizationsPaneValidator(), + visualLayoutValidator: new layoutValidator_1.VisualLayoutValidator(), + visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(), + visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(), + visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(), +}; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { - var utils = __webpack_require__(3); - var sdkConfig = __webpack_require__(4); - var models = __webpack_require__(5); - var errors_1 = __webpack_require__(6); - /** - * Base class for all Power BI embed components - * - * @export - * @abstract - * @hidden - * @class Embed - */ - var Embed = (function () { - /** - * Creates an instance of Embed. - * - * Note: there is circular reference between embeds and the service, because - * the service has a list of all embeds on the host page, and each embed has a reference to the service that created it. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {IEmbedConfigurationBase} config - * @hidden - */ - function Embed(service, element, config, iframe, phasedRender, isBootstrap) { - /** @hidden */ - this.allowedEvents = []; - if (utils.autoAuthInEmbedUrl(config.embedUrl)) { - throw new Error(errors_1.EmbedUrlNotSupported); - } - Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents); - this.eventHandlers = []; - this.service = service; - this.element = element; - this.iframe = iframe; - this.iframeLoaded = false; - this.embedtype = config.type.toLowerCase(); - this.populateConfig(config, isBootstrap); - if (this.embedtype === 'create') { - this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap); - } - else { - this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap); - } - } - /** - * Sends createReport configuration data. - * - * ```javascript - * createReport({ - * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', - * accessToken: 'eyJ0eXA ... TaE2rTSbmg', - * ``` - * @hidden - * @param {models.IReportCreateConfiguration} config - * @returns {Promise} - */ - Embed.prototype.createReport = function (config) { - var errors = models.validateCreateReport(config); - if (errors) { - throw errors; - } - return this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }, function (response) { - throw response.body; - }); - }; - /** - * Saves Report. - * - * @returns {Promise} - */ - Embed.prototype.save = function () { - return this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * SaveAs Report. - * - * @returns {Promise} - */ - Embed.prototype.saveAs = function (saveAsParameters) { - return this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Get the correlationId for the current embed session. - * - * ```javascript - * // Get the correlationId for the current embed session - * report.getCorrelationId() - * .then(correlationId => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Embed.prototype.getCorrelationId = function () { - return this.service.hpm.get("/getCorrelationId", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Sends load configuration data. - * - * ```javascript - * report.load({ - * type: 'report', - * id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', - * accessToken: 'eyJ0eXA ... TaE2rTSbmg', - * settings: { - * navContentPaneEnabled: false - * }, - * pageName: "DefaultPage", - * filters: [ - * { - * ... DefaultReportFilter ... - * } - * ] - * }) - * .catch(error => { ... }); - * ``` - * @hidden - * @param {models.ILoadConfiguration} config - * @param {boolean} phasedRender - * @returns {Promise} - */ - Embed.prototype.load = function (phasedRender) { - if (!this.config.accessToken) { - console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); - return; - } - if (!this.iframeLoaded) { - console.debug("Power BI SDK is trying to post /report/load before iframe is ready."); - return; - } - var path = phasedRender && this.config.type === 'report' ? this.phasedLoadPath : this.loadPath; - var headers = { - uid: this.config.uniqueId, - sdkSessionId: this.service.getSdkSessionId(), - bootstrapped: this.config.bootstrapped, - sdkVersion: sdkConfig.default.version - }; - var timeNow = new Date(); - if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) { - console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval."); - return; - } - this.lastLoadRequest = timeNow; - return this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }, function (response) { - throw response.body; - }); - }; - /** - * Removes one or more event handlers from the list of handlers. - * If a reference to the existing handle function is specified, remove the specific handler. - * If the handler is not specified, remove all handlers for the event name specified. - * - * ```javascript - * report.off('pageChanged') - * - * or - * - * const logHandler = function (event) { - * console.log(event); - * }; - * - * report.off('pageChanged', logHandler); - * ``` - * - * @template T - * @param {string} eventName - * @param {service.IEventHandler} [handler] - */ - Embed.prototype.off = function (eventName, handler) { - var _this = this; - var fakeEvent = { name: eventName, type: null, id: null, value: null }; - if (handler) { - utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers); - this.element.removeEventListener(eventName, handler); - } - else { - var eventHandlersToRemove = this.eventHandlers - .filter(function (eventHandler) { return eventHandler.test(fakeEvent); }); - eventHandlersToRemove - .forEach(function (eventHandlerToRemove) { - utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers); - _this.element.removeEventListener(eventName, eventHandlerToRemove.handle); - }); - } - }; - /** - * Adds an event handler for a specific event. - * - * ```javascript - * report.on('pageChanged', (event) => { - * console.log('PageChanged: ', event.page.name); - * }); - * ``` - * - * @template T - * @param {string} eventName - * @param {service.IEventHandler} handler - */ - Embed.prototype.on = function (eventName, handler) { - if (this.allowedEvents.indexOf(eventName) === -1) { - throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName); - } - this.eventHandlers.push({ - test: function (event) { return event.name === eventName; }, - handle: handler - }); - this.element.addEventListener(eventName, handler); - }; - /** - * Reloads embed using existing configuration. - * E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. - * - * ```javascript - * report.reload(); - * ``` - */ - Embed.prototype.reload = function () { - return this.load(); - }; - /** - * Set accessToken. - * - * @returns {Promise} - */ - Embed.prototype.setAccessToken = function (accessToken) { - var _this = this; - var embedType = this.config.type; - embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; - return this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - _this.config.accessToken = accessToken; - _this.element.setAttribute(Embed.accessTokenAttribute, accessToken); - _this.service.accessToken = accessToken; - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Gets an access token from the first available location: config, attribute, global. - * - * @private - * @param {string} globalAccessToken - * @returns {string} - * @hidden - */ - Embed.prototype.getAccessToken = function (globalAccessToken) { - var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken; - if (!accessToken) { - throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken."); - } - return accessToken; - }; - /** - * Populate config for create and load - * - * @hidden - * @param {IEmbedConfiguration} - * @returns {void} - */ - Embed.prototype.populateConfig = function (config, isBootstrap) { - if (this.bootstrapConfig) { - this.config = utils.assign({}, this.bootstrapConfig, config); - // reset bootstrapConfig because we do not want to merge it in re-embed scenario. - this.bootstrapConfig = null; - } - else { - // Copy config - important for multiple iframe scenario. - // Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes. - this.config = utils.assign({}, config); - } - this.config.embedUrl = this.getEmbedUrl(isBootstrap); - this.config.groupId = this.getGroupId(); - this.addLocaleToEmbedUrl(config); - this.config.uniqueId = this.getUniqueId(); - if (isBootstrap) { - // save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed - this.bootstrapConfig = this.config; - this.bootstrapConfig.bootstrapped = true; - } - else { - this.config.accessToken = this.getAccessToken(this.service.accessToken); - } - this.configChanged(isBootstrap); - }; - /** - * Adds locale parameters to embedUrl - * - * @private - * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config - * @hidden - */ - Embed.prototype.addLocaleToEmbedUrl = function (config) { - if (!config.settings) { - return; - } - var localeSettings = config.settings.localeSettings; - if (localeSettings && localeSettings.language) { - this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language); - } - if (localeSettings && localeSettings.formatLocale) { - this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale); - } - }; - /** - * Gets an embed url from the first available location: options, attribute. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getEmbedUrl = function (isBootstrap) { - var embedUrl = this.config.embedUrl || this.element.getAttribute(Embed.embedUrlAttribute); - if (isBootstrap && !embedUrl) { - // Prepare flow, embed url was not provided, use hostname to build embed url. - embedUrl = this.getDefaultEmbedUrl(this.config.hostname); - } - if (typeof embedUrl !== 'string' || embedUrl.length === 0) { - throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'."); - } - return embedUrl; - }; - /** - * @hidden - */ - Embed.prototype.getDefaultEmbedUrl = function (hostname) { - if (!hostname) { - hostname = Embed.defaultEmbedHostName; - } - var endpoint = this.getDefaultEmbedUrlEndpoint(); - // Trim spaces to fix user mistakes. - hostname = hostname.toLowerCase().trim(); - if (hostname.indexOf("http://") === 0) { - throw new Error("HTTP is not allowed. HTTPS is required"); - } - if (hostname.indexOf("https://") === 0) { - return hostname + "/" + endpoint; - } - return "https://" + hostname + "/" + endpoint; - }; - /** - * Gets a unique ID from the first available location: options, attribute. - * If neither is provided generate a unique string. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getUniqueId = function () { - return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString(); - }; - /** - * Gets the group ID from the first available location: options, embeddedUrl. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getGroupId = function () { - return this.config.groupId || Embed.findGroupIdFromEmbedUrl(this.config.embedUrl); - }; - /** - * Requests the browser to render the component's iframe in fullscreen mode. - */ - Embed.prototype.fullscreen = function () { - var requestFullScreen = this.iframe.requestFullscreen || this.iframe.msRequestFullscreen || this.iframe.mozRequestFullScreen || this.iframe.webkitRequestFullscreen; - requestFullScreen.call(this.iframe); - }; - /** - * Requests the browser to exit fullscreen mode. - */ - Embed.prototype.exitFullscreen = function () { - if (!this.isFullscreen(this.iframe)) { - return; - } - var exitFullscreen = document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen; - exitFullscreen.call(document); - }; - /** - * Returns true if the iframe is rendered in fullscreen mode, - * otherwise returns false. - * - * @private - * @param {HTMLIFrameElement} iframe - * @returns {boolean} - * @hidden - */ - Embed.prototype.isFullscreen = function (iframe) { - var options = ['fullscreenElement', 'webkitFullscreenElement', 'mozFullscreenScreenElement', 'msFullscreenElement']; - return options.some(function (option) { return document[option] === iframe; }); - }; - /** - * Sets Iframe for embed - * @hidden - */ - Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) { - var _this = this; - if (!this.iframe) { - var iframeContent = document.createElement("iframe"); - var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl; - iframeContent.style.width = '100%'; - iframeContent.style.height = '100%'; - iframeContent.setAttribute("src", embedUrl); - iframeContent.setAttribute("scrolling", "no"); - iframeContent.setAttribute("allowfullscreen", "true"); - var node = this.element; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(iframeContent); - this.iframe = node.firstChild; - } - if (isLoad) { - if (!isBootstrap) { - // Validate config if it's not a bootstrap case. - var errors = this.validate(this.config); - if (errors) { - throw errors; - } - } - this.iframe.addEventListener('load', function () { - _this.iframeLoaded = true; - _this.load(phasedRender); - }, false); - if (this.service.getNumberOfComponents() <= Embed.maxFrontLoadTimes) { - this.frontLoadHandler = function () { - _this.frontLoadSendConfig(_this.config); - }; - // 'ready' event is fired by the embedded element (not by the iframe) - this.element.addEventListener('ready', this.frontLoadHandler, false); - } - } - else { - this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false); - } - }; - /** - * Set the component title for accessibility. In case of iframes, this method will change the iframe title. - */ - Embed.prototype.setComponentTitle = function (title) { - if (!this.iframe) { - return; - } - if (title == null) { - this.iframe.removeAttribute("title"); - } - else { - this.iframe.setAttribute("title", title); - } - }; - /** - * Sets element's tabindex attribute - */ - Embed.prototype.setComponentTabIndex = function (tabIndex) { - if (!this.element) { - return; - } - this.element.setAttribute("tabindex", (tabIndex == null) ? "0" : tabIndex.toString()); - }; - /** - * Removes element's tabindex attribute - */ - Embed.prototype.removeComponentTabIndex = function (tabIndex) { - if (!this.element) { - return; - } - this.element.removeAttribute("tabindex"); - }; - /** - * Adds the ability to get groupId from url. - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Embed.findGroupIdFromEmbedUrl = function (url) { - var groupIdRegEx = /groupId="?([^&]+)"?/; - var groupIdMatch = url.match(groupIdRegEx); - var groupId; - if (groupIdMatch) { - groupId = groupIdMatch[1]; - } - return groupId; - }; - /** - * Sends the config for front load calls, after 'ready' message is received from the iframe - * @hidden - */ - Embed.prototype.frontLoadSendConfig = function (config) { - if (!config.accessToken) { - return; - } - var errors = this.validate(config); - if (errors) { - throw errors; - } - // contentWindow must be initialized - if (this.iframe.contentWindow == null) - return; - return this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow).then(function (response) { - return response.body; - }, function (response) { - throw response.body; - }); - }; - /** @hidden */ - Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"]; - /** @hidden */ - Embed.accessTokenAttribute = 'powerbi-access-token'; - /** @hidden */ - Embed.embedUrlAttribute = 'powerbi-embed-url'; - /** @hidden */ - Embed.nameAttribute = 'powerbi-name'; - /** @hidden */ - Embed.typeAttribute = 'powerbi-type'; - /** @hidden */ - Embed.defaultEmbedHostName = "https://app.powerbi.com"; - /** @hidden */ - Embed.maxFrontLoadTimes = 2; - return Embed; - }()); - exports.Embed = Embed; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ActionBarValidator = exports.ReportBarsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportBarsValidator = /** @class */ (function (_super) { + __extends(ReportBarsValidator, _super); + function ReportBarsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportBarsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "actionBar", + validators: [validator_1.Validators.actionBarValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportBarsValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportBarsValidator = ReportBarsValidator; +var ActionBarValidator = /** @class */ (function (_super) { + __extends(ActionBarValidator, _super); + function ActionBarValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ActionBarValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ActionBarValidator; +}(typeValidator_1.ObjectValidator)); +exports.ActionBarValidator = ActionBarValidator; /***/ }), /* 3 */ /***/ (function(module, exports) { - /** - * Raises a custom event with event data on the specified HTML element. - * - * @export - * @param {HTMLElement} element - * @param {string} eventName - * @param {*} eventData - */ - function raiseCustomEvent(element, eventName, eventData) { - var customEvent; - if (typeof CustomEvent === 'function') { - customEvent = new CustomEvent(eventName, { - detail: eventData, - bubbles: true, - cancelable: true - }); - } - else { - customEvent = document.createEvent('CustomEvent'); - customEvent.initCustomEvent(eventName, true, true, eventData); - } - element.dispatchEvent(customEvent); - } - exports.raiseCustomEvent = raiseCustomEvent; - /** - * Finds the index of the first value in an array that matches the specified predicate. - * - * @export - * @template T - * @param {(x: T) => boolean} predicate - * @param {T[]} xs - * @returns {number} - */ - function findIndex(predicate, xs) { - if (!Array.isArray(xs)) { - throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs); - } - var index; - xs.some(function (x, i) { - if (predicate(x)) { - index = i; - return true; - } - }); - return index; - } - exports.findIndex = findIndex; - /** - * Finds the first value in an array that matches the specified predicate. - * - * @export - * @template T - * @param {(x: T) => boolean} predicate - * @param {T[]} xs - * @returns {T} - */ - function find(predicate, xs) { - var index = findIndex(predicate, xs); - return xs[index]; - } - exports.find = find; - function remove(predicate, xs) { - var index = findIndex(predicate, xs); - xs.splice(index, 1); - } - exports.remove = remove; - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - // TODO: replace in favor of using polyfill - /** - * Copies the values of all enumerable properties from one or more source objects to a target object, and returns the target object. - * - * @export - * @param {any} args - * @returns - */ - function assign() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var target = args[0]; - 'use strict'; - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - } - exports.assign = assign; - /** - * Generates a random 5 to 6 character string. - * - * @export - * @returns {string} - */ - function createRandomString() { - return getRandomValue().toString(36).substring(1); - } - exports.createRandomString = createRandomString; - /** - * Generates a 20 charachter uuid. - * - * @export - * @returns {string} - */ - function generateUUID() { - var d = new Date().getTime(); - if (typeof performance !== 'undefined' && typeof performance.now === 'function') { - d += performance.now(); - } - return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - // Generate a random number, scaled from 0 to 15. - var r = (getRandomValue() % 16); - // Shift 4 times to divide by 16 - d >>= 4; - return r.toString(16); - }); - } - exports.generateUUID = generateUUID; - /** - * Adds a parameter to the given url - * - * @export - * @param {string} url - * @param {string} paramName - * @param {string} value - * @returns {string} - */ - function addParamToUrl(url, paramName, value) { - var parameterPrefix = url.indexOf('?') > 0 ? '&' : '?'; - url += parameterPrefix + paramName + '=' + value; - return url; - } - exports.addParamToUrl = addParamToUrl; - /** - * Checks if the report is saved. - * - * @export - * @param {HttpPostMessage} hpm - * @param {string} uid - * @param {Window} contentWindow - * @returns {Promise} - */ - function isSavedInternal(hpm, uid, contentWindow) { - return hpm.get('/report/hasUnsavedChanges', { uid: uid }, contentWindow) - .then(function (response) { return !response.body; }, function (response) { - throw response.body; - }); - } - exports.isSavedInternal = isSavedInternal; - /** - * Checks if the embed url is for RDL report. - * - * @export - * @param {string} embedUrl - * @returns {boolean} - */ - function isRDLEmbed(embedUrl) { - return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0; - } - exports.isRDLEmbed = isRDLEmbed; - /** - * Checks if the embed url contains autoAuth=true. - * - * @export - * @param {string} embedUrl - * @returns {boolean} - */ - function autoAuthInEmbedUrl(embedUrl) { - return embedUrl && decodeURIComponent(embedUrl).toLowerCase().indexOf("autoauth=true") >= 0; - } - exports.autoAuthInEmbedUrl = autoAuthInEmbedUrl; - /** - * Returns random number - */ - function getRandomValue() { - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - return randomValueArray[0]; - } - exports.getRandomValue = getRandomValue; - /** - * Returns the time interval between two dates in milliseconds - * @export - * @param {Date} start - * @param {Date} end - * @returns {number} - */ - function getTimeDiffInMilliseconds(start, end) { - return Math.abs(start.getTime() - end.getTime()); - } - exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MultipleFieldsValidator = void 0; +var MultipleFieldsValidator = /** @class */ (function () { + function MultipleFieldsValidator(fieldValidatorsPairs) { + this.fieldValidatorsPairs = fieldValidatorsPairs; + } + MultipleFieldsValidator.prototype.validate = function (input, path, field) { + if (!this.fieldValidatorsPairs) { + return null; + } + var fieldsPath = path ? path + "." + field : field; + for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { + var fieldValidators = _a[_i]; + for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { + var validator = _c[_b]; + var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); + if (errors) { + return errors; + } + } + } + return null; + }; + return MultipleFieldsValidator; +}()); +exports.MultipleFieldsValidator = MultipleFieldsValidator; /***/ }), /* 4 */ /***/ (function(module, exports) { - /** @ignore */ /** */ - var config = { - version: '2.15.2', - type: 'js' - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = config; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0; +var ObjectValidator = /** @class */ (function () { + function ObjectValidator() { + } + ObjectValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (typeof input !== "object" || Array.isArray(input)) { + return [{ + message: field !== undefined ? field + " must be an object" : "input must be an object", + path: path, + keyword: "type" + }]; + } + return null; + }; + return ObjectValidator; +}()); +exports.ObjectValidator = ObjectValidator; +var ArrayValidator = /** @class */ (function () { + function ArrayValidator(itemValidators) { + this.itemValidators = itemValidators; + } + ArrayValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (!(Array.isArray(input))) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + for (var i = 0; i < input.length; i++) { + var fieldsPath = (path ? path + "." : "") + field + "." + i; + for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input[i], fieldsPath, field); + if (errors) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + } + } + return null; + }; + return ArrayValidator; +}()); +exports.ArrayValidator = ArrayValidator; +var TypeValidator = /** @class */ (function () { + function TypeValidator(expectedType) { + this.expectedType = expectedType; + } + TypeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (!(typeof input === this.expectedType)) { + return [{ + message: field + " must be a " + this.expectedType, + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return TypeValidator; +}()); +exports.TypeValidator = TypeValidator; +var StringValidator = /** @class */ (function (_super) { + __extends(StringValidator, _super); + function StringValidator() { + return _super.call(this, "string") || this; + } + return StringValidator; +}(TypeValidator)); +exports.StringValidator = StringValidator; +var BooleanValidator = /** @class */ (function (_super) { + __extends(BooleanValidator, _super); + function BooleanValidator() { + return _super.call(this, "boolean") || this; + } + return BooleanValidator; +}(TypeValidator)); +exports.BooleanValidator = BooleanValidator; +var NumberValidator = /** @class */ (function (_super) { + __extends(NumberValidator, _super); + function NumberValidator() { + return _super.call(this, "number") || this; + } + return NumberValidator; +}(TypeValidator)); +exports.NumberValidator = NumberValidator; +var ValueValidator = /** @class */ (function () { + function ValueValidator(possibleValues) { + this.possibleValues = possibleValues; + } + ValueValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (this.possibleValues.indexOf(input) < 0) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return ValueValidator; +}()); +exports.ValueValidator = ValueValidator; +var SchemaValidator = /** @class */ (function (_super) { + __extends(SchemaValidator, _super); + function SchemaValidator(schemaValue) { + var _this = _super.call(this, [schemaValue]) || this; + _this.schemaValue = schemaValue; + return _this; + } + SchemaValidator.prototype.validate = function (input, path, field) { + return _super.prototype.validate.call(this, input, path, field); + }; + return SchemaValidator; +}(ValueValidator)); +exports.SchemaValidator = SchemaValidator; +var EnumValidator = /** @class */ (function (_super) { + __extends(EnumValidator, _super); + function EnumValidator(possibleValues) { + var _this = _super.call(this) || this; + _this.possibleValues = possibleValues; + return _this; + } + EnumValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var valueValidator = new ValueValidator(this.possibleValues); + return valueValidator.validate(input, path, field); + }; + return EnumValidator; +}(NumberValidator)); +exports.EnumValidator = EnumValidator; +var StringArrayValidator = /** @class */ (function (_super) { + __extends(StringArrayValidator, _super); + function StringArrayValidator() { + return _super.call(this, [new StringValidator()]) || this; + } + StringArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of strings", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return StringArrayValidator; +}(ArrayValidator)); +exports.StringArrayValidator = StringArrayValidator; +var BooleanArrayValidator = /** @class */ (function (_super) { + __extends(BooleanArrayValidator, _super); + function BooleanArrayValidator() { + return _super.call(this, [new BooleanValidator()]) || this; + } + BooleanArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of booleans", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return BooleanArrayValidator; +}(ArrayValidator)); +exports.BooleanArrayValidator = BooleanArrayValidator; +var NumberArrayValidator = /** @class */ (function (_super) { + __extends(NumberArrayValidator, _super); + function NumberArrayValidator() { + return _super.call(this, [new NumberValidator()]) || this; + } + NumberArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of numbers", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return NumberArrayValidator; +}(ArrayValidator)); +exports.NumberArrayValidator = NumberArrayValidator; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { - /*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ - (function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["powerbi-models"] = factory(); - else - root["powerbi-models"] = factory(); - })(window, function() { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - /******/ - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if(installedModules[moduleId]) { - /******/ return installedModules[moduleId].exports; - /******/ } - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ i: moduleId, - /******/ l: false, - /******/ exports: {} - /******/ }; - /******/ - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - /******/ - /******/ // Flag the module as loaded - /******/ module.l = true; - /******/ - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - /******/ - /******/ - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - /******/ - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - /******/ - /******/ // define getter function for harmony exports - /******/ __webpack_require__.d = function(exports, name, getter) { - /******/ if(!__webpack_require__.o(exports, name)) { - /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); - /******/ } - /******/ }; - /******/ - /******/ // define __esModule on exports - /******/ __webpack_require__.r = function(exports) { - /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); - /******/ } - /******/ Object.defineProperty(exports, '__esModule', { value: true }); - /******/ }; - /******/ - /******/ // create a fake namespace object - /******/ // mode & 1: value is a module id, require it - /******/ // mode & 2: merge all properties of value into the ns - /******/ // mode & 4: return value when already ns object - /******/ // mode & 8|1: behave like require - /******/ __webpack_require__.t = function(value, mode) { - /******/ if(mode & 1) value = __webpack_require__(value); - /******/ if(mode & 8) return value; - /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; - /******/ var ns = Object.create(null); - /******/ __webpack_require__.r(ns); - /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); - /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); - /******/ return ns; - /******/ }; - /******/ - /******/ // getDefaultExport function for compatibility with non-harmony modules - /******/ __webpack_require__.n = function(module) { - /******/ var getter = module && module.__esModule ? - /******/ function getDefault() { return module['default']; } : - /******/ function getModuleExports() { return module; }; - /******/ __webpack_require__.d(getter, 'a', getter); - /******/ return getter; - /******/ }; - /******/ - /******/ // Object.prototype.hasOwnProperty.call - /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; - /******/ - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = ""; - /******/ - /******/ - /******/ // Load entry module and return exports - /******/ return __webpack_require__(__webpack_require__.s = 0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0; - var validator_1 = __webpack_require__(1); - var TraceType; - (function (TraceType) { - TraceType[TraceType["Information"] = 0] = "Information"; - TraceType[TraceType["Verbose"] = 1] = "Verbose"; - TraceType[TraceType["Warning"] = 2] = "Warning"; - TraceType[TraceType["Error"] = 3] = "Error"; - TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError"; - TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError"; - TraceType[TraceType["Fatal"] = 6] = "Fatal"; - })(TraceType = exports.TraceType || (exports.TraceType = {})); - var PageSizeType; - (function (PageSizeType) { - PageSizeType[PageSizeType["Widescreen"] = 0] = "Widescreen"; - PageSizeType[PageSizeType["Standard"] = 1] = "Standard"; - PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana"; - PageSizeType[PageSizeType["Letter"] = 3] = "Letter"; - PageSizeType[PageSizeType["Custom"] = 4] = "Custom"; - })(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {})); - var DisplayOption; - (function (DisplayOption) { - DisplayOption[DisplayOption["FitToPage"] = 0] = "FitToPage"; - DisplayOption[DisplayOption["FitToWidth"] = 1] = "FitToWidth"; - DisplayOption[DisplayOption["ActualSize"] = 2] = "ActualSize"; - })(DisplayOption = exports.DisplayOption || (exports.DisplayOption = {})); - var BackgroundType; - (function (BackgroundType) { - BackgroundType[BackgroundType["Default"] = 0] = "Default"; - BackgroundType[BackgroundType["Transparent"] = 1] = "Transparent"; - })(BackgroundType = exports.BackgroundType || (exports.BackgroundType = {})); - var VisualContainerDisplayMode; - (function (VisualContainerDisplayMode) { - VisualContainerDisplayMode[VisualContainerDisplayMode["Visible"] = 0] = "Visible"; - VisualContainerDisplayMode[VisualContainerDisplayMode["Hidden"] = 1] = "Hidden"; - })(VisualContainerDisplayMode = exports.VisualContainerDisplayMode || (exports.VisualContainerDisplayMode = {})); - var LayoutType; - (function (LayoutType) { - LayoutType[LayoutType["Master"] = 0] = "Master"; - LayoutType[LayoutType["Custom"] = 1] = "Custom"; - LayoutType[LayoutType["MobilePortrait"] = 2] = "MobilePortrait"; - LayoutType[LayoutType["MobileLandscape"] = 3] = "MobileLandscape"; - })(LayoutType = exports.LayoutType || (exports.LayoutType = {})); - var HyperlinkClickBehavior; - (function (HyperlinkClickBehavior) { - HyperlinkClickBehavior[HyperlinkClickBehavior["Navigate"] = 0] = "Navigate"; - HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent"; - HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent"; - })(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {})); - var SectionVisibility; - (function (SectionVisibility) { - SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible"; - SectionVisibility[SectionVisibility["HiddenInViewMode"] = 1] = "HiddenInViewMode"; - })(SectionVisibility = exports.SectionVisibility || (exports.SectionVisibility = {})); - var Permissions; - (function (Permissions) { - Permissions[Permissions["Read"] = 0] = "Read"; - Permissions[Permissions["ReadWrite"] = 1] = "ReadWrite"; - Permissions[Permissions["Copy"] = 2] = "Copy"; - Permissions[Permissions["Create"] = 4] = "Create"; - Permissions[Permissions["All"] = 7] = "All"; - })(Permissions = exports.Permissions || (exports.Permissions = {})); - var ViewMode; - (function (ViewMode) { - ViewMode[ViewMode["View"] = 0] = "View"; - ViewMode[ViewMode["Edit"] = 1] = "Edit"; - })(ViewMode = exports.ViewMode || (exports.ViewMode = {})); - var TokenType; - (function (TokenType) { - TokenType[TokenType["Aad"] = 0] = "Aad"; - TokenType[TokenType["Embed"] = 1] = "Embed"; - })(TokenType = exports.TokenType || (exports.TokenType = {})); - var ContrastMode; - (function (ContrastMode) { - ContrastMode[ContrastMode["None"] = 0] = "None"; - ContrastMode[ContrastMode["HighContrast1"] = 1] = "HighContrast1"; - ContrastMode[ContrastMode["HighContrast2"] = 2] = "HighContrast2"; - ContrastMode[ContrastMode["HighContrastBlack"] = 3] = "HighContrastBlack"; - ContrastMode[ContrastMode["HighContrastWhite"] = 4] = "HighContrastWhite"; - })(ContrastMode = exports.ContrastMode || (exports.ContrastMode = {})); - var MenuLocation; - (function (MenuLocation) { - MenuLocation[MenuLocation["Bottom"] = 0] = "Bottom"; - MenuLocation[MenuLocation["Top"] = 1] = "Top"; - })(MenuLocation = exports.MenuLocation || (exports.MenuLocation = {})); - var FiltersLevel; - (function (FiltersLevel) { - FiltersLevel[FiltersLevel["Report"] = 0] = "Report"; - FiltersLevel[FiltersLevel["Page"] = 1] = "Page"; - FiltersLevel[FiltersLevel["Visual"] = 2] = "Visual"; - })(FiltersLevel = exports.FiltersLevel || (exports.FiltersLevel = {})); - var FilterType; - (function (FilterType) { - FilterType[FilterType["Advanced"] = 0] = "Advanced"; - FilterType[FilterType["Basic"] = 1] = "Basic"; - FilterType[FilterType["Unknown"] = 2] = "Unknown"; - FilterType[FilterType["IncludeExclude"] = 3] = "IncludeExclude"; - FilterType[FilterType["RelativeDate"] = 4] = "RelativeDate"; - FilterType[FilterType["TopN"] = 5] = "TopN"; - FilterType[FilterType["Tuple"] = 6] = "Tuple"; - FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime"; - })(FilterType = exports.FilterType || (exports.FilterType = {})); - var RelativeDateFilterTimeUnit; - (function (RelativeDateFilterTimeUnit) { - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Days"] = 0] = "Days"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Weeks"] = 1] = "Weeks"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarWeeks"] = 2] = "CalendarWeeks"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Months"] = 3] = "Months"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarMonths"] = 4] = "CalendarMonths"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Years"] = 5] = "Years"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarYears"] = 6] = "CalendarYears"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Minutes"] = 7] = "Minutes"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Hours"] = 8] = "Hours"; - })(RelativeDateFilterTimeUnit = exports.RelativeDateFilterTimeUnit || (exports.RelativeDateFilterTimeUnit = {})); - var RelativeDateOperators; - (function (RelativeDateOperators) { - RelativeDateOperators[RelativeDateOperators["InLast"] = 0] = "InLast"; - RelativeDateOperators[RelativeDateOperators["InThis"] = 1] = "InThis"; - RelativeDateOperators[RelativeDateOperators["InNext"] = 2] = "InNext"; - })(RelativeDateOperators = exports.RelativeDateOperators || (exports.RelativeDateOperators = {})); - var Filter = /** @class */ (function () { - function Filter(target, filterType) { - this.target = target; - this.filterType = filterType; - } - Filter.prototype.toJSON = function () { - var filter = { - $schema: this.schemaUrl, - target: this.target, - filterType: this.filterType - }; - // Add displaySettings only when defined - if (this.displaySettings !== undefined) { - filter.displaySettings = this.displaySettings; - } - return filter; - }; - return Filter; - }()); - exports.Filter = Filter; - var NotSupportedFilter = /** @class */ (function (_super) { - __extends(NotSupportedFilter, _super); - function NotSupportedFilter(target, message, notSupportedTypeName) { - var _this = _super.call(this, target, FilterType.Unknown) || this; - _this.message = message; - _this.notSupportedTypeName = notSupportedTypeName; - _this.schemaUrl = NotSupportedFilter.schemaUrl; - return _this; - } - NotSupportedFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.message = this.message; - filter.notSupportedTypeName = this.notSupportedTypeName; - return filter; - }; - NotSupportedFilter.schemaUrl = "http://powerbi.com/product/schema#notSupported"; - return NotSupportedFilter; - }(Filter)); - exports.NotSupportedFilter = NotSupportedFilter; - var IncludeExcludeFilter = /** @class */ (function (_super) { - __extends(IncludeExcludeFilter, _super); - function IncludeExcludeFilter(target, isExclude, values) { - var _this = _super.call(this, target, FilterType.IncludeExclude) || this; - _this.values = values; - _this.isExclude = isExclude; - _this.schemaUrl = IncludeExcludeFilter.schemaUrl; - return _this; - } - IncludeExcludeFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.isExclude = this.isExclude; - filter.values = this.values; - return filter; - }; - IncludeExcludeFilter.schemaUrl = "http://powerbi.com/product/schema#includeExclude"; - return IncludeExcludeFilter; - }(Filter)); - exports.IncludeExcludeFilter = IncludeExcludeFilter; - var TopNFilter = /** @class */ (function (_super) { - __extends(TopNFilter, _super); - function TopNFilter(target, operator, itemCount, orderBy) { - var _this = _super.call(this, target, FilterType.TopN) || this; - _this.operator = operator; - _this.itemCount = itemCount; - _this.schemaUrl = TopNFilter.schemaUrl; - _this.orderBy = orderBy; - return _this; - } - TopNFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.itemCount = this.itemCount; - filter.orderBy = this.orderBy; - return filter; - }; - TopNFilter.schemaUrl = "http://powerbi.com/product/schema#topN"; - return TopNFilter; - }(Filter)); - exports.TopNFilter = TopNFilter; - var RelativeDateFilter = /** @class */ (function (_super) { - __extends(RelativeDateFilter, _super); - function RelativeDateFilter(target, operator, timeUnitsCount, timeUnitType, includeToday) { - var _this = _super.call(this, target, FilterType.RelativeDate) || this; - _this.operator = operator; - _this.timeUnitsCount = timeUnitsCount; - _this.timeUnitType = timeUnitType; - _this.includeToday = includeToday; - _this.schemaUrl = RelativeDateFilter.schemaUrl; - return _this; - } - RelativeDateFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.timeUnitsCount = this.timeUnitsCount; - filter.timeUnitType = this.timeUnitType; - filter.includeToday = this.includeToday; - return filter; - }; - RelativeDateFilter.schemaUrl = "http://powerbi.com/product/schema#relativeDate"; - return RelativeDateFilter; - }(Filter)); - exports.RelativeDateFilter = RelativeDateFilter; - var RelativeTimeFilter = /** @class */ (function (_super) { - __extends(RelativeTimeFilter, _super); - function RelativeTimeFilter(target, operator, timeUnitsCount, timeUnitType) { - var _this = _super.call(this, target, FilterType.RelativeTime) || this; - _this.operator = operator; - _this.timeUnitsCount = timeUnitsCount; - _this.timeUnitType = timeUnitType; - _this.schemaUrl = RelativeTimeFilter.schemaUrl; - return _this; - } - RelativeTimeFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.timeUnitsCount = this.timeUnitsCount; - filter.timeUnitType = this.timeUnitType; - return filter; - }; - RelativeTimeFilter.schemaUrl = "http://powerbi.com/product/schema#relativeTime"; - return RelativeTimeFilter; - }(Filter)); - exports.RelativeTimeFilter = RelativeTimeFilter; - var BasicFilter = /** @class */ (function (_super) { - __extends(BasicFilter, _super); - function BasicFilter(target, operator) { - var values = []; - for (var _i = 2; _i < arguments.length; _i++) { - values[_i - 2] = arguments[_i]; - } - var _this = _super.call(this, target, FilterType.Basic) || this; - _this.operator = operator; - _this.schemaUrl = BasicFilter.schemaUrl; - if (values.length === 0 && operator !== "All") { - throw new Error("values must be a non-empty array unless your operator is \"All\"."); - } - /** - * Accept values as array instead of as individual arguments - * new BasicFilter('a', 'b', 1, 2); - * new BasicFilter('a', 'b', [1,2]); - */ - if (Array.isArray(values[0])) { - _this.values = values[0]; - } - else { - _this.values = values; - } - return _this; - } - BasicFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.values = this.values; - filter.requireSingleSelection = !!this.requireSingleSelection; - return filter; - }; - BasicFilter.schemaUrl = "http://powerbi.com/product/schema#basic"; - return BasicFilter; - }(Filter)); - exports.BasicFilter = BasicFilter; - var BasicFilterWithKeys = /** @class */ (function (_super) { - __extends(BasicFilterWithKeys, _super); - function BasicFilterWithKeys(target, operator, values, keyValues) { - var _this = _super.call(this, target, operator, values) || this; - _this.keyValues = keyValues; - _this.target = target; - var numberOfKeys = target.keys ? target.keys.length : 0; - if (numberOfKeys > 0 && !keyValues) { - throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys"); - } - if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { - throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); - } - for (var _i = 0, _a = _this.keyValues; _i < _a.length; _i++) { - var keyValue = _a[_i]; - if (keyValue) { - var lengthOfArray = keyValue.length; - if (lengthOfArray !== numberOfKeys) { - throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); - } - } - } - return _this; - } - BasicFilterWithKeys.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.keyValues = this.keyValues; - return filter; - }; - return BasicFilterWithKeys; - }(BasicFilter)); - exports.BasicFilterWithKeys = BasicFilterWithKeys; - var TupleFilter = /** @class */ (function (_super) { - __extends(TupleFilter, _super); - function TupleFilter(target, operator, values) { - var _this = _super.call(this, target, FilterType.Tuple) || this; - _this.operator = operator; - _this.schemaUrl = TupleFilter.schemaUrl; - _this.values = values; - return _this; - } - TupleFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.values = this.values; - filter.target = this.target; - return filter; - }; - TupleFilter.schemaUrl = "http://powerbi.com/product/schema#tuple"; - return TupleFilter; - }(Filter)); - exports.TupleFilter = TupleFilter; - var AdvancedFilter = /** @class */ (function (_super) { - __extends(AdvancedFilter, _super); - function AdvancedFilter(target, logicalOperator) { - var conditions = []; - for (var _i = 2; _i < arguments.length; _i++) { - conditions[_i - 2] = arguments[_i]; - } - var _this = _super.call(this, target, FilterType.Advanced) || this; - _this.schemaUrl = AdvancedFilter.schemaUrl; - // Guard statements - if (typeof logicalOperator !== "string" || logicalOperator.length === 0) { - // TODO: It would be nicer to list out the possible logical operators. - throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator); - } - _this.logicalOperator = logicalOperator; - var extractedConditions; - /** - * Accept conditions as array instead of as individual arguments - * new AdvancedFilter('a', 'b', "And", { value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }); - * new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]); - */ - if (Array.isArray(conditions[0])) { - extractedConditions = conditions[0]; - } - else { - extractedConditions = conditions; - } - if (extractedConditions.length === 0) { - throw new Error("conditions must be a non-empty array. You passed: " + conditions); - } - if (extractedConditions.length > 2) { - throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length); - } - if (extractedConditions.length === 1 && logicalOperator !== "And") { - throw new Error("Logical Operator must be \"And\" when there is only one condition provided"); - } - _this.conditions = extractedConditions; - return _this; - } - AdvancedFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.logicalOperator = this.logicalOperator; - filter.conditions = this.conditions; - return filter; - }; - AdvancedFilter.schemaUrl = "http://powerbi.com/product/schema#advanced"; - return AdvancedFilter; - }(Filter)); - exports.AdvancedFilter = AdvancedFilter; - function isFilterKeyColumnsTarget(target) { - return isColumn(target) && !!target.keys; - } - exports.isFilterKeyColumnsTarget = isFilterKeyColumnsTarget; - function isBasicFilterWithKeys(filter) { - return getFilterType(filter) === FilterType.Basic && !!filter.keyValues; - } - exports.isBasicFilterWithKeys = isBasicFilterWithKeys; - function getFilterType(filter) { - if (filter.filterType) { - return filter.filterType; - } - var basicFilter = filter; - var advancedFilter = filter; - if ((typeof basicFilter.operator === "string") - && (Array.isArray(basicFilter.values))) { - return FilterType.Basic; - } - else if ((typeof advancedFilter.logicalOperator === "string") - && (Array.isArray(advancedFilter.conditions))) { - return FilterType.Advanced; - } - else { - return FilterType.Unknown; - } - } - exports.getFilterType = getFilterType; - function isMeasure(arg) { - return arg.table !== undefined && arg.measure !== undefined; - } - exports.isMeasure = isMeasure; - function isColumn(arg) { - return !!(arg.table && arg.column && !arg.aggregationFunction); - } - exports.isColumn = isColumn; - function isHierarchyLevel(arg) { - return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && !arg.aggregationFunction); - } - exports.isHierarchyLevel = isHierarchyLevel; - function isHierarchyLevelAggr(arg) { - return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && arg.aggregationFunction); - } - exports.isHierarchyLevelAggr = isHierarchyLevelAggr; - function isColumnAggr(arg) { - return !!(arg.table && arg.column && arg.aggregationFunction); - } - exports.isColumnAggr = isColumnAggr; - var PageNavigationPosition; - (function (PageNavigationPosition) { - PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; - PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; - })(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); - var QnaMode; - (function (QnaMode) { - QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; - QnaMode[QnaMode["ResultOnly"] = 1] = "ResultOnly"; - })(QnaMode = exports.QnaMode || (exports.QnaMode = {})); - var ExportDataType; - (function (ExportDataType) { - ExportDataType[ExportDataType["Summarized"] = 0] = "Summarized"; - ExportDataType[ExportDataType["Underlying"] = 1] = "Underlying"; - })(ExportDataType = exports.ExportDataType || (exports.ExportDataType = {})); - var BookmarksPlayMode; - (function (BookmarksPlayMode) { - BookmarksPlayMode[BookmarksPlayMode["Off"] = 0] = "Off"; - BookmarksPlayMode[BookmarksPlayMode["Presentation"] = 1] = "Presentation"; - })(BookmarksPlayMode = exports.BookmarksPlayMode || (exports.BookmarksPlayMode = {})); - // This is not an enum because enum strings require - // us to upgrade typeScript version and change SDK build definition - exports.CommonErrorCodes = { - TokenExpired: 'TokenExpired', - NotFound: 'PowerBIEntityNotFound', - InvalidParameters: 'Invalid parameters', - LoadReportFailed: 'LoadReportFailed', - NotAuthorized: 'PowerBINotAuthorizedException', - FailedToLoadModel: 'ExplorationContainer_FailedToLoadModel_DefaultDetails', - }; - exports.TextAlignment = { - Left: 'left', - Center: 'center', - Right: 'right', - }; - exports.LegendPosition = { - Top: 'Top', - Bottom: 'Bottom', - Right: 'Right', - Left: 'Left', - TopCenter: 'TopCenter', - BottomCenter: 'BottomCenter', - RightCenter: 'RightCenter', - LeftCenter: 'LeftCenter', - }; - var SortDirection; - (function (SortDirection) { - SortDirection[SortDirection["Ascending"] = 1] = "Ascending"; - SortDirection[SortDirection["Descending"] = 2] = "Descending"; - })(SortDirection = exports.SortDirection || (exports.SortDirection = {})); - var Selector = /** @class */ (function () { - function Selector(schema) { - this.$schema = schema; - } - Selector.prototype.toJSON = function () { - return { - $schema: this.$schema - }; - }; - return Selector; - }()); - exports.Selector = Selector; - var PageSelector = /** @class */ (function (_super) { - __extends(PageSelector, _super); - function PageSelector(pageName) { - var _this = _super.call(this, PageSelector.schemaUrl) || this; - _this.pageName = pageName; - return _this; - } - PageSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.pageName = this.pageName; - return selector; - }; - PageSelector.schemaUrl = "http://powerbi.com/product/schema#pageSelector"; - return PageSelector; - }(Selector)); - exports.PageSelector = PageSelector; - var VisualSelector = /** @class */ (function (_super) { - __extends(VisualSelector, _super); - function VisualSelector(visualName) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.visualName = visualName; - return _this; - } - VisualSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.visualName = this.visualName; - return selector; - }; - VisualSelector.schemaUrl = "http://powerbi.com/product/schema#visualSelector"; - return VisualSelector; - }(Selector)); - exports.VisualSelector = VisualSelector; - var VisualTypeSelector = /** @class */ (function (_super) { - __extends(VisualTypeSelector, _super); - function VisualTypeSelector(visualType) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.visualType = visualType; - return _this; - } - VisualTypeSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.visualType = this.visualType; - return selector; - }; - VisualTypeSelector.schemaUrl = "http://powerbi.com/product/schema#visualTypeSelector"; - return VisualTypeSelector; - }(Selector)); - exports.VisualTypeSelector = VisualTypeSelector; - var SlicerTargetSelector = /** @class */ (function (_super) { - __extends(SlicerTargetSelector, _super); - function SlicerTargetSelector(target) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.target = target; - return _this; - } - SlicerTargetSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.target = this.target; - return selector; - }; - SlicerTargetSelector.schemaUrl = "http://powerbi.com/product/schema#slicerTargetSelector"; - return SlicerTargetSelector; - }(Selector)); - exports.SlicerTargetSelector = SlicerTargetSelector; - var CommandDisplayOption; - (function (CommandDisplayOption) { - CommandDisplayOption[CommandDisplayOption["Enabled"] = 0] = "Enabled"; - CommandDisplayOption[CommandDisplayOption["Disabled"] = 1] = "Disabled"; - CommandDisplayOption[CommandDisplayOption["Hidden"] = 2] = "Hidden"; - })(CommandDisplayOption = exports.CommandDisplayOption || (exports.CommandDisplayOption = {})); - /* - * Visual CRUD - */ - var VisualDataRoleKind; - (function (VisualDataRoleKind) { - // Indicates that the role should be bound to something that evaluates to a grouping of values. - VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping"; - // Indicates that the role should be bound to something that evaluates to a single value in a scope. - VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure"; - // Indicates that the role can be bound to either Grouping or Measure. - VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure"; - })(VisualDataRoleKind = exports.VisualDataRoleKind || (exports.VisualDataRoleKind = {})); - // Indicates the visual preference on Grouping or Measure. Only applicable if kind is GroupingOrMeasure. - var VisualDataRoleKindPreference; - (function (VisualDataRoleKindPreference) { - VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; - VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; - })(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); - function isFlatMenuExtension(menuExtension) { - return menuExtension && !isGroupedMenuExtension(menuExtension); - } - exports.isFlatMenuExtension = isFlatMenuExtension; - function isGroupedMenuExtension(menuExtension) { - return menuExtension && !!menuExtension.groupName; - } - exports.isGroupedMenuExtension = isGroupedMenuExtension; - function isIExtensions(extensions) { - return extensions && !isIExtensionArray(extensions); - } - exports.isIExtensions = isIExtensions; - function isIExtensionArray(extensions) { - return Array.isArray(extensions); - } - exports.isIExtensionArray = isIExtensionArray; - function normalizeError(error) { - var message = error.message; - if (!message) { - message = error.path + " is invalid. Not meeting " + error.keyword + " constraint"; - } - return { - message: message - }; - } - function validateVisualSelector(input) { - var errors = validator_1.Validators.visualSelectorValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualSelector = validateVisualSelector; - function validateSlicer(input) { - var errors = validator_1.Validators.slicerValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSlicer = validateSlicer; - function validateSlicerState(input) { - var errors = validator_1.Validators.slicerStateValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSlicerState = validateSlicerState; - function validatePlayBookmarkRequest(input) { - var errors = validator_1.Validators.playBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; - function validateAddBookmarkRequest(input) { - var errors = validator_1.Validators.addBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateAddBookmarkRequest = validateAddBookmarkRequest; - function validateApplyBookmarkByNameRequest(input) { - var errors = validator_1.Validators.applyBookmarkByNameRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; - function validateApplyBookmarkStateRequest(input) { - var errors = validator_1.Validators.applyBookmarkStateRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; - function validateCaptureBookmarkRequest(input) { - var errors = validator_1.Validators.captureBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; - function validateSettings(input) { - var errors = validator_1.Validators.settingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSettings = validateSettings; - function validatePanes(input) { - var errors = validator_1.Validators.reportPanesValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePanes = validatePanes; - function validateBookmarksPane(input) { - var errors = validator_1.Validators.bookmarksPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateBookmarksPane = validateBookmarksPane; - function validateFiltersPane(input) { - var errors = validator_1.Validators.filtersPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateFiltersPane = validateFiltersPane; - function validateFieldsPane(input) { - var errors = validator_1.Validators.fieldsPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateFieldsPane = validateFieldsPane; - function validatePageNavigationPane(input) { - var errors = validator_1.Validators.pageNavigationPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePageNavigationPane = validatePageNavigationPane; - function validateSelectionPane(input) { - var errors = validator_1.Validators.selectionPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSelectionPane = validateSelectionPane; - function validateSyncSlicersPane(input) { - var errors = validator_1.Validators.syncSlicersPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSyncSlicersPane = validateSyncSlicersPane; - function validateVisualizationsPane(input) { - var errors = validator_1.Validators.visualizationsPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualizationsPane = validateVisualizationsPane; - function validateCustomPageSize(input) { - var errors = validator_1.Validators.customPageSizeValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCustomPageSize = validateCustomPageSize; - function validateExtension(input) { - var errors = validator_1.Validators.extensionValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateExtension = validateExtension; - function validateMenuGroupExtension(input) { - var errors = validator_1.Validators.menuGroupExtensionValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateMenuGroupExtension = validateMenuGroupExtension; - function validateReportLoad(input) { - var errors = validator_1.Validators.reportLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateReportLoad = validateReportLoad; - function validateCreateReport(input) { - var errors = validator_1.Validators.reportCreateValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCreateReport = validateCreateReport; - function validateDashboardLoad(input) { - var errors = validator_1.Validators.dashboardLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateDashboardLoad = validateDashboardLoad; - function validateTileLoad(input) { - var errors = validator_1.Validators.tileLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateTileLoad = validateTileLoad; - function validatePage(input) { - var errors = validator_1.Validators.pageValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validatePage = validatePage; - function validateFilter(input) { - var errors = validator_1.Validators.filtersValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateFilter = validateFilter; - function validateSaveAsParameters(input) { - var errors = validator_1.Validators.saveAsParametersValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateSaveAsParameters = validateSaveAsParameters; - function validateLoadQnaConfiguration(input) { - var errors = validator_1.Validators.loadQnaValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; - function validateQnaInterpretInputData(input) { - var errors = validator_1.Validators.qnaInterpretInputDataValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateQnaInterpretInputData = validateQnaInterpretInputData; - function validateExportDataRequest(input) { - var errors = validator_1.Validators.exportDataRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateExportDataRequest = validateExportDataRequest; - function validateVisualHeader(input) { - var errors = validator_1.Validators.visualHeaderValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualHeader = validateVisualHeader; - function validateVisualSettings(input) { - var errors = validator_1.Validators.visualSettingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateVisualSettings = validateVisualSettings; - function validateCommandsSettings(input) { - var errors = validator_1.Validators.commandsSettingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCommandsSettings = validateCommandsSettings; - function validateCustomTheme(input) { - var errors = validator_1.Validators.customThemeValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; - } - exports.validateCustomTheme = validateCustomTheme; - - - /***/ }), - /* 1 */ - /***/ (function(module, exports, __webpack_require__) { - - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Validators = void 0; - var barsValidator_1 = __webpack_require__(2); - var bookmarkValidator_1 = __webpack_require__(5); - var commandsSettingsValidator_1 = __webpack_require__(6); - var customThemeValidator_1 = __webpack_require__(7); - var dashboardLoadValidator_1 = __webpack_require__(8); - var datasetBindingValidator_1 = __webpack_require__(9); - var exportDataValidator_1 = __webpack_require__(10); - var extensionsValidator_1 = __webpack_require__(11); - var filtersValidator_1 = __webpack_require__(12); - var layoutValidator_1 = __webpack_require__(13); - var pageValidator_1 = __webpack_require__(14); - var panesValidator_1 = __webpack_require__(15); - var qnaValidator_1 = __webpack_require__(16); - var reportCreateValidator_1 = __webpack_require__(17); - var reportLoadValidator_1 = __webpack_require__(18); - var saveAsParametersValidator_1 = __webpack_require__(19); - var selectorsValidator_1 = __webpack_require__(20); - var settingsValidator_1 = __webpack_require__(21); - var slicersValidator_1 = __webpack_require__(22); - var tileLoadValidator_1 = __webpack_require__(23); - var visualSettingsValidator_1 = __webpack_require__(24); - var anyOfValidator_1 = __webpack_require__(25); - var fieldForbiddenValidator_1 = __webpack_require__(26); - var fieldRequiredValidator_1 = __webpack_require__(27); - var mapValidator_1 = __webpack_require__(28); - var typeValidator_1 = __webpack_require__(4); - exports.Validators = { - addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), - advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), - advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(), - anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]), - anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]), - anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]), - actionBarValidator: new barsValidator_1.ActionBarValidator(), - applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), - applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(), - applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]), - backgroundValidator: new typeValidator_1.EnumValidator([0, 1]), - basicFilterTypeValidator: new typeValidator_1.EnumValidator([1]), - basicFilterValidator: new filtersValidator_1.BasicFilterValidator(), - booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), - booleanValidator: new typeValidator_1.BooleanValidator(), - bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), - captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), - captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), - commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - commandExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.CommandExtensionValidator()]), - commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), - commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), - commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), - conditionItemValidator: new filtersValidator_1.ConditionItemValidator(), - contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]), - customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(), - customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(), - customThemeValidator: new customThemeValidator_1.CustomThemeValidator(), - dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(), - datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(), - displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]), - displayStateValidator: new layoutValidator_1.DisplayStateValidator(), - exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), - extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), - extensionsValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), new extensionsValidator_1.ExtensionsValidator()]), - extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), - extensionValidator: new extensionsValidator_1.ExtensionValidator(), - fieldForbiddenValidator: new fieldForbiddenValidator_1.FieldForbiddenValidator(), - fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), - fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), - filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), - filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]), - filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(), - filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(), - filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]), - filtersArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()])]), - filtersValidator: new filtersValidator_1.FilterValidator(), - filtersPaneValidator: new panesValidator_1.FiltersPaneValidator(), - hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(), - includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), - layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), - loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), - menuExtensionValidator: new anyOfValidator_1.AnyOfValidator([new extensionsValidator_1.FlatMenuExtensionValidator(), new extensionsValidator_1.GroupedMenuExtensionValidator()]), - menuGroupExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.MenuGroupExtensionValidator()]), - menuGroupExtensionValidator: new extensionsValidator_1.MenuGroupExtensionValidator(), - menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), - notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), - notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), - numberArrayValidator: new typeValidator_1.NumberArrayValidator(), - numberValidator: new typeValidator_1.NumberValidator(), - pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), - pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), - pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), - pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), - pageSizeValidator: new pageValidator_1.PageSizeValidator(), - pageValidator: new pageValidator_1.PageValidator(), - pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(), - pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]), - reportBarsValidator: new barsValidator_1.ReportBarsValidator(), - reportPanesValidator: new panesValidator_1.ReportPanesValidator(), - permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]), - playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(), - qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(), - qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(), - relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]), - relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]), - relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(), - relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]), - relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]), - relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(), - reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(), - reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(), - saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(), - selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(), - settingsValidator: new settingsValidator_1.SettingsValidator(), - singleCommandSettingsValidator: new commandsSettingsValidator_1.SingleCommandSettingsValidator(), - slicerSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.SlicerTargetSelectorValidator()]), - slicerStateValidator: new slicersValidator_1.SlicerStateValidator(), - slicerTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()]), - slicerValidator: new slicersValidator_1.SlicerValidator(), - stringArrayValidator: new typeValidator_1.StringArrayValidator(), - stringValidator: new typeValidator_1.StringValidator(), - syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(), - tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(), - tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]), - topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]), - topNFilterValidator: new filtersValidator_1.TopNFilterValidator(), - viewModeValidator: new typeValidator_1.EnumValidator([0, 1]), - visualCommandSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - visualHeaderSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - visualHeaderSettingsValidator: new visualSettingsValidator_1.VisualHeaderSettingsValidator(), - visualHeaderValidator: new visualSettingsValidator_1.VisualHeaderValidator(), - visualHeadersValidator: new typeValidator_1.ArrayValidator([new visualSettingsValidator_1.VisualHeaderValidator()]), - visualizationsPaneValidator: new panesValidator_1.VisualizationsPaneValidator(), - visualLayoutValidator: new layoutValidator_1.VisualLayoutValidator(), - visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(), - visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(), - visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(), - }; - - - /***/ }), - /* 2 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ActionBarValidator = exports.ReportBarsValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var ReportBarsValidator = /** @class */ (function (_super) { - __extends(ReportBarsValidator, _super); - function ReportBarsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportBarsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "actionBar", - validators: [validator_1.Validators.actionBarValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportBarsValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportBarsValidator = ReportBarsValidator; - var ActionBarValidator = /** @class */ (function (_super) { - __extends(ActionBarValidator, _super); - function ActionBarValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionBarValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ActionBarValidator; - }(typeValidator_1.ObjectValidator)); - exports.ActionBarValidator = ActionBarValidator; - - - /***/ }), - /* 3 */ - /***/ (function(module, exports) { - - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MultipleFieldsValidator = void 0; - var MultipleFieldsValidator = /** @class */ (function () { - function MultipleFieldsValidator(fieldValidatorsPairs) { - this.fieldValidatorsPairs = fieldValidatorsPairs; - } - MultipleFieldsValidator.prototype.validate = function (input, path, field) { - if (!this.fieldValidatorsPairs) { - return null; - } - var fieldsPath = path ? path + "." + field : field; - for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { - var fieldValidators = _a[_i]; - for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { - var validator = _c[_b]; - var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); - if (errors) { - return errors; - } - } - } - return null; - }; - return MultipleFieldsValidator; - }()); - exports.MultipleFieldsValidator = MultipleFieldsValidator; - - - /***/ }), - /* 4 */ - /***/ (function(module, exports) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0; - var ObjectValidator = /** @class */ (function () { - function ObjectValidator() { - } - ObjectValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (typeof input !== "object" || Array.isArray(input)) { - return [{ - message: field !== undefined ? field + " must be an object" : "input must be an object", - path: path, - keyword: "type" - }]; - } - return null; - }; - return ObjectValidator; - }()); - exports.ObjectValidator = ObjectValidator; - var ArrayValidator = /** @class */ (function () { - function ArrayValidator(itemValidators) { - this.itemValidators = itemValidators; - } - ArrayValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (!(Array.isArray(input))) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - for (var i = 0; i < input.length; i++) { - var fieldsPath = (path ? path + "." : "") + field + "." + i; - for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) { - var validator = _a[_i]; - var errors = validator.validate(input[i], fieldsPath, field); - if (errors) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - } - } - return null; - }; - return ArrayValidator; - }()); - exports.ArrayValidator = ArrayValidator; - var TypeValidator = /** @class */ (function () { - function TypeValidator(expectedType) { - this.expectedType = expectedType; - } - TypeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (!(typeof input === this.expectedType)) { - return [{ - message: field + " must be a " + this.expectedType, - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return TypeValidator; - }()); - exports.TypeValidator = TypeValidator; - var StringValidator = /** @class */ (function (_super) { - __extends(StringValidator, _super); - function StringValidator() { - return _super.call(this, "string") || this; - } - return StringValidator; - }(TypeValidator)); - exports.StringValidator = StringValidator; - var BooleanValidator = /** @class */ (function (_super) { - __extends(BooleanValidator, _super); - function BooleanValidator() { - return _super.call(this, "boolean") || this; - } - return BooleanValidator; - }(TypeValidator)); - exports.BooleanValidator = BooleanValidator; - var NumberValidator = /** @class */ (function (_super) { - __extends(NumberValidator, _super); - function NumberValidator() { - return _super.call(this, "number") || this; - } - return NumberValidator; - }(TypeValidator)); - exports.NumberValidator = NumberValidator; - var ValueValidator = /** @class */ (function () { - function ValueValidator(possibleValues) { - this.possibleValues = possibleValues; - } - ValueValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (this.possibleValues.indexOf(input) < 0) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return ValueValidator; - }()); - exports.ValueValidator = ValueValidator; - var SchemaValidator = /** @class */ (function (_super) { - __extends(SchemaValidator, _super); - function SchemaValidator(schemaValue) { - var _this = _super.call(this, [schemaValue]) || this; - _this.schemaValue = schemaValue; - return _this; - } - SchemaValidator.prototype.validate = function (input, path, field) { - return _super.prototype.validate.call(this, input, path, field); - }; - return SchemaValidator; - }(ValueValidator)); - exports.SchemaValidator = SchemaValidator; - var EnumValidator = /** @class */ (function (_super) { - __extends(EnumValidator, _super); - function EnumValidator(possibleValues) { - var _this = _super.call(this) || this; - _this.possibleValues = possibleValues; - return _this; - } - EnumValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var valueValidator = new ValueValidator(this.possibleValues); - return valueValidator.validate(input, path, field); - }; - return EnumValidator; - }(NumberValidator)); - exports.EnumValidator = EnumValidator; - var StringArrayValidator = /** @class */ (function (_super) { - __extends(StringArrayValidator, _super); - function StringArrayValidator() { - return _super.call(this, [new StringValidator()]) || this; - } - StringArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of strings", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return StringArrayValidator; - }(ArrayValidator)); - exports.StringArrayValidator = StringArrayValidator; - var BooleanArrayValidator = /** @class */ (function (_super) { - __extends(BooleanArrayValidator, _super); - function BooleanArrayValidator() { - return _super.call(this, [new BooleanValidator()]) || this; - } - BooleanArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of booleans", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return BooleanArrayValidator; - }(ArrayValidator)); - exports.BooleanArrayValidator = BooleanArrayValidator; - var NumberArrayValidator = /** @class */ (function (_super) { - __extends(NumberArrayValidator, _super); - function NumberArrayValidator() { - return _super.call(this, [new NumberValidator()]) || this; - } - NumberArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of numbers", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return NumberArrayValidator; - }(ArrayValidator)); - exports.NumberArrayValidator = NumberArrayValidator; - - - /***/ }), - /* 5 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var PlayBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(PlayBookmarkRequestValidator, _super); - function PlayBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "playMode", - validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PlayBookmarkRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; - var AddBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(AddBookmarkRequestValidator, _super); - function AddBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "displayName", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "apply", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return AddBookmarkRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; - var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkByNameRequestValidator, _super); - function ApplyBookmarkByNameRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ApplyBookmarkByNameRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; - var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkStateRequestValidator, _super); - function ApplyBookmarkStateRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ApplyBookmarkStateRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; - var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkOptionsValidator, _super); - function CaptureBookmarkOptionsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "personalizeVisuals", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CaptureBookmarkOptionsValidator; - }(typeValidator_1.ObjectValidator)); - exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; - var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkRequestValidator, _super); - function CaptureBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "options", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CaptureBookmarkRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; - - - /***/ }), - /* 6 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var CommandsSettingsValidator = /** @class */ (function (_super) { - __extends(CommandsSettingsValidator, _super); - function CommandsSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandsSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "copy", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "drill", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "drillthrough", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "expandCollapse", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "exportData", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "includeExclude", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "removeVisual", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "search", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "seeData", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "sort", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "spotlight", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CommandsSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.CommandsSettingsValidator = CommandsSettingsValidator; - var SingleCommandSettingsValidator = /** @class */ (function (_super) { - __extends(SingleCommandSettingsValidator, _super); - function SingleCommandSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "displayOption", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.visualCommandSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SingleCommandSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; - - - /***/ }), - /* 7 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.CustomThemeValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var CustomThemeValidator = /** @class */ (function (_super) { - __extends(CustomThemeValidator, _super); - function CustomThemeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomThemeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "themeJson", - validators: [new typeValidator_1.ObjectValidator()] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomThemeValidator; - }(typeValidator_1.ObjectValidator)); - exports.CustomThemeValidator = CustomThemeValidator; - - - /***/ }), - /* 8 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DashboardLoadValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var DashboardLoadValidator = /** @class */ (function (_super) { - __extends(DashboardLoadValidator, _super); - function DashboardLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DashboardLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "pageView", - validators: [validator_1.Validators.pageViewFieldValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DashboardLoadValidator; - }(typeValidator_1.ObjectValidator)); - exports.DashboardLoadValidator = DashboardLoadValidator; - - - /***/ }), - /* 9 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DatasetBindingValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var DatasetBindingValidator = /** @class */ (function (_super) { - __extends(DatasetBindingValidator, _super); - function DatasetBindingValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DatasetBindingValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DatasetBindingValidator; - }(typeValidator_1.ObjectValidator)); - exports.DatasetBindingValidator = DatasetBindingValidator; - - - /***/ }), - /* 10 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExportDataRequestValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var ExportDataRequestValidator = /** @class */ (function (_super) { - __extends(ExportDataRequestValidator, _super); - function ExportDataRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExportDataRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "rows", - validators: [new typeValidator_1.NumberValidator()] - }, - { - field: "exportDataType", - validators: [new typeValidator_1.EnumValidator([0, 1])] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExportDataRequestValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExportDataRequestValidator = ExportDataRequestValidator; - - - /***/ }), - /* 11 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExtensionsValidator = exports.MenuGroupExtensionValidator = exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.GroupedMenuExtensionValidator = exports.FlatMenuExtensionValidator = exports.MenuExtensionBaseValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var MenuExtensionBaseValidator = /** @class */ (function (_super) { - __extends(MenuExtensionBaseValidator, _super); - function MenuExtensionBaseValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - MenuExtensionBaseValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "title", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return MenuExtensionBaseValidator; - }(typeValidator_1.ObjectValidator)); - exports.MenuExtensionBaseValidator = MenuExtensionBaseValidator; - var FlatMenuExtensionValidator = /** @class */ (function (_super) { - __extends(FlatMenuExtensionValidator, _super); - function FlatMenuExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FlatMenuExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "menuLocation", - validators: [validator_1.Validators.menuLocationValidator] - }, - { - field: "groupName", - validators: [validator_1.Validators.fieldForbiddenValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FlatMenuExtensionValidator; - }(MenuExtensionBaseValidator)); - exports.FlatMenuExtensionValidator = FlatMenuExtensionValidator; - var GroupedMenuExtensionValidator = /** @class */ (function (_super) { - __extends(GroupedMenuExtensionValidator, _super); - function GroupedMenuExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - GroupedMenuExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "groupName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "menuLocation", - validators: [validator_1.Validators.fieldForbiddenValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return GroupedMenuExtensionValidator; - }(MenuExtensionBaseValidator)); - exports.GroupedMenuExtensionValidator = GroupedMenuExtensionValidator; - var ExtensionPointsValidator = /** @class */ (function (_super) { - __extends(ExtensionPointsValidator, _super); - function ExtensionPointsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionPointsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualContextMenu", - validators: [validator_1.Validators.menuExtensionValidator] - }, - { - field: "visualOptionsMenu", - validators: [validator_1.Validators.menuExtensionValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionPointsValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionPointsValidator = ExtensionPointsValidator; - var ExtensionItemValidator = /** @class */ (function (_super) { - __extends(ExtensionItemValidator, _super); - function ExtensionItemValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionItemValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "extend", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionItemValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionItemValidator = ExtensionItemValidator; - var CommandExtensionValidator = /** @class */ (function (_super) { - __extends(CommandExtensionValidator, _super); - function CommandExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "title", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.commandExtensionSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CommandExtensionValidator; - }(ExtensionItemValidator)); - exports.CommandExtensionValidator = CommandExtensionValidator; - var ExtensionValidator = /** @class */ (function (_super) { - __extends(ExtensionValidator, _super); - function ExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "command", - validators: [validator_1.Validators.commandExtensionValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionValidator = ExtensionValidator; - var MenuGroupExtensionValidator = /** @class */ (function (_super) { - __extends(MenuGroupExtensionValidator, _super); - function MenuGroupExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - MenuGroupExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "title", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "menuLocation", - validators: [validator_1.Validators.menuLocationValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return MenuGroupExtensionValidator; - }(typeValidator_1.ObjectValidator)); - exports.MenuGroupExtensionValidator = MenuGroupExtensionValidator; - var ExtensionsValidator = /** @class */ (function (_super) { - __extends(ExtensionsValidator, _super); - function ExtensionsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "commands", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandExtensionArrayValidator] - }, - { - field: "groups", - validators: [validator_1.Validators.menuGroupExtensionArrayValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionsValidator; - }(typeValidator_1.ObjectValidator)); - exports.ExtensionsValidator = ExtensionsValidator; - - - /***/ }), - /* 12 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var FilterColumnTargetValidator = /** @class */ (function (_super) { - __extends(FilterColumnTargetValidator, _super); - function FilterColumnTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterColumnTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "column", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterColumnTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterColumnTargetValidator = FilterColumnTargetValidator; - var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyColumnsTargetValidator, _super); - function FilterKeyColumnsTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterKeyColumnsTargetValidator; - }(FilterColumnTargetValidator)); - exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; - var FilterHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterHierarchyTargetValidator, _super); - function FilterHierarchyTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "hierarchy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "hierarchyLevel", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterHierarchyTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; - var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyHierarchyTargetValidator, _super); - function FilterKeyHierarchyTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterKeyHierarchyTargetValidator; - }(FilterHierarchyTargetValidator)); - exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; - var FilterMeasureTargetValidator = /** @class */ (function (_super) { - __extends(FilterMeasureTargetValidator, _super); - function FilterMeasureTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "measure", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterMeasureTargetValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; - var BasicFilterValidator = /** @class */ (function (_super) { - __extends(BasicFilterValidator, _super); - function BasicFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BasicFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.basicFilterTypeValidator] - }, - { - field: "requireSingleSelection", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return BasicFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.BasicFilterValidator = BasicFilterValidator; - var AdvancedFilterValidator = /** @class */ (function (_super) { - __extends(AdvancedFilterValidator, _super); - function AdvancedFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - AdvancedFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "logicalOperator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "conditions", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.advancedFilterTypeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return AdvancedFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.AdvancedFilterValidator = AdvancedFilterValidator; - var RelativeDateFilterValidator = /** @class */ (function (_super) { - __extends(RelativeDateFilterValidator, _super); - function RelativeDateFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - RelativeDateFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] - }, - { - field: "includeToday", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeDateFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return RelativeDateFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.RelativeDateFilterValidator = RelativeDateFilterValidator; - var RelativeTimeFilterValidator = /** @class */ (function (_super) { - __extends(RelativeTimeFilterValidator, _super); - function RelativeTimeFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeTimeFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return RelativeTimeFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; - var TopNFilterValidator = /** @class */ (function (_super) { - __extends(TopNFilterValidator, _super); - function TopNFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - TopNFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "itemCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.topNFilterTypeValidator] - }, - { - field: "orderBy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return TopNFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.TopNFilterValidator = TopNFilterValidator; - var NotSupportedFilterValidator = /** @class */ (function (_super) { - __extends(NotSupportedFilterValidator, _super); - function NotSupportedFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - NotSupportedFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.filterTargetValidator] - }, - { - field: "message", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "notSupportedTypeName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.notSupportedFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return NotSupportedFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.NotSupportedFilterValidator = NotSupportedFilterValidator; - var IncludeExcludeFilterValidator = /** @class */ (function (_super) { - __extends(IncludeExcludeFilterValidator, _super); - function IncludeExcludeFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "isExclude", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.includeExludeFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return IncludeExcludeFilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; - var FilterValidator = /** @class */ (function (_super) { - __extends(FilterValidator, _super); - function FilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - return validator_1.Validators.anyFilterValidator.validate(input, path, field); - }; - return FilterValidator; - }(typeValidator_1.ObjectValidator)); - exports.FilterValidator = FilterValidator; - var ConditionItemValidator = /** @class */ (function (_super) { - __extends(ConditionItemValidator, _super); - function ConditionItemValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ConditionItemValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "value", - validators: [validator_1.Validators.anyValueValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ConditionItemValidator; - }(typeValidator_1.ObjectValidator)); - exports.ConditionItemValidator = ConditionItemValidator; - - - /***/ }), - /* 13 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var CustomLayoutValidator = /** @class */ (function (_super) { - __extends(CustomLayoutValidator, _super); - function CustomLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "pageSize", - validators: [validator_1.Validators.pageSizeValidator] - }, - { - field: "displayOption", - validators: [validator_1.Validators.customLayoutDisplayOptionValidator] - }, - { - field: "pagesLayout", - validators: [validator_1.Validators.pagesLayoutValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomLayoutValidator; - }(typeValidator_1.ObjectValidator)); - exports.CustomLayoutValidator = CustomLayoutValidator; - var VisualLayoutValidator = /** @class */ (function (_super) { - __extends(VisualLayoutValidator, _super); - function VisualLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "x", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "y", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "z", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "displayState", - validators: [validator_1.Validators.displayStateValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualLayoutValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualLayoutValidator = VisualLayoutValidator; - var DisplayStateValidator = /** @class */ (function (_super) { - __extends(DisplayStateValidator, _super); - function DisplayStateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DisplayStateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "mode", - validators: [validator_1.Validators.displayStateModeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DisplayStateValidator; - }(typeValidator_1.ObjectValidator)); - exports.DisplayStateValidator = DisplayStateValidator; - var PageLayoutValidator = /** @class */ (function (_super) { - __extends(PageLayoutValidator, _super); - function PageLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualsLayout", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] - }, - { - field: "defaultLayout", - validators: [validator_1.Validators.visualLayoutValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageLayoutValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageLayoutValidator = PageLayoutValidator; - - - /***/ }), - /* 14 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var PageSizeValidator = /** @class */ (function (_super) { - __extends(PageSizeValidator, _super); - function PageSizeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageSizeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "type", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageSizeValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageSizeValidator = PageSizeValidator; - var CustomPageSizeValidator = /** @class */ (function (_super) { - __extends(CustomPageSizeValidator, _super); - function CustomPageSizeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomPageSizeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomPageSizeValidator; - }(PageSizeValidator)); - exports.CustomPageSizeValidator = CustomPageSizeValidator; - var PageValidator = /** @class */ (function (_super) { - __extends(PageValidator, _super); - function PageValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageValidator = PageValidator; - var PageViewFieldValidator = /** @class */ (function (_super) { - __extends(PageViewFieldValidator, _super); - function PageViewFieldValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageViewFieldValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; - if (possibleValues.indexOf(input) < 0) { - return [{ - message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" - }]; - } - return null; - }; - return PageViewFieldValidator; - }(typeValidator_1.StringValidator)); - exports.PageViewFieldValidator = PageViewFieldValidator; - - - /***/ }), - /* 15 */ - /***/ (function(module, exports, __webpack_require__) { - - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var ReportPanesValidator = /** @class */ (function (_super) { - __extends(ReportPanesValidator, _super); - function ReportPanesValidator() { - return _super !== null && _super.apply(this, arguments) || this; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var PlayBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(PlayBookmarkRequestValidator, _super); + function PlayBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "playMode", + validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PlayBookmarkRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; +var AddBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(AddBookmarkRequestValidator, _super); + function AddBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "displayName", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "apply", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return AddBookmarkRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; +var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkByNameRequestValidator, _super); + function ApplyBookmarkByNameRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ApplyBookmarkByNameRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; +var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkStateRequestValidator, _super); + function ApplyBookmarkStateRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ApplyBookmarkStateRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; +var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkOptionsValidator, _super); + function CaptureBookmarkOptionsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "personalizeVisuals", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkOptionsValidator; +}(typeValidator_1.ObjectValidator)); +exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; +var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkRequestValidator, _super); + function CaptureBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "options", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var CommandsSettingsValidator = /** @class */ (function (_super) { + __extends(CommandsSettingsValidator, _super); + function CommandsSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandsSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "copy", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "drill", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "drillthrough", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "expandCollapse", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "exportData", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "includeExclude", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "removeVisual", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "search", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "seeData", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "sort", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "spotlight", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandsSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.CommandsSettingsValidator = CommandsSettingsValidator; +var SingleCommandSettingsValidator = /** @class */ (function (_super) { + __extends(SingleCommandSettingsValidator, _super); + function SingleCommandSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "displayOption", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualCommandSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SingleCommandSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CustomThemeValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var CustomThemeValidator = /** @class */ (function (_super) { + __extends(CustomThemeValidator, _super); + function CustomThemeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomThemeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "themeJson", + validators: [new typeValidator_1.ObjectValidator()] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomThemeValidator; +}(typeValidator_1.ObjectValidator)); +exports.CustomThemeValidator = CustomThemeValidator; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DashboardLoadValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var DashboardLoadValidator = /** @class */ (function (_super) { + __extends(DashboardLoadValidator, _super); + function DashboardLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DashboardLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.pageViewFieldValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DashboardLoadValidator; +}(typeValidator_1.ObjectValidator)); +exports.DashboardLoadValidator = DashboardLoadValidator; + + +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DatasetBindingValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var DatasetBindingValidator = /** @class */ (function (_super) { + __extends(DatasetBindingValidator, _super); + function DatasetBindingValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DatasetBindingValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DatasetBindingValidator; +}(typeValidator_1.ObjectValidator)); +exports.DatasetBindingValidator = DatasetBindingValidator; + + +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExportDataRequestValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var ExportDataRequestValidator = /** @class */ (function (_super) { + __extends(ExportDataRequestValidator, _super); + function ExportDataRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExportDataRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "rows", + validators: [new typeValidator_1.NumberValidator()] + }, + { + field: "exportDataType", + validators: [new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExportDataRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExportDataRequestValidator = ExportDataRequestValidator; + + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtensionsValidator = exports.MenuGroupExtensionValidator = exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.GroupedMenuExtensionValidator = exports.FlatMenuExtensionValidator = exports.MenuExtensionBaseValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var MenuExtensionBaseValidator = /** @class */ (function (_super) { + __extends(MenuExtensionBaseValidator, _super); + function MenuExtensionBaseValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + MenuExtensionBaseValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "title", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "icon", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return MenuExtensionBaseValidator; +}(typeValidator_1.ObjectValidator)); +exports.MenuExtensionBaseValidator = MenuExtensionBaseValidator; +var FlatMenuExtensionValidator = /** @class */ (function (_super) { + __extends(FlatMenuExtensionValidator, _super); + function FlatMenuExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FlatMenuExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] + }, + { + field: "groupName", + validators: [validator_1.Validators.fieldForbiddenValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FlatMenuExtensionValidator; +}(MenuExtensionBaseValidator)); +exports.FlatMenuExtensionValidator = FlatMenuExtensionValidator; +var GroupedMenuExtensionValidator = /** @class */ (function (_super) { + __extends(GroupedMenuExtensionValidator, _super); + function GroupedMenuExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + GroupedMenuExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "groupName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "menuLocation", + validators: [validator_1.Validators.fieldForbiddenValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return GroupedMenuExtensionValidator; +}(MenuExtensionBaseValidator)); +exports.GroupedMenuExtensionValidator = GroupedMenuExtensionValidator; +var ExtensionPointsValidator = /** @class */ (function (_super) { + __extends(ExtensionPointsValidator, _super); + function ExtensionPointsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionPointsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualContextMenu", + validators: [validator_1.Validators.menuExtensionValidator] + }, + { + field: "visualOptionsMenu", + validators: [validator_1.Validators.menuExtensionValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionPointsValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionPointsValidator = ExtensionPointsValidator; +var ExtensionItemValidator = /** @class */ (function (_super) { + __extends(ExtensionItemValidator, _super); + function ExtensionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionItemValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "extend", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionItemValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionItemValidator = ExtensionItemValidator; +var CommandExtensionValidator = /** @class */ (function (_super) { + __extends(CommandExtensionValidator, _super); + function CommandExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "title", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "icon", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.commandExtensionSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandExtensionValidator; +}(ExtensionItemValidator)); +exports.CommandExtensionValidator = CommandExtensionValidator; +var ExtensionValidator = /** @class */ (function (_super) { + __extends(ExtensionValidator, _super); + function ExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "command", + validators: [validator_1.Validators.commandExtensionValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionValidator = ExtensionValidator; +var MenuGroupExtensionValidator = /** @class */ (function (_super) { + __extends(MenuGroupExtensionValidator, _super); + function MenuGroupExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + MenuGroupExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "title", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return MenuGroupExtensionValidator; +}(typeValidator_1.ObjectValidator)); +exports.MenuGroupExtensionValidator = MenuGroupExtensionValidator; +var ExtensionsValidator = /** @class */ (function (_super) { + __extends(ExtensionsValidator, _super); + function ExtensionsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "commands", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandExtensionArrayValidator] + }, + { + field: "groups", + validators: [validator_1.Validators.menuGroupExtensionArrayValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionsValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionsValidator = ExtensionsValidator; + + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var FilterColumnTargetValidator = /** @class */ (function (_super) { + __extends(FilterColumnTargetValidator, _super); + function FilterColumnTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterColumnTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "column", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterColumnTargetValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterColumnTargetValidator = FilterColumnTargetValidator; +var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyColumnsTargetValidator, _super); + function FilterKeyColumnsTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyColumnsTargetValidator; +}(FilterColumnTargetValidator)); +exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; +var FilterHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterHierarchyTargetValidator, _super); + function FilterHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "hierarchy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "hierarchyLevel", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterHierarchyTargetValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; +var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyHierarchyTargetValidator, _super); + function FilterKeyHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyHierarchyTargetValidator; +}(FilterHierarchyTargetValidator)); +exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; +var FilterMeasureTargetValidator = /** @class */ (function (_super) { + __extends(FilterMeasureTargetValidator, _super); + function FilterMeasureTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "measure", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterMeasureTargetValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; +var BasicFilterValidator = /** @class */ (function (_super) { + __extends(BasicFilterValidator, _super); + function BasicFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + BasicFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.basicFilterTypeValidator] + }, + { + field: "requireSingleSelection", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return BasicFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.BasicFilterValidator = BasicFilterValidator; +var AdvancedFilterValidator = /** @class */ (function (_super) { + __extends(AdvancedFilterValidator, _super); + function AdvancedFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AdvancedFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "logicalOperator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "conditions", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.advancedFilterTypeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return AdvancedFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.AdvancedFilterValidator = AdvancedFilterValidator; +var RelativeDateFilterValidator = /** @class */ (function (_super) { + __extends(RelativeDateFilterValidator, _super); + function RelativeDateFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelativeDateFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] + }, + { + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] + }, + { + field: "includeToday", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.relativeDateFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeDateFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.RelativeDateFilterValidator = RelativeDateFilterValidator; +var RelativeTimeFilterValidator = /** @class */ (function (_super) { + __extends(RelativeTimeFilterValidator, _super); + function RelativeTimeFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] + }, + { + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.relativeTimeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeTimeFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; +var TopNFilterValidator = /** @class */ (function (_super) { + __extends(TopNFilterValidator, _super); + function TopNFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + TopNFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "itemCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.topNFilterTypeValidator] + }, + { + field: "orderBy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return TopNFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.TopNFilterValidator = TopNFilterValidator; +var NotSupportedFilterValidator = /** @class */ (function (_super) { + __extends(NotSupportedFilterValidator, _super); + function NotSupportedFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + NotSupportedFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.filterTargetValidator] + }, + { + field: "message", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "notSupportedTypeName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.notSupportedFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return NotSupportedFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.NotSupportedFilterValidator = NotSupportedFilterValidator; +var IncludeExcludeFilterValidator = /** @class */ (function (_super) { + __extends(IncludeExcludeFilterValidator, _super); + function IncludeExcludeFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "isExclude", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.includeExludeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return IncludeExcludeFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; +var FilterValidator = /** @class */ (function (_super) { + __extends(FilterValidator, _super); + function FilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + return validator_1.Validators.anyFilterValidator.validate(input, path, field); + }; + return FilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterValidator = FilterValidator; +var ConditionItemValidator = /** @class */ (function (_super) { + __extends(ConditionItemValidator, _super); + function ConditionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConditionItemValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "value", + validators: [validator_1.Validators.anyValueValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ConditionItemValidator; +}(typeValidator_1.ObjectValidator)); +exports.ConditionItemValidator = ConditionItemValidator; + + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var CustomLayoutValidator = /** @class */ (function (_super) { + __extends(CustomLayoutValidator, _super); + function CustomLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "pageSize", + validators: [validator_1.Validators.pageSizeValidator] + }, + { + field: "displayOption", + validators: [validator_1.Validators.customLayoutDisplayOptionValidator] + }, + { + field: "pagesLayout", + validators: [validator_1.Validators.pagesLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomLayoutValidator; +}(typeValidator_1.ObjectValidator)); +exports.CustomLayoutValidator = CustomLayoutValidator; +var VisualLayoutValidator = /** @class */ (function (_super) { + __extends(VisualLayoutValidator, _super); + function VisualLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "x", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "y", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "z", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "displayState", + validators: [validator_1.Validators.displayStateValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualLayoutValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualLayoutValidator = VisualLayoutValidator; +var DisplayStateValidator = /** @class */ (function (_super) { + __extends(DisplayStateValidator, _super); + function DisplayStateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DisplayStateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "mode", + validators: [validator_1.Validators.displayStateModeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DisplayStateValidator; +}(typeValidator_1.ObjectValidator)); +exports.DisplayStateValidator = DisplayStateValidator; +var PageLayoutValidator = /** @class */ (function (_super) { + __extends(PageLayoutValidator, _super); + function PageLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualsLayout", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] + }, + { + field: "defaultLayout", + validators: [validator_1.Validators.visualLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageLayoutValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageLayoutValidator = PageLayoutValidator; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var PageSizeValidator = /** @class */ (function (_super) { + __extends(PageSizeValidator, _super); + function PageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "type", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageSizeValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageSizeValidator = PageSizeValidator; +var CustomPageSizeValidator = /** @class */ (function (_super) { + __extends(CustomPageSizeValidator, _super); + function CustomPageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomPageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomPageSizeValidator; +}(PageSizeValidator)); +exports.CustomPageSizeValidator = CustomPageSizeValidator; +var PageValidator = /** @class */ (function (_super) { + __extends(PageValidator, _super); + function PageValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageValidator = PageValidator; +var PageViewFieldValidator = /** @class */ (function (_super) { + __extends(PageViewFieldValidator, _super); + function PageViewFieldValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageViewFieldValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; + if (possibleValues.indexOf(input) < 0) { + return [{ + message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" + }]; + } + return null; + }; + return PageViewFieldValidator; +}(typeValidator_1.StringValidator)); +exports.PageViewFieldValidator = PageViewFieldValidator; + + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportPanesValidator = /** @class */ (function (_super) { + __extends(ReportPanesValidator, _super); + function ReportPanesValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportPanesValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "bookmarks", + validators: [validator_1.Validators.bookmarksPaneValidator] + }, + { + field: "fields", + validators: [validator_1.Validators.fieldsPaneValidator] + }, + { + field: "filters", + validators: [validator_1.Validators.filtersPaneValidator] + }, + { + field: "pageNavigation", + validators: [validator_1.Validators.pageNavigationPaneValidator] + }, + { + field: "selection", + validators: [validator_1.Validators.selectionPaneValidator] + }, + { + field: "syncSlicers", + validators: [validator_1.Validators.syncSlicersPaneValidator] + }, + { + field: "visualizations", + validators: [validator_1.Validators.visualizationsPaneValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportPanesValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportPanesValidator = ReportPanesValidator; +var BookmarksPaneValidator = /** @class */ (function (_super) { + __extends(BookmarksPaneValidator, _super); + function BookmarksPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + BookmarksPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return BookmarksPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.BookmarksPaneValidator = BookmarksPaneValidator; +var FieldsPaneValidator = /** @class */ (function (_super) { + __extends(FieldsPaneValidator, _super); + function FieldsPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FieldsPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FieldsPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.FieldsPaneValidator = FieldsPaneValidator; +var FiltersPaneValidator = /** @class */ (function (_super) { + __extends(FiltersPaneValidator, _super); + function FiltersPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FiltersPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FiltersPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.FiltersPaneValidator = FiltersPaneValidator; +var PageNavigationPaneValidator = /** @class */ (function (_super) { + __extends(PageNavigationPaneValidator, _super); + function PageNavigationPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageNavigationPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "position", + validators: [validator_1.Validators.pageNavigationPositionValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageNavigationPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageNavigationPaneValidator = PageNavigationPaneValidator; +var SelectionPaneValidator = /** @class */ (function (_super) { + __extends(SelectionPaneValidator, _super); + function SelectionPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SelectionPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SelectionPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.SelectionPaneValidator = SelectionPaneValidator; +var SyncSlicersPaneValidator = /** @class */ (function (_super) { + __extends(SyncSlicersPaneValidator, _super); + function SyncSlicersPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SyncSlicersPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; +var VisualizationsPaneValidator = /** @class */ (function (_super) { + __extends(VisualizationsPaneValidator, _super); + function VisualizationsPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualizationsPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualizationsPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualizationsPaneValidator = VisualizationsPaneValidator; + + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var LoadQnaValidator = /** @class */ (function (_super) { + __extends(LoadQnaValidator, _super); + function LoadQnaValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + LoadQnaValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "datasetIds", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.qnaSettingValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return LoadQnaValidator; +}(typeValidator_1.ObjectValidator)); +exports.LoadQnaValidator = LoadQnaValidator; +var QnaSettingsValidator = /** @class */ (function (_super) { + __extends(QnaSettingsValidator, _super); + function QnaSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.QnaSettingsValidator = QnaSettingsValidator; +var QnaInterpretInputDataValidator = /** @class */ (function (_super) { + __extends(QnaInterpretInputDataValidator, _super); + function QnaInterpretInputDataValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "datasetIds", + validators: [validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaInterpretInputDataValidator; +}(typeValidator_1.ObjectValidator)); +exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; + + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReportCreateValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportCreateValidator = /** @class */ (function (_super) { + __extends(ReportCreateValidator, _super); + function ReportCreateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportCreateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportCreateValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportCreateValidator = ReportCreateValidator; + + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReportLoadValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportLoadValidator = /** @class */ (function (_super) { + __extends(ReportLoadValidator, _super); + function ReportLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.settingsValidator] + }, + { + field: "pageName", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + }, + { + field: "permissions", + validators: [validator_1.Validators.permissionsValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "bookmark", + validators: [validator_1.Validators.applyBookmarkValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "datasetBinding", + validators: [validator_1.Validators.datasetBindingValidator] + }, + { + field: "contrastMode", + validators: [validator_1.Validators.contrastModeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportLoadValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportLoadValidator = ReportLoadValidator; + + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SaveAsParametersValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var SaveAsParametersValidator = /** @class */ (function (_super) { + __extends(SaveAsParametersValidator, _super); + function SaveAsParametersValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SaveAsParametersValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SaveAsParametersValidator; +}(typeValidator_1.ObjectValidator)); +exports.SaveAsParametersValidator = SaveAsParametersValidator; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var typeValidator_2 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var VisualSelectorValidator = /** @class */ (function (_super) { + __extends(VisualSelectorValidator, _super); + function VisualSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + // Not required for this selector only - Backward compatibility + field: "$schema", + validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] + }, + { + field: "visualName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSelectorValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualSelectorValidator = VisualSelectorValidator; +var VisualTypeSelectorValidator = /** @class */ (function (_super) { + __extends(VisualTypeSelectorValidator, _super); + function VisualTypeSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] + }, + { + field: "visualType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualTypeSelectorValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; +var SlicerTargetSelectorValidator = /** @class */ (function (_super) { + __extends(SlicerTargetSelectorValidator, _super); + function SlicerTargetSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] + }, + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerTargetSelectorValidator; +}(typeValidator_1.ObjectValidator)); +exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; + + +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SettingsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var SettingsValidator = /** @class */ (function (_super) { + __extends(SettingsValidator, _super); + function SettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "navContentPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "bookmarksPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "useCustomSaveAsDialog", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "extensions", + validators: [validator_1.Validators.extensionsValidator] + }, + { + field: "layoutType", + validators: [validator_1.Validators.layoutTypeValidator] + }, + { + field: "customLayout", + validators: [validator_1.Validators.customLayoutValidator] + }, + { + field: "background", + validators: [validator_1.Validators.backgroundValidator] + }, + { + field: "visualSettings", + validators: [validator_1.Validators.visualSettingsValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "commands", + validators: [validator_1.Validators.commandsSettingsArrayValidator] + }, + { + field: "hyperlinkClickBehavior", + validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] + }, + { + field: "bars", + validators: [validator_1.Validators.reportBarsValidator] + }, + { + field: "panes", + validators: [validator_1.Validators.reportPanesValidator] + }, + { + field: "personalBookmarksEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "persistentFiltersEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "visualRenderedEvents", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "authoringHintsEnabled", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.SettingsValidator = SettingsValidator; + + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SlicerStateValidator = exports.SlicerValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var SlicerValidator = /** @class */ (function (_super) { + __extends(SlicerValidator, _super); + function SlicerValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "selector", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] + }, + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerValidator; +}(typeValidator_1.ObjectValidator)); +exports.SlicerValidator = SlicerValidator; +var SlicerStateValidator = /** @class */ (function (_super) { + __extends(SlicerStateValidator, _super); + function SlicerStateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerStateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerStateValidator; +}(typeValidator_1.ObjectValidator)); +exports.SlicerStateValidator = SlicerStateValidator; + + +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TileLoadValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var TileLoadValidator = /** @class */ (function (_super) { + __extends(TileLoadValidator, _super); + function TileLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + TileLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "dashboardId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return TileLoadValidator; +}(typeValidator_1.ObjectValidator)); +exports.TileLoadValidator = TileLoadValidator; + + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var VisualSettingsValidator = /** @class */ (function (_super) { + __extends(VisualSettingsValidator, _super); + function VisualSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualHeaders", + validators: [validator_1.Validators.visualHeadersValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualSettingsValidator = VisualSettingsValidator; +var VisualHeaderSettingsValidator = /** @class */ (function (_super) { + __extends(VisualHeaderSettingsValidator, _super); + function VisualHeaderSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualHeaderSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; +var VisualHeaderValidator = /** @class */ (function (_super) { + __extends(VisualHeaderValidator, _super); + function VisualHeaderValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualHeaderValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "settings", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualHeaderSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualHeaderValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualHeaderValidator = VisualHeaderValidator; + + +/***/ }), +/* 25 */ +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnyOfValidator = void 0; +var AnyOfValidator = /** @class */ (function () { + function AnyOfValidator(validators) { + this.validators = validators; + } + AnyOfValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var valid = false; + for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input, path, field); + if (!errors) { + valid = true; + break; + } + } + if (!valid) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return AnyOfValidator; +}()); +exports.AnyOfValidator = AnyOfValidator; + + +/***/ }), +/* 26 */ +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FieldForbiddenValidator = void 0; +var FieldForbiddenValidator = /** @class */ (function () { + function FieldForbiddenValidator() { + } + FieldForbiddenValidator.prototype.validate = function (input, path, field) { + if (input !== undefined) { + return [{ + message: field + " is forbidden", + path: (path ? path + "." : "") + field, + keyword: "forbidden" + }]; + } + return null; + }; + return FieldForbiddenValidator; +}()); +exports.FieldForbiddenValidator = FieldForbiddenValidator; + + +/***/ }), +/* 27 */ +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FieldRequiredValidator = void 0; +var FieldRequiredValidator = /** @class */ (function () { + function FieldRequiredValidator() { + } + FieldRequiredValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return [{ + message: field + " is required", + path: (path ? path + "." : "") + field, + keyword: "required" + }]; + } + return null; + }; + return FieldRequiredValidator; +}()); +exports.FieldRequiredValidator = FieldRequiredValidator; + + +/***/ }), +/* 28 */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MapValidator = void 0; +var typeValidator_1 = __webpack_require__(4); +var MapValidator = /** @class */ (function (_super) { + __extends(MapValidator, _super); + function MapValidator(keyValidators, valueValidators) { + var _this = _super.call(this) || this; + _this.keyValidators = keyValidators; + _this.valueValidators = valueValidators; + return _this; + } + MapValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + for (var key in input) { + if (input.hasOwnProperty(key)) { + var fieldsPath = (path ? path + "." : "") + field + "." + key; + for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { + var keyValidator = _a[_i]; + errors = keyValidator.validate(key, fieldsPath, field); + if (errors) { + return errors; + } + } + for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { + var valueValidator = _c[_b]; + errors = valueValidator.validate(input[key], fieldsPath, field); + if (errors) { + return errors; + } + } + } + } + return null; + }; + return MapValidator; +}(typeValidator_1.ObjectValidator)); +exports.MapValidator = MapValidator; + + +/***/ }) +/******/ ]); +}); +//# sourceMappingURL=models.js.map + +/***/ }), + +/***/ "./node_modules/powerbi-router/dist/router.js": +/*!****************************************************!*\ + !*** ./node_modules/powerbi-router/dist/router.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/*! powerbi-router v0.1.5 | (c) 2016 Microsoft Corporation MIT */ +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else {} +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var RouteRecognizer = __webpack_require__(1); + var Router = (function () { + function Router(handlers) { + this.handlers = handlers; + /** + * TODO: look at generating the router dynamically based on list of supported http methods + * instead of hardcoding the creation of these and the methods. + */ + this.getRouteRecognizer = new RouteRecognizer(); + this.patchRouteRecognizer = new RouteRecognizer(); + this.postRouteRecognizer = new RouteRecognizer(); + this.putRouteRecognizer = new RouteRecognizer(); + this.deleteRouteRecognizer = new RouteRecognizer(); } - ReportPanesValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "bookmarks", - validators: [validator_1.Validators.bookmarksPaneValidator] - }, - { - field: "fields", - validators: [validator_1.Validators.fieldsPaneValidator] - }, - { - field: "filters", - validators: [validator_1.Validators.filtersPaneValidator] - }, - { - field: "pageNavigation", - validators: [validator_1.Validators.pageNavigationPaneValidator] - }, - { - field: "selection", - validators: [validator_1.Validators.selectionPaneValidator] - }, - { - field: "syncSlicers", - validators: [validator_1.Validators.syncSlicersPaneValidator] - }, - { - field: "visualizations", - validators: [validator_1.Validators.visualizationsPaneValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + Router.prototype.get = function (url, handler) { + this.registerHandler(this.getRouteRecognizer, "GET", url, handler); + return this; }; - return ReportPanesValidator; - }(typeValidator_1.ObjectValidator)); - exports.ReportPanesValidator = ReportPanesValidator; - var BookmarksPaneValidator = /** @class */ (function (_super) { - __extends(BookmarksPaneValidator, _super); - function BookmarksPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BookmarksPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + Router.prototype.patch = function (url, handler) { + this.registerHandler(this.patchRouteRecognizer, "PATCH", url, handler); + return this; }; - return BookmarksPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.BookmarksPaneValidator = BookmarksPaneValidator; - var FieldsPaneValidator = /** @class */ (function (_super) { - __extends(FieldsPaneValidator, _super); - function FieldsPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FieldsPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + Router.prototype.post = function (url, handler) { + this.registerHandler(this.postRouteRecognizer, "POST", url, handler); + return this; }; - return FieldsPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.FieldsPaneValidator = FieldsPaneValidator; - var FiltersPaneValidator = /** @class */ (function (_super) { - __extends(FiltersPaneValidator, _super); - function FiltersPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FiltersPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + Router.prototype.put = function (url, handler) { + this.registerHandler(this.putRouteRecognizer, "PUT", url, handler); + return this; }; - return FiltersPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.FiltersPaneValidator = FiltersPaneValidator; - var PageNavigationPaneValidator = /** @class */ (function (_super) { - __extends(PageNavigationPaneValidator, _super); - function PageNavigationPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageNavigationPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "position", - validators: [validator_1.Validators.pageNavigationPositionValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + Router.prototype.delete = function (url, handler) { + this.registerHandler(this.deleteRouteRecognizer, "DELETE", url, handler); + return this; }; - return PageNavigationPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.PageNavigationPaneValidator = PageNavigationPaneValidator; - var SelectionPaneValidator = /** @class */ (function (_super) { - __extends(SelectionPaneValidator, _super); - function SelectionPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SelectionPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + /** + * TODO: This method could use some refactoring. There is conflict of interest between keeping clean separation of test and handle method + * Test method only returns boolean indicating if request can be handled, and handle method has opportunity to modify response and return promise of it. + * In the case of the router with route-recognizer where handlers are associated with routes, this already guarantees that only one handler is selected and makes the test method feel complicated + * Will leave as is an investigate cleaner ways at later time. + */ + Router.prototype.registerHandler = function (routeRecognizer, method, url, handler) { + var routeRecognizerHandler = function (request) { + var response = new Response(); + return Promise.resolve(handler(request, response)) + .then(function (x) { return response; }); + }; + routeRecognizer.add([ + { path: url, handler: routeRecognizerHandler } + ]); + var internalHandler = { + test: function (request) { + if (request.method !== method) { + return false; + } + var matchingRoutes = routeRecognizer.recognize(request.url); + if (matchingRoutes === undefined) { + return false; + } + /** + * Copy parameters from recognized route to the request so they can be used within the handler function + * This isn't ideal because it is side affect which modifies the request instead of strictly testing for true or false + * but I don't see a better place to put this. If we move it between the call to test and the handle it becomes part of the window post message proxy + * even though it's responsibility is related to routing. + */ + var route = matchingRoutes[0]; + request.params = route.params; + request.queryParams = matchingRoutes.queryParams; + request.handler = route.handler; + return true; + }, + handle: function (request) { + return request.handler(request); + } + }; + this.handlers.addHandler(internalHandler); }; - return SelectionPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.SelectionPaneValidator = SelectionPaneValidator; - var SyncSlicersPaneValidator = /** @class */ (function (_super) { - __extends(SyncSlicersPaneValidator, _super); - function SyncSlicersPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; + return Router; + }()); + exports.Router = Router; + var Response = (function () { + function Response() { + this.statusCode = 200; + this.headers = {}; + this.body = null; } - SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + Response.prototype.send = function (statusCode, body) { + this.statusCode = statusCode; + this.body = body; }; - return SyncSlicersPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; - var VisualizationsPaneValidator = /** @class */ (function (_super) { - __extends(VisualizationsPaneValidator, _super); - function VisualizationsPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; + return Response; + }()); + exports.Response = Response; + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {(function() { + "use strict"; + function $$route$recognizer$dsl$$Target(path, matcher, delegate) { + this.path = path; + this.matcher = matcher; + this.delegate = delegate; } - VisualizationsPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; + + $$route$recognizer$dsl$$Target.prototype = { + to: function(target, callback) { + var delegate = this.delegate; + + if (delegate && delegate.willAddRoute) { + target = delegate.willAddRoute(this.matcher.target, target); } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; + + this.matcher.add(this.path, target); + + if (callback) { + if (callback.length === 0) { throw new Error("You must have an argument in the function passed to `to`"); } + this.matcher.addChild(this.path, target, callback, this.delegate); } - var fields = [ - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + return this; + } }; - return VisualizationsPaneValidator; - }(typeValidator_1.ObjectValidator)); - exports.VisualizationsPaneValidator = VisualizationsPaneValidator; + function $$route$recognizer$dsl$$Matcher(target) { + this.routes = {}; + this.children = {}; + this.target = target; + } + + $$route$recognizer$dsl$$Matcher.prototype = { + add: function(path, handler) { + this.routes[path] = handler; + }, - /***/ }), - /* 16 */ - /***/ (function(module, exports, __webpack_require__) { + addChild: function(path, target, callback, delegate) { + var matcher = new $$route$recognizer$dsl$$Matcher(target); + this.children[path] = matcher; - var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; - var multipleFieldsValidator_1 = __webpack_require__(3); - var typeValidator_1 = __webpack_require__(4); - var validator_1 = __webpack_require__(1); - var LoadQnaValidator = /** @class */ (function (_super) { - __extends(LoadQnaValidator, _super); - function LoadQnaValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - LoadQnaValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; + var match = $$route$recognizer$dsl$$generateMatch(path, matcher, delegate); + + if (delegate && delegate.contextEntered) { + delegate.contextEntered(target, match); } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "datasetIds", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - { - field: "question", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] - }, - { - field: "settings", - validators: [validator_1.Validators.qnaSettingValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); + + callback(match); + } }; - return LoadQnaValidator; - }(typeValidator_1.ObjectValidator)); - exports.LoadQnaValidator = LoadQnaValidator; - var QnaSettingsValidator = /** @class */ (function (_super) { - __extends(QnaSettingsValidator, _super); - function QnaSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - QnaSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; + + function $$route$recognizer$dsl$$generateMatch(startingPath, matcher, delegate) { + return function(path, nestedCallback) { + var fullPath = startingPath + path; + + if (nestedCallback) { + nestedCallback($$route$recognizer$dsl$$generateMatch(fullPath, matcher, delegate)); + } else { + return new $$route$recognizer$dsl$$Target(startingPath + path, matcher, delegate); } - var fields = [ - { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return QnaSettingsValidator; - }(typeValidator_1.ObjectValidator)); - exports.QnaSettingsValidator = QnaSettingsValidator; - var QnaInterpretInputDataValidator = /** @class */ (function (_super) { - __extends(QnaInterpretInputDataValidator, _super); - function QnaInterpretInputDataValidator() { - return _super !== null && _super.apply(this, arguments) || this; + }; } - QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; + + function $$route$recognizer$dsl$$addRoute(routeArray, path, handler) { + var len = 0; + for (var i=0; i z`. For instance, "199" is smaller + // then "200", even though "y" and "z" (which are both 9) are larger than "0" (the value + // of (`b` and `c`). This is because the leading symbol, "2", is larger than the other + // leading symbol, "1". + // The rule is that symbols to the left carry more weight than symbols to the right + // when a number is written out as a string. In the above strings, the leading digit + // represents how many 100's are in the number, and it carries more weight than the middle + // number which represents how many 10's are in the number. + // This system of number magnitude works well for route specificity, too. A route written as + // `a/b/c` will be more specific than `x/y/z` as long as `a` is more specific than + // `x`, irrespective of the other parts. + // Because of this similarity, we assign each type of segment a number value written as a + // string. We can find the specificity of compound routes by concatenating these strings + // together, from left to right. After we have looped through all of the segments, + // we convert the string to a number. + specificity.val = ''; + + for (var i=0; i 2 && key.slice(keyLength -2) === '[]') { + isArray = true; + key = key.slice(0, keyLength - 2); + if(!queryParams[key]) { + queryParams[key] = []; + } } + value = pair[1] ? $$route$recognizer$$decodeQueryParamPart(pair[1]) : ''; + } + if (isArray) { + queryParams[key].push(value); + } else { + queryParams[key] = value; + } + } + return queryParams; + }, + + recognize: function(path) { + var states = [ this.rootState ], + pathLen, i, l, queryStart, queryParams = {}, + isSlashDropped = false; + + queryStart = path.indexOf('?'); + if (queryStart !== -1) { + var queryString = path.substr(queryStart + 1, path.length); + path = path.substr(0, queryStart); + queryParams = this.parseQueryString(queryString); } - if (!valid) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return AnyOfValidator; - }()); - exports.AnyOfValidator = AnyOfValidator; + path = decodeURI(path); - /***/ }), - /* 26 */ - /***/ (function(module, exports) { + if (path.charAt(0) !== "/") { path = "/" + path; } - Object.defineProperty(exports, "__esModule", { value: true }); - exports.FieldForbiddenValidator = void 0; - var FieldForbiddenValidator = /** @class */ (function () { - function FieldForbiddenValidator() { - } - FieldForbiddenValidator.prototype.validate = function (input, path, field) { - if (input !== undefined) { - return [{ - message: field + " is forbidden", - path: (path ? path + "." : "") + field, - keyword: "forbidden" - }]; + pathLen = path.length; + if (pathLen > 1 && path.charAt(pathLen - 1) === "/") { + path = path.substr(0, pathLen - 1); + isSlashDropped = true; + } + + for (i=0; i} - */ - Report.prototype.render = function (config) { - return this.service.hpm.post("/report/render", config, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Add an empty page to the report - * - * ```javascript - * // Add a page to the report with "Sales" as the page display name - * report.addPage("Sales"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.addPage = function (displayName) { - var _this = this; - var request = { - displayName: displayName - }; - return this.service.hpm.post("/report/addPage", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - var page = response.body; - return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - }, function (response) { - throw response.body; - }); - }; - /** - * Delete a page from a report - * - * ```javascript - * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) - * report.deletePage("ReportSection145"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.deletePage = function (pageName) { - return this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Rename a page from a report - * - * ```javascript - * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) - * report.renamePage("ReportSection145", "Sales"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.renamePage = function (pageName, displayName) { - var page = { - name: pageName, - displayName: displayName, - }; - return this.service.hpm.put("/report/pages/" + pageName + "/name", page, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Gets filters that are applied at the report level. - * - * ```javascript - * // Get filters applied at report level - * report.getFilters() - * .then(filters => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Report.prototype.getFilters = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.get("/report/filters", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Gets the report ID from the first available location: options, attribute, embed url. - * - * @returns {string} - */ - Report.prototype.getId = function () { - var config = this.config; - var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); - if (typeof reportId !== 'string' || reportId.length === 0) { - throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'."); - } - return reportId; - }; - /** - * Gets the list of pages within the report. - * - * ```javascript - * report.getPages() - * .then(pages => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Report.prototype.getPages = function () { - var _this = this; - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body - .map(function (page) { - return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - }); - }, function (response) { - throw response.body; - }); - }; - /** - * Creates an instance of a Page. - * - * Normally you would get Page objects by calling `report.getPages()`, but in the case - * that the page name is known and you want to perform an action on a page without having to retrieve it - * you can create it directly. - * - * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. - * - * @param {string} name - * @param {string} [displayName] - * @param {boolean} [isActive] - * @returns {Page} - * @hidden - */ - Report.prototype.page = function (name, displayName, isActive, visibility) { - return new page_1.Page(this, name, displayName, isActive, visibility); - }; - /** - * Prints the active page of the report by invoking `window.print()` on the embed iframe component. - */ - Report.prototype.print = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Removes all filters at the report level. - * - * ```javascript - * report.removeFilters(); - * ``` - * - * @returns {Promise} - */ - Report.prototype.removeFilters = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.setFilters([]); - }; - /** - * Sets the active page of the report. - * - * ```javascript - * report.setPage("page2") - * .catch(error => { ... }); - * ``` - * - * @param {string} pageName - * @returns {Promise} - */ - Report.prototype.setPage = function (pageName) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var page = { - name: pageName, - displayName: null, - isActive: true - }; - return this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Sets filters at the report level. - * - * ```javascript - * const filters: [ - * ... - * ]; - * - * report.setFilters(filters) - * .catch(errors => { - * ... - * }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - Report.prototype.setFilters = function (filters) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.put("/report/filters", filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Updates visibility settings for the filter pane and the page navigation pane. - * - * ```javascript - * const newSettings = { - * navContentPaneEnabled: true, - * filterPaneEnabled: false - * }; - * - * report.updateSettings(newSettings) - * .catch(error => { ... }); - * ``` - * - * @param {models.ISettings} settings - * @returns {Promise} - */ - Report.prototype.updateSettings = function (settings) { - if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Validate load configuration. - * - * @hidden - */ - Report.prototype.validate = function (config) { - return models.validateReportLoad(config); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Report.prototype.configChanged = function (isBootstrap) { - var config = this.config; - if (this.isMobileSettings(config.settings)) - config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); - // Calculate settings from HTML element attributes if available. - var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute); - var navContentPaneEnabledAttribute = this.element.getAttribute(Report.navContentPaneEnabledAttribute); - var elementAttrSettings = { - filterPaneEnabled: (filterPaneEnabledAttribute == null) ? undefined : (filterPaneEnabledAttribute !== "false"), - navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false") - }; - // Set the settings back into the config. - this.config.settings = utils.assign({}, elementAttrSettings, config.settings); - if (isBootstrap) { - return; - } - config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Report.prototype.getDefaultEmbedUrlEndpoint = function () { - return "reportEmbed"; - }; - /** - * Switch Report view mode. - * - * @returns {Promise} - */ - Report.prototype.switchMode = function (viewMode) { - var newMode; - if (typeof viewMode === "string") { - newMode = viewMode; - } - else { - newMode = this.viewModeToString(viewMode); - } - var url = '/report/switchMode/' + newMode; - return this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Refreshes data sources for the report. - * - * ```javascript - * report.refresh(); - * ``` - */ - Report.prototype.refresh = function () { - return this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * checks if the report is saved. - * - * ```javascript - * report.isSaved() - * ``` - * - * @returns {Promise} - */ - Report.prototype.isSaved = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); - }; - /** - * Apply a theme to the report - * - * ```javascript - * report.applyTheme(theme); - * ``` - */ - Report.prototype.applyTheme = function (theme) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.applyThemeInternal(theme); - }; - /** - * Reset and apply the default theme of the report - * - * ```javascript - * report.resetTheme(); - * ``` - */ - Report.prototype.resetTheme = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.applyThemeInternal({}); - }; - /** - * Reset user's filters, slicers, and other data view changes to the default state of the report - * - * ```javascript - * report.resetPersistentFilters(); - * ``` - */ - Report.prototype.resetPersistentFilters = function () { - return this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Save user's filters, slicers, and other data view changes of the report - * - * ```javascript - * report.savePersistentFilters(); - * ``` - */ - Report.prototype.savePersistentFilters = function () { - return this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Returns if there are user's filters, slicers, or other data view changes applied on the report. - * If persistent filters is disable, returns false. - * - * ```javascript - * report.arePersistentFiltersApplied(); - * ``` - * - * @returns {Promise} - */ - Report.prototype.arePersistentFiltersApplied = function () { - return this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * @hidden - */ - Report.prototype.applyThemeInternal = function (theme) { - return this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * @hidden - */ - Report.prototype.viewModeToString = function (viewMode) { - var mode; - switch (viewMode) { - case models.ViewMode.Edit: - mode = "edit"; - break; - case models.ViewMode.View: - mode = "view"; - break; - } - return mode; - }; - /** - * @hidden - */ - Report.prototype.isMobileSettings = function (settings) { - return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); - }; - /** @hidden */ - Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; - /** @hidden */ - Report.reportIdAttribute = 'powerbi-report-id'; - /** @hidden */ - Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled'; - /** @hidden */ - Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled'; - /** @hidden */ - Report.typeAttribute = 'powerbi-type'; - /** @hidden */ - Report.type = "Report"; - return Report; - }(embed.Embed)); - exports.Report = Report; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BookmarksManager = void 0; +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +/** + * Manages report bookmarks. + * + * @export + * @class BookmarksManager + * @implements {IBookmarksManager} + */ +var BookmarksManager = /** @class */ (function () { + /** + * @hidden + */ + function BookmarksManager(service, config, iframe) { + this.service = service; + this.config = config; + this.iframe = iframe; + } + /** + * Gets bookmarks that are defined in the report. + * + * ```javascript + * // Gets bookmarks that are defined in the report + * bookmarksManager.getBookmarks() + * .then(bookmarks => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + BookmarksManager.prototype.getBookmarks = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Apply bookmark by name. + * + * ```javascript + * bookmarksManager.apply(bookmarkName) + * ``` + * + * @param {string} bookmarkName The name of the bookmark to be applied + * @returns {Promise>} + */ + BookmarksManager.prototype.apply = function (bookmarkName) { + return __awaiter(this, void 0, void 0, function () { + var request, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + request = { + name: bookmarkName + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_2 = _a.sent(); + throw response_2.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Play bookmarks: Enter or Exit bookmarks presentation mode. + * + * ```javascript + * // Enter presentation mode. + * bookmarksManager.play(models.BookmarksPlayMode.Presentation) + * ``` + * + * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` + * @returns {Promise>} + */ + BookmarksManager.prototype.play = function (playMode) { + return __awaiter(this, void 0, void 0, function () { + var playBookmarkRequest, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + playBookmarkRequest = { + playMode: playMode + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Capture bookmark from current state. + * + * ```javascript + * bookmarksManager.capture(options) + * ``` + * + * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing + * @returns {Promise} + */ + BookmarksManager.prototype.capture = function (options) { + return __awaiter(this, void 0, void 0, function () { + var request, response, response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + request = { + options: options + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_4 = _a.sent(); + throw response_4.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Apply bookmark state. + * + * ```javascript + * bookmarksManager.applyState(bookmarkState) + * ``` + * + * @param {string} state A base64 bookmark state to be applied + * @returns {Promise>} + */ + BookmarksManager.prototype.applyState = function (state) { + return __awaiter(this, void 0, void 0, function () { + var request, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + request = { + state: state + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + return BookmarksManager; +}()); +exports.BookmarksManager = BookmarksManager; /***/ }), -/* 8 */ + +/***/ "./src/config.ts": +/*!***********************!*\ + !*** ./src/config.ts ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +Object.defineProperty(exports, "__esModule", { value: true }); +/** @ignore */ /** */ +var config = { + version: '2.16.0', + type: 'js' +}; +exports.default = config; + + +/***/ }), + +/***/ "./src/create.ts": +/*!***********************!*\ + !*** ./src/create.ts ***! + \***********************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var visualDescriptor_1 = __webpack_require__(9); - var models = __webpack_require__(5); - var utils = __webpack_require__(3); - var errors = __webpack_require__(6); - /** - * A Power BI report page - * - * @export - * @class Page - * @implements {IPageNode} - * @implements {IFilterable} - */ - var Page = (function () { - /** - * Creates an instance of a Power BI report page. - * - * @param {IReportNode} report - * @param {string} name - * @param {string} [displayName] - * @param {boolean} [isActivePage] - * @param {models.SectionVisibility} [visibility] - * @hidden - */ - function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) { - this.report = report; - this.name = name; - this.displayName = displayName; - this.isActive = isActivePage; - this.visibility = visibility; - this.defaultSize = defaultSize; - this.defaultDisplayOption = defaultDisplayOption; - } - /** - * Gets all page level filters within the report. - * - * ```javascript - * page.getFilters() - * .then(filters => { ... }); - * ``` - * - * @returns {(Promise)} - */ - Page.prototype.getFilters = function () { - return this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Delete the page from the report - * - * ```javascript - * // Delete the page from the report - * page.delete(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.delete = function () { - return this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { - return response.body; - }) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Removes all filters from this page of the report. - * - * ```javascript - * page.removeFilters(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.removeFilters = function () { - return this.setFilters([]); - }; - /** - * Makes the current page the active page of the report. - * - * ```javascripot - * page.setActive(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.setActive = function () { - var page = { - name: this.name, - displayName: null, - isActive: true - }; - return this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Sets all filters on the current page. - * - * ```javascript - * page.setFilters(filters); - * .catch(errors => { ... }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - Page.prototype.setFilters = function (filters) { - return this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Set displayName to the current page. - * - * ```javascript - * page.setName(displayName); - * ``` - * - * @returns {Promise} - */ - Page.prototype.setDisplayName = function (displayName) { - var page = { - name: this.name, - displayName: displayName, - }; - return this.report.service.hpm.put("/report/pages/" + this.name + "/name", page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Gets all the visuals on the page. - * - * ```javascript - * page.getVisuals() - * .then(visuals => { ... }); - * ``` - * - * @returns {Promise} - */ - Page.prototype.getVisuals = function () { - var _this = this; - if (utils.isRDLEmbed(this.report.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { - return response.body - .map(function (visual) { - return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); - }); - }, function (response) { - throw response.body; - }); - }; - /** - * Checks if page has layout. - * - * ```javascript - * page.hasLayout(layoutType) - * .then(hasLayout: boolean => { ... }); - * ``` - * - * @returns {(Promise)} - */ - Page.prototype.hasLayout = function (layoutType) { - if (utils.isRDLEmbed(this.report.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var layoutTypeEnum = models.LayoutType[layoutType]; - return this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - return Page; - }()); - exports.Page = Page; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Create = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +/** + * A Power BI Report creator component + * + * @export + * @class Create + * @extends {embed.Embed} + */ +var Create = /** @class */ (function (_super) { + __extends(Create, _super); + /* + * @hidden + */ + function Create(service, element, config, phasedRender, isBootstrap) { + return _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + } + /** + * Gets the dataset ID from the first available location: createConfig or embed url. + * + * @returns {string} + */ + Create.prototype.getId = function () { + var datasetId = (this.createConfig && this.createConfig.datasetId) ? this.createConfig.datasetId : Create.findIdFromEmbedUrl(this.config.embedUrl); + if (typeof datasetId !== 'string' || datasetId.length === 0) { + throw new Error('Dataset id is required, but it was not found. You must provide an id either as part of embed configuration.'); + } + return datasetId; + }; + /** + * Validate create report configuration. + */ + Create.prototype.validate = function (config) { + return models.validateCreateReport(config); + }; + /** + * Handle config changes. + * + * @hidden + * @returns {void} + */ + Create.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + var config = this.config; + this.createConfig = { + accessToken: config.accessToken, + datasetId: config.datasetId || this.getId(), + groupId: config.groupId, + settings: config.settings, + tokenType: config.tokenType, + theme: config.theme + }; + }; + /** + * @hidden + * @returns {string} + */ + Create.prototype.getDefaultEmbedUrlEndpoint = function () { + return "reportEmbed"; + }; + /** + * checks if the report is saved. + * + * ```javascript + * report.isSaved() + * ``` + * + * @returns {Promise} + */ + Create.prototype.isSaved = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Adds the ability to get datasetId from url. + * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1). + * + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration. + * + * @static + * @param {string} url + * @returns {string} + * @hidden + */ + Create.findIdFromEmbedUrl = function (url) { + var datasetIdRegEx = /datasetId="?([^&]+)"?/; + var datasetIdMatch = url.match(datasetIdRegEx); + var datasetId; + if (datasetIdMatch) { + datasetId = datasetIdMatch[1]; + } + return datasetId; + }; + return Create; +}(embed.Embed)); +exports.Create = Create; + + +/***/ }), + +/***/ "./src/dashboard.ts": +/*!**************************!*\ + !*** ./src/dashboard.ts ***! + \**************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Dashboard = void 0; +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +/** + * A Power BI Dashboard embed component + * + * @export + * @class Dashboard + * @extends {embed.Embed} + * @implements {IDashboardNode} + */ +var Dashboard = /** @class */ (function (_super) { + __extends(Dashboard, _super); + /** + * Creates an instance of a Power BI Dashboard. + * + * @param {service.Service} service + * @hidden + * @param {HTMLElement} element + */ + function Dashboard(service, element, config, phasedRender, isBootstrap) { + var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + _this.loadPath = "/dashboard/load"; + _this.phasedLoadPath = "/dashboard/prepare"; + Array.prototype.push.apply(_this.allowedEvents, Dashboard.allowedEvents); + return _this; + } + /** + * This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id. + * E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e + * + * By extracting the id we can ensure id is always explicitly provided as part of the load configuration. + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Dashboard.findIdFromEmbedUrl = function (url) { + var dashboardIdRegEx = /dashboardId="?([^&]+)"?/; + var dashboardIdMatch = url.match(dashboardIdRegEx); + var dashboardId; + if (dashboardIdMatch) { + dashboardId = dashboardIdMatch[1]; + } + return dashboardId; + }; + /** + * Get dashboard id from first available location: options, attribute, embed url. + * + * @returns {string} + */ + Dashboard.prototype.getId = function () { + var config = this.config; + var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); + if (typeof dashboardId !== 'string' || dashboardId.length === 0) { + throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'."); + } + return dashboardId; + }; + /** + * Validate load configuration. + * + * @hidden + */ + Dashboard.prototype.validate = function (baseConfig) { + var config = baseConfig; + var error = models.validateDashboardLoad(config); + return error ? error : this.ValidatePageView(config.pageView); + }; + /** + * Handle config changes. + * @hidden + * @returns {void} + */ + Dashboard.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + // Populate dashboard id into config object. + this.config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Dashboard.prototype.getDefaultEmbedUrlEndpoint = function () { + return "dashboardEmbed"; + }; + /** + * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView + * @hidden + */ + Dashboard.prototype.ValidatePageView = function (pageView) { + if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") { + return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }]; + } + }; + /** @hidden */ + Dashboard.allowedEvents = ["tileClicked", "error"]; + /** @hidden */ + Dashboard.dashboardIdAttribute = 'powerbi-dashboard-id'; + /** @hidden */ + Dashboard.typeAttribute = 'powerbi-type'; + /** @hidden */ + Dashboard.type = "Dashboard"; + return Dashboard; +}(embed.Embed)); +exports.Dashboard = Dashboard; /***/ }), -/* 9 */ + +/***/ "./src/embed.ts": +/*!**********************!*\ + !*** ./src/embed.ts ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Embed = void 0; +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var sdkConfig = __webpack_require__(/*! ./config */ "./src/config.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var errors_1 = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +/** + * Base class for all Power BI embed components + * + * @export + * @abstract + * @hidden + * @class Embed + */ +var Embed = /** @class */ (function () { + /** + * Creates an instance of Embed. + * + * Note: there is circular reference between embeds and the service, because + * the service has a list of all embeds on the host page, and each embed has a reference to the service that created it. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {IEmbedConfigurationBase} config + * @hidden + */ + function Embed(service, element, config, iframe, phasedRender, isBootstrap) { + /** @hidden */ + this.allowedEvents = []; + if (utils.autoAuthInEmbedUrl(config.embedUrl)) { + throw new Error(errors_1.EmbedUrlNotSupported); + } + Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents); + this.eventHandlers = []; + this.service = service; + this.element = element; + this.iframe = iframe; + this.iframeLoaded = false; + this.embedtype = config.type.toLowerCase(); + this.populateConfig(config, isBootstrap); + if (this.embedtype === 'create') { + this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap); + } + else { + this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap); + } + } + /** + * Sends createReport configuration data. + * + * ```javascript + * createReport({ + * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', + * accessToken: 'eyJ0eXA ... TaE2rTSbmg', + * ``` + * @hidden + * @param {models.IReportCreateConfiguration} config + * @returns {Promise} + */ + Embed.prototype.createReport = function (config) { + return __awaiter(this, void 0, void 0, function () { + var errors, response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + errors = models.validateCreateReport(config); + if (errors) { + throw errors; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Saves Report. + * + * @returns {Promise} + */ + Embed.prototype.save = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_2 = _a.sent(); + throw response_2.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * SaveAs Report. + * + * @returns {Promise} + */ + Embed.prototype.saveAs = function (saveAsParameters) { + return __awaiter(this, void 0, void 0, function () { + var response, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_3 = _a.sent(); + throw response_3.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Get the correlationId for the current embed session. + * + * ```javascript + * // Get the correlationId for the current embed session + * report.getCorrelationId() + * .then(correlationId => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Embed.prototype.getCorrelationId = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.get("/getCorrelationId", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_4 = _a.sent(); + throw response_4.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sends load configuration data. + * + * ```javascript + * report.load({ + * type: 'report', + * id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', + * accessToken: 'eyJ0eXA ... TaE2rTSbmg', + * settings: { + * navContentPaneEnabled: false + * }, + * pageName: "DefaultPage", + * filters: [ + * { + * ... DefaultReportFilter ... + * } + * ] + * }) + * .catch(error => { ... }); + * ``` + * @hidden + * @param {models.ILoadConfiguration} config + * @param {boolean} phasedRender + * @returns {Promise} + */ + Embed.prototype.load = function (phasedRender) { + return __awaiter(this, void 0, void 0, function () { + var path, headers, timeNow, response, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.config.accessToken) { + console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); + return [2 /*return*/]; + } + if (!this.iframeLoaded) { + console.debug("Power BI SDK is trying to post /report/load before iframe is ready."); + return [2 /*return*/]; + } + path = phasedRender && this.config.type === 'report' ? this.phasedLoadPath : this.loadPath; + headers = { + uid: this.config.uniqueId, + sdkSessionId: this.service.getSdkSessionId(), + bootstrapped: this.config.bootstrapped, + sdkVersion: sdkConfig.default.version + }; + timeNow = new Date(); + if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) { + console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval."); + return [2 /*return*/]; + } + this.lastLoadRequest = timeNow; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes one or more event handlers from the list of handlers. + * If a reference to the existing handle function is specified, remove the specific handler. + * If the handler is not specified, remove all handlers for the event name specified. + * + * ```javascript + * report.off('pageChanged') + * + * or + * + * const logHandler = function (event) { + * console.log(event); + * }; + * + * report.off('pageChanged', logHandler); + * ``` + * + * @template T + * @param {string} eventName + * @param {service.IEventHandler} [handler] + */ + Embed.prototype.off = function (eventName, handler) { + var _this = this; + var fakeEvent = { name: eventName, type: null, id: null, value: null }; + if (handler) { + utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers); + this.element.removeEventListener(eventName, handler); + } + else { + var eventHandlersToRemove = this.eventHandlers + .filter(function (eventHandler) { return eventHandler.test(fakeEvent); }); + eventHandlersToRemove + .forEach(function (eventHandlerToRemove) { + utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers); + _this.element.removeEventListener(eventName, eventHandlerToRemove.handle); + }); + } + }; + /** + * Adds an event handler for a specific event. + * + * ```javascript + * report.on('pageChanged', (event) => { + * console.log('PageChanged: ', event.page.name); + * }); + * ``` + * + * @template T + * @param {string} eventName + * @param {service.IEventHandler} handler + */ + Embed.prototype.on = function (eventName, handler) { + if (this.allowedEvents.indexOf(eventName) === -1) { + throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName); + } + this.eventHandlers.push({ + test: function (event) { return event.name === eventName; }, + handle: handler + }); + this.element.addEventListener(eventName, handler); + }; + /** + * Reloads embed using existing configuration. + * E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. + * + * ```javascript + * report.reload(); + * ``` + */ + Embed.prototype.reload = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.load()]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Set accessToken. + * + * @returns {Promise} + */ + Embed.prototype.setAccessToken = function (accessToken) { + return __awaiter(this, void 0, void 0, function () { + var embedType, response, response_6; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + embedType = this.config.type; + embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + this.config.accessToken = accessToken; + this.element.setAttribute(Embed.accessTokenAttribute, accessToken); + this.service.accessToken = accessToken; + return [2 /*return*/, response.body]; + case 3: + response_6 = _a.sent(); + throw response_6.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets an access token from the first available location: config, attribute, global. + * + * @private + * @param {string} globalAccessToken + * @returns {string} + * @hidden + */ + Embed.prototype.getAccessToken = function (globalAccessToken) { + var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken; + if (!accessToken) { + throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken."); + } + return accessToken; + }; + /** + * Populate config for create and load + * + * @hidden + * @param {IEmbedConfiguration} + * @returns {void} + */ + Embed.prototype.populateConfig = function (config, isBootstrap) { + if (this.bootstrapConfig) { + this.config = utils.assign({}, this.bootstrapConfig, config); + // reset bootstrapConfig because we do not want to merge it in re-embed scenario. + this.bootstrapConfig = null; + } + else { + // Copy config - important for multiple iframe scenario. + // Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes. + this.config = utils.assign({}, config); + } + this.config.embedUrl = this.getEmbedUrl(isBootstrap); + this.config.groupId = this.getGroupId(); + this.addLocaleToEmbedUrl(config); + this.config.uniqueId = this.getUniqueId(); + if (isBootstrap) { + // save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed + this.bootstrapConfig = this.config; + this.bootstrapConfig.bootstrapped = true; + } + else { + this.config.accessToken = this.getAccessToken(this.service.accessToken); + } + this.configChanged(isBootstrap); + }; + /** + * Adds locale parameters to embedUrl + * + * @private + * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config + * @hidden + */ + Embed.prototype.addLocaleToEmbedUrl = function (config) { + if (!config.settings) { + return; + } + var localeSettings = config.settings.localeSettings; + if (localeSettings && localeSettings.language) { + this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language); + } + if (localeSettings && localeSettings.formatLocale) { + this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale); + } + }; + /** + * Gets an embed url from the first available location: options, attribute. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getEmbedUrl = function (isBootstrap) { + var embedUrl = this.config.embedUrl || this.element.getAttribute(Embed.embedUrlAttribute); + if (isBootstrap && !embedUrl) { + // Prepare flow, embed url was not provided, use hostname to build embed url. + embedUrl = this.getDefaultEmbedUrl(this.config.hostname); + } + if (typeof embedUrl !== 'string' || embedUrl.length === 0) { + throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'."); + } + return embedUrl; + }; + /** + * @hidden + */ + Embed.prototype.getDefaultEmbedUrl = function (hostname) { + if (!hostname) { + hostname = Embed.defaultEmbedHostName; + } + var endpoint = this.getDefaultEmbedUrlEndpoint(); + // Trim spaces to fix user mistakes. + hostname = hostname.toLowerCase().trim(); + if (hostname.indexOf("http://") === 0) { + throw new Error("HTTP is not allowed. HTTPS is required"); + } + if (hostname.indexOf("https://") === 0) { + return hostname + "/" + endpoint; + } + return "https://" + hostname + "/" + endpoint; + }; + /** + * Gets a unique ID from the first available location: options, attribute. + * If neither is provided generate a unique string. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getUniqueId = function () { + return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString(); + }; + /** + * Gets the group ID from the first available location: options, embeddedUrl. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getGroupId = function () { + return this.config.groupId || Embed.findGroupIdFromEmbedUrl(this.config.embedUrl); + }; + /** + * Requests the browser to render the component's iframe in fullscreen mode. + */ + Embed.prototype.fullscreen = function () { + var requestFullScreen = this.iframe.requestFullscreen || this.iframe.msRequestFullscreen || this.iframe.mozRequestFullScreen || this.iframe.webkitRequestFullscreen; + requestFullScreen.call(this.iframe); + }; + /** + * Requests the browser to exit fullscreen mode. + */ + Embed.prototype.exitFullscreen = function () { + if (!this.isFullscreen(this.iframe)) { + return; + } + var exitFullscreen = document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen; + exitFullscreen.call(document); + }; + /** + * Returns true if the iframe is rendered in fullscreen mode, + * otherwise returns false. + * + * @private + * @param {HTMLIFrameElement} iframe + * @returns {boolean} + * @hidden + */ + Embed.prototype.isFullscreen = function (iframe) { + var options = ['fullscreenElement', 'webkitFullscreenElement', 'mozFullscreenScreenElement', 'msFullscreenElement']; + return options.some(function (option) { return document[option] === iframe; }); + }; + /** + * Sets Iframe for embed + * @hidden + */ + Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) { + var _this = this; + if (!this.iframe) { + var iframeContent = document.createElement("iframe"); + var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl; + iframeContent.style.width = '100%'; + iframeContent.style.height = '100%'; + iframeContent.setAttribute("src", embedUrl); + iframeContent.setAttribute("scrolling", "no"); + iframeContent.setAttribute("allowfullscreen", "true"); + var node = this.element; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + node.appendChild(iframeContent); + this.iframe = node.firstChild; + } + if (isLoad) { + if (!isBootstrap) { + // Validate config if it's not a bootstrap case. + var errors = this.validate(this.config); + if (errors) { + throw errors; + } + } + this.iframe.addEventListener('load', function () { + _this.iframeLoaded = true; + _this.load(phasedRender); + }, false); + if (this.service.getNumberOfComponents() <= Embed.maxFrontLoadTimes) { + this.frontLoadHandler = function () { + _this.frontLoadSendConfig(_this.config); + }; + // 'ready' event is fired by the embedded element (not by the iframe) + this.element.addEventListener('ready', this.frontLoadHandler, false); + } + } + else { + this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false); + } + }; + /** + * Set the component title for accessibility. In case of iframes, this method will change the iframe title. + */ + Embed.prototype.setComponentTitle = function (title) { + if (!this.iframe) { + return; + } + if (title == null) { + this.iframe.removeAttribute("title"); + } + else { + this.iframe.setAttribute("title", title); + } + }; + /** + * Sets element's tabindex attribute + */ + Embed.prototype.setComponentTabIndex = function (tabIndex) { + if (!this.element) { + return; + } + this.element.setAttribute("tabindex", (tabIndex == null) ? "0" : tabIndex.toString()); + }; + /** + * Removes element's tabindex attribute + */ + Embed.prototype.removeComponentTabIndex = function (tabIndex) { + if (!this.element) { + return; + } + this.element.removeAttribute("tabindex"); + }; + /** + * Adds the ability to get groupId from url. + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Embed.findGroupIdFromEmbedUrl = function (url) { + var groupIdRegEx = /groupId="?([^&]+)"?/; + var groupIdMatch = url.match(groupIdRegEx); + var groupId; + if (groupIdMatch) { + groupId = groupIdMatch[1]; + } + return groupId; + }; + /** + * Sends the config for front load calls, after 'ready' message is received from the iframe + * @hidden + */ + Embed.prototype.frontLoadSendConfig = function (config) { + return __awaiter(this, void 0, void 0, function () { + var errors, response, response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!config.accessToken) { + return [2 /*return*/]; + } + errors = this.validate(config); + if (errors) { + throw errors; + } + // contentWindow must be initialized + if (this.iframe.contentWindow == null) + return [2 /*return*/]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_7 = _a.sent(); + throw response_7.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** @hidden */ + Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"]; + /** @hidden */ + Embed.accessTokenAttribute = 'powerbi-access-token'; + /** @hidden */ + Embed.embedUrlAttribute = 'powerbi-embed-url'; + /** @hidden */ + Embed.nameAttribute = 'powerbi-name'; + /** @hidden */ + Embed.typeAttribute = 'powerbi-type'; + /** @hidden */ + Embed.defaultEmbedHostName = "https://app.powerbi.com"; + /** @hidden */ + Embed.maxFrontLoadTimes = 2; + return Embed; +}()); +exports.Embed = Embed; + + +/***/ }), + +/***/ "./src/errors.ts": +/*!***********************!*\ + !*** ./src/errors.ts ***! + \***********************/ +/*! no static exports found */ /***/ (function(module, exports) { - /** - * A Power BI visual within a page - * - * @export - * @class VisualDescriptor - * @implements {IVisualNode} - */ - var VisualDescriptor = (function () { - /** - * @hidden - */ - function VisualDescriptor(page, name, title, type, layout) { - this.name = name; - this.title = title; - this.type = type; - this.layout = layout; - this.page = page; - } - /** - * Gets all visual level filters of the current visual. - * - * ```javascript - * visual.getFilters() - * .then(filters => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.getFilters = function () { - return this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Removes all filters from the current visual. - * - * ```javascript - * visual.removeFilters(); - * ``` - * - * @returns {Promise} - */ - VisualDescriptor.prototype.removeFilters = function () { - return this.setFilters([]); - }; - /** - * Sets the filters on the current visual to 'filters'. - * - * ```javascript - * visual.setFilters(filters); - * .catch(errors => { ... }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - VisualDescriptor.prototype.setFilters = function (filters) { - return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Exports Visual data. - * Can export up to 30K rows. - * @param rows: Optional. Default value is 30K, maximum value is 30K as well. - * @param exportDataType: Optional. Default is models.ExportDataType.Summarized. - * ```javascript - * visual.exportData() - * .then(data => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.exportData = function (exportDataType, rows) { - var exportDataRequestBody = { - rows: rows, - exportDataType: exportDataType - }; - return this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Set slicer state. - * Works only for visuals of type slicer. - * @param state: A new state which contains the slicer filters. - * ```javascript - * visual.setSlicerState() - * .then(() => { ... }); - * ``` - */ - VisualDescriptor.prototype.setSlicerState = function (state) { - return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Get slicer state. - * Works only for visuals of type slicer. - * - * ```javascript - * visual.getSlicerState() - * .then(state => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.getSlicerState = function () { - return this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Clone existing visual to a new instance. - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.clone = function (request) { - if (request === void 0) { request = {}; } - return this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Sort a visual by dataField and direction. - * - * @param request: Sort by visual request. - * - * ```javascript - * visual.sortBy(request) - * .then(() => { ... }); - * ``` - */ - VisualDescriptor.prototype.sortBy = function (request) { - return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - return VisualDescriptor; - }()); - exports.VisualDescriptor = VisualDescriptor; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EmbedUrlNotSupported = exports.APINotSupportedForRDLError = void 0; +exports.APINotSupportedForRDLError = "This API is currently not supported for RDL reports"; +exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"; /***/ }), -/* 10 */ + +/***/ "./src/factories.ts": +/*!**************************!*\ + !*** ./src/factories.ts ***! + \**************************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var utils = __webpack_require__(3); - var errors = __webpack_require__(6); - /** - * Manages report bookmarks. - * - * @export - * @class BookmarksManager - * @implements {IBookmarksManager} - */ - var BookmarksManager = (function () { - /** - * @hidden - */ - function BookmarksManager(service, config, iframe) { - this.service = service; - this.config = config; - this.iframe = iframe; - } - /** - * Gets bookmarks that are defined in the report. - * - * ```javascript - * // Gets bookmarks that are defined in the report - * bookmarksManager.getBookmarks() - * .then(bookmarks => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - BookmarksManager.prototype.getBookmarks = function () { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - return this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Apply bookmark by name. - * - * ```javascript - * bookmarksManager.apply(bookmarkName) - * ``` - * - * @param {string} bookmarkName The name of the bookmark to be applied - * @returns {Promise} - */ - BookmarksManager.prototype.apply = function (bookmarkName) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var request = { - name: bookmarkName - }; - return this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Play bookmarks: Enter or Exit bookmarks presentation mode. - * - * ```javascript - * // Enter presentation mode. - * bookmarksManager.play(models.BookmarksPlayMode.Presentation) - * ``` - * - * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` - * @returns {Promise} - */ - BookmarksManager.prototype.play = function (playMode) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var playBookmarkRequest = { - playMode: playMode - }; - return this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Capture bookmark from current state. - * - * ```javascript - * bookmarksManager.capture(options) - * ``` - * - * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing - * @returns {Promise} - */ - BookmarksManager.prototype.capture = function (options) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var request = { - options: options - }; - return this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Apply bookmark state. - * - * ```javascript - * bookmarksManager.applyState(bookmarkState) - * ``` - * - * @param {string} state A base64 bookmark state to be applied - * @returns {Promise} - */ - BookmarksManager.prototype.applyState = function (state) { - if (utils.isRDLEmbed(this.config.embedUrl)) { - return Promise.reject(errors.APINotSupportedForRDLError); - } - var request = { - state: state - }; - return this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - return BookmarksManager; - }()); - exports.BookmarksManager = BookmarksManager; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.routerFactory = exports.wpmpFactory = exports.hpmFactory = void 0; +var config_1 = __webpack_require__(/*! ./config */ "./src/config.ts"); +var wpmp = __webpack_require__(/*! window-post-message-proxy */ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js"); +var hpm = __webpack_require__(/*! http-post-message */ "./node_modules/http-post-message/dist/httpPostMessage.js"); +var router = __webpack_require__(/*! powerbi-router */ "./node_modules/powerbi-router/dist/router.js"); +exports.hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) { + if (sdkVersion === void 0) { sdkVersion = config_1.default.version; } + if (sdkType === void 0) { sdkType = config_1.default.type; } + return new hpm.HttpPostMessage(wpmp, { + 'x-sdk-type': sdkType, + 'x-sdk-version': sdkVersion + }, defaultTargetWindow); +}; +exports.wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) { + return new wpmp.WindowPostMessageProxy({ + processTrackingProperties: { + addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties, + getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties, + }, + isErrorMessage: hpm.HttpPostMessage.isErrorMessage, + suppressWarnings: true, + name: name, + logMessages: logMessages, + eventSourceOverrideWindow: eventSourceOverrideWindow + }); +}; +exports.routerFactory = function (wpmp) { + return new router.Router(wpmp); +}; /***/ }), -/* 11 */ + +/***/ "./src/page.ts": +/*!*********************!*\ + !*** ./src/page.ts ***! + \*********************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var embed = __webpack_require__(2); - var utils = __webpack_require__(3); - /** - * A Power BI Report creator component - * - * @export - * @class Create - * @extends {embed.Embed} - */ - var Create = (function (_super) { - __extends(Create, _super); - /* - * @hidden - */ - function Create(service, element, config, phasedRender, isBootstrap) { - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - } - /** - * Gets the dataset ID from the first available location: createConfig or embed url. - * - * @returns {string} - */ - Create.prototype.getId = function () { - var datasetId = (this.createConfig && this.createConfig.datasetId) ? this.createConfig.datasetId : Create.findIdFromEmbedUrl(this.config.embedUrl); - if (typeof datasetId !== 'string' || datasetId.length === 0) { - throw new Error('Dataset id is required, but it was not found. You must provide an id either as part of embed configuration.'); - } - return datasetId; - }; - /** - * Validate create report configuration. - */ - Create.prototype.validate = function (config) { - return models.validateCreateReport(config); - }; - /** - * Handle config changes. - * - * @hidden - * @returns {void} - */ - Create.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - var config = this.config; - this.createConfig = { - accessToken: config.accessToken, - datasetId: config.datasetId || this.getId(), - groupId: config.groupId, - settings: config.settings, - tokenType: config.tokenType, - theme: config.theme - }; - }; - /** - * @hidden - * @returns {string} - */ - Create.prototype.getDefaultEmbedUrlEndpoint = function () { - return "reportEmbed"; - }; - /** - * checks if the report is saved. - * - * ```javascript - * report.isSaved() - * ``` - * - * @returns {Promise} - */ - Create.prototype.isSaved = function () { - return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); - }; - /** - * Adds the ability to get datasetId from url. - * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1). - * - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration. - * - * @static - * @param {string} url - * @returns {string} - * @hidden - */ - Create.findIdFromEmbedUrl = function (url) { - var datasetIdRegEx = /datasetId="?([^&]+)"?/; - var datasetIdMatch = url.match(datasetIdRegEx); - var datasetId; - if (datasetIdMatch) { - datasetId = datasetIdMatch[1]; - } - return datasetId; - }; - return Create; - }(embed.Embed)); - exports.Create = Create; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Page = void 0; +var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +/** + * A Power BI report page + * + * @export + * @class Page + * @implements {IPageNode} + * @implements {IFilterable} + */ +var Page = /** @class */ (function () { + /** + * Creates an instance of a Power BI report page. + * + * @param {IReportNode} report + * @param {string} name + * @param {string} [displayName] + * @param {boolean} [isActivePage] + * @param {models.SectionVisibility} [visibility] + * @hidden + */ + function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) { + this.report = report; + this.name = name; + this.displayName = displayName; + this.isActive = isActivePage; + this.visibility = visibility; + this.defaultSize = defaultSize; + this.defaultDisplayOption = defaultDisplayOption; + } + /** + * Gets all page level filters within the report. + * + * ```javascript + * page.getFilters() + * .then(filters => { ... }); + * ``` + * + * @returns {(Promise)} + */ + Page.prototype.getFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Delete the page from the report + * + * ```javascript + * // Delete the page from the report + * page.delete(); + * ``` + * + * @returns {Promise} + */ + Page.prototype.delete = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_2 = _a.sent(); + throw response_2.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters from this page of the report. + * + * ```javascript + * page.removeFilters(); + * ``` + * + * @returns {Promise>} + */ + Page.prototype.removeFilters = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.setFilters([])]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Makes the current page the active page of the report. + * + * ```javascripot + * page.setActive(); + * ``` + * + * @returns {Promise>} + */ + Page.prototype.setActive = function () { + return __awaiter(this, void 0, void 0, function () { + var page, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + page = { + name: this.name, + displayName: null, + isActive: true + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets all filters on the current page. + * + * ```javascript + * page.setFilters(filters); + * .catch(errors => { ... }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + Page.prototype.setFilters = function (filters) { + return __awaiter(this, void 0, void 0, function () { + var response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_4 = _a.sent(); + throw response_4.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Set displayName to the current page. + * + * ```javascript + * page.setName(displayName); + * ``` + * + * @returns {Promise>} + */ + Page.prototype.setDisplayName = function (displayName) { + return __awaiter(this, void 0, void 0, function () { + var page, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + page = { + name: this.name, + displayName: displayName, + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/name", page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets all the visuals on the page. + * + * ```javascript + * page.getVisuals() + * .then(visuals => { ... }); + * ``` + * + * @returns {Promise} + */ + Page.prototype.getVisuals = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_6; + var _this = this; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.report.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body + .map(function (visual) { + return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); + })]; + case 3: + response_6 = _a.sent(); + throw response_6.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Checks if page has layout. + * + * ```javascript + * page.hasLayout(layoutType) + * .then(hasLayout: boolean => { ... }); + * ``` + * + * @returns {(Promise)} + */ + Page.prototype.hasLayout = function (layoutType) { + return __awaiter(this, void 0, void 0, function () { + var layoutTypeEnum, response, response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.report.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + layoutTypeEnum = models.LayoutType[layoutType]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_7 = _a.sent(); + throw response_7.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + return Page; +}()); +exports.Page = Page; /***/ }), -/* 12 */ + +/***/ "./src/powerbi-client.ts": +/*!*******************************!*\ + !*** ./src/powerbi-client.ts ***! + \*******************************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var embed = __webpack_require__(2); - var models = __webpack_require__(5); - /** - * A Power BI Dashboard embed component - * - * @export - * @class Dashboard - * @extends {embed.Embed} - * @implements {IDashboardNode} - */ - var Dashboard = (function (_super) { - __extends(Dashboard, _super); - /** - * Creates an instance of a Power BI Dashboard. - * - * @param {service.Service} service - * @hidden - * @param {HTMLElement} element - */ - function Dashboard(service, element, config, phasedRender, isBootstrap) { - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - this.loadPath = "/dashboard/load"; - this.phasedLoadPath = "/dashboard/prepare"; - Array.prototype.push.apply(this.allowedEvents, Dashboard.allowedEvents); - } - /** - * This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id. - * E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e - * - * By extracting the id we can ensure id is always explicitly provided as part of the load configuration. - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Dashboard.findIdFromEmbedUrl = function (url) { - var dashboardIdRegEx = /dashboardId="?([^&]+)"?/; - var dashboardIdMatch = url.match(dashboardIdRegEx); - var dashboardId; - if (dashboardIdMatch) { - dashboardId = dashboardIdMatch[1]; - } - return dashboardId; - }; - /** - * Get dashboard id from first available location: options, attribute, embed url. - * - * @returns {string} - */ - Dashboard.prototype.getId = function () { - var config = this.config; - var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); - if (typeof dashboardId !== 'string' || dashboardId.length === 0) { - throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'."); - } - return dashboardId; - }; - /** - * Validate load configuration. - * - * @hidden - */ - Dashboard.prototype.validate = function (baseConfig) { - var config = baseConfig; - var error = models.validateDashboardLoad(config); - return error ? error : this.ValidatePageView(config.pageView); - }; - /** - * Handle config changes. - * @hidden - * @returns {void} - */ - Dashboard.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - // Populate dashboard id into config object. - this.config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Dashboard.prototype.getDefaultEmbedUrlEndpoint = function () { - return "dashboardEmbed"; - }; - /** - * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView - * @hidden - */ - Dashboard.prototype.ValidatePageView = function (pageView) { - if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") { - return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }]; - } - }; - /** @hidden */ - Dashboard.allowedEvents = ["tileClicked", "error"]; - /** @hidden */ - Dashboard.dashboardIdAttribute = 'powerbi-dashboard-id'; - /** @hidden */ - Dashboard.typeAttribute = 'powerbi-type'; - /** @hidden */ - Dashboard.type = "Dashboard"; - return Dashboard; - }(embed.Embed)); - exports.Dashboard = Dashboard; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.models = exports.factories = exports.service = void 0; +/** + * @hidden + */ +var service = __webpack_require__(/*! ./service */ "./src/service.ts"); +exports.service = service; +var factories = __webpack_require__(/*! ./factories */ "./src/factories.ts"); +exports.factories = factories; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +exports.models = models; +var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); +Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } }); +var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"); +Object.defineProperty(exports, "Dashboard", { enumerable: true, get: function () { return dashboard_1.Dashboard; } }); +var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts"); +Object.defineProperty(exports, "Tile", { enumerable: true, get: function () { return tile_1.Tile; } }); +var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +Object.defineProperty(exports, "Embed", { enumerable: true, get: function () { return embed_1.Embed; } }); +var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); +Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return page_1.Page; } }); +var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts"); +Object.defineProperty(exports, "Qna", { enumerable: true, get: function () { return qna_1.Qna; } }); +var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts"); +Object.defineProperty(exports, "Visual", { enumerable: true, get: function () { return visual_1.Visual; } }); +var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); +Object.defineProperty(exports, "VisualDescriptor", { enumerable: true, get: function () { return visualDescriptor_1.VisualDescriptor; } }); +/** + * Makes Power BI available to the global object for use in applications that don't have module loading support. + * + * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service. + */ +var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); +window.powerbi = powerbi; /***/ }), -/* 13 */ + +/***/ "./src/qna.ts": +/*!********************!*\ + !*** ./src/qna.ts ***! + \********************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var embed = __webpack_require__(2); - /** - * The Power BI tile embed component - * - * @export - * @class Tile - * @extends {Embed} - */ - var Tile = (function (_super) { - __extends(Tile, _super); - /** - * @hidden - */ - function Tile(service, element, baseConfig, phasedRender, isBootstrap) { - var config = baseConfig; - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - this.loadPath = "/tile/load"; - Array.prototype.push.apply(this.allowedEvents, Tile.allowedEvents); - } - /** - * The ID of the tile - * - * @returns {string} - */ - Tile.prototype.getId = function () { - var config = this.config; - var tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); - if (typeof tileId !== 'string' || tileId.length === 0) { - throw new Error("Tile id is required, but it was not found. You must provide an id either as part of embed configuration."); - } - return tileId; - }; - /** - * Validate load configuration. - */ - Tile.prototype.validate = function (config) { - var embedConfig = config; - return models.validateTileLoad(embedConfig); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Tile.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - // Populate tile id into config object. - this.config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Tile.prototype.getDefaultEmbedUrlEndpoint = function () { - return "tileEmbed"; - }; - /** - * Adds the ability to get tileId from url. - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Tile.findIdFromEmbedUrl = function (url) { - var tileIdRegEx = /tileId="?([^&]+)"?/; - var tileIdMatch = url.match(tileIdRegEx); - var tileId; - if (tileIdMatch) { - tileId = tileIdMatch[1]; - } - return tileId; - }; - /** @hidden */ - Tile.type = "Tile"; - /** @hidden */ - Tile.allowedEvents = ["tileClicked", "tileLoaded"]; - return Tile; - }(embed.Embed)); - exports.Tile = Tile; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Qna = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +/** + * The Power BI Q&A embed component + * + * @export + * @class Qna + * @extends {Embed} + */ +var Qna = /** @class */ (function (_super) { + __extends(Qna, _super); + /** + * @hidden + */ + function Qna(service, element, config, phasedRender, isBootstrap) { + var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + _this.loadPath = "/qna/load"; + _this.phasedLoadPath = "/qna/prepare"; + Array.prototype.push.apply(_this.allowedEvents, Qna.allowedEvents); + return _this; + } + /** + * The ID of the Q&A embed component + * + * @returns {string} + */ + Qna.prototype.getId = function () { + return null; + }; + /** + * Change the question of the Q&A embed component + * + * @param {string} question - question which will render Q&A data + * @returns {Promise>} + */ + Qna.prototype.setQuestion = function (question) { + return __awaiter(this, void 0, void 0, function () { + var qnaData, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + qnaData = { + question: question + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Qna.prototype.configChanged = function (isBootstrap) { + // Nothing to do in Q&A embed. + }; + /** + * @hidden + * @returns {string} + */ + Qna.prototype.getDefaultEmbedUrlEndpoint = function () { + return "qnaEmbed"; + }; + /** + * Validate load configuration. + */ + Qna.prototype.validate = function (config) { + return models.validateLoadQnaConfiguration(config); + }; + /** @hidden */ + Qna.type = "Qna"; + /** @hidden */ + Qna.allowedEvents = ["loaded", "visualRendered"]; + return Qna; +}(embed.Embed)); +exports.Qna = Qna; /***/ }), -/* 14 */ + +/***/ "./src/report.ts": +/*!***********************!*\ + !*** ./src/report.ts ***! + \***********************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var embed = __webpack_require__(2); - /** - * The Power BI Q&A embed component - * - * @export - * @class Qna - * @extends {Embed} - */ - var Qna = (function (_super) { - __extends(Qna, _super); - /** - * @hidden - */ - function Qna(service, element, config, phasedRender, isBootstrap) { - _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap); - this.loadPath = "/qna/load"; - this.phasedLoadPath = "/qna/prepare"; - Array.prototype.push.apply(this.allowedEvents, Qna.allowedEvents); - } - /** - * The ID of the Q&A embed component - * - * @returns {string} - */ - Qna.prototype.getId = function () { - return null; - }; - /** - * Change the question of the Q&A embed component - * - * @param question - question which will render Q&A data - * @returns {string} - */ - Qna.prototype.setQuestion = function (question) { - var qnaData = { - question: question - }; - return this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Qna.prototype.configChanged = function (isBootstrap) { - // Nothing to do in Q&A embed. - }; - /** - * @hidden - * @returns {string} - */ - Qna.prototype.getDefaultEmbedUrlEndpoint = function () { - return "qnaEmbed"; - }; - /** - * Validate load configuration. - */ - Qna.prototype.validate = function (config) { - return models.validateLoadQnaConfiguration(config); - }; - /** @hidden */ - Qna.type = "Qna"; - /** @hidden */ - Qna.allowedEvents = ["loaded", "visualRendered"]; - return Qna; - }(embed.Embed)); - exports.Qna = Qna; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Report = void 0; +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); +var bookmarksManager_1 = __webpack_require__(/*! ./bookmarksManager */ "./src/bookmarksManager.ts"); +/** + * The Power BI Report embed component + * + * @export + * @class Report + * @extends {embed.Embed} + * @implements {IReportNode} + * @implements {IFilterable} + */ +var Report = /** @class */ (function (_super) { + __extends(Report, _super); + /** + * Creates an instance of a Power BI Report. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} config + * @hidden + */ + function Report(service, element, baseConfig, phasedRender, isBootstrap, iframe) { + var _this = this; + var config = baseConfig; + _this = _super.call(this, service, element, config, iframe, phasedRender, isBootstrap) || this; + _this.loadPath = "/report/load"; + _this.phasedLoadPath = "/report/prepare"; + Array.prototype.push.apply(_this.allowedEvents, Report.allowedEvents); + _this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, _this.iframe); + return _this; + } + /** + * Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID + * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1). + * + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Report.findIdFromEmbedUrl = function (url) { + var reportIdRegEx = /reportId="?([^&]+)"?/; + var reportIdMatch = url.match(reportIdRegEx); + var reportId; + if (reportIdMatch) { + reportId = reportIdMatch[1]; + } + return reportId; + }; + /** + * Render a preloaded report, using phased embedding API + * + * ```javascript + * // Load report + * var report = powerbi.load(element, config); + * + * ... + * + * // Render report + * report.render() + * ``` + * + * @returns {Promise} + */ + Report.prototype.render = function (config) { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post("/report/render", config, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Add an empty page to the report + * + * ```javascript + * // Add a page to the report with "Sales" as the page display name + * report.addPage("Sales"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.addPage = function (displayName) { + return __awaiter(this, void 0, void 0, function () { + var request, response, page, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + request = { + displayName: displayName + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/addPage", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + page = response.body; + return [2 /*return*/, new page_1.Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption)]; + case 3: + response_2 = _a.sent(); + throw response_2.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Delete a page from a report + * + * ```javascript + * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) + * report.deletePage("ReportSection145"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.deletePage = function (pageName) { + return __awaiter(this, void 0, void 0, function () { + var response, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_3 = _a.sent(); + throw response_3.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Rename a page from a report + * + * ```javascript + * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) + * report.renamePage("ReportSection145", "Sales"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.renamePage = function (pageName, displayName) { + return __awaiter(this, void 0, void 0, function () { + var page, response, response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + page = { + name: pageName, + displayName: displayName, + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put("/report/pages/" + pageName + "/name", page, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_4 = _a.sent(); + throw response_4.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets filters that are applied at the report level. + * + * ```javascript + * // Get filters applied at report level + * report.getFilters() + * .then(filters => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Report.prototype.getFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get("/report/filters", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets the report ID from the first available location: options, attribute, embed url. + * + * @returns {string} + */ + Report.prototype.getId = function () { + var config = this.config; + var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); + if (typeof reportId !== 'string' || reportId.length === 0) { + throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'."); + } + return reportId; + }; + /** + * Gets the list of pages within the report. + * + * ```javascript + * report.getPages() + * .then(pages => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Report.prototype.getPages = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_6; + var _this = this; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body + .map(function (page) { + return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); + })]; + case 3: + response_6 = _a.sent(); + throw response_6.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Creates an instance of a Page. + * + * Normally you would get Page objects by calling `report.getPages()`, but in the case + * that the page name is known and you want to perform an action on a page without having to retrieve it + * you can create it directly. + * + * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. + * + * @param {string} name + * @param {string} [displayName] + * @param {boolean} [isActive] + * @returns {Page} + * @hidden + */ + Report.prototype.page = function (name, displayName, isActive, visibility) { + return new page_1.Page(this, name, displayName, isActive, visibility); + }; + /** + * Prints the active page of the report by invoking `window.print()` on the embed iframe component. + */ + Report.prototype.print = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_7 = _a.sent(); + throw response_7.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters at the report level. + * + * ```javascript + * report.removeFilters(); + * ``` + * + * @returns {Promise>} + */ + Report.prototype.removeFilters = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, this.setFilters([])]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Sets the active page of the report. + * + * ```javascript + * report.setPage("page2") + * .catch(error => { ... }); + * ``` + * + * @param {string} pageName + * @returns {Promise>} + */ + Report.prototype.setPage = function (pageName) { + return __awaiter(this, void 0, void 0, function () { + var page, response_8; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + page = { + name: pageName, + displayName: null, + isActive: true + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_8 = _a.sent(); + throw response_8.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets filters at the report level. + * + * ```javascript + * const filters: [ + * ... + * ]; + * + * report.setFilters(filters) + * .catch(errors => { + * ... + * }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + Report.prototype.setFilters = function (filters) { + return __awaiter(this, void 0, void 0, function () { + var response_9; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put("/report/filters", filters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_9 = _a.sent(); + throw response_9.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Updates visibility settings for the filter pane and the page navigation pane. + * + * ```javascript + * const newSettings = { + * navContentPaneEnabled: true, + * filterPaneEnabled: false + * }; + * + * report.updateSettings(newSettings) + * .catch(error => { ... }); + * ``` + * + * @param {models.ISettings} settings + * @returns {Promise>} + */ + Report.prototype.updateSettings = function (settings) { + return __awaiter(this, void 0, void 0, function () { + var response_10; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_10 = _a.sent(); + throw response_10.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Validate load configuration. + * + * @hidden + */ + Report.prototype.validate = function (config) { + return models.validateReportLoad(config); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Report.prototype.configChanged = function (isBootstrap) { + var config = this.config; + if (this.isMobileSettings(config.settings)) + config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); + // Calculate settings from HTML element attributes if available. + var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute); + var navContentPaneEnabledAttribute = this.element.getAttribute(Report.navContentPaneEnabledAttribute); + var elementAttrSettings = { + filterPaneEnabled: (filterPaneEnabledAttribute == null) ? undefined : (filterPaneEnabledAttribute !== "false"), + navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false") + }; + // Set the settings back into the config. + this.config.settings = utils.assign({}, elementAttrSettings, config.settings); + if (isBootstrap) { + return; + } + config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Report.prototype.getDefaultEmbedUrlEndpoint = function () { + return "reportEmbed"; + }; + /** + * Switch Report view mode. + * + * @returns {Promise} + */ + Report.prototype.switchMode = function (viewMode) { + return __awaiter(this, void 0, void 0, function () { + var newMode, url, response, response_11; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (typeof viewMode === "string") { + newMode = viewMode; + } + else { + newMode = this.viewModeToString(viewMode); + } + url = '/report/switchMode/' + newMode; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_11 = _a.sent(); + throw response_11.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Refreshes data sources for the report. + * + * ```javascript + * report.refresh(); + * ``` + */ + Report.prototype.refresh = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_12; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_12 = _a.sent(); + throw response_12.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * checks if the report is saved. + * + * ```javascript + * report.isSaved() + * ``` + * + * @returns {Promise} + */ + Report.prototype.isSaved = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Apply a theme to the report + * + * ```javascript + * report.applyTheme(theme); + * ``` + */ + Report.prototype.applyTheme = function (theme) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, this.applyThemeInternal(theme)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Reset and apply the default theme of the report + * + * ```javascript + * report.resetTheme(); + * ``` + */ + Report.prototype.resetTheme = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, this.applyThemeInternal({})]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Reset user's filters, slicers, and other data view changes to the default state of the report + * + * ```javascript + * report.resetPersistentFilters(); + * ``` + */ + Report.prototype.resetPersistentFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response_13; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_13 = _a.sent(); + throw response_13.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Save user's filters, slicers, and other data view changes of the report + * + * ```javascript + * report.savePersistentFilters(); + * ``` + */ + Report.prototype.savePersistentFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response_14; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_14 = _a.sent(); + throw response_14.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns if there are user's filters, slicers, or other data view changes applied on the report. + * If persistent filters is disable, returns false. + * + * ```javascript + * report.arePersistentFiltersApplied(); + * ``` + * + * @returns {Promise} + */ + Report.prototype.arePersistentFiltersApplied = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_15; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_15 = _a.sent(); + throw response_15.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * @hidden + */ + Report.prototype.applyThemeInternal = function (theme) { + return __awaiter(this, void 0, void 0, function () { + var response, response_16; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_16 = _a.sent(); + throw response_16.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * @hidden + */ + Report.prototype.viewModeToString = function (viewMode) { + var mode; + switch (viewMode) { + case models.ViewMode.Edit: + mode = "edit"; + break; + case models.ViewMode.View: + mode = "view"; + break; + } + return mode; + }; + /** + * @hidden + */ + Report.prototype.isMobileSettings = function (settings) { + return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); + }; + /** @hidden */ + Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; + /** @hidden */ + Report.reportIdAttribute = 'powerbi-report-id'; + /** @hidden */ + Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled'; + /** @hidden */ + Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled'; + /** @hidden */ + Report.typeAttribute = 'powerbi-type'; + /** @hidden */ + Report.type = "Report"; + return Report; +}(embed.Embed)); +exports.Report = Report; /***/ }), -/* 15 */ + +/***/ "./src/service.ts": +/*!************************!*\ + !*** ./src/service.ts ***! + \************************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - var models = __webpack_require__(5); - var report_1 = __webpack_require__(7); - var visualDescriptor_1 = __webpack_require__(9); - /** - * The Power BI Visual embed component - * - * @export - * @class Visual - */ - var Visual = (function (_super) { - __extends(Visual, _super); - /** - * Creates an instance of a Power BI Single Visual. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} config - * @hidden - */ - function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { - _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe); - } - Visual.prototype.load = function (phasedRender) { - var config = this.config; - if (!config.accessToken) { - // bootstrap flow. - return; - } - if (typeof config.pageName !== 'string' || config.pageName.length === 0) { - throw new Error("Page name is required when embedding a visual."); - } - if (typeof config.visualName !== 'string' || config.visualName.length === 0) { - throw new Error("Visual name is required, but it was not found. You must provide a visual name as part of embed configuration."); - } - // calculate custom layout settings and override config. - var width = config.width ? config.width : this.iframe.offsetWidth; - var height = config.height ? config.height : this.iframe.offsetHeight; - var pageSize = { - type: models.PageSizeType.Custom, - width: width, - height: height, - }; - var pagesLayout = {}; - pagesLayout[config.pageName] = { - defaultLayout: { - displayState: { - mode: models.VisualContainerDisplayMode.Hidden - } - }, - visualsLayout: {} - }; - pagesLayout[config.pageName].visualsLayout[config.visualName] = { - displayState: { - mode: models.VisualContainerDisplayMode.Visible - }, - x: 1, - y: 1, - z: 1, - width: pageSize.width, - height: pageSize.height - }; - config.settings = config.settings || {}; - config.settings.filterPaneEnabled = false; - config.settings.navContentPaneEnabled = false; - config.settings.layoutType = models.LayoutType.Custom; - config.settings.customLayout = { - displayOption: models.DisplayOption.FitToPage, - pageSize: pageSize, - pagesLayout: pagesLayout - }; - this.config = config; - return _super.prototype.load.call(this, phasedRender); - }; - /** - * Gets the list of pages within the report - not supported in visual embed. - * - * @returns {Promise} - */ - Visual.prototype.getPages = function () { - throw Visual.GetPagesNotSupportedError; - }; - /** - * Sets the active page of the report - not supported in visual embed. - * - * @param {string} pageName - * @returns {Promise} - */ - Visual.prototype.setPage = function (pageName) { - throw Visual.SetPageNotSupportedError; - }; - /** - * Gets the embedded visual descriptor object that contains the visual name, type, etc. - * - * ```javascript - * visual.getVisualDescriptor() - * .then(visualDetails => { ... }); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.getVisualDescriptor = function () { - var _this = this; - var config = this.config; - return this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { - // Find the embedded visual from visuals of this page - // TODO: Use the Array.find method when ES6 is available - var embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); - if (embeddedVisuals.length === 0) { - var visualNotFoundError = { - message: "visualNotFound", - detailedMessage: "Visual not found" - }; - throw visualNotFoundError; - } - var embeddedVisual = embeddedVisuals[0]; - var currentPage = _this.page(config.pageName); - return new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); - }, function (response) { - throw response.body; - }); - }; - /** - * Gets filters that are applied to the filter level. - * Default filter level is visual level. - * - * ```javascript - * visual.getFilters(filtersLevel) - * .then(filters => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.getFilters = function (filtersLevel) { - var url = this.getFiltersLevelUrl(filtersLevel); - return this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(function (response) { return response.body; }, function (response) { - throw response.body; - }); - }; - /** - * Sets filters at the filter level. - * Default filter level is visual level. - * - * ```javascript - * const filters: [ - * ... - * ]; - * - * visual.setFilters(filters, filtersLevel) - * .catch(errors => { - * ... - * }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise} - */ - Visual.prototype.setFilters = function (filters, filtersLevel) { - var url = this.getFiltersLevelUrl(filtersLevel); - return this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(function (response) { - throw response.body; - }); - }; - /** - * Removes all filters from the current filter level. - * Default filter level is visual level. - * - * ```javascript - * visual.removeFilters(filtersLevel); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.removeFilters = function (filtersLevel) { - return this.setFilters([], filtersLevel); - }; - /** - * @hidden - */ - Visual.prototype.getFiltersLevelUrl = function (filtersLevel) { - var config = this.config; - switch (filtersLevel) { - case models.FiltersLevel.Report: - return "/report/filters"; - case models.FiltersLevel.Page: - return "/report/pages/" + config.pageName + "/filters"; - default: - return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters"; - } - }; - /** @hidden */ - Visual.type = "visual"; - /** @hidden */ - Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; - /** @hidden */ - Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; - return Visual; - }(report_1.Report)); - exports.Visual = Visual; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Service = void 0; +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); +var create_1 = __webpack_require__(/*! ./create */ "./src/create.ts"); +var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"); +var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts"); +var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); +var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts"); +var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +/** + * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application + * + * @export + * @class Service + * @implements {IService} + */ +var Service = /** @class */ (function () { + /** + * Creates an instance of a Power BI Service. + * + * @param {IHpmFactory} hpmFactory The http post message factory used in the postMessage communication layer + * @param {IWpmpFactory} wpmpFactory The window post message factory used in the postMessage communication layer + * @param {IRouterFactory} routerFactory The router factory used in the postMessage communication layer + * @param {IServiceConfiguration} [config={}] + * @hidden + */ + function Service(hpmFactory, wpmpFactory, routerFactory, config) { + var _this = this; + if (config === void 0) { config = {}; } + this.wpmp = wpmpFactory(config.wpmpName, config.logMessages); + this.hpm = hpmFactory(this.wpmp, null, config.version, config.type); + this.router = routerFactory(this.wpmp); + this.uniqueSessionId = utils.generateUUID(); + /** + * Adds handler for report events. + */ + this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'dashboard', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'tile', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + /** + * Adds handler for Q&A events. + */ + this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'qna', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + /** + * Adds handler for front load 'ready' message. + */ + this.router.post("/ready/:uniqueId", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: 'ready', + value: req.body + }; + _this.handleEvent(event); + }); + this.embeds = []; + // TODO: Change when Object.assign is available. + this.config = utils.assign({}, Service.defaultConfig, config); + if (this.config.autoEmbedOnContentLoaded) { + this.enableAutoEmbed(); + } + } + /** + * Creates new report + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.createReport = function (element, config) { + config.type = 'create'; + var powerBiElement = element; + var component = new create_1.Create(this, powerBiElement, config); + powerBiElement.powerBiEmbed = component; + this.addOrOverwriteEmbed(component, element); + return component; + }; + /** + * TODO: Add a description here + * + * @param {HTMLElement} [container] + * @param {embed.IEmbedConfiguration} [config=undefined] + * @returns {embed.Embed[]} + * @hidden + */ + Service.prototype.init = function (container, config) { + var _this = this; + if (config === void 0) { config = undefined; } + container = (container && container instanceof HTMLElement) ? container : document.body; + var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]")); + return elements.map(function (element) { return _this.embed(element, config); }); + }; + /** + * Given a configuration based on an HTML element, + * if the component has already been created and attached to the element, reuses the component instance and existing iframe, + * otherwise creates a new component instance. + * + * @param {HTMLElement} element + * @param {embed.IEmbedConfigurationBase} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.embed = function (element, config) { + if (config === void 0) { config = {}; } + return this.embedInternal(element, config); + }; + /** + * Given a configuration based on an HTML element, + * if the component has already been created and attached to the element, reuses the component instance and existing iframe, + * otherwise creates a new component instance. + * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. + * + * @param {HTMLElement} element + * @param {embed.IEmbedConfigurationBase} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.load = function (element, config) { + if (config === void 0) { config = {}; } + return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); + }; + /** + * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. + * + * @param {HTMLElement} element + * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. + */ + Service.prototype.bootstrap = function (element, config) { + return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); + }; + /** @hidden */ + Service.prototype.embedInternal = function (element, config, phasedRender, isBootstrap) { + if (config === void 0) { config = {}; } + var component; + var powerBiElement = element; + if (powerBiElement.powerBiEmbed) { + if (isBootstrap) { + throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element."); + } + component = this.embedExisting(powerBiElement, config, phasedRender); + } + else { + component = this.embedNew(powerBiElement, config, phasedRender, isBootstrap); + } + return component; + }; + /** @hidden */ + Service.prototype.getNumberOfComponents = function () { + if (!this.embeds) { + return 0; + } + return this.embeds.length; + }; + /** @hidden */ + Service.prototype.getSdkSessionId = function () { + return this.uniqueSessionId; + }; + /** + * Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup. + * + * @private + * @param {IPowerBiElement} element + * @param {embed.IEmbedConfigurationBase} config + * @returns {embed.Embed} + * @hidden + */ + Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) { + var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); + if (!componentType) { + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'."); + } + // Saves the type as part of the configuration so that it can be referenced later at a known location. + config.type = componentType; + var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components); + if (!Component) { + throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended."); + } + var component = new Component(this, element, config, phasedRender, isBootstrap); + element.powerBiEmbed = component; + this.addOrOverwriteEmbed(component, element); + return component; + }; + /** + * Given an element that already contains an embed component, load with a new configuration. + * + * @private + * @param {IPowerBiElement} element + * @param {embed.IEmbedConfigurationBase} config + * @returns {embed.Embed} + * @hidden + */ + Service.prototype.embedExisting = function (element, config, phasedRender) { + var component = utils.find(function (x) { return x.element === element; }, this.embeds); + if (!component) { + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); + } + // TODO: Multiple embedding to the same iframe is not supported in QnA + if (config.type && config.type.toLowerCase() === "qna") { + return this.embedNew(element, config); + } + /** + * TODO: Dynamic embed type switching could be supported but there is work needed to prepare the service state and DOM cleanup. + * remove all event handlers from the DOM, then reset the element to initial state which removes iframe, and removes from list of embeds + * then we can call the embedNew function which would allow setting the proper embedUrl and construction of object based on the new type. + */ + if (typeof config.type === "string" && config.type !== component.config.type) { + /** + * When loading report after create we want to use existing Iframe to optimize load period + */ + if (config.type === "report" && component.config.type === "create") { + var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe); + component.populateConfig(config, /* isBootstrap */ false); + report.load(); + element.powerBiEmbed = report; + this.addOrOverwriteEmbed(component, element); + return report; + } + throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type); + } + component.populateConfig(config, /* isBootstrap */ false); + component.load(phasedRender); + return component; + }; + /** + * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, + * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. + * + * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. + * This handler is typically useful only for applications that are rendered on the server so that all required data is available when the handler is called. + * + * @hidden + */ + Service.prototype.enableAutoEmbed = function () { + var _this = this; + window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false); + }; + /** + * Returns an instance of the component associated with the element. + * + * @param {HTMLElement} element + * @returns {(Report | Tile)} + */ + Service.prototype.get = function (element) { + var powerBiElement = element; + if (!powerBiElement.powerBiEmbed) { + throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance."); + } + return powerBiElement.powerBiEmbed; + }; + /** + * Finds an embed instance by the name or unique ID that is provided. + * + * @param {string} uniqueId + * @returns {(Report | Tile)} + * @hidden + */ + Service.prototype.find = function (uniqueId) { + return utils.find(function (x) { return x.config.uniqueId === uniqueId; }, this.embeds); + }; + /** + * Removes embed components whose container element is same as the given element + * + * @param {Embed} component + * @param {HTMLElement} element + * @returns {void} + * @hidden + */ + Service.prototype.addOrOverwriteEmbed = function (component, element) { + // remove embeds over the same div element. + this.embeds = this.embeds.filter(function (embed) { + return embed.element !== element; + }); + this.embeds.push(component); + }; + /** + * Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe. + * + * @param {HTMLElement} element + * @returns {void} + */ + Service.prototype.reset = function (element) { + var powerBiElement = element; + if (!powerBiElement.powerBiEmbed) { + return; + } + /** Removes the element frontLoad listener if exists. */ + var embedElement = powerBiElement.powerBiEmbed; + if (embedElement.frontLoadHandler) { + embedElement.element.removeEventListener('ready', embedElement.frontLoadHandler, false); + } + /** Removes the component from an internal list of components. */ + utils.remove(function (x) { return x === powerBiElement.powerBiEmbed; }, this.embeds); + /** Deletes a property from the HTML element. */ + delete powerBiElement.powerBiEmbed; + /** Removes the iframe from the element. */ + var iframe = element.querySelector('iframe'); + if (iframe) { + if (iframe.remove !== undefined) { + iframe.remove(); + } + else { + /** Workaround for IE: unhandled rejection TypeError: object doesn't support propert or method 'remove' */ + iframe.parentElement.removeChild(iframe); + } + } + }; + /** + * handles tile events + * + * @param {IEvent} event + * @hidden + */ + Service.prototype.handleTileEvents = function (event) { + if (event.type === 'tile') { + this.handleEvent(event); + } + }; + /** + * Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object. + * + * @private + * @param {IEvent} event + * @hidden + */ + Service.prototype.handleEvent = function (event) { + var embed = utils.find(function (embed) { + return (embed.config.uniqueId === event.id); + }, this.embeds); + if (embed) { + var value = event.value; + if (event.name === 'pageChanged') { + var pageKey = 'newPage'; + var page = value[pageKey]; + if (!page) { + throw new Error("Page model not found at 'event.value." + pageKey + "'."); + } + value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */); + } + utils.raiseCustomEvent(embed.element, event.name, value); + } + }; + /** + * API for warm starting powerbi embedded endpoints. + * Use this API to preload Power BI Embedded in the background. + * + * @public + * @param {embed.IEmbedConfigurationBase} [config={}] + * @param {HTMLElement} [element=undefined] + */ + Service.prototype.preload = function (config, element) { + var iframeContent = document.createElement("iframe"); + iframeContent.setAttribute("style", "display:none;"); + iframeContent.setAttribute("src", config.embedUrl); + iframeContent.setAttribute("scrolling", "no"); + iframeContent.setAttribute("allowfullscreen", "false"); + var node = element; + if (!node) { + node = document.getElementsByTagName("body")[0]; + } + node.appendChild(iframeContent); + iframeContent.onload = function () { + utils.raiseCustomEvent(iframeContent, "preloaded", {}); + }; + return iframeContent; + }; + /** + * A list of components that this service can embed + */ + Service.components = [ + tile_1.Tile, + report_1.Report, + dashboard_1.Dashboard, + qna_1.Qna, + visual_1.Visual + ]; + /** + * The default configuration for the service + */ + Service.defaultConfig = { + autoEmbedOnContentLoaded: false, + onError: function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return console.log(args[0], args.slice(1)); + } + }; + return Service; +}()); +exports.Service = Service; /***/ }), -/* 16 */ + +/***/ "./src/tile.ts": +/*!*********************!*\ + !*** ./src/tile.ts ***! + \*********************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - var config_1 = __webpack_require__(4); - var wpmp = __webpack_require__(17); - var hpm = __webpack_require__(18); - var router = __webpack_require__(19); - exports.hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) { - if (sdkVersion === void 0) { sdkVersion = config_1.default.version; } - if (sdkType === void 0) { sdkType = config_1.default.type; } - return new hpm.HttpPostMessage(wpmp, { - 'x-sdk-type': sdkType, - 'x-sdk-version': sdkVersion - }, defaultTargetWindow); - }; - exports.wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) { - return new wpmp.WindowPostMessageProxy({ - processTrackingProperties: { - addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties, - getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties, - }, - isErrorMessage: hpm.HttpPostMessage.isErrorMessage, - suppressWarnings: true, - name: name, - logMessages: logMessages, - eventSourceOverrideWindow: eventSourceOverrideWindow - }); - }; - exports.routerFactory = function (wpmp) { - return new router.Router(wpmp); - }; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Tile = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +/** + * The Power BI tile embed component + * + * @export + * @class Tile + * @extends {Embed} + */ +var Tile = /** @class */ (function (_super) { + __extends(Tile, _super); + /** + * @hidden + */ + function Tile(service, element, baseConfig, phasedRender, isBootstrap) { + var _this = this; + var config = baseConfig; + _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + _this.loadPath = "/tile/load"; + Array.prototype.push.apply(_this.allowedEvents, Tile.allowedEvents); + return _this; + } + /** + * The ID of the tile + * + * @returns {string} + */ + Tile.prototype.getId = function () { + var config = this.config; + var tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); + if (typeof tileId !== 'string' || tileId.length === 0) { + throw new Error("Tile id is required, but it was not found. You must provide an id either as part of embed configuration."); + } + return tileId; + }; + /** + * Validate load configuration. + */ + Tile.prototype.validate = function (config) { + var embedConfig = config; + return models.validateTileLoad(embedConfig); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Tile.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + // Populate tile id into config object. + this.config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Tile.prototype.getDefaultEmbedUrlEndpoint = function () { + return "tileEmbed"; + }; + /** + * Adds the ability to get tileId from url. + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Tile.findIdFromEmbedUrl = function (url) { + var tileIdRegEx = /tileId="?([^&]+)"?/; + var tileIdMatch = url.match(tileIdRegEx); + var tileId; + if (tileIdMatch) { + tileId = tileIdMatch[1]; + } + return tileId; + }; + /** @hidden */ + Tile.type = "Tile"; + /** @hidden */ + Tile.allowedEvents = ["tileClicked", "tileLoaded"]; + return Tile; +}(embed.Embed)); +exports.Tile = Tile; /***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - /*! window-post-message-proxy v0.2.6 | (c) 2016 Microsoft Corporation MIT */ - (function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["window-post-message-proxy"] = factory(); - else - root["window-post-message-proxy"] = factory(); - })(this, function() { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - /******/ - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if(installedModules[moduleId]) - /******/ return installedModules[moduleId].exports; - /******/ - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ exports: {}, - /******/ id: moduleId, - /******/ loaded: false - /******/ }; - /******/ - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - /******/ - /******/ // Flag the module as loaded - /******/ module.loaded = true; - /******/ - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - /******/ - /******/ - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - /******/ - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - /******/ - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = ""; - /******/ - /******/ // Load entry module and return exports - /******/ return __webpack_require__(0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ (function(module, exports) { - - "use strict"; - var WindowPostMessageProxy = (function () { - function WindowPostMessageProxy(options) { - var _this = this; - if (options === void 0) { options = { - processTrackingProperties: { - addTrackingProperties: WindowPostMessageProxy.defaultAddTrackingProperties, - getTrackingProperties: WindowPostMessageProxy.defaultGetTrackingProperties - }, - isErrorMessage: WindowPostMessageProxy.defaultIsErrorMessage, - receiveWindow: window, - name: WindowPostMessageProxy.createRandomString() - }; } - this.pendingRequestPromises = {}; - // save options with defaults - this.addTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.addTrackingProperties) || WindowPostMessageProxy.defaultAddTrackingProperties; - this.getTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.getTrackingProperties) || WindowPostMessageProxy.defaultGetTrackingProperties; - this.isErrorMessage = options.isErrorMessage || WindowPostMessageProxy.defaultIsErrorMessage; - this.receiveWindow = options.receiveWindow || window; - this.name = options.name || WindowPostMessageProxy.createRandomString(); - this.logMessages = options.logMessages || false; - this.eventSourceOverrideWindow = options.eventSourceOverrideWindow; - this.suppressWarnings = options.suppressWarnings || false; - if (this.logMessages) { - console.log("new WindowPostMessageProxy created with name: " + this.name + " receiving on window: " + this.receiveWindow.document.title); - } - // Initialize - this.handlers = []; - this.windowMessageHandler = function (event) { return _this.onMessageReceived(event); }; - this.start(); - } - // Static - WindowPostMessageProxy.defaultAddTrackingProperties = function (message, trackingProperties) { - message[WindowPostMessageProxy.messagePropertyName] = trackingProperties; - return message; - }; - WindowPostMessageProxy.defaultGetTrackingProperties = function (message) { - return message[WindowPostMessageProxy.messagePropertyName]; - }; - WindowPostMessageProxy.defaultIsErrorMessage = function (message) { - return !!message.error; - }; - /** - * Utility to create a deferred object. - */ - // TODO: Look to use RSVP library instead of doing this manually. - // From what I searched RSVP would work better because it has .finally and .deferred; however, it doesn't have Typings information. - WindowPostMessageProxy.createDeferred = function () { - var deferred = { - resolve: null, - reject: null, - promise: null - }; - var promise = new Promise(function (resolve, reject) { - deferred.resolve = resolve; - deferred.reject = reject; - }); - deferred.promise = promise; - return deferred; - }; - /** - * Utility to generate random sequence of characters used as tracking id for promises. - */ - WindowPostMessageProxy.createRandomString = function () { - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - return randomValueArray[0].toString(36).substring(1); - }; - /** - * Adds handler. - * If the first handler whose test method returns true will handle the message and provide a response. - */ - WindowPostMessageProxy.prototype.addHandler = function (handler) { - this.handlers.push(handler); - }; - /** - * Removes handler. - * The reference must match the original object that was provided when adding the handler. - */ - WindowPostMessageProxy.prototype.removeHandler = function (handler) { - var handlerIndex = this.handlers.indexOf(handler); - if (handlerIndex === -1) { - throw new Error("You attempted to remove a handler but no matching handler was found."); - } - this.handlers.splice(handlerIndex, 1); - }; - /** - * Start listening to message events. - */ - WindowPostMessageProxy.prototype.start = function () { - this.receiveWindow.addEventListener('message', this.windowMessageHandler); - }; - /** - * Stops listening to message events. - */ - WindowPostMessageProxy.prototype.stop = function () { - this.receiveWindow.removeEventListener('message', this.windowMessageHandler); - }; - /** - * Post message to target window with tracking properties added and save deferred object referenced by tracking id. - */ - WindowPostMessageProxy.prototype.postMessage = function (targetWindow, message) { - // Add tracking properties to indicate message came from this proxy - var trackingProperties = { id: WindowPostMessageProxy.createRandomString() }; - this.addTrackingProperties(message, trackingProperties); - if (this.logMessages) { - console.log(this.name + " Posting message:"); - console.log(JSON.stringify(message, null, ' ')); - } - targetWindow.postMessage(message, "*"); - var deferred = WindowPostMessageProxy.createDeferred(); - this.pendingRequestPromises[trackingProperties.id] = deferred; - return deferred.promise; - }; - /** - * Send response message to target window. - * Response messages re-use tracking properties from a previous request message. - */ - WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) { - this.addTrackingProperties(message, trackingProperties); - if (this.logMessages) { - console.log(this.name + " Sending response:"); - console.log(JSON.stringify(message, null, ' ')); - } - targetWindow.postMessage(message, "*"); - }; - /** - * Message handler. - */ - WindowPostMessageProxy.prototype.onMessageReceived = function (event) { - var _this = this; - if (this.logMessages) { - console.log(this.name + " Received message:"); - console.log("type: " + event.type); - console.log(JSON.stringify(event.data, null, ' ')); - } - var sendingWindow = this.eventSourceOverrideWindow || event.source; - var message = event.data; - if (typeof message !== "object") { - if (!this.suppressWarnings) { - console.warn("Proxy(" + this.name + "): Received message that was not an object. Discarding message"); - } - return; - } - var trackingProperties; - try { - trackingProperties = this.getTrackingProperties(message); - } - catch (e) { - if (!this.suppressWarnings) { - console.warn("Proxy(" + this.name + "): Error occurred when attempting to get tracking properties from incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - } - var deferred; - if (trackingProperties) { - deferred = this.pendingRequestPromises[trackingProperties.id]; - } - // If message does not have a known ID, treat it as a request - // Otherwise, treat message as response - if (!deferred) { - var handled = this.handlers.some(function (handler) { - var canMessageBeHandled = false; - try { - canMessageBeHandled = handler.test(message); - } - catch (e) { - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): Error occurred when handler was testing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - } - if (canMessageBeHandled) { - var responseMessagePromise = void 0; - try { - responseMessagePromise = Promise.resolve(handler.handle(message)); - } - catch (e) { - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): Error occurred when handler was processing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - responseMessagePromise = Promise.resolve(); - } - responseMessagePromise - .then(function (responseMessage) { - if (!responseMessage) { - var warningMessage = "Handler for message: " + JSON.stringify(message, null, ' ') + " did not return a response message. The default response message will be returned instead."; - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): " + warningMessage); - } - responseMessage = { - warning: warningMessage - }; - } - _this.sendResponse(sendingWindow, responseMessage, trackingProperties); - }); - return true; - } - }); - /** - * TODO: Consider returning an error message if nothing handled the message. - * In the case of the Report receiving messages all of them should be handled, - * however, in the case of the SDK receiving messages it's likely it won't register handlers - * for all events. Perhaps make this an option at construction time. - */ - if (!handled && !this.suppressWarnings) { - console.warn("Proxy(" + this.name + ") did not handle message. Handlers: " + this.handlers.length + " Message: " + JSON.stringify(message, null, '') + "."); - } - } - else { - /** - * If error message reject promise, - * Otherwise, resolve promise - */ - var isErrorMessage = true; - try { - isErrorMessage = this.isErrorMessage(message); - } - catch (e) { - console.warn("Proxy(" + this.name + ") Error occurred when trying to determine if message is consider an error response. Message: ", JSON.stringify(message, null, ''), 'Error: ', e); - } - if (isErrorMessage) { - deferred.reject(message); - } - else { - deferred.resolve(message); - } - // TODO: Move to .finally clause up where promise is created for better maitenance like original proxy code. - delete this.pendingRequestPromises[trackingProperties.id]; - } - }; - WindowPostMessageProxy.messagePropertyName = "windowPostMessageProxy"; - return WindowPostMessageProxy; - }()); - exports.WindowPostMessageProxy = WindowPostMessageProxy; - - - /***/ }) - /******/ ]) - }); - ; - //# sourceMappingURL=windowPostMessageProxy.js.map +/***/ "./src/util.ts": +/*!*********************!*\ + !*** ./src/util.ts ***! + \*********************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getTimeDiffInMilliseconds = exports.getRandomValue = exports.autoAuthInEmbedUrl = exports.isRDLEmbed = exports.isSavedInternal = exports.addParamToUrl = exports.generateUUID = exports.createRandomString = exports.assign = exports.remove = exports.find = exports.findIndex = exports.raiseCustomEvent = void 0; +/** + * Raises a custom event with event data on the specified HTML element. + * + * @export + * @param {HTMLElement} element + * @param {string} eventName + * @param {*} eventData + */ +function raiseCustomEvent(element, eventName, eventData) { + var customEvent; + if (typeof CustomEvent === 'function') { + customEvent = new CustomEvent(eventName, { + detail: eventData, + bubbles: true, + cancelable: true + }); + } + else { + customEvent = document.createEvent('CustomEvent'); + customEvent.initCustomEvent(eventName, true, true, eventData); + } + element.dispatchEvent(customEvent); +} +exports.raiseCustomEvent = raiseCustomEvent; +/** + * Finds the index of the first value in an array that matches the specified predicate. + * + * @export + * @template T + * @param {(x: T) => boolean} predicate + * @param {T[]} xs + * @returns {number} + */ +function findIndex(predicate, xs) { + if (!Array.isArray(xs)) { + throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs); + } + var index; + xs.some(function (x, i) { + if (predicate(x)) { + index = i; + return true; + } + }); + return index; +} +exports.findIndex = findIndex; +/** + * Finds the first value in an array that matches the specified predicate. + * + * @export + * @template T + * @param {(x: T) => boolean} predicate + * @param {T[]} xs + * @returns {T} + */ +function find(predicate, xs) { + var index = findIndex(predicate, xs); + return xs[index]; +} +exports.find = find; +function remove(predicate, xs) { + var index = findIndex(predicate, xs); + xs.splice(index, 1); +} +exports.remove = remove; +// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign +// TODO: replace in favor of using polyfill +/** + * Copies the values of all enumerable properties from one or more source objects to a target object, and returns the target object. + * + * @export + * @param {any} args + * @returns + */ +function assign() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var target = args[0]; + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +} +exports.assign = assign; +/** + * Generates a random 5 to 6 character string. + * + * @export + * @returns {string} + */ +function createRandomString() { + return getRandomValue().toString(36).substring(1); +} +exports.createRandomString = createRandomString; +/** + * Generates a 20 charachter uuid. + * + * @export + * @returns {string} + */ +function generateUUID() { + var d = new Date().getTime(); + if (typeof performance !== 'undefined' && typeof performance.now === 'function') { + d += performance.now(); + } + return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + // Generate a random number, scaled from 0 to 15. + var r = (getRandomValue() % 16); + // Shift 4 times to divide by 16 + d >>= 4; + return r.toString(16); + }); +} +exports.generateUUID = generateUUID; +/** + * Adds a parameter to the given url + * + * @export + * @param {string} url + * @param {string} paramName + * @param {string} value + * @returns {string} + */ +function addParamToUrl(url, paramName, value) { + var parameterPrefix = url.indexOf('?') > 0 ? '&' : '?'; + url += parameterPrefix + paramName + '=' + value; + return url; +} +exports.addParamToUrl = addParamToUrl; +/** + * Checks if the report is saved. + * + * @export + * @param {HttpPostMessage} hpm + * @param {string} uid + * @param {Window} contentWindow + * @returns {Promise} + */ +function isSavedInternal(hpm, uid, contentWindow) { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, hpm.get('/report/hasUnsavedChanges', { uid: uid }, contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, !response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); +} +exports.isSavedInternal = isSavedInternal; +/** + * Checks if the embed url is for RDL report. + * + * @export + * @param {string} embedUrl + * @returns {boolean} + */ +function isRDLEmbed(embedUrl) { + return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0; +} +exports.isRDLEmbed = isRDLEmbed; +/** + * Checks if the embed url contains autoAuth=true. + * + * @export + * @param {string} embedUrl + * @returns {boolean} + */ +function autoAuthInEmbedUrl(embedUrl) { + return embedUrl && decodeURIComponent(embedUrl).toLowerCase().indexOf("autoauth=true") >= 0; +} +exports.autoAuthInEmbedUrl = autoAuthInEmbedUrl; +/** + * Returns random number + */ +function getRandomValue() { + // window.msCrypto for IE + var cryptoObj = window.crypto || window.msCrypto; + var randomValueArray = new Uint32Array(1); + cryptoObj.getRandomValues(randomValueArray); + return randomValueArray[0]; +} +exports.getRandomValue = getRandomValue; +/** + * Returns the time interval between two dates in milliseconds + * @export + * @param {Date} start + * @param {Date} end + * @returns {number} + */ +function getTimeDiffInMilliseconds(start, end) { + return Math.abs(start.getTime() - end.getTime()); +} +exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; + /***/ }), -/* 18 */ + +/***/ "./src/visual.ts": +/*!***********************!*\ + !*** ./src/visual.ts ***! + \***********************/ +/*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { - /*! http-post-message v0.2.3 | (c) 2016 Microsoft Corporation MIT */ - (function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["http-post-message"] = factory(); - else - root["http-post-message"] = factory(); - })(this, function() { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - /******/ - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if(installedModules[moduleId]) - /******/ return installedModules[moduleId].exports; - /******/ - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ exports: {}, - /******/ id: moduleId, - /******/ loaded: false - /******/ }; - /******/ - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - /******/ - /******/ // Flag the module as loaded - /******/ module.loaded = true; - /******/ - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - /******/ - /******/ - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - /******/ - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - /******/ - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = ""; - /******/ - /******/ // Load entry module and return exports - /******/ return __webpack_require__(0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ function(module, exports) { - - "use strict"; - var HttpPostMessage = (function () { - function HttpPostMessage(windowPostMessageProxy, defaultHeaders, defaultTargetWindow) { - if (defaultHeaders === void 0) { defaultHeaders = {}; } - this.defaultHeaders = defaultHeaders; - this.defaultTargetWindow = defaultTargetWindow; - this.windowPostMessageProxy = windowPostMessageProxy; - } - // TODO: See if it's possible to share tracking properties interface? - // The responsibility of knowing how to configure windowPostMessageProxy for http should - // live in this http class, but the configuration would need ITrackingProperties - // interface which lives in WindowPostMessageProxy. Use type as workaround - HttpPostMessage.addTrackingProperties = function (message, trackingProperties) { - message.headers = message.headers || {}; - if (trackingProperties && trackingProperties.id) { - message.headers.id = trackingProperties.id; - } - return message; - }; - HttpPostMessage.getTrackingProperties = function (message) { - return { - id: message.headers && message.headers.id - }; - }; - HttpPostMessage.isErrorMessage = function (message) { - if (typeof (message && message.statusCode) !== 'number') { - return false; - } - return !(200 <= message.statusCode && message.statusCode < 300); - }; - HttpPostMessage.prototype.get = function (url, headers, targetWindow) { - if (headers === void 0) { headers = {}; } - if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } - return this.send({ - method: "GET", - url: url, - headers: headers - }, targetWindow); - }; - HttpPostMessage.prototype.post = function (url, body, headers, targetWindow) { - if (headers === void 0) { headers = {}; } - if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } - return this.send({ - method: "POST", - url: url, - headers: headers, - body: body - }, targetWindow); - }; - HttpPostMessage.prototype.put = function (url, body, headers, targetWindow) { - if (headers === void 0) { headers = {}; } - if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } - return this.send({ - method: "PUT", - url: url, - headers: headers, - body: body - }, targetWindow); - }; - HttpPostMessage.prototype.patch = function (url, body, headers, targetWindow) { - if (headers === void 0) { headers = {}; } - if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } - return this.send({ - method: "PATCH", - url: url, - headers: headers, - body: body - }, targetWindow); - }; - HttpPostMessage.prototype.delete = function (url, body, headers, targetWindow) { - if (body === void 0) { body = null; } - if (headers === void 0) { headers = {}; } - if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } - return this.send({ - method: "DELETE", - url: url, - headers: headers, - body: body - }, targetWindow); - }; - HttpPostMessage.prototype.send = function (request, targetWindow) { - if (targetWindow === void 0) { targetWindow = this.defaultTargetWindow; } - request.headers = this.assign({}, this.defaultHeaders, request.headers); - if (!targetWindow) { - throw new Error("target window is not provided. You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class."); - } - return this.windowPostMessageProxy.postMessage(targetWindow, request); - }; - /** - * Object.assign() polyfill - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - */ - HttpPostMessage.prototype.assign = function (target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - var output = Object(target); - sources.forEach(function (source) { - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (Object.prototype.hasOwnProperty.call(source, nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - }); - return output; - }; - return HttpPostMessage; - }()); - exports.HttpPostMessage = HttpPostMessage; - - - /***/ } - /******/ ]) - }); - ; - //# sourceMappingURL=httpPostMessage.js.map +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Visual = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); +var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); +/** + * The Power BI Visual embed component + * + * @export + * @class Visual + */ +var Visual = /** @class */ (function (_super) { + __extends(Visual, _super); + /** + * Creates an instance of a Power BI Single Visual. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} config + * @hidden + */ + function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { + return _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe) || this; + } + Visual.prototype.load = function (phasedRender) { + var config = this.config; + if (!config.accessToken) { + // bootstrap flow. + return; + } + if (typeof config.pageName !== 'string' || config.pageName.length === 0) { + throw new Error("Page name is required when embedding a visual."); + } + if (typeof config.visualName !== 'string' || config.visualName.length === 0) { + throw new Error("Visual name is required, but it was not found. You must provide a visual name as part of embed configuration."); + } + // calculate custom layout settings and override config. + var width = config.width ? config.width : this.iframe.offsetWidth; + var height = config.height ? config.height : this.iframe.offsetHeight; + var pageSize = { + type: models.PageSizeType.Custom, + width: width, + height: height, + }; + var pagesLayout = {}; + pagesLayout[config.pageName] = { + defaultLayout: { + displayState: { + mode: models.VisualContainerDisplayMode.Hidden + } + }, + visualsLayout: {} + }; + pagesLayout[config.pageName].visualsLayout[config.visualName] = { + displayState: { + mode: models.VisualContainerDisplayMode.Visible + }, + x: 1, + y: 1, + z: 1, + width: pageSize.width, + height: pageSize.height + }; + config.settings = config.settings || {}; + config.settings.filterPaneEnabled = false; + config.settings.navContentPaneEnabled = false; + config.settings.layoutType = models.LayoutType.Custom; + config.settings.customLayout = { + displayOption: models.DisplayOption.FitToPage, + pageSize: pageSize, + pagesLayout: pagesLayout + }; + this.config = config; + return _super.prototype.load.call(this, phasedRender); + }; + /** + * Gets the list of pages within the report - not supported in visual embed. + * + * @returns {Promise} + */ + Visual.prototype.getPages = function () { + throw Visual.GetPagesNotSupportedError; + }; + /** + * Sets the active page of the report - not supported in visual embed. + * + * @param {string} pageName + * @returns {Promise>} + */ + Visual.prototype.setPage = function (pageName) { + throw Visual.SetPageNotSupportedError; + }; + /** + * Gets the embedded visual descriptor object that contains the visual name, type, etc. + * + * ```javascript + * visual.getVisualDescriptor() + * .then(visualDetails => { ... }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getVisualDescriptor = function () { + return __awaiter(this, void 0, void 0, function () { + var config, response, embeddedVisuals, visualNotFoundError, embeddedVisual, currentPage, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + config = this.config; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); + if (embeddedVisuals.length === 0) { + visualNotFoundError = { + message: "visualNotFound", + detailedMessage: "Visual not found" + }; + throw visualNotFoundError; + } + embeddedVisual = embeddedVisuals[0]; + currentPage = this.page(config.pageName); + return [2 /*return*/, new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout)]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets filters that are applied to the filter level. + * Default filter level is visual level. + * + * ```javascript + * visual.getFilters(filtersLevel) + * .then(filters => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getFilters = function (filtersLevel) { + return __awaiter(this, void 0, void 0, function () { + var url, response, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + url = this.getFiltersLevelUrl(filtersLevel); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_2 = _a.sent(); + throw response_2.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets filters at the filter level. + * Default filter level is visual level. + * + * ```javascript + * const filters: [ + * ... + * ]; + * + * visual.setFilters(filters, filtersLevel) + * .catch(errors => { + * ... + * }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + Visual.prototype.setFilters = function (filters, filtersLevel) { + return __awaiter(this, void 0, void 0, function () { + var url, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + url = this.getFiltersLevelUrl(filtersLevel); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters from the current filter level. + * Default filter level is visual level. + * + * ```javascript + * visual.removeFilters(filtersLevel); + * ``` + * + * @returns {Promise>} + */ + Visual.prototype.removeFilters = function (filtersLevel) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.setFilters([], filtersLevel)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * @hidden + */ + Visual.prototype.getFiltersLevelUrl = function (filtersLevel) { + var config = this.config; + switch (filtersLevel) { + case models.FiltersLevel.Report: + return "/report/filters"; + case models.FiltersLevel.Page: + return "/report/pages/" + config.pageName + "/filters"; + default: + return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters"; + } + }; + /** @hidden */ + Visual.type = "visual"; + /** @hidden */ + Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; + /** @hidden */ + Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; + return Visual; +}(report_1.Report)); +exports.Visual = Visual; + /***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - /*! powerbi-router v0.1.5 | (c) 2016 Microsoft Corporation MIT */ - (function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["powerbi-router"] = factory(); - else - root["powerbi-router"] = factory(); - })(this, function() { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - /******/ - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - /******/ - /******/ // Check if module is in cache - /******/ if(installedModules[moduleId]) - /******/ return installedModules[moduleId].exports; - /******/ - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ exports: {}, - /******/ id: moduleId, - /******/ loaded: false - /******/ }; - /******/ - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - /******/ - /******/ // Flag the module as loaded - /******/ module.loaded = true; - /******/ - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - /******/ - /******/ - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - /******/ - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - /******/ - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = ""; - /******/ - /******/ // Load entry module and return exports - /******/ return __webpack_require__(0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - - "use strict"; - var RouteRecognizer = __webpack_require__(1); - var Router = (function () { - function Router(handlers) { - this.handlers = handlers; - /** - * TODO: look at generating the router dynamically based on list of supported http methods - * instead of hardcoding the creation of these and the methods. - */ - this.getRouteRecognizer = new RouteRecognizer(); - this.patchRouteRecognizer = new RouteRecognizer(); - this.postRouteRecognizer = new RouteRecognizer(); - this.putRouteRecognizer = new RouteRecognizer(); - this.deleteRouteRecognizer = new RouteRecognizer(); - } - Router.prototype.get = function (url, handler) { - this.registerHandler(this.getRouteRecognizer, "GET", url, handler); - return this; - }; - Router.prototype.patch = function (url, handler) { - this.registerHandler(this.patchRouteRecognizer, "PATCH", url, handler); - return this; - }; - Router.prototype.post = function (url, handler) { - this.registerHandler(this.postRouteRecognizer, "POST", url, handler); - return this; - }; - Router.prototype.put = function (url, handler) { - this.registerHandler(this.putRouteRecognizer, "PUT", url, handler); - return this; - }; - Router.prototype.delete = function (url, handler) { - this.registerHandler(this.deleteRouteRecognizer, "DELETE", url, handler); - return this; - }; - /** - * TODO: This method could use some refactoring. There is conflict of interest between keeping clean separation of test and handle method - * Test method only returns boolean indicating if request can be handled, and handle method has opportunity to modify response and return promise of it. - * In the case of the router with route-recognizer where handlers are associated with routes, this already guarantees that only one handler is selected and makes the test method feel complicated - * Will leave as is an investigate cleaner ways at later time. - */ - Router.prototype.registerHandler = function (routeRecognizer, method, url, handler) { - var routeRecognizerHandler = function (request) { - var response = new Response(); - return Promise.resolve(handler(request, response)) - .then(function (x) { return response; }); - }; - routeRecognizer.add([ - { path: url, handler: routeRecognizerHandler } - ]); - var internalHandler = { - test: function (request) { - if (request.method !== method) { - return false; - } - var matchingRoutes = routeRecognizer.recognize(request.url); - if (matchingRoutes === undefined) { - return false; - } - /** - * Copy parameters from recognized route to the request so they can be used within the handler function - * This isn't ideal because it is side affect which modifies the request instead of strictly testing for true or false - * but I don't see a better place to put this. If we move it between the call to test and the handle it becomes part of the window post message proxy - * even though it's responsibility is related to routing. - */ - var route = matchingRoutes[0]; - request.params = route.params; - request.queryParams = matchingRoutes.queryParams; - request.handler = route.handler; - return true; - }, - handle: function (request) { - return request.handler(request); - } - }; - this.handlers.addHandler(internalHandler); - }; - return Router; - }()); - exports.Router = Router; - var Response = (function () { - function Response() { - this.statusCode = 200; - this.headers = {}; - this.body = null; - } - Response.prototype.send = function (statusCode, body) { - this.statusCode = statusCode; - this.body = body; - }; - return Response; - }()); - exports.Response = Response; - - - /***/ }, - /* 1 */ - /***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {(function() { - "use strict"; - function $$route$recognizer$dsl$$Target(path, matcher, delegate) { - this.path = path; - this.matcher = matcher; - this.delegate = delegate; - } - - $$route$recognizer$dsl$$Target.prototype = { - to: function(target, callback) { - var delegate = this.delegate; - - if (delegate && delegate.willAddRoute) { - target = delegate.willAddRoute(this.matcher.target, target); - } - - this.matcher.add(this.path, target); - - if (callback) { - if (callback.length === 0) { throw new Error("You must have an argument in the function passed to `to`"); } - this.matcher.addChild(this.path, target, callback, this.delegate); - } - return this; - } - }; - - function $$route$recognizer$dsl$$Matcher(target) { - this.routes = {}; - this.children = {}; - this.target = target; - } - - $$route$recognizer$dsl$$Matcher.prototype = { - add: function(path, handler) { - this.routes[path] = handler; - }, - - addChild: function(path, target, callback, delegate) { - var matcher = new $$route$recognizer$dsl$$Matcher(target); - this.children[path] = matcher; - - var match = $$route$recognizer$dsl$$generateMatch(path, matcher, delegate); - - if (delegate && delegate.contextEntered) { - delegate.contextEntered(target, match); - } - - callback(match); - } - }; - - function $$route$recognizer$dsl$$generateMatch(startingPath, matcher, delegate) { - return function(path, nestedCallback) { - var fullPath = startingPath + path; - - if (nestedCallback) { - nestedCallback($$route$recognizer$dsl$$generateMatch(fullPath, matcher, delegate)); - } else { - return new $$route$recognizer$dsl$$Target(startingPath + path, matcher, delegate); - } - }; - } - - function $$route$recognizer$dsl$$addRoute(routeArray, path, handler) { - var len = 0; - for (var i=0; i z`. For instance, "199" is smaller - // then "200", even though "y" and "z" (which are both 9) are larger than "0" (the value - // of (`b` and `c`). This is because the leading symbol, "2", is larger than the other - // leading symbol, "1". - // The rule is that symbols to the left carry more weight than symbols to the right - // when a number is written out as a string. In the above strings, the leading digit - // represents how many 100's are in the number, and it carries more weight than the middle - // number which represents how many 10's are in the number. - // This system of number magnitude works well for route specificity, too. A route written as - // `a/b/c` will be more specific than `x/y/z` as long as `a` is more specific than - // `x`, irrespective of the other parts. - // Because of this similarity, we assign each type of segment a number value written as a - // string. We can find the specificity of compound routes by concatenating these strings - // together, from left to right. After we have looped through all of the segments, - // we convert the string to a number. - specificity.val = ''; - - for (var i=0; i 2 && key.slice(keyLength -2) === '[]') { - isArray = true; - key = key.slice(0, keyLength - 2); - if(!queryParams[key]) { - queryParams[key] = []; - } - } - value = pair[1] ? $$route$recognizer$$decodeQueryParamPart(pair[1]) : ''; - } - if (isArray) { - queryParams[key].push(value); - } else { - queryParams[key] = value; - } - } - return queryParams; - }, - - recognize: function(path) { - var states = [ this.rootState ], - pathLen, i, l, queryStart, queryParams = {}, - isSlashDropped = false; - - queryStart = path.indexOf('?'); - if (queryStart !== -1) { - var queryString = path.substr(queryStart + 1, path.length); - path = path.substr(0, queryStart); - queryParams = this.parseQueryString(queryString); - } - - path = decodeURI(path); - - if (path.charAt(0) !== "/") { path = "/" + path; } - - pathLen = path.length; - if (pathLen > 1 && path.charAt(pathLen - 1) === "/") { - path = path.substr(0, pathLen - 1); - isSlashDropped = true; - } - - for (i=0; i 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualDescriptor = void 0; +/** + * A Power BI visual within a page + * + * @export + * @class VisualDescriptor + * @implements {IVisualNode} + */ +var VisualDescriptor = /** @class */ (function () { + /** + * @hidden + */ + function VisualDescriptor(page, name, title, type, layout) { + this.name = name; + this.title = title; + this.type = type; + this.layout = layout; + this.page = page; + } + /** + * Gets all visual level filters of the current visual. + * + * ```javascript + * visual.getFilters() + * .then(filters => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.getFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters from the current visual. + * + * ```javascript + * visual.removeFilters(); + * ``` + * + * @returns {Promise>} + */ + VisualDescriptor.prototype.removeFilters = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.setFilters([])]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Sets the filters on the current visual to 'filters'. + * + * ```javascript + * visual.setFilters(filters); + * .catch(errors => { ... }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + VisualDescriptor.prototype.setFilters = function (filters) { + return __awaiter(this, void 0, void 0, function () { + var response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_2 = _a.sent(); + throw response_2.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Exports Visual data. + * Can export up to 30K rows. + * @param rows: Optional. Default value is 30K, maximum value is 30K as well. + * @param exportDataType: Optional. Default is models.ExportDataType.Summarized. + * ```javascript + * visual.exportData() + * .then(data => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.exportData = function (exportDataType, rows) { + return __awaiter(this, void 0, void 0, function () { + var exportDataRequestBody, response, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + exportDataRequestBody = { + rows: rows, + exportDataType: exportDataType + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Set slicer state. + * Works only for visuals of type slicer. + * @param state: A new state which contains the slicer filters. + * ```javascript + * visual.setSlicerState() + * .then(() => { ... }); + * ``` + */ + VisualDescriptor.prototype.setSlicerState = function (state) { + return __awaiter(this, void 0, void 0, function () { + var response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_4 = _a.sent(); + throw response_4.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Get slicer state. + * Works only for visuals of type slicer. + * + * ```javascript + * visual.getSlicerState() + * .then(state => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.getSlicerState = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_5 = _a.sent(); + throw response_5.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Clone existing visual to a new instance. + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.clone = function (request) { + if (request === void 0) { request = {}; } + return __awaiter(this, void 0, void 0, function () { + var response, response_6; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_6 = _a.sent(); + throw response_6.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sort a visual by dataField and direction. + * + * @param request: Sort by visual request. + * + * ```javascript + * visual.sortBy(request) + * .then(() => { ... }); + * ``` + */ + VisualDescriptor.prototype.sortBy = function (request) { + return __awaiter(this, void 0, void 0, function () { + var response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_7 = _a.sent(); + throw response_7.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + return VisualDescriptor; +}()); +exports.VisualDescriptor = VisualDescriptor; + /***/ }) -/******/ ]) + +/******/ }); }); -; //# sourceMappingURL=powerbi.js.map \ No newline at end of file diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index a3222a9d..f1220a9f 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,9 +1,10 @@ -/*! powerbi-client v2.15.2 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={exports:{},id:a,loaded:!1};return t[a].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){var a=r(1);e.service=a;var i=r(16);e.factories=i;var o=r(5);e.models=o;var n=r(7);e.Report=n.Report;var l=r(12);e.Dashboard=l.Dashboard;var d=r(13);e.Tile=d.Tile;var s=r(2);e.Embed=s.Embed;var u=r(8);e.Page=u.Page;var p=r(14);e.Qna=p.Qna;var c=r(15);e.Visual=c.Visual;var f=r(9);e.VisualDescriptor=f.VisualDescriptor;var v=new a.Service(i.hpmFactory,i.wpmpFactory,i.routerFactory);window.powerbi=v},function(t,e,r){var a=r(2),i=r(7),o=r(11),n=r(12),l=r(13),d=r(8),s=r(14),u=r(15),p=r(3),c=function(){function t(e,r,a,i){var o=this;void 0===i&&(i={}),this.wpmp=r(i.wpmpName,i.logMessages),this.hpm=e(this.wpmp,null,i.version,i.type),this.router=a(this.wpmp),this.uniqueSessionId=p.generateUUID(),this.router.post("/reports/:uniqueId/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName",function(t,e){var r={type:"report",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/dashboards/:uniqueId/events/:eventName",function(t,e){var r={type:"dashboard",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/tile/:uniqueId/events/:eventName",function(t,e){var r={type:"tile",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/qna/:uniqueId/events/:eventName",function(t,e){var r={type:"qna",id:t.params.uniqueId,name:t.params.eventName,value:t.body};o.handleEvent(r)}),this.router.post("/ready/:uniqueId",function(t,e){var r={type:"report",id:t.params.uniqueId,name:"ready",value:t.body};o.handleEvent(r)}),this.embeds=[],this.config=p.assign({},t.defaultConfig,i),this.config.autoEmbedOnContentLoaded&&this.enableAutoEmbed()}return t.prototype.createReport=function(t,e){e.type="create";var r=t,a=new o.Create(this,r,e);return r.powerBiEmbed=a,this.addOrOverwriteEmbed(a,t),a},t.prototype.init=function(t,e){var r=this;void 0===e&&(e=void 0),t=t&&t instanceof HTMLElement?t:document.body;var i=Array.prototype.slice.call(t.querySelectorAll("["+a.Embed.embedUrlAttribute+"]"));return i.map(function(t){return r.embed(t,e)})},t.prototype.embed=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e)},t.prototype.load=function(t,e){return void 0===e&&(e={}),this.embedInternal(t,e,!0,!1)},t.prototype.bootstrap=function(t,e){return this.embedInternal(t,e,!1,!0)},t.prototype.embedInternal=function(t,e,r,a){void 0===e&&(e={});var i,o=t;if(o.powerBiEmbed){if(a)throw new Error("Attempted to bootstrap element "+t.outerHTML+", but the element is already a powerbi element.");i=this.embedExisting(o,e,r)}else i=this.embedNew(o,e,r,a);return i},t.prototype.getNumberOfComponents=function(){return this.embeds?this.embeds.length:0},t.prototype.getSdkSessionId=function(){return this.uniqueSessionId},t.prototype.embedNew=function(e,r,o,n){var l=r.type||e.getAttribute(a.Embed.typeAttribute);if(!l)throw new Error("Attempted to embed using config "+JSON.stringify(r)+" on element "+e.outerHTML+", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '"+a.Embed.typeAttribute+'="'+i.Report.type.toLowerCase()+"\"'.");r.type=l;var d=p.find(function(t){return l===t.type.toLowerCase()},t.components);if(!d)throw new Error("Attempted to embed component of type: "+l+" but did not find any matching component. Please verify the type you specified is intended.");var s=new d(this,e,r,o,n);return e.powerBiEmbed=s,this.addOrOverwriteEmbed(s,e),s},t.prototype.embedExisting=function(t,e,r){var a=p.find(function(e){return e.element===t},this.embeds);if(!a)throw new Error("Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+" which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");if(e.type&&"qna"===e.type.toLowerCase())return this.embedNew(t,e);if("string"==typeof e.type&&e.type!==a.config.type){if("report"===e.type&&"create"===a.config.type){var o=new i.Report(this,t,e,(!1),(!1),t.powerBiEmbed.iframe);return a.populateConfig(e,!1),o.load(),t.powerBiEmbed=o,this.addOrOverwriteEmbed(a,t),o}throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config "+JSON.stringify(e)+" on element "+t.outerHTML+", but the existing element contains an embed of type: "+this.config.type+" which does not match the new type: "+e.type)}return a.populateConfig(e,!1),a.load(r),a},t.prototype.enableAutoEmbed=function(){var t=this;window.addEventListener("DOMContentLoaded",function(e){return t.init(document.body)},!1)},t.prototype.get=function(t){var e=t;if(!e.powerBiEmbed)throw new Error("You attempted to get an instance of powerbi component associated with element: "+t.outerHTML+" but there was no associated instance.");return e.powerBiEmbed},t.prototype.find=function(t){return p.find(function(e){return e.config.uniqueId===t},this.embeds)},t.prototype.addOrOverwriteEmbed=function(t,e){this.embeds=this.embeds.filter(function(t){return t.element!==e}),this.embeds.push(t)},t.prototype.reset=function(t){var e=t;if(e.powerBiEmbed){var r=e.powerBiEmbed;r.frontLoadHandler&&r.element.removeEventListener("ready",r.frontLoadHandler,!1),p.remove(function(t){return t===e.powerBiEmbed},this.embeds),delete e.powerBiEmbed;var a=t.querySelector("iframe");a&&(void 0!==a.remove?a.remove():a.parentElement.removeChild(a))}},t.prototype.handleTileEvents=function(t){"tile"===t.type&&this.handleEvent(t)},t.prototype.handleEvent=function(t){var e=p.find(function(e){return e.config.uniqueId===t.id},this.embeds);if(e){var r=t.value;if("pageChanged"===t.name){var a="newPage",i=r[a];if(!i)throw new Error("Page model not found at 'event.value."+a+"'.");r[a]=new d.Page(e,i.name,i.displayName,(!0))}p.raiseCustomEvent(e.element,t.name,r)}},t.prototype.preload=function(t,e){var r=document.createElement("iframe");r.setAttribute("style","display:none;"),r.setAttribute("src",t.embedUrl),r.setAttribute("scrolling","no"),r.setAttribute("allowfullscreen","false");var a=e;return a||(a=document.getElementsByTagName("body")[0]),a.appendChild(r),r.onload=function(){p.raiseCustomEvent(r,"preloaded",{})},r},t.components=[l.Tile,i.Report,n.Dashboard,s.Qna,u.Visual],t.defaultConfig={autoEmbedOnContentLoaded:!1,onError:function(){for(var t=[],e=0;e>=4,r.toString(16)})}function s(t,e,r){var a=t.indexOf("?")>0?"&":"?";return t+=a+e+"="+r}function u(t,e,r){return t.get("/report/hasUnsavedChanges",{uid:e},r).then(function(t){return!t.body},function(t){throw t.body})}function p(t){return t.toLowerCase().indexOf("/rdlembed?")>=0}function c(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0}function f(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0]}function v(t,e){return Math.abs(t.getTime()-e.getTime())}e.raiseCustomEvent=r,e.findIndex=a,e.find=i,e.remove=o,e.assign=n,e.createRandomString=l,e.generateUUID=d,e.addParamToUrl=s,e.isSavedInternal=u,e.isRDLEmbed=p,e.autoAuthInEmbedUrl=c,e.getRandomValue=f,e.getTimeDiffInMilliseconds=v},function(t,e){var r={version:"2.15.2",type:"js"};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r},function(t,e,r){/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ -!function(e,r){t.exports=r()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){return l(t)&&!!t.keys}function i(t){return o(t)===ct.Basic&&!!t.keyValues}function o(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?ct.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?ct.Advanced:ct.Unknown}function n(t){return void 0!==t.table&&void 0!==t.measure}function l(t){return!(!t.table||!t.column||t.aggregationFunction)}function d(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)}function s(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)}function u(t){return!!(t.table&&t.column&&t.aggregationFunction)}function p(t){return t&&!c(t)}function c(t){return t&&!!t.groupName}function f(t){return t&&!v(t)}function v(t){return Array.isArray(t)}function h(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}function y(t){var e=X.Validators.visualSelectorValidator.validate(t);return e?e.map(h):void 0}function V(t){var e=X.Validators.slicerValidator.validate(t);return e?e.map(h):void 0}function m(t){var e=X.Validators.slicerStateValidator.validate(t);return e?e.map(h):void 0}function g(t){var e=X.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(h):void 0}function w(t){var e=X.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(h):void 0}function b(t){var e=X.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(h):void 0}function P(t){var e=X.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(h):void 0}function S(t){var e=X.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(h):void 0}function E(t){var e=X.Validators.settingsValidator.validate(t);return e?e.map(h):void 0}function T(t){var e=X.Validators.reportPanesValidator.validate(t);return e?e.map(h):void 0}function O(t){var e=X.Validators.bookmarksPaneValidator.validate(t);return e?e.map(h):void 0}function _(t){var e=X.Validators.filtersPaneValidator.validate(t);return e?e.map(h):void 0}function F(t){var e=X.Validators.fieldsPaneValidator.validate(t);return e?e.map(h):void 0}function R(t){var e=X.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(h):void 0}function k(t){var e=X.Validators.selectionPaneValidator.validate(t);return e?e.map(h):void 0}function A(t){var e=X.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(h):void 0}function C(t){var e=X.Validators.visualizationsPaneValidator.validate(t);return e?e.map(h):void 0}function x(t){var e=X.Validators.customPageSizeValidator.validate(t);return e?e.map(h):void 0}function M(t){var e=X.Validators.extensionValidator.validate(t);return e?e.map(h):void 0}function q(t){var e=X.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(h):void 0}function I(t){var e=X.Validators.reportLoadValidator.validate(t);return e?e.map(h):void 0}function L(t){var e=X.Validators.reportCreateValidator.validate(t);return e?e.map(h):void 0}function j(t){var e=X.Validators.dashboardLoadValidator.validate(t);return e?e.map(h):void 0}function N(t){var e=X.Validators.tileLoadValidator.validate(t);return e?e.map(h):void 0}function D(t){var e=X.Validators.pageValidator.validate(t);return e?e.map(h):void 0}function U(t){var e=X.Validators.filtersValidator.validate(t);return e?e.map(h):void 0}function B(t){var e=X.Validators.saveAsParametersValidator.validate(t);return e?e.map(h):void 0}function W(t){var e=X.Validators.loadQnaValidator.validate(t);return e?e.map(h):void 0}function H(t){var e=X.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(h):void 0}function z(t){var e=X.Validators.exportDataRequestValidator.validate(t);return e?e.map(h):void 0}function J(t){var e=X.Validators.visualHeaderValidator.validate(t);return e?e.map(h):void 0}function G(t){var e=X.Validators.visualSettingsValidator.validate(t);return e?e.map(h):void 0}function Q(t){var e=X.Validators.commandsSettingsValidator.validate(t);return e?e.map(h):void 0}function Y(t){var e=X.Validators.customThemeValidator.validate(t);return e?e.map(h):void 0}var K=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var $,X=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}($=e.TraceType||(e.TraceType={}));var Z;!function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(Z=e.PageSizeType||(e.PageSizeType={}));var tt;!function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(tt=e.DisplayOption||(e.DisplayOption={}));var et;!function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(et=e.BackgroundType||(e.BackgroundType={}));var rt;!function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(rt=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}));var at;!function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(at=e.LayoutType||(e.LayoutType={}));var it;!function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(it=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}));var ot;!function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(ot=e.SectionVisibility||(e.SectionVisibility={}));var nt;!function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(nt=e.Permissions||(e.Permissions={}));var lt;!function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(lt=e.ViewMode||(e.ViewMode={}));var dt;!function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(dt=e.TokenType||(e.TokenType={}));var st;!function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(st=e.ContrastMode||(e.ContrastMode={}));var ut;!function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(ut=e.MenuLocation||(e.MenuLocation={}));var pt;!function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(pt=e.FiltersLevel||(e.FiltersLevel={}));var ct;!function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(ct=e.FilterType||(e.FilterType={}));var ft;!function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(ft=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}));var vt;!function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(vt=e.RelativeDateOperators||(e.RelativeDateOperators={}));var ht=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=ht;var yt=function(t){function e(r,a,i){var o=t.call(this,r,ct.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(ht);e.NotSupportedFilter=yt;var Vt=function(t){function e(r,a,i){var o=t.call(this,r,ct.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(ht);e.IncludeExcludeFilter=Vt;var mt=function(t){function e(r,a,i,o){var n=t.call(this,r,ct.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(ht);e.TopNFilter=mt;var gt=function(t){function e(r,a,i,o,n){var l=t.call(this,r,ct.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(ht);e.RelativeDateFilter=gt;var wt=function(t){function e(r,a,i,o){var n=t.call(this,r,ct.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(ht);e.RelativeTimeFilter=wt;var bt=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,d=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return n.conditions=l,n}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(ht);e.AdvancedFilter=Et,e.isFilterKeyColumnsTarget=a,e.isBasicFilterWithKeys=i,e.getFilterType=o,e.isMeasure=n,e.isColumn=l,e.isHierarchyLevel=d,e.isHierarchyLevelAggr=s,e.isColumnAggr=u;var Tt;!function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(Tt=e.PageNavigationPosition||(e.PageNavigationPosition={}));var Ot;!function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(Ot=e.QnaMode||(e.QnaMode={}));var _t;!function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(_t=e.ExportDataType||(e.ExportDataType={}));var Ft;!function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(Ft=e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"};var Rt;!function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(Rt=e.SortDirection||(e.SortDirection={}));var kt=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=kt;var At=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(kt);e.PageSelector=At;var Ct=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(kt);e.VisualSelector=Ct;var xt=function(t){function e(e){var r=t.call(this,Ct.schemaUrl)||this;return r.visualType=e,r}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(kt);e.VisualTypeSelector=xt;var Mt=function(t){function e(e){var r=t.call(this,Ct.schemaUrl)||this;return r.target=e,r}return K(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(kt);e.SlicerTargetSelector=Mt;var qt;!function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(qt=e.CommandDisplayOption||(e.CommandDisplayOption={}));var It;!function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(It=e.VisualDataRoleKind||(e.VisualDataRoleKind={}));var Lt;!function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(Lt=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=p,e.isGroupedMenuExtension=c,e.isIExtensions=f,e.isIExtensionArray=v,e.validateVisualSelector=y,e.validateSlicer=V,e.validateSlicerState=m,e.validatePlayBookmarkRequest=g,e.validateAddBookmarkRequest=w,e.validateApplyBookmarkByNameRequest=b,e.validateApplyBookmarkStateRequest=P,e.validateCaptureBookmarkRequest=S,e.validateSettings=E,e.validatePanes=T,e.validateBookmarksPane=O,e.validateFiltersPane=_,e.validateFieldsPane=F,e.validatePageNavigationPane=R,e.validateSelectionPane=k,e.validateSyncSlicersPane=A,e.validateVisualizationsPane=C,e.validateCustomPageSize=x,e.validateExtension=M,e.validateMenuGroupExtension=q,e.validateReportLoad=I,e.validateCreateReport=L,e.validateDashboardLoad=j,e.validateTileLoad=N,e.validatePage=D,e.validateFilter=U,e.validateSaveAsParameters=B,e.validateLoadQnaConfiguration=W,e.validateQnaInterpretInputData=H,e.validateExportDataRequest=z,e.validateVisualHeader=J,e.validateVisualSettings=G,e.validateCommandsSettings=Q,e.validateCustomTheme=Y},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),d=r(9),s=r(10),u=r(11),p=r(12),c=r(13),f=r(14),v=r(15),h=r(16),y=r(17),V=r(18),m=r(19),g=r(20),w=r(21),b=r(22),P=r(23),S=r(24),E=r(25),T=r(26),O=r(27),_=r(28),F=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new F.EnumValidator([0]),advancedFilterValidator:new p.AdvancedFilterValidator,anyArrayValidator:new F.ArrayValidator([new E.AnyOfValidator([new F.StringValidator,new F.NumberValidator,new F.BooleanValidator])]),anyFilterValidator:new E.AnyOfValidator([new p.BasicFilterValidator,new p.AdvancedFilterValidator,new p.IncludeExcludeFilterValidator,new p.NotSupportedFilterValidator,new p.RelativeDateFilterValidator,new p.TopNFilterValidator,new p.RelativeTimeFilterValidator]),anyValueValidator:new E.AnyOfValidator([new F.StringValidator,new F.NumberValidator,new F.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new E.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new F.EnumValidator([0,1]),basicFilterTypeValidator:new F.EnumValidator([1]),basicFilterValidator:new p.BasicFilterValidator,booleanArrayValidator:new F.BooleanArrayValidator,booleanValidator:new F.BooleanValidator,bookmarksPaneValidator:new v.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new F.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new F.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new F.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new p.ConditionItemValidator,contrastModeValidator:new F.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new F.EnumValidator([0,1,2]),customLayoutValidator:new c.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new d.DatasetBindingValidator,displayStateModeValidator:new F.EnumValidator([0,1]),displayStateValidator:new c.DisplayStateValidator,exportDataRequestValidator:new s.ExportDataRequestValidator,extensionArrayValidator:new F.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new E.AnyOfValidator([new F.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new T.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new v.FieldsPaneValidator,filterColumnTargetValidator:new p.FilterColumnTargetValidator,filterConditionsValidator:new F.ArrayValidator([new p.ConditionItemValidator]),filterHierarchyTargetValidator:new p.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new p.FilterMeasureTargetValidator,filterTargetValidator:new E.AnyOfValidator([new p.FilterColumnTargetValidator,new p.FilterHierarchyTargetValidator,new p.FilterMeasureTargetValidator]),filtersArrayValidator:new F.ArrayValidator([new E.AnyOfValidator([new p.BasicFilterValidator,new p.AdvancedFilterValidator,new p.RelativeDateFilterValidator,new p.RelativeTimeFilterValidator])]),filtersValidator:new p.FilterValidator,filtersPaneValidator:new v.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new F.EnumValidator([0,1,2]),includeExcludeFilterValidator:new p.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new F.EnumValidator([3]),layoutTypeValidator:new F.EnumValidator([0,1,2,3]),loadQnaValidator:new h.LoadQnaValidator,menuExtensionValidator:new E.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new F.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new F.EnumValidator([0,1]),notSupportedFilterTypeValidator:new F.EnumValidator([2]),notSupportedFilterValidator:new p.NotSupportedFilterValidator,numberArrayValidator:new F.NumberArrayValidator,numberValidator:new F.NumberValidator,pageLayoutValidator:new _.MapValidator([new F.StringValidator],[new c.VisualLayoutValidator]),pageNavigationPaneValidator:new v.PageNavigationPaneValidator,pageNavigationPositionValidator:new F.EnumValidator([0,1]),pageSizeTypeValidator:new F.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new _.MapValidator([new F.StringValidator],[new c.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new v.ReportPanesValidator,permissionsValidator:new F.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new h.QnaInterpretInputDataValidator,qnaSettingValidator:new h.QnaSettingsValidator,relativeDateFilterOperatorValidator:new F.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new F.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new F.EnumValidator([4]),relativeDateFilterValidator:new p.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new F.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new F.EnumValidator([7]),relativeTimeFilterValidator:new p.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new V.ReportLoadValidator,saveAsParametersValidator:new m.SaveAsParametersValidator,selectionPaneValidator:new v.SelectionPaneValidator,settingsValidator:new w.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new b.SlicerStateValidator,slicerTargetValidator:new E.AnyOfValidator([new p.FilterColumnTargetValidator,new p.FilterHierarchyTargetValidator,new p.FilterMeasureTargetValidator,new p.FilterKeyColumnsTargetValidator,new p.FilterKeyHierarchyTargetValidator]),slicerValidator:new b.SlicerValidator,stringArrayValidator:new F.StringArrayValidator,stringValidator:new F.StringValidator,syncSlicersPaneValidator:new v.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new F.EnumValidator([0,1]),topNFilterTypeValidator:new F.EnumValidator([5]),topNFilterValidator:new p.TopNFilterValidator,viewModeValidator:new F.EnumValidator([0,1]),visualCommandSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new E.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new S.VisualHeaderSettingsValidator,visualHeaderValidator:new S.VisualHeaderValidator,visualHeadersValidator:new F.ArrayValidator([new S.VisualHeaderValidator]),visualizationsPaneValidator:new v.VisualizationsPaneValidator,visualLayoutValidator:new c.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new S.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function a(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(a.prototype=r.prototype,new a)}}();Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var i=r(3),o=r(4),n=r(1),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var o=t.prototype.validate.call(this,e,r,a);if(o)return o;var l=[{field:"actionBar",validators:[n.Validators.actionBarValidator]}],d=new i.MultipleFieldsValidator(l);return d.validate(e,r,a)},e}(o.ObjectValidator);e.ReportBarsValidator=l;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var o=t.prototype.validate.call(this,e,r,a);if(o)return o;var l=[{field:"visible",validators:[n.Validators.booleanValidator]}],d=new i.MultipleFieldsValidator(l);return d.validate(e,r,a)},e}(o.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i2&&"[]"===n.slice(l-2)&&(d=!0,n=n.slice(0,l-2),r[n]||(r[n]=[])),i=o[1]?w(o[1]):""),d?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(a=t.indexOf("?"),a!==-1){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for(t=decodeURI(t),"/"!==t.charAt(0)&&(t="/"+t),e=t.length,e>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===n.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return l.conditions=n,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(p);e.AdvancedFilter=w,e.isFilterKeyColumnsTarget=function(t){return i(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return a(t)===u.Basic&&!!t.keyValues},e.getFilterType=a,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=i,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var P=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=P;var _=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(P);e.PageSelector=_;var S=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(P);e.VisualSelector=S;var E=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.visualType=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(P);e.VisualTypeSelector=E;var O=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.target=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(P);e.SlicerTargetSelector=O,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!o(t)},e.isGroupedMenuExtension=o,e.isIExtensions=function(t){return t&&!n(t)},e.isIExtensionArray=n,e.validateVisualSelector=function(t){var e=c.Validators.visualSelectorValidator.validate(t);return e?e.map(l):void 0},e.validateSlicer=function(t){var e=c.Validators.slicerValidator.validate(t);return e?e.map(l):void 0},e.validateSlicerState=function(t){var e=c.Validators.slicerStateValidator.validate(t);return e?e.map(l):void 0},e.validatePlayBookmarkRequest=function(t){var e=c.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateAddBookmarkRequest=function(t){var e=c.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=c.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=c.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(l):void 0},e.validateCaptureBookmarkRequest=function(t){var e=c.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateSettings=function(t){var e=c.Validators.settingsValidator.validate(t);return e?e.map(l):void 0},e.validatePanes=function(t){var e=c.Validators.reportPanesValidator.validate(t);return e?e.map(l):void 0},e.validateBookmarksPane=function(t){var e=c.Validators.bookmarksPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFiltersPane=function(t){var e=c.Validators.filtersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFieldsPane=function(t){var e=c.Validators.fieldsPaneValidator.validate(t);return e?e.map(l):void 0},e.validatePageNavigationPane=function(t){var e=c.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSelectionPane=function(t){var e=c.Validators.selectionPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSyncSlicersPane=function(t){var e=c.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateVisualizationsPane=function(t){var e=c.Validators.visualizationsPaneValidator.validate(t);return e?e.map(l):void 0},e.validateCustomPageSize=function(t){var e=c.Validators.customPageSizeValidator.validate(t);return e?e.map(l):void 0},e.validateExtension=function(t){var e=c.Validators.extensionValidator.validate(t);return e?e.map(l):void 0},e.validateMenuGroupExtension=function(t){var e=c.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(l):void 0},e.validateReportLoad=function(t){var e=c.Validators.reportLoadValidator.validate(t);return e?e.map(l):void 0},e.validateCreateReport=function(t){var e=c.Validators.reportCreateValidator.validate(t);return e?e.map(l):void 0},e.validateDashboardLoad=function(t){var e=c.Validators.dashboardLoadValidator.validate(t);return e?e.map(l):void 0},e.validateTileLoad=function(t){var e=c.Validators.tileLoadValidator.validate(t);return e?e.map(l):void 0},e.validatePage=function(t){var e=c.Validators.pageValidator.validate(t);return e?e.map(l):void 0},e.validateFilter=function(t){var e=c.Validators.filtersValidator.validate(t);return e?e.map(l):void 0},e.validateSaveAsParameters=function(t){var e=c.Validators.saveAsParametersValidator.validate(t);return e?e.map(l):void 0},e.validateLoadQnaConfiguration=function(t){var e=c.Validators.loadQnaValidator.validate(t);return e?e.map(l):void 0},e.validateQnaInterpretInputData=function(t){var e=c.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(l):void 0},e.validateExportDataRequest=function(t){var e=c.Validators.exportDataRequestValidator.validate(t);return e?e.map(l):void 0},e.validateVisualHeader=function(t){var e=c.Validators.visualHeaderValidator.validate(t);return e?e.map(l):void 0},e.validateVisualSettings=function(t){var e=c.Validators.visualSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCommandsSettings=function(t){var e=c.Validators.commandsSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCustomTheme=function(t){var e=c.Validators.customThemeValidator.validate(t);return e?e.map(l):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,r){return i(this,void 0,void 0,function(){return o(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},r)];case 1:return[2,!a.sent().body];case 2:throw a.sent().body;case 3:return[2]}})})},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=a,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{ +value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))(function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a["throw"](t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,l)}s((a=a.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){function r(t){return function(r){return function(t){if(a)throw new TypeError("Generator is already executing.");for(;l;)try{if(a=1,i&&(o=2&t[0]?i["return"]:t[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,t[1])).done)return o;switch(i=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,i=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(o=l.trys,!((o=o.length>0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),i=o[1]?y(o[1]):""),s?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(-1!==(a=t.indexOf("?"))){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r; - apply(bookmarkName: string): Promise; - play(playMode: models.BookmarksPlayMode): Promise; + apply(bookmarkName: string): Promise>; + play(playMode: models.BookmarksPlayMode): Promise>; capture(options?: models.ICaptureBookmarkOptions): Promise; - applyState(state: string): Promise; + applyState(state: string): Promise>; } /** @@ -45,16 +46,17 @@ export class BookmarksManager implements IBookmarksManager { * * @returns {Promise} */ - getBookmarks(): Promise { + async getBookmarks(): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.service.hpm.get(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + try { + const response = await this.service.hpm.get(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -65,9 +67,9 @@ export class BookmarksManager implements IBookmarksManager { * ``` * * @param {string} bookmarkName The name of the bookmark to be applied - * @returns {Promise} + * @returns {Promise>} */ - apply(bookmarkName: string): Promise { + async apply(bookmarkName: string): Promise> { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } @@ -76,10 +78,11 @@ export class BookmarksManager implements IBookmarksManager { name: bookmarkName }; - return this.service.hpm.post(`/report/bookmarks/applyByName`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.post(`/report/bookmarks/applyByName`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -91,9 +94,9 @@ export class BookmarksManager implements IBookmarksManager { * ``` * * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` - * @returns {Promise} + * @returns {Promise>} */ - play(playMode: models.BookmarksPlayMode): Promise { + async play(playMode: models.BookmarksPlayMode): Promise> { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } @@ -102,10 +105,11 @@ export class BookmarksManager implements IBookmarksManager { playMode: playMode }; - return this.service.hpm.post(`/report/bookmarks/play`, playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.post(`/report/bookmarks/play`, playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -118,7 +122,7 @@ export class BookmarksManager implements IBookmarksManager { * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing * @returns {Promise} */ - capture(options?: models.ICaptureBookmarkOptions): Promise { + async capture(options?: models.ICaptureBookmarkOptions): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } @@ -127,11 +131,12 @@ export class BookmarksManager implements IBookmarksManager { options: options }; - return this.service.hpm.post(`/report/bookmarks/capture`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post(`/report/bookmarks/capture`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -142,9 +147,9 @@ export class BookmarksManager implements IBookmarksManager { * ``` * * @param {string} state A base64 bookmark state to be applied - * @returns {Promise} + * @returns {Promise>} */ - applyState(state: string): Promise { + async applyState(state: string): Promise> { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } @@ -153,9 +158,10 @@ export class BookmarksManager implements IBookmarksManager { state: state }; - return this.service.hpm.post(`/report/bookmarks/applyState`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.post(`/report/bookmarks/applyState`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } } diff --git a/src/config.ts b/src/config.ts index 71a5260f..676d2576 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,6 @@ /** @ignore *//** */ const config = { - version: '2.15.2', + version: '2.16.0', type: 'js' }; diff --git a/src/create.ts b/src/create.ts index 9140fdcf..60844b80 100644 --- a/src/create.ts +++ b/src/create.ts @@ -80,8 +80,8 @@ export class Create extends embed.Embed { * * @returns {Promise} */ - isSaved(): Promise { - return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); + async isSaved(): Promise { + return await utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); } /** diff --git a/src/embed.ts b/src/embed.ts index bea6d11a..69fe406e 100644 --- a/src/embed.ts +++ b/src/embed.ts @@ -11,6 +11,9 @@ declare global { // Ms Fullscreen msExitFullscreen: any; + + // Safari Fullscreen + webkitExitFullscreen: void; } interface HTMLIFrameElement { @@ -19,10 +22,12 @@ declare global { // Ms Fullscreen msRequestFullscreen: Function; + + // Safari Fullscreen + webkitRequestFullscreen: {(): void}; } } -//TODO: Require a specific version of powerbi-models in package.json export type IBootstrapEmbedConfiguration = models.IBootstrapEmbedConfiguration; export type IEmbedConfigurationBase = models.IEmbedConfigurationBase; @@ -224,19 +229,18 @@ export abstract class Embed { * @param {models.IReportCreateConfiguration} config * @returns {Promise} */ - createReport(config: models.IReportCreateConfiguration): Promise { + async createReport(config: models.IReportCreateConfiguration): Promise { const errors = models.validateCreateReport(config); if (errors) { throw errors; } - return this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow) - .then(response => { - return response.body; - }, - response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -244,14 +248,13 @@ export abstract class Embed { * * @returns {Promise} */ - save(): Promise { - return this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + async save(): Promise { + try { + const response = await this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -259,14 +262,13 @@ export abstract class Embed { * * @returns {Promise} */ - saveAs(saveAsParameters: models.ISaveAsParameters): Promise { - return this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + async saveAs(saveAsParameters: models.ISaveAsParameters): Promise { + try { + const response = await this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -282,12 +284,13 @@ export abstract class Embed { * * @returns {Promise} */ - getCorrelationId(): Promise { - return this.service.hpm.get(`/getCorrelationId`, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + async getCorrelationId(): Promise { + try { + const response = await this.service.hpm.get(`/getCorrelationId`, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -315,7 +318,7 @@ export abstract class Embed { * @param {boolean} phasedRender * @returns {Promise} */ - load(phasedRender?: boolean): Promise { + async load(phasedRender?: boolean): Promise { if (!this.config.accessToken) { console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); return; @@ -342,13 +345,12 @@ export abstract class Embed { this.lastLoadRequest = timeNow; - return this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow) - .then(response => { - return response.body; - }, - response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -424,8 +426,8 @@ export abstract class Embed { * report.reload(); * ``` */ - reload(): Promise { - return this.load(); + async reload(): Promise { + return await this.load(); } /** @@ -433,19 +435,19 @@ export abstract class Embed { * * @returns {Promise} */ - setAccessToken(accessToken: string): Promise { + async setAccessToken(accessToken: string): Promise { var embedType = this.config.type; embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; - return this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - this.config.accessToken = accessToken; - this.element.setAttribute(Embed.accessTokenAttribute, accessToken); - this.service.accessToken = accessToken; - return response.body; - }) - .catch(response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow); + + this.config.accessToken = accessToken; + this.element.setAttribute(Embed.accessTokenAttribute, accessToken); + this.service.accessToken = accessToken; + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -768,7 +770,7 @@ export abstract class Embed { * Sends the config for front load calls, after 'ready' message is received from the iframe * @hidden */ - private frontLoadSendConfig(config: IEmbedConfigurationBase): Promise { + private async frontLoadSendConfig(config: IEmbedConfigurationBase): Promise { if (!config.accessToken) { return; } @@ -782,11 +784,11 @@ export abstract class Embed { if (this.iframe.contentWindow == null) return; - return this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow).then(response => { + try { + const response = await this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow); return response.body; - }, - response => { - throw response.body; - }); + } catch (response) { + throw response.body; + } } } diff --git a/src/ifilterable.ts b/src/ifilterable.ts index caec70c1..42dff3a8 100644 --- a/src/ifilterable.ts +++ b/src/ifilterable.ts @@ -1,5 +1,5 @@ - import * as models from 'powerbi-models'; +import { IHttpPostMessageResponse } from 'http-post-message'; /** * Decorates embed components that support filters @@ -19,13 +19,13 @@ export interface IFilterable { * Replaces all filters on the current object with the specified filter values. * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise; + setFilters(filters: models.IFilter[]): Promise>; /** * Removes all filters from the current object. * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise; + removeFilters(): Promise>; } \ No newline at end of file diff --git a/src/page.ts b/src/page.ts index 6bee38e7..efc3daf6 100644 --- a/src/page.ts +++ b/src/page.ts @@ -1,3 +1,4 @@ +import { IHttpPostMessageResponse } from 'http-post-message'; import { IFilterable } from './ifilterable'; import { IReportNode } from './report'; import { VisualDescriptor } from './visualDescriptor'; @@ -103,12 +104,13 @@ export class Page implements IPageNode, IFilterable { * * @returns {(Promise)} */ - getFilters(): Promise { - return this.report.service.hpm.get(`/report/pages/${this.name}/filters`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + async getFilters(): Promise { + try { + const response = await this.report.service.hpm.get(`/report/pages/${this.name}/filters`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -121,14 +123,13 @@ export class Page implements IPageNode, IFilterable { * * @returns {Promise} */ - delete(): Promise { - return this.report.service.hpm.delete(`/report/pages/${this.name}`, { }, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(response => { + async delete(): Promise { + try { + const response = await this.report.service.hpm.delete(`/report/pages/${this.name}`, { }, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); return response.body; - }) - .catch(response => { + } catch (response) { throw response.body; - }); + } } /** @@ -138,10 +139,10 @@ export class Page implements IPageNode, IFilterable { * page.removeFilters(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise { - return this.setFilters([]); + async removeFilters(): Promise> { + return await this.setFilters([]); } /** @@ -151,19 +152,20 @@ export class Page implements IPageNode, IFilterable { * page.setActive(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - setActive(): Promise { + async setActive(): Promise> { const page: models.IPage = { name: this.name, displayName: null, isActive: true }; - return this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -175,13 +177,14 @@ export class Page implements IPageNode, IFilterable { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise { - return this.report.service.hpm.put(`/report/pages/${this.name}/filters`, filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + async setFilters(filters: models.IFilter[]): Promise> { + try { + return await this.report.service.hpm.put(`/report/pages/${this.name}/filters`, filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -191,18 +194,19 @@ export class Page implements IPageNode, IFilterable { * page.setName(displayName); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - setDisplayName(displayName: string): Promise { + async setDisplayName(displayName: string): Promise> { const page: models.IPage = { name: this.name, displayName, }; - return this.report.service.hpm.put(`/report/pages/${this.name}/name`, page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.report.service.hpm.put(`/report/pages/${this.name}/name`, page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -215,20 +219,20 @@ export class Page implements IPageNode, IFilterable { * * @returns {Promise} */ - getVisuals(): Promise { + async getVisuals(): Promise { if (utils.isRDLEmbed(this.report.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.report.service.hpm.get(`/report/pages/${this.name}/visuals`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(response => { - return response.body + try { + const response = await this.report.service.hpm.get(`/report/pages/${this.name}/visuals`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); + return response.body .map(visual => { return new VisualDescriptor(this, visual.name, visual.title, visual.type, visual.layout); }); - }, response => { + } catch (response) { throw response.body; - }); + } } /** @@ -241,16 +245,17 @@ export class Page implements IPageNode, IFilterable { * * @returns {(Promise)} */ - hasLayout(layoutType): Promise { + async hasLayout(layoutType): Promise { if (utils.isRDLEmbed(this.report.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } let layoutTypeEnum = models.LayoutType[layoutType]; - return this.report.service.hpm.get(`/report/pages/${this.name}/layoutTypes/${layoutTypeEnum}`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + try { + const response = await this.report.service.hpm.get(`/report/pages/${this.name}/layoutTypes/${layoutTypeEnum}`, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } } \ No newline at end of file diff --git a/src/qna.ts b/src/qna.ts index 060442de..0fdd09c2 100644 --- a/src/qna.ts +++ b/src/qna.ts @@ -1,6 +1,7 @@ import * as service from './service'; import * as models from 'powerbi-models'; import * as embed from './embed'; +import { IHttpPostMessageResponse } from 'http-post-message'; /** * The Power BI Q&A embed component @@ -38,18 +39,19 @@ export class Qna extends embed.Embed { /** * Change the question of the Q&A embed component * - * @param question - question which will render Q&A data - * @returns {string} + * @param {string} question - question which will render Q&A data + * @returns {Promise>} */ - setQuestion(question: string): Promise { + async setQuestion(question: string): Promise> { const qnaData: models.IQnaInterpretInputData = { question: question }; - return this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** diff --git a/src/report.ts b/src/report.ts index b919106d..1a3c1a03 100644 --- a/src/report.ts +++ b/src/report.ts @@ -7,6 +7,7 @@ import { IFilterable } from './ifilterable'; import { Page } from './page'; import { IReportLoadConfiguration, IReportEmbedConfiguration } from 'powerbi-models'; import { BookmarksManager } from './bookmarksManager'; +import { IHttpPostMessageResponse } from 'http-post-message'; /** * A Report node within a report hierarchy @@ -71,7 +72,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * @hidden * @static * @param {string} url - * @returns {string} + * @returns {string} */ static findIdFromEmbedUrl(url: string): string { const reportIdRegEx = /reportId="?([^&]+)"?/ @@ -101,14 +102,13 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - render(config?: IReportLoadConfiguration | embed.IReportEmbedConfiguration): Promise { - return this.service.hpm.post(`/report/render`, config, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + async render(config?: IReportLoadConfiguration | embed.IReportEmbedConfiguration): Promise { + try { + const response = await this.service.hpm.post(`/report/render`, config, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -121,18 +121,18 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - addPage(displayName?: string): Promise { + async addPage(displayName?: string): Promise { var request = { displayName: displayName }; - return this.service.hpm.post(`/report/addPage`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - var page = response.body; - return new Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - }, response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post(`/report/addPage`, request, { uid: this.config.uniqueId }, this.iframe.contentWindow); + var page = response.body; + return new Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); + } catch (response) { + throw response.body; + } } /** @@ -145,14 +145,13 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - deletePage(pageName: string): Promise { - return this.service.hpm.delete(`/report/pages/${pageName}`, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + async deletePage(pageName: string): Promise { + try { + const response = await this.service.hpm.delete(`/report/pages/${pageName}`, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -165,19 +164,18 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - renamePage(pageName: string, displayName: string): Promise { + async renamePage(pageName: string, displayName: string): Promise { const page: models.IPage = { name: pageName, displayName, }; - return this.service.hpm.put(`/report/pages/${pageName}/name`, page, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + try { + const response = await this.service.hpm.put(`/report/pages/${pageName}/name`, page, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -193,16 +191,17 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - getFilters(): Promise { + async getFilters(): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.service.hpm.get(`/report/filters`, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + try { + const response = await this.service.hpm.get(`/report/filters`, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -233,20 +232,20 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - getPages(): Promise { + async getPages(): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body - .map(page => { - return new Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - }); - }, response => { - throw response.body; - }); + try { + const response = await this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body + .map(page => { + return new Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); + }); + } catch (response) { + throw response.body; + } } /** @@ -271,18 +270,17 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { /** * Prints the active page of the report by invoking `window.print()` on the embed iframe component. */ - print(): Promise { + async print(): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -292,14 +290,14 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * report.removeFilters(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise { + async removeFilters(): Promise> { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.setFilters([]); + return await this.setFilters([]); } /** @@ -311,9 +309,9 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * ``` * * @param {string} pageName - * @returns {Promise} + * @returns {Promise>} */ - setPage(pageName: string): Promise { + async setPage(pageName: string): Promise> { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } @@ -324,10 +322,11 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { isActive: true }; - return this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -345,18 +344,18 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise { + async setFilters(filters: models.IFilter[]): Promise> { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - - return this.service.hpm.put(`/report/filters`, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.put(`/report/filters`, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -373,17 +372,18 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * ``` * * @param {models.ISettings} settings - * @returns {Promise} + * @returns {Promise>} */ - updateSettings(settings: models.ISettings): Promise { + async updateSettings(settings: models.ISettings): Promise> { if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -438,7 +438,7 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - switchMode(viewMode: models.ViewMode | string): Promise { + async switchMode(viewMode: models.ViewMode | string): Promise { let newMode: string; if (typeof viewMode === "string") { newMode = viewMode; @@ -448,13 +448,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { } let url = '/report/switchMode/' + newMode; - return this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + try { + const response = await this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -464,14 +463,13 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * report.refresh(); * ``` */ - refresh(): Promise { - return this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + async refresh(): Promise { + try { + const response = await this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -483,12 +481,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - isSaved(): Promise { + async isSaved(): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); + return await utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow); } /** @@ -498,12 +496,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * report.applyTheme(theme); * ``` */ - applyTheme(theme: models.IReportTheme): Promise { + async applyTheme(theme: models.IReportTheme): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.applyThemeInternal(theme); + return await this.applyThemeInternal(theme); } /** @@ -513,12 +511,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * report.resetTheme(); * ``` */ - resetTheme(): Promise { + async resetTheme(): Promise { if (utils.isRDLEmbed(this.config.embedUrl)) { return Promise.reject(errors.APINotSupportedForRDLError); } - return this.applyThemeInternal({}); + return await this.applyThemeInternal({}); } /** @@ -528,11 +526,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * report.resetPersistentFilters(); * ``` */ - resetPersistentFilters(): Promise { - return this.service.hpm.delete(`/report/userState`, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + async resetPersistentFilters(): Promise> { + try { + return await this.service.hpm.delete(`/report/userState`, null, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -542,11 +541,12 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * report.savePersistentFilters(); * ``` */ - savePersistentFilters(): Promise { - return this.service.hpm.post(`/report/userState`, null, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + async savePersistentFilters(): Promise> { + try { + return await this.service.hpm.post(`/report/userState`, null, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -559,25 +559,25 @@ export class Report extends embed.Embed implements IReportNode, IFilterable { * * @returns {Promise} */ - arePersistentFiltersApplied(): Promise { - return this.service.hpm.get(`/report/isUserStateApplied`, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + async arePersistentFiltersApplied(): Promise { + try { + const response = await this.service.hpm.get(`/report/isUserStateApplied`, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** * @hidden */ - private applyThemeInternal(theme: models.IReportTheme): Promise { - return this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - return response.body; - }) - .catch(response => { - throw response.body; - }); + private async applyThemeInternal(theme: models.IReportTheme): Promise { + try { + const response = await this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** diff --git a/src/util.ts b/src/util.ts index 5130e2d9..0b0de8ae 100644 --- a/src/util.ts +++ b/src/util.ts @@ -154,12 +154,13 @@ export function addParamToUrl(url: string, paramName: string, value: string): st * @param {Window} contentWindow * @returns {Promise} */ -export function isSavedInternal(hpm: HttpPostMessage, uid: string, contentWindow: Window): Promise { - return hpm.get('/report/hasUnsavedChanges', { uid }, contentWindow) - .then(response => !response.body, - response => { - throw response.body; - }); +export async function isSavedInternal(hpm: HttpPostMessage, uid: string, contentWindow: Window): Promise { + try { + const response = await hpm.get('/report/hasUnsavedChanges', { uid }, contentWindow); + return !response.body; + } catch (response) { + throw response.body; + } } /** diff --git a/src/visual.ts b/src/visual.ts index 801f0333..8bcc4e4d 100644 --- a/src/visual.ts +++ b/src/visual.ts @@ -1,11 +1,10 @@ import * as service from './service'; import * as embed from './embed'; import * as models from 'powerbi-models'; -import * as utils from './util'; -import * as errors from './errors'; import { Report } from './report' import { Page } from './page'; import { VisualDescriptor } from './visualDescriptor'; +import { IHttpPostMessageResponse } from 'http-post-message'; /** * The Power BI Visual embed component @@ -108,9 +107,9 @@ export class Visual extends Report { * Sets the active page of the report - not supported in visual embed. * * @param {string} pageName - * @returns {Promise} + * @returns {Promise>} */ - setPage(pageName: string): Promise { + setPage(pageName: string): Promise> { throw Visual.SetPageNotSupportedError; } @@ -124,30 +123,30 @@ export class Visual extends Report { * * @returns {Promise} */ - getVisualDescriptor(): Promise { + async getVisualDescriptor(): Promise { const config = this.config; - return this.service.hpm.get(`/report/pages/${config.pageName}/visuals`, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => { - // Find the embedded visual from visuals of this page - // TODO: Use the Array.find method when ES6 is available - const embeddedVisuals = response.body.filter(pageVisual => pageVisual.name === config.visualName); - - if (embeddedVisuals.length === 0) { - const visualNotFoundError: models.IError = { - message: "visualNotFound", - detailedMessage: "Visual not found" - }; - - throw visualNotFoundError; - } - - const embeddedVisual = embeddedVisuals[0]; - const currentPage = this.page(config.pageName); - return new VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); - }, response => { - throw response.body; - }); + try { + const response = await this.service.hpm.get(`/report/pages/${config.pageName}/visuals`, { uid: this.config.uniqueId }, this.iframe.contentWindow); + // Find the embedded visual from visuals of this page + // TODO: Use the Array.find method when ES6 is available + const embeddedVisuals = response.body.filter(pageVisual => pageVisual.name === config.visualName); + + if (embeddedVisuals.length === 0) { + const visualNotFoundError: models.IError = { + message: "visualNotFound", + detailedMessage: "Visual not found" + }; + + throw visualNotFoundError; + } + + const embeddedVisual = embeddedVisuals[0]; + const currentPage = this.page(config.pageName); + return new VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout); + } catch (response) { + throw response.body; + } } /** @@ -163,13 +162,14 @@ export class Visual extends Report { * * @returns {Promise} */ - getFilters(filtersLevel?: models.FiltersLevel): Promise { + async getFilters(filtersLevel?: models.FiltersLevel): Promise { const url: string = this.getFiltersLevelUrl(filtersLevel); - return this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + try { + const response = await this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -188,14 +188,15 @@ export class Visual extends Report { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[], filtersLevel?: models.FiltersLevel): Promise { + async setFilters(filters: models.IFilter[], filtersLevel?: models.FiltersLevel): Promise> { const url: string = this.getFiltersLevelUrl(filtersLevel); - return this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + try { + return await this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -206,10 +207,10 @@ export class Visual extends Report { * visual.removeFilters(filtersLevel); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(filtersLevel?: models.FiltersLevel): Promise { - return this.setFilters([], filtersLevel); + async removeFilters(filtersLevel?: models.FiltersLevel): Promise> { + return await this.setFilters([], filtersLevel); } /** diff --git a/src/visualDescriptor.ts b/src/visualDescriptor.ts index 0c7e84ed..764213ef 100644 --- a/src/visualDescriptor.ts +++ b/src/visualDescriptor.ts @@ -1,6 +1,7 @@ import * as models from 'powerbi-models'; import { IFilterable } from './ifilterable'; import { IPageNode } from './page'; +import { IHttpPostMessageResponse } from 'http-post-message'; /** * A Visual node within a report hierarchy @@ -80,12 +81,13 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * * @returns {(Promise)} */ - getFilters(): Promise { - return this.page.report.service.hpm.get(`/report/pages/${this.page.name}/visuals/${this.name}/filters`, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + async getFilters(): Promise { + try { + const response = await this.page.report.service.hpm.get(`/report/pages/${this.page.name}/visuals/${this.name}/filters`, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -95,10 +97,10 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * visual.removeFilters(); * ``` * - * @returns {Promise} + * @returns {Promise>} */ - removeFilters(): Promise { - return this.setFilters([]); + async removeFilters(): Promise> { + return await this.setFilters([]); } /** @@ -110,13 +112,14 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * ``` * * @param {(models.IFilter[])} filters - * @returns {Promise} + * @returns {Promise>} */ - setFilters(filters: models.IFilter[]): Promise { - return this.page.report.service.hpm.put(`/report/pages/${this.page.name}/visuals/${this.name}/filters`, filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + async setFilters(filters: models.IFilter[]): Promise> { + try { + return await this.page.report.service.hpm.put(`/report/pages/${this.page.name}/visuals/${this.name}/filters`, filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -131,17 +134,18 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * * @returns {(Promise)} */ - exportData(exportDataType?: models.ExportDataType, rows?: number): Promise { + async exportData(exportDataType?: models.ExportDataType, rows?: number): Promise { let exportDataRequestBody: models.IExportDataRequest = { rows: rows, exportDataType: exportDataType }; - return this.page.report.service.hpm.post(`/report/pages/${this.page.name}/visuals/${this.name}/exportData`, exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + try { + const response = await this.page.report.service.hpm.post(`/report/pages/${this.page.name}/visuals/${this.name}/exportData`, exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -153,11 +157,12 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * .then(() => { ... }); * ``` */ - setSlicerState(state: models.ISlicerState): Promise { - return this.page.report.service.hpm.put(`/report/pages/${this.page.name}/visuals/${this.name}/slicer`, state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + async setSlicerState(state: models.ISlicerState): Promise> { + try { + return await this.page.report.service.hpm.put(`/report/pages/${this.page.name}/visuals/${this.name}/slicer`, state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + } catch (response) { + throw response.body; + } } /** @@ -171,12 +176,13 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * * @returns {(Promise)} */ - getSlicerState(): Promise { - return this.page.report.service.hpm.get(`/report/pages/${this.page.name}/visuals/${this.name}/slicer`, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + async getSlicerState(): Promise { + try { + const response = await this.page.report.service.hpm.get(`/report/pages/${this.page.name}/visuals/${this.name}/slicer`, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -184,12 +190,13 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * * @returns {(Promise)} */ - clone(request: models.ICloneVisualRequest = {}): Promise { - return this.page.report.service.hpm.post(`/report/pages/${this.page.name}/visuals/${this.name}/clone`, request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .then(response => response.body, - response => { - throw response.body; - }); + async clone(request: models.ICloneVisualRequest = {}): Promise { + try { + const response = await this.page.report.service.hpm.post(`/report/pages/${this.page.name}/visuals/${this.name}/clone`, request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + return response.body; + } catch (response) { + throw response.body; + } } /** @@ -202,10 +209,11 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * .then(() => { ... }); * ``` */ - sortBy(request: models.ISortByVisualRequest): Promise { - return this.page.report.service.hpm.put(`/report/pages/${this.page.name}/visuals/${this.name}/sortBy`, request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow) - .catch(response => { - throw response.body; - }); + async sortBy(request: models.ISortByVisualRequest): Promise> { + try { + return await this.page.report.service.hpm.put(`/report/pages/${this.page.name}/visuals/${this.name}/sortBy`, request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + } catch (response) { + throw response.body; + } } } diff --git a/test/test.spec.ts b/test/test.spec.ts index 4a9e8fba..c1a14dd3 100644 --- a/test/test.spec.ts +++ b/test/test.spec.ts @@ -1118,7 +1118,7 @@ describe('embed', function () { var report = powerbi.get($container[0]); report.fullscreen(); - expect(document.webkitFullscreenElement === $iframe[0]); + expect(document["webkitFullscreenElement"] === $iframe[0]); }); }); @@ -1128,7 +1128,7 @@ describe('embed', function () { report.fullscreen(); report.exitFullscreen(); - expect(document.webkitFullscreenElement !== $iframe[0]); + expect(document["webkitFullscreenElement"] !== $iframe[0]); }); }); }); @@ -1596,6 +1596,7 @@ describe('Protocol', function () { // Assert expect(spyApp.getPages).toHaveBeenCalled(); const pages = response.body; + // @ts-ignore as testData is not of type IFilter expect(pages).toEqual(testData.expectedPages); // Cleanup spyApp.getPages.calls.reset(); @@ -1909,6 +1910,7 @@ describe('Protocol', function () { // Assert expect(spyApp.getFilters).toHaveBeenCalled(); expect(response.statusCode).toEqual(200); + // @ts-ignore as testData is not of type IFilter expect(response.body).toEqual(testData.filters); // Cleanup spyApp.getFilters.calls.reset(); @@ -2061,6 +2063,7 @@ describe('Protocol', function () { // Assert expect(spyApp.getFilters).toHaveBeenCalled(); expect(response.statusCode).toEqual(200); + // @ts-ignore as testData is not of type IFilter expect(response.body).toEqual(testData.filters); // Cleanup spyApp.getFilters.calls.reset(); @@ -2217,6 +2220,7 @@ describe('Protocol', function () { // Assert expect(spyApp.getFilters).toHaveBeenCalled(); expect(response.statusCode).toEqual(200); + // @ts-ignore as testData is not of type IFilter expect(response.body).toEqual(testData.filters); // Cleanup spyApp.getFilters.calls.reset(); @@ -3909,6 +3913,7 @@ describe('SDK-to-HPM', function () { .then(filters => { // Assert expect(spyHpm.get).toHaveBeenCalledWith(`/report/pages/${page1.name}/filters`, { uid: uniqueId }, iframe.contentWindow); + // @ts-ignore as testData is not of type IFilter expect(filters).toEqual(testData.expectedResponse.body); done(); }); @@ -4155,6 +4160,7 @@ describe('SDK-to-HPM', function () { .then(filters => { // Assert expect(spyHpm.get).toHaveBeenCalledWith(`/report/pages/${page1.name}/visuals/${visual1.name}/filters`, { uid: uniqueId }, iframe.contentWindow); + // @ts-ignore as testData is not of type IFilter expect(filters).toEqual(testData.expectedResponse.body); done(); }); @@ -4269,6 +4275,13 @@ describe('SDK-to-HPM', function () { } }; + const expectedHeaders = { + bootstrapped: undefined, + sdkVersion: sdkConfig.default.version, + uid: uniqueId, + sdkSessionId: sdkSessionId + }; + spyHpm.post.and.returnValue(Promise.resolve(testData.response)); report.applyTheme(testData.theme) .then(() => { @@ -4278,7 +4291,7 @@ describe('SDK-to-HPM', function () { report.reload(); // Assert - expect(spyHpm.post).toHaveBeenCalledWith('/report/load', jasmine.objectContaining(testData.theme), { uid: uniqueId, sdkSessionId: sdkSessionId }, iframe.contentWindow); + expect(spyHpm.post).toHaveBeenCalledWith('/report/load', jasmine.objectContaining(testData.theme), expectedHeaders, iframe.contentWindow); }); }); @@ -4288,6 +4301,13 @@ describe('SDK-to-HPM', function () { body: null }; + const expectedHeaders = { + bootstrapped: undefined, + sdkVersion: sdkConfig.default.version, + uid: uniqueId, + sdkSessionId: sdkSessionId + }; + spyHpm.post.and.returnValue(Promise.resolve(response)); report.resetTheme() .then(() => { @@ -4297,7 +4317,7 @@ describe('SDK-to-HPM', function () { report.reload(); // Assert - expect(spyHpm.post).toHaveBeenCalledWith('/report/load', jasmine.objectContaining({}), { uid: uniqueId, sdkSessionId: sdkSessionId }, iframe.contentWindow); + expect(spyHpm.post).toHaveBeenCalledWith('/report/load', jasmine.objectContaining({}), expectedHeaders, iframe.contentWindow); }); }); }); @@ -4763,6 +4783,7 @@ describe('SDK-to-MockApp', function () { .then(filters => { // Assert expect(spyApp.getFilters).toHaveBeenCalled(); + // @ts-ignore as testData is not of type IFilter expect(filters).toEqual(testData.filters); done(); }); @@ -4969,6 +4990,7 @@ describe('SDK-to-MockApp', function () { .then(filters => { // Assert expect(spyApp.getFilters).toHaveBeenCalled(); + // @ts-ignore as testData is not of type IFilter as testData is not of type IFilter expect(filters).toEqual(testData.filters); done(); }); diff --git a/tsconfig.json b/tsconfig.json index 50e055dc..b47a4de3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,11 +8,6 @@ }, "exclude": [ "node_modules", - "typings/main", - "typings/main.d.ts", - "typings/browser", - "typings/browser.d.ts", - "typings/index.d.ts", "demo", "dist", "docs", diff --git a/typings.json b/typings.json deleted file mode 100644 index 2229075a..00000000 --- a/typings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "powerbi-client", - "dependencies": {}, - "globalDependencies": { - "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", - "jasmine": "registry:dt/jasmine#2.2.0+20160505161446", - "jquery": "registry:dt/jquery#1.10.0+20160417213236", - "jsen": "registry:dt/jsen#0.0.0+20160328204314", - "karma-jasmine": "registry:dt/karma-jasmine#0.0.0+20160316155526" - } -} diff --git a/webpack.config.js b/webpack.config.js index ce1dd83e..257f38a7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,10 +12,10 @@ module.exports = { }, devtool: 'source-map', resolve: { - extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'] + extensions: ['.webpack.js', '.web.js', '.ts', '.js'] }, module: { - loaders: [ + rules: [ { test: /\.map$/, loader: 'ignore-loader' }, { test: /\.d.ts$/, loader: 'ignore-loader' }, { test: /\.ts$/, exclude: /\.d.ts$/, loader: 'ts-loader' }, diff --git a/webpack.test.config.js b/webpack.test.config.js index b7f4ee28..e0ebe539 100644 --- a/webpack.test.config.js +++ b/webpack.test.config.js @@ -1,4 +1,7 @@ +const webpack = require('webpack'); // To access built-in plugins + module.exports = { + mode: 'development', entry: './test/test.spec.ts', output: { path: __dirname + "/tmp", @@ -6,17 +9,21 @@ module.exports = { }, devtool: 'source-map', resolve: { - extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'] + extensions: ['.webpack.js', '.web.js', '.ts', '.js'] }, module: { - loaders: [ + rules: [ { test: /\.map$/, loader: 'ignore-loader' }, { test: /\.d.ts$/, loader: 'ignore-loader' }, { test: /\.ts$/, exclude: /\.d.ts$/, loader: 'ts-loader' }, { test: /\.json$/, loader: 'json-loader' } ] }, - ts: { - configFileName: "webpack.test.tsconfig.json" - } + plugins: [ + new webpack.LoaderOptionsPlugin({ + ts: { + configFileName: "webpack.test.tsconfig.json" + } + }) + ], } \ No newline at end of file diff --git a/webpack.test.tsconfig.json b/webpack.test.tsconfig.json index b8012b00..f934fe43 100644 --- a/webpack.test.tsconfig.json +++ b/webpack.test.tsconfig.json @@ -6,11 +6,6 @@ }, "exclude": [ "node_modules", - "typings/main", - "typings/main.d.ts", - "typings/browser", - "typings/browser.d.ts", - "typings/index.d.ts", "demo", "dist", "docs", From 9c18221d1661051ae793fbe9b87af55835f2ec68 Mon Sep 17 00:00:00 2001 From: Mayur Garhwal Date: Fri, 4 Dec 2020 10:36:01 +0000 Subject: [PATCH 12/23] Merged PR 131679: Remove typings install from pipeline restore task ## In this PR: - Remove typings install from pipeline restore task Related work items: #472167 --- .pipelines/restore.ps1 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.pipelines/restore.ps1 b/.pipelines/restore.ps1 index 6c5c5125..3aa88f61 100644 --- a/.pipelines/restore.ps1 +++ b/.pipelines/restore.ps1 @@ -15,17 +15,8 @@ Write-Host "start: try install latest npm version" & npm install npm@latest -g Write-Host "done: try install latest npm version" -Write-Host "start: install typings globaly" -& npm install typings -g -Write-Host "done: install typings globaly" - # Do not update $exitCode because we do not want to fail if install latest npm version fails. -Write-Host "start: typings install" -& typings install -Write-Host "done: typings install" -$exitCode += $LASTEXITCODE; - Write-Host "start: npm install" & npm install --no-audit --no-save Write-Host "done: npm install" From 6d81a1757baa06acebbb158a65b70e084d2bc70a Mon Sep 17 00:00:00 2001 From: Saleh Mahameed Date: Mon, 7 Dec 2020 10:04:10 +0000 Subject: [PATCH 13/23] Merged PR 131977: Capture bug fix Fixed error on capturing without options object. Related work items: #471445 --- src/bookmarksManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bookmarksManager.ts b/src/bookmarksManager.ts index 83c03cc3..cd2b2434 100644 --- a/src/bookmarksManager.ts +++ b/src/bookmarksManager.ts @@ -128,7 +128,7 @@ export class BookmarksManager implements IBookmarksManager { } var request: models.ICaptureBookmarkRequest = { - options: options + options: options || {} }; try { From 6f30306a4750582099e7975e25b484664c627f09 Mon Sep 17 00:00:00 2001 From: Mayur Garhwal Date: Mon, 7 Dec 2020 11:20:03 +0000 Subject: [PATCH 14/23] Merged PR 132031: Upgrade version to 2.16.1 version upgraded to 2.16.1 Related work items: #473909 --- dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 6 +++--- dist/powerbi.min.js | 6 +++--- package.json | 2 +- src/config.ts | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 8a49ada6..327eb7be 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.1 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index 52083736..a3c7ed40 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.1 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -5795,7 +5795,7 @@ var BookmarksManager = /** @class */ (function () { return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; } request = { - options: options + options: options || {} }; _a.label = 1; case 1: @@ -5864,7 +5864,7 @@ exports.BookmarksManager = BookmarksManager; Object.defineProperty(exports, "__esModule", { value: true }); /** @ignore */ /** */ var config = { - version: '2.16.0', + version: '2.16.1', type: 'js' }; exports.default = config; diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index f1220a9f..07ef0854 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,10 +1,10 @@ -/*! powerbi-client v2.16.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.1 | (c) 2016 Microsoft Corporation MIT */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=12)}([function(t,e,r){/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ var a;window,a=function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?u.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?u.Advanced:u.Unknown}function i(t){return!(!t.table||!t.column||t.aggregationFunction)}function o(t){return t&&!!t.groupName}function n(t){return Array.isArray(t)}function l(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}var s,d=this&&this.__extends||(s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var u,c=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(u=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var p=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=p;var f=function(t){function e(r,a,i){var o=t.call(this,r,u.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(p);e.NotSupportedFilter=f;var h=function(t){function e(r,a,i){var o=t.call(this,r,u.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(p);e.IncludeExcludeFilter=h;var v=function(t){function e(r,a,i,o){var n=t.call(this,r,u.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(p);e.TopNFilter=v;var y=function(t){function e(r,a,i,o,n){var l=t.call(this,r,u.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(p);e.RelativeDateFilter=y;var m=function(t){function e(r,a,i,o){var n=t.call(this,r,u.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(p);e.RelativeTimeFilter=m;var V=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===n.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return l.conditions=n,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(p);e.AdvancedFilter=w,e.isFilterKeyColumnsTarget=function(t){return i(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return a(t)===u.Basic&&!!t.keyValues},e.getFilterType=a,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=i,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var P=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=P;var _=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(P);e.PageSelector=_;var S=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(P);e.VisualSelector=S;var E=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.visualType=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(P);e.VisualTypeSelector=E;var O=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.target=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(P);e.SlicerTargetSelector=O,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!o(t)},e.isGroupedMenuExtension=o,e.isIExtensions=function(t){return t&&!n(t)},e.isIExtensionArray=n,e.validateVisualSelector=function(t){var e=c.Validators.visualSelectorValidator.validate(t);return e?e.map(l):void 0},e.validateSlicer=function(t){var e=c.Validators.slicerValidator.validate(t);return e?e.map(l):void 0},e.validateSlicerState=function(t){var e=c.Validators.slicerStateValidator.validate(t);return e?e.map(l):void 0},e.validatePlayBookmarkRequest=function(t){var e=c.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateAddBookmarkRequest=function(t){var e=c.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=c.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=c.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(l):void 0},e.validateCaptureBookmarkRequest=function(t){var e=c.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateSettings=function(t){var e=c.Validators.settingsValidator.validate(t);return e?e.map(l):void 0},e.validatePanes=function(t){var e=c.Validators.reportPanesValidator.validate(t);return e?e.map(l):void 0},e.validateBookmarksPane=function(t){var e=c.Validators.bookmarksPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFiltersPane=function(t){var e=c.Validators.filtersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFieldsPane=function(t){var e=c.Validators.fieldsPaneValidator.validate(t);return e?e.map(l):void 0},e.validatePageNavigationPane=function(t){var e=c.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSelectionPane=function(t){var e=c.Validators.selectionPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSyncSlicersPane=function(t){var e=c.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateVisualizationsPane=function(t){var e=c.Validators.visualizationsPaneValidator.validate(t);return e?e.map(l):void 0},e.validateCustomPageSize=function(t){var e=c.Validators.customPageSizeValidator.validate(t);return e?e.map(l):void 0},e.validateExtension=function(t){var e=c.Validators.extensionValidator.validate(t);return e?e.map(l):void 0},e.validateMenuGroupExtension=function(t){var e=c.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(l):void 0},e.validateReportLoad=function(t){var e=c.Validators.reportLoadValidator.validate(t);return e?e.map(l):void 0},e.validateCreateReport=function(t){var e=c.Validators.reportCreateValidator.validate(t);return e?e.map(l):void 0},e.validateDashboardLoad=function(t){var e=c.Validators.dashboardLoadValidator.validate(t);return e?e.map(l):void 0},e.validateTileLoad=function(t){var e=c.Validators.tileLoadValidator.validate(t);return e?e.map(l):void 0},e.validatePage=function(t){var e=c.Validators.pageValidator.validate(t);return e?e.map(l):void 0},e.validateFilter=function(t){var e=c.Validators.filtersValidator.validate(t);return e?e.map(l):void 0},e.validateSaveAsParameters=function(t){var e=c.Validators.saveAsParametersValidator.validate(t);return e?e.map(l):void 0},e.validateLoadQnaConfiguration=function(t){var e=c.Validators.loadQnaValidator.validate(t);return e?e.map(l):void 0},e.validateQnaInterpretInputData=function(t){var e=c.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(l):void 0},e.validateExportDataRequest=function(t){var e=c.Validators.exportDataRequestValidator.validate(t);return e?e.map(l):void 0},e.validateVisualHeader=function(t){var e=c.Validators.visualHeaderValidator.validate(t);return e?e.map(l):void 0},e.validateVisualSettings=function(t){var e=c.Validators.visualSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCommandsSettings=function(t){var e=c.Validators.commandsSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCustomTheme=function(t){var e=c.Validators.customThemeValidator.validate(t);return e?e.map(l):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,r){return i(this,void 0,void 0,function(){return o(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},r)];case 1:return[2,!a.sent().body];case 2:throw a.sent().body;case 3:return[2]}})})},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=a,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{ -value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))(function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a["throw"](t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,l)}s((a=a.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){function r(t){return function(r){return function(t){if(a)throw new TypeError("Generator is already executing.");for(;l;)try{if(a=1,i&&(o=2&t[0]?i["return"]:t[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,t[1])).done)return o;switch(i=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,i=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(o=l.trys,!((o=o.length>0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),i=o[1]?y(o[1]):""),s?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(-1!==(a=t.indexOf("?"))){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r Date: Wed, 9 Dec 2020 10:37:47 +0000 Subject: [PATCH 15/23] Merged PR 130579: Update playground code snippets in Playground v1 to migrate from then-catch to async-await **Items completed in this PR** 1. Then-catch has been migrated to async-await for code_samples file from v2-demo folder for Playground v1 _All the functions of this file are tested after the async-await change_ Related work items: #469707, #470909, #471453, #473946 --- demo/v2-demo/scripts/codesamples.js | 1813 ++++++++++++--------------- 1 file changed, 835 insertions(+), 978 deletions(-) diff --git a/demo/v2-demo/scripts/codesamples.js b/demo/v2-demo/scripts/codesamples.js index c7cd743d..1838366e 100644 --- a/demo/v2-demo/scripts/codesamples.js +++ b/demo/v2-demo/scripts/codesamples.js @@ -37,14 +37,14 @@ function _Embed_BasicEmbed() { id: txtEmbedReportId, permissions: permissions, settings: { - panes: { - filters: { - visible: true - }, - pageNavigation: { - visible: true + panes: { + filters: { + visible: true + }, + pageNavigation: { + visible: true + } } - } } }; @@ -117,12 +117,12 @@ function _Embed_BasicEmbed_Mobile() { permissions: permissions, pageName: "ReportSectioneb8c865100f8508cc533", settings: { - panes: { - filters: { - visible: false - } - }, - layoutType: models.LayoutType.MobilePortrait + panes: { + filters: { + visible: false + } + }, + layoutType: models.LayoutType.MobilePortrait } }; @@ -181,19 +181,19 @@ function _Embed_PaginatedReportBasicEmbed() { var models = window['powerbi-client'].models; // Se view permissions. - var permissions = models.Permissions.View; + var permissions = models.Permissions.View; // Embed configuration used to describe the what and how to embed. // This object is used when calling powerbi.embed. // This also includes settings and options such as filters. // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details. var config = { - type: 'report', - tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, - accessToken: txtAccessToken, - embedUrl: txtEmbedUrl, - id: txtEmbedReportId, - permissions: permissions, + type: 'report', + tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed, + accessToken: txtAccessToken, + embedUrl: txtEmbedUrl, + id: txtEmbedReportId, + permissions: permissions, }; // Get a reference to the paginated embedded report HTML element @@ -412,12 +412,12 @@ function _Mock_Embed_BasicEmbed(isEdit) { viewMode: viewMode, settings: { panes: { - filters: { - visible: true - }, - pageNavigation: { - visible: true - } + filters: { + visible: true + }, + pageNavigation: { + visible: true + } }, useCustomSaveAsDialog: true } @@ -502,12 +502,12 @@ function _Embed_BasicEmbed_EditMode() { viewMode: models.ViewMode.Edit, settings: { panes: { - filters: { - visible: true - }, - pageNavigation: { - visible: true - } + filters: { + visible: true + }, + pageNavigation: { + visible: true + } } } }; @@ -582,12 +582,12 @@ function _Embed_EmbedWithDefaultFilter() { id: txtEmbedReportId, settings: { panes: { - filters: { - visible: false - }, - pageNavigation: { - visible: false - } + filters: { + visible: false + }, + pageNavigation: { + visible: false + } } }, filters: [filter] @@ -866,16 +866,16 @@ function _Report_GetId() { Log.logText("Report id: \"" + reportId + "\""); } -function _Report_UpdateSettings() { +async function _Report_UpdateSettings() { // The new settings that you want to apply to the report. const newSettings = { panes: { - filters: { - visible: false - }, - pageNavigation: { - visible: true - } + filters: { + visible: false + }, + pageNavigation: { + visible: true + } } }; @@ -886,16 +886,16 @@ function _Report_UpdateSettings() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .then(function () { - Log.logText("Filter pane was removed."); - }) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(newSettings); + Log.logText("Filter pane was removed."); + } + catch (error) { + Log.log(error); + } } -function _Report_GetPages() { +async function _Report_GetPages() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -904,20 +904,20 @@ function _Report_GetPages() { // Retrieve the page collection and loop through to collect the // page name and display name of each page and display the value. - report.getPages() - .then(function (pages) { - var log = "Report pages:"; - pages.forEach(function (page) { - log += "\n" + page.name + " - " + page.displayName; - }); - Log.logText(log); - }) - .catch(function (error) { - Log.log(error); + try { + const pages = await report.getPages(); + var log = "Report pages:"; + pages.forEach(function (page) { + log += "\n" + page.name + " - " + page.displayName; }); + Log.logText(log); + } + catch (error) { + Log.log(error); + } } -function _Report_SetPage() { +async function _Report_SetPage() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -926,16 +926,16 @@ function _Report_SetPage() { // setPage will change the selected view to the page you indicate. // This is the actual page name not the display name. - report.setPage("ReportSectiona271643cba2213c935be") - .then(function () { - Log.logText("Page was set to: ReportSectiona271643cba2213c935be"); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.setPage("ReportSectiona271643cba2213c935be"); + Log.logText("Page was set to: ReportSectiona271643cba2213c935be"); + } + catch (errors) { + Log.log(errors); + } } -function _Report_GetFilters() { +async function _Report_GetFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -943,16 +943,16 @@ function _Report_GetFilters() { report = powerbi.get(embedContainer); // Get the filters applied to the report. - report.getFilters() - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const filters = await report.getFilters(); + Log.log(filters); + } + catch (errors) { + Log.log(errors); + } } -function _Report_SetFilters() { +async function _Report_SetFilters() { // Build the filter you want to use. For more information, See Constructing // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. const filter = { @@ -973,16 +973,16 @@ function _Report_SetFilters() { // Set the filter for the report. // Pay attention that setFilters receives an array. - report.setFilters([filter]) - .then(function () { - Log.logText("Report filter was set."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.setFilters([filter]); + Log.logText("Report filter was set."); + } + catch (errors) { + Log.log(errors); + } } -function _Report_RemoveFilters() { +async function _Report_RemoveFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -990,16 +990,16 @@ function _Report_RemoveFilters() { report = powerbi.get(embedContainer); // Remove the filters currently applied to the report. - report.removeFilters() - .then(function () { - Log.logText("Report filters were removed."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.removeFilters(); + Log.logText("Report filters were removed."); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Report_SetFilters() { +async function _ReportVisual_Report_SetFilters() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1023,16 +1023,16 @@ function _ReportVisual_Report_SetFilters() { // Set the filter for the report. // Pay attention that setFilters receives an array. - visual.setFilters([filter], models.FiltersLevel.Report) - .then(function () { - Log.logText("Report filter was set."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await visual.setFilters([filter], models.FiltersLevel.Report); + Log.logText("Report filter was set."); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Report_GetFilters() { +async function _ReportVisual_Report_GetFilters() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1043,16 +1043,16 @@ function _ReportVisual_Report_GetFilters() { visual = powerbi.get(embedContainer); // Get the filters applied to the report. - visual.getFilters(models.FiltersLevel.Report) - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const filters = await visual.getFilters(models.FiltersLevel.Report); + Log.log(filters); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Report_RemoveFilters() { +async function _ReportVisual_Report_RemoveFilters() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1063,16 +1063,16 @@ function _ReportVisual_Report_RemoveFilters() { report = powerbi.get(embedContainer); // Remove the filters currently applied to the report. - report.removeFilters(models.FiltersLevel.Report) - .then(function () { - Log.logText("Report filters were removed."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.removeFilters(models.FiltersLevel.Report); + Log.logText("Report filters were removed."); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Page_SetFilters() { +async function _ReportVisual_Page_SetFilters() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1096,16 +1096,16 @@ function _ReportVisual_Page_SetFilters() { // Set the filter for the report. // Pay attention that setFilters receives an array. - visual.setFilters([filter], models.FiltersLevel.Page) - .then(function () { - Log.logText("Page filter was set."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await visual.setFilters([filter], models.FiltersLevel.Page); + Log.logText("Page filter was set."); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Page_GetFilters() { +async function _ReportVisual_Page_GetFilters() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1116,16 +1116,16 @@ function _ReportVisual_Page_GetFilters() { visual = powerbi.get(embedContainer); // Get the filters applied to the report. - visual.getFilters(models.FiltersLevel.Page) - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const filters = await visual.getFilters(models.FiltersLevel.Page); + Log.log(filters); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Page_RemoveFilters() { +async function _ReportVisual_Page_RemoveFilters() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1136,16 +1136,16 @@ function _ReportVisual_Page_RemoveFilters() { report = powerbi.get(embedContainer); // Remove the filters currently applied to the report. - report.removeFilters(models.FiltersLevel.Page) - .then(function () { - Log.logText("Page filters were removed."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.removeFilters(models.FiltersLevel.Page); + Log.logText("Page filters were removed."); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Visual_SetFilters() { +async function _ReportVisual_Visual_SetFilters() { // Build the filter you want to use. For more information, See Constructing // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. const filter = { @@ -1166,16 +1166,16 @@ function _ReportVisual_Visual_SetFilters() { // Set the filter for the report. // Pay attention that setFilters receives an array. - visual.setFilters([filter]) - .then(function () { - Log.logText("Report filter was set."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await visual.setFilters([filter]); + Log.logText("Report filter was set."); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Visual_GetFilters() { +async function _ReportVisual_Visual_GetFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1183,16 +1183,16 @@ function _ReportVisual_Visual_GetFilters() { visual = powerbi.get(embedContainer); // Get the filters applied to the report. - visual.getFilters() - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const filters = await visual.getFilters(); + Log.log(filters); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_Visual_RemoveFilters() { +async function _ReportVisual_Visual_RemoveFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1200,16 +1200,16 @@ function _ReportVisual_Visual_RemoveFilters() { report = powerbi.get(embedContainer); // Remove the filters currently applied to the report. - report.removeFilters() - .then(function () { - Log.logText("Report filters were removed."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.removeFilters(); + Log.logText("Report filters were removed."); + } + catch (errors) { + Log.log(errors); + } } -function _Report_PrintCurrentReport() { +async function _Report_PrintCurrentReport() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1217,13 +1217,15 @@ function _Report_PrintCurrentReport() { report = powerbi.get(embedContainer); // Trigger the print dialog for your browser. - report.print() - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.print(); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Reload() { +async function _Report_Reload() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1231,13 +1233,13 @@ function _Report_Reload() { report = powerbi.get(embedContainer); // Reload the displayed report - report.reload() - .then(function (result) { - Log.logText("Reloaded"); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.reload(); + Log.logText("Reloaded"); + } + catch (errors) { + Log.log(errors); + } } function _PaginatedReport_Reload() { @@ -1249,11 +1251,11 @@ function _PaginatedReport_Reload() { // Reload the displayed paginated report paginatedReport.reload(); - + Log.logText("Reload Paginated Report"); } -function _Report_Refresh() { +async function _Report_Refresh() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1261,16 +1263,16 @@ function _Report_Refresh() { report = powerbi.get(embedContainer); // Refresh the displayed report - report.refresh() - .then(function (result) { - Log.logText("Refreshed"); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.refresh(); + Log.logText("Refreshed"); + } + catch (errors) { + Log.log(errors); + } } -function _Report_ApplyCustomLayout() { +async function _Report_ApplyCustomLayout() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1324,12 +1326,12 @@ function _Report_ApplyCustomLayout() { } }, panes: { - filters: { - visible: false - }, - pageNavigation: { - visible: false - } + filters: { + visible: false + }, + pageNavigation: { + visible: false + } } } @@ -1337,16 +1339,16 @@ function _Report_ApplyCustomLayout() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(settings) - .then(function () { - Log.logText("Custom layout applied, to remove custom layout, reload the report using 'Reload' API.") - }) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(settings); + Log.logText("Custom layout applied, to remove custom layout, reload the report using 'Reload' API."); + } + catch (error) { + Log.log(error); + } } -function _Report_HideAllVisualHeaders() { +async function _Report_HideAllVisualHeaders() { // New settings to hide all the visual headers in the report const newSettings = { @@ -1369,17 +1371,16 @@ function _Report_HideAllVisualHeaders() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .then(function () { - Log.logText("Visual header was successfully hidden for all the visuals in the report."); - }) - .catch(function (error) { - Log.log(error); - }); - + try { + await report.updateSettings(newSettings); + Log.logText("Visual header was successfully hidden for all the visuals in the report."); + } + catch (error) { + Log.log(error); + } } -function _Report_ShowAllVisualHeaders() { +async function _Report_ShowAllVisualHeaders() { // New settings to show all the visual headers in the report const newSettings = { visualSettings: { @@ -1401,17 +1402,16 @@ function _Report_ShowAllVisualHeaders() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .then(function () { - Log.logText("Visual header was successfully shown for all the visuals in the report."); - }) - .catch(function (error) { - Log.log(error); - }); - + try { + await report.updateSettings(newSettings); + Log.logText("Visual header was successfully shown for all the visuals in the report."); + } + catch (error) { + Log.log(error); + } } -function _Report_HideSingleVisualHeader() { +async function _Report_HideSingleVisualHeader() { // Define settings to hide the header of a single visual var newSettings = { @@ -1445,13 +1445,13 @@ function _Report_HideSingleVisualHeader() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .then(function () { - Log.logText("Visual header was successfully hidden for 'Category Breakdown' visual."); - }) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(newSettings); + Log.logText("Visual header was successfully hidden for 'Category Breakdown' visual."); + } + catch (error) { + Log.log(error); + } } function _Report_FullScreen() { @@ -1565,7 +1565,7 @@ function _Report_saveAs() { report.saveAs(saveAsParameters); } -function _Report_Extensions_OptionsMenu() { +async function _Report_Extensions_OptionsMenu() { const base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAu9JREFUeJzt3U9OE2Ech/FnSiKsXbh340pg5Qk8gofAY3gGtBqWXsKNIR5BF0ZkQ9h6A2pC62LAEP5ITdv3R+f7fJJ3QUh4ZzpPmaaZmReGZxf4ABwDE2C24Jhc/K33wE7D/dB/2gIOgCmLH/S7xhQYA5uN9klz2gK+sLoDf30cXsypB+KAdgf/coyb7Jnutctq/+3/63Sw3WD/VmpUvQFL8BroCubtgL2CeXXNMe3f/ZfjqMH+rVTFO2fZJsCjwrnX+sPgEAKYFc+/1q/hED4DaAEGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCDcbQEs+3n7qx7Vqvf/vjH3egctnrfvqB13rnfQ+nn7jtrxd72DDXpj4BVK8RR4DHzq6M/5X1nzZ97qv82A3Q3gDfCidltUoAOmHf0nxGfFG6MaPztqn7evWpOO/lygUH4TGM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQbAb+rN0JlJiPgtHorVOZkRH+NuDIddvS3C33Dy8LTTLm4LPwX8AQvDU/zDvh4+cMm/amg+pYlR5vxmVuuBN+iv0XMm0OHO86Bfa4c/NvO+9vAHvCS/h6yG3eSaq1MgBP6//AHwPervxzCB79Z8fxr/Rr6TWA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQbggBVK53MCmceymGEMBp4dwnhXMvxRACqFzvwLUWHoAdah5wfQ48b7B/msOY9gHsN9kzzaX1ege3Pm9ftVqsd3Djeft6eLbpl0M5As5Y/KCfAT+AtwzwnP8HNwiKJyPkCoYAAAAASUVORK5CYII="; // The new settings that you want to apply to the report. @@ -1596,10 +1596,12 @@ function _Report_Extensions_OptionsMenu() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(newSettings); + } + catch (error) { + Log.log(error); + } // Report.on will add an event handler to commandTriggered event which prints to console window. report.on("commandTriggered", function (event) { @@ -1614,7 +1616,7 @@ function _Report_Extensions_OptionsMenu() { Log.logText("Open visual options menu by clicking the three dots icon and click on added items to see events in Log window."); } -function _Report_Extensions_ContextMenu() { +async function _Report_Extensions_ContextMenu() { // The new settings that you want to apply to the report. const newSettings = { extensions: [ @@ -1642,10 +1644,12 @@ function _Report_Extensions_ContextMenu() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(newSettings); + } + catch (error) { + Log.log(error); + } // Report.on will add an event handler to commandTriggered event which prints to console window. report.on("commandTriggered", function (event) { @@ -1660,7 +1664,7 @@ function _Report_Extensions_ContextMenu() { Log.logText("Open visual context menu by right click on data points and click on added items to see events in Log window."); } -function _Visual_Operations_SortVisualBy() { +async function _Visual_Operations_SortVisualBy() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1681,65 +1685,51 @@ function _Visual_Operations_SortVisualBy() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name === "VisualContainer6"; - })[0]; - - // Sort the visual's data by direction and data field. - visual.sortBy(sortByRequest) - .then(function () { - Log.logText("\"Total Category Volume Over Time by Region\" visual was sorted according to the request.") - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var visual = visuals.filter(function (visual) { + return visual.name === "VisualContainer6"; + })[0]; + + // Sort the visual's data by direction and data field. + await visual.sortBy(sortByRequest); + Log.logText("\"Total Category Volume Over Time by Region\" visual was sorted according to the request.") + } + catch (errors) { + Log.log(errors); + } } // ---- Page Operations ---------------------------------------------------- -function _Page_SetActive() { +async function _Page_SetActive() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; // Get a reference to the embedded report. report = powerbi.get(embedContainer); - // Retrieve the page collection, and then set the second page to be active. - report.getPages() - .then(function (pages) { - pages[3].setActive() - .then(function () { - Log.logText("Active page was set to: \"" + pages[3].displayName + "\""); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + // Retrieve active page. + try { + const pages = await report.getPages(); + await pages[3].setActive(); + Log.logText("Active page was set to: \"" + pages[3].displayName + "\""); + } + catch (errors) { + Log.log(errors); + } } -function _Page_GetFilters() { +async function _Page_GetFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1747,27 +1737,22 @@ function _Page_GetFilters() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the filters for the first page. - report.getPages() - .then(function (pages) { - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getFilters() - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const filters = await activePage.getFilters(); + Log.log(filters); + } + catch (errors) { + Log.log(errors); + } } -function _Page_GetVisuals() { +async function _Page_GetVisuals() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1775,35 +1760,30 @@ function _Page_GetVisuals() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - Log.log( - visuals.map(function (visual) { - return { - name: visual.name, - type: visual.type, - title: visual.title, - layout: visual.layout - }; - })); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + Log.log( + visuals.map(function (visual) { + return { + name: visual.name, + type: visual.type, + title: visual.title, + layout: visual.layout + }; + })); + } + catch (errors) { + Log.log(errors); + } } -function _Page_SetFilters() { +async function _Page_SetFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1824,27 +1804,23 @@ function _Page_SetFilters() { // Retrieve the page collection and then set the filters for the first page. // Pay attention that setFilters receives an array. - report.getPages() - .then(function (pages) { - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.setFilters([filter]) - .then(function () { - Log.logText("Page filter was set."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + await activePage.setFilters([filter]); + Log.logText("Page filter was set."); + + } + catch (errors) { + Log.log(errors); + } } -function _Page_RemoveFilters() { +async function _Page_RemoveFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -1852,27 +1828,22 @@ function _Page_RemoveFilters() { report = powerbi.get(embedContainer); // Retrieve the page collection and remove the filters for the first page. - report.getPages() - .then(function (pages) { - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.removeFilters() - .then(function () { - Log.logText("Page filters were removed."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + await activePage.removeFilters(); + Log.logText("Page filters were removed."); + } + catch (errors) { + Log.log(errors); + } } -function _Page_HasLayout() { +async function _Page_HasLayout() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -1883,12 +1854,16 @@ function _Page_HasLayout() { report = powerbi.get(embedContainer); // Retrieve the page collection and check if the first page has a MobilePortrait layout. - report.getPages().then(function (pages) { - pages[0].hasLayout(models.LayoutType.MobilePortrait).then(function (hasLayout) { - hasLayout = hasLayout ? "has" : "doesn't have"; - Log.logText("Page \"" + pages[0].name + "\" " + hasLayout + " mobile portrait layout."); - }) - }); + try { + const pages = await report.getPages(); + const hasLayout = await pages[0].hasLayout(models.LayoutType.MobilePortrait); + + var hasLayoutText = hasLayout ? "has" : "doesn't have"; + Log.logText("Page \"" + pages[0].name + "\" " + hasLayoutText + " mobile portrait layout."); + } + catch (errors) { + Log.log(errors); + } } // ---- Event Listener ---------------------------------------------------- @@ -2153,20 +2128,20 @@ function _DashboardEvents_TileClicked() { // ---- Qna Events Listener ---------------------------------------------------- -function _Qna_SetQuestion() { +async function _Qna_SetQuestion() { // Get a reference to the embedded Q&A HTML element var qnaContainer = $('#qnaContainer')[0]; // Get a reference to the embedded Q&A. qna = powerbi.get(qnaContainer); - qna.setQuestion("2014 total units YTD by manufacturer, region as treemap chart") - .then(function (result) { - log.log(result); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const result = await qna.setQuestion("2014 total units YTD by manufacturer, region as treemap chart"); + Log.log(result); + } + catch (errors) { + Log.log(errors); + } } function _Qna_QuestionChanged() { @@ -2212,13 +2187,13 @@ function _Visual_DataSelected() { } // ---- Bookmarks Operations ---------------------------------------------------- -function _Bookmarks_Enable() { +async function _Bookmarks_Enable() { // The new settings that you want to apply to the report. const newSettings = { panes: { - bookmarks: { - visible: true - } + bookmarks: { + visible: true + } } }; @@ -2229,20 +2204,22 @@ function _Bookmarks_Enable() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(newSettings); + } + catch (error) { + Log.log(error); + } } -function _Bookmarks_Disable() { +async function _Bookmarks_Disable() { // The new settings that you want to apply to the report. const newSettings = { - panes: { - bookmarks: { - visible: false + panes: { + bookmarks: { + visible: false + } } - } }; // Get a reference to the embedded report HTML element @@ -2252,13 +2229,15 @@ function _Bookmarks_Disable() { report = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - report.updateSettings(newSettings) - .catch(function (error) { - Log.log(error); - }); + try { + await report.updateSettings(newSettings); + } + catch (error) { + Log.log(error); + } } -function _Bookmarks_Get() { +async function _Bookmarks_Get() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2267,19 +2246,19 @@ function _Bookmarks_Get() { // Retrieve the bookmark collection and loop through to print the // bookmarks' name and display name. - report.bookmarksManager.getBookmarks() - .then(function (bookmarks) { - bookmarks.forEach(function (bookmark) { - var log = bookmark.name + " - " + bookmark.displayName; - Log.logText(log); - }); - }) - .catch(function (error) { - Log.log(error); + try { + const bookmarks = await report.bookmarksManager.getBookmarks(); + bookmarks.forEach(function (bookmark) { + var log = bookmark.name + " - " + bookmark.displayName; + Log.logText(log); }); + } + catch (error) { + Log.log(error); + } } -function _Bookmarks_Apply() { +async function _Bookmarks_Apply() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2289,16 +2268,16 @@ function _Bookmarks_Apply() { // bookmarksManager.apply will apply the bookmark with the // given name on the report. // This is the actual bookmark name not the display name. - report.bookmarksManager.apply("Bookmarkaf5fe203dc1e280a4822") - .then(function () { - Log.logText("Bookmark \"Q4 2014\" applied."); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + await report.bookmarksManager.apply("Bookmarkaf5fe203dc1e280a4822"); + Log.logText("Bookmark \"Q4 2014\" applied."); + } + catch (errors) { + Log.log(errors); + } } -function _Bookmarks_Capture() { +async function _Bookmarks_Capture() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2307,17 +2286,17 @@ function _Bookmarks_Capture() { // Capture the current bookmark and prints the bookmark's // state string to Log window. - report.bookmarksManager.capture() - .then(function (capturedBookmark) { - var log = "Captured bookmark state: " + capturedBookmark.state; - Log.logText(log); - }) - .catch(function (error) { - Log.log(error); - }); + try { + const capturedBookmark = await report.bookmarksManager.capture(); + var log = "Captured bookmark state: " + capturedBookmark.state; + Log.logText(log); + } + catch (error) { + Log.log(error); + } } -function _Bookmarks_ApplyState() { +async function _Bookmarks_ApplyState() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2326,16 +2305,16 @@ function _Bookmarks_ApplyState() { // bookmarksManager.applyState will apply the bookmark which // represented by the given state string. - report.bookmarksManager.applyState("H4sIAAAAAAAAA+1d62/bOBL/VwIfDvmSXQyfEvvp2qa9La7Z7iW9HIpDP/AxcrRrS4Yspw2K/u9HSbbrxJal+J3USRBEMjUcDofD3zyofOu4eDjo6bvfdR87Lzqv0vSvvs7+OiGkc9ZJ7t8MlNbaEMuIoxGllFMS+VbpII/TZNh58a2T66yL+XU8HOleQdHf/F8HeEggcIZKwQyRwoEQnc/fzzr4ddBLM108fZXrHAsKt5gN/bXvlfwKnri2eXyLV2jz6u4lDtIsH19LAOcUVcwFRDsEEkjhn4niXu7JFOTM3Zuvg8xz8W0ymLflh75Vfjcorl/7jrtpFlvdmz5aPHk9YYSedd5mab+kMZaS8y3fJHmc3/mL84Lz75/POv+9wQzLZq/TxMUVw98678rfBRs4HFaCKpv0Rv0HnxRXV+kos3iJ0Y+LssPvXl5/ZOkAs7LTT6gzf8/3eq17o1LOnuj72DPvx1GwX9z2DSkQ/r5o+fm7/1UJfaa7Vmw8GOpCTs46N+mX1xn6Fq7zgpRdDatZKieied58ozUmbp1h+dG4kc0fjuwKu31M8gWDO3vAFNkGV4uEfZEm+U0LhugOxRQPr3XyMhs67NXowW1pD/yiyHWcjOdXRCQALYghKL0iEGeZKu4P46Tbw8qClPag/OtjNRajh7G9utH+wpsd86fXpoLY96JbVCIMGBNADRBpCSLCWgSp1NxbPIYBD3jIIMRgPYJhGEobSaCWc0IF1Ua7RoI5fs1N+nWemoCA+G9NRejXuCICDFmLvQBQCEIjFxolDA3ACb06e1QoFkZgNIAXoSUMmFmLPW8wmHCRlx+nEoQRwjYrTC17VitqGHcuJBqscIrz5snVpfF6Ncpzv0zmp5c5wyURwmgBjBmtgK9JUkZGBwJsgDSQzijCrF2D5Nlksy+e6aeuaH0TO4dJp1pClHk5MAcSqQ4DqwSDerO8q/3zQ0nuPUZ5ZbL6A53Fw4kBm1z9K078YoKzmYZrbbCXoyTxUj6Zbm+XcfemJLxgkyXFDnuv0UGySSs2twQE5liZ26IOYUeCGUZeuludWHRzXFygHo4ybMvGle7h8K2eZ+RjmuveyX+S2K+/eUZKiLRsJdveaOgnEV0lldc3Ossfrug0c5i9uiuXzXmcTXCyX3RvdjCkYtkutylGUCRWWxOC9bYROZAVd5WmnkJghHoYEXCp0ITInW426Sv1RKmjjCERBJwJnHeINN+/ndyKn/FgUTf7G2SrzkZrG7P1pf33ag2cXHi/GPMTD1oy3K+xWcTRySWhF6uYHqOzgzA3NWJutjshCwWTEeEOVUiMsVywNdEYRetBMTM2pAyFx2MhROs5BA6874uBDiVYiiIAuYZDoELBheSRjDRHMNa7VM2Iu5aaA6o1eHdAIkAowyCiwerUru97gGT/1vKIKo+o8lmiyhaM/Bb7Oczszd17vMXePD/Tz+c/mrBx7RWvCtyOleiRMzxeslMynXsjnDab4aS8efLjRvHxmP/FMUhoqRzPThqLg4Q/p2ac67tteV5VZsLz9udMmHusaBVAenbSnKyzZzi0yaL53Oj9PcAybP9Y5uj5Haqf9SQd0me3to/wYFYa/x75zQyPAjnipc3hpZ7fCY8g6bFIAkISomUoEIAhaENlc2x89fSe0pQLIFZZKqWTwMMWIZ3lIbFIGxABUwGC4iEn1pF1SDaNwCkeKAdaoUXtQPBxgnLlCBy3Aoo8AUehADToQOJaBKVENJ4mOi/gACjTMlyLIPPKYbmIDAFDVUFa0UaCtXE4RgUGTAMBisY4Io2w9fi1XY1LO0AbzwLadx68Wp2nvsctw9p4rqgn1/lo2ArQnl6gi0f9003B2tlR1zDVVNfzYw5mtqR2EzCcnYAZFFkv/9bRxnYQdjonc8P/x1QyQJvDjeedmmDjppD0HDvbDznWq8a7vu4uwvGNW3J/1MvjS/+MztyCXIaxQWikJAGzTFlumMajIagzBO/TL0crcFBWgBytwAasAHdFtZrWwsMVh9y6SDXjqWEvtqUO/iDW6WPWLUXexaSaKq9Gg4r/GIc/LMv9vzYWAXuZlInTduk8urE82dQ1WKaqzjfK4z6eFqXYv4D8BchHgBflz+njMnxsn5wTMs95uQLH6Xid6wXTPsy9V3g+Lu7HckNZTUp+aSXu0YQI/MLIR+qpyBdc/aooGxOrvIullE5fYf4FMTmdmJr6+gfysP5h/YDn+F7VbeRoRDiw4scGRmhlw/rtenchx4knf1JoKnqXuC7suIah2kfRSe24qumg3llkwmnLnHKa01DoJYWyP9feTRrNCtvl3k1a4KmfENH+5udnz5D26cOnB5nAA6gBPcgCoXEd0yGVB7UT/WBW9NOqoHrp76SmbDC3xmaOqS2bhlPP6y0mMfpN55G4cw/MXnh8Vh0NnUGaOz3mV5MA2tZe/Xuazw9kZxt4VVM2hT3XhWCbHYRk1OvVz85m690W8bZK+nIjOjPNYO2Vi9nbe6s7WIq1dsrJ364G2uKCaE0rLl5mcX7T966jnTXim9XhaQHpTPXmdH1dWd/avbnVC5Kg22ej7N1bpdK/+TAobG/qrRw7hBnds14tjQS2AJGD+DbNP2rTw307tnWWtNiWFmbqPfR9hGvS3l59LtEHEcoYQqzz/rQAIsAJWY+hj270HhNhRzf6cDPET9+RDnkUSB4CJ1oHoYaiQqEgsXoeoiYa3Sbqe+6fcOmXmbDvAl9/iZ1a1S4dHf1N1/8+T1etKvS9X3786cOnk9c3Ouk2+2xwvn2PrQWL27di/8R0TomwWzyyVzT5eG/2kPI4T8qxfHalpWsVsm/r7VM77n+1N2msc4xrg2bnGevkRie48g85SCskDRhHamUIDPEgst6P2tyeXO67YXRVBjwIlaFUO+4E0wY4Z7Ak/fWzu4kHkG39uaInzQWEOy1CeLYFhIpFBGkoDePGUUIoZc3nP3bruEMEDFQUKAJcaYWasGOi/mn479vcvxsPyj7BXXvBa5IWhK6Co/b/xNrfNvzwpNS/Pq9VNJTFm/pMcbSPSMuUUs661d2Il91uhl09UeV1yn6XILk0qwb5dpSMhQe78bsfjS538DK5PYq80iChNNcq4NSYgJPQGS2bX4x71KCjBk01iBlwkikRAsiQUsXAHSvGW6e6d3ra65jqPtAzkE/fXV74n1DWcpc3d96uO6uTZRB7u8rYrY2St1DGN3qYz2jj0hNorU56FW9gmI0blF//B2OhSYYdZwAA") - .then(function () { - Log.logText("Bookmark applied from given state."); - }) - .catch(function (error) { - Log.log(error); - }); + try { + await report.bookmarksManager.applyState("H4sIAAAAAAAAA+1d62/bOBL/VwIfDvmSXQyfEvvp2qa9La7Z7iW9HIpDP/AxcrRrS4Yspw2K/u9HSbbrxJal+J3USRBEMjUcDofD3zyofOu4eDjo6bvfdR87Lzqv0vSvvs7+OiGkc9ZJ7t8MlNbaEMuIoxGllFMS+VbpII/TZNh58a2T66yL+XU8HOleQdHf/F8HeEggcIZKwQyRwoEQnc/fzzr4ddBLM108fZXrHAsKt5gN/bXvlfwKnri2eXyLV2jz6u4lDtIsH19LAOcUVcwFRDsEEkjhn4niXu7JFOTM3Zuvg8xz8W0ymLflh75Vfjcorl/7jrtpFlvdmz5aPHk9YYSedd5mab+kMZaS8y3fJHmc3/mL84Lz75/POv+9wQzLZq/TxMUVw98678rfBRs4HFaCKpv0Rv0HnxRXV+kos3iJ0Y+LssPvXl5/ZOkAs7LTT6gzf8/3eq17o1LOnuj72DPvx1GwX9z2DSkQ/r5o+fm7/1UJfaa7Vmw8GOpCTs46N+mX1xn6Fq7zgpRdDatZKieied58ozUmbp1h+dG4kc0fjuwKu31M8gWDO3vAFNkGV4uEfZEm+U0LhugOxRQPr3XyMhs67NXowW1pD/yiyHWcjOdXRCQALYghKL0iEGeZKu4P46Tbw8qClPag/OtjNRajh7G9utH+wpsd86fXpoLY96JbVCIMGBNADRBpCSLCWgSp1NxbPIYBD3jIIMRgPYJhGEobSaCWc0IF1Ua7RoI5fs1N+nWemoCA+G9NRejXuCICDFmLvQBQCEIjFxolDA3ACb06e1QoFkZgNIAXoSUMmFmLPW8wmHCRlx+nEoQRwjYrTC17VitqGHcuJBqscIrz5snVpfF6Ncpzv0zmp5c5wyURwmgBjBmtgK9JUkZGBwJsgDSQzijCrF2D5Nlksy+e6aeuaH0TO4dJp1pClHk5MAcSqQ4DqwSDerO8q/3zQ0nuPUZ5ZbL6A53Fw4kBm1z9K078YoKzmYZrbbCXoyTxUj6Zbm+XcfemJLxgkyXFDnuv0UGySSs2twQE5liZ26IOYUeCGUZeuludWHRzXFygHo4ybMvGle7h8K2eZ+RjmuveyX+S2K+/eUZKiLRsJdveaOgnEV0lldc3Ossfrug0c5i9uiuXzXmcTXCyX3RvdjCkYtkutylGUCRWWxOC9bYROZAVd5WmnkJghHoYEXCp0ITInW426Sv1RKmjjCERBJwJnHeINN+/ndyKn/FgUTf7G2SrzkZrG7P1pf33ag2cXHi/GPMTD1oy3K+xWcTRySWhF6uYHqOzgzA3NWJutjshCwWTEeEOVUiMsVywNdEYRetBMTM2pAyFx2MhROs5BA6874uBDiVYiiIAuYZDoELBheSRjDRHMNa7VM2Iu5aaA6o1eHdAIkAowyCiwerUru97gGT/1vKIKo+o8lmiyhaM/Bb7Oczszd17vMXePD/Tz+c/mrBx7RWvCtyOleiRMzxeslMynXsjnDab4aS8efLjRvHxmP/FMUhoqRzPThqLg4Q/p2ac67tteV5VZsLz9udMmHusaBVAenbSnKyzZzi0yaL53Oj9PcAybP9Y5uj5Haqf9SQd0me3to/wYFYa/x75zQyPAjnipc3hpZ7fCY8g6bFIAkISomUoEIAhaENlc2x89fSe0pQLIFZZKqWTwMMWIZ3lIbFIGxABUwGC4iEn1pF1SDaNwCkeKAdaoUXtQPBxgnLlCBy3Aoo8AUehADToQOJaBKVENJ4mOi/gACjTMlyLIPPKYbmIDAFDVUFa0UaCtXE4RgUGTAMBisY4Io2w9fi1XY1LO0AbzwLadx68Wp2nvsctw9p4rqgn1/lo2ArQnl6gi0f9003B2tlR1zDVVNfzYw5mtqR2EzCcnYAZFFkv/9bRxnYQdjonc8P/x1QyQJvDjeedmmDjppD0HDvbDznWq8a7vu4uwvGNW3J/1MvjS/+MztyCXIaxQWikJAGzTFlumMajIagzBO/TL0crcFBWgBytwAasAHdFtZrWwsMVh9y6SDXjqWEvtqUO/iDW6WPWLUXexaSaKq9Gg4r/GIc/LMv9vzYWAXuZlInTduk8urE82dQ1WKaqzjfK4z6eFqXYv4D8BchHgBflz+njMnxsn5wTMs95uQLH6Xid6wXTPsy9V3g+Lu7HckNZTUp+aSXu0YQI/MLIR+qpyBdc/aooGxOrvIullE5fYf4FMTmdmJr6+gfysP5h/YDn+F7VbeRoRDiw4scGRmhlw/rtenchx4knf1JoKnqXuC7suIah2kfRSe24qumg3llkwmnLnHKa01DoJYWyP9feTRrNCtvl3k1a4KmfENH+5udnz5D26cOnB5nAA6gBPcgCoXEd0yGVB7UT/WBW9NOqoHrp76SmbDC3xmaOqS2bhlPP6y0mMfpN55G4cw/MXnh8Vh0NnUGaOz3mV5MA2tZe/Xuazw9kZxt4VVM2hT3XhWCbHYRk1OvVz85m690W8bZK+nIjOjPNYO2Vi9nbe6s7WIq1dsrJ364G2uKCaE0rLl5mcX7T966jnTXim9XhaQHpTPXmdH1dWd/avbnVC5Kg22ej7N1bpdK/+TAobG/qrRw7hBnds14tjQS2AJGD+DbNP2rTw307tnWWtNiWFmbqPfR9hGvS3l59LtEHEcoYQqzz/rQAIsAJWY+hj270HhNhRzf6cDPET9+RDnkUSB4CJ1oHoYaiQqEgsXoeoiYa3Sbqe+6fcOmXmbDvAl9/iZ1a1S4dHf1N1/8+T1etKvS9X3786cOnk9c3Ouk2+2xwvn2PrQWL27di/8R0TomwWzyyVzT5eG/2kPI4T8qxfHalpWsVsm/r7VM77n+1N2msc4xrg2bnGevkRie48g85SCskDRhHamUIDPEgst6P2tyeXO67YXRVBjwIlaFUO+4E0wY4Z7Ak/fWzu4kHkG39uaInzQWEOy1CeLYFhIpFBGkoDePGUUIoZc3nP3bruEMEDFQUKAJcaYWasGOi/mn479vcvxsPyj7BXXvBa5IWhK6Co/b/xNrfNvzwpNS/Pq9VNJTFm/pMcbSPSMuUUs661d2Il91uhl09UeV1yn6XILk0qwb5dpSMhQe78bsfjS538DK5PYq80iChNNcq4NSYgJPQGS2bX4x71KCjBk01iBlwkikRAsiQUsXAHSvGW6e6d3ra65jqPtAzkE/fXV74n1DWcpc3d96uO6uTZRB7u8rYrY2St1DGN3qYz2jj0hNorU56FW9gmI0blF//B2OhSYYdZwAA"); + Log.logText("Bookmark applied from given state."); + } + catch (error) { + Log.log(error); + } } -function _Bookmarks_EnterPresentation() { +async function _Bookmarks_EnterPresentation() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -2346,13 +2325,16 @@ function _Bookmarks_EnterPresentation() { report = powerbi.get(embedContainer); // Enter bookmarks play mode - report.bookmarksManager.play(models.BookmarksPlayMode.Presentation) - .then(function () { - Log.logText("Bookmarks play mode is on, check the play bar at the bottom of the report."); - }); + try { + await report.bookmarksManager.play(models.BookmarksPlayMode.Presentation); + Log.logText("Bookmarks play mode is on, check the play bar at the bottom of the report."); + } + catch (errors) { + Log.log(errors); + } } -function _Bookmarks_ExitPresentation() { +async function _Bookmarks_ExitPresentation() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -2363,13 +2345,16 @@ function _Bookmarks_ExitPresentation() { report = powerbi.get(embedContainer); // Exit bookmarks play mode - report.bookmarksManager.play(models.BookmarksPlayMode.Off) - .then(function () { - Log.logText("Bookmarks play mode is off."); - }); + try { + await report.bookmarksManager.play(models.BookmarksPlayMode.Off); + Log.logText("Bookmarks play mode is off."); + } + catch (errors) { + Log.log(errors); + } } -function _Visual_GetSlicer() { +async function _Visual_GetSlicer() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2377,39 +2362,31 @@ function _Visual_GetSlicer() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive; - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - // Retrieve the target visual. - var slicer = visuals.filter(function (visual) { - return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90"; - })[0]; - - // Get the slicer state which contains the slicer filter. - slicer.getSlicerState() - .then(function (state) { - Log.log(state); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive; + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var slicer = visuals.filter(function (visual) { + return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90"; + })[0]; + + // Get the slicer state which contains the slicer filter. + const state = await slicer.getSlicerState(); + Log.log(state); + } + catch (errors) { + Log.log(errors); + } } -function _Visual_SetSlicer() { +async function _Visual_SetSlicer() { // Build the filter you want to use. For more information, See Constructing // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. const filter = { @@ -2439,39 +2416,31 @@ function _Visual_SetSlicer() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive; - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - // Retrieve the target visual. - var slicer = visuals.filter(function (visual) { - return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90"; - })[0]; - - // Set the slicer state which contains the slicer filters. - slicer.setSlicerState({ filters: [filter] }) - .then(function () { - Log.logText("Date slicer was set."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive; + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var slicer = visuals.filter(function (visual) { + return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90"; + })[0]; + + // Set the slicer state which contains the slicer filters. + await slicer.setSlicerState({ filters: [filter] }); + Log.logText("Date slicer was set."); + } + catch (errors) { + Log.log(errors); + } } -function _Visual_SetFilters() { +async function _Visual_SetFilters() { // Build the filter you want to use. For more information, See Constructing // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters. const filter = { @@ -2497,42 +2466,32 @@ function _Visual_SetFilters() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - // Set the filter for the visual. - // Pay attention that setFilters receives an array. - visual.setFilters([filter]) - .then(function () { - Log.logText("Filter was set for \"Category Breakdown\" table.") - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var visual = visuals.filter(function (visual) { + return visual.name == "VisualContainer4"; + })[0]; + + // Set the filter for the visual. + // Pay attention that setFilters receives an array. + await visual.setFilters([filter]); + Log.logText("Filter was set for \"Category Breakdown\" table.") + } + catch (errors) { + Log.log(errors); + } } -function _Visual_GetFilters() { +async function _Visual_GetFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2540,40 +2499,30 @@ function _Visual_GetFilters() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - visual.getFilters() - .then(function (filters) { - Log.log(filters); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var visual = visuals.filter(function (visual) { + return visual.name == "VisualContainer4"; + })[0]; + + const filters = await visual.getFilters(); + Log.log(filters); + } + catch (errors) { + Log.log(errors); + } } -function _Visual_RemoveFilters() { +async function _Visual_RemoveFilters() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2581,40 +2530,30 @@ function _Visual_RemoveFilters() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - visual.removeFilters() - .then(function () { - Log.logText("\"Sentiment by Year and Months\" visual filters were removed."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var visual = visuals.filter(function (visual) { + return visual.name == "VisualContainer4"; + })[0]; + + await visual.removeFilters(); + Log.logText("\"Sentiment by Year and Months\" visual filters were removed."); + } + catch (errors) { + Log.log(errors); + } } -function _Visual_ExportData_Summarized() { +async function _Visual_ExportData_Summarized() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -2625,41 +2564,30 @@ function _Visual_ExportData_Summarized() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - // Exports visual data - visual.exportData(models.ExportDataType.Summarized) - .then(function (result) { - Log.logCsv(result.data); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var visual = visuals.filter(function (visual) { + return visual.name == "VisualContainer4"; + })[0]; + + const result = await visual.exportData(models.ExportDataType.Summarized); + Log.logCsv(result.data); + } + catch (errors) { + Log.log(errors); + } } -function _Visual_ExportData_Underlying() { +async function _Visual_ExportData_Underlying() { // Get models. models contains enums that can be used. var models = window['powerbi-client'].models; @@ -2670,47 +2598,37 @@ function _Visual_ExportData_Underlying() { report = powerbi.get(embedContainer); // Retrieve the page collection and get the visuals for the first page. - report.getPages() - .then(function (pages) { - - // Retrieve active page. - var activePage = pages.filter(function (page) { - return page.isActive - })[0]; - - activePage.getVisuals() - .then(function (visuals) { - - // Retrieve the target visual. - var visual = visuals.filter(function (visual) { - return visual.name == "VisualContainer4"; - })[0]; - - // Exports visual data - visual.exportData(models.ExportDataType.Underlying) - .then(function (result) { - Log.logCsv(result.data); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const pages = await report.getPages(); + + // Retrieve active page. + var activePage = pages.filter(function (page) { + return page.isActive + })[0]; + + const visuals = await activePage.getVisuals(); + + // Retrieve the target visual. + var visual = visuals.filter(function (visual) { + return visual.name == "VisualContainer4"; + })[0]; + + // Exports visual data + const result = await visual.exportData(models.ExportDataType.Underlying); + Log.logCsv(result.data); + } + catch (errors) { + Log.log(errors); + } } -function _ReportVisual_UpdateSettings() { +async function _ReportVisual_UpdateSettings() { // The new settings that you want to apply to the report. const newSettings = { panes: { - filters: { - visible: true - } + filters: { + visible: true + } } }; @@ -2721,16 +2639,16 @@ function _ReportVisual_UpdateSettings() { visual = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - visual.updateSettings(newSettings) - .then(function () { - Log.logText("Filter pane was added."); - }) - .catch(function (error) { - Log.log(error); - }); + try { + await visual.updateSettings(newSettings); + Log.logText("Filter pane was added."); + } + catch (error) { + Log.log(error); + } } -function _ReportVisual_HideSingleVisualHeader() { +async function _ReportVisual_HideSingleVisualHeader() { // Define settings to hide the header of a single visual var newSettings = { @@ -2764,16 +2682,16 @@ function _ReportVisual_HideSingleVisualHeader() { visual = powerbi.get(embedContainer); // Update the settings by passing in the new settings you have configured. - visual.updateSettings(newSettings) - .then(function () { - Log.logText("Visual header was successfully hidden for 'Sentiment by Year and Months' visual."); - }) - .catch(function (error) { - Log.log(error); - }); + try { + await visual.updateSettings(newSettings); + Log.logText("Visual header was successfully hidden for 'Sentiment by Year and Months' visual."); + } + catch (error) { + Log.log(error); + } } -function _Report_Authoring_Create() { +async function _Report_Authoring_Create() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2782,38 +2700,37 @@ function _Report_Authoring_Create() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - - // Creating new visual - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization - page.createVisual('clusteredColumnChart') - .then(function (response) { - let visual = response.visual; - - // Defining data fields - const regionColumn = { column: 'Region', table: 'Geo', schema: 'http://powerbi.com/product/schema#column' }; - const totalUnitsMeasure = { measure: 'Total Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' }; - const totalVanArsdelUnitsMeasure = { measure: 'Total VanArsdel Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' }; - - // Setting visual data fields - visual.addDataField('Category', regionColumn); - visual.addDataField('Y', totalUnitsMeasure); - visual.addDataField('Y', totalVanArsdelUnitsMeasure); - - // Personalizing the visual - visual.setProperty({ objectName: "title", propertyName: "textSize" }, { schema: 'http://powerbi.com/product/schema#property', value: 8 }); - visual.setProperty({ objectName: "title", propertyName: "fontColor" }, { schema: 'http://powerbi.com/product/schema#property', value: '#000000' }); - - // Visit: https://github.com/microsoft/powerbi-report-authoring/wiki for full documentation - }); - }) - .catch(function (errors) { - Log.log(errors); - }); + try { + const page = await SetAuthoringPageActive(report); + + // Creating new visual + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization + const response = await page.createVisual('clusteredColumnChart'); + + let visual = response.visual; + + // Defining data fields + const regionColumn = { column: 'Region', table: 'Geo', schema: 'http://powerbi.com/product/schema#column' }; + const totalUnitsMeasure = { measure: 'Total Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' }; + const totalVanArsdelUnitsMeasure = { measure: 'Total VanArsdel Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' }; + + // Setting visual data fields + visual.addDataField('Category', regionColumn); + visual.addDataField('Y', totalUnitsMeasure); + visual.addDataField('Y', totalVanArsdelUnitsMeasure); + + // Personalizing the visual + visual.setProperty({ objectName: "title", propertyName: "textSize" }, { schema: 'http://powerbi.com/product/schema#property', value: 8 }); + visual.setProperty({ objectName: "title", propertyName: "fontColor" }, { schema: 'http://powerbi.com/product/schema#property', value: '#000000' }); + + // Visit: https://github.com/microsoft/powerbi-report-authoring/wiki for full documentation + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_ChangeType() { +async function _Report_Authoring_ChangeType() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2822,33 +2739,27 @@ function _Report_Authoring_ChangeType() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization - visual.changeType('waterfallChart') - .then(function () { - Log.logText("Last visual type was changed."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization + await visual.changeType('waterfallChart'); + Log.logText("Last visual type was changed."); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_Remove() { +async function _Report_Authoring_Remove() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2857,33 +2768,27 @@ function _Report_Authoring_Remove() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization - page.deleteVisual(visual.name) - .then(function () { - Log.logText("Last visual was deleted."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization + await page.deleteVisual(visual.name); + Log.logText("Last visual was deleted."); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_Capabilities() { +async function _Report_Authoring_Capabilities() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2892,33 +2797,29 @@ function _Report_Authoring_Capabilities() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Getting visual capabilities - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - visual.getCapabilities().then(function (capabilities) { - Log.logText("Visual capabilities:"); - Log.log(capabilities); - }).catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Getting visual capabilities + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding + const capabilities = await visual.getCapabilities(); + Log.logText("Visual capabilities:"); + Log.log(capabilities); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_AddDataField() { +async function _Report_Authoring_AddDataField() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2927,57 +2828,43 @@ function _Report_Authoring_AddDataField() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Getting 'Y' role data fields - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - visual.getDataFields('Y') - .then(function (dataFields) { - - // Removing the second data field of 'Y' role, in order to add Legend/Breakdown - if (dataFields.length > 1) - visual.removeDataField('Y', 1); - - // Adding Legend/Breakdown data role - if (visual.type === 'clusteredColumnChart') { - const quarterColumn = { column: 'Quarter', table: 'Date', schema: 'http://powerbi.com/product/schema#column' }; - visual.addDataField('Series', quarterColumn) - .then(function () { - Log.logText("Data field was added to last visual."); - }) - .catch(function (errors) { - Log.log(errors); - }); - } else { - const categoryColumn = { column: 'Category', table: 'Product', schema: 'http://powerbi.com/product/schema#column' }; - visual.addDataField('Breakdown', categoryColumn) - .then(function () { - Log.logText("Data field was added to last visual."); - }) - .catch(function (errors) { - Log.log(errors); - }); - } - }).catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Getting 'Y' role data fields + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding + const dataFields = await visual.getDataFields('Y'); + + // Removing the second data field of 'Y' role, in order to add Legend/Breakdown + if (dataFields.length > 1) + visual.removeDataField('Y', 1); + + // Adding Legend/Breakdown data role + if (visual.type === 'clusteredColumnChart') { + const quarterColumn = { column: 'Quarter', table: 'Date', schema: 'http://powerbi.com/product/schema#column' }; + await visual.addDataField('Series', quarterColumn); + Log.logText("Data field was added to last visual."); + } + else { + const categoryColumn = { column: 'Category', table: 'Product', schema: 'http://powerbi.com/product/schema#column' }; + await visual.addDataField('Breakdown', categoryColumn); + Log.logText("Data field was added to last visual."); + } + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_RemoveDataField() { +async function _Report_Authoring_RemoveDataField() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -2986,46 +2873,37 @@ function _Report_Authoring_RemoveDataField() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - let dataRole = visual.type === 'clusteredColumnChart' ? 'Series' : 'Breakdown'; - - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - visual.getDataFields(dataRole) - .then(function (dataFields) { - - // Removing Legend/Breakdown data field - if (dataFields.length > 0) { - visual.removeDataField(dataRole, 0) - .then(function () { - Log.logText("Data field was removed from last visual."); - }) - .catch(function (errors) { - Log.log(errors); - }); - } else { - Log.logText("Please add additional data field first."); - } - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } + + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + let dataRole = visual.type === 'clusteredColumnChart' ? 'Series' : 'Breakdown'; + + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding + const dataFields = await visual.getDataFields(dataRole); + + // Removing Legend/Breakdown data field + if (dataFields.length > 0) { + await visual.removeDataField(dataRole, 0); + Log.logText("Data field was removed from last visual."); + } + else { + Log.log("Please add additional data field first."); + } + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_GetDataField() { +async function _Report_Authoring_GetDataField() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -3034,35 +2912,29 @@ function _Report_Authoring_GetDataField() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Getting 'Y' role data fields - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding - visual.getDataFields('Y') - .then(function (dataFields) { - Log.logText("Visual 'Y' fields:"); - Log.log(dataFields); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Getting 'Y' role data fields + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding + const dataFields = await visual.getDataFields('Y'); + Log.logText("Visual 'Y' fields:"); + Log.log(dataFields); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_GetProperty() { +async function _Report_Authoring_GetProperty() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -3071,32 +2943,29 @@ function _Report_Authoring_GetProperty() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Get legend position property - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties - visual.getProperty({ objectName: "legend", propertyName: "position" }) - .then(function (property) { - Log.logText("Last visual - legend position property:"); - Log.log(property); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Get legend position property + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties + const property = await visual.getProperty({ objectName: "legend", propertyName: "position" }); + Log.logText("Last visual - legend position property:"); + Log.log(property); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_SetProperty() { +async function _Report_Authoring_SetProperty() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -3105,34 +2974,28 @@ function _Report_Authoring_SetProperty() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Set legend position to bottom center - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties - visual.setProperty({ objectName: "legend", propertyName: "position" }, { schema: 'http://powerbi.com/product/schema#property', value: 'BottomCenter' }) - .then(function () { - Log.logText("Last visual legend position was set to bottom center."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Set legend position to bottom center + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties + await visual.setProperty({ objectName: "legend", propertyName: "position" }, { schema: 'http://powerbi.com/product/schema#property', value: 'BottomCenter' }); + Log.logText("Last visual legend position was set to bottom center."); + } + catch (errors) { + Log.log(errors); + } } -function _Report_Authoring_ResetProperty() { +async function _Report_Authoring_ResetProperty() { // Get a reference to the embedded report HTML element var embedContainer = $('#embedContainer')[0]; @@ -3141,29 +3004,23 @@ function _Report_Authoring_ResetProperty() { // Util function - setting authoring page as active // For implementation please check 'Navigation > Page - Set active' code sample. - SetAuthoringPageActive(report) - .then(function (page) { - page.getVisuals().then(function (visuals) { - if (visuals.length < 1) { - Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); - return; - } + try { + const page = await SetAuthoringPageActive(report); + const visuals = await page.getVisuals(); + if (visuals.length < 1) { + Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first."); + return; + } - // Getting the last visual that was added - let visual = visuals[visuals.length - 1]; - - // Reset visual legend position - // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties - visual.resetProperty({ objectName: "legend", propertyName: "position" }) - .then(function () { - Log.logText("Last visual legend position property was reset to default value."); - }) - .catch(function (errors) { - Log.log(errors); - }); - }) - }) - .catch(function (errors) { - Log.log(errors); - }); + // Getting the last visual that was added + let visual = visuals[visuals.length - 1]; + + // Reset visual legend position + // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties + await visual.resetProperty({ objectName: "legend", propertyName: "position" }); + Log.logText("Last visual legend position property was reset to default value."); + } + catch (errors) { + Log.log(errors); + } } From 0071be7c041a9487096f0f9eecb12f1f867628e3 Mon Sep 17 00:00:00 2001 From: Shahak Yosef Date: Sun, 13 Dec 2020 15:15:34 +0000 Subject: [PATCH 16/23] Merged PR 132063: Hide phased loading for single visual embedded Phased loading (load and render) doesn't work for single visual embed (report embed with custom layout). Hide it from the official documentation. --- src/visual.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/visual.ts b/src/visual.ts index 8bcc4e4d..13e183fd 100644 --- a/src/visual.ts +++ b/src/visual.ts @@ -5,6 +5,7 @@ import { Report } from './report' import { Page } from './page'; import { VisualDescriptor } from './visualDescriptor'; import { IHttpPostMessageResponse } from 'http-post-message'; +import { IReportLoadConfiguration } from 'powerbi-models'; /** * The Power BI Visual embed component @@ -20,6 +21,8 @@ export class Visual extends Report { static GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; /** @hidden */ static SetPageNotSupportedError = "Set page is not supported while embedding a visual."; + /** @hidden */ + static RenderNotSupportedError = "render is not supported while embedding a visual."; /** * Creates an instance of a Power BI Single Visual. @@ -33,6 +36,9 @@ export class Visual extends Report { super(service, element, baseConfig, phasedRender, isBootstrap, iframe); } + /** + * @hidden + */ load(phasedRender?: boolean): Promise { var config = this.config; @@ -113,6 +119,16 @@ export class Visual extends Report { throw Visual.SetPageNotSupportedError; } + /** + * Render a preloaded report, using phased embedding API + * + * @hidden + * @returns {Promise} + */ + async render(config?: IReportLoadConfiguration | embed.IReportEmbedConfiguration): Promise { + throw Visual.RenderNotSupportedError + } + /** * Gets the embedded visual descriptor object that contains the visual name, type, etc. * From 09894c8d6781a00b75b60e87b230ffb70c6d0d73 Mon Sep 17 00:00:00 2001 From: Anant Singh Date: Sun, 20 Dec 2020 17:05:13 +0000 Subject: [PATCH 17/23] Merged PR 134898: Fixed spellings Note: Changes in **powerbi-client.d.ts > module "visual"** are due to the previous completed PR --- dist/powerbi-client.d.ts | 21 +++++++++++++++++---- dist/powerbi.js | 26 ++++++++++++++++++++++---- dist/powerbi.min.js | 4 ++-- src/page.ts | 2 +- src/service.ts | 6 +++--- src/util.ts | 2 +- src/visualDescriptor.ts | 2 +- 7 files changed, 47 insertions(+), 16 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 327eb7be..418a2094 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -47,7 +47,7 @@ declare module "util" { */ export function createRandomString(): string; /** - * Generates a 20 charachter uuid. + * Generates a 20 character uuid. * * @export * @returns {string} @@ -597,7 +597,7 @@ declare module "visualDescriptor" { */ type: string; /** - * The visual layout: position, size and visiblity. + * The visual layout: position, size and visibility. * * @type {string} */ @@ -812,7 +812,7 @@ declare module "page" { /** * Makes the current page the active page of the report. * - * ```javascripot + * ```javascript * page.setActive(); * ``` * @@ -1437,6 +1437,7 @@ declare module "visual" { import { Page } from "page"; import { VisualDescriptor } from "visualDescriptor"; import { IHttpPostMessageResponse } from 'http-post-message'; + import { IReportLoadConfiguration } from 'powerbi-models'; /** * The Power BI Visual embed component * @@ -1450,6 +1451,8 @@ declare module "visual" { static GetPagesNotSupportedError: string; /** @hidden */ static SetPageNotSupportedError: string; + /** @hidden */ + static RenderNotSupportedError: string; /** * Creates an instance of a Power BI Single Visual. * @@ -1459,6 +1462,9 @@ declare module "visual" { * @hidden */ constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean, iframe?: HTMLIFrameElement); + /** + * @hidden + */ load(phasedRender?: boolean): Promise; /** * Gets the list of pages within the report - not supported in visual embed. @@ -1473,6 +1479,13 @@ declare module "visual" { * @returns {Promise>} */ setPage(pageName: string): Promise>; + /** + * Render a preloaded report, using phased embedding API + * + * @hidden + * @returns {Promise} + */ + render(config?: IReportLoadConfiguration | embed.IReportEmbedConfiguration): Promise; /** * Gets the embedded visual descriptor object that contains the visual name, type, etc. * @@ -1620,7 +1633,7 @@ declare module "service" { private config; /** A list of Dashboard, Report and Tile components that have been embedded using this service instance. */ private embeds; - /** TODO: Look for way to make hpm private without sacraficing ease of maitenance. This should be private but in embed needs to call methods. + /** TODO: Look for way to make hpm private without sacrificing ease of maintenance. This should be private but in embed needs to call methods. * @hidden */ hpm: hpm.HttpPostMessage; diff --git a/dist/powerbi.js b/dist/powerbi.js index a3c7ed40..17ccd31d 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -7073,7 +7073,7 @@ var Page = /** @class */ (function () { /** * Makes the current page the active page of the report. * - * ```javascripot + * ```javascript * page.setActive(); * ``` * @@ -8504,7 +8504,7 @@ var Service = /** @class */ (function () { Service.prototype.embedExisting = function (element, config, phasedRender) { var component = utils.find(function (x) { return x.element === element; }, this.embeds); if (!component) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded component associated, but could not find the existing component in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); } // TODO: Multiple embedding to the same iframe is not supported in QnA if (config.type && config.type.toLowerCase() === "qna") { @@ -8611,7 +8611,7 @@ var Service = /** @class */ (function () { iframe.remove(); } else { - /** Workaround for IE: unhandled rejection TypeError: object doesn't support propert or method 'remove' */ + /** Workaround for IE: unhandled rejection TypeError: object doesn't support property or method 'remove' */ iframe.parentElement.removeChild(iframe); } } @@ -8972,7 +8972,7 @@ function createRandomString() { } exports.createRandomString = createRandomString; /** - * Generates a 20 charachter uuid. + * Generates a 20 character uuid. * * @export * @returns {string} @@ -9163,6 +9163,9 @@ var Visual = /** @class */ (function (_super) { function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { return _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe) || this; } + /** + * @hidden + */ Visual.prototype.load = function (phasedRender) { var config = this.config; if (!config.accessToken) { @@ -9231,6 +9234,19 @@ var Visual = /** @class */ (function (_super) { Visual.prototype.setPage = function (pageName) { throw Visual.SetPageNotSupportedError; }; + /** + * Render a preloaded report, using phased embedding API + * + * @hidden + * @returns {Promise} + */ + Visual.prototype.render = function (config) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + throw Visual.RenderNotSupportedError; + }); + }); + }; /** * Gets the embedded visual descriptor object that contains the visual name, type, etc. * @@ -9386,6 +9402,8 @@ var Visual = /** @class */ (function (_super) { Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; /** @hidden */ Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; + /** @hidden */ + Visual.RenderNotSupportedError = "render is not supported while embedding a visual."; return Visual; }(report_1.Report)); exports.Visual = Visual; diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 07ef0854..11125637 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -3,8 +3,8 @@ var a;window,a=function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?u.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?u.Advanced:u.Unknown}function i(t){return!(!t.table||!t.column||t.aggregationFunction)}function o(t){return t&&!!t.groupName}function n(t){return Array.isArray(t)}function l(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}var s,d=this&&this.__extends||(s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var u,c=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(u=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var p=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=p;var f=function(t){function e(r,a,i){var o=t.call(this,r,u.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(p);e.NotSupportedFilter=f;var h=function(t){function e(r,a,i){var o=t.call(this,r,u.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(p);e.IncludeExcludeFilter=h;var v=function(t){function e(r,a,i,o){var n=t.call(this,r,u.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(p);e.TopNFilter=v;var y=function(t){function e(r,a,i,o,n){var l=t.call(this,r,u.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(p);e.RelativeDateFilter=y;var m=function(t){function e(r,a,i,o){var n=t.call(this,r,u.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(p);e.RelativeTimeFilter=m;var V=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===n.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return l.conditions=n,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(p);e.AdvancedFilter=w,e.isFilterKeyColumnsTarget=function(t){return i(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return a(t)===u.Basic&&!!t.keyValues},e.getFilterType=a,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=i,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var P=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=P;var _=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(P);e.PageSelector=_;var S=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(P);e.VisualSelector=S;var E=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.visualType=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(P);e.VisualTypeSelector=E;var O=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.target=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(P);e.SlicerTargetSelector=O,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!o(t)},e.isGroupedMenuExtension=o,e.isIExtensions=function(t){return t&&!n(t)},e.isIExtensionArray=n,e.validateVisualSelector=function(t){var e=c.Validators.visualSelectorValidator.validate(t);return e?e.map(l):void 0},e.validateSlicer=function(t){var e=c.Validators.slicerValidator.validate(t);return e?e.map(l):void 0},e.validateSlicerState=function(t){var e=c.Validators.slicerStateValidator.validate(t);return e?e.map(l):void 0},e.validatePlayBookmarkRequest=function(t){var e=c.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateAddBookmarkRequest=function(t){var e=c.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=c.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=c.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(l):void 0},e.validateCaptureBookmarkRequest=function(t){var e=c.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateSettings=function(t){var e=c.Validators.settingsValidator.validate(t);return e?e.map(l):void 0},e.validatePanes=function(t){var e=c.Validators.reportPanesValidator.validate(t);return e?e.map(l):void 0},e.validateBookmarksPane=function(t){var e=c.Validators.bookmarksPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFiltersPane=function(t){var e=c.Validators.filtersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFieldsPane=function(t){var e=c.Validators.fieldsPaneValidator.validate(t);return e?e.map(l):void 0},e.validatePageNavigationPane=function(t){var e=c.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSelectionPane=function(t){var e=c.Validators.selectionPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSyncSlicersPane=function(t){var e=c.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateVisualizationsPane=function(t){var e=c.Validators.visualizationsPaneValidator.validate(t);return e?e.map(l):void 0},e.validateCustomPageSize=function(t){var e=c.Validators.customPageSizeValidator.validate(t);return e?e.map(l):void 0},e.validateExtension=function(t){var e=c.Validators.extensionValidator.validate(t);return e?e.map(l):void 0},e.validateMenuGroupExtension=function(t){var e=c.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(l):void 0},e.validateReportLoad=function(t){var e=c.Validators.reportLoadValidator.validate(t);return e?e.map(l):void 0},e.validateCreateReport=function(t){var e=c.Validators.reportCreateValidator.validate(t);return e?e.map(l):void 0},e.validateDashboardLoad=function(t){var e=c.Validators.dashboardLoadValidator.validate(t);return e?e.map(l):void 0},e.validateTileLoad=function(t){var e=c.Validators.tileLoadValidator.validate(t);return e?e.map(l):void 0},e.validatePage=function(t){var e=c.Validators.pageValidator.validate(t);return e?e.map(l):void 0},e.validateFilter=function(t){var e=c.Validators.filtersValidator.validate(t);return e?e.map(l):void 0},e.validateSaveAsParameters=function(t){var e=c.Validators.saveAsParametersValidator.validate(t);return e?e.map(l):void 0},e.validateLoadQnaConfiguration=function(t){var e=c.Validators.loadQnaValidator.validate(t);return e?e.map(l):void 0},e.validateQnaInterpretInputData=function(t){var e=c.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(l):void 0},e.validateExportDataRequest=function(t){var e=c.Validators.exportDataRequestValidator.validate(t);return e?e.map(l):void 0},e.validateVisualHeader=function(t){var e=c.Validators.visualHeaderValidator.validate(t);return e?e.map(l):void 0},e.validateVisualSettings=function(t){var e=c.Validators.visualSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCommandsSettings=function(t){var e=c.Validators.commandsSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCustomTheme=function(t){var e=c.Validators.customThemeValidator.validate(t);return e?e.map(l):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,r){return i(this,void 0,void 0,function(){return o(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},r)];case 1:return[2,!a.sent().body];case 2:throw a.sent().body;case 3:return[2]}})})},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=a,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{ -value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))(function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a["throw"](t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,l)}s((a=a.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){function r(t){return function(r){return function(t){if(a)throw new TypeError("Generator is already executing.");for(;l;)try{if(a=1,i&&(o=2&t[0]?i["return"]:t[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,t[1])).done)return o;switch(i=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,i=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(o=l.trys,!((o=o.length>0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),i=o[1]?y(o[1]):""),s?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(-1!==(a=t.indexOf("?"))){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r x.element === element, this.embeds); if (!component) { - throw new Error(`Attempted to embed using config ${JSON.stringify(config)} on element ${element.outerHTML} which already has embedded comopnent associated, but could not find the existing comopnent in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.`); + throw new Error(`Attempted to embed using config ${JSON.stringify(config)} on element ${element.outerHTML} which already has embedded component associated, but could not find the existing component in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.`); } // TODO: Multiple embedding to the same iframe is not supported in QnA @@ -508,7 +508,7 @@ export class Service implements IService { iframe.remove(); } else { - /** Workaround for IE: unhandled rejection TypeError: object doesn't support propert or method 'remove' */ + /** Workaround for IE: unhandled rejection TypeError: object doesn't support property or method 'remove' */ iframe.parentElement.removeChild(iframe); } } diff --git a/src/util.ts b/src/util.ts index 0b0de8ae..bc84e731 100644 --- a/src/util.ts +++ b/src/util.ts @@ -110,7 +110,7 @@ export function createRandomString(): string { } /** - * Generates a 20 charachter uuid. + * Generates a 20 character uuid. * * @export * @returns {string} diff --git a/src/visualDescriptor.ts b/src/visualDescriptor.ts index 764213ef..8836b32e 100644 --- a/src/visualDescriptor.ts +++ b/src/visualDescriptor.ts @@ -47,7 +47,7 @@ export class VisualDescriptor implements IVisualNode, IFilterable { type: string; /** - * The visual layout: position, size and visiblity. + * The visual layout: position, size and visibility. * * @type {string} */ From b07359b9c18ec242150ca6733b699017529ecb1b Mon Sep 17 00:00:00 2001 From: Anant Singh Date: Thu, 24 Dec 2020 13:16:55 +0000 Subject: [PATCH 18/23] Merged PR 135765: Fix bug with minified version of output bundle Removed gulp-uglify package as it introduced the bug in the minified file. We are now just using the webpack's production mode to generate minified bundle --- dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 4 ++-- dist/powerbi.min.js | 20 ++++++++++---------- gulpfile.js | 4 ---- package.json | 3 +-- src/config.ts | 2 +- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 418a2094..866833ae 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.1 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.2 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index 17ccd31d..03ae6229 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.1 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.2 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -5864,7 +5864,7 @@ exports.BookmarksManager = BookmarksManager; Object.defineProperty(exports, "__esModule", { value: true }); /** @ignore */ /** */ var config = { - version: '2.16.1', + version: '2.16.2', type: 'js' }; exports.default = config; diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 11125637..d0f38b8f 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,10 +1,10 @@ -/*! powerbi-client v2.16.1 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(window,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=12)}([function(t,e,r){/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ -var a;window,a=function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:a})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(e.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(a,i,function(e){return t[e]}.bind(null,i));return a},e.n=function(t){var r=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function a(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?u.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?u.Advanced:u.Unknown}function i(t){return!(!t.table||!t.column||t.aggregationFunction)}function o(t){return t&&!!t.groupName}function n(t){return Array.isArray(t)}function l(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}var s,d=this&&this.__extends||(s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var u,c=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(u=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var p=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=p;var f=function(t){function e(r,a,i){var o=t.call(this,r,u.Unknown)||this;return o.message=a,o.notSupportedTypeName=i,o.schemaUrl=e.schemaUrl,o}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(p);e.NotSupportedFilter=f;var h=function(t){function e(r,a,i){var o=t.call(this,r,u.IncludeExclude)||this;return o.values=i,o.isExclude=a,o.schemaUrl=e.schemaUrl,o}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(p);e.IncludeExcludeFilter=h;var v=function(t){function e(r,a,i,o){var n=t.call(this,r,u.TopN)||this;return n.operator=a,n.itemCount=i,n.schemaUrl=e.schemaUrl,n.orderBy=o,n}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(p);e.TopNFilter=v;var y=function(t){function e(r,a,i,o,n){var l=t.call(this,r,u.RelativeDate)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=o,l.includeToday=n,l.schemaUrl=e.schemaUrl,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(p);e.RelativeDateFilter=y;var m=function(t){function e(r,a,i,o){var n=t.call(this,r,u.RelativeTime)||this;return n.operator=a,n.timeUnitsCount=i,n.timeUnitType=o,n.schemaUrl=e.schemaUrl,n}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(p);e.RelativeTimeFilter=m;var V=function(t){function e(r,a){for(var i=[],o=2;o0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===n.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return l.conditions=n,l}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(p);e.AdvancedFilter=w,e.isFilterKeyColumnsTarget=function(t){return i(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return a(t)===u.Basic&&!!t.keyValues},e.getFilterType=a,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=i,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var P=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=P;var _=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(P);e.PageSelector=_;var S=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(P);e.VisualSelector=S;var E=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.visualType=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(P);e.VisualTypeSelector=E;var O=function(t){function e(e){var r=t.call(this,S.schemaUrl)||this;return r.target=e,r}return d(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(P);e.SlicerTargetSelector=O,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!o(t)},e.isGroupedMenuExtension=o,e.isIExtensions=function(t){return t&&!n(t)},e.isIExtensionArray=n,e.validateVisualSelector=function(t){var e=c.Validators.visualSelectorValidator.validate(t);return e?e.map(l):void 0},e.validateSlicer=function(t){var e=c.Validators.slicerValidator.validate(t);return e?e.map(l):void 0},e.validateSlicerState=function(t){var e=c.Validators.slicerStateValidator.validate(t);return e?e.map(l):void 0},e.validatePlayBookmarkRequest=function(t){var e=c.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateAddBookmarkRequest=function(t){var e=c.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=c.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(l):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=c.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(l):void 0},e.validateCaptureBookmarkRequest=function(t){var e=c.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(l):void 0},e.validateSettings=function(t){var e=c.Validators.settingsValidator.validate(t);return e?e.map(l):void 0},e.validatePanes=function(t){var e=c.Validators.reportPanesValidator.validate(t);return e?e.map(l):void 0},e.validateBookmarksPane=function(t){var e=c.Validators.bookmarksPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFiltersPane=function(t){var e=c.Validators.filtersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateFieldsPane=function(t){var e=c.Validators.fieldsPaneValidator.validate(t);return e?e.map(l):void 0},e.validatePageNavigationPane=function(t){var e=c.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSelectionPane=function(t){var e=c.Validators.selectionPaneValidator.validate(t);return e?e.map(l):void 0},e.validateSyncSlicersPane=function(t){var e=c.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(l):void 0},e.validateVisualizationsPane=function(t){var e=c.Validators.visualizationsPaneValidator.validate(t);return e?e.map(l):void 0},e.validateCustomPageSize=function(t){var e=c.Validators.customPageSizeValidator.validate(t);return e?e.map(l):void 0},e.validateExtension=function(t){var e=c.Validators.extensionValidator.validate(t);return e?e.map(l):void 0},e.validateMenuGroupExtension=function(t){var e=c.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(l):void 0},e.validateReportLoad=function(t){var e=c.Validators.reportLoadValidator.validate(t);return e?e.map(l):void 0},e.validateCreateReport=function(t){var e=c.Validators.reportCreateValidator.validate(t);return e?e.map(l):void 0},e.validateDashboardLoad=function(t){var e=c.Validators.dashboardLoadValidator.validate(t);return e?e.map(l):void 0},e.validateTileLoad=function(t){var e=c.Validators.tileLoadValidator.validate(t);return e?e.map(l):void 0},e.validatePage=function(t){var e=c.Validators.pageValidator.validate(t);return e?e.map(l):void 0},e.validateFilter=function(t){var e=c.Validators.filtersValidator.validate(t);return e?e.map(l):void 0},e.validateSaveAsParameters=function(t){var e=c.Validators.saveAsParametersValidator.validate(t);return e?e.map(l):void 0},e.validateLoadQnaConfiguration=function(t){var e=c.Validators.loadQnaValidator.validate(t);return e?e.map(l):void 0},e.validateQnaInterpretInputData=function(t){var e=c.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(l):void 0},e.validateExportDataRequest=function(t){var e=c.Validators.exportDataRequestValidator.validate(t);return e?e.map(l):void 0},e.validateVisualHeader=function(t){var e=c.Validators.visualHeaderValidator.validate(t);return e?e.map(l):void 0},e.validateVisualSettings=function(t){var e=c.Validators.visualSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCommandsSettings=function(t){var e=c.Validators.commandsSettingsValidator.validate(t);return e?e.map(l):void 0},e.validateCustomTheme=function(t){var e=c.Validators.customThemeValidator.validate(t);return e?e.map(l):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,r){return i(this,void 0,void 0,function(){return o(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},r)];case 1:return[2,!a.sent().body];case 2:throw a.sent().body;case 3:return[2]}})})},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=a,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{ -value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))(function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a["throw"](t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,l)}s((a=a.apply(t,e||[])).next())})},n=this&&this.__generator||function(t,e){function r(t){return function(r){return function(t){if(a)throw new TypeError("Generator is already executing.");for(;l;)try{if(a=1,i&&(o=2&t[0]?i["return"]:t[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,t[1])).done)return o;switch(i=0,o&&(t=[2&t[0],o.value]),t[0]){case 0:case 1:o=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,i=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(o=l.trys,!((o=o.length>0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]0&&o[o.length-1])||6!==t[0]&&2!==t[0])){l=0;continue}if(3===t[0]&&(!o||t[1]>o[0]&&t[1]2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),i=o[1]?y(o[1]):""),s?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(-1!==(a=t.indexOf("?"))){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),i=o[1]?V(o[1]):""),s?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(-1!==(a=t.indexOf("?"))){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r Date: Wed, 30 Dec 2020 07:17:22 +0000 Subject: [PATCH 19/23] Merged PR 136125: Fix return type of exportData method Changed return type to `Promise` --- dist/powerbi-client.d.ts | 4 ++-- dist/powerbi.js | 2 +- src/visualDescriptor.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 866833ae..33194670 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -655,9 +655,9 @@ declare module "visualDescriptor" { * .then(data => { ... }); * ``` * - * @returns {(Promise)} + * @returns {(Promise)} */ - exportData(exportDataType?: models.ExportDataType, rows?: number): Promise; + exportData(exportDataType?: models.ExportDataType, rows?: number): Promise; /** * Set slicer state. * Works only for visuals of type slicer. diff --git a/dist/powerbi.js b/dist/powerbi.js index 03ae6229..bffa38d2 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -9560,7 +9560,7 @@ var VisualDescriptor = /** @class */ (function () { * .then(data => { ... }); * ``` * - * @returns {(Promise)} + * @returns {(Promise)} */ VisualDescriptor.prototype.exportData = function (exportDataType, rows) { return __awaiter(this, void 0, void 0, function () { diff --git a/src/visualDescriptor.ts b/src/visualDescriptor.ts index 8836b32e..29a7be1c 100644 --- a/src/visualDescriptor.ts +++ b/src/visualDescriptor.ts @@ -132,16 +132,16 @@ export class VisualDescriptor implements IVisualNode, IFilterable { * .then(data => { ... }); * ``` * - * @returns {(Promise)} + * @returns {(Promise)} */ - async exportData(exportDataType?: models.ExportDataType, rows?: number): Promise { - let exportDataRequestBody: models.IExportDataRequest = { + async exportData(exportDataType?: models.ExportDataType, rows?: number): Promise { + const exportDataRequestBody: models.IExportDataRequest = { rows: rows, exportDataType: exportDataType }; try { - const response = await this.page.report.service.hpm.post(`/report/pages/${this.page.name}/visuals/${this.name}/exportData`, exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); + const response = await this.page.report.service.hpm.post(`/report/pages/${this.page.name}/visuals/${this.name}/exportData`, exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow); return response.body; } catch (response) { throw response.body; From 194de2f843c722f96e34de490179096a87b6d762 Mon Sep 17 00:00:00 2001 From: Shahak Yosef Date: Wed, 30 Dec 2020 09:23:51 +0000 Subject: [PATCH 20/23] Merged PR 136313: 2.16.3 global this Between versions 2.15.1 and 2.16.1 Webpack version was updated which caused the compiled JS code to use the window object instead of the global `this` object. `window` object is not defined in Node.JS so when I tried to update the version used by the front end E2E tests I got the following error: It might also be the reason why the travis build fails the `npm install` in Github. ![e2e.PNG](https://powerbi.visualstudio.com/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/3e42401e-931d-4a96-b4b9-3533d1cf56ce/pullRequests/136311/attachments/e2e.PNG) --- dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 6 +++--- dist/powerbi.min.js | 6 +++--- package.json | 2 +- src/config.ts | 2 +- webpack.config.js | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index 33194670..cb29c41d 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.2 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.3 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index bffa38d2..bd951155 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.2 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.3 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -8,7 +8,7 @@ exports["powerbi-client"] = factory(); else root["powerbi-client"] = factory(); -})(window, function() { +})(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -5864,7 +5864,7 @@ exports.BookmarksManager = BookmarksManager; Object.defineProperty(exports, "__esModule", { value: true }); /** @ignore */ /** */ var config = { - version: '2.16.2', + version: '2.16.3', type: 'js' }; exports.default = config; diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index d0f38b8f..ef01eb03 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,7 +1,7 @@ -/*! powerbi-client v2.16.2 | (c) 2016 Microsoft Corporation MIT */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(window,(function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=12)}([function(t,e,r){ +/*! powerbi-client v2.16.3 | (c) 2016 Microsoft Corporation MIT */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,(function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=12)}([function(t,e,r){ /*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ -var a;window,a=function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var o,n=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(o=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var l=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=l;var s=function(t){function e(r,a,i){var n=t.call(this,r,o.Unknown)||this;return n.message=a,n.notSupportedTypeName=i,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(l);e.NotSupportedFilter=s;var d=function(t){function e(r,a,i){var n=t.call(this,r,o.IncludeExclude)||this;return n.values=i,n.isExclude=a,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(l);e.IncludeExcludeFilter=d;var u=function(t){function e(r,a,i,n){var l=t.call(this,r,o.TopN)||this;return l.operator=a,l.itemCount=i,l.schemaUrl=e.schemaUrl,l.orderBy=n,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(l);e.TopNFilter=u;var c=function(t){function e(r,a,i,n,l){var s=t.call(this,r,o.RelativeDate)||this;return s.operator=a,s.timeUnitsCount=i,s.timeUnitType=n,s.includeToday=l,s.schemaUrl=e.schemaUrl,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(l);e.RelativeDateFilter=c;var p=function(t){function e(r,a,i,n){var l=t.call(this,r,o.RelativeTime)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=n,l.schemaUrl=e.schemaUrl,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(l);e.RelativeTimeFilter=p;var f=function(t){function e(r,a){for(var i=[],n=2;n0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] Date: Wed, 30 Dec 2020 10:47:16 +0000 Subject: [PATCH 21/23] Merged PR 126798: Migrate to eslint and TypeScript v4 ## Changes in the PR - Configured eslint - Upgraded typescript to v4 Related work items: #462609, #502381 --- .eslintrc.js | 254 + dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 16173 ++++++++++++++++++----------------- dist/powerbi.min.js | 4 +- gulpfile.js | 162 +- package.json | 13 +- src/config.ts | 2 +- tslint.json | 26 - webpack.test.tsconfig.json | 1 - 9 files changed, 8436 insertions(+), 8201 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 tslint.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..5e6d4467 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,254 @@ +// TODO: Remove "warn" settings for the rules after resolving them +module.exports = { + "env": { + "browser": true, + "node": true + }, + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "webpack.test.tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "eslint-plugin-jsdoc", + "eslint-plugin-prefer-arrow", + "eslint-plugin-import", + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/adjacent-overload-signatures": "warn", + "@typescript-eslint/array-type": [ + "warn", + { + "default": "array-simple" + } + ], + "@typescript-eslint/await-thenable": "warn", + "@typescript-eslint/ban-ts-comment": "warn", + "@typescript-eslint/ban-types": [ + "warn", + { + "types": { + "Object": { + "message": "Avoid using the `Object` type. Did you mean `object`?" + }, + "Function": { + "message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`." + }, + "Boolean": { + "message": "Avoid using the `Boolean` type. Did you mean `boolean`?" + }, + "Number": { + "message": "Avoid using the `Number` type. Did you mean `number`?" + }, + "String": { + "message": "Avoid using the `String` type. Did you mean `string`?" + }, + "Symbol": { + "message": "Avoid using the `Symbol` type. Did you mean `symbol`?" + } + } + } + ], + "@typescript-eslint/consistent-type-assertions": "warn", + "@typescript-eslint/consistent-type-definitions": "warn", + "@typescript-eslint/dot-notation": "warn", + "@typescript-eslint/explicit-member-accessibility": [ + "off", + { + "accessibility": "explicit" + } + ], + "@typescript-eslint/explicit-module-boundary-types": "warn", + "@typescript-eslint/indent": [ + "warn", + 2, + { + "FunctionDeclaration": { + "parameters": "first" + }, + "FunctionExpression": { + "parameters": "first" + } + } + ], + "@typescript-eslint/member-delimiter-style": [ + "warn", + { + "multiline": { + "delimiter": "semi", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/member-ordering": "warn", + "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/no-array-constructor": "warn", + "@typescript-eslint/no-empty-function": "warn", + "@typescript-eslint/no-empty-interface": "warn", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-extra-non-null-assertion": "warn", + "@typescript-eslint/no-extra-semi": "warn", + "@typescript-eslint/no-floating-promises": "warn", + "@typescript-eslint/no-for-in-array": "warn", + "@typescript-eslint/no-implied-eval": "warn", + "@typescript-eslint/no-inferrable-types": "warn", + "@typescript-eslint/no-misused-new": "warn", + "@typescript-eslint/no-misused-promises": "warn", + "@typescript-eslint/no-namespace": "warn", + "@typescript-eslint/no-non-null-asserted-optional-chain": "warn", + "@typescript-eslint/no-non-null-assertion": "warn", + "@typescript-eslint/no-parameter-properties": "off", + "@typescript-eslint/no-this-alias": "warn", + "@typescript-eslint/no-unnecessary-type-assertion": "warn", + "@typescript-eslint/no-unsafe-assignment": "warn", + "@typescript-eslint/no-unsafe-call": "warn", + "@typescript-eslint/no-unsafe-member-access": "warn", + "@typescript-eslint/no-unsafe-return": "warn", + "@typescript-eslint/no-unused-expressions": "warn", + "@typescript-eslint/no-unused-vars": "warn", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-var-requires": "warn", + "@typescript-eslint/prefer-as-const": "warn", + "@typescript-eslint/prefer-for-of": "warn", + "@typescript-eslint/prefer-function-type": "warn", + "@typescript-eslint/prefer-namespace-keyword": "warn", + "@typescript-eslint/prefer-regexp-exec": "warn", + "@typescript-eslint/quotes": [ + "off", + { + "avoidEscape": true + } + ], + "@typescript-eslint/require-await": "warn", + "@typescript-eslint/restrict-plus-operands": "warn", + "@typescript-eslint/restrict-template-expressions": "warn", + "@typescript-eslint/semi": [ + "warn", + "always" + ], + "@typescript-eslint/triple-slash-reference": [ + "warn", + { + "path": "always", + "types": "prefer-import", + "lib": "always" + } + ], + "@typescript-eslint/type-annotation-spacing": "warn", + "@typescript-eslint/unbound-method": "warn", + "@typescript-eslint/unified-signatures": "warn", + "arrow-body-style": "warn", + "arrow-parens": [ + "warn", + "always" + ], + "brace-style": [ + "off", + "1tbs" + ], + "comma-dangle": "off", + "complexity": "off", + "constructor-super": "warn", + "curly": "warn", + "eol-last": "warn", + "eqeqeq": [ + "warn", + "smart" + ], + "guard-for-in": "warn", + "id-blacklist": [ + "warn", + "any", + "Number", + "number", + "String", + "string", + "Boolean", + "boolean", + "Undefined", + "undefined" + ], + "id-match": "warn", + "import/order": "warn", + "jsdoc/check-alignment": "warn", + "jsdoc/check-indentation": "warn", + "jsdoc/newline-after-description": "warn", + "max-classes-per-file": [ + "warn", + 1 + ], + "max-len": "off", + "new-parens": "warn", + "no-array-constructor": "off", + "no-bitwise": "warn", + "no-caller": "warn", + "no-cond-assign": "warn", + "no-console": "off", + "no-debugger": "warn", + "no-empty": "warn", + "no-empty-function": "off", + "no-eval": "warn", + "no-extra-semi": "off", + "no-fallthrough": "off", + "no-implied-eval": "off", + "no-invalid-this": "off", + "no-multiple-empty-lines": "warn", + "no-new-wrappers": "warn", + "no-shadow": [ + "warn", + { + "hoist": "all" + } + ], + "no-throw-literal": "warn", + "no-trailing-spaces": "warn", + "no-undef-init": "warn", + "no-underscore-dangle": "warn", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-unused-vars": "off", + "no-var": "warn", + "object-shorthand": "warn", + "one-var": [ + "warn", + "never" + ], + "prefer-arrow/prefer-arrow-functions": "warn", + "prefer-const": "warn", + "prefer-rest-params": "warn", + "quote-props": [ + "warn", + "consistent-as-needed" + ], + "radix": "warn", + "require-await": "off", + "space-before-function-paren": [ + "warn", + { + "anonymous": "never", + "asyncArrow": "always", + "named": "never" + } + ], + "spaced-comment": [ + "warn", + "always", + { + "markers": [ + "/" + ] + } + ], + "use-isnan": "warn", + "valid-typeof": "off" + } +}; diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index cb29c41d..c8a29da1 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.3 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.4 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index bd951155..041303e1 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.3 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.4 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -384,4090 +384,4090 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0; -var validator_1 = __webpack_require__(1); -var TraceType; -(function (TraceType) { - TraceType[TraceType["Information"] = 0] = "Information"; - TraceType[TraceType["Verbose"] = 1] = "Verbose"; - TraceType[TraceType["Warning"] = 2] = "Warning"; - TraceType[TraceType["Error"] = 3] = "Error"; - TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError"; - TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError"; - TraceType[TraceType["Fatal"] = 6] = "Fatal"; -})(TraceType = exports.TraceType || (exports.TraceType = {})); -var PageSizeType; -(function (PageSizeType) { - PageSizeType[PageSizeType["Widescreen"] = 0] = "Widescreen"; - PageSizeType[PageSizeType["Standard"] = 1] = "Standard"; - PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana"; - PageSizeType[PageSizeType["Letter"] = 3] = "Letter"; - PageSizeType[PageSizeType["Custom"] = 4] = "Custom"; -})(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {})); -var DisplayOption; -(function (DisplayOption) { - DisplayOption[DisplayOption["FitToPage"] = 0] = "FitToPage"; - DisplayOption[DisplayOption["FitToWidth"] = 1] = "FitToWidth"; - DisplayOption[DisplayOption["ActualSize"] = 2] = "ActualSize"; -})(DisplayOption = exports.DisplayOption || (exports.DisplayOption = {})); -var BackgroundType; -(function (BackgroundType) { - BackgroundType[BackgroundType["Default"] = 0] = "Default"; - BackgroundType[BackgroundType["Transparent"] = 1] = "Transparent"; -})(BackgroundType = exports.BackgroundType || (exports.BackgroundType = {})); -var VisualContainerDisplayMode; -(function (VisualContainerDisplayMode) { - VisualContainerDisplayMode[VisualContainerDisplayMode["Visible"] = 0] = "Visible"; - VisualContainerDisplayMode[VisualContainerDisplayMode["Hidden"] = 1] = "Hidden"; -})(VisualContainerDisplayMode = exports.VisualContainerDisplayMode || (exports.VisualContainerDisplayMode = {})); -var LayoutType; -(function (LayoutType) { - LayoutType[LayoutType["Master"] = 0] = "Master"; - LayoutType[LayoutType["Custom"] = 1] = "Custom"; - LayoutType[LayoutType["MobilePortrait"] = 2] = "MobilePortrait"; - LayoutType[LayoutType["MobileLandscape"] = 3] = "MobileLandscape"; -})(LayoutType = exports.LayoutType || (exports.LayoutType = {})); -var HyperlinkClickBehavior; -(function (HyperlinkClickBehavior) { - HyperlinkClickBehavior[HyperlinkClickBehavior["Navigate"] = 0] = "Navigate"; - HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent"; - HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent"; -})(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {})); -var SectionVisibility; -(function (SectionVisibility) { - SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible"; - SectionVisibility[SectionVisibility["HiddenInViewMode"] = 1] = "HiddenInViewMode"; -})(SectionVisibility = exports.SectionVisibility || (exports.SectionVisibility = {})); -var Permissions; -(function (Permissions) { - Permissions[Permissions["Read"] = 0] = "Read"; - Permissions[Permissions["ReadWrite"] = 1] = "ReadWrite"; - Permissions[Permissions["Copy"] = 2] = "Copy"; - Permissions[Permissions["Create"] = 4] = "Create"; - Permissions[Permissions["All"] = 7] = "All"; -})(Permissions = exports.Permissions || (exports.Permissions = {})); -var ViewMode; -(function (ViewMode) { - ViewMode[ViewMode["View"] = 0] = "View"; - ViewMode[ViewMode["Edit"] = 1] = "Edit"; -})(ViewMode = exports.ViewMode || (exports.ViewMode = {})); -var TokenType; -(function (TokenType) { - TokenType[TokenType["Aad"] = 0] = "Aad"; - TokenType[TokenType["Embed"] = 1] = "Embed"; -})(TokenType = exports.TokenType || (exports.TokenType = {})); -var ContrastMode; -(function (ContrastMode) { - ContrastMode[ContrastMode["None"] = 0] = "None"; - ContrastMode[ContrastMode["HighContrast1"] = 1] = "HighContrast1"; - ContrastMode[ContrastMode["HighContrast2"] = 2] = "HighContrast2"; - ContrastMode[ContrastMode["HighContrastBlack"] = 3] = "HighContrastBlack"; - ContrastMode[ContrastMode["HighContrastWhite"] = 4] = "HighContrastWhite"; -})(ContrastMode = exports.ContrastMode || (exports.ContrastMode = {})); -var MenuLocation; -(function (MenuLocation) { - MenuLocation[MenuLocation["Bottom"] = 0] = "Bottom"; - MenuLocation[MenuLocation["Top"] = 1] = "Top"; -})(MenuLocation = exports.MenuLocation || (exports.MenuLocation = {})); -var FiltersLevel; -(function (FiltersLevel) { - FiltersLevel[FiltersLevel["Report"] = 0] = "Report"; - FiltersLevel[FiltersLevel["Page"] = 1] = "Page"; - FiltersLevel[FiltersLevel["Visual"] = 2] = "Visual"; -})(FiltersLevel = exports.FiltersLevel || (exports.FiltersLevel = {})); -var FilterType; -(function (FilterType) { - FilterType[FilterType["Advanced"] = 0] = "Advanced"; - FilterType[FilterType["Basic"] = 1] = "Basic"; - FilterType[FilterType["Unknown"] = 2] = "Unknown"; - FilterType[FilterType["IncludeExclude"] = 3] = "IncludeExclude"; - FilterType[FilterType["RelativeDate"] = 4] = "RelativeDate"; - FilterType[FilterType["TopN"] = 5] = "TopN"; - FilterType[FilterType["Tuple"] = 6] = "Tuple"; - FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime"; -})(FilterType = exports.FilterType || (exports.FilterType = {})); -var RelativeDateFilterTimeUnit; -(function (RelativeDateFilterTimeUnit) { - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Days"] = 0] = "Days"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Weeks"] = 1] = "Weeks"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarWeeks"] = 2] = "CalendarWeeks"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Months"] = 3] = "Months"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarMonths"] = 4] = "CalendarMonths"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Years"] = 5] = "Years"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarYears"] = 6] = "CalendarYears"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Minutes"] = 7] = "Minutes"; - RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Hours"] = 8] = "Hours"; -})(RelativeDateFilterTimeUnit = exports.RelativeDateFilterTimeUnit || (exports.RelativeDateFilterTimeUnit = {})); -var RelativeDateOperators; -(function (RelativeDateOperators) { - RelativeDateOperators[RelativeDateOperators["InLast"] = 0] = "InLast"; - RelativeDateOperators[RelativeDateOperators["InThis"] = 1] = "InThis"; - RelativeDateOperators[RelativeDateOperators["InNext"] = 2] = "InNext"; -})(RelativeDateOperators = exports.RelativeDateOperators || (exports.RelativeDateOperators = {})); -var Filter = /** @class */ (function () { - function Filter(target, filterType) { - this.target = target; - this.filterType = filterType; - } - Filter.prototype.toJSON = function () { - var filter = { - $schema: this.schemaUrl, - target: this.target, - filterType: this.filterType - }; - // Add displaySettings only when defined - if (this.displaySettings !== undefined) { - filter.displaySettings = this.displaySettings; - } - return filter; - }; - return Filter; -}()); -exports.Filter = Filter; -var NotSupportedFilter = /** @class */ (function (_super) { - __extends(NotSupportedFilter, _super); - function NotSupportedFilter(target, message, notSupportedTypeName) { - var _this = _super.call(this, target, FilterType.Unknown) || this; - _this.message = message; - _this.notSupportedTypeName = notSupportedTypeName; - _this.schemaUrl = NotSupportedFilter.schemaUrl; - return _this; - } - NotSupportedFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.message = this.message; - filter.notSupportedTypeName = this.notSupportedTypeName; - return filter; - }; - NotSupportedFilter.schemaUrl = "http://powerbi.com/product/schema#notSupported"; - return NotSupportedFilter; -}(Filter)); -exports.NotSupportedFilter = NotSupportedFilter; -var IncludeExcludeFilter = /** @class */ (function (_super) { - __extends(IncludeExcludeFilter, _super); - function IncludeExcludeFilter(target, isExclude, values) { - var _this = _super.call(this, target, FilterType.IncludeExclude) || this; - _this.values = values; - _this.isExclude = isExclude; - _this.schemaUrl = IncludeExcludeFilter.schemaUrl; - return _this; - } - IncludeExcludeFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.isExclude = this.isExclude; - filter.values = this.values; - return filter; - }; - IncludeExcludeFilter.schemaUrl = "http://powerbi.com/product/schema#includeExclude"; - return IncludeExcludeFilter; -}(Filter)); -exports.IncludeExcludeFilter = IncludeExcludeFilter; -var TopNFilter = /** @class */ (function (_super) { - __extends(TopNFilter, _super); - function TopNFilter(target, operator, itemCount, orderBy) { - var _this = _super.call(this, target, FilterType.TopN) || this; - _this.operator = operator; - _this.itemCount = itemCount; - _this.schemaUrl = TopNFilter.schemaUrl; - _this.orderBy = orderBy; - return _this; - } - TopNFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.itemCount = this.itemCount; - filter.orderBy = this.orderBy; - return filter; - }; - TopNFilter.schemaUrl = "http://powerbi.com/product/schema#topN"; - return TopNFilter; -}(Filter)); -exports.TopNFilter = TopNFilter; -var RelativeDateFilter = /** @class */ (function (_super) { - __extends(RelativeDateFilter, _super); - function RelativeDateFilter(target, operator, timeUnitsCount, timeUnitType, includeToday) { - var _this = _super.call(this, target, FilterType.RelativeDate) || this; - _this.operator = operator; - _this.timeUnitsCount = timeUnitsCount; - _this.timeUnitType = timeUnitType; - _this.includeToday = includeToday; - _this.schemaUrl = RelativeDateFilter.schemaUrl; - return _this; - } - RelativeDateFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.timeUnitsCount = this.timeUnitsCount; - filter.timeUnitType = this.timeUnitType; - filter.includeToday = this.includeToday; - return filter; - }; - RelativeDateFilter.schemaUrl = "http://powerbi.com/product/schema#relativeDate"; - return RelativeDateFilter; -}(Filter)); -exports.RelativeDateFilter = RelativeDateFilter; -var RelativeTimeFilter = /** @class */ (function (_super) { - __extends(RelativeTimeFilter, _super); - function RelativeTimeFilter(target, operator, timeUnitsCount, timeUnitType) { - var _this = _super.call(this, target, FilterType.RelativeTime) || this; - _this.operator = operator; - _this.timeUnitsCount = timeUnitsCount; - _this.timeUnitType = timeUnitType; - _this.schemaUrl = RelativeTimeFilter.schemaUrl; - return _this; - } - RelativeTimeFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.timeUnitsCount = this.timeUnitsCount; - filter.timeUnitType = this.timeUnitType; - return filter; - }; - RelativeTimeFilter.schemaUrl = "http://powerbi.com/product/schema#relativeTime"; - return RelativeTimeFilter; -}(Filter)); -exports.RelativeTimeFilter = RelativeTimeFilter; -var BasicFilter = /** @class */ (function (_super) { - __extends(BasicFilter, _super); - function BasicFilter(target, operator) { - var values = []; - for (var _i = 2; _i < arguments.length; _i++) { - values[_i - 2] = arguments[_i]; - } - var _this = _super.call(this, target, FilterType.Basic) || this; - _this.operator = operator; - _this.schemaUrl = BasicFilter.schemaUrl; - if (values.length === 0 && operator !== "All") { - throw new Error("values must be a non-empty array unless your operator is \"All\"."); - } - /** - * Accept values as array instead of as individual arguments - * new BasicFilter('a', 'b', 1, 2); - * new BasicFilter('a', 'b', [1,2]); - */ - if (Array.isArray(values[0])) { - _this.values = values[0]; - } - else { - _this.values = values; - } - return _this; - } - BasicFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.values = this.values; - filter.requireSingleSelection = !!this.requireSingleSelection; - return filter; - }; - BasicFilter.schemaUrl = "http://powerbi.com/product/schema#basic"; - return BasicFilter; -}(Filter)); -exports.BasicFilter = BasicFilter; -var BasicFilterWithKeys = /** @class */ (function (_super) { - __extends(BasicFilterWithKeys, _super); - function BasicFilterWithKeys(target, operator, values, keyValues) { - var _this = _super.call(this, target, operator, values) || this; - _this.keyValues = keyValues; - _this.target = target; - var numberOfKeys = target.keys ? target.keys.length : 0; - if (numberOfKeys > 0 && !keyValues) { - throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys"); - } - if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { - throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); - } - for (var _i = 0, _a = _this.keyValues; _i < _a.length; _i++) { - var keyValue = _a[_i]; - if (keyValue) { - var lengthOfArray = keyValue.length; - if (lengthOfArray !== numberOfKeys) { - throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); - } - } - } - return _this; - } - BasicFilterWithKeys.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.keyValues = this.keyValues; - return filter; - }; - return BasicFilterWithKeys; -}(BasicFilter)); -exports.BasicFilterWithKeys = BasicFilterWithKeys; -var TupleFilter = /** @class */ (function (_super) { - __extends(TupleFilter, _super); - function TupleFilter(target, operator, values) { - var _this = _super.call(this, target, FilterType.Tuple) || this; - _this.operator = operator; - _this.schemaUrl = TupleFilter.schemaUrl; - _this.values = values; - return _this; - } - TupleFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.operator = this.operator; - filter.values = this.values; - filter.target = this.target; - return filter; - }; - TupleFilter.schemaUrl = "http://powerbi.com/product/schema#tuple"; - return TupleFilter; -}(Filter)); -exports.TupleFilter = TupleFilter; -var AdvancedFilter = /** @class */ (function (_super) { - __extends(AdvancedFilter, _super); - function AdvancedFilter(target, logicalOperator) { - var conditions = []; - for (var _i = 2; _i < arguments.length; _i++) { - conditions[_i - 2] = arguments[_i]; - } - var _this = _super.call(this, target, FilterType.Advanced) || this; - _this.schemaUrl = AdvancedFilter.schemaUrl; - // Guard statements - if (typeof logicalOperator !== "string" || logicalOperator.length === 0) { - // TODO: It would be nicer to list out the possible logical operators. - throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator); - } - _this.logicalOperator = logicalOperator; - var extractedConditions; - /** - * Accept conditions as array instead of as individual arguments - * new AdvancedFilter('a', 'b', "And", { value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }); - * new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]); - */ - if (Array.isArray(conditions[0])) { - extractedConditions = conditions[0]; - } - else { - extractedConditions = conditions; - } - if (extractedConditions.length === 0) { - throw new Error("conditions must be a non-empty array. You passed: " + conditions); - } - if (extractedConditions.length > 2) { - throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length); - } - if (extractedConditions.length === 1 && logicalOperator !== "And") { - throw new Error("Logical Operator must be \"And\" when there is only one condition provided"); - } - _this.conditions = extractedConditions; - return _this; - } - AdvancedFilter.prototype.toJSON = function () { - var filter = _super.prototype.toJSON.call(this); - filter.logicalOperator = this.logicalOperator; - filter.conditions = this.conditions; - return filter; - }; - AdvancedFilter.schemaUrl = "http://powerbi.com/product/schema#advanced"; - return AdvancedFilter; -}(Filter)); -exports.AdvancedFilter = AdvancedFilter; -function isFilterKeyColumnsTarget(target) { - return isColumn(target) && !!target.keys; -} -exports.isFilterKeyColumnsTarget = isFilterKeyColumnsTarget; -function isBasicFilterWithKeys(filter) { - return getFilterType(filter) === FilterType.Basic && !!filter.keyValues; -} -exports.isBasicFilterWithKeys = isBasicFilterWithKeys; -function getFilterType(filter) { - if (filter.filterType) { - return filter.filterType; - } - var basicFilter = filter; - var advancedFilter = filter; - if ((typeof basicFilter.operator === "string") - && (Array.isArray(basicFilter.values))) { - return FilterType.Basic; - } - else if ((typeof advancedFilter.logicalOperator === "string") - && (Array.isArray(advancedFilter.conditions))) { - return FilterType.Advanced; - } - else { - return FilterType.Unknown; - } -} -exports.getFilterType = getFilterType; -function isMeasure(arg) { - return arg.table !== undefined && arg.measure !== undefined; -} -exports.isMeasure = isMeasure; -function isColumn(arg) { - return !!(arg.table && arg.column && !arg.aggregationFunction); -} -exports.isColumn = isColumn; -function isHierarchyLevel(arg) { - return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && !arg.aggregationFunction); -} -exports.isHierarchyLevel = isHierarchyLevel; -function isHierarchyLevelAggr(arg) { - return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && arg.aggregationFunction); -} -exports.isHierarchyLevelAggr = isHierarchyLevelAggr; -function isColumnAggr(arg) { - return !!(arg.table && arg.column && arg.aggregationFunction); -} -exports.isColumnAggr = isColumnAggr; -var PageNavigationPosition; -(function (PageNavigationPosition) { - PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; - PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; -})(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); -var QnaMode; -(function (QnaMode) { - QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; - QnaMode[QnaMode["ResultOnly"] = 1] = "ResultOnly"; -})(QnaMode = exports.QnaMode || (exports.QnaMode = {})); -var ExportDataType; -(function (ExportDataType) { - ExportDataType[ExportDataType["Summarized"] = 0] = "Summarized"; - ExportDataType[ExportDataType["Underlying"] = 1] = "Underlying"; -})(ExportDataType = exports.ExportDataType || (exports.ExportDataType = {})); -var BookmarksPlayMode; -(function (BookmarksPlayMode) { - BookmarksPlayMode[BookmarksPlayMode["Off"] = 0] = "Off"; - BookmarksPlayMode[BookmarksPlayMode["Presentation"] = 1] = "Presentation"; -})(BookmarksPlayMode = exports.BookmarksPlayMode || (exports.BookmarksPlayMode = {})); -// This is not an enum because enum strings require -// us to upgrade typeScript version and change SDK build definition -exports.CommonErrorCodes = { - TokenExpired: 'TokenExpired', - NotFound: 'PowerBIEntityNotFound', - InvalidParameters: 'Invalid parameters', - LoadReportFailed: 'LoadReportFailed', - NotAuthorized: 'PowerBINotAuthorizedException', - FailedToLoadModel: 'ExplorationContainer_FailedToLoadModel_DefaultDetails', -}; -exports.TextAlignment = { - Left: 'left', - Center: 'center', - Right: 'right', -}; -exports.LegendPosition = { - Top: 'Top', - Bottom: 'Bottom', - Right: 'Right', - Left: 'Left', - TopCenter: 'TopCenter', - BottomCenter: 'BottomCenter', - RightCenter: 'RightCenter', - LeftCenter: 'LeftCenter', -}; -var SortDirection; -(function (SortDirection) { - SortDirection[SortDirection["Ascending"] = 1] = "Ascending"; - SortDirection[SortDirection["Descending"] = 2] = "Descending"; -})(SortDirection = exports.SortDirection || (exports.SortDirection = {})); -var Selector = /** @class */ (function () { - function Selector(schema) { - this.$schema = schema; - } - Selector.prototype.toJSON = function () { - return { - $schema: this.$schema - }; - }; - return Selector; -}()); -exports.Selector = Selector; -var PageSelector = /** @class */ (function (_super) { - __extends(PageSelector, _super); - function PageSelector(pageName) { - var _this = _super.call(this, PageSelector.schemaUrl) || this; - _this.pageName = pageName; - return _this; - } - PageSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.pageName = this.pageName; - return selector; - }; - PageSelector.schemaUrl = "http://powerbi.com/product/schema#pageSelector"; - return PageSelector; -}(Selector)); -exports.PageSelector = PageSelector; -var VisualSelector = /** @class */ (function (_super) { - __extends(VisualSelector, _super); - function VisualSelector(visualName) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.visualName = visualName; - return _this; - } - VisualSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.visualName = this.visualName; - return selector; - }; - VisualSelector.schemaUrl = "http://powerbi.com/product/schema#visualSelector"; - return VisualSelector; -}(Selector)); -exports.VisualSelector = VisualSelector; -var VisualTypeSelector = /** @class */ (function (_super) { - __extends(VisualTypeSelector, _super); - function VisualTypeSelector(visualType) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.visualType = visualType; - return _this; - } - VisualTypeSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.visualType = this.visualType; - return selector; - }; - VisualTypeSelector.schemaUrl = "http://powerbi.com/product/schema#visualTypeSelector"; - return VisualTypeSelector; -}(Selector)); -exports.VisualTypeSelector = VisualTypeSelector; -var SlicerTargetSelector = /** @class */ (function (_super) { - __extends(SlicerTargetSelector, _super); - function SlicerTargetSelector(target) { - var _this = _super.call(this, VisualSelector.schemaUrl) || this; - _this.target = target; - return _this; - } - SlicerTargetSelector.prototype.toJSON = function () { - var selector = _super.prototype.toJSON.call(this); - selector.target = this.target; - return selector; - }; - SlicerTargetSelector.schemaUrl = "http://powerbi.com/product/schema#slicerTargetSelector"; - return SlicerTargetSelector; -}(Selector)); -exports.SlicerTargetSelector = SlicerTargetSelector; -var CommandDisplayOption; -(function (CommandDisplayOption) { - CommandDisplayOption[CommandDisplayOption["Enabled"] = 0] = "Enabled"; - CommandDisplayOption[CommandDisplayOption["Disabled"] = 1] = "Disabled"; - CommandDisplayOption[CommandDisplayOption["Hidden"] = 2] = "Hidden"; -})(CommandDisplayOption = exports.CommandDisplayOption || (exports.CommandDisplayOption = {})); -/* - * Visual CRUD - */ -var VisualDataRoleKind; -(function (VisualDataRoleKind) { - // Indicates that the role should be bound to something that evaluates to a grouping of values. - VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping"; - // Indicates that the role should be bound to something that evaluates to a single value in a scope. - VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure"; - // Indicates that the role can be bound to either Grouping or Measure. - VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure"; -})(VisualDataRoleKind = exports.VisualDataRoleKind || (exports.VisualDataRoleKind = {})); -// Indicates the visual preference on Grouping or Measure. Only applicable if kind is GroupingOrMeasure. -var VisualDataRoleKindPreference; -(function (VisualDataRoleKindPreference) { - VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; - VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; -})(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); -function isFlatMenuExtension(menuExtension) { - return menuExtension && !isGroupedMenuExtension(menuExtension); -} -exports.isFlatMenuExtension = isFlatMenuExtension; -function isGroupedMenuExtension(menuExtension) { - return menuExtension && !!menuExtension.groupName; -} -exports.isGroupedMenuExtension = isGroupedMenuExtension; -function isIExtensions(extensions) { - return extensions && !isIExtensionArray(extensions); -} -exports.isIExtensions = isIExtensions; -function isIExtensionArray(extensions) { - return Array.isArray(extensions); -} -exports.isIExtensionArray = isIExtensionArray; -function normalizeError(error) { - var message = error.message; - if (!message) { - message = error.path + " is invalid. Not meeting " + error.keyword + " constraint"; - } - return { - message: message - }; -} -function validateVisualSelector(input) { - var errors = validator_1.Validators.visualSelectorValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateVisualSelector = validateVisualSelector; -function validateSlicer(input) { - var errors = validator_1.Validators.slicerValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateSlicer = validateSlicer; -function validateSlicerState(input) { - var errors = validator_1.Validators.slicerStateValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateSlicerState = validateSlicerState; -function validatePlayBookmarkRequest(input) { - var errors = validator_1.Validators.playBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; -function validateAddBookmarkRequest(input) { - var errors = validator_1.Validators.addBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateAddBookmarkRequest = validateAddBookmarkRequest; -function validateApplyBookmarkByNameRequest(input) { - var errors = validator_1.Validators.applyBookmarkByNameRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; -function validateApplyBookmarkStateRequest(input) { - var errors = validator_1.Validators.applyBookmarkStateRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; -function validateCaptureBookmarkRequest(input) { - var errors = validator_1.Validators.captureBookmarkRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; -function validateSettings(input) { - var errors = validator_1.Validators.settingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateSettings = validateSettings; -function validatePanes(input) { - var errors = validator_1.Validators.reportPanesValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validatePanes = validatePanes; -function validateBookmarksPane(input) { - var errors = validator_1.Validators.bookmarksPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateBookmarksPane = validateBookmarksPane; -function validateFiltersPane(input) { - var errors = validator_1.Validators.filtersPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateFiltersPane = validateFiltersPane; -function validateFieldsPane(input) { - var errors = validator_1.Validators.fieldsPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateFieldsPane = validateFieldsPane; -function validatePageNavigationPane(input) { - var errors = validator_1.Validators.pageNavigationPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validatePageNavigationPane = validatePageNavigationPane; -function validateSelectionPane(input) { - var errors = validator_1.Validators.selectionPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateSelectionPane = validateSelectionPane; -function validateSyncSlicersPane(input) { - var errors = validator_1.Validators.syncSlicersPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateSyncSlicersPane = validateSyncSlicersPane; -function validateVisualizationsPane(input) { - var errors = validator_1.Validators.visualizationsPaneValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateVisualizationsPane = validateVisualizationsPane; -function validateCustomPageSize(input) { - var errors = validator_1.Validators.customPageSizeValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateCustomPageSize = validateCustomPageSize; -function validateExtension(input) { - var errors = validator_1.Validators.extensionValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateExtension = validateExtension; -function validateMenuGroupExtension(input) { - var errors = validator_1.Validators.menuGroupExtensionValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateMenuGroupExtension = validateMenuGroupExtension; -function validateReportLoad(input) { - var errors = validator_1.Validators.reportLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateReportLoad = validateReportLoad; -function validateCreateReport(input) { - var errors = validator_1.Validators.reportCreateValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateCreateReport = validateCreateReport; -function validateDashboardLoad(input) { - var errors = validator_1.Validators.dashboardLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateDashboardLoad = validateDashboardLoad; -function validateTileLoad(input) { - var errors = validator_1.Validators.tileLoadValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateTileLoad = validateTileLoad; -function validatePage(input) { - var errors = validator_1.Validators.pageValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validatePage = validatePage; -function validateFilter(input) { - var errors = validator_1.Validators.filtersValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateFilter = validateFilter; -function validateSaveAsParameters(input) { - var errors = validator_1.Validators.saveAsParametersValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateSaveAsParameters = validateSaveAsParameters; -function validateLoadQnaConfiguration(input) { - var errors = validator_1.Validators.loadQnaValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; -function validateQnaInterpretInputData(input) { - var errors = validator_1.Validators.qnaInterpretInputDataValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateQnaInterpretInputData = validateQnaInterpretInputData; -function validateExportDataRequest(input) { - var errors = validator_1.Validators.exportDataRequestValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateExportDataRequest = validateExportDataRequest; -function validateVisualHeader(input) { - var errors = validator_1.Validators.visualHeaderValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateVisualHeader = validateVisualHeader; -function validateVisualSettings(input) { - var errors = validator_1.Validators.visualSettingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateVisualSettings = validateVisualSettings; -function validateCommandsSettings(input) { - var errors = validator_1.Validators.commandsSettingsValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateCommandsSettings = validateCommandsSettings; -function validateCustomTheme(input) { - var errors = validator_1.Validators.customThemeValidator.validate(input); - return errors ? errors.map(normalizeError) : undefined; -} -exports.validateCustomTheme = validateCustomTheme; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0; +var validator_1 = __webpack_require__(1); +var TraceType; +(function (TraceType) { + TraceType[TraceType["Information"] = 0] = "Information"; + TraceType[TraceType["Verbose"] = 1] = "Verbose"; + TraceType[TraceType["Warning"] = 2] = "Warning"; + TraceType[TraceType["Error"] = 3] = "Error"; + TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError"; + TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError"; + TraceType[TraceType["Fatal"] = 6] = "Fatal"; +})(TraceType = exports.TraceType || (exports.TraceType = {})); +var PageSizeType; +(function (PageSizeType) { + PageSizeType[PageSizeType["Widescreen"] = 0] = "Widescreen"; + PageSizeType[PageSizeType["Standard"] = 1] = "Standard"; + PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana"; + PageSizeType[PageSizeType["Letter"] = 3] = "Letter"; + PageSizeType[PageSizeType["Custom"] = 4] = "Custom"; +})(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {})); +var DisplayOption; +(function (DisplayOption) { + DisplayOption[DisplayOption["FitToPage"] = 0] = "FitToPage"; + DisplayOption[DisplayOption["FitToWidth"] = 1] = "FitToWidth"; + DisplayOption[DisplayOption["ActualSize"] = 2] = "ActualSize"; +})(DisplayOption = exports.DisplayOption || (exports.DisplayOption = {})); +var BackgroundType; +(function (BackgroundType) { + BackgroundType[BackgroundType["Default"] = 0] = "Default"; + BackgroundType[BackgroundType["Transparent"] = 1] = "Transparent"; +})(BackgroundType = exports.BackgroundType || (exports.BackgroundType = {})); +var VisualContainerDisplayMode; +(function (VisualContainerDisplayMode) { + VisualContainerDisplayMode[VisualContainerDisplayMode["Visible"] = 0] = "Visible"; + VisualContainerDisplayMode[VisualContainerDisplayMode["Hidden"] = 1] = "Hidden"; +})(VisualContainerDisplayMode = exports.VisualContainerDisplayMode || (exports.VisualContainerDisplayMode = {})); +var LayoutType; +(function (LayoutType) { + LayoutType[LayoutType["Master"] = 0] = "Master"; + LayoutType[LayoutType["Custom"] = 1] = "Custom"; + LayoutType[LayoutType["MobilePortrait"] = 2] = "MobilePortrait"; + LayoutType[LayoutType["MobileLandscape"] = 3] = "MobileLandscape"; +})(LayoutType = exports.LayoutType || (exports.LayoutType = {})); +var HyperlinkClickBehavior; +(function (HyperlinkClickBehavior) { + HyperlinkClickBehavior[HyperlinkClickBehavior["Navigate"] = 0] = "Navigate"; + HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent"; + HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent"; +})(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {})); +var SectionVisibility; +(function (SectionVisibility) { + SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible"; + SectionVisibility[SectionVisibility["HiddenInViewMode"] = 1] = "HiddenInViewMode"; +})(SectionVisibility = exports.SectionVisibility || (exports.SectionVisibility = {})); +var Permissions; +(function (Permissions) { + Permissions[Permissions["Read"] = 0] = "Read"; + Permissions[Permissions["ReadWrite"] = 1] = "ReadWrite"; + Permissions[Permissions["Copy"] = 2] = "Copy"; + Permissions[Permissions["Create"] = 4] = "Create"; + Permissions[Permissions["All"] = 7] = "All"; +})(Permissions = exports.Permissions || (exports.Permissions = {})); +var ViewMode; +(function (ViewMode) { + ViewMode[ViewMode["View"] = 0] = "View"; + ViewMode[ViewMode["Edit"] = 1] = "Edit"; +})(ViewMode = exports.ViewMode || (exports.ViewMode = {})); +var TokenType; +(function (TokenType) { + TokenType[TokenType["Aad"] = 0] = "Aad"; + TokenType[TokenType["Embed"] = 1] = "Embed"; +})(TokenType = exports.TokenType || (exports.TokenType = {})); +var ContrastMode; +(function (ContrastMode) { + ContrastMode[ContrastMode["None"] = 0] = "None"; + ContrastMode[ContrastMode["HighContrast1"] = 1] = "HighContrast1"; + ContrastMode[ContrastMode["HighContrast2"] = 2] = "HighContrast2"; + ContrastMode[ContrastMode["HighContrastBlack"] = 3] = "HighContrastBlack"; + ContrastMode[ContrastMode["HighContrastWhite"] = 4] = "HighContrastWhite"; +})(ContrastMode = exports.ContrastMode || (exports.ContrastMode = {})); +var MenuLocation; +(function (MenuLocation) { + MenuLocation[MenuLocation["Bottom"] = 0] = "Bottom"; + MenuLocation[MenuLocation["Top"] = 1] = "Top"; +})(MenuLocation = exports.MenuLocation || (exports.MenuLocation = {})); +var FiltersLevel; +(function (FiltersLevel) { + FiltersLevel[FiltersLevel["Report"] = 0] = "Report"; + FiltersLevel[FiltersLevel["Page"] = 1] = "Page"; + FiltersLevel[FiltersLevel["Visual"] = 2] = "Visual"; +})(FiltersLevel = exports.FiltersLevel || (exports.FiltersLevel = {})); +var FilterType; +(function (FilterType) { + FilterType[FilterType["Advanced"] = 0] = "Advanced"; + FilterType[FilterType["Basic"] = 1] = "Basic"; + FilterType[FilterType["Unknown"] = 2] = "Unknown"; + FilterType[FilterType["IncludeExclude"] = 3] = "IncludeExclude"; + FilterType[FilterType["RelativeDate"] = 4] = "RelativeDate"; + FilterType[FilterType["TopN"] = 5] = "TopN"; + FilterType[FilterType["Tuple"] = 6] = "Tuple"; + FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime"; +})(FilterType = exports.FilterType || (exports.FilterType = {})); +var RelativeDateFilterTimeUnit; +(function (RelativeDateFilterTimeUnit) { + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Days"] = 0] = "Days"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Weeks"] = 1] = "Weeks"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarWeeks"] = 2] = "CalendarWeeks"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Months"] = 3] = "Months"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarMonths"] = 4] = "CalendarMonths"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Years"] = 5] = "Years"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["CalendarYears"] = 6] = "CalendarYears"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Minutes"] = 7] = "Minutes"; + RelativeDateFilterTimeUnit[RelativeDateFilterTimeUnit["Hours"] = 8] = "Hours"; +})(RelativeDateFilterTimeUnit = exports.RelativeDateFilterTimeUnit || (exports.RelativeDateFilterTimeUnit = {})); +var RelativeDateOperators; +(function (RelativeDateOperators) { + RelativeDateOperators[RelativeDateOperators["InLast"] = 0] = "InLast"; + RelativeDateOperators[RelativeDateOperators["InThis"] = 1] = "InThis"; + RelativeDateOperators[RelativeDateOperators["InNext"] = 2] = "InNext"; +})(RelativeDateOperators = exports.RelativeDateOperators || (exports.RelativeDateOperators = {})); +var Filter = /** @class */ (function () { + function Filter(target, filterType) { + this.target = target; + this.filterType = filterType; + } + Filter.prototype.toJSON = function () { + var filter = { + $schema: this.schemaUrl, + target: this.target, + filterType: this.filterType + }; + // Add displaySettings only when defined + if (this.displaySettings !== undefined) { + filter.displaySettings = this.displaySettings; + } + return filter; + }; + return Filter; +}()); +exports.Filter = Filter; +var NotSupportedFilter = /** @class */ (function (_super) { + __extends(NotSupportedFilter, _super); + function NotSupportedFilter(target, message, notSupportedTypeName) { + var _this = _super.call(this, target, FilterType.Unknown) || this; + _this.message = message; + _this.notSupportedTypeName = notSupportedTypeName; + _this.schemaUrl = NotSupportedFilter.schemaUrl; + return _this; + } + NotSupportedFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.message = this.message; + filter.notSupportedTypeName = this.notSupportedTypeName; + return filter; + }; + NotSupportedFilter.schemaUrl = "http://powerbi.com/product/schema#notSupported"; + return NotSupportedFilter; +}(Filter)); +exports.NotSupportedFilter = NotSupportedFilter; +var IncludeExcludeFilter = /** @class */ (function (_super) { + __extends(IncludeExcludeFilter, _super); + function IncludeExcludeFilter(target, isExclude, values) { + var _this = _super.call(this, target, FilterType.IncludeExclude) || this; + _this.values = values; + _this.isExclude = isExclude; + _this.schemaUrl = IncludeExcludeFilter.schemaUrl; + return _this; + } + IncludeExcludeFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.isExclude = this.isExclude; + filter.values = this.values; + return filter; + }; + IncludeExcludeFilter.schemaUrl = "http://powerbi.com/product/schema#includeExclude"; + return IncludeExcludeFilter; +}(Filter)); +exports.IncludeExcludeFilter = IncludeExcludeFilter; +var TopNFilter = /** @class */ (function (_super) { + __extends(TopNFilter, _super); + function TopNFilter(target, operator, itemCount, orderBy) { + var _this = _super.call(this, target, FilterType.TopN) || this; + _this.operator = operator; + _this.itemCount = itemCount; + _this.schemaUrl = TopNFilter.schemaUrl; + _this.orderBy = orderBy; + return _this; + } + TopNFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.itemCount = this.itemCount; + filter.orderBy = this.orderBy; + return filter; + }; + TopNFilter.schemaUrl = "http://powerbi.com/product/schema#topN"; + return TopNFilter; +}(Filter)); +exports.TopNFilter = TopNFilter; +var RelativeDateFilter = /** @class */ (function (_super) { + __extends(RelativeDateFilter, _super); + function RelativeDateFilter(target, operator, timeUnitsCount, timeUnitType, includeToday) { + var _this = _super.call(this, target, FilterType.RelativeDate) || this; + _this.operator = operator; + _this.timeUnitsCount = timeUnitsCount; + _this.timeUnitType = timeUnitType; + _this.includeToday = includeToday; + _this.schemaUrl = RelativeDateFilter.schemaUrl; + return _this; + } + RelativeDateFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.timeUnitsCount = this.timeUnitsCount; + filter.timeUnitType = this.timeUnitType; + filter.includeToday = this.includeToday; + return filter; + }; + RelativeDateFilter.schemaUrl = "http://powerbi.com/product/schema#relativeDate"; + return RelativeDateFilter; +}(Filter)); +exports.RelativeDateFilter = RelativeDateFilter; +var RelativeTimeFilter = /** @class */ (function (_super) { + __extends(RelativeTimeFilter, _super); + function RelativeTimeFilter(target, operator, timeUnitsCount, timeUnitType) { + var _this = _super.call(this, target, FilterType.RelativeTime) || this; + _this.operator = operator; + _this.timeUnitsCount = timeUnitsCount; + _this.timeUnitType = timeUnitType; + _this.schemaUrl = RelativeTimeFilter.schemaUrl; + return _this; + } + RelativeTimeFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.timeUnitsCount = this.timeUnitsCount; + filter.timeUnitType = this.timeUnitType; + return filter; + }; + RelativeTimeFilter.schemaUrl = "http://powerbi.com/product/schema#relativeTime"; + return RelativeTimeFilter; +}(Filter)); +exports.RelativeTimeFilter = RelativeTimeFilter; +var BasicFilter = /** @class */ (function (_super) { + __extends(BasicFilter, _super); + function BasicFilter(target, operator) { + var values = []; + for (var _i = 2; _i < arguments.length; _i++) { + values[_i - 2] = arguments[_i]; + } + var _this = _super.call(this, target, FilterType.Basic) || this; + _this.operator = operator; + _this.schemaUrl = BasicFilter.schemaUrl; + if (values.length === 0 && operator !== "All") { + throw new Error("values must be a non-empty array unless your operator is \"All\"."); + } + /** + * Accept values as array instead of as individual arguments + * new BasicFilter('a', 'b', 1, 2); + * new BasicFilter('a', 'b', [1,2]); + */ + if (Array.isArray(values[0])) { + _this.values = values[0]; + } + else { + _this.values = values; + } + return _this; + } + BasicFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.values = this.values; + filter.requireSingleSelection = !!this.requireSingleSelection; + return filter; + }; + BasicFilter.schemaUrl = "http://powerbi.com/product/schema#basic"; + return BasicFilter; +}(Filter)); +exports.BasicFilter = BasicFilter; +var BasicFilterWithKeys = /** @class */ (function (_super) { + __extends(BasicFilterWithKeys, _super); + function BasicFilterWithKeys(target, operator, values, keyValues) { + var _this = _super.call(this, target, operator, values) || this; + _this.keyValues = keyValues; + _this.target = target; + var numberOfKeys = target.keys ? target.keys.length : 0; + if (numberOfKeys > 0 && !keyValues) { + throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys"); + } + if (numberOfKeys === 0 && keyValues && keyValues.length > 0) { + throw new Error("You passed key values but your target object doesn't contain the keys to be filtered"); + } + for (var _i = 0, _a = _this.keyValues; _i < _a.length; _i++) { + var keyValue = _a[_i]; + if (keyValue) { + var lengthOfArray = keyValue.length; + if (lengthOfArray !== numberOfKeys) { + throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys"); + } + } + } + return _this; + } + BasicFilterWithKeys.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.keyValues = this.keyValues; + return filter; + }; + return BasicFilterWithKeys; +}(BasicFilter)); +exports.BasicFilterWithKeys = BasicFilterWithKeys; +var TupleFilter = /** @class */ (function (_super) { + __extends(TupleFilter, _super); + function TupleFilter(target, operator, values) { + var _this = _super.call(this, target, FilterType.Tuple) || this; + _this.operator = operator; + _this.schemaUrl = TupleFilter.schemaUrl; + _this.values = values; + return _this; + } + TupleFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.operator = this.operator; + filter.values = this.values; + filter.target = this.target; + return filter; + }; + TupleFilter.schemaUrl = "http://powerbi.com/product/schema#tuple"; + return TupleFilter; +}(Filter)); +exports.TupleFilter = TupleFilter; +var AdvancedFilter = /** @class */ (function (_super) { + __extends(AdvancedFilter, _super); + function AdvancedFilter(target, logicalOperator) { + var conditions = []; + for (var _i = 2; _i < arguments.length; _i++) { + conditions[_i - 2] = arguments[_i]; + } + var _this = _super.call(this, target, FilterType.Advanced) || this; + _this.schemaUrl = AdvancedFilter.schemaUrl; + // Guard statements + if (typeof logicalOperator !== "string" || logicalOperator.length === 0) { + // TODO: It would be nicer to list out the possible logical operators. + throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator); + } + _this.logicalOperator = logicalOperator; + var extractedConditions; + /** + * Accept conditions as array instead of as individual arguments + * new AdvancedFilter('a', 'b', "And", { value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }); + * new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]); + */ + if (Array.isArray(conditions[0])) { + extractedConditions = conditions[0]; + } + else { + extractedConditions = conditions; + } + if (extractedConditions.length === 0) { + throw new Error("conditions must be a non-empty array. You passed: " + conditions); + } + if (extractedConditions.length > 2) { + throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length); + } + if (extractedConditions.length === 1 && logicalOperator !== "And") { + throw new Error("Logical Operator must be \"And\" when there is only one condition provided"); + } + _this.conditions = extractedConditions; + return _this; + } + AdvancedFilter.prototype.toJSON = function () { + var filter = _super.prototype.toJSON.call(this); + filter.logicalOperator = this.logicalOperator; + filter.conditions = this.conditions; + return filter; + }; + AdvancedFilter.schemaUrl = "http://powerbi.com/product/schema#advanced"; + return AdvancedFilter; +}(Filter)); +exports.AdvancedFilter = AdvancedFilter; +function isFilterKeyColumnsTarget(target) { + return isColumn(target) && !!target.keys; +} +exports.isFilterKeyColumnsTarget = isFilterKeyColumnsTarget; +function isBasicFilterWithKeys(filter) { + return getFilterType(filter) === FilterType.Basic && !!filter.keyValues; +} +exports.isBasicFilterWithKeys = isBasicFilterWithKeys; +function getFilterType(filter) { + if (filter.filterType) { + return filter.filterType; + } + var basicFilter = filter; + var advancedFilter = filter; + if ((typeof basicFilter.operator === "string") + && (Array.isArray(basicFilter.values))) { + return FilterType.Basic; + } + else if ((typeof advancedFilter.logicalOperator === "string") + && (Array.isArray(advancedFilter.conditions))) { + return FilterType.Advanced; + } + else { + return FilterType.Unknown; + } +} +exports.getFilterType = getFilterType; +function isMeasure(arg) { + return arg.table !== undefined && arg.measure !== undefined; +} +exports.isMeasure = isMeasure; +function isColumn(arg) { + return !!(arg.table && arg.column && !arg.aggregationFunction); +} +exports.isColumn = isColumn; +function isHierarchyLevel(arg) { + return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && !arg.aggregationFunction); +} +exports.isHierarchyLevel = isHierarchyLevel; +function isHierarchyLevelAggr(arg) { + return !!(arg.table && arg.hierarchy && arg.hierarchyLevel && arg.aggregationFunction); +} +exports.isHierarchyLevelAggr = isHierarchyLevelAggr; +function isColumnAggr(arg) { + return !!(arg.table && arg.column && arg.aggregationFunction); +} +exports.isColumnAggr = isColumnAggr; +var PageNavigationPosition; +(function (PageNavigationPosition) { + PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom"; + PageNavigationPosition[PageNavigationPosition["Left"] = 1] = "Left"; +})(PageNavigationPosition = exports.PageNavigationPosition || (exports.PageNavigationPosition = {})); +var QnaMode; +(function (QnaMode) { + QnaMode[QnaMode["Interactive"] = 0] = "Interactive"; + QnaMode[QnaMode["ResultOnly"] = 1] = "ResultOnly"; +})(QnaMode = exports.QnaMode || (exports.QnaMode = {})); +var ExportDataType; +(function (ExportDataType) { + ExportDataType[ExportDataType["Summarized"] = 0] = "Summarized"; + ExportDataType[ExportDataType["Underlying"] = 1] = "Underlying"; +})(ExportDataType = exports.ExportDataType || (exports.ExportDataType = {})); +var BookmarksPlayMode; +(function (BookmarksPlayMode) { + BookmarksPlayMode[BookmarksPlayMode["Off"] = 0] = "Off"; + BookmarksPlayMode[BookmarksPlayMode["Presentation"] = 1] = "Presentation"; +})(BookmarksPlayMode = exports.BookmarksPlayMode || (exports.BookmarksPlayMode = {})); +// This is not an enum because enum strings require +// us to upgrade typeScript version and change SDK build definition +exports.CommonErrorCodes = { + TokenExpired: 'TokenExpired', + NotFound: 'PowerBIEntityNotFound', + InvalidParameters: 'Invalid parameters', + LoadReportFailed: 'LoadReportFailed', + NotAuthorized: 'PowerBINotAuthorizedException', + FailedToLoadModel: 'ExplorationContainer_FailedToLoadModel_DefaultDetails', +}; +exports.TextAlignment = { + Left: 'left', + Center: 'center', + Right: 'right', +}; +exports.LegendPosition = { + Top: 'Top', + Bottom: 'Bottom', + Right: 'Right', + Left: 'Left', + TopCenter: 'TopCenter', + BottomCenter: 'BottomCenter', + RightCenter: 'RightCenter', + LeftCenter: 'LeftCenter', +}; +var SortDirection; +(function (SortDirection) { + SortDirection[SortDirection["Ascending"] = 1] = "Ascending"; + SortDirection[SortDirection["Descending"] = 2] = "Descending"; +})(SortDirection = exports.SortDirection || (exports.SortDirection = {})); +var Selector = /** @class */ (function () { + function Selector(schema) { + this.$schema = schema; + } + Selector.prototype.toJSON = function () { + return { + $schema: this.$schema + }; + }; + return Selector; +}()); +exports.Selector = Selector; +var PageSelector = /** @class */ (function (_super) { + __extends(PageSelector, _super); + function PageSelector(pageName) { + var _this = _super.call(this, PageSelector.schemaUrl) || this; + _this.pageName = pageName; + return _this; + } + PageSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.pageName = this.pageName; + return selector; + }; + PageSelector.schemaUrl = "http://powerbi.com/product/schema#pageSelector"; + return PageSelector; +}(Selector)); +exports.PageSelector = PageSelector; +var VisualSelector = /** @class */ (function (_super) { + __extends(VisualSelector, _super); + function VisualSelector(visualName) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.visualName = visualName; + return _this; + } + VisualSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.visualName = this.visualName; + return selector; + }; + VisualSelector.schemaUrl = "http://powerbi.com/product/schema#visualSelector"; + return VisualSelector; +}(Selector)); +exports.VisualSelector = VisualSelector; +var VisualTypeSelector = /** @class */ (function (_super) { + __extends(VisualTypeSelector, _super); + function VisualTypeSelector(visualType) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.visualType = visualType; + return _this; + } + VisualTypeSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.visualType = this.visualType; + return selector; + }; + VisualTypeSelector.schemaUrl = "http://powerbi.com/product/schema#visualTypeSelector"; + return VisualTypeSelector; +}(Selector)); +exports.VisualTypeSelector = VisualTypeSelector; +var SlicerTargetSelector = /** @class */ (function (_super) { + __extends(SlicerTargetSelector, _super); + function SlicerTargetSelector(target) { + var _this = _super.call(this, VisualSelector.schemaUrl) || this; + _this.target = target; + return _this; + } + SlicerTargetSelector.prototype.toJSON = function () { + var selector = _super.prototype.toJSON.call(this); + selector.target = this.target; + return selector; + }; + SlicerTargetSelector.schemaUrl = "http://powerbi.com/product/schema#slicerTargetSelector"; + return SlicerTargetSelector; +}(Selector)); +exports.SlicerTargetSelector = SlicerTargetSelector; +var CommandDisplayOption; +(function (CommandDisplayOption) { + CommandDisplayOption[CommandDisplayOption["Enabled"] = 0] = "Enabled"; + CommandDisplayOption[CommandDisplayOption["Disabled"] = 1] = "Disabled"; + CommandDisplayOption[CommandDisplayOption["Hidden"] = 2] = "Hidden"; +})(CommandDisplayOption = exports.CommandDisplayOption || (exports.CommandDisplayOption = {})); +/* + * Visual CRUD + */ +var VisualDataRoleKind; +(function (VisualDataRoleKind) { + // Indicates that the role should be bound to something that evaluates to a grouping of values. + VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping"; + // Indicates that the role should be bound to something that evaluates to a single value in a scope. + VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure"; + // Indicates that the role can be bound to either Grouping or Measure. + VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure"; +})(VisualDataRoleKind = exports.VisualDataRoleKind || (exports.VisualDataRoleKind = {})); +// Indicates the visual preference on Grouping or Measure. Only applicable if kind is GroupingOrMeasure. +var VisualDataRoleKindPreference; +(function (VisualDataRoleKindPreference) { + VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure"; + VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping"; +})(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {})); +function isFlatMenuExtension(menuExtension) { + return menuExtension && !isGroupedMenuExtension(menuExtension); +} +exports.isFlatMenuExtension = isFlatMenuExtension; +function isGroupedMenuExtension(menuExtension) { + return menuExtension && !!menuExtension.groupName; +} +exports.isGroupedMenuExtension = isGroupedMenuExtension; +function isIExtensions(extensions) { + return extensions && !isIExtensionArray(extensions); +} +exports.isIExtensions = isIExtensions; +function isIExtensionArray(extensions) { + return Array.isArray(extensions); +} +exports.isIExtensionArray = isIExtensionArray; +function normalizeError(error) { + var message = error.message; + if (!message) { + message = error.path + " is invalid. Not meeting " + error.keyword + " constraint"; + } + return { + message: message + }; +} +function validateVisualSelector(input) { + var errors = validator_1.Validators.visualSelectorValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualSelector = validateVisualSelector; +function validateSlicer(input) { + var errors = validator_1.Validators.slicerValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSlicer = validateSlicer; +function validateSlicerState(input) { + var errors = validator_1.Validators.slicerStateValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSlicerState = validateSlicerState; +function validatePlayBookmarkRequest(input) { + var errors = validator_1.Validators.playBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePlayBookmarkRequest = validatePlayBookmarkRequest; +function validateAddBookmarkRequest(input) { + var errors = validator_1.Validators.addBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateAddBookmarkRequest = validateAddBookmarkRequest; +function validateApplyBookmarkByNameRequest(input) { + var errors = validator_1.Validators.applyBookmarkByNameRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateApplyBookmarkByNameRequest = validateApplyBookmarkByNameRequest; +function validateApplyBookmarkStateRequest(input) { + var errors = validator_1.Validators.applyBookmarkStateRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateApplyBookmarkStateRequest = validateApplyBookmarkStateRequest; +function validateCaptureBookmarkRequest(input) { + var errors = validator_1.Validators.captureBookmarkRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCaptureBookmarkRequest = validateCaptureBookmarkRequest; +function validateSettings(input) { + var errors = validator_1.Validators.settingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSettings = validateSettings; +function validatePanes(input) { + var errors = validator_1.Validators.reportPanesValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePanes = validatePanes; +function validateBookmarksPane(input) { + var errors = validator_1.Validators.bookmarksPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateBookmarksPane = validateBookmarksPane; +function validateFiltersPane(input) { + var errors = validator_1.Validators.filtersPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateFiltersPane = validateFiltersPane; +function validateFieldsPane(input) { + var errors = validator_1.Validators.fieldsPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateFieldsPane = validateFieldsPane; +function validatePageNavigationPane(input) { + var errors = validator_1.Validators.pageNavigationPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePageNavigationPane = validatePageNavigationPane; +function validateSelectionPane(input) { + var errors = validator_1.Validators.selectionPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSelectionPane = validateSelectionPane; +function validateSyncSlicersPane(input) { + var errors = validator_1.Validators.syncSlicersPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSyncSlicersPane = validateSyncSlicersPane; +function validateVisualizationsPane(input) { + var errors = validator_1.Validators.visualizationsPaneValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualizationsPane = validateVisualizationsPane; +function validateCustomPageSize(input) { + var errors = validator_1.Validators.customPageSizeValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCustomPageSize = validateCustomPageSize; +function validateExtension(input) { + var errors = validator_1.Validators.extensionValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateExtension = validateExtension; +function validateMenuGroupExtension(input) { + var errors = validator_1.Validators.menuGroupExtensionValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateMenuGroupExtension = validateMenuGroupExtension; +function validateReportLoad(input) { + var errors = validator_1.Validators.reportLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateReportLoad = validateReportLoad; +function validateCreateReport(input) { + var errors = validator_1.Validators.reportCreateValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCreateReport = validateCreateReport; +function validateDashboardLoad(input) { + var errors = validator_1.Validators.dashboardLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateDashboardLoad = validateDashboardLoad; +function validateTileLoad(input) { + var errors = validator_1.Validators.tileLoadValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateTileLoad = validateTileLoad; +function validatePage(input) { + var errors = validator_1.Validators.pageValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validatePage = validatePage; +function validateFilter(input) { + var errors = validator_1.Validators.filtersValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateFilter = validateFilter; +function validateSaveAsParameters(input) { + var errors = validator_1.Validators.saveAsParametersValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateSaveAsParameters = validateSaveAsParameters; +function validateLoadQnaConfiguration(input) { + var errors = validator_1.Validators.loadQnaValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateLoadQnaConfiguration = validateLoadQnaConfiguration; +function validateQnaInterpretInputData(input) { + var errors = validator_1.Validators.qnaInterpretInputDataValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateQnaInterpretInputData = validateQnaInterpretInputData; +function validateExportDataRequest(input) { + var errors = validator_1.Validators.exportDataRequestValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateExportDataRequest = validateExportDataRequest; +function validateVisualHeader(input) { + var errors = validator_1.Validators.visualHeaderValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualHeader = validateVisualHeader; +function validateVisualSettings(input) { + var errors = validator_1.Validators.visualSettingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateVisualSettings = validateVisualSettings; +function validateCommandsSettings(input) { + var errors = validator_1.Validators.commandsSettingsValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCommandsSettings = validateCommandsSettings; +function validateCustomTheme(input) { + var errors = validator_1.Validators.customThemeValidator.validate(input); + return errors ? errors.map(normalizeError) : undefined; +} +exports.validateCustomTheme = validateCustomTheme; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Validators = void 0; -var barsValidator_1 = __webpack_require__(2); -var bookmarkValidator_1 = __webpack_require__(5); -var commandsSettingsValidator_1 = __webpack_require__(6); -var customThemeValidator_1 = __webpack_require__(7); -var dashboardLoadValidator_1 = __webpack_require__(8); -var datasetBindingValidator_1 = __webpack_require__(9); -var exportDataValidator_1 = __webpack_require__(10); -var extensionsValidator_1 = __webpack_require__(11); -var filtersValidator_1 = __webpack_require__(12); -var layoutValidator_1 = __webpack_require__(13); -var pageValidator_1 = __webpack_require__(14); -var panesValidator_1 = __webpack_require__(15); -var qnaValidator_1 = __webpack_require__(16); -var reportCreateValidator_1 = __webpack_require__(17); -var reportLoadValidator_1 = __webpack_require__(18); -var saveAsParametersValidator_1 = __webpack_require__(19); -var selectorsValidator_1 = __webpack_require__(20); -var settingsValidator_1 = __webpack_require__(21); -var slicersValidator_1 = __webpack_require__(22); -var tileLoadValidator_1 = __webpack_require__(23); -var visualSettingsValidator_1 = __webpack_require__(24); -var anyOfValidator_1 = __webpack_require__(25); -var fieldForbiddenValidator_1 = __webpack_require__(26); -var fieldRequiredValidator_1 = __webpack_require__(27); -var mapValidator_1 = __webpack_require__(28); -var typeValidator_1 = __webpack_require__(4); -exports.Validators = { - addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), - advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), - advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(), - anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]), - anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]), - anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]), - actionBarValidator: new barsValidator_1.ActionBarValidator(), - applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), - applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(), - applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]), - backgroundValidator: new typeValidator_1.EnumValidator([0, 1]), - basicFilterTypeValidator: new typeValidator_1.EnumValidator([1]), - basicFilterValidator: new filtersValidator_1.BasicFilterValidator(), - booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), - booleanValidator: new typeValidator_1.BooleanValidator(), - bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), - captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), - captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), - commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - commandExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.CommandExtensionValidator()]), - commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), - commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), - commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), - conditionItemValidator: new filtersValidator_1.ConditionItemValidator(), - contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]), - customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(), - customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(), - customThemeValidator: new customThemeValidator_1.CustomThemeValidator(), - dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(), - datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(), - displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]), - displayStateValidator: new layoutValidator_1.DisplayStateValidator(), - exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), - extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), - extensionsValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), new extensionsValidator_1.ExtensionsValidator()]), - extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), - extensionValidator: new extensionsValidator_1.ExtensionValidator(), - fieldForbiddenValidator: new fieldForbiddenValidator_1.FieldForbiddenValidator(), - fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), - fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), - filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), - filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]), - filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(), - filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(), - filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]), - filtersArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()])]), - filtersValidator: new filtersValidator_1.FilterValidator(), - filtersPaneValidator: new panesValidator_1.FiltersPaneValidator(), - hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(), - includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), - layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), - loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), - menuExtensionValidator: new anyOfValidator_1.AnyOfValidator([new extensionsValidator_1.FlatMenuExtensionValidator(), new extensionsValidator_1.GroupedMenuExtensionValidator()]), - menuGroupExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.MenuGroupExtensionValidator()]), - menuGroupExtensionValidator: new extensionsValidator_1.MenuGroupExtensionValidator(), - menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), - notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), - notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), - numberArrayValidator: new typeValidator_1.NumberArrayValidator(), - numberValidator: new typeValidator_1.NumberValidator(), - pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), - pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), - pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), - pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), - pageSizeValidator: new pageValidator_1.PageSizeValidator(), - pageValidator: new pageValidator_1.PageValidator(), - pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(), - pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]), - reportBarsValidator: new barsValidator_1.ReportBarsValidator(), - reportPanesValidator: new panesValidator_1.ReportPanesValidator(), - permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]), - playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(), - qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(), - qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(), - relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), - relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]), - relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]), - relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(), - relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]), - relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]), - relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(), - reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(), - reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(), - saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(), - selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(), - settingsValidator: new settingsValidator_1.SettingsValidator(), - singleCommandSettingsValidator: new commandsSettingsValidator_1.SingleCommandSettingsValidator(), - slicerSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.SlicerTargetSelectorValidator()]), - slicerStateValidator: new slicersValidator_1.SlicerStateValidator(), - slicerTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()]), - slicerValidator: new slicersValidator_1.SlicerValidator(), - stringArrayValidator: new typeValidator_1.StringArrayValidator(), - stringValidator: new typeValidator_1.StringValidator(), - syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(), - tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(), - tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]), - topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]), - topNFilterValidator: new filtersValidator_1.TopNFilterValidator(), - viewModeValidator: new typeValidator_1.EnumValidator([0, 1]), - visualCommandSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - visualHeaderSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), - visualHeaderSettingsValidator: new visualSettingsValidator_1.VisualHeaderSettingsValidator(), - visualHeaderValidator: new visualSettingsValidator_1.VisualHeaderValidator(), - visualHeadersValidator: new typeValidator_1.ArrayValidator([new visualSettingsValidator_1.VisualHeaderValidator()]), - visualizationsPaneValidator: new panesValidator_1.VisualizationsPaneValidator(), - visualLayoutValidator: new layoutValidator_1.VisualLayoutValidator(), - visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(), - visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(), - visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(), -}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Validators = void 0; +var barsValidator_1 = __webpack_require__(2); +var bookmarkValidator_1 = __webpack_require__(5); +var commandsSettingsValidator_1 = __webpack_require__(6); +var customThemeValidator_1 = __webpack_require__(7); +var dashboardLoadValidator_1 = __webpack_require__(8); +var datasetBindingValidator_1 = __webpack_require__(9); +var exportDataValidator_1 = __webpack_require__(10); +var extensionsValidator_1 = __webpack_require__(11); +var filtersValidator_1 = __webpack_require__(12); +var layoutValidator_1 = __webpack_require__(13); +var pageValidator_1 = __webpack_require__(14); +var panesValidator_1 = __webpack_require__(15); +var qnaValidator_1 = __webpack_require__(16); +var reportCreateValidator_1 = __webpack_require__(17); +var reportLoadValidator_1 = __webpack_require__(18); +var saveAsParametersValidator_1 = __webpack_require__(19); +var selectorsValidator_1 = __webpack_require__(20); +var settingsValidator_1 = __webpack_require__(21); +var slicersValidator_1 = __webpack_require__(22); +var tileLoadValidator_1 = __webpack_require__(23); +var visualSettingsValidator_1 = __webpack_require__(24); +var anyOfValidator_1 = __webpack_require__(25); +var fieldForbiddenValidator_1 = __webpack_require__(26); +var fieldRequiredValidator_1 = __webpack_require__(27); +var mapValidator_1 = __webpack_require__(28); +var typeValidator_1 = __webpack_require__(4); +exports.Validators = { + addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(), + advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]), + advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(), + anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]), + anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]), + anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]), + actionBarValidator: new barsValidator_1.ActionBarValidator(), + applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), + applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(), + applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]), + backgroundValidator: new typeValidator_1.EnumValidator([0, 1]), + basicFilterTypeValidator: new typeValidator_1.EnumValidator([1]), + basicFilterValidator: new filtersValidator_1.BasicFilterValidator(), + booleanArrayValidator: new typeValidator_1.BooleanArrayValidator(), + booleanValidator: new typeValidator_1.BooleanValidator(), + bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(), + captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(), + captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(), + commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + commandExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.CommandExtensionValidator()]), + commandExtensionValidator: new extensionsValidator_1.CommandExtensionValidator(), + commandsSettingsArrayValidator: new typeValidator_1.ArrayValidator([new commandsSettingsValidator_1.CommandsSettingsValidator()]), + commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(), + conditionItemValidator: new filtersValidator_1.ConditionItemValidator(), + contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]), + customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(), + customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(), + customThemeValidator: new customThemeValidator_1.CustomThemeValidator(), + dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(), + datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(), + displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]), + displayStateValidator: new layoutValidator_1.DisplayStateValidator(), + exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(), + extensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), + extensionsValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.ArrayValidator([new extensionsValidator_1.ExtensionValidator()]), new extensionsValidator_1.ExtensionsValidator()]), + extensionPointsValidator: new extensionsValidator_1.ExtensionPointsValidator(), + extensionValidator: new extensionsValidator_1.ExtensionValidator(), + fieldForbiddenValidator: new fieldForbiddenValidator_1.FieldForbiddenValidator(), + fieldRequiredValidator: new fieldRequiredValidator_1.FieldRequiredValidator(), + fieldsPaneValidator: new panesValidator_1.FieldsPaneValidator(), + filterColumnTargetValidator: new filtersValidator_1.FilterColumnTargetValidator(), + filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]), + filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(), + filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(), + filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]), + filtersArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()])]), + filtersValidator: new filtersValidator_1.FilterValidator(), + filtersPaneValidator: new panesValidator_1.FiltersPaneValidator(), + hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(), + includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]), + layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]), + loadQnaValidator: new qnaValidator_1.LoadQnaValidator(), + menuExtensionValidator: new anyOfValidator_1.AnyOfValidator([new extensionsValidator_1.FlatMenuExtensionValidator(), new extensionsValidator_1.GroupedMenuExtensionValidator()]), + menuGroupExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.MenuGroupExtensionValidator()]), + menuGroupExtensionValidator: new extensionsValidator_1.MenuGroupExtensionValidator(), + menuLocationValidator: new typeValidator_1.EnumValidator([0, 1]), + notSupportedFilterTypeValidator: new typeValidator_1.EnumValidator([2]), + notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(), + numberArrayValidator: new typeValidator_1.NumberArrayValidator(), + numberValidator: new typeValidator_1.NumberValidator(), + pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]), + pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(), + pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]), + pageSizeTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5]), + pageSizeValidator: new pageValidator_1.PageSizeValidator(), + pageValidator: new pageValidator_1.PageValidator(), + pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(), + pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]), + reportBarsValidator: new barsValidator_1.ReportBarsValidator(), + reportPanesValidator: new panesValidator_1.ReportPanesValidator(), + permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]), + playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(), + qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(), + qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(), + relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]), + relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]), + relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]), + relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(), + relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]), + relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]), + relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(), + reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(), + reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(), + saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(), + selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(), + settingsValidator: new settingsValidator_1.SettingsValidator(), + singleCommandSettingsValidator: new commandsSettingsValidator_1.SingleCommandSettingsValidator(), + slicerSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.SlicerTargetSelectorValidator()]), + slicerStateValidator: new slicersValidator_1.SlicerStateValidator(), + slicerTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()]), + slicerValidator: new slicersValidator_1.SlicerValidator(), + stringArrayValidator: new typeValidator_1.StringArrayValidator(), + stringValidator: new typeValidator_1.StringValidator(), + syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(), + tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(), + tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]), + topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]), + topNFilterValidator: new filtersValidator_1.TopNFilterValidator(), + viewModeValidator: new typeValidator_1.EnumValidator([0, 1]), + visualCommandSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + visualHeaderSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]), + visualHeaderSettingsValidator: new visualSettingsValidator_1.VisualHeaderSettingsValidator(), + visualHeaderValidator: new visualSettingsValidator_1.VisualHeaderValidator(), + visualHeadersValidator: new typeValidator_1.ArrayValidator([new visualSettingsValidator_1.VisualHeaderValidator()]), + visualizationsPaneValidator: new panesValidator_1.VisualizationsPaneValidator(), + visualLayoutValidator: new layoutValidator_1.VisualLayoutValidator(), + visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(), + visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(), + visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(), +}; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ActionBarValidator = exports.ReportBarsValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var ReportBarsValidator = /** @class */ (function (_super) { - __extends(ReportBarsValidator, _super); - function ReportBarsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportBarsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "actionBar", - validators: [validator_1.Validators.actionBarValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportBarsValidator; -}(typeValidator_1.ObjectValidator)); -exports.ReportBarsValidator = ReportBarsValidator; -var ActionBarValidator = /** @class */ (function (_super) { - __extends(ActionBarValidator, _super); - function ActionBarValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionBarValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ActionBarValidator; -}(typeValidator_1.ObjectValidator)); -exports.ActionBarValidator = ActionBarValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ActionBarValidator = exports.ReportBarsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportBarsValidator = /** @class */ (function (_super) { + __extends(ReportBarsValidator, _super); + function ReportBarsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportBarsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "actionBar", + validators: [validator_1.Validators.actionBarValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportBarsValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportBarsValidator = ReportBarsValidator; +var ActionBarValidator = /** @class */ (function (_super) { + __extends(ActionBarValidator, _super); + function ActionBarValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ActionBarValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ActionBarValidator; +}(typeValidator_1.ObjectValidator)); +exports.ActionBarValidator = ActionBarValidator; /***/ }), /* 3 */ /***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MultipleFieldsValidator = void 0; -var MultipleFieldsValidator = /** @class */ (function () { - function MultipleFieldsValidator(fieldValidatorsPairs) { - this.fieldValidatorsPairs = fieldValidatorsPairs; - } - MultipleFieldsValidator.prototype.validate = function (input, path, field) { - if (!this.fieldValidatorsPairs) { - return null; - } - var fieldsPath = path ? path + "." + field : field; - for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { - var fieldValidators = _a[_i]; - for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { - var validator = _c[_b]; - var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); - if (errors) { - return errors; - } - } - } - return null; - }; - return MultipleFieldsValidator; -}()); -exports.MultipleFieldsValidator = MultipleFieldsValidator; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MultipleFieldsValidator = void 0; +var MultipleFieldsValidator = /** @class */ (function () { + function MultipleFieldsValidator(fieldValidatorsPairs) { + this.fieldValidatorsPairs = fieldValidatorsPairs; + } + MultipleFieldsValidator.prototype.validate = function (input, path, field) { + if (!this.fieldValidatorsPairs) { + return null; + } + var fieldsPath = path ? path + "." + field : field; + for (var _i = 0, _a = this.fieldValidatorsPairs; _i < _a.length; _i++) { + var fieldValidators = _a[_i]; + for (var _b = 0, _c = fieldValidators.validators; _b < _c.length; _b++) { + var validator = _c[_b]; + var errors = validator.validate(input[fieldValidators.field], fieldsPath, fieldValidators.field); + if (errors) { + return errors; + } + } + } + return null; + }; + return MultipleFieldsValidator; +}()); +exports.MultipleFieldsValidator = MultipleFieldsValidator; /***/ }), /* 4 */ /***/ (function(module, exports) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0; -var ObjectValidator = /** @class */ (function () { - function ObjectValidator() { - } - ObjectValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (typeof input !== "object" || Array.isArray(input)) { - return [{ - message: field !== undefined ? field + " must be an object" : "input must be an object", - path: path, - keyword: "type" - }]; - } - return null; - }; - return ObjectValidator; -}()); -exports.ObjectValidator = ObjectValidator; -var ArrayValidator = /** @class */ (function () { - function ArrayValidator(itemValidators) { - this.itemValidators = itemValidators; - } - ArrayValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (!(Array.isArray(input))) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - for (var i = 0; i < input.length; i++) { - var fieldsPath = (path ? path + "." : "") + field + "." + i; - for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) { - var validator = _a[_i]; - var errors = validator.validate(input[i], fieldsPath, field); - if (errors) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - } - } - return null; - }; - return ArrayValidator; -}()); -exports.ArrayValidator = ArrayValidator; -var TypeValidator = /** @class */ (function () { - function TypeValidator(expectedType) { - this.expectedType = expectedType; - } - TypeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (!(typeof input === this.expectedType)) { - return [{ - message: field + " must be a " + this.expectedType, - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return TypeValidator; -}()); -exports.TypeValidator = TypeValidator; -var StringValidator = /** @class */ (function (_super) { - __extends(StringValidator, _super); - function StringValidator() { - return _super.call(this, "string") || this; - } - return StringValidator; -}(TypeValidator)); -exports.StringValidator = StringValidator; -var BooleanValidator = /** @class */ (function (_super) { - __extends(BooleanValidator, _super); - function BooleanValidator() { - return _super.call(this, "boolean") || this; - } - return BooleanValidator; -}(TypeValidator)); -exports.BooleanValidator = BooleanValidator; -var NumberValidator = /** @class */ (function (_super) { - __extends(NumberValidator, _super); - function NumberValidator() { - return _super.call(this, "number") || this; - } - return NumberValidator; -}(TypeValidator)); -exports.NumberValidator = NumberValidator; -var ValueValidator = /** @class */ (function () { - function ValueValidator(possibleValues) { - this.possibleValues = possibleValues; - } - ValueValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - if (this.possibleValues.indexOf(input) < 0) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return ValueValidator; -}()); -exports.ValueValidator = ValueValidator; -var SchemaValidator = /** @class */ (function (_super) { - __extends(SchemaValidator, _super); - function SchemaValidator(schemaValue) { - var _this = _super.call(this, [schemaValue]) || this; - _this.schemaValue = schemaValue; - return _this; - } - SchemaValidator.prototype.validate = function (input, path, field) { - return _super.prototype.validate.call(this, input, path, field); - }; - return SchemaValidator; -}(ValueValidator)); -exports.SchemaValidator = SchemaValidator; -var EnumValidator = /** @class */ (function (_super) { - __extends(EnumValidator, _super); - function EnumValidator(possibleValues) { - var _this = _super.call(this) || this; - _this.possibleValues = possibleValues; - return _this; - } - EnumValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var valueValidator = new ValueValidator(this.possibleValues); - return valueValidator.validate(input, path, field); - }; - return EnumValidator; -}(NumberValidator)); -exports.EnumValidator = EnumValidator; -var StringArrayValidator = /** @class */ (function (_super) { - __extends(StringArrayValidator, _super); - function StringArrayValidator() { - return _super.call(this, [new StringValidator()]) || this; - } - StringArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of strings", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return StringArrayValidator; -}(ArrayValidator)); -exports.StringArrayValidator = StringArrayValidator; -var BooleanArrayValidator = /** @class */ (function (_super) { - __extends(BooleanArrayValidator, _super); - function BooleanArrayValidator() { - return _super.call(this, [new BooleanValidator()]) || this; - } - BooleanArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of booleans", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return BooleanArrayValidator; -}(ArrayValidator)); -exports.BooleanArrayValidator = BooleanArrayValidator; -var NumberArrayValidator = /** @class */ (function (_super) { - __extends(NumberArrayValidator, _super); - function NumberArrayValidator() { - return _super.call(this, [new NumberValidator()]) || this; - } - NumberArrayValidator.prototype.validate = function (input, path, field) { - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return [{ - message: field + " must be an array of numbers", - path: (path ? path + "." : "") + field, - keyword: "type" - }]; - } - return null; - }; - return NumberArrayValidator; -}(ArrayValidator)); -exports.NumberArrayValidator = NumberArrayValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0; +var ObjectValidator = /** @class */ (function () { + function ObjectValidator() { + } + ObjectValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (typeof input !== "object" || Array.isArray(input)) { + return [{ + message: field !== undefined ? field + " must be an object" : "input must be an object", + path: path, + keyword: "type" + }]; + } + return null; + }; + return ObjectValidator; +}()); +exports.ObjectValidator = ObjectValidator; +var ArrayValidator = /** @class */ (function () { + function ArrayValidator(itemValidators) { + this.itemValidators = itemValidators; + } + ArrayValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (!(Array.isArray(input))) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + for (var i = 0; i < input.length; i++) { + var fieldsPath = (path ? path + "." : "") + field + "." + i; + for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input[i], fieldsPath, field); + if (errors) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + } + } + return null; + }; + return ArrayValidator; +}()); +exports.ArrayValidator = ArrayValidator; +var TypeValidator = /** @class */ (function () { + function TypeValidator(expectedType) { + this.expectedType = expectedType; + } + TypeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (!(typeof input === this.expectedType)) { + return [{ + message: field + " must be a " + this.expectedType, + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return TypeValidator; +}()); +exports.TypeValidator = TypeValidator; +var StringValidator = /** @class */ (function (_super) { + __extends(StringValidator, _super); + function StringValidator() { + return _super.call(this, "string") || this; + } + return StringValidator; +}(TypeValidator)); +exports.StringValidator = StringValidator; +var BooleanValidator = /** @class */ (function (_super) { + __extends(BooleanValidator, _super); + function BooleanValidator() { + return _super.call(this, "boolean") || this; + } + return BooleanValidator; +}(TypeValidator)); +exports.BooleanValidator = BooleanValidator; +var NumberValidator = /** @class */ (function (_super) { + __extends(NumberValidator, _super); + function NumberValidator() { + return _super.call(this, "number") || this; + } + return NumberValidator; +}(TypeValidator)); +exports.NumberValidator = NumberValidator; +var ValueValidator = /** @class */ (function () { + function ValueValidator(possibleValues) { + this.possibleValues = possibleValues; + } + ValueValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + if (this.possibleValues.indexOf(input) < 0) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return ValueValidator; +}()); +exports.ValueValidator = ValueValidator; +var SchemaValidator = /** @class */ (function (_super) { + __extends(SchemaValidator, _super); + function SchemaValidator(schemaValue) { + var _this = _super.call(this, [schemaValue]) || this; + _this.schemaValue = schemaValue; + return _this; + } + SchemaValidator.prototype.validate = function (input, path, field) { + return _super.prototype.validate.call(this, input, path, field); + }; + return SchemaValidator; +}(ValueValidator)); +exports.SchemaValidator = SchemaValidator; +var EnumValidator = /** @class */ (function (_super) { + __extends(EnumValidator, _super); + function EnumValidator(possibleValues) { + var _this = _super.call(this) || this; + _this.possibleValues = possibleValues; + return _this; + } + EnumValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var valueValidator = new ValueValidator(this.possibleValues); + return valueValidator.validate(input, path, field); + }; + return EnumValidator; +}(NumberValidator)); +exports.EnumValidator = EnumValidator; +var StringArrayValidator = /** @class */ (function (_super) { + __extends(StringArrayValidator, _super); + function StringArrayValidator() { + return _super.call(this, [new StringValidator()]) || this; + } + StringArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of strings", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return StringArrayValidator; +}(ArrayValidator)); +exports.StringArrayValidator = StringArrayValidator; +var BooleanArrayValidator = /** @class */ (function (_super) { + __extends(BooleanArrayValidator, _super); + function BooleanArrayValidator() { + return _super.call(this, [new BooleanValidator()]) || this; + } + BooleanArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of booleans", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return BooleanArrayValidator; +}(ArrayValidator)); +exports.BooleanArrayValidator = BooleanArrayValidator; +var NumberArrayValidator = /** @class */ (function (_super) { + __extends(NumberArrayValidator, _super); + function NumberArrayValidator() { + return _super.call(this, [new NumberValidator()]) || this; + } + NumberArrayValidator.prototype.validate = function (input, path, field) { + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return [{ + message: field + " must be an array of numbers", + path: (path ? path + "." : "") + field, + keyword: "type" + }]; + } + return null; + }; + return NumberArrayValidator; +}(ArrayValidator)); +exports.NumberArrayValidator = NumberArrayValidator; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var PlayBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(PlayBookmarkRequestValidator, _super); - function PlayBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "playMode", - validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PlayBookmarkRequestValidator; -}(typeValidator_1.ObjectValidator)); -exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; -var AddBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(AddBookmarkRequestValidator, _super); - function AddBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "displayName", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "apply", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return AddBookmarkRequestValidator; -}(typeValidator_1.ObjectValidator)); -exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; -var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkByNameRequestValidator, _super); - function ApplyBookmarkByNameRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ApplyBookmarkByNameRequestValidator; -}(typeValidator_1.ObjectValidator)); -exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; -var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { - __extends(ApplyBookmarkStateRequestValidator, _super); - function ApplyBookmarkStateRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ApplyBookmarkStateRequestValidator; -}(typeValidator_1.ObjectValidator)); -exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; -var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkOptionsValidator, _super); - function CaptureBookmarkOptionsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "personalizeVisuals", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CaptureBookmarkOptionsValidator; -}(typeValidator_1.ObjectValidator)); -exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; -var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { - __extends(CaptureBookmarkRequestValidator, _super); - function CaptureBookmarkRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "options", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CaptureBookmarkRequestValidator; -}(typeValidator_1.ObjectValidator)); -exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var PlayBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(PlayBookmarkRequestValidator, _super); + function PlayBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PlayBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "playMode", + validators: [validator_1.Validators.fieldRequiredValidator, new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PlayBookmarkRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.PlayBookmarkRequestValidator = PlayBookmarkRequestValidator; +var AddBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(AddBookmarkRequestValidator, _super); + function AddBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AddBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "displayName", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "apply", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return AddBookmarkRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.AddBookmarkRequestValidator = AddBookmarkRequestValidator; +var ApplyBookmarkByNameRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkByNameRequestValidator, _super); + function ApplyBookmarkByNameRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ApplyBookmarkByNameRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ApplyBookmarkByNameRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.ApplyBookmarkByNameRequestValidator = ApplyBookmarkByNameRequestValidator; +var ApplyBookmarkStateRequestValidator = /** @class */ (function (_super) { + __extends(ApplyBookmarkStateRequestValidator, _super); + function ApplyBookmarkStateRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ApplyBookmarkStateRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ApplyBookmarkStateRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.ApplyBookmarkStateRequestValidator = ApplyBookmarkStateRequestValidator; +var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkOptionsValidator, _super); + function CaptureBookmarkOptionsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkOptionsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "personalizeVisuals", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkOptionsValidator; +}(typeValidator_1.ObjectValidator)); +exports.CaptureBookmarkOptionsValidator = CaptureBookmarkOptionsValidator; +var CaptureBookmarkRequestValidator = /** @class */ (function (_super) { + __extends(CaptureBookmarkRequestValidator, _super); + function CaptureBookmarkRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CaptureBookmarkRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "options", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.captureBookmarkOptionsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CaptureBookmarkRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var CommandsSettingsValidator = /** @class */ (function (_super) { - __extends(CommandsSettingsValidator, _super); - function CommandsSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandsSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "copy", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "drill", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "drillthrough", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "expandCollapse", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "exportData", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "includeExclude", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "removeVisual", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "search", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "seeData", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "sort", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - { - field: "spotlight", - validators: [validator_1.Validators.singleCommandSettingsValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CommandsSettingsValidator; -}(typeValidator_1.ObjectValidator)); -exports.CommandsSettingsValidator = CommandsSettingsValidator; -var SingleCommandSettingsValidator = /** @class */ (function (_super) { - __extends(SingleCommandSettingsValidator, _super); - function SingleCommandSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "displayOption", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.visualCommandSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SingleCommandSettingsValidator; -}(typeValidator_1.ObjectValidator)); -exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var CommandsSettingsValidator = /** @class */ (function (_super) { + __extends(CommandsSettingsValidator, _super); + function CommandsSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandsSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "copy", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "drill", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "drillthrough", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "expandCollapse", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "exportData", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "includeExclude", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "removeVisual", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "search", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "seeData", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "sort", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + { + field: "spotlight", + validators: [validator_1.Validators.singleCommandSettingsValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandsSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.CommandsSettingsValidator = CommandsSettingsValidator; +var SingleCommandSettingsValidator = /** @class */ (function (_super) { + __extends(SingleCommandSettingsValidator, _super); + function SingleCommandSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SingleCommandSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "displayOption", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandDisplayOptionValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualCommandSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SingleCommandSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CustomThemeValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var CustomThemeValidator = /** @class */ (function (_super) { - __extends(CustomThemeValidator, _super); - function CustomThemeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomThemeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "themeJson", - validators: [new typeValidator_1.ObjectValidator()] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomThemeValidator; -}(typeValidator_1.ObjectValidator)); -exports.CustomThemeValidator = CustomThemeValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CustomThemeValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var CustomThemeValidator = /** @class */ (function (_super) { + __extends(CustomThemeValidator, _super); + function CustomThemeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomThemeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "themeJson", + validators: [new typeValidator_1.ObjectValidator()] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomThemeValidator; +}(typeValidator_1.ObjectValidator)); +exports.CustomThemeValidator = CustomThemeValidator; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DashboardLoadValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var DashboardLoadValidator = /** @class */ (function (_super) { - __extends(DashboardLoadValidator, _super); - function DashboardLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DashboardLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "pageView", - validators: [validator_1.Validators.pageViewFieldValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DashboardLoadValidator; -}(typeValidator_1.ObjectValidator)); -exports.DashboardLoadValidator = DashboardLoadValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DashboardLoadValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var DashboardLoadValidator = /** @class */ (function (_super) { + __extends(DashboardLoadValidator, _super); + function DashboardLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DashboardLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.pageViewFieldValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DashboardLoadValidator; +}(typeValidator_1.ObjectValidator)); +exports.DashboardLoadValidator = DashboardLoadValidator; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DatasetBindingValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var DatasetBindingValidator = /** @class */ (function (_super) { - __extends(DatasetBindingValidator, _super); - function DatasetBindingValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DatasetBindingValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DatasetBindingValidator; -}(typeValidator_1.ObjectValidator)); -exports.DatasetBindingValidator = DatasetBindingValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DatasetBindingValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var DatasetBindingValidator = /** @class */ (function (_super) { + __extends(DatasetBindingValidator, _super); + function DatasetBindingValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DatasetBindingValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DatasetBindingValidator; +}(typeValidator_1.ObjectValidator)); +exports.DatasetBindingValidator = DatasetBindingValidator; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExportDataRequestValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var ExportDataRequestValidator = /** @class */ (function (_super) { - __extends(ExportDataRequestValidator, _super); - function ExportDataRequestValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExportDataRequestValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "rows", - validators: [new typeValidator_1.NumberValidator()] - }, - { - field: "exportDataType", - validators: [new typeValidator_1.EnumValidator([0, 1])] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExportDataRequestValidator; -}(typeValidator_1.ObjectValidator)); -exports.ExportDataRequestValidator = ExportDataRequestValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExportDataRequestValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var ExportDataRequestValidator = /** @class */ (function (_super) { + __extends(ExportDataRequestValidator, _super); + function ExportDataRequestValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExportDataRequestValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "rows", + validators: [new typeValidator_1.NumberValidator()] + }, + { + field: "exportDataType", + validators: [new typeValidator_1.EnumValidator([0, 1])] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExportDataRequestValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExportDataRequestValidator = ExportDataRequestValidator; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExtensionsValidator = exports.MenuGroupExtensionValidator = exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.GroupedMenuExtensionValidator = exports.FlatMenuExtensionValidator = exports.MenuExtensionBaseValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var MenuExtensionBaseValidator = /** @class */ (function (_super) { - __extends(MenuExtensionBaseValidator, _super); - function MenuExtensionBaseValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - MenuExtensionBaseValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "title", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return MenuExtensionBaseValidator; -}(typeValidator_1.ObjectValidator)); -exports.MenuExtensionBaseValidator = MenuExtensionBaseValidator; -var FlatMenuExtensionValidator = /** @class */ (function (_super) { - __extends(FlatMenuExtensionValidator, _super); - function FlatMenuExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FlatMenuExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "menuLocation", - validators: [validator_1.Validators.menuLocationValidator] - }, - { - field: "groupName", - validators: [validator_1.Validators.fieldForbiddenValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FlatMenuExtensionValidator; -}(MenuExtensionBaseValidator)); -exports.FlatMenuExtensionValidator = FlatMenuExtensionValidator; -var GroupedMenuExtensionValidator = /** @class */ (function (_super) { - __extends(GroupedMenuExtensionValidator, _super); - function GroupedMenuExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - GroupedMenuExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "groupName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "menuLocation", - validators: [validator_1.Validators.fieldForbiddenValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return GroupedMenuExtensionValidator; -}(MenuExtensionBaseValidator)); -exports.GroupedMenuExtensionValidator = GroupedMenuExtensionValidator; -var ExtensionPointsValidator = /** @class */ (function (_super) { - __extends(ExtensionPointsValidator, _super); - function ExtensionPointsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionPointsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualContextMenu", - validators: [validator_1.Validators.menuExtensionValidator] - }, - { - field: "visualOptionsMenu", - validators: [validator_1.Validators.menuExtensionValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionPointsValidator; -}(typeValidator_1.ObjectValidator)); -exports.ExtensionPointsValidator = ExtensionPointsValidator; -var ExtensionItemValidator = /** @class */ (function (_super) { - __extends(ExtensionItemValidator, _super); - function ExtensionItemValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionItemValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "extend", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionItemValidator; -}(typeValidator_1.ObjectValidator)); -exports.ExtensionItemValidator = ExtensionItemValidator; -var CommandExtensionValidator = /** @class */ (function (_super) { - __extends(CommandExtensionValidator, _super); - function CommandExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "title", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "icon", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.commandExtensionSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CommandExtensionValidator; -}(ExtensionItemValidator)); -exports.CommandExtensionValidator = CommandExtensionValidator; -var ExtensionValidator = /** @class */ (function (_super) { - __extends(ExtensionValidator, _super); - function ExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "command", - validators: [validator_1.Validators.commandExtensionValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionValidator; -}(typeValidator_1.ObjectValidator)); -exports.ExtensionValidator = ExtensionValidator; -var MenuGroupExtensionValidator = /** @class */ (function (_super) { - __extends(MenuGroupExtensionValidator, _super); - function MenuGroupExtensionValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - MenuGroupExtensionValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "title", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "menuLocation", - validators: [validator_1.Validators.menuLocationValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return MenuGroupExtensionValidator; -}(typeValidator_1.ObjectValidator)); -exports.MenuGroupExtensionValidator = MenuGroupExtensionValidator; -var ExtensionsValidator = /** @class */ (function (_super) { - __extends(ExtensionsValidator, _super); - function ExtensionsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ExtensionsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "commands", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandExtensionArrayValidator] - }, - { - field: "groups", - validators: [validator_1.Validators.menuGroupExtensionArrayValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ExtensionsValidator; -}(typeValidator_1.ObjectValidator)); -exports.ExtensionsValidator = ExtensionsValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtensionsValidator = exports.MenuGroupExtensionValidator = exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.GroupedMenuExtensionValidator = exports.FlatMenuExtensionValidator = exports.MenuExtensionBaseValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var MenuExtensionBaseValidator = /** @class */ (function (_super) { + __extends(MenuExtensionBaseValidator, _super); + function MenuExtensionBaseValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + MenuExtensionBaseValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "title", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "icon", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return MenuExtensionBaseValidator; +}(typeValidator_1.ObjectValidator)); +exports.MenuExtensionBaseValidator = MenuExtensionBaseValidator; +var FlatMenuExtensionValidator = /** @class */ (function (_super) { + __extends(FlatMenuExtensionValidator, _super); + function FlatMenuExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FlatMenuExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] + }, + { + field: "groupName", + validators: [validator_1.Validators.fieldForbiddenValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FlatMenuExtensionValidator; +}(MenuExtensionBaseValidator)); +exports.FlatMenuExtensionValidator = FlatMenuExtensionValidator; +var GroupedMenuExtensionValidator = /** @class */ (function (_super) { + __extends(GroupedMenuExtensionValidator, _super); + function GroupedMenuExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + GroupedMenuExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "groupName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "menuLocation", + validators: [validator_1.Validators.fieldForbiddenValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return GroupedMenuExtensionValidator; +}(MenuExtensionBaseValidator)); +exports.GroupedMenuExtensionValidator = GroupedMenuExtensionValidator; +var ExtensionPointsValidator = /** @class */ (function (_super) { + __extends(ExtensionPointsValidator, _super); + function ExtensionPointsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionPointsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualContextMenu", + validators: [validator_1.Validators.menuExtensionValidator] + }, + { + field: "visualOptionsMenu", + validators: [validator_1.Validators.menuExtensionValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionPointsValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionPointsValidator = ExtensionPointsValidator; +var ExtensionItemValidator = /** @class */ (function (_super) { + __extends(ExtensionItemValidator, _super); + function ExtensionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionItemValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "extend", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.extensionPointsValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionItemValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionItemValidator = ExtensionItemValidator; +var CommandExtensionValidator = /** @class */ (function (_super) { + __extends(CommandExtensionValidator, _super); + function CommandExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "title", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "icon", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.commandExtensionSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CommandExtensionValidator; +}(ExtensionItemValidator)); +exports.CommandExtensionValidator = CommandExtensionValidator; +var ExtensionValidator = /** @class */ (function (_super) { + __extends(ExtensionValidator, _super); + function ExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "command", + validators: [validator_1.Validators.commandExtensionValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionValidator = ExtensionValidator; +var MenuGroupExtensionValidator = /** @class */ (function (_super) { + __extends(MenuGroupExtensionValidator, _super); + function MenuGroupExtensionValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + MenuGroupExtensionValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "title", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "menuLocation", + validators: [validator_1.Validators.menuLocationValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return MenuGroupExtensionValidator; +}(typeValidator_1.ObjectValidator)); +exports.MenuGroupExtensionValidator = MenuGroupExtensionValidator; +var ExtensionsValidator = /** @class */ (function (_super) { + __extends(ExtensionsValidator, _super); + function ExtensionsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ExtensionsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "commands", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.commandExtensionArrayValidator] + }, + { + field: "groups", + validators: [validator_1.Validators.menuGroupExtensionArrayValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ExtensionsValidator; +}(typeValidator_1.ObjectValidator)); +exports.ExtensionsValidator = ExtensionsValidator; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var FilterColumnTargetValidator = /** @class */ (function (_super) { - __extends(FilterColumnTargetValidator, _super); - function FilterColumnTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterColumnTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "column", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterColumnTargetValidator; -}(typeValidator_1.ObjectValidator)); -exports.FilterColumnTargetValidator = FilterColumnTargetValidator; -var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyColumnsTargetValidator, _super); - function FilterKeyColumnsTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterKeyColumnsTargetValidator; -}(FilterColumnTargetValidator)); -exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; -var FilterHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterHierarchyTargetValidator, _super); - function FilterHierarchyTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "hierarchy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "hierarchyLevel", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterHierarchyTargetValidator; -}(typeValidator_1.ObjectValidator)); -exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; -var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { - __extends(FilterKeyHierarchyTargetValidator, _super); - function FilterKeyHierarchyTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "keys", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterKeyHierarchyTargetValidator; -}(FilterHierarchyTargetValidator)); -exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; -var FilterMeasureTargetValidator = /** @class */ (function (_super) { - __extends(FilterMeasureTargetValidator, _super); - function FilterMeasureTargetValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "table", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "measure", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FilterMeasureTargetValidator; -}(typeValidator_1.ObjectValidator)); -exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; -var BasicFilterValidator = /** @class */ (function (_super) { - __extends(BasicFilterValidator, _super); - function BasicFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BasicFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.basicFilterTypeValidator] - }, - { - field: "requireSingleSelection", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return BasicFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.BasicFilterValidator = BasicFilterValidator; -var AdvancedFilterValidator = /** @class */ (function (_super) { - __extends(AdvancedFilterValidator, _super); - function AdvancedFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - AdvancedFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "logicalOperator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "conditions", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.advancedFilterTypeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return AdvancedFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.AdvancedFilterValidator = AdvancedFilterValidator; -var RelativeDateFilterValidator = /** @class */ (function (_super) { - __extends(RelativeDateFilterValidator, _super); - function RelativeDateFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - RelativeDateFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] - }, - { - field: "includeToday", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeDateFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return RelativeDateFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.RelativeDateFilterValidator = RelativeDateFilterValidator; -var RelativeTimeFilterValidator = /** @class */ (function (_super) { - __extends(RelativeTimeFilterValidator, _super); - function RelativeTimeFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] - }, - { - field: "timeUnitsCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "timeUnitType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.relativeTimeFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return RelativeTimeFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; -var TopNFilterValidator = /** @class */ (function (_super) { - __extends(TopNFilterValidator, _super); - function TopNFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - TopNFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "itemCount", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.topNFilterTypeValidator] - }, - { - field: "orderBy", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return TopNFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.TopNFilterValidator = TopNFilterValidator; -var NotSupportedFilterValidator = /** @class */ (function (_super) { - __extends(NotSupportedFilterValidator, _super); - function NotSupportedFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - NotSupportedFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.filterTargetValidator] - }, - { - field: "message", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "notSupportedTypeName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.notSupportedFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return NotSupportedFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.NotSupportedFilterValidator = NotSupportedFilterValidator; -var IncludeExcludeFilterValidator = /** @class */ (function (_super) { - __extends(IncludeExcludeFilterValidator, _super); - function IncludeExcludeFilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] - }, - { - field: "isExclude", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] - }, - { - field: "values", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] - }, - { - field: "filterType", - validators: [validator_1.Validators.includeExludeFilterTypeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return IncludeExcludeFilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; -var FilterValidator = /** @class */ (function (_super) { - __extends(FilterValidator, _super); - function FilterValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FilterValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - return validator_1.Validators.anyFilterValidator.validate(input, path, field); - }; - return FilterValidator; -}(typeValidator_1.ObjectValidator)); -exports.FilterValidator = FilterValidator; -var ConditionItemValidator = /** @class */ (function (_super) { - __extends(ConditionItemValidator, _super); - function ConditionItemValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ConditionItemValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "value", - validators: [validator_1.Validators.anyValueValidator] - }, - { - field: "operator", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ConditionItemValidator; -}(typeValidator_1.ObjectValidator)); -exports.ConditionItemValidator = ConditionItemValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConditionItemValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var FilterColumnTargetValidator = /** @class */ (function (_super) { + __extends(FilterColumnTargetValidator, _super); + function FilterColumnTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterColumnTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "column", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterColumnTargetValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterColumnTargetValidator = FilterColumnTargetValidator; +var FilterKeyColumnsTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyColumnsTargetValidator, _super); + function FilterKeyColumnsTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterKeyColumnsTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyColumnsTargetValidator; +}(FilterColumnTargetValidator)); +exports.FilterKeyColumnsTargetValidator = FilterKeyColumnsTargetValidator; +var FilterHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterHierarchyTargetValidator, _super); + function FilterHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "hierarchy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "hierarchyLevel", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterHierarchyTargetValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterHierarchyTargetValidator = FilterHierarchyTargetValidator; +var FilterKeyHierarchyTargetValidator = /** @class */ (function (_super) { + __extends(FilterKeyHierarchyTargetValidator, _super); + function FilterKeyHierarchyTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterKeyHierarchyTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "keys", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterKeyHierarchyTargetValidator; +}(FilterHierarchyTargetValidator)); +exports.FilterKeyHierarchyTargetValidator = FilterKeyHierarchyTargetValidator; +var FilterMeasureTargetValidator = /** @class */ (function (_super) { + __extends(FilterMeasureTargetValidator, _super); + function FilterMeasureTargetValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterMeasureTargetValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "table", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "measure", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FilterMeasureTargetValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterMeasureTargetValidator = FilterMeasureTargetValidator; +var BasicFilterValidator = /** @class */ (function (_super) { + __extends(BasicFilterValidator, _super); + function BasicFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + BasicFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.basicFilterTypeValidator] + }, + { + field: "requireSingleSelection", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return BasicFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.BasicFilterValidator = BasicFilterValidator; +var AdvancedFilterValidator = /** @class */ (function (_super) { + __extends(AdvancedFilterValidator, _super); + function AdvancedFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + AdvancedFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "logicalOperator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "conditions", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.advancedFilterTypeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return AdvancedFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.AdvancedFilterValidator = AdvancedFilterValidator; +var RelativeDateFilterValidator = /** @class */ (function (_super) { + __extends(RelativeDateFilterValidator, _super); + function RelativeDateFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelativeDateFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] + }, + { + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator] + }, + { + field: "includeToday", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.relativeDateFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeDateFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.RelativeDateFilterValidator = RelativeDateFilterValidator; +var RelativeTimeFilterValidator = /** @class */ (function (_super) { + __extends(RelativeTimeFilterValidator, _super); + function RelativeTimeFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + RelativeTimeFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator] + }, + { + field: "timeUnitsCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "timeUnitType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.relativeTimeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return RelativeTimeFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator; +var TopNFilterValidator = /** @class */ (function (_super) { + __extends(TopNFilterValidator, _super); + function TopNFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + TopNFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "itemCount", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.topNFilterTypeValidator] + }, + { + field: "orderBy", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return TopNFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.TopNFilterValidator = TopNFilterValidator; +var NotSupportedFilterValidator = /** @class */ (function (_super) { + __extends(NotSupportedFilterValidator, _super); + function NotSupportedFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + NotSupportedFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.filterTargetValidator] + }, + { + field: "message", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "notSupportedTypeName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.notSupportedFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return NotSupportedFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.NotSupportedFilterValidator = NotSupportedFilterValidator; +var IncludeExcludeFilterValidator = /** @class */ (function (_super) { + __extends(IncludeExcludeFilterValidator, _super); + function IncludeExcludeFilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + IncludeExcludeFilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterTargetValidator] + }, + { + field: "isExclude", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator] + }, + { + field: "values", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator] + }, + { + field: "filterType", + validators: [validator_1.Validators.includeExludeFilterTypeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return IncludeExcludeFilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator; +var FilterValidator = /** @class */ (function (_super) { + __extends(FilterValidator, _super); + function FilterValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FilterValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + return validator_1.Validators.anyFilterValidator.validate(input, path, field); + }; + return FilterValidator; +}(typeValidator_1.ObjectValidator)); +exports.FilterValidator = FilterValidator; +var ConditionItemValidator = /** @class */ (function (_super) { + __extends(ConditionItemValidator, _super); + function ConditionItemValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConditionItemValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "value", + validators: [validator_1.Validators.anyValueValidator] + }, + { + field: "operator", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ConditionItemValidator; +}(typeValidator_1.ObjectValidator)); +exports.ConditionItemValidator = ConditionItemValidator; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var CustomLayoutValidator = /** @class */ (function (_super) { - __extends(CustomLayoutValidator, _super); - function CustomLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "pageSize", - validators: [validator_1.Validators.pageSizeValidator] - }, - { - field: "displayOption", - validators: [validator_1.Validators.customLayoutDisplayOptionValidator] - }, - { - field: "pagesLayout", - validators: [validator_1.Validators.pagesLayoutValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomLayoutValidator; -}(typeValidator_1.ObjectValidator)); -exports.CustomLayoutValidator = CustomLayoutValidator; -var VisualLayoutValidator = /** @class */ (function (_super) { - __extends(VisualLayoutValidator, _super); - function VisualLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "x", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "y", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "z", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "displayState", - validators: [validator_1.Validators.displayStateValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualLayoutValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualLayoutValidator = VisualLayoutValidator; -var DisplayStateValidator = /** @class */ (function (_super) { - __extends(DisplayStateValidator, _super); - function DisplayStateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - DisplayStateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "mode", - validators: [validator_1.Validators.displayStateModeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return DisplayStateValidator; -}(typeValidator_1.ObjectValidator)); -exports.DisplayStateValidator = DisplayStateValidator; -var PageLayoutValidator = /** @class */ (function (_super) { - __extends(PageLayoutValidator, _super); - function PageLayoutValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageLayoutValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualsLayout", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] - }, - { - field: "defaultLayout", - validators: [validator_1.Validators.visualLayoutValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageLayoutValidator; -}(typeValidator_1.ObjectValidator)); -exports.PageLayoutValidator = PageLayoutValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var CustomLayoutValidator = /** @class */ (function (_super) { + __extends(CustomLayoutValidator, _super); + function CustomLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "pageSize", + validators: [validator_1.Validators.pageSizeValidator] + }, + { + field: "displayOption", + validators: [validator_1.Validators.customLayoutDisplayOptionValidator] + }, + { + field: "pagesLayout", + validators: [validator_1.Validators.pagesLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomLayoutValidator; +}(typeValidator_1.ObjectValidator)); +exports.CustomLayoutValidator = CustomLayoutValidator; +var VisualLayoutValidator = /** @class */ (function (_super) { + __extends(VisualLayoutValidator, _super); + function VisualLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "x", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "y", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "z", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "displayState", + validators: [validator_1.Validators.displayStateValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualLayoutValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualLayoutValidator = VisualLayoutValidator; +var DisplayStateValidator = /** @class */ (function (_super) { + __extends(DisplayStateValidator, _super); + function DisplayStateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + DisplayStateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "mode", + validators: [validator_1.Validators.displayStateModeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return DisplayStateValidator; +}(typeValidator_1.ObjectValidator)); +exports.DisplayStateValidator = DisplayStateValidator; +var PageLayoutValidator = /** @class */ (function (_super) { + __extends(PageLayoutValidator, _super); + function PageLayoutValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageLayoutValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualsLayout", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageLayoutValidator] + }, + { + field: "defaultLayout", + validators: [validator_1.Validators.visualLayoutValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageLayoutValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageLayoutValidator = PageLayoutValidator; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var PageSizeValidator = /** @class */ (function (_super) { - __extends(PageSizeValidator, _super); - function PageSizeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageSizeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "type", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageSizeValidator; -}(typeValidator_1.ObjectValidator)); -exports.PageSizeValidator = PageSizeValidator; -var CustomPageSizeValidator = /** @class */ (function (_super) { - __extends(CustomPageSizeValidator, _super); - function CustomPageSizeValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - CustomPageSizeValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return CustomPageSizeValidator; -}(PageSizeValidator)); -exports.CustomPageSizeValidator = CustomPageSizeValidator; -var PageValidator = /** @class */ (function (_super) { - __extends(PageValidator, _super); - function PageValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageValidator; -}(typeValidator_1.ObjectValidator)); -exports.PageValidator = PageValidator; -var PageViewFieldValidator = /** @class */ (function (_super) { - __extends(PageViewFieldValidator, _super); - function PageViewFieldValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageViewFieldValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; - if (possibleValues.indexOf(input) < 0) { - return [{ - message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" - }]; - } - return null; - }; - return PageViewFieldValidator; -}(typeValidator_1.StringValidator)); -exports.PageViewFieldValidator = PageViewFieldValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var PageSizeValidator = /** @class */ (function (_super) { + __extends(PageSizeValidator, _super); + function PageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "type", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.pageSizeTypeValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageSizeValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageSizeValidator = PageSizeValidator; +var CustomPageSizeValidator = /** @class */ (function (_super) { + __extends(CustomPageSizeValidator, _super); + function CustomPageSizeValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + CustomPageSizeValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return CustomPageSizeValidator; +}(PageSizeValidator)); +exports.CustomPageSizeValidator = CustomPageSizeValidator; +var PageValidator = /** @class */ (function (_super) { + __extends(PageValidator, _super); + function PageValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageValidator = PageValidator; +var PageViewFieldValidator = /** @class */ (function (_super) { + __extends(PageViewFieldValidator, _super); + function PageViewFieldValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageViewFieldValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var possibleValues = ["actualSize", "fitToWidth", "oneColumn"]; + if (possibleValues.indexOf(input) < 0) { + return [{ + message: "pageView must be a string with one of the following values: \"actualSize\", \"fitToWidth\", \"oneColumn\"" + }]; + } + return null; + }; + return PageViewFieldValidator; +}(typeValidator_1.StringValidator)); +exports.PageViewFieldValidator = PageViewFieldValidator; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var ReportPanesValidator = /** @class */ (function (_super) { - __extends(ReportPanesValidator, _super); - function ReportPanesValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportPanesValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "bookmarks", - validators: [validator_1.Validators.bookmarksPaneValidator] - }, - { - field: "fields", - validators: [validator_1.Validators.fieldsPaneValidator] - }, - { - field: "filters", - validators: [validator_1.Validators.filtersPaneValidator] - }, - { - field: "pageNavigation", - validators: [validator_1.Validators.pageNavigationPaneValidator] - }, - { - field: "selection", - validators: [validator_1.Validators.selectionPaneValidator] - }, - { - field: "syncSlicers", - validators: [validator_1.Validators.syncSlicersPaneValidator] - }, - { - field: "visualizations", - validators: [validator_1.Validators.visualizationsPaneValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportPanesValidator; -}(typeValidator_1.ObjectValidator)); -exports.ReportPanesValidator = ReportPanesValidator; -var BookmarksPaneValidator = /** @class */ (function (_super) { - __extends(BookmarksPaneValidator, _super); - function BookmarksPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - BookmarksPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return BookmarksPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.BookmarksPaneValidator = BookmarksPaneValidator; -var FieldsPaneValidator = /** @class */ (function (_super) { - __extends(FieldsPaneValidator, _super); - function FieldsPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FieldsPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FieldsPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.FieldsPaneValidator = FieldsPaneValidator; -var FiltersPaneValidator = /** @class */ (function (_super) { - __extends(FiltersPaneValidator, _super); - function FiltersPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - FiltersPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return FiltersPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.FiltersPaneValidator = FiltersPaneValidator; -var PageNavigationPaneValidator = /** @class */ (function (_super) { - __extends(PageNavigationPaneValidator, _super); - function PageNavigationPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - PageNavigationPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "position", - validators: [validator_1.Validators.pageNavigationPositionValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return PageNavigationPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.PageNavigationPaneValidator = PageNavigationPaneValidator; -var SelectionPaneValidator = /** @class */ (function (_super) { - __extends(SelectionPaneValidator, _super); - function SelectionPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SelectionPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SelectionPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.SelectionPaneValidator = SelectionPaneValidator; -var SyncSlicersPaneValidator = /** @class */ (function (_super) { - __extends(SyncSlicersPaneValidator, _super); - function SyncSlicersPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SyncSlicersPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; -var VisualizationsPaneValidator = /** @class */ (function (_super) { - __extends(VisualizationsPaneValidator, _super); - function VisualizationsPaneValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualizationsPaneValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "expanded", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualizationsPaneValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualizationsPaneValidator = VisualizationsPaneValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportPanesValidator = /** @class */ (function (_super) { + __extends(ReportPanesValidator, _super); + function ReportPanesValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportPanesValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "bookmarks", + validators: [validator_1.Validators.bookmarksPaneValidator] + }, + { + field: "fields", + validators: [validator_1.Validators.fieldsPaneValidator] + }, + { + field: "filters", + validators: [validator_1.Validators.filtersPaneValidator] + }, + { + field: "pageNavigation", + validators: [validator_1.Validators.pageNavigationPaneValidator] + }, + { + field: "selection", + validators: [validator_1.Validators.selectionPaneValidator] + }, + { + field: "syncSlicers", + validators: [validator_1.Validators.syncSlicersPaneValidator] + }, + { + field: "visualizations", + validators: [validator_1.Validators.visualizationsPaneValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportPanesValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportPanesValidator = ReportPanesValidator; +var BookmarksPaneValidator = /** @class */ (function (_super) { + __extends(BookmarksPaneValidator, _super); + function BookmarksPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + BookmarksPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return BookmarksPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.BookmarksPaneValidator = BookmarksPaneValidator; +var FieldsPaneValidator = /** @class */ (function (_super) { + __extends(FieldsPaneValidator, _super); + function FieldsPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FieldsPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FieldsPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.FieldsPaneValidator = FieldsPaneValidator; +var FiltersPaneValidator = /** @class */ (function (_super) { + __extends(FiltersPaneValidator, _super); + function FiltersPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + FiltersPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return FiltersPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.FiltersPaneValidator = FiltersPaneValidator; +var PageNavigationPaneValidator = /** @class */ (function (_super) { + __extends(PageNavigationPaneValidator, _super); + function PageNavigationPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + PageNavigationPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "position", + validators: [validator_1.Validators.pageNavigationPositionValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return PageNavigationPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.PageNavigationPaneValidator = PageNavigationPaneValidator; +var SelectionPaneValidator = /** @class */ (function (_super) { + __extends(SelectionPaneValidator, _super); + function SelectionPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SelectionPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SelectionPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.SelectionPaneValidator = SelectionPaneValidator; +var SyncSlicersPaneValidator = /** @class */ (function (_super) { + __extends(SyncSlicersPaneValidator, _super); + function SyncSlicersPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SyncSlicersPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SyncSlicersPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.SyncSlicersPaneValidator = SyncSlicersPaneValidator; +var VisualizationsPaneValidator = /** @class */ (function (_super) { + __extends(VisualizationsPaneValidator, _super); + function VisualizationsPaneValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualizationsPaneValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "expanded", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualizationsPaneValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualizationsPaneValidator = VisualizationsPaneValidator; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var LoadQnaValidator = /** @class */ (function (_super) { - __extends(LoadQnaValidator, _super); - function LoadQnaValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - LoadQnaValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "datasetIds", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] - }, - { - field: "question", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] - }, - { - field: "settings", - validators: [validator_1.Validators.qnaSettingValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return LoadQnaValidator; -}(typeValidator_1.ObjectValidator)); -exports.LoadQnaValidator = LoadQnaValidator; -var QnaSettingsValidator = /** @class */ (function (_super) { - __extends(QnaSettingsValidator, _super); - function QnaSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - QnaSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return QnaSettingsValidator; -}(typeValidator_1.ObjectValidator)); -exports.QnaSettingsValidator = QnaSettingsValidator; -var QnaInterpretInputDataValidator = /** @class */ (function (_super) { - __extends(QnaInterpretInputDataValidator, _super); - function QnaInterpretInputDataValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "datasetIds", - validators: [validator_1.Validators.stringArrayValidator] - }, - { - field: "question", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return QnaInterpretInputDataValidator; -}(typeValidator_1.ObjectValidator)); -exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var LoadQnaValidator = /** @class */ (function (_super) { + __extends(LoadQnaValidator, _super); + function LoadQnaValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + LoadQnaValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "datasetIds", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.qnaSettingValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return LoadQnaValidator; +}(typeValidator_1.ObjectValidator)); +exports.LoadQnaValidator = LoadQnaValidator; +var QnaSettingsValidator = /** @class */ (function (_super) { + __extends(QnaSettingsValidator, _super); + function QnaSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.QnaSettingsValidator = QnaSettingsValidator; +var QnaInterpretInputDataValidator = /** @class */ (function (_super) { + __extends(QnaInterpretInputDataValidator, _super); + function QnaInterpretInputDataValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + QnaInterpretInputDataValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "datasetIds", + validators: [validator_1.Validators.stringArrayValidator] + }, + { + field: "question", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return QnaInterpretInputDataValidator; +}(typeValidator_1.ObjectValidator)); +exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReportCreateValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var ReportCreateValidator = /** @class */ (function (_super) { - __extends(ReportCreateValidator, _super); - function ReportCreateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportCreateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "datasetId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "theme", - validators: [validator_1.Validators.customThemeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportCreateValidator; -}(typeValidator_1.ObjectValidator)); -exports.ReportCreateValidator = ReportCreateValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReportCreateValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportCreateValidator = /** @class */ (function (_super) { + __extends(ReportCreateValidator, _super); + function ReportCreateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportCreateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "datasetId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportCreateValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportCreateValidator = ReportCreateValidator; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReportLoadValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var ReportLoadValidator = /** @class */ (function (_super) { - __extends(ReportLoadValidator, _super); - function ReportLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - ReportLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "settings", - validators: [validator_1.Validators.settingsValidator] - }, - { - field: "pageName", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "filters", - validators: [validator_1.Validators.filtersArrayValidator] - }, - { - field: "permissions", - validators: [validator_1.Validators.permissionsValidator] - }, - { - field: "viewMode", - validators: [validator_1.Validators.viewModeValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "bookmark", - validators: [validator_1.Validators.applyBookmarkValidator] - }, - { - field: "theme", - validators: [validator_1.Validators.customThemeValidator] - }, - { - field: "embedUrl", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "datasetBinding", - validators: [validator_1.Validators.datasetBindingValidator] - }, - { - field: "contrastMode", - validators: [validator_1.Validators.contrastModeValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return ReportLoadValidator; -}(typeValidator_1.ObjectValidator)); -exports.ReportLoadValidator = ReportLoadValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReportLoadValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var ReportLoadValidator = /** @class */ (function (_super) { + __extends(ReportLoadValidator, _super); + function ReportLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + ReportLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "settings", + validators: [validator_1.Validators.settingsValidator] + }, + { + field: "pageName", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + }, + { + field: "permissions", + validators: [validator_1.Validators.permissionsValidator] + }, + { + field: "viewMode", + validators: [validator_1.Validators.viewModeValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "bookmark", + validators: [validator_1.Validators.applyBookmarkValidator] + }, + { + field: "theme", + validators: [validator_1.Validators.customThemeValidator] + }, + { + field: "embedUrl", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "datasetBinding", + validators: [validator_1.Validators.datasetBindingValidator] + }, + { + field: "contrastMode", + validators: [validator_1.Validators.contrastModeValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return ReportLoadValidator; +}(typeValidator_1.ObjectValidator)); +exports.ReportLoadValidator = ReportLoadValidator; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SaveAsParametersValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var SaveAsParametersValidator = /** @class */ (function (_super) { - __extends(SaveAsParametersValidator, _super); - function SaveAsParametersValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SaveAsParametersValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "name", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SaveAsParametersValidator; -}(typeValidator_1.ObjectValidator)); -exports.SaveAsParametersValidator = SaveAsParametersValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SaveAsParametersValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var SaveAsParametersValidator = /** @class */ (function (_super) { + __extends(SaveAsParametersValidator, _super); + function SaveAsParametersValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SaveAsParametersValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "name", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SaveAsParametersValidator; +}(typeValidator_1.ObjectValidator)); +exports.SaveAsParametersValidator = SaveAsParametersValidator; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var typeValidator_2 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var VisualSelectorValidator = /** @class */ (function (_super) { - __extends(VisualSelectorValidator, _super); - function VisualSelectorValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualSelectorValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - // Not required for this selector only - Backward compatibility - field: "$schema", - validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] - }, - { - field: "visualName", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualSelectorValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualSelectorValidator = VisualSelectorValidator; -var VisualTypeSelectorValidator = /** @class */ (function (_super) { - __extends(VisualTypeSelectorValidator, _super); - function VisualTypeSelectorValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "$schema", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] - }, - { - field: "visualType", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualTypeSelectorValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; -var SlicerTargetSelectorValidator = /** @class */ (function (_super) { - __extends(SlicerTargetSelectorValidator, _super); - function SlicerTargetSelectorValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "$schema", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] - }, - { - field: "target", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SlicerTargetSelectorValidator; -}(typeValidator_1.ObjectValidator)); -exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var typeValidator_2 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var VisualSelectorValidator = /** @class */ (function (_super) { + __extends(VisualSelectorValidator, _super); + function VisualSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + // Not required for this selector only - Backward compatibility + field: "$schema", + validators: [validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualSelector")] + }, + { + field: "visualName", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSelectorValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualSelectorValidator = VisualSelectorValidator; +var VisualTypeSelectorValidator = /** @class */ (function (_super) { + __extends(VisualTypeSelectorValidator, _super); + function VisualTypeSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualTypeSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#visualTypeSelector")] + }, + { + field: "visualType", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualTypeSelectorValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualTypeSelectorValidator = VisualTypeSelectorValidator; +var SlicerTargetSelectorValidator = /** @class */ (function (_super) { + __extends(SlicerTargetSelectorValidator, _super); + function SlicerTargetSelectorValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerTargetSelectorValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "$schema", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator, new typeValidator_2.SchemaValidator("http://powerbi.com/product/schema#slicerTargetSelector")] + }, + { + field: "target", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerTargetValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerTargetSelectorValidator; +}(typeValidator_1.ObjectValidator)); +exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SettingsValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var SettingsValidator = /** @class */ (function (_super) { - __extends(SettingsValidator, _super); - function SettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "filterPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "navContentPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "bookmarksPaneEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "useCustomSaveAsDialog", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "extensions", - validators: [validator_1.Validators.extensionsValidator] - }, - { - field: "layoutType", - validators: [validator_1.Validators.layoutTypeValidator] - }, - { - field: "customLayout", - validators: [validator_1.Validators.customLayoutValidator] - }, - { - field: "background", - validators: [validator_1.Validators.backgroundValidator] - }, - { - field: "visualSettings", - validators: [validator_1.Validators.visualSettingsValidator] - }, - { - field: "hideErrors", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "commands", - validators: [validator_1.Validators.commandsSettingsArrayValidator] - }, - { - field: "hyperlinkClickBehavior", - validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] - }, - { - field: "bars", - validators: [validator_1.Validators.reportBarsValidator] - }, - { - field: "panes", - validators: [validator_1.Validators.reportPanesValidator] - }, - { - field: "personalBookmarksEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "persistentFiltersEnabled", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "visualRenderedEvents", - validators: [validator_1.Validators.booleanValidator] - }, - { - field: "authoringHintsEnabled", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SettingsValidator; -}(typeValidator_1.ObjectValidator)); -exports.SettingsValidator = SettingsValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SettingsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var SettingsValidator = /** @class */ (function (_super) { + __extends(SettingsValidator, _super); + function SettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filterPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "navContentPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "bookmarksPaneEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "useCustomSaveAsDialog", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "extensions", + validators: [validator_1.Validators.extensionsValidator] + }, + { + field: "layoutType", + validators: [validator_1.Validators.layoutTypeValidator] + }, + { + field: "customLayout", + validators: [validator_1.Validators.customLayoutValidator] + }, + { + field: "background", + validators: [validator_1.Validators.backgroundValidator] + }, + { + field: "visualSettings", + validators: [validator_1.Validators.visualSettingsValidator] + }, + { + field: "hideErrors", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "commands", + validators: [validator_1.Validators.commandsSettingsArrayValidator] + }, + { + field: "hyperlinkClickBehavior", + validators: [validator_1.Validators.hyperlinkClickBehaviorValidator] + }, + { + field: "bars", + validators: [validator_1.Validators.reportBarsValidator] + }, + { + field: "panes", + validators: [validator_1.Validators.reportPanesValidator] + }, + { + field: "personalBookmarksEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "persistentFiltersEnabled", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "visualRenderedEvents", + validators: [validator_1.Validators.booleanValidator] + }, + { + field: "authoringHintsEnabled", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.SettingsValidator = SettingsValidator; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SlicerStateValidator = exports.SlicerValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var SlicerValidator = /** @class */ (function (_super) { - __extends(SlicerValidator, _super); - function SlicerValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlicerValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "selector", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] - }, - { - field: "state", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SlicerValidator; -}(typeValidator_1.ObjectValidator)); -exports.SlicerValidator = SlicerValidator; -var SlicerStateValidator = /** @class */ (function (_super) { - __extends(SlicerStateValidator, _super); - function SlicerStateValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - SlicerStateValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "filters", - validators: [validator_1.Validators.filtersArrayValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return SlicerStateValidator; -}(typeValidator_1.ObjectValidator)); -exports.SlicerStateValidator = SlicerStateValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SlicerStateValidator = exports.SlicerValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var SlicerValidator = /** @class */ (function (_super) { + __extends(SlicerValidator, _super); + function SlicerValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "selector", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerSelectorValidator] + }, + { + field: "state", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.slicerStateValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerValidator; +}(typeValidator_1.ObjectValidator)); +exports.SlicerValidator = SlicerValidator; +var SlicerStateValidator = /** @class */ (function (_super) { + __extends(SlicerStateValidator, _super); + function SlicerStateValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + SlicerStateValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "filters", + validators: [validator_1.Validators.filtersArrayValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return SlicerStateValidator; +}(typeValidator_1.ObjectValidator)); +exports.SlicerStateValidator = SlicerStateValidator; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TileLoadValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var TileLoadValidator = /** @class */ (function (_super) { - __extends(TileLoadValidator, _super); - function TileLoadValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - TileLoadValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "accessToken", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "id", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "dashboardId", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] - }, - { - field: "groupId", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "pageView", - validators: [validator_1.Validators.stringValidator] - }, - { - field: "tokenType", - validators: [validator_1.Validators.tokenTypeValidator] - }, - { - field: "width", - validators: [validator_1.Validators.numberValidator] - }, - { - field: "height", - validators: [validator_1.Validators.numberValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return TileLoadValidator; -}(typeValidator_1.ObjectValidator)); -exports.TileLoadValidator = TileLoadValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TileLoadValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var TileLoadValidator = /** @class */ (function (_super) { + __extends(TileLoadValidator, _super); + function TileLoadValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + TileLoadValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "accessToken", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "id", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "dashboardId", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator] + }, + { + field: "groupId", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "pageView", + validators: [validator_1.Validators.stringValidator] + }, + { + field: "tokenType", + validators: [validator_1.Validators.tokenTypeValidator] + }, + { + field: "width", + validators: [validator_1.Validators.numberValidator] + }, + { + field: "height", + validators: [validator_1.Validators.numberValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return TileLoadValidator; +}(typeValidator_1.ObjectValidator)); +exports.TileLoadValidator = TileLoadValidator; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; -var multipleFieldsValidator_1 = __webpack_require__(3); -var typeValidator_1 = __webpack_require__(4); -var validator_1 = __webpack_require__(1); -var VisualSettingsValidator = /** @class */ (function (_super) { - __extends(VisualSettingsValidator, _super); - function VisualSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visualHeaders", - validators: [validator_1.Validators.visualHeadersValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualSettingsValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualSettingsValidator = VisualSettingsValidator; -var VisualHeaderSettingsValidator = /** @class */ (function (_super) { - __extends(VisualHeaderSettingsValidator, _super); - function VisualHeaderSettingsValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "visible", - validators: [validator_1.Validators.booleanValidator] - } - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualHeaderSettingsValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; -var VisualHeaderValidator = /** @class */ (function (_super) { - __extends(VisualHeaderValidator, _super); - function VisualHeaderValidator() { - return _super !== null && _super.apply(this, arguments) || this; - } - VisualHeaderValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - var fields = [ - { - field: "settings", - validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] - }, - { - field: "selector", - validators: [validator_1.Validators.visualHeaderSelectorValidator] - }, - ]; - var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); - return multipleFieldsValidator.validate(input, path, field); - }; - return VisualHeaderValidator; -}(typeValidator_1.ObjectValidator)); -exports.VisualHeaderValidator = VisualHeaderValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0; +var multipleFieldsValidator_1 = __webpack_require__(3); +var typeValidator_1 = __webpack_require__(4); +var validator_1 = __webpack_require__(1); +var VisualSettingsValidator = /** @class */ (function (_super) { + __extends(VisualSettingsValidator, _super); + function VisualSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visualHeaders", + validators: [validator_1.Validators.visualHeadersValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualSettingsValidator = VisualSettingsValidator; +var VisualHeaderSettingsValidator = /** @class */ (function (_super) { + __extends(VisualHeaderSettingsValidator, _super); + function VisualHeaderSettingsValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualHeaderSettingsValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "visible", + validators: [validator_1.Validators.booleanValidator] + } + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualHeaderSettingsValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualHeaderSettingsValidator = VisualHeaderSettingsValidator; +var VisualHeaderValidator = /** @class */ (function (_super) { + __extends(VisualHeaderValidator, _super); + function VisualHeaderValidator() { + return _super !== null && _super.apply(this, arguments) || this; + } + VisualHeaderValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + var fields = [ + { + field: "settings", + validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.visualHeaderSettingsValidator] + }, + { + field: "selector", + validators: [validator_1.Validators.visualHeaderSelectorValidator] + }, + ]; + var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields); + return multipleFieldsValidator.validate(input, path, field); + }; + return VisualHeaderValidator; +}(typeValidator_1.ObjectValidator)); +exports.VisualHeaderValidator = VisualHeaderValidator; /***/ }), /* 25 */ /***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AnyOfValidator = void 0; -var AnyOfValidator = /** @class */ (function () { - function AnyOfValidator(validators) { - this.validators = validators; - } - AnyOfValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var valid = false; - for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { - var validator = _a[_i]; - var errors = validator.validate(input, path, field); - if (!errors) { - valid = true; - break; - } - } - if (!valid) { - return [{ - message: field + " property is invalid", - path: (path ? path + "." : "") + field, - keyword: "invalid" - }]; - } - return null; - }; - return AnyOfValidator; -}()); -exports.AnyOfValidator = AnyOfValidator; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnyOfValidator = void 0; +var AnyOfValidator = /** @class */ (function () { + function AnyOfValidator(validators) { + this.validators = validators; + } + AnyOfValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var valid = false; + for (var _i = 0, _a = this.validators; _i < _a.length; _i++) { + var validator = _a[_i]; + var errors = validator.validate(input, path, field); + if (!errors) { + valid = true; + break; + } + } + if (!valid) { + return [{ + message: field + " property is invalid", + path: (path ? path + "." : "") + field, + keyword: "invalid" + }]; + } + return null; + }; + return AnyOfValidator; +}()); +exports.AnyOfValidator = AnyOfValidator; /***/ }), /* 26 */ /***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FieldForbiddenValidator = void 0; -var FieldForbiddenValidator = /** @class */ (function () { - function FieldForbiddenValidator() { - } - FieldForbiddenValidator.prototype.validate = function (input, path, field) { - if (input !== undefined) { - return [{ - message: field + " is forbidden", - path: (path ? path + "." : "") + field, - keyword: "forbidden" - }]; - } - return null; - }; - return FieldForbiddenValidator; -}()); -exports.FieldForbiddenValidator = FieldForbiddenValidator; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FieldForbiddenValidator = void 0; +var FieldForbiddenValidator = /** @class */ (function () { + function FieldForbiddenValidator() { + } + FieldForbiddenValidator.prototype.validate = function (input, path, field) { + if (input !== undefined) { + return [{ + message: field + " is forbidden", + path: (path ? path + "." : "") + field, + keyword: "forbidden" + }]; + } + return null; + }; + return FieldForbiddenValidator; +}()); +exports.FieldForbiddenValidator = FieldForbiddenValidator; /***/ }), /* 27 */ /***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FieldRequiredValidator = void 0; -var FieldRequiredValidator = /** @class */ (function () { - function FieldRequiredValidator() { - } - FieldRequiredValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return [{ - message: field + " is required", - path: (path ? path + "." : "") + field, - keyword: "required" - }]; - } - return null; - }; - return FieldRequiredValidator; -}()); -exports.FieldRequiredValidator = FieldRequiredValidator; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FieldRequiredValidator = void 0; +var FieldRequiredValidator = /** @class */ (function () { + function FieldRequiredValidator() { + } + FieldRequiredValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return [{ + message: field + " is required", + path: (path ? path + "." : "") + field, + keyword: "required" + }]; + } + return null; + }; + return FieldRequiredValidator; +}()); +exports.FieldRequiredValidator = FieldRequiredValidator; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MapValidator = void 0; -var typeValidator_1 = __webpack_require__(4); -var MapValidator = /** @class */ (function (_super) { - __extends(MapValidator, _super); - function MapValidator(keyValidators, valueValidators) { - var _this = _super.call(this) || this; - _this.keyValidators = keyValidators; - _this.valueValidators = valueValidators; - return _this; - } - MapValidator.prototype.validate = function (input, path, field) { - if (input == null) { - return null; - } - var errors = _super.prototype.validate.call(this, input, path, field); - if (errors) { - return errors; - } - for (var key in input) { - if (input.hasOwnProperty(key)) { - var fieldsPath = (path ? path + "." : "") + field + "." + key; - for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { - var keyValidator = _a[_i]; - errors = keyValidator.validate(key, fieldsPath, field); - if (errors) { - return errors; - } - } - for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { - var valueValidator = _c[_b]; - errors = valueValidator.validate(input[key], fieldsPath, field); - if (errors) { - return errors; - } - } - } - } - return null; - }; - return MapValidator; -}(typeValidator_1.ObjectValidator)); -exports.MapValidator = MapValidator; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MapValidator = void 0; +var typeValidator_1 = __webpack_require__(4); +var MapValidator = /** @class */ (function (_super) { + __extends(MapValidator, _super); + function MapValidator(keyValidators, valueValidators) { + var _this = _super.call(this) || this; + _this.keyValidators = keyValidators; + _this.valueValidators = valueValidators; + return _this; + } + MapValidator.prototype.validate = function (input, path, field) { + if (input == null) { + return null; + } + var errors = _super.prototype.validate.call(this, input, path, field); + if (errors) { + return errors; + } + for (var key in input) { + if (input.hasOwnProperty(key)) { + var fieldsPath = (path ? path + "." : "") + field + "." + key; + for (var _i = 0, _a = this.keyValidators; _i < _a.length; _i++) { + var keyValidator = _a[_i]; + errors = keyValidator.validate(key, fieldsPath, field); + if (errors) { + return errors; + } + } + for (var _b = 0, _c = this.valueValidators; _b < _c.length; _b++) { + var valueValidator = _c[_b]; + errors = valueValidator.validate(input[key], fieldsPath, field); + if (errors) { + return errors; + } + } + } + } + return null; + }; + return MapValidator; +}(typeValidator_1.ObjectValidator)); +exports.MapValidator = MapValidator; /***/ }) @@ -5273,23 +5273,23 @@ return /******/ (function(modules) { // webpackBootstrap /* 2 */ /***/ function(module, exports) { - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } /***/ }, /* 3 */ /***/ function(module, exports) { - module.exports = function() { throw new Error("define cannot be used indirect"); }; + module.exports = function() { throw new Error("define cannot be used indirect"); }; /***/ } @@ -5359,241 +5359,241 @@ return /******/ (function(modules) { // webpackBootstrap /* 0 */ /***/ (function(module, exports) { - "use strict"; - var WindowPostMessageProxy = (function () { - function WindowPostMessageProxy(options) { - var _this = this; - if (options === void 0) { options = { - processTrackingProperties: { - addTrackingProperties: WindowPostMessageProxy.defaultAddTrackingProperties, - getTrackingProperties: WindowPostMessageProxy.defaultGetTrackingProperties - }, - isErrorMessage: WindowPostMessageProxy.defaultIsErrorMessage, - receiveWindow: window, - name: WindowPostMessageProxy.createRandomString() - }; } - this.pendingRequestPromises = {}; - // save options with defaults - this.addTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.addTrackingProperties) || WindowPostMessageProxy.defaultAddTrackingProperties; - this.getTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.getTrackingProperties) || WindowPostMessageProxy.defaultGetTrackingProperties; - this.isErrorMessage = options.isErrorMessage || WindowPostMessageProxy.defaultIsErrorMessage; - this.receiveWindow = options.receiveWindow || window; - this.name = options.name || WindowPostMessageProxy.createRandomString(); - this.logMessages = options.logMessages || false; - this.eventSourceOverrideWindow = options.eventSourceOverrideWindow; - this.suppressWarnings = options.suppressWarnings || false; - if (this.logMessages) { - console.log("new WindowPostMessageProxy created with name: " + this.name + " receiving on window: " + this.receiveWindow.document.title); - } - // Initialize - this.handlers = []; - this.windowMessageHandler = function (event) { return _this.onMessageReceived(event); }; - this.start(); - } - // Static - WindowPostMessageProxy.defaultAddTrackingProperties = function (message, trackingProperties) { - message[WindowPostMessageProxy.messagePropertyName] = trackingProperties; - return message; - }; - WindowPostMessageProxy.defaultGetTrackingProperties = function (message) { - return message[WindowPostMessageProxy.messagePropertyName]; - }; - WindowPostMessageProxy.defaultIsErrorMessage = function (message) { - return !!message.error; - }; - /** - * Utility to create a deferred object. - */ - // TODO: Look to use RSVP library instead of doing this manually. - // From what I searched RSVP would work better because it has .finally and .deferred; however, it doesn't have Typings information. - WindowPostMessageProxy.createDeferred = function () { - var deferred = { - resolve: null, - reject: null, - promise: null - }; - var promise = new Promise(function (resolve, reject) { - deferred.resolve = resolve; - deferred.reject = reject; - }); - deferred.promise = promise; - return deferred; - }; - /** - * Utility to generate random sequence of characters used as tracking id for promises. - */ - WindowPostMessageProxy.createRandomString = function () { - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - return randomValueArray[0].toString(36).substring(1); - }; - /** - * Adds handler. - * If the first handler whose test method returns true will handle the message and provide a response. - */ - WindowPostMessageProxy.prototype.addHandler = function (handler) { - this.handlers.push(handler); - }; - /** - * Removes handler. - * The reference must match the original object that was provided when adding the handler. - */ - WindowPostMessageProxy.prototype.removeHandler = function (handler) { - var handlerIndex = this.handlers.indexOf(handler); - if (handlerIndex === -1) { - throw new Error("You attempted to remove a handler but no matching handler was found."); - } - this.handlers.splice(handlerIndex, 1); - }; - /** - * Start listening to message events. - */ - WindowPostMessageProxy.prototype.start = function () { - this.receiveWindow.addEventListener('message', this.windowMessageHandler); - }; - /** - * Stops listening to message events. - */ - WindowPostMessageProxy.prototype.stop = function () { - this.receiveWindow.removeEventListener('message', this.windowMessageHandler); - }; - /** - * Post message to target window with tracking properties added and save deferred object referenced by tracking id. - */ - WindowPostMessageProxy.prototype.postMessage = function (targetWindow, message) { - // Add tracking properties to indicate message came from this proxy - var trackingProperties = { id: WindowPostMessageProxy.createRandomString() }; - this.addTrackingProperties(message, trackingProperties); - if (this.logMessages) { - console.log(this.name + " Posting message:"); - console.log(JSON.stringify(message, null, ' ')); - } - targetWindow.postMessage(message, "*"); - var deferred = WindowPostMessageProxy.createDeferred(); - this.pendingRequestPromises[trackingProperties.id] = deferred; - return deferred.promise; - }; - /** - * Send response message to target window. - * Response messages re-use tracking properties from a previous request message. - */ - WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) { - this.addTrackingProperties(message, trackingProperties); - if (this.logMessages) { - console.log(this.name + " Sending response:"); - console.log(JSON.stringify(message, null, ' ')); - } - targetWindow.postMessage(message, "*"); - }; - /** - * Message handler. - */ - WindowPostMessageProxy.prototype.onMessageReceived = function (event) { - var _this = this; - if (this.logMessages) { - console.log(this.name + " Received message:"); - console.log("type: " + event.type); - console.log(JSON.stringify(event.data, null, ' ')); - } - var sendingWindow = this.eventSourceOverrideWindow || event.source; - var message = event.data; - if (typeof message !== "object") { - if (!this.suppressWarnings) { - console.warn("Proxy(" + this.name + "): Received message that was not an object. Discarding message"); - } - return; - } - var trackingProperties; - try { - trackingProperties = this.getTrackingProperties(message); - } - catch (e) { - if (!this.suppressWarnings) { - console.warn("Proxy(" + this.name + "): Error occurred when attempting to get tracking properties from incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - } - var deferred; - if (trackingProperties) { - deferred = this.pendingRequestPromises[trackingProperties.id]; - } - // If message does not have a known ID, treat it as a request - // Otherwise, treat message as response - if (!deferred) { - var handled = this.handlers.some(function (handler) { - var canMessageBeHandled = false; - try { - canMessageBeHandled = handler.test(message); - } - catch (e) { - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): Error occurred when handler was testing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - } - if (canMessageBeHandled) { - var responseMessagePromise = void 0; - try { - responseMessagePromise = Promise.resolve(handler.handle(message)); - } - catch (e) { - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): Error occurred when handler was processing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); - } - responseMessagePromise = Promise.resolve(); - } - responseMessagePromise - .then(function (responseMessage) { - if (!responseMessage) { - var warningMessage = "Handler for message: " + JSON.stringify(message, null, ' ') + " did not return a response message. The default response message will be returned instead."; - if (!_this.suppressWarnings) { - console.warn("Proxy(" + _this.name + "): " + warningMessage); - } - responseMessage = { - warning: warningMessage - }; - } - _this.sendResponse(sendingWindow, responseMessage, trackingProperties); - }); - return true; - } - }); - /** - * TODO: Consider returning an error message if nothing handled the message. - * In the case of the Report receiving messages all of them should be handled, - * however, in the case of the SDK receiving messages it's likely it won't register handlers - * for all events. Perhaps make this an option at construction time. - */ - if (!handled && !this.suppressWarnings) { - console.warn("Proxy(" + this.name + ") did not handle message. Handlers: " + this.handlers.length + " Message: " + JSON.stringify(message, null, '') + "."); - } - } - else { - /** - * If error message reject promise, - * Otherwise, resolve promise - */ - var isErrorMessage = true; - try { - isErrorMessage = this.isErrorMessage(message); - } - catch (e) { - console.warn("Proxy(" + this.name + ") Error occurred when trying to determine if message is consider an error response. Message: ", JSON.stringify(message, null, ''), 'Error: ', e); - } - if (isErrorMessage) { - deferred.reject(message); - } - else { - deferred.resolve(message); - } - // TODO: Move to .finally clause up where promise is created for better maitenance like original proxy code. - delete this.pendingRequestPromises[trackingProperties.id]; - } - }; - WindowPostMessageProxy.messagePropertyName = "windowPostMessageProxy"; - return WindowPostMessageProxy; - }()); - exports.WindowPostMessageProxy = WindowPostMessageProxy; + "use strict"; + var WindowPostMessageProxy = (function () { + function WindowPostMessageProxy(options) { + var _this = this; + if (options === void 0) { options = { + processTrackingProperties: { + addTrackingProperties: WindowPostMessageProxy.defaultAddTrackingProperties, + getTrackingProperties: WindowPostMessageProxy.defaultGetTrackingProperties + }, + isErrorMessage: WindowPostMessageProxy.defaultIsErrorMessage, + receiveWindow: window, + name: WindowPostMessageProxy.createRandomString() + }; } + this.pendingRequestPromises = {}; + // save options with defaults + this.addTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.addTrackingProperties) || WindowPostMessageProxy.defaultAddTrackingProperties; + this.getTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.getTrackingProperties) || WindowPostMessageProxy.defaultGetTrackingProperties; + this.isErrorMessage = options.isErrorMessage || WindowPostMessageProxy.defaultIsErrorMessage; + this.receiveWindow = options.receiveWindow || window; + this.name = options.name || WindowPostMessageProxy.createRandomString(); + this.logMessages = options.logMessages || false; + this.eventSourceOverrideWindow = options.eventSourceOverrideWindow; + this.suppressWarnings = options.suppressWarnings || false; + if (this.logMessages) { + console.log("new WindowPostMessageProxy created with name: " + this.name + " receiving on window: " + this.receiveWindow.document.title); + } + // Initialize + this.handlers = []; + this.windowMessageHandler = function (event) { return _this.onMessageReceived(event); }; + this.start(); + } + // Static + WindowPostMessageProxy.defaultAddTrackingProperties = function (message, trackingProperties) { + message[WindowPostMessageProxy.messagePropertyName] = trackingProperties; + return message; + }; + WindowPostMessageProxy.defaultGetTrackingProperties = function (message) { + return message[WindowPostMessageProxy.messagePropertyName]; + }; + WindowPostMessageProxy.defaultIsErrorMessage = function (message) { + return !!message.error; + }; + /** + * Utility to create a deferred object. + */ + // TODO: Look to use RSVP library instead of doing this manually. + // From what I searched RSVP would work better because it has .finally and .deferred; however, it doesn't have Typings information. + WindowPostMessageProxy.createDeferred = function () { + var deferred = { + resolve: null, + reject: null, + promise: null + }; + var promise = new Promise(function (resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + deferred.promise = promise; + return deferred; + }; + /** + * Utility to generate random sequence of characters used as tracking id for promises. + */ + WindowPostMessageProxy.createRandomString = function () { + // window.msCrypto for IE + var cryptoObj = window.crypto || window.msCrypto; + var randomValueArray = new Uint32Array(1); + cryptoObj.getRandomValues(randomValueArray); + return randomValueArray[0].toString(36).substring(1); + }; + /** + * Adds handler. + * If the first handler whose test method returns true will handle the message and provide a response. + */ + WindowPostMessageProxy.prototype.addHandler = function (handler) { + this.handlers.push(handler); + }; + /** + * Removes handler. + * The reference must match the original object that was provided when adding the handler. + */ + WindowPostMessageProxy.prototype.removeHandler = function (handler) { + var handlerIndex = this.handlers.indexOf(handler); + if (handlerIndex === -1) { + throw new Error("You attempted to remove a handler but no matching handler was found."); + } + this.handlers.splice(handlerIndex, 1); + }; + /** + * Start listening to message events. + */ + WindowPostMessageProxy.prototype.start = function () { + this.receiveWindow.addEventListener('message', this.windowMessageHandler); + }; + /** + * Stops listening to message events. + */ + WindowPostMessageProxy.prototype.stop = function () { + this.receiveWindow.removeEventListener('message', this.windowMessageHandler); + }; + /** + * Post message to target window with tracking properties added and save deferred object referenced by tracking id. + */ + WindowPostMessageProxy.prototype.postMessage = function (targetWindow, message) { + // Add tracking properties to indicate message came from this proxy + var trackingProperties = { id: WindowPostMessageProxy.createRandomString() }; + this.addTrackingProperties(message, trackingProperties); + if (this.logMessages) { + console.log(this.name + " Posting message:"); + console.log(JSON.stringify(message, null, ' ')); + } + targetWindow.postMessage(message, "*"); + var deferred = WindowPostMessageProxy.createDeferred(); + this.pendingRequestPromises[trackingProperties.id] = deferred; + return deferred.promise; + }; + /** + * Send response message to target window. + * Response messages re-use tracking properties from a previous request message. + */ + WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) { + this.addTrackingProperties(message, trackingProperties); + if (this.logMessages) { + console.log(this.name + " Sending response:"); + console.log(JSON.stringify(message, null, ' ')); + } + targetWindow.postMessage(message, "*"); + }; + /** + * Message handler. + */ + WindowPostMessageProxy.prototype.onMessageReceived = function (event) { + var _this = this; + if (this.logMessages) { + console.log(this.name + " Received message:"); + console.log("type: " + event.type); + console.log(JSON.stringify(event.data, null, ' ')); + } + var sendingWindow = this.eventSourceOverrideWindow || event.source; + var message = event.data; + if (typeof message !== "object") { + if (!this.suppressWarnings) { + console.warn("Proxy(" + this.name + "): Received message that was not an object. Discarding message"); + } + return; + } + var trackingProperties; + try { + trackingProperties = this.getTrackingProperties(message); + } + catch (e) { + if (!this.suppressWarnings) { + console.warn("Proxy(" + this.name + "): Error occurred when attempting to get tracking properties from incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); + } + } + var deferred; + if (trackingProperties) { + deferred = this.pendingRequestPromises[trackingProperties.id]; + } + // If message does not have a known ID, treat it as a request + // Otherwise, treat message as response + if (!deferred) { + var handled = this.handlers.some(function (handler) { + var canMessageBeHandled = false; + try { + canMessageBeHandled = handler.test(message); + } + catch (e) { + if (!_this.suppressWarnings) { + console.warn("Proxy(" + _this.name + "): Error occurred when handler was testing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); + } + } + if (canMessageBeHandled) { + var responseMessagePromise = void 0; + try { + responseMessagePromise = Promise.resolve(handler.handle(message)); + } + catch (e) { + if (!_this.suppressWarnings) { + console.warn("Proxy(" + _this.name + "): Error occurred when handler was processing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e); + } + responseMessagePromise = Promise.resolve(); + } + responseMessagePromise + .then(function (responseMessage) { + if (!responseMessage) { + var warningMessage = "Handler for message: " + JSON.stringify(message, null, ' ') + " did not return a response message. The default response message will be returned instead."; + if (!_this.suppressWarnings) { + console.warn("Proxy(" + _this.name + "): " + warningMessage); + } + responseMessage = { + warning: warningMessage + }; + } + _this.sendResponse(sendingWindow, responseMessage, trackingProperties); + }); + return true; + } + }); + /** + * TODO: Consider returning an error message if nothing handled the message. + * In the case of the Report receiving messages all of them should be handled, + * however, in the case of the SDK receiving messages it's likely it won't register handlers + * for all events. Perhaps make this an option at construction time. + */ + if (!handled && !this.suppressWarnings) { + console.warn("Proxy(" + this.name + ") did not handle message. Handlers: " + this.handlers.length + " Message: " + JSON.stringify(message, null, '') + "."); + } + } + else { + /** + * If error message reject promise, + * Otherwise, resolve promise + */ + var isErrorMessage = true; + try { + isErrorMessage = this.isErrorMessage(message); + } + catch (e) { + console.warn("Proxy(" + this.name + ") Error occurred when trying to determine if message is consider an error response. Message: ", JSON.stringify(message, null, ''), 'Error: ', e); + } + if (isErrorMessage) { + deferred.reject(message); + } + else { + deferred.resolve(message); + } + // TODO: Move to .finally clause up where promise is created for better maitenance like original proxy code. + delete this.pendingRequestPromises[trackingProperties.id]; + } + }; + WindowPostMessageProxy.messagePropertyName = "windowPostMessageProxy"; + return WindowPostMessageProxy; + }()); + exports.WindowPostMessageProxy = WindowPostMessageProxy; /***/ }) @@ -5611,245 +5611,245 @@ return /******/ (function(modules) { // webpackBootstrap /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BookmarksManager = void 0; -var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); -var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); -/** - * Manages report bookmarks. - * - * @export - * @class BookmarksManager - * @implements {IBookmarksManager} - */ -var BookmarksManager = /** @class */ (function () { - /** - * @hidden - */ - function BookmarksManager(service, config, iframe) { - this.service = service; - this.config = config; - this.iframe = iframe; - } - /** - * Gets bookmarks that are defined in the report. - * - * ```javascript - * // Gets bookmarks that are defined in the report - * bookmarksManager.getBookmarks() - * .then(bookmarks => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - BookmarksManager.prototype.getBookmarks = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_1 = _a.sent(); - throw response_1.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Apply bookmark by name. - * - * ```javascript - * bookmarksManager.apply(bookmarkName) - * ``` - * - * @param {string} bookmarkName The name of the bookmark to be applied - * @returns {Promise>} - */ - BookmarksManager.prototype.apply = function (bookmarkName) { - return __awaiter(this, void 0, void 0, function () { - var request, response_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - request = { - name: bookmarkName - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_2 = _a.sent(); - throw response_2.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Play bookmarks: Enter or Exit bookmarks presentation mode. - * - * ```javascript - * // Enter presentation mode. - * bookmarksManager.play(models.BookmarksPlayMode.Presentation) - * ``` - * - * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` - * @returns {Promise>} - */ - BookmarksManager.prototype.play = function (playMode) { - return __awaiter(this, void 0, void 0, function () { - var playBookmarkRequest, response_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - playBookmarkRequest = { - playMode: playMode - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_3 = _a.sent(); - throw response_3.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Capture bookmark from current state. - * - * ```javascript - * bookmarksManager.capture(options) - * ``` - * - * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing - * @returns {Promise} - */ - BookmarksManager.prototype.capture = function (options) { - return __awaiter(this, void 0, void 0, function () { - var request, response, response_4; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - request = { - options: options || {} - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_4 = _a.sent(); - throw response_4.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Apply bookmark state. - * - * ```javascript - * bookmarksManager.applyState(bookmarkState) - * ``` - * - * @param {string} state A base64 bookmark state to be applied - * @returns {Promise>} - */ - BookmarksManager.prototype.applyState = function (state) { - return __awaiter(this, void 0, void 0, function () { - var request, response_5; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - request = { - state: state - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_5 = _a.sent(); - throw response_5.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - return BookmarksManager; -}()); -exports.BookmarksManager = BookmarksManager; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BookmarksManager = void 0; +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +/** + * Manages report bookmarks. + * + * @export + * @class BookmarksManager + * @implements {IBookmarksManager} + */ +var BookmarksManager = /** @class */ (function () { + /** + * @hidden + */ + function BookmarksManager(service, config, iframe) { + this.service = service; + this.config = config; + this.iframe = iframe; + } + /** + * Gets bookmarks that are defined in the report. + * + * ```javascript + * // Gets bookmarks that are defined in the report + * bookmarksManager.getBookmarks() + * .then(bookmarks => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + BookmarksManager.prototype.getBookmarks = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get("/report/bookmarks", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Apply bookmark by name. + * + * ```javascript + * bookmarksManager.apply(bookmarkName) + * ``` + * + * @param {string} bookmarkName The name of the bookmark to be applied + * @returns {Promise>} + */ + BookmarksManager.prototype.apply = function (bookmarkName) { + return __awaiter(this, void 0, void 0, function () { + var request, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + request = { + name: bookmarkName + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/applyByName", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_2 = _a.sent(); + throw response_2.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Play bookmarks: Enter or Exit bookmarks presentation mode. + * + * ```javascript + * // Enter presentation mode. + * bookmarksManager.play(models.BookmarksPlayMode.Presentation) + * ``` + * + * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off` + * @returns {Promise>} + */ + BookmarksManager.prototype.play = function (playMode) { + return __awaiter(this, void 0, void 0, function () { + var playBookmarkRequest, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + playBookmarkRequest = { + playMode: playMode + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/play", playBookmarkRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Capture bookmark from current state. + * + * ```javascript + * bookmarksManager.capture(options) + * ``` + * + * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing + * @returns {Promise} + */ + BookmarksManager.prototype.capture = function (options) { + return __awaiter(this, void 0, void 0, function () { + var request, response, response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + request = { + options: options || {} + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/capture", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_4 = _a.sent(); + throw response_4.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Apply bookmark state. + * + * ```javascript + * bookmarksManager.applyState(bookmarkState) + * ``` + * + * @param {string} state A base64 bookmark state to be applied + * @returns {Promise>} + */ + BookmarksManager.prototype.applyState = function (state) { + return __awaiter(this, void 0, void 0, function () { + var request, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + request = { + state: state + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/bookmarks/applyState", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + return BookmarksManager; +}()); +exports.BookmarksManager = BookmarksManager; /***/ }), @@ -5861,13 +5861,13 @@ exports.BookmarksManager = BookmarksManager; /*! no static exports found */ /***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { value: true }); -/** @ignore */ /** */ -var config = { - version: '2.16.3', - type: 'js' -}; -exports.default = config; +Object.defineProperty(exports, "__esModule", { value: true }); +/** @ignore */ /** */ +var config = { + version: '2.16.4', + type: 'js' +}; +exports.default = config; /***/ }), @@ -5879,162 +5879,162 @@ exports.default = config; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Create = void 0; -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); -/** - * A Power BI Report creator component - * - * @export - * @class Create - * @extends {embed.Embed} - */ -var Create = /** @class */ (function (_super) { - __extends(Create, _super); - /* - * @hidden - */ - function Create(service, element, config, phasedRender, isBootstrap) { - return _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; - } - /** - * Gets the dataset ID from the first available location: createConfig or embed url. - * - * @returns {string} - */ - Create.prototype.getId = function () { - var datasetId = (this.createConfig && this.createConfig.datasetId) ? this.createConfig.datasetId : Create.findIdFromEmbedUrl(this.config.embedUrl); - if (typeof datasetId !== 'string' || datasetId.length === 0) { - throw new Error('Dataset id is required, but it was not found. You must provide an id either as part of embed configuration.'); - } - return datasetId; - }; - /** - * Validate create report configuration. - */ - Create.prototype.validate = function (config) { - return models.validateCreateReport(config); - }; - /** - * Handle config changes. - * - * @hidden - * @returns {void} - */ - Create.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - var config = this.config; - this.createConfig = { - accessToken: config.accessToken, - datasetId: config.datasetId || this.getId(), - groupId: config.groupId, - settings: config.settings, - tokenType: config.tokenType, - theme: config.theme - }; - }; - /** - * @hidden - * @returns {string} - */ - Create.prototype.getDefaultEmbedUrlEndpoint = function () { - return "reportEmbed"; - }; - /** - * checks if the report is saved. - * - * ```javascript - * report.isSaved() - * ``` - * - * @returns {Promise} - */ - Create.prototype.isSaved = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Adds the ability to get datasetId from url. - * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1). - * - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration. - * - * @static - * @param {string} url - * @returns {string} - * @hidden - */ - Create.findIdFromEmbedUrl = function (url) { - var datasetIdRegEx = /datasetId="?([^&]+)"?/; - var datasetIdMatch = url.match(datasetIdRegEx); - var datasetId; - if (datasetIdMatch) { - datasetId = datasetIdMatch[1]; - } - return datasetId; - }; - return Create; -}(embed.Embed)); -exports.Create = Create; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Create = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +/** + * A Power BI Report creator component + * + * @export + * @class Create + * @extends {embed.Embed} + */ +var Create = /** @class */ (function (_super) { + __extends(Create, _super); + /* + * @hidden + */ + function Create(service, element, config, phasedRender, isBootstrap) { + return _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + } + /** + * Gets the dataset ID from the first available location: createConfig or embed url. + * + * @returns {string} + */ + Create.prototype.getId = function () { + var datasetId = (this.createConfig && this.createConfig.datasetId) ? this.createConfig.datasetId : Create.findIdFromEmbedUrl(this.config.embedUrl); + if (typeof datasetId !== 'string' || datasetId.length === 0) { + throw new Error('Dataset id is required, but it was not found. You must provide an id either as part of embed configuration.'); + } + return datasetId; + }; + /** + * Validate create report configuration. + */ + Create.prototype.validate = function (config) { + return models.validateCreateReport(config); + }; + /** + * Handle config changes. + * + * @hidden + * @returns {void} + */ + Create.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + var config = this.config; + this.createConfig = { + accessToken: config.accessToken, + datasetId: config.datasetId || this.getId(), + groupId: config.groupId, + settings: config.settings, + tokenType: config.tokenType, + theme: config.theme + }; + }; + /** + * @hidden + * @returns {string} + */ + Create.prototype.getDefaultEmbedUrlEndpoint = function () { + return "reportEmbed"; + }; + /** + * checks if the report is saved. + * + * ```javascript + * report.isSaved() + * ``` + * + * @returns {Promise} + */ + Create.prototype.isSaved = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Adds the ability to get datasetId from url. + * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1). + * + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration. + * + * @static + * @param {string} url + * @returns {string} + * @hidden + */ + Create.findIdFromEmbedUrl = function (url) { + var datasetIdRegEx = /datasetId="?([^&]+)"?/; + var datasetIdMatch = url.match(datasetIdRegEx); + var datasetId; + if (datasetIdMatch) { + datasetId = datasetIdMatch[1]; + } + return datasetId; + }; + return Create; +}(embed.Embed)); +exports.Create = Create; /***/ }), @@ -6046,128 +6046,128 @@ exports.Create = Create; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Dashboard = void 0; -var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -/** - * A Power BI Dashboard embed component - * - * @export - * @class Dashboard - * @extends {embed.Embed} - * @implements {IDashboardNode} - */ -var Dashboard = /** @class */ (function (_super) { - __extends(Dashboard, _super); - /** - * Creates an instance of a Power BI Dashboard. - * - * @param {service.Service} service - * @hidden - * @param {HTMLElement} element - */ - function Dashboard(service, element, config, phasedRender, isBootstrap) { - var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; - _this.loadPath = "/dashboard/load"; - _this.phasedLoadPath = "/dashboard/prepare"; - Array.prototype.push.apply(_this.allowedEvents, Dashboard.allowedEvents); - return _this; - } - /** - * This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id. - * E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e - * - * By extracting the id we can ensure id is always explicitly provided as part of the load configuration. - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Dashboard.findIdFromEmbedUrl = function (url) { - var dashboardIdRegEx = /dashboardId="?([^&]+)"?/; - var dashboardIdMatch = url.match(dashboardIdRegEx); - var dashboardId; - if (dashboardIdMatch) { - dashboardId = dashboardIdMatch[1]; - } - return dashboardId; - }; - /** - * Get dashboard id from first available location: options, attribute, embed url. - * - * @returns {string} - */ - Dashboard.prototype.getId = function () { - var config = this.config; - var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); - if (typeof dashboardId !== 'string' || dashboardId.length === 0) { - throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'."); - } - return dashboardId; - }; - /** - * Validate load configuration. - * - * @hidden - */ - Dashboard.prototype.validate = function (baseConfig) { - var config = baseConfig; - var error = models.validateDashboardLoad(config); - return error ? error : this.ValidatePageView(config.pageView); - }; - /** - * Handle config changes. - * @hidden - * @returns {void} - */ - Dashboard.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - // Populate dashboard id into config object. - this.config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Dashboard.prototype.getDefaultEmbedUrlEndpoint = function () { - return "dashboardEmbed"; - }; - /** - * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView - * @hidden - */ - Dashboard.prototype.ValidatePageView = function (pageView) { - if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") { - return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }]; - } - }; - /** @hidden */ - Dashboard.allowedEvents = ["tileClicked", "error"]; - /** @hidden */ - Dashboard.dashboardIdAttribute = 'powerbi-dashboard-id'; - /** @hidden */ - Dashboard.typeAttribute = 'powerbi-type'; - /** @hidden */ - Dashboard.type = "Dashboard"; - return Dashboard; -}(embed.Embed)); -exports.Dashboard = Dashboard; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Dashboard = void 0; +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +/** + * A Power BI Dashboard embed component + * + * @export + * @class Dashboard + * @extends {embed.Embed} + * @implements {IDashboardNode} + */ +var Dashboard = /** @class */ (function (_super) { + __extends(Dashboard, _super); + /** + * Creates an instance of a Power BI Dashboard. + * + * @param {service.Service} service + * @hidden + * @param {HTMLElement} element + */ + function Dashboard(service, element, config, phasedRender, isBootstrap) { + var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + _this.loadPath = "/dashboard/load"; + _this.phasedLoadPath = "/dashboard/prepare"; + Array.prototype.push.apply(_this.allowedEvents, Dashboard.allowedEvents); + return _this; + } + /** + * This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id. + * E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e + * + * By extracting the id we can ensure id is always explicitly provided as part of the load configuration. + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Dashboard.findIdFromEmbedUrl = function (url) { + var dashboardIdRegEx = /dashboardId="?([^&]+)"?/; + var dashboardIdMatch = url.match(dashboardIdRegEx); + var dashboardId; + if (dashboardIdMatch) { + dashboardId = dashboardIdMatch[1]; + } + return dashboardId; + }; + /** + * Get dashboard id from first available location: options, attribute, embed url. + * + * @returns {string} + */ + Dashboard.prototype.getId = function () { + var config = this.config; + var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl); + if (typeof dashboardId !== 'string' || dashboardId.length === 0) { + throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'."); + } + return dashboardId; + }; + /** + * Validate load configuration. + * + * @hidden + */ + Dashboard.prototype.validate = function (baseConfig) { + var config = baseConfig; + var error = models.validateDashboardLoad(config); + return error ? error : this.ValidatePageView(config.pageView); + }; + /** + * Handle config changes. + * @hidden + * @returns {void} + */ + Dashboard.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + // Populate dashboard id into config object. + this.config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Dashboard.prototype.getDefaultEmbedUrlEndpoint = function () { + return "dashboardEmbed"; + }; + /** + * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView + * @hidden + */ + Dashboard.prototype.ValidatePageView = function (pageView) { + if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") { + return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }]; + } + }; + /** @hidden */ + Dashboard.allowedEvents = ["tileClicked", "error"]; + /** @hidden */ + Dashboard.dashboardIdAttribute = 'powerbi-dashboard-id'; + /** @hidden */ + Dashboard.typeAttribute = 'powerbi-type'; + /** @hidden */ + Dashboard.type = "Dashboard"; + return Dashboard; +}(embed.Embed)); +exports.Dashboard = Dashboard; /***/ }), @@ -6179,683 +6179,683 @@ exports.Dashboard = Dashboard; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Embed = void 0; -var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); -var sdkConfig = __webpack_require__(/*! ./config */ "./src/config.ts"); -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var errors_1 = __webpack_require__(/*! ./errors */ "./src/errors.ts"); -/** - * Base class for all Power BI embed components - * - * @export - * @abstract - * @hidden - * @class Embed - */ -var Embed = /** @class */ (function () { - /** - * Creates an instance of Embed. - * - * Note: there is circular reference between embeds and the service, because - * the service has a list of all embeds on the host page, and each embed has a reference to the service that created it. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {IEmbedConfigurationBase} config - * @hidden - */ - function Embed(service, element, config, iframe, phasedRender, isBootstrap) { - /** @hidden */ - this.allowedEvents = []; - if (utils.autoAuthInEmbedUrl(config.embedUrl)) { - throw new Error(errors_1.EmbedUrlNotSupported); - } - Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents); - this.eventHandlers = []; - this.service = service; - this.element = element; - this.iframe = iframe; - this.iframeLoaded = false; - this.embedtype = config.type.toLowerCase(); - this.populateConfig(config, isBootstrap); - if (this.embedtype === 'create') { - this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap); - } - else { - this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap); - } - } - /** - * Sends createReport configuration data. - * - * ```javascript - * createReport({ - * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', - * accessToken: 'eyJ0eXA ... TaE2rTSbmg', - * ``` - * @hidden - * @param {models.IReportCreateConfiguration} config - * @returns {Promise} - */ - Embed.prototype.createReport = function (config) { - return __awaiter(this, void 0, void 0, function () { - var errors, response, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - errors = models.validateCreateReport(config); - if (errors) { - throw errors; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_1 = _a.sent(); - throw response_1.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Saves Report. - * - * @returns {Promise} - */ - Embed.prototype.save = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_2 = _a.sent(); - throw response_2.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * SaveAs Report. - * - * @returns {Promise} - */ - Embed.prototype.saveAs = function (saveAsParameters) { - return __awaiter(this, void 0, void 0, function () { - var response, response_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_3 = _a.sent(); - throw response_3.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Get the correlationId for the current embed session. - * - * ```javascript - * // Get the correlationId for the current embed session - * report.getCorrelationId() - * .then(correlationId => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Embed.prototype.getCorrelationId = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_4; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.get("/getCorrelationId", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_4 = _a.sent(); - throw response_4.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Sends load configuration data. - * - * ```javascript - * report.load({ - * type: 'report', - * id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', - * accessToken: 'eyJ0eXA ... TaE2rTSbmg', - * settings: { - * navContentPaneEnabled: false - * }, - * pageName: "DefaultPage", - * filters: [ - * { - * ... DefaultReportFilter ... - * } - * ] - * }) - * .catch(error => { ... }); - * ``` - * @hidden - * @param {models.ILoadConfiguration} config - * @param {boolean} phasedRender - * @returns {Promise} - */ - Embed.prototype.load = function (phasedRender) { - return __awaiter(this, void 0, void 0, function () { - var path, headers, timeNow, response, response_5; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!this.config.accessToken) { - console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); - return [2 /*return*/]; - } - if (!this.iframeLoaded) { - console.debug("Power BI SDK is trying to post /report/load before iframe is ready."); - return [2 /*return*/]; - } - path = phasedRender && this.config.type === 'report' ? this.phasedLoadPath : this.loadPath; - headers = { - uid: this.config.uniqueId, - sdkSessionId: this.service.getSdkSessionId(), - bootstrapped: this.config.bootstrapped, - sdkVersion: sdkConfig.default.version - }; - timeNow = new Date(); - if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) { - console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval."); - return [2 /*return*/]; - } - this.lastLoadRequest = timeNow; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_5 = _a.sent(); - throw response_5.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Removes one or more event handlers from the list of handlers. - * If a reference to the existing handle function is specified, remove the specific handler. - * If the handler is not specified, remove all handlers for the event name specified. - * - * ```javascript - * report.off('pageChanged') - * - * or - * - * const logHandler = function (event) { - * console.log(event); - * }; - * - * report.off('pageChanged', logHandler); - * ``` - * - * @template T - * @param {string} eventName - * @param {service.IEventHandler} [handler] - */ - Embed.prototype.off = function (eventName, handler) { - var _this = this; - var fakeEvent = { name: eventName, type: null, id: null, value: null }; - if (handler) { - utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers); - this.element.removeEventListener(eventName, handler); - } - else { - var eventHandlersToRemove = this.eventHandlers - .filter(function (eventHandler) { return eventHandler.test(fakeEvent); }); - eventHandlersToRemove - .forEach(function (eventHandlerToRemove) { - utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers); - _this.element.removeEventListener(eventName, eventHandlerToRemove.handle); - }); - } - }; - /** - * Adds an event handler for a specific event. - * - * ```javascript - * report.on('pageChanged', (event) => { - * console.log('PageChanged: ', event.page.name); - * }); - * ``` - * - * @template T - * @param {string} eventName - * @param {service.IEventHandler} handler - */ - Embed.prototype.on = function (eventName, handler) { - if (this.allowedEvents.indexOf(eventName) === -1) { - throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName); - } - this.eventHandlers.push({ - test: function (event) { return event.name === eventName; }, - handle: handler - }); - this.element.addEventListener(eventName, handler); - }; - /** - * Reloads embed using existing configuration. - * E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. - * - * ```javascript - * report.reload(); - * ``` - */ - Embed.prototype.reload = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.load()]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Set accessToken. - * - * @returns {Promise} - */ - Embed.prototype.setAccessToken = function (accessToken) { - return __awaiter(this, void 0, void 0, function () { - var embedType, response, response_6; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - embedType = this.config.type; - embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - this.config.accessToken = accessToken; - this.element.setAttribute(Embed.accessTokenAttribute, accessToken); - this.service.accessToken = accessToken; - return [2 /*return*/, response.body]; - case 3: - response_6 = _a.sent(); - throw response_6.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Gets an access token from the first available location: config, attribute, global. - * - * @private - * @param {string} globalAccessToken - * @returns {string} - * @hidden - */ - Embed.prototype.getAccessToken = function (globalAccessToken) { - var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken; - if (!accessToken) { - throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken."); - } - return accessToken; - }; - /** - * Populate config for create and load - * - * @hidden - * @param {IEmbedConfiguration} - * @returns {void} - */ - Embed.prototype.populateConfig = function (config, isBootstrap) { - if (this.bootstrapConfig) { - this.config = utils.assign({}, this.bootstrapConfig, config); - // reset bootstrapConfig because we do not want to merge it in re-embed scenario. - this.bootstrapConfig = null; - } - else { - // Copy config - important for multiple iframe scenario. - // Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes. - this.config = utils.assign({}, config); - } - this.config.embedUrl = this.getEmbedUrl(isBootstrap); - this.config.groupId = this.getGroupId(); - this.addLocaleToEmbedUrl(config); - this.config.uniqueId = this.getUniqueId(); - if (isBootstrap) { - // save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed - this.bootstrapConfig = this.config; - this.bootstrapConfig.bootstrapped = true; - } - else { - this.config.accessToken = this.getAccessToken(this.service.accessToken); - } - this.configChanged(isBootstrap); - }; - /** - * Adds locale parameters to embedUrl - * - * @private - * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config - * @hidden - */ - Embed.prototype.addLocaleToEmbedUrl = function (config) { - if (!config.settings) { - return; - } - var localeSettings = config.settings.localeSettings; - if (localeSettings && localeSettings.language) { - this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language); - } - if (localeSettings && localeSettings.formatLocale) { - this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale); - } - }; - /** - * Gets an embed url from the first available location: options, attribute. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getEmbedUrl = function (isBootstrap) { - var embedUrl = this.config.embedUrl || this.element.getAttribute(Embed.embedUrlAttribute); - if (isBootstrap && !embedUrl) { - // Prepare flow, embed url was not provided, use hostname to build embed url. - embedUrl = this.getDefaultEmbedUrl(this.config.hostname); - } - if (typeof embedUrl !== 'string' || embedUrl.length === 0) { - throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'."); - } - return embedUrl; - }; - /** - * @hidden - */ - Embed.prototype.getDefaultEmbedUrl = function (hostname) { - if (!hostname) { - hostname = Embed.defaultEmbedHostName; - } - var endpoint = this.getDefaultEmbedUrlEndpoint(); - // Trim spaces to fix user mistakes. - hostname = hostname.toLowerCase().trim(); - if (hostname.indexOf("http://") === 0) { - throw new Error("HTTP is not allowed. HTTPS is required"); - } - if (hostname.indexOf("https://") === 0) { - return hostname + "/" + endpoint; - } - return "https://" + hostname + "/" + endpoint; - }; - /** - * Gets a unique ID from the first available location: options, attribute. - * If neither is provided generate a unique string. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getUniqueId = function () { - return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString(); - }; - /** - * Gets the group ID from the first available location: options, embeddedUrl. - * - * @private - * @returns {string} - * @hidden - */ - Embed.prototype.getGroupId = function () { - return this.config.groupId || Embed.findGroupIdFromEmbedUrl(this.config.embedUrl); - }; - /** - * Requests the browser to render the component's iframe in fullscreen mode. - */ - Embed.prototype.fullscreen = function () { - var requestFullScreen = this.iframe.requestFullscreen || this.iframe.msRequestFullscreen || this.iframe.mozRequestFullScreen || this.iframe.webkitRequestFullscreen; - requestFullScreen.call(this.iframe); - }; - /** - * Requests the browser to exit fullscreen mode. - */ - Embed.prototype.exitFullscreen = function () { - if (!this.isFullscreen(this.iframe)) { - return; - } - var exitFullscreen = document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen; - exitFullscreen.call(document); - }; - /** - * Returns true if the iframe is rendered in fullscreen mode, - * otherwise returns false. - * - * @private - * @param {HTMLIFrameElement} iframe - * @returns {boolean} - * @hidden - */ - Embed.prototype.isFullscreen = function (iframe) { - var options = ['fullscreenElement', 'webkitFullscreenElement', 'mozFullscreenScreenElement', 'msFullscreenElement']; - return options.some(function (option) { return document[option] === iframe; }); - }; - /** - * Sets Iframe for embed - * @hidden - */ - Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) { - var _this = this; - if (!this.iframe) { - var iframeContent = document.createElement("iframe"); - var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl; - iframeContent.style.width = '100%'; - iframeContent.style.height = '100%'; - iframeContent.setAttribute("src", embedUrl); - iframeContent.setAttribute("scrolling", "no"); - iframeContent.setAttribute("allowfullscreen", "true"); - var node = this.element; - while (node.firstChild) { - node.removeChild(node.firstChild); - } - node.appendChild(iframeContent); - this.iframe = node.firstChild; - } - if (isLoad) { - if (!isBootstrap) { - // Validate config if it's not a bootstrap case. - var errors = this.validate(this.config); - if (errors) { - throw errors; - } - } - this.iframe.addEventListener('load', function () { - _this.iframeLoaded = true; - _this.load(phasedRender); - }, false); - if (this.service.getNumberOfComponents() <= Embed.maxFrontLoadTimes) { - this.frontLoadHandler = function () { - _this.frontLoadSendConfig(_this.config); - }; - // 'ready' event is fired by the embedded element (not by the iframe) - this.element.addEventListener('ready', this.frontLoadHandler, false); - } - } - else { - this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false); - } - }; - /** - * Set the component title for accessibility. In case of iframes, this method will change the iframe title. - */ - Embed.prototype.setComponentTitle = function (title) { - if (!this.iframe) { - return; - } - if (title == null) { - this.iframe.removeAttribute("title"); - } - else { - this.iframe.setAttribute("title", title); - } - }; - /** - * Sets element's tabindex attribute - */ - Embed.prototype.setComponentTabIndex = function (tabIndex) { - if (!this.element) { - return; - } - this.element.setAttribute("tabindex", (tabIndex == null) ? "0" : tabIndex.toString()); - }; - /** - * Removes element's tabindex attribute - */ - Embed.prototype.removeComponentTabIndex = function (tabIndex) { - if (!this.element) { - return; - } - this.element.removeAttribute("tabindex"); - }; - /** - * Adds the ability to get groupId from url. - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Embed.findGroupIdFromEmbedUrl = function (url) { - var groupIdRegEx = /groupId="?([^&]+)"?/; - var groupIdMatch = url.match(groupIdRegEx); - var groupId; - if (groupIdMatch) { - groupId = groupIdMatch[1]; - } - return groupId; - }; - /** - * Sends the config for front load calls, after 'ready' message is received from the iframe - * @hidden - */ - Embed.prototype.frontLoadSendConfig = function (config) { - return __awaiter(this, void 0, void 0, function () { - var errors, response, response_7; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!config.accessToken) { - return [2 /*return*/]; - } - errors = this.validate(config); - if (errors) { - throw errors; - } - // contentWindow must be initialized - if (this.iframe.contentWindow == null) - return [2 /*return*/]; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_7 = _a.sent(); - throw response_7.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** @hidden */ - Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"]; - /** @hidden */ - Embed.accessTokenAttribute = 'powerbi-access-token'; - /** @hidden */ - Embed.embedUrlAttribute = 'powerbi-embed-url'; - /** @hidden */ - Embed.nameAttribute = 'powerbi-name'; - /** @hidden */ - Embed.typeAttribute = 'powerbi-type'; - /** @hidden */ - Embed.defaultEmbedHostName = "https://app.powerbi.com"; - /** @hidden */ - Embed.maxFrontLoadTimes = 2; - return Embed; -}()); -exports.Embed = Embed; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Embed = void 0; +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var sdkConfig = __webpack_require__(/*! ./config */ "./src/config.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var errors_1 = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +/** + * Base class for all Power BI embed components + * + * @export + * @abstract + * @hidden + * @class Embed + */ +var Embed = /** @class */ (function () { + /** + * Creates an instance of Embed. + * + * Note: there is circular reference between embeds and the service, because + * the service has a list of all embeds on the host page, and each embed has a reference to the service that created it. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {IEmbedConfigurationBase} config + * @hidden + */ + function Embed(service, element, config, iframe, phasedRender, isBootstrap) { + /** @hidden */ + this.allowedEvents = []; + if (utils.autoAuthInEmbedUrl(config.embedUrl)) { + throw new Error(errors_1.EmbedUrlNotSupported); + } + Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents); + this.eventHandlers = []; + this.service = service; + this.element = element; + this.iframe = iframe; + this.iframeLoaded = false; + this.embedtype = config.type.toLowerCase(); + this.populateConfig(config, isBootstrap); + if (this.embedtype === 'create') { + this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap); + } + else { + this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap); + } + } + /** + * Sends createReport configuration data. + * + * ```javascript + * createReport({ + * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', + * accessToken: 'eyJ0eXA ... TaE2rTSbmg', + * ``` + * @hidden + * @param {models.IReportCreateConfiguration} config + * @returns {Promise} + */ + Embed.prototype.createReport = function (config) { + return __awaiter(this, void 0, void 0, function () { + var errors, response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + errors = models.validateCreateReport(config); + if (errors) { + throw errors; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Saves Report. + * + * @returns {Promise} + */ + Embed.prototype.save = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post('/report/save', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_2 = _a.sent(); + throw response_2.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * SaveAs Report. + * + * @returns {Promise} + */ + Embed.prototype.saveAs = function (saveAsParameters) { + return __awaiter(this, void 0, void 0, function () { + var response, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post('/report/saveAs', saveAsParameters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_3 = _a.sent(); + throw response_3.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Get the correlationId for the current embed session. + * + * ```javascript + * // Get the correlationId for the current embed session + * report.getCorrelationId() + * .then(correlationId => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Embed.prototype.getCorrelationId = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.get("/getCorrelationId", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_4 = _a.sent(); + throw response_4.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sends load configuration data. + * + * ```javascript + * report.load({ + * type: 'report', + * id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', + * accessToken: 'eyJ0eXA ... TaE2rTSbmg', + * settings: { + * navContentPaneEnabled: false + * }, + * pageName: "DefaultPage", + * filters: [ + * { + * ... DefaultReportFilter ... + * } + * ] + * }) + * .catch(error => { ... }); + * ``` + * @hidden + * @param {models.ILoadConfiguration} config + * @param {boolean} phasedRender + * @returns {Promise} + */ + Embed.prototype.load = function (phasedRender) { + return __awaiter(this, void 0, void 0, function () { + var path, headers, timeNow, response, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.config.accessToken) { + console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet."); + return [2 /*return*/]; + } + if (!this.iframeLoaded) { + console.debug("Power BI SDK is trying to post /report/load before iframe is ready."); + return [2 /*return*/]; + } + path = phasedRender && this.config.type === 'report' ? this.phasedLoadPath : this.loadPath; + headers = { + uid: this.config.uniqueId, + sdkSessionId: this.service.getSdkSessionId(), + bootstrapped: this.config.bootstrapped, + sdkVersion: sdkConfig.default.version + }; + timeNow = new Date(); + if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) { + console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval."); + return [2 /*return*/]; + } + this.lastLoadRequest = timeNow; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes one or more event handlers from the list of handlers. + * If a reference to the existing handle function is specified, remove the specific handler. + * If the handler is not specified, remove all handlers for the event name specified. + * + * ```javascript + * report.off('pageChanged') + * + * or + * + * const logHandler = function (event) { + * console.log(event); + * }; + * + * report.off('pageChanged', logHandler); + * ``` + * + * @template T + * @param {string} eventName + * @param {service.IEventHandler} [handler] + */ + Embed.prototype.off = function (eventName, handler) { + var _this = this; + var fakeEvent = { name: eventName, type: null, id: null, value: null }; + if (handler) { + utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers); + this.element.removeEventListener(eventName, handler); + } + else { + var eventHandlersToRemove = this.eventHandlers + .filter(function (eventHandler) { return eventHandler.test(fakeEvent); }); + eventHandlersToRemove + .forEach(function (eventHandlerToRemove) { + utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers); + _this.element.removeEventListener(eventName, eventHandlerToRemove.handle); + }); + } + }; + /** + * Adds an event handler for a specific event. + * + * ```javascript + * report.on('pageChanged', (event) => { + * console.log('PageChanged: ', event.page.name); + * }); + * ``` + * + * @template T + * @param {string} eventName + * @param {service.IEventHandler} handler + */ + Embed.prototype.on = function (eventName, handler) { + if (this.allowedEvents.indexOf(eventName) === -1) { + throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName); + } + this.eventHandlers.push({ + test: function (event) { return event.name === eventName; }, + handle: handler + }); + this.element.addEventListener(eventName, handler); + }; + /** + * Reloads embed using existing configuration. + * E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state. + * + * ```javascript + * report.reload(); + * ``` + */ + Embed.prototype.reload = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.load()]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Set accessToken. + * + * @returns {Promise} + */ + Embed.prototype.setAccessToken = function (accessToken) { + return __awaiter(this, void 0, void 0, function () { + var embedType, response, response_6; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + embedType = this.config.type; + embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post('/' + embedType + '/token', accessToken, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + this.config.accessToken = accessToken; + this.element.setAttribute(Embed.accessTokenAttribute, accessToken); + this.service.accessToken = accessToken; + return [2 /*return*/, response.body]; + case 3: + response_6 = _a.sent(); + throw response_6.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets an access token from the first available location: config, attribute, global. + * + * @private + * @param {string} globalAccessToken + * @returns {string} + * @hidden + */ + Embed.prototype.getAccessToken = function (globalAccessToken) { + var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken; + if (!accessToken) { + throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken."); + } + return accessToken; + }; + /** + * Populate config for create and load + * + * @hidden + * @param {IEmbedConfiguration} + * @returns {void} + */ + Embed.prototype.populateConfig = function (config, isBootstrap) { + if (this.bootstrapConfig) { + this.config = utils.assign({}, this.bootstrapConfig, config); + // reset bootstrapConfig because we do not want to merge it in re-embed scenario. + this.bootstrapConfig = null; + } + else { + // Copy config - important for multiple iframe scenario. + // Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes. + this.config = utils.assign({}, config); + } + this.config.embedUrl = this.getEmbedUrl(isBootstrap); + this.config.groupId = this.getGroupId(); + this.addLocaleToEmbedUrl(config); + this.config.uniqueId = this.getUniqueId(); + if (isBootstrap) { + // save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed + this.bootstrapConfig = this.config; + this.bootstrapConfig.bootstrapped = true; + } + else { + this.config.accessToken = this.getAccessToken(this.service.accessToken); + } + this.configChanged(isBootstrap); + }; + /** + * Adds locale parameters to embedUrl + * + * @private + * @param {IEmbedConfiguration | models.ICommonEmbedConfiguration} config + * @hidden + */ + Embed.prototype.addLocaleToEmbedUrl = function (config) { + if (!config.settings) { + return; + } + var localeSettings = config.settings.localeSettings; + if (localeSettings && localeSettings.language) { + this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language); + } + if (localeSettings && localeSettings.formatLocale) { + this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale); + } + }; + /** + * Gets an embed url from the first available location: options, attribute. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getEmbedUrl = function (isBootstrap) { + var embedUrl = this.config.embedUrl || this.element.getAttribute(Embed.embedUrlAttribute); + if (isBootstrap && !embedUrl) { + // Prepare flow, embed url was not provided, use hostname to build embed url. + embedUrl = this.getDefaultEmbedUrl(this.config.hostname); + } + if (typeof embedUrl !== 'string' || embedUrl.length === 0) { + throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'."); + } + return embedUrl; + }; + /** + * @hidden + */ + Embed.prototype.getDefaultEmbedUrl = function (hostname) { + if (!hostname) { + hostname = Embed.defaultEmbedHostName; + } + var endpoint = this.getDefaultEmbedUrlEndpoint(); + // Trim spaces to fix user mistakes. + hostname = hostname.toLowerCase().trim(); + if (hostname.indexOf("http://") === 0) { + throw new Error("HTTP is not allowed. HTTPS is required"); + } + if (hostname.indexOf("https://") === 0) { + return hostname + "/" + endpoint; + } + return "https://" + hostname + "/" + endpoint; + }; + /** + * Gets a unique ID from the first available location: options, attribute. + * If neither is provided generate a unique string. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getUniqueId = function () { + return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString(); + }; + /** + * Gets the group ID from the first available location: options, embeddedUrl. + * + * @private + * @returns {string} + * @hidden + */ + Embed.prototype.getGroupId = function () { + return this.config.groupId || Embed.findGroupIdFromEmbedUrl(this.config.embedUrl); + }; + /** + * Requests the browser to render the component's iframe in fullscreen mode. + */ + Embed.prototype.fullscreen = function () { + var requestFullScreen = this.iframe.requestFullscreen || this.iframe.msRequestFullscreen || this.iframe.mozRequestFullScreen || this.iframe.webkitRequestFullscreen; + requestFullScreen.call(this.iframe); + }; + /** + * Requests the browser to exit fullscreen mode. + */ + Embed.prototype.exitFullscreen = function () { + if (!this.isFullscreen(this.iframe)) { + return; + } + var exitFullscreen = document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen; + exitFullscreen.call(document); + }; + /** + * Returns true if the iframe is rendered in fullscreen mode, + * otherwise returns false. + * + * @private + * @param {HTMLIFrameElement} iframe + * @returns {boolean} + * @hidden + */ + Embed.prototype.isFullscreen = function (iframe) { + var options = ['fullscreenElement', 'webkitFullscreenElement', 'mozFullscreenScreenElement', 'msFullscreenElement']; + return options.some(function (option) { return document[option] === iframe; }); + }; + /** + * Sets Iframe for embed + * @hidden + */ + Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) { + var _this = this; + if (!this.iframe) { + var iframeContent = document.createElement("iframe"); + var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl; + iframeContent.style.width = '100%'; + iframeContent.style.height = '100%'; + iframeContent.setAttribute("src", embedUrl); + iframeContent.setAttribute("scrolling", "no"); + iframeContent.setAttribute("allowfullscreen", "true"); + var node = this.element; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + node.appendChild(iframeContent); + this.iframe = node.firstChild; + } + if (isLoad) { + if (!isBootstrap) { + // Validate config if it's not a bootstrap case. + var errors = this.validate(this.config); + if (errors) { + throw errors; + } + } + this.iframe.addEventListener('load', function () { + _this.iframeLoaded = true; + _this.load(phasedRender); + }, false); + if (this.service.getNumberOfComponents() <= Embed.maxFrontLoadTimes) { + this.frontLoadHandler = function () { + _this.frontLoadSendConfig(_this.config); + }; + // 'ready' event is fired by the embedded element (not by the iframe) + this.element.addEventListener('ready', this.frontLoadHandler, false); + } + } + else { + this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false); + } + }; + /** + * Set the component title for accessibility. In case of iframes, this method will change the iframe title. + */ + Embed.prototype.setComponentTitle = function (title) { + if (!this.iframe) { + return; + } + if (title == null) { + this.iframe.removeAttribute("title"); + } + else { + this.iframe.setAttribute("title", title); + } + }; + /** + * Sets element's tabindex attribute + */ + Embed.prototype.setComponentTabIndex = function (tabIndex) { + if (!this.element) { + return; + } + this.element.setAttribute("tabindex", (tabIndex == null) ? "0" : tabIndex.toString()); + }; + /** + * Removes element's tabindex attribute + */ + Embed.prototype.removeComponentTabIndex = function (tabIndex) { + if (!this.element) { + return; + } + this.element.removeAttribute("tabindex"); + }; + /** + * Adds the ability to get groupId from url. + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Embed.findGroupIdFromEmbedUrl = function (url) { + var groupIdRegEx = /groupId="?([^&]+)"?/; + var groupIdMatch = url.match(groupIdRegEx); + var groupId; + if (groupIdMatch) { + groupId = groupIdMatch[1]; + } + return groupId; + }; + /** + * Sends the config for front load calls, after 'ready' message is received from the iframe + * @hidden + */ + Embed.prototype.frontLoadSendConfig = function (config) { + return __awaiter(this, void 0, void 0, function () { + var errors, response, response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!config.accessToken) { + return [2 /*return*/]; + } + errors = this.validate(config); + if (errors) { + throw errors; + } + // contentWindow must be initialized + if (this.iframe.contentWindow == null) + return [2 /*return*/]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/frontload/config", config, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_7 = _a.sent(); + throw response_7.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** @hidden */ + Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"]; + /** @hidden */ + Embed.accessTokenAttribute = 'powerbi-access-token'; + /** @hidden */ + Embed.embedUrlAttribute = 'powerbi-embed-url'; + /** @hidden */ + Embed.nameAttribute = 'powerbi-name'; + /** @hidden */ + Embed.typeAttribute = 'powerbi-type'; + /** @hidden */ + Embed.defaultEmbedHostName = "https://app.powerbi.com"; + /** @hidden */ + Embed.maxFrontLoadTimes = 2; + return Embed; +}()); +exports.Embed = Embed; /***/ }), @@ -6867,10 +6867,10 @@ exports.Embed = Embed; /*! no static exports found */ /***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmbedUrlNotSupported = exports.APINotSupportedForRDLError = void 0; -exports.APINotSupportedForRDLError = "This API is currently not supported for RDL reports"; -exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EmbedUrlNotSupported = exports.APINotSupportedForRDLError = void 0; +exports.APINotSupportedForRDLError = "This API is currently not supported for RDL reports"; +exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"; /***/ }), @@ -6882,36 +6882,39 @@ exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please u /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.routerFactory = exports.wpmpFactory = exports.hpmFactory = void 0; -var config_1 = __webpack_require__(/*! ./config */ "./src/config.ts"); -var wpmp = __webpack_require__(/*! window-post-message-proxy */ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js"); -var hpm = __webpack_require__(/*! http-post-message */ "./node_modules/http-post-message/dist/httpPostMessage.js"); -var router = __webpack_require__(/*! powerbi-router */ "./node_modules/powerbi-router/dist/router.js"); -exports.hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) { - if (sdkVersion === void 0) { sdkVersion = config_1.default.version; } - if (sdkType === void 0) { sdkType = config_1.default.type; } - return new hpm.HttpPostMessage(wpmp, { - 'x-sdk-type': sdkType, - 'x-sdk-version': sdkVersion - }, defaultTargetWindow); -}; -exports.wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) { - return new wpmp.WindowPostMessageProxy({ - processTrackingProperties: { - addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties, - getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties, - }, - isErrorMessage: hpm.HttpPostMessage.isErrorMessage, - suppressWarnings: true, - name: name, - logMessages: logMessages, - eventSourceOverrideWindow: eventSourceOverrideWindow - }); -}; -exports.routerFactory = function (wpmp) { - return new router.Router(wpmp); -}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.routerFactory = exports.wpmpFactory = exports.hpmFactory = void 0; +var config_1 = __webpack_require__(/*! ./config */ "./src/config.ts"); +var wpmp = __webpack_require__(/*! window-post-message-proxy */ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js"); +var hpm = __webpack_require__(/*! http-post-message */ "./node_modules/http-post-message/dist/httpPostMessage.js"); +var router = __webpack_require__(/*! powerbi-router */ "./node_modules/powerbi-router/dist/router.js"); +var hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) { + if (sdkVersion === void 0) { sdkVersion = config_1.default.version; } + if (sdkType === void 0) { sdkType = config_1.default.type; } + return new hpm.HttpPostMessage(wpmp, { + 'x-sdk-type': sdkType, + 'x-sdk-version': sdkVersion + }, defaultTargetWindow); +}; +exports.hpmFactory = hpmFactory; +var wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) { + return new wpmp.WindowPostMessageProxy({ + processTrackingProperties: { + addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties, + getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties, + }, + isErrorMessage: hpm.HttpPostMessage.isErrorMessage, + suppressWarnings: true, + name: name, + logMessages: logMessages, + eventSourceOverrideWindow: eventSourceOverrideWindow + }); +}; +exports.wpmpFactory = wpmpFactory; +var routerFactory = function (wpmp) { + return new router.Router(wpmp); +}; +exports.routerFactory = routerFactory; /***/ }), @@ -6923,322 +6926,322 @@ exports.routerFactory = function (wpmp) { /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Page = void 0; -var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); -var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); -/** - * A Power BI report page - * - * @export - * @class Page - * @implements {IPageNode} - * @implements {IFilterable} - */ -var Page = /** @class */ (function () { - /** - * Creates an instance of a Power BI report page. - * - * @param {IReportNode} report - * @param {string} name - * @param {string} [displayName] - * @param {boolean} [isActivePage] - * @param {models.SectionVisibility} [visibility] - * @hidden - */ - function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) { - this.report = report; - this.name = name; - this.displayName = displayName; - this.isActive = isActivePage; - this.visibility = visibility; - this.defaultSize = defaultSize; - this.defaultDisplayOption = defaultDisplayOption; - } - /** - * Gets all page level filters within the report. - * - * ```javascript - * page.getFilters() - * .then(filters => { ... }); - * ``` - * - * @returns {(Promise)} - */ - Page.prototype.getFilters = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_1 = _a.sent(); - throw response_1.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Delete the page from the report - * - * ```javascript - * // Delete the page from the report - * page.delete(); - * ``` - * - * @returns {Promise} - */ - Page.prototype.delete = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_2 = _a.sent(); - throw response_2.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Removes all filters from this page of the report. - * - * ```javascript - * page.removeFilters(); - * ``` - * - * @returns {Promise>} - */ - Page.prototype.removeFilters = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.setFilters([])]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Makes the current page the active page of the report. - * - * ```javascript - * page.setActive(); - * ``` - * - * @returns {Promise>} - */ - Page.prototype.setActive = function () { - return __awaiter(this, void 0, void 0, function () { - var page, response_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - page = { - name: this.name, - displayName: null, - isActive: true - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_3 = _a.sent(); - throw response_3.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Sets all filters on the current page. - * - * ```javascript - * page.setFilters(filters); - * .catch(errors => { ... }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise>} - */ - Page.prototype.setFilters = function (filters) { - return __awaiter(this, void 0, void 0, function () { - var response_4; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: - response_4 = _a.sent(); - throw response_4.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Set displayName to the current page. - * - * ```javascript - * page.setName(displayName); - * ``` - * - * @returns {Promise>} - */ - Page.prototype.setDisplayName = function (displayName) { - return __awaiter(this, void 0, void 0, function () { - var page, response_5; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - page = { - name: this.name, - displayName: displayName, - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/name", page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_5 = _a.sent(); - throw response_5.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Gets all the visuals on the page. - * - * ```javascript - * page.getVisuals() - * .then(visuals => { ... }); - * ``` - * - * @returns {Promise} - */ - Page.prototype.getVisuals = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_6; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.report.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body - .map(function (visual) { - return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); - })]; - case 3: - response_6 = _a.sent(); - throw response_6.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Checks if page has layout. - * - * ```javascript - * page.hasLayout(layoutType) - * .then(hasLayout: boolean => { ... }); - * ``` - * - * @returns {(Promise)} - */ - Page.prototype.hasLayout = function (layoutType) { - return __awaiter(this, void 0, void 0, function () { - var layoutTypeEnum, response, response_7; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.report.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - layoutTypeEnum = models.LayoutType[layoutType]; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_7 = _a.sent(); - throw response_7.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - return Page; -}()); -exports.Page = Page; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Page = void 0; +var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +/** + * A Power BI report page + * + * @export + * @class Page + * @implements {IPageNode} + * @implements {IFilterable} + */ +var Page = /** @class */ (function () { + /** + * Creates an instance of a Power BI report page. + * + * @param {IReportNode} report + * @param {string} name + * @param {string} [displayName] + * @param {boolean} [isActivePage] + * @param {models.SectionVisibility} [visibility] + * @hidden + */ + function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) { + this.report = report; + this.name = name; + this.displayName = displayName; + this.isActive = isActivePage; + this.visibility = visibility; + this.defaultSize = defaultSize; + this.defaultDisplayOption = defaultDisplayOption; + } + /** + * Gets all page level filters within the report. + * + * ```javascript + * page.getFilters() + * .then(filters => { ... }); + * ``` + * + * @returns {(Promise)} + */ + Page.prototype.getFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Delete the page from the report + * + * ```javascript + * // Delete the page from the report + * page.delete(); + * ``` + * + * @returns {Promise} + */ + Page.prototype.delete = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_2 = _a.sent(); + throw response_2.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters from this page of the report. + * + * ```javascript + * page.removeFilters(); + * ``` + * + * @returns {Promise>} + */ + Page.prototype.removeFilters = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.setFilters([])]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Makes the current page the active page of the report. + * + * ```javascript + * page.setActive(); + * ``` + * + * @returns {Promise>} + */ + Page.prototype.setActive = function () { + return __awaiter(this, void 0, void 0, function () { + var page, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + page = { + name: this.name, + displayName: null, + isActive: true + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets all filters on the current page. + * + * ```javascript + * page.setFilters(filters); + * .catch(errors => { ... }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + Page.prototype.setFilters = function (filters) { + return __awaiter(this, void 0, void 0, function () { + var response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_4 = _a.sent(); + throw response_4.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Set displayName to the current page. + * + * ```javascript + * page.setName(displayName); + * ``` + * + * @returns {Promise>} + */ + Page.prototype.setDisplayName = function (displayName) { + return __awaiter(this, void 0, void 0, function () { + var page, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + page = { + name: this.name, + displayName: displayName, + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/name", page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets all the visuals on the page. + * + * ```javascript + * page.getVisuals() + * .then(visuals => { ... }); + * ``` + * + * @returns {Promise} + */ + Page.prototype.getVisuals = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_6; + var _this = this; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.report.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body + .map(function (visual) { + return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); + })]; + case 3: + response_6 = _a.sent(); + throw response_6.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Checks if page has layout. + * + * ```javascript + * page.hasLayout(layoutType) + * .then(hasLayout: boolean => { ... }); + * ``` + * + * @returns {(Promise)} + */ + Page.prototype.hasLayout = function (layoutType) { + return __awaiter(this, void 0, void 0, function () { + var layoutTypeEnum, response, response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.report.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + layoutTypeEnum = models.LayoutType[layoutType]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_7 = _a.sent(); + throw response_7.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + return Page; +}()); +exports.Page = Page; /***/ }), @@ -7250,40 +7253,40 @@ exports.Page = Page; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.models = exports.factories = exports.service = void 0; -/** - * @hidden - */ -var service = __webpack_require__(/*! ./service */ "./src/service.ts"); -exports.service = service; -var factories = __webpack_require__(/*! ./factories */ "./src/factories.ts"); -exports.factories = factories; -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -exports.models = models; -var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); -Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } }); -var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"); -Object.defineProperty(exports, "Dashboard", { enumerable: true, get: function () { return dashboard_1.Dashboard; } }); -var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts"); -Object.defineProperty(exports, "Tile", { enumerable: true, get: function () { return tile_1.Tile; } }); -var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -Object.defineProperty(exports, "Embed", { enumerable: true, get: function () { return embed_1.Embed; } }); -var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); -Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return page_1.Page; } }); -var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts"); -Object.defineProperty(exports, "Qna", { enumerable: true, get: function () { return qna_1.Qna; } }); -var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts"); -Object.defineProperty(exports, "Visual", { enumerable: true, get: function () { return visual_1.Visual; } }); -var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); -Object.defineProperty(exports, "VisualDescriptor", { enumerable: true, get: function () { return visualDescriptor_1.VisualDescriptor; } }); -/** - * Makes Power BI available to the global object for use in applications that don't have module loading support. - * - * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service. - */ -var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); -window.powerbi = powerbi; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualDescriptor = exports.Visual = exports.Qna = exports.Page = exports.Embed = exports.Tile = exports.Dashboard = exports.Report = exports.models = exports.factories = exports.service = void 0; +/** + * @hidden + */ +var service = __webpack_require__(/*! ./service */ "./src/service.ts"); +exports.service = service; +var factories = __webpack_require__(/*! ./factories */ "./src/factories.ts"); +exports.factories = factories; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +exports.models = models; +var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); +Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } }); +var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"); +Object.defineProperty(exports, "Dashboard", { enumerable: true, get: function () { return dashboard_1.Dashboard; } }); +var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts"); +Object.defineProperty(exports, "Tile", { enumerable: true, get: function () { return tile_1.Tile; } }); +var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +Object.defineProperty(exports, "Embed", { enumerable: true, get: function () { return embed_1.Embed; } }); +var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); +Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return page_1.Page; } }); +var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts"); +Object.defineProperty(exports, "Qna", { enumerable: true, get: function () { return qna_1.Qna; } }); +var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts"); +Object.defineProperty(exports, "Visual", { enumerable: true, get: function () { return visual_1.Visual; } }); +var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); +Object.defineProperty(exports, "VisualDescriptor", { enumerable: true, get: function () { return visualDescriptor_1.VisualDescriptor; } }); +/** + * Makes Power BI available to the global object for use in applications that don't have module loading support. + * + * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service. + */ +var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); +window.powerbi = powerbi; /***/ }), @@ -7295,142 +7298,142 @@ window.powerbi = powerbi; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Qna = void 0; -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -/** - * The Power BI Q&A embed component - * - * @export - * @class Qna - * @extends {Embed} - */ -var Qna = /** @class */ (function (_super) { - __extends(Qna, _super); - /** - * @hidden - */ - function Qna(service, element, config, phasedRender, isBootstrap) { - var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; - _this.loadPath = "/qna/load"; - _this.phasedLoadPath = "/qna/prepare"; - Array.prototype.push.apply(_this.allowedEvents, Qna.allowedEvents); - return _this; - } - /** - * The ID of the Q&A embed component - * - * @returns {string} - */ - Qna.prototype.getId = function () { - return null; - }; - /** - * Change the question of the Q&A embed component - * - * @param {string} question - question which will render Q&A data - * @returns {Promise>} - */ - Qna.prototype.setQuestion = function (question) { - return __awaiter(this, void 0, void 0, function () { - var qnaData, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - qnaData = { - question: question - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_1 = _a.sent(); - throw response_1.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Qna.prototype.configChanged = function (isBootstrap) { - // Nothing to do in Q&A embed. - }; - /** - * @hidden - * @returns {string} - */ - Qna.prototype.getDefaultEmbedUrlEndpoint = function () { - return "qnaEmbed"; - }; - /** - * Validate load configuration. - */ - Qna.prototype.validate = function (config) { - return models.validateLoadQnaConfiguration(config); - }; - /** @hidden */ - Qna.type = "Qna"; - /** @hidden */ - Qna.allowedEvents = ["loaded", "visualRendered"]; - return Qna; -}(embed.Embed)); -exports.Qna = Qna; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Qna = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +/** + * The Power BI Q&A embed component + * + * @export + * @class Qna + * @extends {Embed} + */ +var Qna = /** @class */ (function (_super) { + __extends(Qna, _super); + /** + * @hidden + */ + function Qna(service, element, config, phasedRender, isBootstrap) { + var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + _this.loadPath = "/qna/load"; + _this.phasedLoadPath = "/qna/prepare"; + Array.prototype.push.apply(_this.allowedEvents, Qna.allowedEvents); + return _this; + } + /** + * The ID of the Q&A embed component + * + * @returns {string} + */ + Qna.prototype.getId = function () { + return null; + }; + /** + * Change the question of the Q&A embed component + * + * @param {string} question - question which will render Q&A data + * @returns {Promise>} + */ + Qna.prototype.setQuestion = function (question) { + return __awaiter(this, void 0, void 0, function () { + var qnaData, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + qnaData = { + question: question + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post('/qna/interpret', qnaData, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Qna.prototype.configChanged = function (isBootstrap) { + // Nothing to do in Q&A embed. + }; + /** + * @hidden + * @returns {string} + */ + Qna.prototype.getDefaultEmbedUrlEndpoint = function () { + return "qnaEmbed"; + }; + /** + * Validate load configuration. + */ + Qna.prototype.validate = function (config) { + return models.validateLoadQnaConfiguration(config); + }; + /** @hidden */ + Qna.type = "Qna"; + /** @hidden */ + Qna.allowedEvents = ["loaded", "visualRendered"]; + return Qna; +}(embed.Embed)); +exports.Qna = Qna; /***/ }), @@ -7442,814 +7445,814 @@ exports.Qna = Qna; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Report = void 0; -var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); -var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); -var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); -var bookmarksManager_1 = __webpack_require__(/*! ./bookmarksManager */ "./src/bookmarksManager.ts"); -/** - * The Power BI Report embed component - * - * @export - * @class Report - * @extends {embed.Embed} - * @implements {IReportNode} - * @implements {IFilterable} - */ -var Report = /** @class */ (function (_super) { - __extends(Report, _super); - /** - * Creates an instance of a Power BI Report. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} config - * @hidden - */ - function Report(service, element, baseConfig, phasedRender, isBootstrap, iframe) { - var _this = this; - var config = baseConfig; - _this = _super.call(this, service, element, config, iframe, phasedRender, isBootstrap) || this; - _this.loadPath = "/report/load"; - _this.phasedLoadPath = "/report/prepare"; - Array.prototype.push.apply(_this.allowedEvents, Report.allowedEvents); - _this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, _this.iframe); - return _this; - } - /** - * Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID - * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1). - * - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Report.findIdFromEmbedUrl = function (url) { - var reportIdRegEx = /reportId="?([^&]+)"?/; - var reportIdMatch = url.match(reportIdRegEx); - var reportId; - if (reportIdMatch) { - reportId = reportIdMatch[1]; - } - return reportId; - }; - /** - * Render a preloaded report, using phased embedding API - * - * ```javascript - * // Load report - * var report = powerbi.load(element, config); - * - * ... - * - * // Render report - * report.render() - * ``` - * - * @returns {Promise} - */ - Report.prototype.render = function (config) { - return __awaiter(this, void 0, void 0, function () { - var response, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.post("/report/render", config, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_1 = _a.sent(); - throw response_1.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Add an empty page to the report - * - * ```javascript - * // Add a page to the report with "Sales" as the page display name - * report.addPage("Sales"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.addPage = function (displayName) { - return __awaiter(this, void 0, void 0, function () { - var request, response, page, response_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - request = { - displayName: displayName - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post("/report/addPage", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - page = response.body; - return [2 /*return*/, new page_1.Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption)]; - case 3: - response_2 = _a.sent(); - throw response_2.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Delete a page from a report - * - * ```javascript - * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) - * report.deletePage("ReportSection145"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.deletePage = function (pageName) { - return __awaiter(this, void 0, void 0, function () { - var response, response_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_3 = _a.sent(); - throw response_3.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Rename a page from a report - * - * ```javascript - * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) - * report.renamePage("ReportSection145", "Sales"); - * ``` - * - * @returns {Promise} - */ - Report.prototype.renamePage = function (pageName, displayName) { - return __awaiter(this, void 0, void 0, function () { - var page, response, response_4; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - page = { - name: pageName, - displayName: displayName, - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.put("/report/pages/" + pageName + "/name", page, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_4 = _a.sent(); - throw response_4.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Gets filters that are applied at the report level. - * - * ```javascript - * // Get filters applied at report level - * report.getFilters() - * .then(filters => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Report.prototype.getFilters = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_5; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.get("/report/filters", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_5 = _a.sent(); - throw response_5.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Gets the report ID from the first available location: options, attribute, embed url. - * - * @returns {string} - */ - Report.prototype.getId = function () { - var config = this.config; - var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); - if (typeof reportId !== 'string' || reportId.length === 0) { - throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'."); - } - return reportId; - }; - /** - * Gets the list of pages within the report. - * - * ```javascript - * report.getPages() - * .then(pages => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Report.prototype.getPages = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_6; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body - .map(function (page) { - return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); - })]; - case 3: - response_6 = _a.sent(); - throw response_6.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Creates an instance of a Page. - * - * Normally you would get Page objects by calling `report.getPages()`, but in the case - * that the page name is known and you want to perform an action on a page without having to retrieve it - * you can create it directly. - * - * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. - * - * @param {string} name - * @param {string} [displayName] - * @param {boolean} [isActive] - * @returns {Page} - * @hidden - */ - Report.prototype.page = function (name, displayName, isActive, visibility) { - return new page_1.Page(this, name, displayName, isActive, visibility); - }; - /** - * Prints the active page of the report by invoking `window.print()` on the embed iframe component. - */ - Report.prototype.print = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_7; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_7 = _a.sent(); - throw response_7.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Removes all filters at the report level. - * - * ```javascript - * report.removeFilters(); - * ``` - * - * @returns {Promise>} - */ - Report.prototype.removeFilters = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - return [4 /*yield*/, this.setFilters([])]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Sets the active page of the report. - * - * ```javascript - * report.setPage("page2") - * .catch(error => { ... }); - * ``` - * - * @param {string} pageName - * @returns {Promise>} - */ - Report.prototype.setPage = function (pageName) { - return __awaiter(this, void 0, void 0, function () { - var page, response_8; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - page = { - name: pageName, - displayName: null, - isActive: true - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_8 = _a.sent(); - throw response_8.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Sets filters at the report level. - * - * ```javascript - * const filters: [ - * ... - * ]; - * - * report.setFilters(filters) - * .catch(errors => { - * ... - * }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise>} - */ - Report.prototype.setFilters = function (filters) { - return __awaiter(this, void 0, void 0, function () { - var response_9; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.put("/report/filters", filters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_9 = _a.sent(); - throw response_9.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Updates visibility settings for the filter pane and the page navigation pane. - * - * ```javascript - * const newSettings = { - * navContentPaneEnabled: true, - * filterPaneEnabled: false - * }; - * - * report.updateSettings(newSettings) - * .catch(error => { ... }); - * ``` - * - * @param {models.ISettings} settings - * @returns {Promise>} - */ - Report.prototype.updateSettings = function (settings) { - return __awaiter(this, void 0, void 0, function () { - var response_10; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_10 = _a.sent(); - throw response_10.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Validate load configuration. - * - * @hidden - */ - Report.prototype.validate = function (config) { - return models.validateReportLoad(config); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Report.prototype.configChanged = function (isBootstrap) { - var config = this.config; - if (this.isMobileSettings(config.settings)) - config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); - // Calculate settings from HTML element attributes if available. - var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute); - var navContentPaneEnabledAttribute = this.element.getAttribute(Report.navContentPaneEnabledAttribute); - var elementAttrSettings = { - filterPaneEnabled: (filterPaneEnabledAttribute == null) ? undefined : (filterPaneEnabledAttribute !== "false"), - navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false") - }; - // Set the settings back into the config. - this.config.settings = utils.assign({}, elementAttrSettings, config.settings); - if (isBootstrap) { - return; - } - config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Report.prototype.getDefaultEmbedUrlEndpoint = function () { - return "reportEmbed"; - }; - /** - * Switch Report view mode. - * - * @returns {Promise} - */ - Report.prototype.switchMode = function (viewMode) { - return __awaiter(this, void 0, void 0, function () { - var newMode, url, response, response_11; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (typeof viewMode === "string") { - newMode = viewMode; - } - else { - newMode = this.viewModeToString(viewMode); - } - url = '/report/switchMode/' + newMode; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_11 = _a.sent(); - throw response_11.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Refreshes data sources for the report. - * - * ```javascript - * report.refresh(); - * ``` - */ - Report.prototype.refresh = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_12; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_12 = _a.sent(); - throw response_12.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * checks if the report is saved. - * - * ```javascript - * report.isSaved() - * ``` - * - * @returns {Promise} - */ - Report.prototype.isSaved = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - return [4 /*yield*/, utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Apply a theme to the report - * - * ```javascript - * report.applyTheme(theme); - * ``` - */ - Report.prototype.applyTheme = function (theme) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - return [4 /*yield*/, this.applyThemeInternal(theme)]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Reset and apply the default theme of the report - * - * ```javascript - * report.resetTheme(); - * ``` - */ - Report.prototype.resetTheme = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (utils.isRDLEmbed(this.config.embedUrl)) { - return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; - } - return [4 /*yield*/, this.applyThemeInternal({})]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Reset user's filters, slicers, and other data view changes to the default state of the report - * - * ```javascript - * report.resetPersistentFilters(); - * ``` - */ - Report.prototype.resetPersistentFilters = function () { - return __awaiter(this, void 0, void 0, function () { - var response_13; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: - response_13 = _a.sent(); - throw response_13.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Save user's filters, slicers, and other data view changes of the report - * - * ```javascript - * report.savePersistentFilters(); - * ``` - */ - Report.prototype.savePersistentFilters = function () { - return __awaiter(this, void 0, void 0, function () { - var response_14; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: - response_14 = _a.sent(); - throw response_14.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Returns if there are user's filters, slicers, or other data view changes applied on the report. - * If persistent filters is disable, returns false. - * - * ```javascript - * report.arePersistentFiltersApplied(); - * ``` - * - * @returns {Promise} - */ - Report.prototype.arePersistentFiltersApplied = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_15; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_15 = _a.sent(); - throw response_15.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * @hidden - */ - Report.prototype.applyThemeInternal = function (theme) { - return __awaiter(this, void 0, void 0, function () { - var response, response_16; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_16 = _a.sent(); - throw response_16.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * @hidden - */ - Report.prototype.viewModeToString = function (viewMode) { - var mode; - switch (viewMode) { - case models.ViewMode.Edit: - mode = "edit"; - break; - case models.ViewMode.View: - mode = "view"; - break; - } - return mode; - }; - /** - * @hidden - */ - Report.prototype.isMobileSettings = function (settings) { - return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); - }; - /** @hidden */ - Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; - /** @hidden */ - Report.reportIdAttribute = 'powerbi-report-id'; - /** @hidden */ - Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled'; - /** @hidden */ - Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled'; - /** @hidden */ - Report.typeAttribute = 'powerbi-type'; - /** @hidden */ - Report.type = "Report"; - return Report; -}(embed.Embed)); -exports.Report = Report; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Report = void 0; +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts"); +var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); +var bookmarksManager_1 = __webpack_require__(/*! ./bookmarksManager */ "./src/bookmarksManager.ts"); +/** + * The Power BI Report embed component + * + * @export + * @class Report + * @extends {embed.Embed} + * @implements {IReportNode} + * @implements {IFilterable} + */ +var Report = /** @class */ (function (_super) { + __extends(Report, _super); + /** + * Creates an instance of a Power BI Report. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} config + * @hidden + */ + function Report(service, element, baseConfig, phasedRender, isBootstrap, iframe) { + var _this = this; + var config = baseConfig; + _this = _super.call(this, service, element, config, iframe, phasedRender, isBootstrap) || this; + _this.loadPath = "/report/load"; + _this.phasedLoadPath = "/report/prepare"; + Array.prototype.push.apply(_this.allowedEvents, Report.allowedEvents); + _this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, _this.iframe); + return _this; + } + /** + * Adds backwards compatibility for the previous load configuration, which used the reportId query parameter to specify the report ID + * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?reportId=854846ed-2106-4dc2-bc58-eb77533bf2f1). + * + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Report.findIdFromEmbedUrl = function (url) { + var reportIdRegEx = /reportId="?([^&]+)"?/; + var reportIdMatch = url.match(reportIdRegEx); + var reportId; + if (reportIdMatch) { + reportId = reportIdMatch[1]; + } + return reportId; + }; + /** + * Render a preloaded report, using phased embedding API + * + * ```javascript + * // Load report + * var report = powerbi.load(element, config); + * + * ... + * + * // Render report + * report.render() + * ``` + * + * @returns {Promise} + */ + Report.prototype.render = function (config) { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post("/report/render", config, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Add an empty page to the report + * + * ```javascript + * // Add a page to the report with "Sales" as the page display name + * report.addPage("Sales"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.addPage = function (displayName) { + return __awaiter(this, void 0, void 0, function () { + var request, response, page, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + request = { + displayName: displayName + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post("/report/addPage", request, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + page = response.body; + return [2 /*return*/, new page_1.Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption)]; + case 3: + response_2 = _a.sent(); + throw response_2.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Delete a page from a report + * + * ```javascript + * // Delete a page from a report by pageName (PageName is different than the display name and can be acquired from the getPages API) + * report.deletePage("ReportSection145"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.deletePage = function (pageName) { + return __awaiter(this, void 0, void 0, function () { + var response, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_3 = _a.sent(); + throw response_3.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Rename a page from a report + * + * ```javascript + * // Rename a page from a report by changing displayName (pageName is different from the display name and can be acquired from the getPages API) + * report.renamePage("ReportSection145", "Sales"); + * ``` + * + * @returns {Promise} + */ + Report.prototype.renamePage = function (pageName, displayName) { + return __awaiter(this, void 0, void 0, function () { + var page, response, response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + page = { + name: pageName, + displayName: displayName, + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put("/report/pages/" + pageName + "/name", page, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_4 = _a.sent(); + throw response_4.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets filters that are applied at the report level. + * + * ```javascript + * // Get filters applied at report level + * report.getFilters() + * .then(filters => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Report.prototype.getFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get("/report/filters", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_5 = _a.sent(); + throw response_5.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets the report ID from the first available location: options, attribute, embed url. + * + * @returns {string} + */ + Report.prototype.getId = function () { + var config = this.config; + var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl); + if (typeof reportId !== 'string' || reportId.length === 0) { + throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'."); + } + return reportId; + }; + /** + * Gets the list of pages within the report. + * + * ```javascript + * report.getPages() + * .then(pages => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Report.prototype.getPages = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_6; + var _this = this; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body + .map(function (page) { + return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); + })]; + case 3: + response_6 = _a.sent(); + throw response_6.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Creates an instance of a Page. + * + * Normally you would get Page objects by calling `report.getPages()`, but in the case + * that the page name is known and you want to perform an action on a page without having to retrieve it + * you can create it directly. + * + * Note: Because you are creating the page manually there is no guarantee that the page actually exists in the report, and subsequent requests could fail. + * + * @param {string} name + * @param {string} [displayName] + * @param {boolean} [isActive] + * @returns {Page} + * @hidden + */ + Report.prototype.page = function (name, displayName, isActive, visibility) { + return new page_1.Page(this, name, displayName, isActive, visibility); + }; + /** + * Prints the active page of the report by invoking `window.print()` on the embed iframe component. + */ + Report.prototype.print = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post('/report/print', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_7 = _a.sent(); + throw response_7.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters at the report level. + * + * ```javascript + * report.removeFilters(); + * ``` + * + * @returns {Promise>} + */ + Report.prototype.removeFilters = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, this.setFilters([])]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Sets the active page of the report. + * + * ```javascript + * report.setPage("page2") + * .catch(error => { ... }); + * ``` + * + * @param {string} pageName + * @returns {Promise>} + */ + Report.prototype.setPage = function (pageName) { + return __awaiter(this, void 0, void 0, function () { + var page, response_8; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + page = { + name: pageName, + displayName: null, + isActive: true + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_8 = _a.sent(); + throw response_8.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets filters at the report level. + * + * ```javascript + * const filters: [ + * ... + * ]; + * + * report.setFilters(filters) + * .catch(errors => { + * ... + * }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + Report.prototype.setFilters = function (filters) { + return __awaiter(this, void 0, void 0, function () { + var response_9; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put("/report/filters", filters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_9 = _a.sent(); + throw response_9.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Updates visibility settings for the filter pane and the page navigation pane. + * + * ```javascript + * const newSettings = { + * navContentPaneEnabled: true, + * filterPaneEnabled: false + * }; + * + * report.updateSettings(newSettings) + * .catch(error => { ... }); + * ``` + * + * @param {models.ISettings} settings + * @returns {Promise>} + */ + Report.prototype.updateSettings = function (settings) { + return __awaiter(this, void 0, void 0, function () { + var response_10; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_10 = _a.sent(); + throw response_10.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Validate load configuration. + * + * @hidden + */ + Report.prototype.validate = function (config) { + return models.validateReportLoad(config); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Report.prototype.configChanged = function (isBootstrap) { + var config = this.config; + if (this.isMobileSettings(config.settings)) + config.embedUrl = utils.addParamToUrl(config.embedUrl, "isMobile", "true"); + // Calculate settings from HTML element attributes if available. + var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute); + var navContentPaneEnabledAttribute = this.element.getAttribute(Report.navContentPaneEnabledAttribute); + var elementAttrSettings = { + filterPaneEnabled: (filterPaneEnabledAttribute == null) ? undefined : (filterPaneEnabledAttribute !== "false"), + navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false") + }; + // Set the settings back into the config. + this.config.settings = utils.assign({}, elementAttrSettings, config.settings); + if (isBootstrap) { + return; + } + config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Report.prototype.getDefaultEmbedUrlEndpoint = function () { + return "reportEmbed"; + }; + /** + * Switch Report view mode. + * + * @returns {Promise} + */ + Report.prototype.switchMode = function (viewMode) { + return __awaiter(this, void 0, void 0, function () { + var newMode, url, response, response_11; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (typeof viewMode === "string") { + newMode = viewMode; + } + else { + newMode = this.viewModeToString(viewMode); + } + url = '/report/switchMode/' + newMode; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.post(url, null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_11 = _a.sent(); + throw response_11.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Refreshes data sources for the report. + * + * ```javascript + * report.refresh(); + * ``` + */ + Report.prototype.refresh = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_12; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_12 = _a.sent(); + throw response_12.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * checks if the report is saved. + * + * ```javascript + * report.isSaved() + * ``` + * + * @returns {Promise} + */ + Report.prototype.isSaved = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, utils.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Apply a theme to the report + * + * ```javascript + * report.applyTheme(theme); + * ``` + */ + Report.prototype.applyTheme = function (theme) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, this.applyThemeInternal(theme)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Reset and apply the default theme of the report + * + * ```javascript + * report.resetTheme(); + * ``` + */ + Report.prototype.resetTheme = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (utils.isRDLEmbed(this.config.embedUrl)) { + return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)]; + } + return [4 /*yield*/, this.applyThemeInternal({})]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Reset user's filters, slicers, and other data view changes to the default state of the report + * + * ```javascript + * report.resetPersistentFilters(); + * ``` + */ + Report.prototype.resetPersistentFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response_13; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_13 = _a.sent(); + throw response_13.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Save user's filters, slicers, and other data view changes of the report + * + * ```javascript + * report.savePersistentFilters(); + * ``` + */ + Report.prototype.savePersistentFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response_14; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_14 = _a.sent(); + throw response_14.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Returns if there are user's filters, slicers, or other data view changes applied on the report. + * If persistent filters is disable, returns false. + * + * ```javascript + * report.arePersistentFiltersApplied(); + * ``` + * + * @returns {Promise} + */ + Report.prototype.arePersistentFiltersApplied = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_15; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_15 = _a.sent(); + throw response_15.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * @hidden + */ + Report.prototype.applyThemeInternal = function (theme) { + return __awaiter(this, void 0, void 0, function () { + var response, response_16; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.service.hpm.put('/report/theme', theme, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_16 = _a.sent(); + throw response_16.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * @hidden + */ + Report.prototype.viewModeToString = function (viewMode) { + var mode; + switch (viewMode) { + case models.ViewMode.Edit: + mode = "edit"; + break; + case models.ViewMode.View: + mode = "view"; + break; + } + return mode; + }; + /** + * @hidden + */ + Report.prototype.isMobileSettings = function (settings) { + return settings && (settings.layoutType === models.LayoutType.MobileLandscape || settings.layoutType === models.LayoutType.MobilePortrait); + }; + /** @hidden */ + Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"]; + /** @hidden */ + Report.reportIdAttribute = 'powerbi-report-id'; + /** @hidden */ + Report.filterPaneEnabledAttribute = 'powerbi-settings-filter-pane-enabled'; + /** @hidden */ + Report.navContentPaneEnabledAttribute = 'powerbi-settings-nav-content-pane-enabled'; + /** @hidden */ + Report.typeAttribute = 'powerbi-type'; + /** @hidden */ + Report.type = "Report"; + return Report; +}(embed.Embed)); +exports.Report = Report; /***/ }), @@ -8261,446 +8264,446 @@ exports.Report = Report; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Service = void 0; -var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); -var create_1 = __webpack_require__(/*! ./create */ "./src/create.ts"); -var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"); -var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts"); -var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); -var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts"); -var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts"); -var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); -/** - * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application - * - * @export - * @class Service - * @implements {IService} - */ -var Service = /** @class */ (function () { - /** - * Creates an instance of a Power BI Service. - * - * @param {IHpmFactory} hpmFactory The http post message factory used in the postMessage communication layer - * @param {IWpmpFactory} wpmpFactory The window post message factory used in the postMessage communication layer - * @param {IRouterFactory} routerFactory The router factory used in the postMessage communication layer - * @param {IServiceConfiguration} [config={}] - * @hidden - */ - function Service(hpmFactory, wpmpFactory, routerFactory, config) { - var _this = this; - if (config === void 0) { config = {}; } - this.wpmp = wpmpFactory(config.wpmpName, config.logMessages); - this.hpm = hpmFactory(this.wpmp, null, config.version, config.type); - this.router = routerFactory(this.wpmp); - this.uniqueSessionId = utils.generateUUID(); - /** - * Adds handler for report events. - */ - this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'dashboard', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'tile', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - /** - * Adds handler for Q&A events. - */ - this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) { - var event = { - type: 'qna', - id: req.params.uniqueId, - name: req.params.eventName, - value: req.body - }; - _this.handleEvent(event); - }); - /** - * Adds handler for front load 'ready' message. - */ - this.router.post("/ready/:uniqueId", function (req, res) { - var event = { - type: 'report', - id: req.params.uniqueId, - name: 'ready', - value: req.body - }; - _this.handleEvent(event); - }); - this.embeds = []; - // TODO: Change when Object.assign is available. - this.config = utils.assign({}, Service.defaultConfig, config); - if (this.config.autoEmbedOnContentLoaded) { - this.enableAutoEmbed(); - } - } - /** - * Creates new report - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.createReport = function (element, config) { - config.type = 'create'; - var powerBiElement = element; - var component = new create_1.Create(this, powerBiElement, config); - powerBiElement.powerBiEmbed = component; - this.addOrOverwriteEmbed(component, element); - return component; - }; - /** - * TODO: Add a description here - * - * @param {HTMLElement} [container] - * @param {embed.IEmbedConfiguration} [config=undefined] - * @returns {embed.Embed[]} - * @hidden - */ - Service.prototype.init = function (container, config) { - var _this = this; - if (config === void 0) { config = undefined; } - container = (container && container instanceof HTMLElement) ? container : document.body; - var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]")); - return elements.map(function (element) { return _this.embed(element, config); }); - }; - /** - * Given a configuration based on an HTML element, - * if the component has already been created and attached to the element, reuses the component instance and existing iframe, - * otherwise creates a new component instance. - * - * @param {HTMLElement} element - * @param {embed.IEmbedConfigurationBase} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.embed = function (element, config) { - if (config === void 0) { config = {}; } - return this.embedInternal(element, config); - }; - /** - * Given a configuration based on an HTML element, - * if the component has already been created and attached to the element, reuses the component instance and existing iframe, - * otherwise creates a new component instance. - * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. - * - * @param {HTMLElement} element - * @param {embed.IEmbedConfigurationBase} [config={}] - * @returns {embed.Embed} - */ - Service.prototype.load = function (element, config) { - if (config === void 0) { config = {}; } - return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); - }; - /** - * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. - * - * @param {HTMLElement} element - * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. - */ - Service.prototype.bootstrap = function (element, config) { - return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); - }; - /** @hidden */ - Service.prototype.embedInternal = function (element, config, phasedRender, isBootstrap) { - if (config === void 0) { config = {}; } - var component; - var powerBiElement = element; - if (powerBiElement.powerBiEmbed) { - if (isBootstrap) { - throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element."); - } - component = this.embedExisting(powerBiElement, config, phasedRender); - } - else { - component = this.embedNew(powerBiElement, config, phasedRender, isBootstrap); - } - return component; - }; - /** @hidden */ - Service.prototype.getNumberOfComponents = function () { - if (!this.embeds) { - return 0; - } - return this.embeds.length; - }; - /** @hidden */ - Service.prototype.getSdkSessionId = function () { - return this.uniqueSessionId; - }; - /** - * Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup. - * - * @private - * @param {IPowerBiElement} element - * @param {embed.IEmbedConfigurationBase} config - * @returns {embed.Embed} - * @hidden - */ - Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) { - var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); - if (!componentType) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'."); - } - // Saves the type as part of the configuration so that it can be referenced later at a known location. - config.type = componentType; - var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components); - if (!Component) { - throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended."); - } - var component = new Component(this, element, config, phasedRender, isBootstrap); - element.powerBiEmbed = component; - this.addOrOverwriteEmbed(component, element); - return component; - }; - /** - * Given an element that already contains an embed component, load with a new configuration. - * - * @private - * @param {IPowerBiElement} element - * @param {embed.IEmbedConfigurationBase} config - * @returns {embed.Embed} - * @hidden - */ - Service.prototype.embedExisting = function (element, config, phasedRender) { - var component = utils.find(function (x) { return x.element === element; }, this.embeds); - if (!component) { - throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded component associated, but could not find the existing component in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); - } - // TODO: Multiple embedding to the same iframe is not supported in QnA - if (config.type && config.type.toLowerCase() === "qna") { - return this.embedNew(element, config); - } - /** - * TODO: Dynamic embed type switching could be supported but there is work needed to prepare the service state and DOM cleanup. - * remove all event handlers from the DOM, then reset the element to initial state which removes iframe, and removes from list of embeds - * then we can call the embedNew function which would allow setting the proper embedUrl and construction of object based on the new type. - */ - if (typeof config.type === "string" && config.type !== component.config.type) { - /** - * When loading report after create we want to use existing Iframe to optimize load period - */ - if (config.type === "report" && component.config.type === "create") { - var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe); - component.populateConfig(config, /* isBootstrap */ false); - report.load(); - element.powerBiEmbed = report; - this.addOrOverwriteEmbed(component, element); - return report; - } - throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type); - } - component.populateConfig(config, /* isBootstrap */ false); - component.load(phasedRender); - return component; - }; - /** - * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, - * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. - * - * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. - * This handler is typically useful only for applications that are rendered on the server so that all required data is available when the handler is called. - * - * @hidden - */ - Service.prototype.enableAutoEmbed = function () { - var _this = this; - window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false); - }; - /** - * Returns an instance of the component associated with the element. - * - * @param {HTMLElement} element - * @returns {(Report | Tile)} - */ - Service.prototype.get = function (element) { - var powerBiElement = element; - if (!powerBiElement.powerBiEmbed) { - throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance."); - } - return powerBiElement.powerBiEmbed; - }; - /** - * Finds an embed instance by the name or unique ID that is provided. - * - * @param {string} uniqueId - * @returns {(Report | Tile)} - * @hidden - */ - Service.prototype.find = function (uniqueId) { - return utils.find(function (x) { return x.config.uniqueId === uniqueId; }, this.embeds); - }; - /** - * Removes embed components whose container element is same as the given element - * - * @param {Embed} component - * @param {HTMLElement} element - * @returns {void} - * @hidden - */ - Service.prototype.addOrOverwriteEmbed = function (component, element) { - // remove embeds over the same div element. - this.embeds = this.embeds.filter(function (embed) { - return embed.element !== element; - }); - this.embeds.push(component); - }; - /** - * Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe. - * - * @param {HTMLElement} element - * @returns {void} - */ - Service.prototype.reset = function (element) { - var powerBiElement = element; - if (!powerBiElement.powerBiEmbed) { - return; - } - /** Removes the element frontLoad listener if exists. */ - var embedElement = powerBiElement.powerBiEmbed; - if (embedElement.frontLoadHandler) { - embedElement.element.removeEventListener('ready', embedElement.frontLoadHandler, false); - } - /** Removes the component from an internal list of components. */ - utils.remove(function (x) { return x === powerBiElement.powerBiEmbed; }, this.embeds); - /** Deletes a property from the HTML element. */ - delete powerBiElement.powerBiEmbed; - /** Removes the iframe from the element. */ - var iframe = element.querySelector('iframe'); - if (iframe) { - if (iframe.remove !== undefined) { - iframe.remove(); - } - else { - /** Workaround for IE: unhandled rejection TypeError: object doesn't support property or method 'remove' */ - iframe.parentElement.removeChild(iframe); - } - } - }; - /** - * handles tile events - * - * @param {IEvent} event - * @hidden - */ - Service.prototype.handleTileEvents = function (event) { - if (event.type === 'tile') { - this.handleEvent(event); - } - }; - /** - * Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object. - * - * @private - * @param {IEvent} event - * @hidden - */ - Service.prototype.handleEvent = function (event) { - var embed = utils.find(function (embed) { - return (embed.config.uniqueId === event.id); - }, this.embeds); - if (embed) { - var value = event.value; - if (event.name === 'pageChanged') { - var pageKey = 'newPage'; - var page = value[pageKey]; - if (!page) { - throw new Error("Page model not found at 'event.value." + pageKey + "'."); - } - value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */); - } - utils.raiseCustomEvent(embed.element, event.name, value); - } - }; - /** - * API for warm starting powerbi embedded endpoints. - * Use this API to preload Power BI Embedded in the background. - * - * @public - * @param {embed.IEmbedConfigurationBase} [config={}] - * @param {HTMLElement} [element=undefined] - */ - Service.prototype.preload = function (config, element) { - var iframeContent = document.createElement("iframe"); - iframeContent.setAttribute("style", "display:none;"); - iframeContent.setAttribute("src", config.embedUrl); - iframeContent.setAttribute("scrolling", "no"); - iframeContent.setAttribute("allowfullscreen", "false"); - var node = element; - if (!node) { - node = document.getElementsByTagName("body")[0]; - } - node.appendChild(iframeContent); - iframeContent.onload = function () { - utils.raiseCustomEvent(iframeContent, "preloaded", {}); - }; - return iframeContent; - }; - /** - * A list of components that this service can embed - */ - Service.components = [ - tile_1.Tile, - report_1.Report, - dashboard_1.Dashboard, - qna_1.Qna, - visual_1.Visual - ]; - /** - * The default configuration for the service - */ - Service.defaultConfig = { - autoEmbedOnContentLoaded: false, - onError: function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return console.log(args[0], args.slice(1)); - } - }; - return Service; -}()); -exports.Service = Service; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Service = void 0; +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); +var create_1 = __webpack_require__(/*! ./create */ "./src/create.ts"); +var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"); +var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts"); +var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts"); +var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts"); +var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts"); +var utils = __webpack_require__(/*! ./util */ "./src/util.ts"); +/** + * The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application + * + * @export + * @class Service + * @implements {IService} + */ +var Service = /** @class */ (function () { + /** + * Creates an instance of a Power BI Service. + * + * @param {IHpmFactory} hpmFactory The http post message factory used in the postMessage communication layer + * @param {IWpmpFactory} wpmpFactory The window post message factory used in the postMessage communication layer + * @param {IRouterFactory} routerFactory The router factory used in the postMessage communication layer + * @param {IServiceConfiguration} [config={}] + * @hidden + */ + function Service(hpmFactory, wpmpFactory, routerFactory, config) { + var _this = this; + if (config === void 0) { config = {}; } + this.wpmp = wpmpFactory(config.wpmpName, config.logMessages); + this.hpm = hpmFactory(this.wpmp, null, config.version, config.type); + this.router = routerFactory(this.wpmp); + this.uniqueSessionId = utils.generateUUID(); + /** + * Adds handler for report events. + */ + this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'dashboard', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'tile', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + /** + * Adds handler for Q&A events. + */ + this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) { + var event = { + type: 'qna', + id: req.params.uniqueId, + name: req.params.eventName, + value: req.body + }; + _this.handleEvent(event); + }); + /** + * Adds handler for front load 'ready' message. + */ + this.router.post("/ready/:uniqueId", function (req, res) { + var event = { + type: 'report', + id: req.params.uniqueId, + name: 'ready', + value: req.body + }; + _this.handleEvent(event); + }); + this.embeds = []; + // TODO: Change when Object.assign is available. + this.config = utils.assign({}, Service.defaultConfig, config); + if (this.config.autoEmbedOnContentLoaded) { + this.enableAutoEmbed(); + } + } + /** + * Creates new report + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.createReport = function (element, config) { + config.type = 'create'; + var powerBiElement = element; + var component = new create_1.Create(this, powerBiElement, config); + powerBiElement.powerBiEmbed = component; + this.addOrOverwriteEmbed(component, element); + return component; + }; + /** + * TODO: Add a description here + * + * @param {HTMLElement} [container] + * @param {embed.IEmbedConfiguration} [config=undefined] + * @returns {embed.Embed[]} + * @hidden + */ + Service.prototype.init = function (container, config) { + var _this = this; + if (config === void 0) { config = undefined; } + container = (container && container instanceof HTMLElement) ? container : document.body; + var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]")); + return elements.map(function (element) { return _this.embed(element, config); }); + }; + /** + * Given a configuration based on an HTML element, + * if the component has already been created and attached to the element, reuses the component instance and existing iframe, + * otherwise creates a new component instance. + * + * @param {HTMLElement} element + * @param {embed.IEmbedConfigurationBase} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.embed = function (element, config) { + if (config === void 0) { config = {}; } + return this.embedInternal(element, config); + }; + /** + * Given a configuration based on an HTML element, + * if the component has already been created and attached to the element, reuses the component instance and existing iframe, + * otherwise creates a new component instance. + * This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it. + * + * @param {HTMLElement} element + * @param {embed.IEmbedConfigurationBase} [config={}] + * @returns {embed.Embed} + */ + Service.prototype.load = function (element, config) { + if (config === void 0) { config = {}; } + return this.embedInternal(element, config, /* phasedRender */ true, /* isBootstrap */ false); + }; + /** + * Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding. + * + * @param {HTMLElement} element + * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token. + */ + Service.prototype.bootstrap = function (element, config) { + return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true); + }; + /** @hidden */ + Service.prototype.embedInternal = function (element, config, phasedRender, isBootstrap) { + if (config === void 0) { config = {}; } + var component; + var powerBiElement = element; + if (powerBiElement.powerBiEmbed) { + if (isBootstrap) { + throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element."); + } + component = this.embedExisting(powerBiElement, config, phasedRender); + } + else { + component = this.embedNew(powerBiElement, config, phasedRender, isBootstrap); + } + return component; + }; + /** @hidden */ + Service.prototype.getNumberOfComponents = function () { + if (!this.embeds) { + return 0; + } + return this.embeds.length; + }; + /** @hidden */ + Service.prototype.getSdkSessionId = function () { + return this.uniqueSessionId; + }; + /** + * Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup. + * + * @private + * @param {IPowerBiElement} element + * @param {embed.IEmbedConfigurationBase} config + * @returns {embed.Embed} + * @hidden + */ + Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) { + var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute); + if (!componentType) { + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'."); + } + // Saves the type as part of the configuration so that it can be referenced later at a known location. + config.type = componentType; + var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components); + if (!Component) { + throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended."); + } + var component = new Component(this, element, config, phasedRender, isBootstrap); + element.powerBiEmbed = component; + this.addOrOverwriteEmbed(component, element); + return component; + }; + /** + * Given an element that already contains an embed component, load with a new configuration. + * + * @private + * @param {IPowerBiElement} element + * @param {embed.IEmbedConfigurationBase} config + * @returns {embed.Embed} + * @hidden + */ + Service.prototype.embedExisting = function (element, config, phasedRender) { + var component = utils.find(function (x) { return x.element === element; }, this.embeds); + if (!component) { + throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded component associated, but could not find the existing component in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."); + } + // TODO: Multiple embedding to the same iframe is not supported in QnA + if (config.type && config.type.toLowerCase() === "qna") { + return this.embedNew(element, config); + } + /** + * TODO: Dynamic embed type switching could be supported but there is work needed to prepare the service state and DOM cleanup. + * remove all event handlers from the DOM, then reset the element to initial state which removes iframe, and removes from list of embeds + * then we can call the embedNew function which would allow setting the proper embedUrl and construction of object based on the new type. + */ + if (typeof config.type === "string" && config.type !== component.config.type) { + /** + * When loading report after create we want to use existing Iframe to optimize load period + */ + if (config.type === "report" && component.config.type === "create") { + var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe); + component.populateConfig(config, /* isBootstrap */ false); + report.load(); + element.powerBiEmbed = report; + this.addOrOverwriteEmbed(component, element); + return report; + } + throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type); + } + component.populateConfig(config, /* isBootstrap */ false); + component.load(phasedRender); + return component; + }; + /** + * Adds an event handler for DOMContentLoaded, which searches the DOM for elements that have the 'powerbi-embed-url' attribute, + * and automatically attempts to embed a powerbi component based on information from other powerbi-* attributes. + * + * Note: Only runs if `config.autoEmbedOnContentLoaded` is true when the service is created. + * This handler is typically useful only for applications that are rendered on the server so that all required data is available when the handler is called. + * + * @hidden + */ + Service.prototype.enableAutoEmbed = function () { + var _this = this; + window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false); + }; + /** + * Returns an instance of the component associated with the element. + * + * @param {HTMLElement} element + * @returns {(Report | Tile)} + */ + Service.prototype.get = function (element) { + var powerBiElement = element; + if (!powerBiElement.powerBiEmbed) { + throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance."); + } + return powerBiElement.powerBiEmbed; + }; + /** + * Finds an embed instance by the name or unique ID that is provided. + * + * @param {string} uniqueId + * @returns {(Report | Tile)} + * @hidden + */ + Service.prototype.find = function (uniqueId) { + return utils.find(function (x) { return x.config.uniqueId === uniqueId; }, this.embeds); + }; + /** + * Removes embed components whose container element is same as the given element + * + * @param {Embed} component + * @param {HTMLElement} element + * @returns {void} + * @hidden + */ + Service.prototype.addOrOverwriteEmbed = function (component, element) { + // remove embeds over the same div element. + this.embeds = this.embeds.filter(function (embed) { + return embed.element !== element; + }); + this.embeds.push(component); + }; + /** + * Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe. + * + * @param {HTMLElement} element + * @returns {void} + */ + Service.prototype.reset = function (element) { + var powerBiElement = element; + if (!powerBiElement.powerBiEmbed) { + return; + } + /** Removes the element frontLoad listener if exists. */ + var embedElement = powerBiElement.powerBiEmbed; + if (embedElement.frontLoadHandler) { + embedElement.element.removeEventListener('ready', embedElement.frontLoadHandler, false); + } + /** Removes the component from an internal list of components. */ + utils.remove(function (x) { return x === powerBiElement.powerBiEmbed; }, this.embeds); + /** Deletes a property from the HTML element. */ + delete powerBiElement.powerBiEmbed; + /** Removes the iframe from the element. */ + var iframe = element.querySelector('iframe'); + if (iframe) { + if (iframe.remove !== undefined) { + iframe.remove(); + } + else { + /** Workaround for IE: unhandled rejection TypeError: object doesn't support property or method 'remove' */ + iframe.parentElement.removeChild(iframe); + } + } + }; + /** + * handles tile events + * + * @param {IEvent} event + * @hidden + */ + Service.prototype.handleTileEvents = function (event) { + if (event.type === 'tile') { + this.handleEvent(event); + } + }; + /** + * Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object. + * + * @private + * @param {IEvent} event + * @hidden + */ + Service.prototype.handleEvent = function (event) { + var embed = utils.find(function (embed) { + return (embed.config.uniqueId === event.id); + }, this.embeds); + if (embed) { + var value = event.value; + if (event.name === 'pageChanged') { + var pageKey = 'newPage'; + var page = value[pageKey]; + if (!page) { + throw new Error("Page model not found at 'event.value." + pageKey + "'."); + } + value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */); + } + utils.raiseCustomEvent(embed.element, event.name, value); + } + }; + /** + * API for warm starting powerbi embedded endpoints. + * Use this API to preload Power BI Embedded in the background. + * + * @public + * @param {embed.IEmbedConfigurationBase} [config={}] + * @param {HTMLElement} [element=undefined] + */ + Service.prototype.preload = function (config, element) { + var iframeContent = document.createElement("iframe"); + iframeContent.setAttribute("style", "display:none;"); + iframeContent.setAttribute("src", config.embedUrl); + iframeContent.setAttribute("scrolling", "no"); + iframeContent.setAttribute("allowfullscreen", "false"); + var node = element; + if (!node) { + node = document.getElementsByTagName("body")[0]; + } + node.appendChild(iframeContent); + iframeContent.onload = function () { + utils.raiseCustomEvent(iframeContent, "preloaded", {}); + }; + return iframeContent; + }; + /** + * A list of components that this service can embed + */ + Service.components = [ + tile_1.Tile, + report_1.Report, + dashboard_1.Dashboard, + qna_1.Qna, + visual_1.Visual + ]; + /** + * The default configuration for the service + */ + Service.defaultConfig = { + autoEmbedOnContentLoaded: false, + onError: function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return console.log(args[0], args.slice(1)); + } + }; + return Service; +}()); +exports.Service = Service; /***/ }), @@ -8712,107 +8715,107 @@ exports.Service = Service; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Tile = void 0; -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); -/** - * The Power BI tile embed component - * - * @export - * @class Tile - * @extends {Embed} - */ -var Tile = /** @class */ (function (_super) { - __extends(Tile, _super); - /** - * @hidden - */ - function Tile(service, element, baseConfig, phasedRender, isBootstrap) { - var _this = this; - var config = baseConfig; - _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; - _this.loadPath = "/tile/load"; - Array.prototype.push.apply(_this.allowedEvents, Tile.allowedEvents); - return _this; - } - /** - * The ID of the tile - * - * @returns {string} - */ - Tile.prototype.getId = function () { - var config = this.config; - var tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); - if (typeof tileId !== 'string' || tileId.length === 0) { - throw new Error("Tile id is required, but it was not found. You must provide an id either as part of embed configuration."); - } - return tileId; - }; - /** - * Validate load configuration. - */ - Tile.prototype.validate = function (config) { - var embedConfig = config; - return models.validateTileLoad(embedConfig); - }; - /** - * Handle config changes. - * - * @returns {void} - */ - Tile.prototype.configChanged = function (isBootstrap) { - if (isBootstrap) { - return; - } - // Populate tile id into config object. - this.config.id = this.getId(); - }; - /** - * @hidden - * @returns {string} - */ - Tile.prototype.getDefaultEmbedUrlEndpoint = function () { - return "tileEmbed"; - }; - /** - * Adds the ability to get tileId from url. - * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. - * - * @hidden - * @static - * @param {string} url - * @returns {string} - */ - Tile.findIdFromEmbedUrl = function (url) { - var tileIdRegEx = /tileId="?([^&]+)"?/; - var tileIdMatch = url.match(tileIdRegEx); - var tileId; - if (tileIdMatch) { - tileId = tileIdMatch[1]; - } - return tileId; - }; - /** @hidden */ - Tile.type = "Tile"; - /** @hidden */ - Tile.allowedEvents = ["tileClicked", "tileLoaded"]; - return Tile; -}(embed.Embed)); -exports.Tile = Tile; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Tile = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts"); +/** + * The Power BI tile embed component + * + * @export + * @class Tile + * @extends {Embed} + */ +var Tile = /** @class */ (function (_super) { + __extends(Tile, _super); + /** + * @hidden + */ + function Tile(service, element, baseConfig, phasedRender, isBootstrap) { + var _this = this; + var config = baseConfig; + _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this; + _this.loadPath = "/tile/load"; + Array.prototype.push.apply(_this.allowedEvents, Tile.allowedEvents); + return _this; + } + /** + * The ID of the tile + * + * @returns {string} + */ + Tile.prototype.getId = function () { + var config = this.config; + var tileId = config.id || Tile.findIdFromEmbedUrl(this.config.embedUrl); + if (typeof tileId !== 'string' || tileId.length === 0) { + throw new Error("Tile id is required, but it was not found. You must provide an id either as part of embed configuration."); + } + return tileId; + }; + /** + * Validate load configuration. + */ + Tile.prototype.validate = function (config) { + var embedConfig = config; + return models.validateTileLoad(embedConfig); + }; + /** + * Handle config changes. + * + * @returns {void} + */ + Tile.prototype.configChanged = function (isBootstrap) { + if (isBootstrap) { + return; + } + // Populate tile id into config object. + this.config.id = this.getId(); + }; + /** + * @hidden + * @returns {string} + */ + Tile.prototype.getDefaultEmbedUrlEndpoint = function () { + return "tileEmbed"; + }; + /** + * Adds the ability to get tileId from url. + * By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration. + * + * @hidden + * @static + * @param {string} url + * @returns {string} + */ + Tile.findIdFromEmbedUrl = function (url) { + var tileIdRegEx = /tileId="?([^&]+)"?/; + var tileIdMatch = url.match(tileIdRegEx); + var tileId; + if (tileIdMatch) { + tileId = tileIdMatch[1]; + } + return tileId; + }; + /** @hidden */ + Tile.type = "Tile"; + /** @hidden */ + Tile.allowedEvents = ["tileClicked", "tileLoaded"]; + return Tile; +}(embed.Embed)); +exports.Tile = Tile; /***/ }), @@ -8824,261 +8827,261 @@ exports.Tile = Tile; /*! no static exports found */ /***/ (function(module, exports) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTimeDiffInMilliseconds = exports.getRandomValue = exports.autoAuthInEmbedUrl = exports.isRDLEmbed = exports.isSavedInternal = exports.addParamToUrl = exports.generateUUID = exports.createRandomString = exports.assign = exports.remove = exports.find = exports.findIndex = exports.raiseCustomEvent = void 0; -/** - * Raises a custom event with event data on the specified HTML element. - * - * @export - * @param {HTMLElement} element - * @param {string} eventName - * @param {*} eventData - */ -function raiseCustomEvent(element, eventName, eventData) { - var customEvent; - if (typeof CustomEvent === 'function') { - customEvent = new CustomEvent(eventName, { - detail: eventData, - bubbles: true, - cancelable: true - }); - } - else { - customEvent = document.createEvent('CustomEvent'); - customEvent.initCustomEvent(eventName, true, true, eventData); - } - element.dispatchEvent(customEvent); -} -exports.raiseCustomEvent = raiseCustomEvent; -/** - * Finds the index of the first value in an array that matches the specified predicate. - * - * @export - * @template T - * @param {(x: T) => boolean} predicate - * @param {T[]} xs - * @returns {number} - */ -function findIndex(predicate, xs) { - if (!Array.isArray(xs)) { - throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs); - } - var index; - xs.some(function (x, i) { - if (predicate(x)) { - index = i; - return true; - } - }); - return index; -} -exports.findIndex = findIndex; -/** - * Finds the first value in an array that matches the specified predicate. - * - * @export - * @template T - * @param {(x: T) => boolean} predicate - * @param {T[]} xs - * @returns {T} - */ -function find(predicate, xs) { - var index = findIndex(predicate, xs); - return xs[index]; -} -exports.find = find; -function remove(predicate, xs) { - var index = findIndex(predicate, xs); - xs.splice(index, 1); -} -exports.remove = remove; -// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign -// TODO: replace in favor of using polyfill -/** - * Copies the values of all enumerable properties from one or more source objects to a target object, and returns the target object. - * - * @export - * @param {any} args - * @returns - */ -function assign() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var target = args[0]; - 'use strict'; - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; -} -exports.assign = assign; -/** - * Generates a random 5 to 6 character string. - * - * @export - * @returns {string} - */ -function createRandomString() { - return getRandomValue().toString(36).substring(1); -} -exports.createRandomString = createRandomString; -/** - * Generates a 20 character uuid. - * - * @export - * @returns {string} - */ -function generateUUID() { - var d = new Date().getTime(); - if (typeof performance !== 'undefined' && typeof performance.now === 'function') { - d += performance.now(); - } - return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - // Generate a random number, scaled from 0 to 15. - var r = (getRandomValue() % 16); - // Shift 4 times to divide by 16 - d >>= 4; - return r.toString(16); - }); -} -exports.generateUUID = generateUUID; -/** - * Adds a parameter to the given url - * - * @export - * @param {string} url - * @param {string} paramName - * @param {string} value - * @returns {string} - */ -function addParamToUrl(url, paramName, value) { - var parameterPrefix = url.indexOf('?') > 0 ? '&' : '?'; - url += parameterPrefix + paramName + '=' + value; - return url; -} -exports.addParamToUrl = addParamToUrl; -/** - * Checks if the report is saved. - * - * @export - * @param {HttpPostMessage} hpm - * @param {string} uid - * @param {Window} contentWindow - * @returns {Promise} - */ -function isSavedInternal(hpm, uid, contentWindow) { - return __awaiter(this, void 0, void 0, function () { - var response, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, hpm.get('/report/hasUnsavedChanges', { uid: uid }, contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, !response.body]; - case 2: - response_1 = _a.sent(); - throw response_1.body; - case 3: return [2 /*return*/]; - } - }); - }); -} -exports.isSavedInternal = isSavedInternal; -/** - * Checks if the embed url is for RDL report. - * - * @export - * @param {string} embedUrl - * @returns {boolean} - */ -function isRDLEmbed(embedUrl) { - return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0; -} -exports.isRDLEmbed = isRDLEmbed; -/** - * Checks if the embed url contains autoAuth=true. - * - * @export - * @param {string} embedUrl - * @returns {boolean} - */ -function autoAuthInEmbedUrl(embedUrl) { - return embedUrl && decodeURIComponent(embedUrl).toLowerCase().indexOf("autoauth=true") >= 0; -} -exports.autoAuthInEmbedUrl = autoAuthInEmbedUrl; -/** - * Returns random number - */ -function getRandomValue() { - // window.msCrypto for IE - var cryptoObj = window.crypto || window.msCrypto; - var randomValueArray = new Uint32Array(1); - cryptoObj.getRandomValues(randomValueArray); - return randomValueArray[0]; -} -exports.getRandomValue = getRandomValue; -/** - * Returns the time interval between two dates in milliseconds - * @export - * @param {Date} start - * @param {Date} end - * @returns {number} - */ -function getTimeDiffInMilliseconds(start, end) { - return Math.abs(start.getTime() - end.getTime()); -} -exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getTimeDiffInMilliseconds = exports.getRandomValue = exports.autoAuthInEmbedUrl = exports.isRDLEmbed = exports.isSavedInternal = exports.addParamToUrl = exports.generateUUID = exports.createRandomString = exports.assign = exports.remove = exports.find = exports.findIndex = exports.raiseCustomEvent = void 0; +/** + * Raises a custom event with event data on the specified HTML element. + * + * @export + * @param {HTMLElement} element + * @param {string} eventName + * @param {*} eventData + */ +function raiseCustomEvent(element, eventName, eventData) { + var customEvent; + if (typeof CustomEvent === 'function') { + customEvent = new CustomEvent(eventName, { + detail: eventData, + bubbles: true, + cancelable: true + }); + } + else { + customEvent = document.createEvent('CustomEvent'); + customEvent.initCustomEvent(eventName, true, true, eventData); + } + element.dispatchEvent(customEvent); +} +exports.raiseCustomEvent = raiseCustomEvent; +/** + * Finds the index of the first value in an array that matches the specified predicate. + * + * @export + * @template T + * @param {(x: T) => boolean} predicate + * @param {T[]} xs + * @returns {number} + */ +function findIndex(predicate, xs) { + if (!Array.isArray(xs)) { + throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs); + } + var index; + xs.some(function (x, i) { + if (predicate(x)) { + index = i; + return true; + } + }); + return index; +} +exports.findIndex = findIndex; +/** + * Finds the first value in an array that matches the specified predicate. + * + * @export + * @template T + * @param {(x: T) => boolean} predicate + * @param {T[]} xs + * @returns {T} + */ +function find(predicate, xs) { + var index = findIndex(predicate, xs); + return xs[index]; +} +exports.find = find; +function remove(predicate, xs) { + var index = findIndex(predicate, xs); + xs.splice(index, 1); +} +exports.remove = remove; +// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign +// TODO: replace in favor of using polyfill +/** + * Copies the values of all enumerable properties from one or more source objects to a target object, and returns the target object. + * + * @export + * @param {any} args + * @returns + */ +function assign() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var target = args[0]; + 'use strict'; + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; +} +exports.assign = assign; +/** + * Generates a random 5 to 6 character string. + * + * @export + * @returns {string} + */ +function createRandomString() { + return getRandomValue().toString(36).substring(1); +} +exports.createRandomString = createRandomString; +/** + * Generates a 20 character uuid. + * + * @export + * @returns {string} + */ +function generateUUID() { + var d = new Date().getTime(); + if (typeof performance !== 'undefined' && typeof performance.now === 'function') { + d += performance.now(); + } + return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + // Generate a random number, scaled from 0 to 15. + var r = (getRandomValue() % 16); + // Shift 4 times to divide by 16 + d >>= 4; + return r.toString(16); + }); +} +exports.generateUUID = generateUUID; +/** + * Adds a parameter to the given url + * + * @export + * @param {string} url + * @param {string} paramName + * @param {string} value + * @returns {string} + */ +function addParamToUrl(url, paramName, value) { + var parameterPrefix = url.indexOf('?') > 0 ? '&' : '?'; + url += parameterPrefix + paramName + '=' + value; + return url; +} +exports.addParamToUrl = addParamToUrl; +/** + * Checks if the report is saved. + * + * @export + * @param {HttpPostMessage} hpm + * @param {string} uid + * @param {Window} contentWindow + * @returns {Promise} + */ +function isSavedInternal(hpm, uid, contentWindow) { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, hpm.get('/report/hasUnsavedChanges', { uid: uid }, contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, !response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); +} +exports.isSavedInternal = isSavedInternal; +/** + * Checks if the embed url is for RDL report. + * + * @export + * @param {string} embedUrl + * @returns {boolean} + */ +function isRDLEmbed(embedUrl) { + return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0; +} +exports.isRDLEmbed = isRDLEmbed; +/** + * Checks if the embed url contains autoAuth=true. + * + * @export + * @param {string} embedUrl + * @returns {boolean} + */ +function autoAuthInEmbedUrl(embedUrl) { + return embedUrl && decodeURIComponent(embedUrl).toLowerCase().indexOf("autoauth=true") >= 0; +} +exports.autoAuthInEmbedUrl = autoAuthInEmbedUrl; +/** + * Returns random number + */ +function getRandomValue() { + // window.msCrypto for IE + var cryptoObj = window.crypto || window.msCrypto; + var randomValueArray = new Uint32Array(1); + cryptoObj.getRandomValues(randomValueArray); + return randomValueArray[0]; +} +exports.getRandomValue = getRandomValue; +/** + * Returns the time interval between two dates in milliseconds + * @export + * @param {Date} start + * @param {Date} end + * @returns {number} + */ +function getTimeDiffInMilliseconds(start, end) { + return Math.abs(start.getTime() - end.getTime()); +} +exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; /***/ }), @@ -9090,323 +9093,323 @@ exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds; /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Visual = void 0; -var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); -var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); -var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); -/** - * The Power BI Visual embed component - * - * @export - * @class Visual - */ -var Visual = /** @class */ (function (_super) { - __extends(Visual, _super); - /** - * Creates an instance of a Power BI Single Visual. - * - * @param {service.Service} service - * @param {HTMLElement} element - * @param {embed.IEmbedConfiguration} config - * @hidden - */ - function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { - return _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe) || this; - } - /** - * @hidden - */ - Visual.prototype.load = function (phasedRender) { - var config = this.config; - if (!config.accessToken) { - // bootstrap flow. - return; - } - if (typeof config.pageName !== 'string' || config.pageName.length === 0) { - throw new Error("Page name is required when embedding a visual."); - } - if (typeof config.visualName !== 'string' || config.visualName.length === 0) { - throw new Error("Visual name is required, but it was not found. You must provide a visual name as part of embed configuration."); - } - // calculate custom layout settings and override config. - var width = config.width ? config.width : this.iframe.offsetWidth; - var height = config.height ? config.height : this.iframe.offsetHeight; - var pageSize = { - type: models.PageSizeType.Custom, - width: width, - height: height, - }; - var pagesLayout = {}; - pagesLayout[config.pageName] = { - defaultLayout: { - displayState: { - mode: models.VisualContainerDisplayMode.Hidden - } - }, - visualsLayout: {} - }; - pagesLayout[config.pageName].visualsLayout[config.visualName] = { - displayState: { - mode: models.VisualContainerDisplayMode.Visible - }, - x: 1, - y: 1, - z: 1, - width: pageSize.width, - height: pageSize.height - }; - config.settings = config.settings || {}; - config.settings.filterPaneEnabled = false; - config.settings.navContentPaneEnabled = false; - config.settings.layoutType = models.LayoutType.Custom; - config.settings.customLayout = { - displayOption: models.DisplayOption.FitToPage, - pageSize: pageSize, - pagesLayout: pagesLayout - }; - this.config = config; - return _super.prototype.load.call(this, phasedRender); - }; - /** - * Gets the list of pages within the report - not supported in visual embed. - * - * @returns {Promise} - */ - Visual.prototype.getPages = function () { - throw Visual.GetPagesNotSupportedError; - }; - /** - * Sets the active page of the report - not supported in visual embed. - * - * @param {string} pageName - * @returns {Promise>} - */ - Visual.prototype.setPage = function (pageName) { - throw Visual.SetPageNotSupportedError; - }; - /** - * Render a preloaded report, using phased embedding API - * - * @hidden - * @returns {Promise} - */ - Visual.prototype.render = function (config) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - throw Visual.RenderNotSupportedError; - }); - }); - }; - /** - * Gets the embedded visual descriptor object that contains the visual name, type, etc. - * - * ```javascript - * visual.getVisualDescriptor() - * .then(visualDetails => { ... }); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.getVisualDescriptor = function () { - return __awaiter(this, void 0, void 0, function () { - var config, response, embeddedVisuals, visualNotFoundError, embeddedVisual, currentPage, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - config = this.config; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); - if (embeddedVisuals.length === 0) { - visualNotFoundError = { - message: "visualNotFound", - detailedMessage: "Visual not found" - }; - throw visualNotFoundError; - } - embeddedVisual = embeddedVisuals[0]; - currentPage = this.page(config.pageName); - return [2 /*return*/, new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout)]; - case 3: - response_1 = _a.sent(); - throw response_1.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Gets filters that are applied to the filter level. - * Default filter level is visual level. - * - * ```javascript - * visual.getFilters(filtersLevel) - * .then(filters => { - * ... - * }); - * ``` - * - * @returns {Promise} - */ - Visual.prototype.getFilters = function (filtersLevel) { - return __awaiter(this, void 0, void 0, function () { - var url, response, response_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - url = this.getFiltersLevelUrl(filtersLevel); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_2 = _a.sent(); - throw response_2.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Sets filters at the filter level. - * Default filter level is visual level. - * - * ```javascript - * const filters: [ - * ... - * ]; - * - * visual.setFilters(filters, filtersLevel) - * .catch(errors => { - * ... - * }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise>} - */ - Visual.prototype.setFilters = function (filters, filtersLevel) { - return __awaiter(this, void 0, void 0, function () { - var url, response_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - url = this.getFiltersLevelUrl(filtersLevel); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; - case 2: return [2 /*return*/, _a.sent()]; - case 3: - response_3 = _a.sent(); - throw response_3.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Removes all filters from the current filter level. - * Default filter level is visual level. - * - * ```javascript - * visual.removeFilters(filtersLevel); - * ``` - * - * @returns {Promise>} - */ - Visual.prototype.removeFilters = function (filtersLevel) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.setFilters([], filtersLevel)]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * @hidden - */ - Visual.prototype.getFiltersLevelUrl = function (filtersLevel) { - var config = this.config; - switch (filtersLevel) { - case models.FiltersLevel.Report: - return "/report/filters"; - case models.FiltersLevel.Page: - return "/report/pages/" + config.pageName + "/filters"; - default: - return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters"; - } - }; - /** @hidden */ - Visual.type = "visual"; - /** @hidden */ - Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; - /** @hidden */ - Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; - /** @hidden */ - Visual.RenderNotSupportedError = "render is not supported while embedding a visual."; - return Visual; -}(report_1.Report)); -exports.Visual = Visual; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Visual = void 0; +var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js"); +var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts"); +var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts"); +/** + * The Power BI Visual embed component + * + * @export + * @class Visual + */ +var Visual = /** @class */ (function (_super) { + __extends(Visual, _super); + /** + * Creates an instance of a Power BI Single Visual. + * + * @param {service.Service} service + * @param {HTMLElement} element + * @param {embed.IEmbedConfiguration} config + * @hidden + */ + function Visual(service, element, baseConfig, phasedRender, isBootstrap, iframe) { + return _super.call(this, service, element, baseConfig, phasedRender, isBootstrap, iframe) || this; + } + /** + * @hidden + */ + Visual.prototype.load = function (phasedRender) { + var config = this.config; + if (!config.accessToken) { + // bootstrap flow. + return; + } + if (typeof config.pageName !== 'string' || config.pageName.length === 0) { + throw new Error("Page name is required when embedding a visual."); + } + if (typeof config.visualName !== 'string' || config.visualName.length === 0) { + throw new Error("Visual name is required, but it was not found. You must provide a visual name as part of embed configuration."); + } + // calculate custom layout settings and override config. + var width = config.width ? config.width : this.iframe.offsetWidth; + var height = config.height ? config.height : this.iframe.offsetHeight; + var pageSize = { + type: models.PageSizeType.Custom, + width: width, + height: height, + }; + var pagesLayout = {}; + pagesLayout[config.pageName] = { + defaultLayout: { + displayState: { + mode: models.VisualContainerDisplayMode.Hidden + } + }, + visualsLayout: {} + }; + pagesLayout[config.pageName].visualsLayout[config.visualName] = { + displayState: { + mode: models.VisualContainerDisplayMode.Visible + }, + x: 1, + y: 1, + z: 1, + width: pageSize.width, + height: pageSize.height + }; + config.settings = config.settings || {}; + config.settings.filterPaneEnabled = false; + config.settings.navContentPaneEnabled = false; + config.settings.layoutType = models.LayoutType.Custom; + config.settings.customLayout = { + displayOption: models.DisplayOption.FitToPage, + pageSize: pageSize, + pagesLayout: pagesLayout + }; + this.config = config; + return _super.prototype.load.call(this, phasedRender); + }; + /** + * Gets the list of pages within the report - not supported in visual embed. + * + * @returns {Promise} + */ + Visual.prototype.getPages = function () { + throw Visual.GetPagesNotSupportedError; + }; + /** + * Sets the active page of the report - not supported in visual embed. + * + * @param {string} pageName + * @returns {Promise>} + */ + Visual.prototype.setPage = function (pageName) { + throw Visual.SetPageNotSupportedError; + }; + /** + * Render a preloaded report, using phased embedding API + * + * @hidden + * @returns {Promise} + */ + Visual.prototype.render = function (config) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + throw Visual.RenderNotSupportedError; + }); + }); + }; + /** + * Gets the embedded visual descriptor object that contains the visual name, type, etc. + * + * ```javascript + * visual.getVisualDescriptor() + * .then(visualDetails => { ... }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getVisualDescriptor = function () { + return __awaiter(this, void 0, void 0, function () { + var config, response, embeddedVisuals, visualNotFoundError, embeddedVisual, currentPage, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + config = this.config; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; }); + if (embeddedVisuals.length === 0) { + visualNotFoundError = { + message: "visualNotFound", + detailedMessage: "Visual not found" + }; + throw visualNotFoundError; + } + embeddedVisual = embeddedVisuals[0]; + currentPage = this.page(config.pageName); + return [2 /*return*/, new visualDescriptor_1.VisualDescriptor(currentPage, embeddedVisual.name, embeddedVisual.title, embeddedVisual.type, embeddedVisual.layout)]; + case 3: + response_1 = _a.sent(); + throw response_1.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Gets filters that are applied to the filter level. + * Default filter level is visual level. + * + * ```javascript + * visual.getFilters(filtersLevel) + * .then(filters => { + * ... + * }); + * ``` + * + * @returns {Promise} + */ + Visual.prototype.getFilters = function (filtersLevel) { + return __awaiter(this, void 0, void 0, function () { + var url, response, response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + url = this.getFiltersLevelUrl(filtersLevel); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.get(url, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_2 = _a.sent(); + throw response_2.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sets filters at the filter level. + * Default filter level is visual level. + * + * ```javascript + * const filters: [ + * ... + * ]; + * + * visual.setFilters(filters, filtersLevel) + * .catch(errors => { + * ... + * }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + Visual.prototype.setFilters = function (filters, filtersLevel) { + return __awaiter(this, void 0, void 0, function () { + var url, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + url = this.getFiltersLevelUrl(filtersLevel); + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.service.hpm.put(url, filters, { uid: this.config.uniqueId }, this.iframe.contentWindow)]; + case 2: return [2 /*return*/, _a.sent()]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters from the current filter level. + * Default filter level is visual level. + * + * ```javascript + * visual.removeFilters(filtersLevel); + * ``` + * + * @returns {Promise>} + */ + Visual.prototype.removeFilters = function (filtersLevel) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.setFilters([], filtersLevel)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * @hidden + */ + Visual.prototype.getFiltersLevelUrl = function (filtersLevel) { + var config = this.config; + switch (filtersLevel) { + case models.FiltersLevel.Report: + return "/report/filters"; + case models.FiltersLevel.Page: + return "/report/pages/" + config.pageName + "/filters"; + default: + return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters"; + } + }; + /** @hidden */ + Visual.type = "visual"; + /** @hidden */ + Visual.GetPagesNotSupportedError = "Get pages is not supported while embedding a visual."; + /** @hidden */ + Visual.SetPageNotSupportedError = "Set page is not supported while embedding a visual."; + /** @hidden */ + Visual.RenderNotSupportedError = "render is not supported while embedding a visual."; + return Visual; +}(report_1.Report)); +exports.Visual = Visual; /***/ }), @@ -9418,286 +9421,286 @@ exports.Visual = Visual; /*! no static exports found */ /***/ (function(module, exports) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VisualDescriptor = void 0; -/** - * A Power BI visual within a page - * - * @export - * @class VisualDescriptor - * @implements {IVisualNode} - */ -var VisualDescriptor = /** @class */ (function () { - /** - * @hidden - */ - function VisualDescriptor(page, name, title, type, layout) { - this.name = name; - this.title = title; - this.type = type; - this.layout = layout; - this.page = page; - } - /** - * Gets all visual level filters of the current visual. - * - * ```javascript - * visual.getFilters() - * .then(filters => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.getFilters = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_1 = _a.sent(); - throw response_1.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Removes all filters from the current visual. - * - * ```javascript - * visual.removeFilters(); - * ``` - * - * @returns {Promise>} - */ - VisualDescriptor.prototype.removeFilters = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.setFilters([])]; - case 1: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; - /** - * Sets the filters on the current visual to 'filters'. - * - * ```javascript - * visual.setFilters(filters); - * .catch(errors => { ... }); - * ``` - * - * @param {(models.IFilter[])} filters - * @returns {Promise>} - */ - VisualDescriptor.prototype.setFilters = function (filters) { - return __awaiter(this, void 0, void 0, function () { - var response_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: - response_2 = _a.sent(); - throw response_2.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Exports Visual data. - * Can export up to 30K rows. - * @param rows: Optional. Default value is 30K, maximum value is 30K as well. - * @param exportDataType: Optional. Default is models.ExportDataType.Summarized. - * ```javascript - * visual.exportData() - * .then(data => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.exportData = function (exportDataType, rows) { - return __awaiter(this, void 0, void 0, function () { - var exportDataRequestBody, response, response_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - exportDataRequestBody = { - rows: rows, - exportDataType: exportDataType - }; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 2: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 3: - response_3 = _a.sent(); - throw response_3.body; - case 4: return [2 /*return*/]; - } - }); - }); - }; - /** - * Set slicer state. - * Works only for visuals of type slicer. - * @param state: A new state which contains the slicer filters. - * ```javascript - * visual.setSlicerState() - * .then(() => { ... }); - * ``` - */ - VisualDescriptor.prototype.setSlicerState = function (state) { - return __awaiter(this, void 0, void 0, function () { - var response_4; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: - response_4 = _a.sent(); - throw response_4.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Get slicer state. - * Works only for visuals of type slicer. - * - * ```javascript - * visual.getSlicerState() - * .then(state => { ... }); - * ``` - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.getSlicerState = function () { - return __awaiter(this, void 0, void 0, function () { - var response, response_5; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_5 = _a.sent(); - throw response_5.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Clone existing visual to a new instance. - * - * @returns {(Promise)} - */ - VisualDescriptor.prototype.clone = function (request) { - if (request === void 0) { request = {}; } - return __awaiter(this, void 0, void 0, function () { - var response, response_6; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 1: - response = _a.sent(); - return [2 /*return*/, response.body]; - case 2: - response_6 = _a.sent(); - throw response_6.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - /** - * Sort a visual by dataField and direction. - * - * @param request: Sort by visual request. - * - * ```javascript - * visual.sortBy(request) - * .then(() => { ... }); - * ``` - */ - VisualDescriptor.prototype.sortBy = function (request) { - return __awaiter(this, void 0, void 0, function () { - var response_7; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: - response_7 = _a.sent(); - throw response_7.body; - case 3: return [2 /*return*/]; - } - }); - }); - }; - return VisualDescriptor; -}()); -exports.VisualDescriptor = VisualDescriptor; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VisualDescriptor = void 0; +/** + * A Power BI visual within a page + * + * @export + * @class VisualDescriptor + * @implements {IVisualNode} + */ +var VisualDescriptor = /** @class */ (function () { + /** + * @hidden + */ + function VisualDescriptor(page, name, title, type, layout) { + this.name = name; + this.title = title; + this.type = type; + this.layout = layout; + this.page = page; + } + /** + * Gets all visual level filters of the current visual. + * + * ```javascript + * visual.getFilters() + * .then(filters => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.getFilters = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_1 = _a.sent(); + throw response_1.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Removes all filters from the current visual. + * + * ```javascript + * visual.removeFilters(); + * ``` + * + * @returns {Promise>} + */ + VisualDescriptor.prototype.removeFilters = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.setFilters([])]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + /** + * Sets the filters on the current visual to 'filters'. + * + * ```javascript + * visual.setFilters(filters); + * .catch(errors => { ... }); + * ``` + * + * @param {(models.IFilter[])} filters + * @returns {Promise>} + */ + VisualDescriptor.prototype.setFilters = function (filters) { + return __awaiter(this, void 0, void 0, function () { + var response_2; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_2 = _a.sent(); + throw response_2.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Exports Visual data. + * Can export up to 30K rows. + * @param rows: Optional. Default value is 30K, maximum value is 30K as well. + * @param exportDataType: Optional. Default is models.ExportDataType.Summarized. + * ```javascript + * visual.exportData() + * .then(data => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.exportData = function (exportDataType, rows) { + return __awaiter(this, void 0, void 0, function () { + var exportDataRequestBody, response, response_3; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + exportDataRequestBody = { + rows: rows, + exportDataType: exportDataType + }; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 2: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 3: + response_3 = _a.sent(); + throw response_3.body; + case 4: return [2 /*return*/]; + } + }); + }); + }; + /** + * Set slicer state. + * Works only for visuals of type slicer. + * @param state: A new state which contains the slicer filters. + * ```javascript + * visual.setSlicerState() + * .then(() => { ... }); + * ``` + */ + VisualDescriptor.prototype.setSlicerState = function (state) { + return __awaiter(this, void 0, void 0, function () { + var response_4; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_4 = _a.sent(); + throw response_4.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Get slicer state. + * Works only for visuals of type slicer. + * + * ```javascript + * visual.getSlicerState() + * .then(state => { ... }); + * ``` + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.getSlicerState = function () { + return __awaiter(this, void 0, void 0, function () { + var response, response_5; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_5 = _a.sent(); + throw response_5.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Clone existing visual to a new instance. + * + * @returns {(Promise)} + */ + VisualDescriptor.prototype.clone = function (request) { + if (request === void 0) { request = {}; } + return __awaiter(this, void 0, void 0, function () { + var response, response_6; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: + response = _a.sent(); + return [2 /*return*/, response.body]; + case 2: + response_6 = _a.sent(); + throw response_6.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + /** + * Sort a visual by dataField and direction. + * + * @param request: Sort by visual request. + * + * ```javascript + * visual.sortBy(request) + * .then(() => { ... }); + * ``` + */ + VisualDescriptor.prototype.sortBy = function (request) { + return __awaiter(this, void 0, void 0, function () { + var response_7; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + response_7 = _a.sent(); + throw response_7.body; + case 3: return [2 /*return*/]; + } + }); + }); + }; + return VisualDescriptor; +}()); +exports.VisualDescriptor = VisualDescriptor; /***/ }) diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index ef01eb03..34d7d125 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,7 +1,7 @@ -/*! powerbi-client v2.16.3 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.4 | (c) 2016 Microsoft Corporation MIT */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,(function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=12)}([function(t,e,r){ /*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ -var a;window,a=function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var o,n=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(o=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var l=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=l;var s=function(t){function e(r,a,i){var n=t.call(this,r,o.Unknown)||this;return n.message=a,n.notSupportedTypeName=i,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(l);e.NotSupportedFilter=s;var d=function(t){function e(r,a,i){var n=t.call(this,r,o.IncludeExclude)||this;return n.values=i,n.isExclude=a,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(l);e.IncludeExcludeFilter=d;var u=function(t){function e(r,a,i,n){var l=t.call(this,r,o.TopN)||this;return l.operator=a,l.itemCount=i,l.schemaUrl=e.schemaUrl,l.orderBy=n,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(l);e.TopNFilter=u;var c=function(t){function e(r,a,i,n,l){var s=t.call(this,r,o.RelativeDate)||this;return s.operator=a,s.timeUnitsCount=i,s.timeUnitType=n,s.includeToday=l,s.schemaUrl=e.schemaUrl,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(l);e.RelativeDateFilter=c;var p=function(t){function e(r,a,i,n){var l=t.call(this,r,o.RelativeTime)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=n,l.schemaUrl=e.schemaUrl,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(l);e.RelativeTimeFilter=p;var f=function(t){function e(r,a){for(var i=[],n=2;n0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] Date: Wed, 30 Dec 2020 11:36:04 +0000 Subject: [PATCH 22/23] Merged PR 136337: 2.16.5 Use 1.7.1 models version Use explicit version --- dist/powerbi-client.d.ts | 2 +- dist/powerbi.js | 8 ++++---- dist/powerbi.min.js | 6 +++--- package.json | 4 ++-- src/config.ts | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts index c8a29da1..212fba02 100644 --- a/dist/powerbi-client.d.ts +++ b/dist/powerbi-client.d.ts @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.4 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.5 | (c) 2016 Microsoft Corporation MIT */ declare module "util" { import { HttpPostMessage } from 'http-post-message'; /** diff --git a/dist/powerbi.js b/dist/powerbi.js index 041303e1..e8d4f430 100644 --- a/dist/powerbi.js +++ b/dist/powerbi.js @@ -1,4 +1,4 @@ -/*! powerbi-client v2.16.4 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.5 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -288,12 +288,12 @@ return /******/ (function(modules) { // webpackBootstrap /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-models v1.7.1 | (c) 2016 Microsoft Corporation MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else {} -})(window, function() { +})(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -5864,7 +5864,7 @@ exports.BookmarksManager = BookmarksManager; Object.defineProperty(exports, "__esModule", { value: true }); /** @ignore */ /** */ var config = { - version: '2.16.4', + version: '2.16.5', type: 'js' }; exports.default = config; diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js index 34d7d125..7c107024 100644 --- a/dist/powerbi.min.js +++ b/dist/powerbi.min.js @@ -1,7 +1,7 @@ -/*! powerbi-client v2.16.4 | (c) 2016 Microsoft Corporation MIT */ +/*! powerbi-client v2.16.5 | (c) 2016 Microsoft Corporation MIT */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,(function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=12)}([function(t,e,r){ -/*! powerbi-models v1.7.0 | (c) 2016 Microsoft Corporation MIT */ -var a;window,a=function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var o,n=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(o=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var l=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=l;var s=function(t){function e(r,a,i){var n=t.call(this,r,o.Unknown)||this;return n.message=a,n.notSupportedTypeName=i,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(l);e.NotSupportedFilter=s;var d=function(t){function e(r,a,i){var n=t.call(this,r,o.IncludeExclude)||this;return n.values=i,n.isExclude=a,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(l);e.IncludeExcludeFilter=d;var u=function(t){function e(r,a,i,n){var l=t.call(this,r,o.TopN)||this;return l.operator=a,l.itemCount=i,l.schemaUrl=e.schemaUrl,l.orderBy=n,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(l);e.TopNFilter=u;var c=function(t){function e(r,a,i,n,l){var s=t.call(this,r,o.RelativeDate)||this;return s.operator=a,s.timeUnitsCount=i,s.timeUnitType=n,s.includeToday=l,s.schemaUrl=e.schemaUrl,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(l);e.RelativeDateFilter=c;var p=function(t){function e(r,a,i,n){var l=t.call(this,r,o.RelativeTime)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=n,l.schemaUrl=e.schemaUrl,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(l);e.RelativeTimeFilter=p;var f=function(t){function e(r,a){for(var i=[],n=2;n0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filtersValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),k=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new k.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new k.StringValidator,new k.NumberValidator,new k.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new k.EnumValidator([0,1]),basicFilterTypeValidator:new k.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new k.BooleanArrayValidator,booleanValidator:new k.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new k.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new k.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new k.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new k.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new k.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new k.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new k.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new k.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterConditionsValidator:new k.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filtersArrayValidator:new k.ArrayValidator([new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.RelativeDateFilterValidator,new c.RelativeTimeFilterValidator])]),filtersValidator:new c.FilterValidator,filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new k.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new k.EnumValidator([3]),layoutTypeValidator:new k.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new k.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new k.EnumValidator([0,1]),notSupportedFilterTypeValidator:new k.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new k.NumberArrayValidator,numberValidator:new k.NumberValidator,pageLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new k.EnumValidator([0,1]),pageSizeTypeValidator:new k.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new k.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new k.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new k.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new k.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new k.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new k.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new k.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new k.StringArrayValidator,stringValidator:new k.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new k.EnumValidator([0,1]),topNFilterTypeValidator:new k.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,viewModeValidator:new k.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new k.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1] Date: Wed, 13 Jan 2021 10:04:59 +0200 Subject: [PATCH 23/23] fix merge issues --- package.json | 1 - test/test.spec.ts | 88 ++++++++--------------------------------------- 2 files changed, 14 insertions(+), 75 deletions(-) diff --git a/package.json b/package.json index 08ef3c18..fc04a75d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "build": "gulp build", "start": "http-server ./demo", "prestart": "cd demo && npm install", - "pretest": "typings install && gulp build", "test": "gulp test", "gulp": "gulp" }, diff --git a/test/test.spec.ts b/test/test.spec.ts index 259708ad..c1a14dd3 100644 --- a/test/test.spec.ts +++ b/test/test.spec.ts @@ -79,84 +79,24 @@ describe('service', function () { }); describe('init', function () { - describe('embeds all components found in the DOM', function () { - let powerbi: service.Service; // redefined for this scope - - beforeEach(function() { - powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory); - powerbi.accessToken = 'ABC123'; - }); - - afterEach(function () { - powerbi.wpmp.stop(); - powerbi = null; - }); - - it('should work with multiple elements without id', function () { - // Arrange - const elements = [ - '
', - '
', - ]; - - elements.forEach(element => { - $(element).appendTo('#powerbi-fixture'); - }); - - // Act - powerbi.init(); - - // Assert - // If embed element has iframe inside it, assume embed action occurred - const iframes = document.querySelectorAll('[powerbi-embed-url] iframe'); - expect(iframes.length).toEqual(2); - // Check the number of components controlled by powerbi - expect(powerbi.getNumberOfComponents()).toEqual(2); - }); - - it('should work with multiple elements with id', function () { - // Arrange - const elements = [ - '
', - '
', - ]; - - elements.forEach(element => { - $(element).appendTo('#powerbi-fixture'); - }); - - // Act - powerbi.init(); + it('embeds all components found in the DOM', function () { + // Arrange + const elements = [ + '
', + '
', + ]; - // Assert - // If embed element has iframe inside it, assume embed action occurred - const iframes = document.querySelectorAll('[powerbi-embed-url] iframe'); - expect(iframes.length).toEqual(2); - // Check the number of components controlled by powerbi - expect(powerbi.getNumberOfComponents()).toEqual(2); + elements.forEach(element => { + $(element).appendTo('#powerbi-fixture'); }); - it('should work with multiple elements with duplicated id', function () { - // Arrange - const elements = [ - '
', - '
', - ]; - - elements.forEach(element => { - $(element).appendTo('#powerbi-fixture'); - }); - - // Act - powerbi.init(); + // Act + powerbi.init(); - // Assert - // If embed element has iframe inside it, assume embed action occurred - const iframes = document.querySelectorAll('[powerbi-embed-url] iframe'); - expect(iframes.length).toEqual(2); - // Check the number of components controlled by powerbi - expect(powerbi.getNumberOfComponents()).toEqual(2); - }); + // Assert + // If embed element has iframe inside it, assume embed action occurred + const iframes = document.querySelectorAll('[powerbi-embed-url] iframe'); + expect(iframes.length).toEqual(2); }); it('embeds all components found in the DOM without id attribute', function () {