@mindline/sync 1.0.71 → 1.0.73

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
@@ -2,6 +2,10 @@
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\\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
+ },
5
9
  {
6
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}",
7
11
  "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
@@ -9,10 +13,6 @@
9
13
  {
10
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}",
11
15
  "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:index.d.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
12
- },
13
- {
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
- "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:hybridspa.ts||{0F2454B1-A556-402D-A7D0-1FDE7F99DEE0}"
16
16
  }
17
17
  ],
18
18
  "DocumentGroupContainers": [
@@ -60,46 +60,45 @@
60
60
  },
61
61
  {
62
62
  "DockedWidth": 200,
63
- "SelectedChildIndex": 1,
63
+ "SelectedChildIndex": 0,
64
64
  "Children": [
65
65
  {
66
66
  "$type": "Document",
67
- "DocumentIndex": 2,
67
+ "DocumentIndex": 0,
68
68
  "Title": "hybridspa.ts",
69
69
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
70
70
  "RelativeDocumentMoniker": "hybridspa.ts",
71
71
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\hybridspa.ts",
72
72
  "RelativeToolTip": "hybridspa.ts",
73
- "ViewState": "AQIAANwAAAAAAAAAAAAYwOgAAAAjAAAA",
73
+ "ViewState": "AQIAAAUCAAAAAAAAAAAhwAcCAAAEAAAA",
74
74
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
75
75
  "WhenOpened": "2023-11-25T02:18:34.862Z",
76
76
  "EditorCaption": ""
77
77
  },
78
78
  {
79
79
  "$type": "Document",
80
- "DocumentIndex": 0,
80
+ "DocumentIndex": 1,
81
81
  "Title": "index.ts",
82
82
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
83
83
  "RelativeDocumentMoniker": "index.ts",
84
84
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.ts",
85
85
  "RelativeToolTip": "index.ts",
86
- "ViewState": "AQIAABMGAAAAAAAAAAAswCYGAAAFAAAA",
86
+ "ViewState": "AQIAAAAAAAAAAAAAAAAAAAQAAADwAAAA",
87
87
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
88
88
  "WhenOpened": "2023-12-05T02:10:16.04Z",
89
89
  "EditorCaption": ""
90
90
  },
91
91
  {
92
92
  "$type": "Document",
93
- "DocumentIndex": 1,
93
+ "DocumentIndex": 2,
94
94
  "Title": "index.d.ts",
95
95
  "DocumentMoniker": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
96
96
  "RelativeDocumentMoniker": "index.d.ts",
97
97
  "ToolTip": "C:\\Users\\ArvindSuthar\\source\\repos\\front\\sync\\index.d.ts",
98
98
  "RelativeToolTip": "index.d.ts",
99
- "ViewState": "AQIAAAUBAAAAAAAAAAAnwBYBAABBAAAA",
99
+ "ViewState": "AQIAABMBAAAAAAAAAAAEwCsBAAAEAAAA",
100
100
  "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003213|",
101
- "WhenOpened": "2024-01-01T16:19:43.325Z",
102
- "EditorCaption": ""
101
+ "WhenOpened": "2024-01-01T16:19:43.325Z"
103
102
  }
104
103
  ]
105
104
  },
