Skip to content

Commit a6766a5

Browse files
committed
Merge remote-tracking branch 'powerbi/master'
2 parents 6fd9b08 + c9f57cc commit a6766a5

File tree

4 files changed

+58
-22
lines changed

4 files changed

+58
-22
lines changed

dist/powerbi-client.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ declare module "util" {
4545
* @returns {string}
4646
*/
4747
export function createRandomString(): string;
48+
/**
49+
* Generates a 20 charachter uuid.
50+
*
51+
* @export
52+
* @returns {string}
53+
*/
54+
export function generateUUID(): string;
4855
/**
4956
* Adds a parameter to the given url
5057
*
@@ -1245,6 +1252,7 @@ declare module "service" {
12451252
/** TODO: Look for way to make wpmp private. This is only public to allow stopping the wpmp in tests */
12461253
wpmp: wpmp.WindowPostMessageProxy;
12471254
private router;
1255+
private uniqueSessionId;
12481256
private static DefaultInitEmbedUrl;
12491257
/**
12501258
* Creates an instance of a Power BI Service.
@@ -1293,6 +1301,7 @@ declare module "service" {
12931301
load(element: HTMLElement, config?: embed.IEmbedConfigurationBase): embed.Embed;
12941302
embedInternal(element: HTMLElement, config?: embed.IEmbedConfigurationBase, phasedRender?: boolean): embed.Embed;
12951303
getNumberOfComponents(): number;
1304+
getSdkSessionId(): string;
12961305
/**
12971306
* Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup.
12981307
*

dist/powerbi.js

Lines changed: 33 additions & 8 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: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test.spec.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,6 +2446,7 @@ describe('SDK-to-HPM', function () {
24462446
let page1: page.Page;
24472447
let visual1: visualDescriptor.VisualDescriptor;
24482448
let uniqueId = 'uniqueId';
2449+
let sdkSessionId = 'sdkSessionId';
24492450
let createUniqueId = 'uniqueId';
24502451
let dashboardUniqueId = 'uniqueId';
24512452
let visualUniqueId = 'uniqueId';
@@ -2513,6 +2514,7 @@ describe('SDK-to-HPM', function () {
25132514
page1 = new page.Page(report, 'xyz');
25142515
visual1 = new visualDescriptor.VisualDescriptor(page1, 'uvw', 'title', 'type', {});
25152516
uniqueId = report.config.uniqueId;
2517+
sdkSessionId = powerbi.getSdkSessionId();
25162518
createUniqueId = create.config.uniqueId;
25172519
dashboardUniqueId = dashboard.config.uniqueId;
25182520
visualUniqueId = embeddedVisual.config.uniqueId;
@@ -2567,7 +2569,7 @@ describe('SDK-to-HPM', function () {
25672569
report.load(testData.loadConfiguration);
25682570

25692571
// Assert
2570-
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', testData.loadConfiguration, { uid: uniqueId }, iframe.contentWindow);
2572+
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', testData.loadConfiguration, { uid: uniqueId, sdkSessionId: sdkSessionId }, iframe.contentWindow);
25712573
});
25722574

25732575
it('report.load() returns promise that rejects with validation error if the load configuration is invalid', function (done) {
@@ -2589,7 +2591,7 @@ describe('SDK-to-HPM', function () {
25892591
// Act
25902592
report.load(testData.loadConfiguration)
25912593
.catch(error => {
2592-
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', testData.loadConfiguration, { uid: uniqueId }, iframe.contentWindow);
2594+
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', testData.loadConfiguration, { uid: uniqueId, sdkSessionId: sdkSessionId }, iframe.contentWindow);
25932595
expect(error).toEqual(testData.errorResponse.body);
25942596
// Assert
25952597
done();
@@ -2613,7 +2615,7 @@ describe('SDK-to-HPM', function () {
26132615
// Act
26142616
report.load(testData.loadConfiguration)
26152617
.then(response => {
2616-
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', testData.loadConfiguration, { uid: uniqueId }, iframe.contentWindow);
2618+
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', testData.loadConfiguration, { uid: uniqueId, sdkSessionId: sdkSessionId }, iframe.contentWindow);
26172619
expect(response).toEqual(null);
26182620
// Assert
26192621
done();
@@ -2709,7 +2711,7 @@ describe('SDK-to-HPM', function () {
27092711
let spyArgs = spyHpm.post.calls.mostRecent().args;
27102712
expect(spyArgs[0]).toEqual('/report/load');
27112713
expect(spyArgs[1]).toEqual(expectedConfiguration);
2712-
expect(spyArgs[2]).toEqual({ uid: visualUniqueId });
2714+
expect(spyArgs[2]).toEqual({ uid: visualUniqueId, sdkSessionId: sdkSessionId });
27132715
expect(spyArgs[3]).toEqual(visualFrame.contentWindow);
27142716
});
27152717

@@ -3167,7 +3169,7 @@ describe('SDK-to-HPM', function () {
31673169
report.reload();
31683170

31693171
// Assert
3170-
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', jasmine.objectContaining(testData.loadConfiguration), { uid: uniqueId }, iframe.contentWindow);
3172+
expect(spyHpm.post).toHaveBeenCalledWith('/report/load', jasmine.objectContaining(testData.loadConfiguration), { uid: uniqueId, sdkSessionId: sdkSessionId }, iframe.contentWindow);
31713173
});
31723174
});
31733175
});
@@ -3274,7 +3276,7 @@ describe('SDK-to-HPM', function () {
32743276
create.createReport(testData.createConfiguration);
32753277

32763278
// Assert
3277-
expect(spyHpm.post).toHaveBeenCalledWith('/report/create', testData.createConfiguration, { uid: createUniqueId }, createIframe.contentWindow);
3279+
expect(spyHpm.post).toHaveBeenCalledWith('/report/create', testData.createConfiguration, { uid: createUniqueId, sdkSessionId: sdkSessionId }, createIframe.contentWindow);
32783280
});
32793281

32803282
it('create.createReport() returns promise that rejects with validation error if the create configuration is invalid', function (done) {
@@ -3296,7 +3298,7 @@ describe('SDK-to-HPM', function () {
32963298
// Act
32973299
create.createReport(testData.createConfiguration)
32983300
.catch(error => {
3299-
expect(spyHpm.post).toHaveBeenCalledWith('/report/create', testData.createConfiguration, { uid: createUniqueId }, createIframe.contentWindow);
3301+
expect(spyHpm.post).toHaveBeenCalledWith('/report/create', testData.createConfiguration, { uid: createUniqueId, sdkSessionId: sdkSessionId }, createIframe.contentWindow);
33003302
expect(error).toEqual(testData.errorResponse.body);
33013303
// Assert
33023304
done();
@@ -3320,7 +3322,7 @@ describe('SDK-to-HPM', function () {
33203322
// Act
33213323
create.createReport(testData.createConfiguration)
33223324
.then(response => {
3323-
expect(spyHpm.post).toHaveBeenCalledWith('/report/create', testData.createConfiguration, { uid: createUniqueId }, createIframe.contentWindow);
3325+
expect(spyHpm.post).toHaveBeenCalledWith('/report/create', testData.createConfiguration, { uid: createUniqueId, sdkSessionId: sdkSessionId }, createIframe.contentWindow);
33243326
expect(response).toEqual(null);
33253327
// Assert
33263328
done();
@@ -3350,7 +3352,7 @@ describe('SDK-to-HPM', function () {
33503352
dashboard.load(testData.loadConfiguration);
33513353

33523354
// Assert
3353-
expect(spyHpm.post).toHaveBeenCalledWith('/dashboard/load', testData.loadConfiguration, { uid: dashboardUniqueId }, dashboardIframe.contentWindow);
3355+
expect(spyHpm.post).toHaveBeenCalledWith('/dashboard/load', testData.loadConfiguration, { uid: dashboardUniqueId, sdkSessionId: sdkSessionId }, dashboardIframe.contentWindow);
33543356
});
33553357
});
33563358
});

0 commit comments

Comments
 (0)