@mindline/sync 1.0.79 → 1.0.82

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,20 @@
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}"
6
+ "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}",
7
+ "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:hybridspa.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
8
8
  },
9
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}"
10
+ "AbsoluteMoniker": "D:0: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:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
12
12
  },
13
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}"
14
+ "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}",
15
+ "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
16
16
  },
17
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}"
18
+ "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\users.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
19
+ "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:users.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
20
20
  }
21
21
  ],
22
22
  "DocumentGroupContainers": [
@@ -64,51 +64,46 @@
64
64
  },
65
65
  {
66
66
  "DockedWidth": 200,
67
- "SelectedChildIndex": 1,
67
+ "SelectedChildIndex": 2,
68
68
  "Children": [
69
+ {
70
+ "$type": "Document",
71
+ "DocumentIndex": 2,
72
+ "Title": "package.json",
73
+ "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
74
+ "RelativeDocumentMoniker": "package.json",
75
+ "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
76
+ "RelativeToolTip": "package.json",
77
+ "ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
78
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
79
+ "WhenOpened": "2024-11-06T06:24:37.385Z",
80
+ "EditorCaption": ""
81
+ },
69
82
  {
70
83
  "$type": "Document",
71
84
  "DocumentIndex": 3,
85
+ "Title": "users.json",
86
+ "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\users.json",
87
+ "RelativeDocumentMoniker": "users.json",
88
+ "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\users.json",
89
+ "RelativeToolTip": "users.json",
90
+ "ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAASAAAA",
91
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
92
+ "WhenOpened": "2024-11-05T22:57:19.003Z"
93
+ },
94
+ {
95
+ "$type": "Document",
96
+ "DocumentIndex": 0,
72
97
  "Title": "hybridspa.ts",
73
98
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
74
99
  "RelativeDocumentMoniker": "hybridspa.ts",
75
100
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
76
101
  "RelativeToolTip": "hybridspa.ts",
77
- "ViewState": "AQIAAFwAAAAAAAAAAADwv14AAAAhAAAA",
102
+ "ViewState": "AQIAABwAAAAAAAAAAAAAABwAAAAUAAAA",
78
103
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
79
- "WhenOpened": "2024-05-28T14:16:49.61Z"
80
- },
81
- {
82
- "$type": "Document",
83
- "DocumentIndex": 0,
84
- "Title": "index.ts",
85
- "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
86
- "RelativeDocumentMoniker": "index.ts",
87
- "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
88
- "RelativeToolTip": "index.ts",
89
- "ViewState": "AQIAAHABAAAAAAAAAAAAALABAAAfAAAA",
90
- "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
91
- "WhenOpened": "2024-05-12T20:20:11.888Z",
104
+ "WhenOpened": "2024-11-04T14:16:26.493Z",
92
105
  "EditorCaption": ""
93
106
  },
94
- {
95
- "$type": "Document",
96
- "DocumentIndex": 2,
97
- "Title": "index.d.ts",
98
- "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
99
- "RelativeDocumentMoniker": "index.d.ts",
100
- "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
101
- "RelativeToolTip": "index.d.ts",
102
- "ViewState": "AQIAAEQAAAAAAAAAAAAAAE8AAAAOAAAA",
103
- "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
104
- "WhenOpened": "2024-03-31T03:51:46.193Z"
105
- }
106
- ]
107
- },
108
- {
109
- "DockedWidth": 200,
110
- "SelectedChildIndex": 0,
111
- "Children": [
112
107
  {
113
108
  "$type": "Document",
114
109
  "DocumentIndex": 1,
@@ -117,9 +112,9 @@
117
112
  "RelativeDocumentMoniker": "index.ts",
118
113
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
119
114
  "RelativeToolTip": "index.ts",
120
- "ViewState": "AQIAAHYAAAAAAAAAAAAAABAAAAATAAAA",
115
+ "ViewState": "AQIAAPQGAAAAAAAAAAAswNQHAAAdAAAA",
121
116
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
122
- "WhenOpened": "2024-05-29T05:21:44.969Z",
117
+ "WhenOpened": "2024-05-12T20:20:11.888Z",
123
118
  "EditorCaption": ""
124
119
  }
125
120
  ]
package/hybridspa.ts CHANGED
@@ -17,6 +17,18 @@ import {
17
17
  import { deserializeArray } from "class-transformer";
18
18
 
19
19
  // helper functions
20
+ function getAPIScope(user: User): string {
21
+ let apiAppID: string = "8d95d21c-c378-4bb0-9f52-88c30d271e7a";
22
+ let authority: string = user.authority.toLowerCase();
23
+ if (authority.startsWith("https://login.microsoftonline.com/"))
24
+ apiAppID = "8d95d21c-c378-4bb0-9f52-88c30d271e7a";
25
+ else if (authority.startsWith("https://login.microsoftonline.us/"))
26
+ apiAppID = "48da942e-ea3d-49e4-a054-81649012f8f2";
27
+ else if (authority.startsWith("https://login.partner.microsoftonline.cn/"))
28
+ apiAppID = "c91d32e4-dcc5-4d77-826a-16e93ffce666";
29
+ let apiScope: string = `api://${apiAppID}/Config.Write`;
30
+ return apiScope;
31
+ }
20
32
  // TODO: this is where you want to trigger a re-authentication if token expires
21
33
  async function mindlineDefineHeaders(
22
34
  instance: IPublicClientApplication,
@@ -27,6 +39,7 @@ async function mindlineDefineHeaders(
27
39
  headers.append("accept", "*/*");
28
40
  // authorization header - if needed, retrieve and cache access token
29
41
  if (user.mindlineAccessToken == null || user.mindlineAccessToken === "") {
42
+ const apiScope: string = getAPIScope(user);
30
43
  try {
31
44
  let accounts: AccountInfo[] = instance.getAllAccounts();
32
45
  let homeAccountId = user.oid + "." + user.tid;
@@ -37,7 +50,7 @@ async function mindlineDefineHeaders(
37
50
  }
38
51
  }
39
52
  let response: AuthenticationResult = await instance.acquireTokenSilent({
40
- scopes: ["api://8d95d21c-c378-4bb0-9f52-88c30d271e7a/Config.Write"],
53
+ scopes: [apiScope],
41
54
  account: account
42
55
  });
43
56
  user.mindlineAccessToken = response.accessToken; // cache access token
@@ -56,7 +69,7 @@ async function mindlineDefineHeaders(
56
69
  }
57
70
  }
58
71
  instance.acquireTokenRedirect({
59
- scopes: ["api://8d95d21c-c378-4bb0-9f52-88c30d271e7a/Config.Write"],
72
+ scopes: [apiScope],
60
73
  account: account
61
74
  });
62
75
  }
package/index.ts CHANGED
@@ -139,7 +139,7 @@ export class User {
139
139
  this.oid = "";
140
140
  this.name = "";
141
141
  this.mail = "";
142
- this.authority = "https://login.microsoftonline.com/";
142
+ this.authority = "";
143
143
  this.tid = "";
144
144
  this.companyName = "";
145
145
  this.companyDomain = "";
@@ -1544,7 +1544,9 @@ export async function signIn(user: User, tasks: TaskArray): Promise<boolean> {
1544
1544
  let url: URL = new URL(signinURL);
1545
1545
  url.searchParams.append("redirectUri", window.location.origin);
1546
1546
  url.searchParams.append("domainHint", "organizations");
1547
- if (user.oid !== "1") { // "1" means no mail has been set by admin initially in the app, oid and mail should be same if user has set and not yet signed in
1547
+ // "1" is the OID that is set by default when reading the user objects from the JSON initialization file.
1548
+ // This means this user has not been created by the admin. If it had been, oid and mail would be the same and not == "1".
1549
+ if (user.oid !== "1") {
1548
1550
  url.searchParams.append("loginHint", user.mail);
1549
1551
  }
1550
1552
  tasks.setTaskStart("initialization", new Date());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.79",
4
+ "version": "1.0.82",
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.",
package/users.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "oid": "1",
4
4
  "name": "",
5
5
  "mail": "",
6
- "authority": "https://login.microsoftonline.com/",
6
+ "authority": "",
7
7
  "tid": "",
8
8
  "companyName": "",
9
9
  "companyDomain": "",