package/hybridspa.ts CHANGED
@@ -111,7 +111,7 @@ export async function adminDelete(
111
111
  //adminsGet
112
112
  export async function adminsGet(
113
113
  instance: IPublicClientApplication,
114
- authorizedUser: User,
114
+ user: User,
115
115
  workspaceID: string,
116
116
  debug: boolean
117
117
  ): Promise<APIResult> {
@@ -129,7 +129,7 @@ export async function adminsGet(
129
129
  let url: URL = new URL(endpoint);
130
130
  url.searchParams.append("workspaceId", workspaceID);
131
131
  // create headers
132
- const headers = await defineHeaders(instance, authorizedUser);
132
+ const headers = await defineHeaders(instance, user);
133
133
  // make endpoint call
134
134
  let options = { method: "GET", headers: headers };
135
135
  try {
@@ -499,7 +499,7 @@ export async function configPut(
499
499
  //configsGet
500
500
  export async function configsGet(
501
501
  instance: IPublicClientApplication,
502
- authorizedUser: User,
502
+ user: User,
503
503
  workspaceID: string,
504
504
  debug: boolean
505
505
  ): Promise<APIResult> {
@@ -517,7 +517,7 @@ export async function configsGet(
517
517
  let url: URL = new URL(endpoint);
518
518
  url.searchParams.append("workspaceId", workspaceID);
519
519
  // create headers
520
- const headers = await defineHeaders(instance, authorizedUser);
520
+ const headers = await defineHeaders(instance, user);
521
521
  // make endpoint call
522
522
  let options = { method: "GET", headers: headers };
523
523
  try {
@@ -560,7 +560,6 @@ export async function configsGet(
560
560
  //initPost
561
561
  export async function initPost(
562
562
  instance: IPublicClientApplication,
563
- authorizedUser: User,
564
563
  user: User,
565
564
  debug: boolean
566
565
  ): Promise<APIResult> {
@@ -575,7 +574,7 @@ export async function initPost(
575
574
  // create init endpoint
576
575
  let endpoint: string = mindlineConfig.initEndpoint();
577
576
  // create init headers
578
- const headers = await defineHeaders(instance, authorizedUser);
577
+ const headers = await defineHeaders(instance, user);
579
578
  // create init body
580
579
  let initBody: string = `
581
580
  {
@@ -665,7 +664,7 @@ export async function tenantDelete(
665
664
  //tenantsGet
666
665
  export async function tenantsGet(
667
666
  instance: IPublicClientApplication,
668
- authorizedUser: User,
667
+ user: User,
669
668
  workspaceID: string,
670
669
  debug: boolean
671
670
  ): Promise<APIResult> {
@@ -683,7 +682,7 @@ export async function tenantsGet(
683
682
  let url: URL = new URL(endpoint);
684
683
  url.searchParams.append("workspaceId", workspaceID);
685
684
  // create headers
686
- const headers = await defineHeaders(instance, authorizedUser);
685
+ const headers = await defineHeaders(instance, user);
687
686
  // make endpoint call
688
687
  let options = { method: "GET", headers: headers };
689
688
  try {
@@ -823,7 +822,6 @@ export async function workspacePut(instance: IPublicClientApplication, authorize
823
822
  //workspacesGet
824
823
  export async function workspacesGet(
825
824
  instance: IPublicClientApplication,
826
- authorizedUser: User,
827
825
  user: User,
828
826
  debug: boolean
829
827
  ): Promise<APIResult> {
@@ -840,7 +838,7 @@ export async function workspacesGet(
840
838
  // create workspace endpoint
841
839
  let url: URL = new URL(endpoint);
842
840
  // create workspace headers
843
- const headers = await defineHeaders(instance, authorizedUser);
841
+ const headers = await defineHeaders(instance, user);
844
842
  // make workspace endpoint call
845
843
  let options = { method: "GET", headers: headers };
846
844
  try {
package/index.d.ts CHANGED
@@ -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, authorizedUser: User, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): APIResult;
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
@@ -1793,7 +1793,7 @@ export async function configsRefresh(instance: IPublicClientApplication, authori
1793
1793
  result.status = 500;
1794
1794
  return result;
1795
1795
  }
1796
- export async function initGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): Promise<APIResult> {
1796
+ export async function initGet(instance: IPublicClientApplication, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): Promise<APIResult> {
1797
1797
  console.log(`>>>>>> initGet`);
1798
1798
  let result: APIResult = new APIResult();
1799
1799
  if (debug) debugger;
@@ -1805,35 +1805,26 @@ export async function initGet(instance: IPublicClientApplication, authorizedUser
1805
1805
  if (bResult) {
1806
1806
  // success, we now know cloud instance where this tenant is provisioned
1807
1807
  user.authority = tenant.authority;
1808
- // do we have a logged in user from the same authority as this newly proposed tenant?
1809
- let loggedInUser: User | undefined = ii.us.find((u: User) => (u.session === "Sign Out" && u.authority === user.authority));
1810
- if (loggedInUser != null) {
1811
- // get tenant name and domain from AAD to pass to Configuration API
1812
- tasks.setTaskStart("GET tenant details", new Date());
1813
- result.result = await tenantRelationshipsGetById(user, tenant, ii, instance, debug);
1814
- tasks.setTaskEnd("GET tenant details", new Date(), "complete");
1815
- // store tenant name and domain on user, POST user and tenant to back end
1816
- if (result.result) {
1817
- loggedInUser.companyName = tenant.name;
1818
- loggedInUser.companyDomain = tenant.domain;
1819
- tasks.setTaskStart("POST config init", new Date());
1820
- result = await initPost(instance, authorizedUser, user, debug);
1821
- tasks.setTaskEnd("POST config init", new Date(), result.result ? "complete" : "failed");
1822
- }
1823
- // simlarly, if we just did our first post, then query config backend for workspace(s) associated with this user
1824
- if (result.result) {
1825
- tasks.setTaskStart("GET workspaces", new Date());
1826
- result = await workspaceInfoGet(instance, authorizedUser, user, ii, debug);
1827
- tasks.setTaskEnd("GET workspaces", new Date(), result.result ? "complete" : "failed");
1828
- }
1829
- console.log("initGet complete. Version: " + version);
1830
- return result;
1808
+ // get tenant name and domain from AAD to pass to Configuration API
1809
+ tasks.setTaskStart("GET tenant details", new Date());
1810
+ result.result = await tenantRelationshipsGetById(user, tenant, ii, instance, debug);
1811
+ tasks.setTaskEnd("GET tenant details", new Date(), "complete");
1812
+ // store tenant name and domain on user, POST user and tenant to back end
1813
+ if (result.result) {
1814
+ user.companyName = tenant.name;
1815
+ user.companyDomain = tenant.domain;
1816
+ tasks.setTaskStart("POST config init", new Date());
1817
+ result = await initPost(instance, user, debug);
1818
+ tasks.setTaskEnd("POST config init", new Date(), result.result ? "complete" : "failed");
1831
1819
  }
1832
- else {
1833
- result.error = `${user.mail} has insufficient privileges to lookup under authority: ${user.authority}.`;
1834
- result.result = false;
1835
- return result;
1820
+ // simlarly, if we just did our first post, then query config backend for workspace(s) associated with this user
1821
+ if (result.result) {
1822
+ tasks.setTaskStart("GET workspaces", new Date());
1823
+ result = await workspaceInfoGet(instance, user, ii, debug);
1824
+ tasks.setTaskEnd("GET workspaces", new Date(), result.result ? "complete" : "failed");
1836
1825
  }
1826
+ console.log("initGet complete. Version: " + version);
1827
+ return result;
1837
1828
  }
1838
1829
  else {
1839
1830
  result.error = `Failed to retrieve authority for user "${user.mail}" TID ${user.tid}.`;
@@ -2014,11 +2005,11 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
2014
2005
  });
2015
2006
  ii.save();
2016
2007
  }
2017
- async function workspaceInfoGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, debug: boolean): Promise<APIResult> {
2008
+ async function workspaceInfoGet(instance: IPublicClientApplication, user: User, ii: InitInfo, debug: boolean): Promise<APIResult> {
2018
2009
  let result: APIResult = new APIResult();
2019
2010
  if (debug) debugger;
2020
2011
  try {
2021
- result = await workspacesGet(instance, authorizedUser, user, debug);
2012
+ result = await workspacesGet(instance, user, debug);
2022
2013
  if (result.result) {
2023
2014
  for (let o of result.array!) {
2024
2015
  // are we already tracking this workspace?
@@ -2071,9 +2062,9 @@ async function workspaceInfoGet(instance: IPublicClientApplication, authorizedUs
2071
2062
  workspace.name = o.name;
2072
2063
  workspace.ownerid = o.workspaceOwnerUserId;
2073
2064
  // parallel GET admins, tenants, configs associated with this workspace
2074
- let adminsPromise: Promise<APIResult> = adminsGet(instance, authorizedUser, workspace.id, debug);
2075
- let tenantsPromise: Promise<APIResult> = tenantsGet(instance, authorizedUser, workspace.id, debug);
2076
- let configsPromise: Promise<APIResult> = configsGet(instance, authorizedUser, workspace.id, debug);
2065
+ let adminsPromise: Promise<APIResult> = adminsGet(instance, user, workspace.id, debug);
2066
+ let tenantsPromise: Promise<APIResult> = tenantsGet(instance, user, workspace.id, debug);
2067
+ let configsPromise: Promise<APIResult> = configsGet(instance, user, workspace.id, debug);
2077
2068
  // wait for all to finish, return on any failure
2078
2069
  let [adminsResult, tenantsResult, configsResult] = await Promise.all([adminsPromise, tenantsPromise, configsPromise]);
2079
2070
  if (!adminsResult.result) return adminsResult;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.71",
4
+ "version": "1.0.73",
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.",