@mindline/sync 1.0.59 → 1.0.60

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
package/configs.json CHANGED
@@ -1,11 +1 @@
1
- [
2
- {
3
- "id": "1",
4
- "workspaceId": "",
5
- "name": "",
6
- "description": "",
7
- "tenants": [],
8
- "isEnabled": true,
9
- "sel": true
10
- }
11
- ]
1
+ []
package/index.d.ts CHANGED
@@ -238,7 +238,7 @@ declare module "@mindline/sync" {
238
238
  config: Config | null | undefined,
239
239
  syncPortalGlobalState: InitInfo | null,
240
240
  batchIdArray: Array<Object>,
241
- setRefreshDeltaTrigger: (trigger: boolean) => void,
241
+ setRefreshDeltaTrigger: (workspace: string) => void,
242
242
  setReadersTotal: (readersTotal: number) => void,
243
243
  setReadersCurrent: (readersCurrent: number) => void,
244
244
  setWritersTotal: (writersTotal: number) => void,
package/index.ts CHANGED
@@ -930,7 +930,7 @@ export class BatchArray {
930
930
  config: Config | null | undefined,
931
931
  syncPortalGlobalState: InitInfo | null,
932
932
  batchIdArray: Array<Object>,
933
- setRefreshDeltaTrigger: (trigger: boolean) => void,
933
+ setRefreshDeltaTrigger: (workspace: string) => void,
934
934
  setReadersTotal: (readersTotal: number) => void,
935
935
  setReadersCurrent: (readersCurrent: number) => void,
936
936
  setWritersTotal: (writersTotal: number) => void,
@@ -1083,7 +1083,7 @@ export class BatchArray {
1083
1083
  setConfigSyncResult("reading complete");
1084
1084
  console.log(`Setting config sync result: "reading complete"`);
1085
1085
  // trigger refresh delta tokens
1086
- setRefreshDeltaTrigger(true);
1086
+ setRefreshDeltaTrigger(config!.workspaceId);
1087
1087
  // change to % per second to complete in 12x as long as it took to get here
1088
1088
  let readTS = Date.now();
1089
1089
  let secsElapsed = (readTS - this.pb_startTS) / 1000;
@@ -1788,14 +1788,12 @@ function processReturnedAdmins(workspace: Workspace, ii: InitInfo, returnedAdmin
1788
1788
  if (dummyIndex !== -1) {
1789
1789
  // clear and overwrite dummy
1790
1790
  user = ii.us.at(dummyIndex);
1791
- // replace dummy User oid "1" with real oid in associatedTenants of all workspaces
1792
- ii.ws.map((w: Workspace) => {
1793
- let idx: number = w.associatedUsers.findIndex((oid: string) => oid == "1");
1794
- if (idx !== -1) {
1795
- w.associatedUsers.splice(idx, 1);
1796
- w.associatedUsers.push(item.userId);
1797
- }
1798
- });
1791
+ // replace dummy User oid "1" with real oid in associatedTenants of this workspace
1792
+ let idx: number = workspace.associatedUsers.findIndex((oid: string) => oid == "1");
1793
+ if (idx !== -1) {
1794
+ workspace.associatedUsers.splice(idx, 1);
1795
+ workspace.associatedUsers.push(item.userId);
1796
+ }
1799
1797
  }
1800
1798
  else {
1801
1799
  // create and track new user
@@ -1826,6 +1824,7 @@ function processReturnedAdmins(workspace: Workspace, ii: InitInfo, returnedAdmin
1826
1824
  let idx = workspace.associatedUsers.findIndex((u) => u === user.oid);
1827
1825
  if (idx == -1) workspace.associatedUsers.push(user.oid);
1828
1826
  });
1827
+ ii.save();
1829
1828
  }
1830
1829
  function processReturnedTenants(workspace: Workspace, ii: InitInfo, returnedTenants: Array<Object>) {
1831
1830
  returnedTenants.map((item) => {
@@ -1838,14 +1837,12 @@ function processReturnedTenants(workspace: Workspace, ii: InitInfo, returnedTena
1838
1837
  if (dummyIndex !== -1) {
1839
1838
  // clear and overwrite dummy
1840
1839
  tenant = ii.ts.at(dummyIndex);
1841
- // replace dummy Tenant id "1" with real id in associatedTenants of all workspaces
1842
- ii.ws.map((w: Workspace) => {
1843
- let idx: number = w.associatedTenants.findIndex((tid: string) => tid == "1");
1844
- if (idx !== -1) {
1845
- w.associatedTenants.splice(idx, 1);
1846
- w.associatedTenants.push(item.tenantId);
1847
- }
1848
- });
1840
+ // replace dummy Tenant id "1" with real id in associatedTenants of this workspace
1841
+ let idx: number = workspace.associatedTenants.findIndex((tid: string) => tid == "1");
1842
+ if (idx !== -1) {
1843
+ workspace.associatedTenants.splice(idx, 1);
1844
+ workspace.associatedTenants.push(item.tenantId);
1845
+ }
1849
1846
  } else {
1850
1847
  // create and track new tenant
1851
1848
  tenant = new Tenant();
@@ -1871,6 +1868,7 @@ function processReturnedTenants(workspace: Workspace, ii: InitInfo, returnedTena
1871
1868
  let idx = workspace.associatedTenants.findIndex((t) => t === item.tenantId);
1872
1869
  if (idx == -1) workspace.associatedTenants.push(item.tenantId);
1873
1870
  });
1871
+ ii.save();
1874
1872
  }
1875
1873
  function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConfigs: Array<Object>) {
1876
1874
  // process returned configs
@@ -1884,14 +1882,12 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
1884
1882
  if (dummyIndex !== -1) {
1885
1883
  // clear and overwrite dummy
1886
1884
  config = ii.cs.at(dummyIndex);
1887
- // replace dummy Config id "1" with real id in associatedConfigs of all workspaces
1888
- ii.ws.map((w: Workspace) => {
1889
- let idx: number = w.associatedConfigs.findIndex((id: string) => id == "1");
1890
- if (idx !== -1) {
1891
- w.associatedConfigs.splice(idx, 1);
1892
- w.associatedConfigs.push(item.id);
1893
- }
1894
- });
1885
+ // replace dummy Config id "1" with real id in associatedConfigs of this workspace
1886
+ let idx: number = workspace.associatedConfigs.findIndex((id: string) => id == "1");
1887
+ if (idx !== -1) {
1888
+ workspace.associatedConfigs.splice(idx, 1);
1889
+ workspace.associatedConfigs.push(item.id);
1890
+ }
1895
1891
  } else {
1896
1892
  // create and track new workspace
1897
1893
  config = new Config();
@@ -1902,6 +1898,7 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
1902
1898
  config = ii.cs.at(csIndex);
1903
1899
  }
1904
1900
  config!.id = item.id;
1901
+ config!.workspaceId = item.workspaceId;
1905
1902
  config!.name = item.name;
1906
1903
  config!.description = item.description;
1907
1904
  config!.isEnabled = item.isEnabled;
@@ -1924,6 +1921,7 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
1924
1921
  let idx = workspace.associatedConfigs.findIndex((c) => c === item.id);
1925
1922
  if (idx == -1) workspace.associatedConfigs.push(item.id);
1926
1923
  });
1924
+ ii.save();
1927
1925
  }
1928
1926
  async function workspaceInfoGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, debug: boolean): Promise<APIResult> {
1929
1927
  let result: APIResult = new APIResult();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mindline/sync",
3
3
  "type": "module",
4
- "version": "1.0.59",
4
+ "version": "1.0.60",
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.",
package/workspaces.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "",
5
5
  "associatedUsers": [ "1" ],
6
6
  "associatedTenants": [ "1" ],
7
- "associatedConfigs": [ "1" ],
7
+ "associatedConfigs": [ ],
8
8
  "sel": true
9
9
  }
10
10
  ]