Skip to content

Commit b7a2fac

Browse files
author
Shahak Yosef
committed
Merged PR 229864: Release version 2.19.1 - Scrub config
Remove `accessToken` from the config when throwing an exception. ### Notes for reviewers - Spread operator seems to be [well supported](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax), doesn't work in IE however it was transplied to `__assign` in JS Code - I can't put it in `utils.ts` because that would create a circular dependency (with `embed.ts` due to type imports).
1 parent 9f9e39e commit b7a2fac

File tree

7 files changed

+75
-59
lines changed

7 files changed

+75
-59
lines changed

dist/powerbi-client.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// powerbi-client v2.19.0
1+
// powerbi-client v2.19.1
22
// Copyright (c) Microsoft Corporation.
33
// Licensed under the MIT License.
44
declare module "config" {
@@ -191,11 +191,11 @@ declare module "embed" {
191191
*/
192192
eventHandlers: IInternalEventHandler<any>[];
193193
/**
194-
* Gets or sets the eventHooks.
195-
*
196-
* @type {models.EventHooks}
197-
* @hidden
198-
*/
194+
* Gets or sets the eventHooks.
195+
*
196+
* @type {models.EventHooks}
197+
* @hidden
198+
*/
199199
eventHooks: models.EventHooks;
200200
/**
201201
* Gets or sets the Power BI embed service.

dist/powerbi.js

Lines changed: 54 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "powerbi-client",
3-
"version": "2.19.0",
3+
"version": "2.19.1",
44
"description": "JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and responding to data selection.",
55
"main": "dist/powerbi.js",
66
"types": "dist/powerbi-client.d.ts",

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/** @ignore *//** */
55
const config = {
6-
version: '2.19.0',
6+
version: '2.19.1',
77
type: 'js'
88
};
99

src/embed.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ export abstract class Embed {
109109
eventHandlers: IInternalEventHandler<any>[];
110110

111111
/**
112-
* Gets or sets the eventHooks.
113-
*
114-
* @type {models.EventHooks}
115-
* @hidden
116-
*/
112+
* Gets or sets the eventHooks.
113+
*
114+
* @type {models.EventHooks}
115+
* @hidden
116+
*/
117117
eventHooks: models.EventHooks;
118118

119119
/**

src/service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ export class Service implements IService {
399399
private embedNew(element: IPowerBiElement, config: IComponentEmbedConfiguration | IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): Embed {
400400
const componentType = config.type || element.getAttribute(Embed.typeAttribute);
401401
if (!componentType) {
402-
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.typeAttribute}="${Report.type.toLowerCase()}"'.`);
402+
const scrubbedConfig = { ...config, accessToken: "" };
403+
throw new Error(`Attempted to embed using config ${JSON.stringify(scrubbedConfig)} 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.typeAttribute}="${Report.type.toLowerCase()}"'.`);
403404
}
404405

405406
// Saves the type as part of the configuration so that it can be referenced later at a known location.
@@ -429,7 +430,8 @@ export class Service implements IService {
429430
private embedExisting(element: IPowerBiElement, config: IComponentEmbedConfiguration | IEmbedConfigurationBase, phasedRender?: boolean): Embed {
430431
const component = utils.find((x) => x.element === element, this.embeds);
431432
if (!component) {
432-
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.`);
433+
const scrubbedConfig = { ...config, accessToken: "" };
434+
throw new Error(`Attempted to embed using config ${JSON.stringify(scrubbedConfig)} 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.`);
433435
}
434436

435437
// TODO: Multiple embedding to the same iframe is not supported in QnA
@@ -457,8 +459,8 @@ export class Service implements IService {
457459

458460
return report;
459461
}
460-
461-
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}`);
462+
const scrubbedConfig = { ...config, accessToken: "" };
463+
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(scrubbedConfig)} 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}`);
462464
}
463465

464466
component.populateConfig(config, /* isBootstrap */ false);

0 commit comments

Comments
 (0)