@mindline/sync 1.0.70 → 1.0.72
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 +0 -0
- package/.vs/sync/FileContentIndex/c1d2a8c6-2611-4aad-95f7-50c57ae8099c.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/.vs/sync/v17/DocumentLayout.json +11 -12
- package/index.d.ts +2 -2
- package/index.ts +16 -19
- package/package.json +1 -1
- package/.vs/sync/FileContentIndex/3e722f75-6755-461e-b2b7-295022a6593c.vsidx +0 -0
package/.vs/slnx.sqlite
CHANGED
|
Binary file
|
package/.vs/sync/v17/.wsuo
CHANGED
|
Binary file
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"Version": 1,
|
|
3
3
|
"WorkspaceRootPath": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\",
|
|
4
4
|
"Documents": [
|
|
5
|
-
{
|
|
6
|
-
"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}",
|
|
7
|
-
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.d.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
8
|
-
},
|
|
9
5
|
{
|
|
10
6
|
"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
7
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
12
8
|
},
|
|
9
|
+
{
|
|
10
|
+
"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}",
|
|
11
|
+
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.d.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
12
|
+
},
|
|
13
13
|
{
|
|
14
14
|
"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}",
|
|
15
15
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:hybridspa.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"DockedWidth": 200,
|
|
63
|
-
"SelectedChildIndex":
|
|
63
|
+
"SelectedChildIndex": 1,
|
|
64
64
|
"Children": [
|
|
65
65
|
{
|
|
66
66
|
"$type": "Document",
|
|
@@ -70,33 +70,32 @@
|
|
|
70
70
|
"RelativeDocumentMoniker": "hybridspa.ts",
|
|
71
71
|
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
|
|
72
72
|
"RelativeToolTip": "hybridspa.ts",
|
|
73
|
-
"ViewState": "
|
|
73
|
+
"ViewState": "AQIAANwAAAAAAAAAAAAYwOgAAAAjAAAA",
|
|
74
74
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
75
|
-
"WhenOpened": "2023-11-25T02:18:34.862Z"
|
|
76
|
-
"EditorCaption": ""
|
|
75
|
+
"WhenOpened": "2023-11-25T02:18:34.862Z"
|
|
77
76
|
},
|
|
78
77
|
{
|
|
79
78
|
"$type": "Document",
|
|
80
|
-
"DocumentIndex":
|
|
79
|
+
"DocumentIndex": 0,
|
|
81
80
|
"Title": "index.ts",
|
|
82
81
|
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
|
|
83
82
|
"RelativeDocumentMoniker": "index.ts",
|
|
84
83
|
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
|
|
85
84
|
"RelativeToolTip": "index.ts",
|
|
86
|
-
"ViewState": "
|
|
85
|
+
"ViewState": "AQIAAPwGAAAAAAAAAAAcwCwHAAAFAAAA",
|
|
87
86
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
88
87
|
"WhenOpened": "2023-12-05T02:10:16.04Z",
|
|
89
88
|
"EditorCaption": ""
|
|
90
89
|
},
|
|
91
90
|
{
|
|
92
91
|
"$type": "Document",
|
|
93
|
-
"DocumentIndex":
|
|
92
|
+
"DocumentIndex": 1,
|
|
94
93
|
"Title": "index.d.ts",
|
|
95
94
|
"DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
|
|
96
95
|
"RelativeDocumentMoniker": "index.d.ts",
|
|
97
96
|
"ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
|
|
98
97
|
"RelativeToolTip": "index.d.ts",
|
|
99
|
-
"ViewState": "
|
|
98
|
+
"ViewState": "AQIAABMBAAAAAAAAAAAEwCsBAAAEAAAA",
|
|
100
99
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
|
|
101
100
|
"WhenOpened": "2024-01-01T16:19:43.325Z",
|
|
102
101
|
"EditorCaption": ""
|
package/index.d.ts
CHANGED
|
@@ -276,7 +276,7 @@ declare module "@mindline/sync" {
|
|
|
276
276
|
export function signInIncrementally(user: User, scope: string): void;
|
|
277
277
|
export function signOut(user: User): boolean;
|
|
278
278
|
export function tenantRelationshipsGetByDomain(loggedInuser: User, tenant: Tenant, instance: IPublicClientApplication, debug: boolean): boolean;
|
|
279
|
-
export function tenantRelationshipsGetById(
|
|
279
|
+
export function tenantRelationshipsGetById(loggedInUser: User, tenant: Tenant, ii: InitInfo, instance: IPublicClientApplication, debug: boolean): boolean;
|
|
280
280
|
export function tenantUnauthenticatedLookup(tenant: Tenant, debug: boolean): boolean;
|
|
281
281
|
export function userDelegatedScopesGet(instance: IPublicClientApplication, loggedInUser: User, tenant: Tenant): { scopes: string, id: string, error: string };
|
|
282
282
|
export function userDelegatedScopesRemove(instance: IPublicClientApplication, loggedInUser: User, tenant: Tenant, scope: string): boolean;
|
|
@@ -297,7 +297,7 @@ declare module "@mindline/sync" {
|
|
|
297
297
|
debug: boolean): APIResult;
|
|
298
298
|
export function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): APIResult;
|
|
299
299
|
export function configsRefresh(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, ii: InitInfo, debug: boolean): APIResult;
|
|
300
|
-
export function initGet(instance: IPublicClientApplication,
|
|
300
|
+
export function initGet(instance: IPublicClientApplication, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): APIResult;
|
|
301
301
|
export function tenantAdd(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string): APIResult;
|
|
302
302
|
export function tenantRemove(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string, debug: boolean): APIResult;
|
|
303
303
|
export function userAdd(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
package/index.ts
CHANGED
|
@@ -1526,17 +1526,15 @@ export async function tenantRelationshipsGetByDomain(loggedInUser: User, tenant:
|
|
|
1526
1526
|
return false; // failed, no need for UX to re-render
|
|
1527
1527
|
}
|
|
1528
1528
|
//tenantRelationshipsGetById - query AAD for associated company name and domain
|
|
1529
|
-
export async function tenantRelationshipsGetById(
|
|
1529
|
+
export async function tenantRelationshipsGetById(loggedInUser: User, tenant: Tenant, ii: InitInfo, instance: IPublicClientApplication, debug: boolean): Promise<boolean> {
|
|
1530
1530
|
console.log("**** tenantRelationshipsGetById");
|
|
1531
1531
|
if (debug) debugger;
|
|
1532
|
-
// since we should mainly be called when a user has newly logged in, we can afford the performance hit of looking up the tenant name and domain again
|
|
1533
|
-
// if (user.companyName != "") return false;
|
|
1534
1532
|
// if needed, retrieve and cache access token
|
|
1535
|
-
if (
|
|
1533
|
+
if (loggedInUser.accessToken === "") {
|
|
1536
1534
|
try {
|
|
1537
|
-
let response: AuthenticationResult = await instance.acquireTokenByCode({ code:
|
|
1538
|
-
|
|
1539
|
-
console.log("tenantRelationshipsGetById: Front end token acquired: " +
|
|
1535
|
+
let response: AuthenticationResult = await instance.acquireTokenByCode({ code: loggedInUser.spacode });
|
|
1536
|
+
loggedInUser.accessToken = response.accessToken; // cache access token
|
|
1537
|
+
console.log("tenantRelationshipsGetById: Front end token acquired: " + loggedInUser.accessToken.slice(0, 20));
|
|
1540
1538
|
}
|
|
1541
1539
|
catch (error: any) {
|
|
1542
1540
|
console.log("tenantRelationshipsGetById: Front end token failure: " + error);
|
|
@@ -1545,25 +1543,21 @@ export async function tenantRelationshipsGetById(user: User, ii: InitInfo, insta
|
|
|
1545
1543
|
}
|
|
1546
1544
|
// prepare Authorization headers as part of options
|
|
1547
1545
|
const headers = new Headers();
|
|
1548
|
-
const bearer = `Bearer ${
|
|
1546
|
+
const bearer = `Bearer ${loggedInUser.accessToken}`;
|
|
1549
1547
|
headers.append("Authorization", bearer);
|
|
1550
1548
|
let options = { method: "GET", headers: headers };
|
|
1551
1549
|
// make tenant endpoint call
|
|
1552
1550
|
try {
|
|
1553
1551
|
// create tenant info endpoint
|
|
1554
|
-
var tenantEndpoint = getGraphEndpoint(
|
|
1552
|
+
var tenantEndpoint = getGraphEndpoint(loggedInUser.authority) + graphConfig.graphTenantByIdPredicate;
|
|
1555
1553
|
tenantEndpoint += "(tenantId='";
|
|
1556
|
-
tenantEndpoint +=
|
|
1554
|
+
tenantEndpoint += tenant.tid;
|
|
1557
1555
|
tenantEndpoint += "')";
|
|
1558
1556
|
console.log("tenantRelationshipsGetById: Attempting GET from /findTenantInformationByTenantId:", tenantEndpoint);
|
|
1559
1557
|
let response = await fetch(tenantEndpoint, options);
|
|
1560
1558
|
let data = await response.json();
|
|
1561
1559
|
if (data && typeof data.displayName !== undefined && data.displayName !== "") {
|
|
1562
|
-
// set domain information on user
|
|
1563
|
-
user.companyName = data.displayName;
|
|
1564
|
-
user.companyDomain = data.defaultDomainName;
|
|
1565
1560
|
// set domain information on tenant
|
|
1566
|
-
let tenant: Tenant | undefined = ii.ts.find((t) => t.tid === user.tid);
|
|
1567
1561
|
if (tenant !== undefined) {
|
|
1568
1562
|
tenant.name = data.displayName;
|
|
1569
1563
|
tenant.domain = data.defaultDomainName;
|
|
@@ -1799,12 +1793,13 @@ export async function configsRefresh(instance: IPublicClientApplication, authori
|
|
|
1799
1793
|
result.status = 500;
|
|
1800
1794
|
return result;
|
|
1801
1795
|
}
|
|
1802
|
-
export async function initGet(instance: IPublicClientApplication,
|
|
1796
|
+
export async function initGet(instance: IPublicClientApplication, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): Promise<APIResult> {
|
|
1803
1797
|
console.log(`>>>>>> initGet`);
|
|
1804
1798
|
let result: APIResult = new APIResult();
|
|
1805
1799
|
if (debug) debugger;
|
|
1806
1800
|
// lookup authority for this user (the lookup call does it based on domain, but TID works as well to find authority)
|
|
1807
1801
|
let tenant: Tenant = new Tenant();
|
|
1802
|
+
tenant.tid = user.tid;
|
|
1808
1803
|
tenant.domain = user.tid;
|
|
1809
1804
|
let bResult: boolean = await tenantUnauthenticatedLookup(tenant, debug);
|
|
1810
1805
|
if (bResult) {
|
|
@@ -1815,18 +1810,20 @@ export async function initGet(instance: IPublicClientApplication, authorizedUser
|
|
|
1815
1810
|
if (loggedInUser != null) {
|
|
1816
1811
|
// get tenant name and domain from AAD to pass to Configuration API
|
|
1817
1812
|
tasks.setTaskStart("GET tenant details", new Date());
|
|
1818
|
-
result.result = await tenantRelationshipsGetById(user, ii, instance, debug);
|
|
1813
|
+
result.result = await tenantRelationshipsGetById(user, tenant, ii, instance, debug);
|
|
1819
1814
|
tasks.setTaskEnd("GET tenant details", new Date(), "complete");
|
|
1820
|
-
//
|
|
1815
|
+
// store tenant name and domain on user, POST user and tenant to back end
|
|
1821
1816
|
if (result.result) {
|
|
1817
|
+
user.companyName = tenant.name;
|
|
1818
|
+
user.companyDomain = tenant.domain;
|
|
1822
1819
|
tasks.setTaskStart("POST config init", new Date());
|
|
1823
|
-
result = await initPost(instance,
|
|
1820
|
+
result = await initPost(instance, loggedInUser, user, debug);
|
|
1824
1821
|
tasks.setTaskEnd("POST config init", new Date(), result.result ? "complete" : "failed");
|
|
1825
1822
|
}
|
|
1826
1823
|
// simlarly, if we just did our first post, then query config backend for workspace(s) associated with this user
|
|
1827
1824
|
if (result.result) {
|
|
1828
1825
|
tasks.setTaskStart("GET workspaces", new Date());
|
|
1829
|
-
result = await workspaceInfoGet(instance,
|
|
1826
|
+
result = await workspaceInfoGet(instance, loggedInUser, user, ii, debug);
|
|
1830
1827
|
tasks.setTaskEnd("GET workspaces", new Date(), result.result ? "complete" : "failed");
|
|
1831
1828
|
}
|
|
1832
1829
|
console.log("initGet complete. Version: " + version);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindline/sync",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.72",
|
|
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.",
|
|
Binary file
|