@mindline/sync 1.0.81 → 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.
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: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}"
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
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
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\\users.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
15
- "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:users.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
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,11 +64,11 @@
64
64
  },
65
65
  {
66
66
  "DockedWidth": 200,
67
- "SelectedChildIndex": 0,
67
+ "SelectedChildIndex": 2,
68
68
  "Children": [
69
69
  {
70
70
  "$type": "Document",
71
- "DocumentIndex": 0,
71
+ "DocumentIndex": 2,
72
72
  "Title": "package.json",
73
73
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
74
74
  "RelativeDocumentMoniker": "package.json",
@@ -81,7 +81,7 @@
81
81
  },
82
82
  {
83
83
  "$type": "Document",
84
- "DocumentIndex": 2,
84
+ "DocumentIndex": 3,
85
85
  "Title": "users.json",
86
86
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\users.json",
87
87
  "RelativeDocumentMoniker": "users.json",
@@ -89,18 +89,17 @@
89
89
  "RelativeToolTip": "users.json",
90
90
  "ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAASAAAA",
91
91
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
92
- "WhenOpened": "2024-11-05T22:57:19.003Z",
93
- "EditorCaption": ""
92
+ "WhenOpened": "2024-11-05T22:57:19.003Z"
94
93
  },
95
94
  {
96
95
  "$type": "Document",
97
- "DocumentIndex": 3,
96
+ "DocumentIndex": 0,
98
97
  "Title": "hybridspa.ts",
99
98
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
100
99
  "RelativeDocumentMoniker": "hybridspa.ts",
101
100
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
102
101
  "RelativeToolTip": "hybridspa.ts",
103
- "ViewState": "AQIAAPgAAAAAAAAAAAAAAFECAAAXAAAA",
102
+ "ViewState": "AQIAABwAAAAAAAAAAAAAABwAAAAUAAAA",
104
103
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
105
104
  "WhenOpened": "2024-11-04T14:16:26.493Z",
106
105
  "EditorCaption": ""
@@ -113,7 +112,7 @@
113
112
  "RelativeDocumentMoniker": "index.ts",
114
113
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
115
114
  "RelativeToolTip": "index.ts",
116
- "ViewState": "AQIAAFgBAAAAAAAAAAAuwHMBAAAAAAAA",
115
+ "ViewState": "AQIAAPQGAAAAAAAAAAAswNQHAAAdAAAA",
117
116
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
118
117
  "WhenOpened": "2024-05-12T20:20:11.888Z",
119
118
  "EditorCaption": ""
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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.81",
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.",