@mindline/sync 1.0.42 → 1.0.43

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
package/index.d.ts CHANGED
@@ -26,7 +26,6 @@ declare module "@mindline/sync" {
26
26
  loginHint: string;
27
27
  scopes: string[];
28
28
  authTS: Date;
29
- claimsprincipal: string; // claims principal cached at login to allow clearing cache at logout
30
29
  constructor();
31
30
  }
32
31
  // tenant (Azure AD tenant, AD domain, Google workspace)
package/index.ts CHANGED
@@ -1187,8 +1187,8 @@ export async function tenantRelationshipsGetByDomain(loggedInUser: User, tenant:
1187
1187
  //tenantRelationshipsGetById - query AAD for associated company name and domain
1188
1188
  export async function tenantRelationshipsGetById(user: User, ii: InitInfo, instance: IPublicClientApplication, tasks: TaskArray, debug: boolean): Promise<boolean> {
1189
1189
  if (debug) debugger;
1190
- // do we already have a valid company name? if so, nothing to add, no need for UX to re-render
1191
- if (user.companyName != "") return false;
1190
+ // 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
1191
+ // if (user.companyName != "") return false;
1192
1192
  // if needed, retrieve and cache access token
1193
1193
  if (user.accessToken === "") {
1194
1194
  try {
@@ -1276,7 +1276,7 @@ export async function tenantUnauthenticatedLookup(tenant: Tenant, debug: boolean
1276
1276
  var authMatches = tenantAuthEndpoint.match(regexes[j]);
1277
1277
  tenant.tid = authMatches[2];
1278
1278
  tenant.authority = authMatches[1]; // USGov tenants are registered in WW with USGov authority values!
1279
- console.log("Successful GET from openid well-known endpoint");
1279
+ console.log(`Successful GET from openid well-known endpoint: tid: ${tenant.tid} authority: ${tenant.authority}`);
1280
1280
  return true; // success, need UX to re-render
1281
1281
  }
1282
1282
  else {
@@ -1376,12 +1376,12 @@ export async function initGet(instance: IPublicClientApplication, authorizedUser
1376
1376
  tenant.domain = user.tid;
1377
1377
  let bResult: boolean = await tenantUnauthenticatedLookup(tenant, debug);
1378
1378
  if (bResult) {
1379
- // success, we at least got authority as a new bit of information at this point
1379
+ // success, we now know instance of this tenant
1380
1380
  user.authority = tenant.authority;
1381
1381
  // do we have a logged in user from the same authority as this newly proposed tenant?
1382
1382
  let loggedInUser: User | undefined = ii.us.find((u: User) => (u.session === "Sign Out" && u.authority === user.authority));
1383
1383
  if (loggedInUser != null) {
1384
- // get tenant name and domain from AAD
1384
+ // get tenant name and domain from AAD to pass to Configuration API
1385
1385
  result.result = await tenantRelationshipsGetById(user, ii, instance, tasks, debug);
1386
1386
  // if this is the first time, we have just gotten tenant info, then we must POST user and not-yet-onboarded tenant to back end
1387
1387
  if (result.result) {
@@ -1400,7 +1400,7 @@ export async function initGet(instance: IPublicClientApplication, authorizedUser
1400
1400
  return result;
1401
1401
  }
1402
1402
  else {
1403
- result.error = `${user.mail} insufficient privileges to lookup under authority: ${user.authority}.`;
1403
+ result.error = `${user.mail} with insufficient privileges to lookup under authority: ${user.authority}.`;
1404
1404
  result.result = false;
1405
1405
  return result;
1406
1406
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.42",
4
+ "version": "1.0.43",
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.",