@mindline/sync 1.0.85 → 1.0.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,5 +2,6 @@
2
2
  "ExpandedNodes": [
3
3
  ""
4
4
  ],
5
+ "SelectedNode": "\\package.json",
5
6
  "PreviewInSolutionExplorer": false
6
7
  }
package/.vs/slnx.sqlite CHANGED
Binary file
Binary file
@@ -3,20 +3,8 @@
3
3
  "WorkspaceRootPath": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\",
4
4
  "Documents": [
5
5
  {
6
- "AbsoluteMoniker": "D:1:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
7
- "RelativeMoniker": "D:1:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
8
- },
9
- {
10
- "AbsoluteMoniker": "D:2:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
11
- "RelativeMoniker": "D:2:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
12
- },
13
- {
14
- "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
15
- "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.d.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
16
- },
17
- {
18
- "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}",
19
- "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:hybridspa.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
6
+ "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
7
+ "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
20
8
  }
21
9
  ],
22
10
  "DocumentGroupContainers": [
@@ -26,7 +14,7 @@
26
14
  "DocumentGroups": [
27
15
  {
28
16
  "DockedWidth": 200,
29
- "SelectedChildIndex": -1,
17
+ "SelectedChildIndex": 9,
30
18
  "Children": [
31
19
  {
32
20
  "$type": "Bookmark",
@@ -59,75 +47,28 @@
59
47
  {
60
48
  "$type": "Bookmark",
61
49
  "Name": "ST:1:0:{d212f56b-c48a-434c-a121-1c5d80b59b9f}"
62
- }
63
- ]
64
- },
65
- {
66
- "DockedWidth": 168,
67
- "SelectedChildIndex": 1,
68
- "Children": [
69
- {
70
- "$type": "Document",
71
- "DocumentIndex": 2,
72
- "Title": "index.d.ts",
73
- "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
74
- "RelativeDocumentMoniker": "index.d.ts",
75
- "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
76
- "RelativeToolTip": "index.d.ts",
77
- "ViewState": "AQIAABoAAAAAAAAAAAAAABoAAAAoAAAA",
78
- "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
79
- "WhenOpened": "2025-01-29T23:22:53.18Z",
80
- "EditorCaption": ""
81
50
  },
82
51
  {
83
- "$type": "Document",
84
- "DocumentIndex": 1,
85
- "Title": "index.ts",
86
- "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
87
- "RelativeDocumentMoniker": "index.ts",
88
- "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
89
- "RelativeToolTip": "index.ts",
90
- "ViewState": "AQIAAOIIAAAAAAAAAAAAAOcIAAAAAAAA",
91
- "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
92
- "WhenOpened": "2025-01-29T23:46:37.773Z",
93
- "EditorCaption": ""
94
- }
95
- ]
96
- },
97
- {
98
- "DockedWidth": 232,
99
- "SelectedChildIndex": 1,
100
- "Children": [
101
- {
102
- "$type": "Document",
103
- "DocumentIndex": 3,
104
- "Title": "hybridspa.ts",
105
- "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
106
- "RelativeDocumentMoniker": "hybridspa.ts",
107
- "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
108
- "RelativeToolTip": "hybridspa.ts",
109
- "ViewState": "AQIAAAAAAAAAAAAAAAAAABQAAAAXAAAA",
110
- "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
111
- "WhenOpened": "2024-11-04T14:16:26.493Z",
112
- "EditorCaption": ""
52
+ "$type": "Bookmark",
53
+ "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
113
54
  },
114
55
  {
115
56
  "$type": "Document",
116
57
  "DocumentIndex": 0,
117
- "Title": "index.ts",
118
- "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
119
- "RelativeDocumentMoniker": "index.ts",
120
- "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
121
- "RelativeToolTip": "index.ts",
122
- "ViewState": "AQIAAL0HAAAAAAAAAADgv9sHAAA1AAAA",
123
- "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
124
- "WhenOpened": "2025-01-29T14:51:05.763Z",
58
+ "Title": "package.json",
59
+ "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
60
+ "RelativeDocumentMoniker": "package.json",
61
+ "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
62
+ "RelativeToolTip": "package.json",
63
+ "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
64
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
65
+ "WhenOpened": "2025-03-30T14:35:19.537Z",
125
66
  "EditorCaption": ""
126
67
  }
127
68
  ]
128
69
  },
129
70
  {
130
- "DockedWidth": 294,
71
+ "DockedWidth": 254,
131
72
  "SelectedChildIndex": -1,
132
73
  "Children": [
133
74
  {
@@ -137,7 +78,7 @@
137
78
  ]
138
79
  },
139
80
  {
140
- "DockedWidth": 294,
81
+ "DockedWidth": 200,
141
82
  "SelectedChildIndex": -1,
142
83
  "Children": [
143
84
  {
package/index.d.ts CHANGED
@@ -331,6 +331,7 @@ declare module "@mindline/sync" {
331
331
  export function userAdd(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
332
332
  export function userRemove(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
333
333
  export function workspaceEdit(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, workspaceName: string): Promise<APIResult>;
334
+ export function getPowerBIAccessToken(instance: IPublicClientApplication, user: User): Promise<string>;
334
335
  // ======================= Azure REST API ===============================
335
336
  export function canListRootAssignments(instance: IPublicClientApplication, user: User): Promise<boolean>;
336
337
  export function elevateGlobalAdminToUserAccessAdmin(instance: IPublicClientApplication, user: User): Promise<boolean>;
package/index.ts CHANGED
@@ -2319,6 +2319,38 @@ async function workspaceInfoGet(instance: IPublicClientApplication, user: User,
2319
2319
  result.status = 500;
2320
2320
  return result;
2321
2321
  }
2322
+ // ======================= PowerBI Access Token Retrieval ===============================
2323
+ export async function getPowerBIAccessToken(
2324
+ instance: IPublicClientApplication,
2325
+ user: User
2326
+ ): Promise<string> {
2327
+ let accesstoken: string = "";
2328
+ // retrieve access token silently
2329
+ try {
2330
+ let accounts: AccountInfo[] = instance.getAllAccounts();
2331
+ let homeAccountId = user.oid + "." + user.tid;
2332
+ let account: AccountInfo = null;
2333
+ for (let i: number = 0; i < accounts.length; i++) {
2334
+ if (accounts[i].homeAccountId == homeAccountId) {
2335
+ account = accounts[i];
2336
+ }
2337
+ }
2338
+ let response: AuthenticationResult = await instance.acquireTokenSilent({
2339
+ scopes: ["https://analysis.windows.net/powerbi/api/App.Read.All",
2340
+ "https://analysis.windows.net/powerbi/api/Dataset.ReadWrite.All",
2341
+ "https://analysis.windows.net/powerbi/api/Report.ReadWrite.All",
2342
+ "https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All"
2343
+ ],
2344
+ account: account
2345
+ });
2346
+ accesstoken = response.accessToken; // cache access token
2347
+ console.log("PowerBI token acquired silently: " + accesstoken.slice(0, 20));
2348
+ }
2349
+ catch (error: any) {
2350
+ console.log("PowerBI token failed to be acquired silently");
2351
+ }
2352
+ return accesstoken;
2353
+ }
2322
2354
  // ======================= Azure REST API ===============================
2323
2355
  // TODO: this is where you want to trigger a re-authentication if token expires
2324
2356
  async function azureDefineHeaders(
@@ -2339,7 +2371,6 @@ async function azureDefineHeaders(
2339
2371
  account = accounts[i];
2340
2372
  }
2341
2373
  }
2342
- debugger;
2343
2374
  let response: AuthenticationResult = await instance.acquireTokenSilent({
2344
2375
  scopes: ["https://management.azure.com/user_impersonation"],
2345
2376
  account: account
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.85",
4
+ "version": "1.0.87",
5
5
  "types": "index.d.ts",
6
6
  "exports": "./index.ts",
7
7
  "description": "sync is a node.js package encapsulating javscript classes required for configuring Mindline sync service.",