@mindline/sync 1.0.73 → 1.0.75
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/VSWorkspaceState.json +1 -0
- package/.vs/slnx.sqlite +0 -0
- package/.vs/sync/FileContentIndex/14dddfc3-43fc-4d99-b5ff-2695774c7325.vsidx +0 -0
- package/.vs/sync/FileContentIndex/5d07352f-b1a7-4c75-8bbb-e4a043235bc2.vsidx +0 -0
- package/.vs/sync/FileContentIndex/7e4ecd2c-67ad-427f-b332-f46a4844d20f.vsidx +0 -0
- package/.vs/sync/FileContentIndex/fb5d1ac5-8cdf-47e7-80da-383f4c5b9f68.vsidx +0 -0
- package/.vs/sync/config/applicationhost.config +1011 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/.vs/sync/v17/DocumentLayout.json +89 -22
- package/actors.json +20 -0
- package/hybridspa.ts +71 -42
- package/index.d.ts +26 -8
- package/index.ts +315 -21
- package/package.json +1 -1
- package/resources.json +58 -0
- package/.vs/sync/FileContentIndex/2df54e99-e721-4891-b1ee-16c3205a1c35.vsidx +0 -0
package/.vs/sync/v17/.wsuo
CHANGED
|
Binary file
|
|
@@ -3,8 +3,12 @@
|
|
|
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\\
|
|
7
|
-
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:
|
|
6
|
+
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\resources.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
|
|
7
|
+
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:resources.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\actors.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}",
|
|
11
|
+
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:actors.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
|
8
12
|
},
|
|
9
13
|
{
|
|
10
14
|
"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}",
|
|
@@ -13,15 +17,26 @@
|
|
|
13
17
|
{
|
|
14
18
|
"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
19
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.d.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"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}",
|
|
23
|
+
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:hybridspa.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\ArvindSuthar\\node_modules\\@azure\\msal-browser\\src\\app\\IPublicClientApplication.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"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}",
|
|
30
|
+
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:package.json||{90A6B3A7-C1A3-4009-A288-E2FF89E96FA0}"
|
|
16
31
|
}
|
|
17
32
|
],
|
|
18
33
|
"DocumentGroupContainers": [
|
|
19
34
|
{
|
|
20
|
-
"Orientation":
|
|
35
|
+
"Orientation": 1,
|
|
21
36
|
"VerticalTabListWidth": 256,
|
|
22
37
|
"DocumentGroups": [
|
|
23
38
|
{
|
|
24
|
-
"
|
|
39
|
+
"DockedHeight": 221,
|
|
25
40
|
"SelectedChildIndex": -1,
|
|
26
41
|
"Children": [
|
|
27
42
|
{
|
|
@@ -59,51 +74,103 @@
|
|
|
59
74
|
]
|
|
60
75
|
},
|
|
61
76
|
{
|
|
62
|
-
"
|
|
63
|
-
"SelectedChildIndex":
|
|
77
|
+
"DockedHeight": 299,
|
|
78
|
+
"SelectedChildIndex": 6,
|
|
64
79
|
"Children": [
|
|
65
80
|
{
|
|
66
81
|
"$type": "Document",
|
|
67
|
-
"DocumentIndex":
|
|
68
|
-
"Title": "
|
|
69
|
-
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\
|
|
70
|
-
"RelativeDocumentMoniker": "
|
|
71
|
-
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\
|
|
72
|
-
"RelativeToolTip": "
|
|
73
|
-
"ViewState": "
|
|
82
|
+
"DocumentIndex": 1,
|
|
83
|
+
"Title": "actors.json",
|
|
84
|
+
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\actors.json",
|
|
85
|
+
"RelativeDocumentMoniker": "actors.json",
|
|
86
|
+
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\actors.json",
|
|
87
|
+
"RelativeToolTip": "actors.json",
|
|
88
|
+
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAAEAAAA",
|
|
89
|
+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
|
90
|
+
"WhenOpened": "2024-04-01T07:44:39.353Z",
|
|
91
|
+
"EditorCaption": ""
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"$type": "Document",
|
|
95
|
+
"DocumentIndex": 5,
|
|
96
|
+
"Title": "IPublicClientApplication.ts",
|
|
97
|
+
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\node_modules\\@azure\\msal-browser\\src\\app\\IPublicClientApplication.ts",
|
|
98
|
+
"RelativeDocumentMoniker": "..\\..\\..\\..\\node_modules\\@azure\\msal-browser\\src\\app\\IPublicClientApplication.ts",
|
|
99
|
+
"ToolTip": "C:\\Users\\ArvindSuthar\\node_modules\\@azure\\msal-browser\\src\\app\\IPublicClientApplication.ts",
|
|
100
|
+
"RelativeToolTip": "..\\..\\..\\..\\node_modules\\@azure\\msal-browser\\src\\app\\IPublicClientApplication.ts",
|
|
101
|
+
"ViewState": "AQIAABAAAAAAAAAAAAAAACIAAAAkAAAA",
|
|
74
102
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
75
|
-
"WhenOpened": "
|
|
103
|
+
"WhenOpened": "2024-04-01T01:09:13.977Z",
|
|
76
104
|
"EditorCaption": ""
|
|
77
105
|
},
|
|
78
106
|
{
|
|
79
107
|
"$type": "Document",
|
|
80
|
-
"DocumentIndex":
|
|
108
|
+
"DocumentIndex": 2,
|
|
81
109
|
"Title": "index.ts",
|
|
82
110
|
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
|
|
83
111
|
"RelativeDocumentMoniker": "index.ts",
|
|
84
112
|
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
|
|
85
113
|
"RelativeToolTip": "index.ts",
|
|
86
|
-
"ViewState": "
|
|
114
|
+
"ViewState": "AQIAAAAAAAAAAAAAAAAAAIQAAAAAAAAA",
|
|
87
115
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
88
|
-
"WhenOpened": "
|
|
116
|
+
"WhenOpened": "2024-03-31T04:25:14.781Z",
|
|
89
117
|
"EditorCaption": ""
|
|
90
118
|
},
|
|
91
119
|
{
|
|
92
120
|
"$type": "Document",
|
|
93
|
-
"DocumentIndex":
|
|
121
|
+
"DocumentIndex": 4,
|
|
122
|
+
"Title": "hybridspa.ts",
|
|
123
|
+
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
|
|
124
|
+
"RelativeDocumentMoniker": "hybridspa.ts",
|
|
125
|
+
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
|
|
126
|
+
"RelativeToolTip": "hybridspa.ts",
|
|
127
|
+
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAkAAAAAAAAA",
|
|
128
|
+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
129
|
+
"WhenOpened": "2024-03-31T03:57:20.961Z",
|
|
130
|
+
"EditorCaption": ""
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"$type": "Document",
|
|
134
|
+
"DocumentIndex": 3,
|
|
94
135
|
"Title": "index.d.ts",
|
|
95
136
|
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
|
|
96
137
|
"RelativeDocumentMoniker": "index.d.ts",
|
|
97
138
|
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
|
|
98
139
|
"RelativeToolTip": "index.d.ts",
|
|
99
|
-
"ViewState": "
|
|
140
|
+
"ViewState": "AQIAACgBAAAAAAAAAAAAAD4BAAAiAAAA",
|
|
100
141
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
101
|
-
"WhenOpened": "2024-
|
|
142
|
+
"WhenOpened": "2024-03-31T03:51:46.193Z",
|
|
143
|
+
"EditorCaption": ""
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"$type": "Document",
|
|
147
|
+
"DocumentIndex": 6,
|
|
148
|
+
"Title": "package.json",
|
|
149
|
+
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
|
|
150
|
+
"RelativeDocumentMoniker": "package.json",
|
|
151
|
+
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\package.json",
|
|
152
|
+
"RelativeToolTip": "package.json",
|
|
153
|
+
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
|
154
|
+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
|
155
|
+
"WhenOpened": "2024-03-30T18:10:14.136Z"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"$type": "Document",
|
|
159
|
+
"DocumentIndex": 0,
|
|
160
|
+
"Title": "resources.json",
|
|
161
|
+
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\resources.json",
|
|
162
|
+
"RelativeDocumentMoniker": "resources.json",
|
|
163
|
+
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\resources.json",
|
|
164
|
+
"RelativeToolTip": "resources.json",
|
|
165
|
+
"ViewState": "AQIAAAAAAAAAAAAAAAAAADkAAAABAAAA",
|
|
166
|
+
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001642|",
|
|
167
|
+
"WhenOpened": "2024-03-30T16:56:29.032Z",
|
|
168
|
+
"EditorCaption": ""
|
|
102
169
|
}
|
|
103
170
|
]
|
|
104
171
|
},
|
|
105
172
|
{
|
|
106
|
-
"
|
|
173
|
+
"DockedHeight": 200,
|
|
107
174
|
"SelectedChildIndex": -1,
|
|
108
175
|
"Children": [
|
|
109
176
|
{
|
|
@@ -113,7 +180,7 @@
|
|
|
113
180
|
]
|
|
114
181
|
},
|
|
115
182
|
{
|
|
116
|
-
"
|
|
183
|
+
"DockedHeight": 200,
|
|
117
184
|
"SelectedChildIndex": -1,
|
|
118
185
|
"Children": [
|
|
119
186
|
{
|
package/actors.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "user",
|
|
4
|
+
"actor": "arvind@mindline.site",
|
|
5
|
+
"resource": "kv-syncproject",
|
|
6
|
+
"role": "Key Vault Certificate Officer",
|
|
7
|
+
"updatedby": "arvind@mindline.site",
|
|
8
|
+
"updatedon": "2023-09-06T15:36:45.7760714Z",
|
|
9
|
+
"resources": []
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "app",
|
|
13
|
+
"actor": "mindline1-sync-512169f5-38d1-4b57-be8b-967f2d0ae4c6",
|
|
14
|
+
"resource": "dev-subscription",
|
|
15
|
+
"role": "Contributor",
|
|
16
|
+
"updatedby": "arvind@mindline.site",
|
|
17
|
+
"updatedon": "2023-09-06T15:36:45.7760714Z",
|
|
18
|
+
"resources": []
|
|
19
|
+
}
|
|
20
|
+
]
|
package/hybridspa.ts
CHANGED
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
TenantConfigInfo,
|
|
8
8
|
User
|
|
9
9
|
} from "./index";
|
|
10
|
+
import {
|
|
11
|
+
AccountInfo
|
|
12
|
+
} from "@azure/msal-common";
|
|
10
13
|
import {
|
|
11
14
|
IPublicClientApplication,
|
|
12
15
|
AuthenticationResult,
|
|
@@ -15,7 +18,7 @@ import { deserializeArray } from "class-transformer";
|
|
|
15
18
|
|
|
16
19
|
// helper functions
|
|
17
20
|
// TODO: this is where you want to trigger a re-authentication if token expires
|
|
18
|
-
|
|
21
|
+
async function mindlineDefineHeaders(
|
|
19
22
|
instance: IPublicClientApplication,
|
|
20
23
|
user: User
|
|
21
24
|
): Promise<Headers> {
|
|
@@ -23,42 +26,68 @@ export async function defineHeaders(
|
|
|
23
26
|
headers.append("Content-Type", "application/json");
|
|
24
27
|
headers.append("accept", "*/*");
|
|
25
28
|
// authorization header - if needed, retrieve and cache access token
|
|
26
|
-
if (user.
|
|
29
|
+
if (user.mindlineAccessToken == null || user.mindlineAccessToken === "") {
|
|
27
30
|
try {
|
|
28
|
-
let
|
|
29
|
-
|
|
31
|
+
let accounts: AccountInfo[] = instance.getAllAccounts();
|
|
32
|
+
let homeAccountId = user.oid + "." + user.tid;
|
|
33
|
+
let account: AccountInfo = null;
|
|
34
|
+
for (let i: number = 0; i < accounts.length; i++) {
|
|
35
|
+
if (accounts[i].homeAccountId == homeAccountId) {
|
|
36
|
+
account = accounts[i];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let response: AuthenticationResult = await instance.acquireTokenSilent({
|
|
40
|
+
scopes: ["api://8d95d21c-c378-4bb0-9f52-88c30d271e7a/Config.Write"],
|
|
41
|
+
account: account
|
|
30
42
|
});
|
|
31
|
-
user.
|
|
32
|
-
console.log("Front end token acquired: " + user.
|
|
43
|
+
user.mindlineAccessToken = response.accessToken; // cache access token
|
|
44
|
+
console.log("Front end token acquired silently: " + user.mindlineAccessToken.slice(0, 20));
|
|
33
45
|
}
|
|
34
46
|
catch (error: any) {
|
|
35
|
-
|
|
47
|
+
try {
|
|
48
|
+
console.log("Front end token silent acquisition failure: " + error);
|
|
49
|
+
// fallback to redirect if silent acquisition fails
|
|
50
|
+
let accounts: AccountInfo[] = instance.getAllAccounts();
|
|
51
|
+
let homeAccountId = user.oid + "." + user.tid;
|
|
52
|
+
let account: AccountInfo = null;
|
|
53
|
+
for (let i: number = 0; i < accounts.length; i++) {
|
|
54
|
+
if (accounts[i].homeAccountId == homeAccountId) {
|
|
55
|
+
account = accounts[i];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
instance.acquireTokenRedirect({
|
|
59
|
+
scopes: ["api://8d95d21c-c378-4bb0-9f52-88c30d271e7a/Config.Write"],
|
|
60
|
+
account: account
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error: any) {
|
|
64
|
+
console.log("Front end token popup acquisition failure: " + error);
|
|
65
|
+
}
|
|
36
66
|
}
|
|
37
67
|
}
|
|
38
|
-
headers.append("Authorization", `Bearer ${user.
|
|
68
|
+
headers.append("Authorization", `Bearer ${user.mindlineAccessToken}`);
|
|
39
69
|
return headers;
|
|
40
70
|
}
|
|
41
|
-
async function processErrors(response: Response): Promise<string> {
|
|
71
|
+
export async function processErrors(response: Response): Promise<string> {
|
|
42
72
|
let errorString: string = "";
|
|
43
73
|
if (response.status === 401) {
|
|
44
74
|
errorString = response.statusText;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
75
|
+
if (errorString != "") return errorString;
|
|
76
|
+
}
|
|
77
|
+
let data = await response.json();
|
|
78
|
+
if (data.error !== undefined) {
|
|
79
|
+
errorString = `Error: ${data.error.code} Message: ${data.error.message}`;
|
|
80
|
+
} else if (data.errors !== undefined) {
|
|
81
|
+
let errorArray = Object.keys(data.errors);
|
|
82
|
+
let errorlist: string = "";
|
|
83
|
+
errorString = errorArray.reduce(
|
|
84
|
+
(acc, curr) => acc + curr + ": " + data.errors[curr] + " ",
|
|
85
|
+
errorlist
|
|
86
|
+
);
|
|
87
|
+
} else if (data.title !== undefined) {
|
|
88
|
+
errorString = data.title;
|
|
89
|
+
} else {
|
|
90
|
+
debugger;
|
|
62
91
|
}
|
|
63
92
|
return errorString;
|
|
64
93
|
}
|
|
@@ -83,7 +112,7 @@ export async function adminDelete(
|
|
|
83
112
|
url.searchParams.append("workspaceId", workspaceId);
|
|
84
113
|
url.searchParams.append("email", user.mail);
|
|
85
114
|
// create headers
|
|
86
|
-
const headers = await
|
|
115
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
87
116
|
// make endpoint call
|
|
88
117
|
let options = { method: "DELETE", headers: headers };
|
|
89
118
|
try {
|
|
@@ -129,7 +158,7 @@ export async function adminsGet(
|
|
|
129
158
|
let url: URL = new URL(endpoint);
|
|
130
159
|
url.searchParams.append("workspaceId", workspaceID);
|
|
131
160
|
// create headers
|
|
132
|
-
const headers = await
|
|
161
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
133
162
|
// make endpoint call
|
|
134
163
|
let options = { method: "GET", headers: headers };
|
|
135
164
|
try {
|
|
@@ -186,7 +215,7 @@ export async function adminPost(
|
|
|
186
215
|
// create admin endpoint
|
|
187
216
|
let endpoint: string = mindlineConfig.adminEndpoint();
|
|
188
217
|
// create headers
|
|
189
|
-
const headers = await
|
|
218
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
190
219
|
// create admin body
|
|
191
220
|
let adminBody: string = `
|
|
192
221
|
{"email": "${user.mail}",
|
|
@@ -225,7 +254,7 @@ export async function configConsentReadPut(instance: IPublicClientApplication, a
|
|
|
225
254
|
let url: URL = new URL(endpoint);
|
|
226
255
|
url.searchParams.append("configurationId", configId);
|
|
227
256
|
// create headers
|
|
228
|
-
const headers = await
|
|
257
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
229
258
|
// create body
|
|
230
259
|
let configConsentReadBody: string = `
|
|
231
260
|
{
|
|
@@ -266,7 +295,7 @@ export async function configConsentWritePut(instance: IPublicClientApplication,
|
|
|
266
295
|
let url: URL = new URL(endpoint);
|
|
267
296
|
url.searchParams.append("configurationId", configId);
|
|
268
297
|
// create headers
|
|
269
|
-
const headers = await
|
|
298
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
270
299
|
// create body
|
|
271
300
|
let configConsentWriteBody: string = `
|
|
272
301
|
{
|
|
@@ -318,7 +347,7 @@ export async function configDelete(
|
|
|
318
347
|
url = new URL(mindlineConfig.configEndpoint());
|
|
319
348
|
url.searchParams.append("configurationId", config.id);
|
|
320
349
|
// create headers
|
|
321
|
-
const headers = await
|
|
350
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
322
351
|
// make endpoint call
|
|
323
352
|
let options = { method: "DELETE", headers: headers };
|
|
324
353
|
try {
|
|
@@ -363,7 +392,7 @@ export async function configPost(
|
|
|
363
392
|
// create no parameter config endpoint
|
|
364
393
|
let endpoint: string = mindlineConfig.configEndpoint();
|
|
365
394
|
// create config headers
|
|
366
|
-
const headers = await
|
|
395
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
367
396
|
// create config body
|
|
368
397
|
let configBody: string = `
|
|
369
398
|
{
|
|
@@ -441,7 +470,7 @@ export async function configPut(
|
|
|
441
470
|
let url: URL = new URL(endpoint);
|
|
442
471
|
url.searchParams.append("configurationId", config.id);
|
|
443
472
|
// create config headers
|
|
444
|
-
const headers = await
|
|
473
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
445
474
|
// create config body
|
|
446
475
|
let configBody: string = `
|
|
447
476
|
{
|
|
@@ -517,7 +546,7 @@ export async function configsGet(
|
|
|
517
546
|
let url: URL = new URL(endpoint);
|
|
518
547
|
url.searchParams.append("workspaceId", workspaceID);
|
|
519
548
|
// create headers
|
|
520
|
-
const headers = await
|
|
549
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
521
550
|
// make endpoint call
|
|
522
551
|
let options = { method: "GET", headers: headers };
|
|
523
552
|
try {
|
|
@@ -574,7 +603,7 @@ export async function initPost(
|
|
|
574
603
|
// create init endpoint
|
|
575
604
|
let endpoint: string = mindlineConfig.initEndpoint();
|
|
576
605
|
// create init headers
|
|
577
|
-
const headers = await
|
|
606
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
578
607
|
// create init body
|
|
579
608
|
let initBody: string = `
|
|
580
609
|
{
|
|
@@ -634,7 +663,7 @@ export async function tenantDelete(
|
|
|
634
663
|
url.searchParams.append("tenantId", tenant.tid);
|
|
635
664
|
url.searchParams.append("workspaceId", workspaceId);
|
|
636
665
|
// create headers
|
|
637
|
-
const headers = await
|
|
666
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
638
667
|
// make tenant endpoint call
|
|
639
668
|
let options = { method: "DELETE", headers: headers };
|
|
640
669
|
try {
|
|
@@ -682,7 +711,7 @@ export async function tenantsGet(
|
|
|
682
711
|
let url: URL = new URL(endpoint);
|
|
683
712
|
url.searchParams.append("workspaceId", workspaceID);
|
|
684
713
|
// create headers
|
|
685
|
-
const headers = await
|
|
714
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
686
715
|
// make endpoint call
|
|
687
716
|
let options = { method: "GET", headers: headers };
|
|
688
717
|
try {
|
|
@@ -742,7 +771,7 @@ export async function tenantPost(
|
|
|
742
771
|
let url: URL = new URL(endpoint);
|
|
743
772
|
url.searchParams.append("workspaceId", workspaceId);
|
|
744
773
|
// create tenant headers
|
|
745
|
-
const headers = await
|
|
774
|
+
const headers = await mindlineDefineHeaders(instance, addingUser);
|
|
746
775
|
// create tenant body
|
|
747
776
|
let tenantBody: string = `
|
|
748
777
|
{"tenantId": "${tenant.tid}",
|
|
@@ -792,7 +821,7 @@ export async function workspacePut(instance: IPublicClientApplication, authorize
|
|
|
792
821
|
url.searchParams.append("workspaceId", workspaceId);
|
|
793
822
|
url.searchParams.append("workspaceName", workspaceName);
|
|
794
823
|
// create workspace headers
|
|
795
|
-
const headers = await
|
|
824
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
796
825
|
let options = { method: "PUT", headers: headers };
|
|
797
826
|
// make config endpoint call
|
|
798
827
|
try {
|
|
@@ -838,7 +867,7 @@ export async function workspacesGet(
|
|
|
838
867
|
// create workspace endpoint
|
|
839
868
|
let url: URL = new URL(endpoint);
|
|
840
869
|
// create workspace headers
|
|
841
|
-
const headers = await
|
|
870
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
842
871
|
// make workspace endpoint call
|
|
843
872
|
let options = { method: "GET", headers: headers };
|
|
844
873
|
try {
|
|
@@ -897,7 +926,7 @@ export async function readerPost(
|
|
|
897
926
|
let url: URL = new URL(readerEndpoint);
|
|
898
927
|
url.searchParams.append("configurationId", config.id);
|
|
899
928
|
// create headers
|
|
900
|
-
const headers = await
|
|
929
|
+
const headers = await mindlineDefineHeaders(instance, authorizedUser);
|
|
901
930
|
// make reader endpoint call
|
|
902
931
|
let options = { method: "POST", headers: headers };
|
|
903
932
|
try {
|
package/index.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ declare module "@mindline/sync" {
|
|
|
10
10
|
version: string;
|
|
11
11
|
array: Array<Object> | null;
|
|
12
12
|
constructor();
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
|
+
export class azureConfig {
|
|
15
|
+
// azure graph REST API endpoints
|
|
16
|
+
static azureListRootAssignments: string = "https://management.azure.com/providers/Microsoft.Authorization/roleAssignments?api-version=2022-04-01&$filter=principalId+eq+";
|
|
17
|
+
};
|
|
14
18
|
export class mindlineConfig {
|
|
15
19
|
static environmentTag: string;
|
|
16
20
|
// config API endpoints
|
|
@@ -72,7 +76,8 @@ declare module "@mindline/sync" {
|
|
|
72
76
|
workspaceIDs: string;
|
|
73
77
|
session: string;
|
|
74
78
|
spacode: string;
|
|
75
|
-
|
|
79
|
+
graphAccessToken: string;
|
|
80
|
+
mindlineAccessToken: string;
|
|
76
81
|
loginHint: string;
|
|
77
82
|
scopes: string[];
|
|
78
83
|
authTS: Date;
|
|
@@ -265,9 +270,21 @@ declare module "@mindline/sync" {
|
|
|
265
270
|
constructor(tid: string, name: string);
|
|
266
271
|
update(total: number, read: number, written: number, deferred: number): void;
|
|
267
272
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
273
|
+
export class ResourceArray {
|
|
274
|
+
resourceNodes: ResourceNode[];
|
|
275
|
+
constructor(bClearLocalStorage: boolean);
|
|
276
|
+
// get initial data from localStorage or file
|
|
277
|
+
init(bClearLocalStorage: boolean): void;
|
|
278
|
+
}
|
|
279
|
+
export class ResourceNode {
|
|
280
|
+
type: string;
|
|
281
|
+
resource: string;
|
|
282
|
+
cost: number;
|
|
283
|
+
expanded: boolean;
|
|
284
|
+
resources: ResourceNode[];
|
|
285
|
+
constructor(type: string, resource: string, cost: number);
|
|
286
|
+
}
|
|
287
|
+
// ======================= Azure AD Graph API ===============================
|
|
271
288
|
export function groupsGet(instance: IPublicClientApplication, user: User | undefined, groupSearchString: string): Promise<{ groups: Group[], error: string }>;
|
|
272
289
|
export function oauth2PermissionGrantsGet(options: RequestInit, user: User, spid: string, oid: string): Promise<{grants: string, error: string}>;
|
|
273
290
|
export function requestAdminConsent(admin: User, tct: TenantConfigType): void;
|
|
@@ -281,9 +298,7 @@ declare module "@mindline/sync" {
|
|
|
281
298
|
export function userDelegatedScopesGet(instance: IPublicClientApplication, loggedInUser: User, tenant: Tenant): { scopes: string, id: string, error: string };
|
|
282
299
|
export function userDelegatedScopesRemove(instance: IPublicClientApplication, loggedInUser: User, tenant: Tenant, scope: string): boolean;
|
|
283
300
|
export function usersGet(instance: IPublicClientApplication, user: User | undefined): { users: string[], error: string };
|
|
284
|
-
//
|
|
285
|
-
// Mindline Config API
|
|
286
|
-
//
|
|
301
|
+
// ======================= Mindline Config API ===============================
|
|
287
302
|
export function configConsentForRead(instance: IPublicClientApplication, authorizedUser: User, configId: string, tid: string, consent: boolean): Promise<APIResult>;
|
|
288
303
|
export function configConsentForWrite(instance: IPublicClientApplication, authorizedUser: User, configId: string, tid: string, consent: boolean): Promise<APIResult>;
|
|
289
304
|
export function configEdit(
|
|
@@ -303,4 +318,7 @@ declare module "@mindline/sync" {
|
|
|
303
318
|
export function userAdd(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
|
304
319
|
export function userRemove(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
|
305
320
|
export function workspaceEdit(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, workspaceName: string): Promise<APIResult>;
|
|
321
|
+
// ======================= Azure REST API ===============================
|
|
322
|
+
export function canListRootAssignments(instance: IPublicClientApplication, user: User): Promise<boolean>;
|
|
323
|
+
export function elevateGlobalAdminToUserAccessAdmin(instance: IPublicClientApplication, user: User): Promise<boolean>;
|
|
306
324
|
}
|