@mindline/sync 1.0.59 → 1.0.61
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/4b369802-4ce9-4834-a1b3-8823c2c9a222.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/configs.json +1 -11
- package/index.d.ts +9 -2
- package/index.ts +49 -29
- package/package.json +1 -1
- package/workspaces.json +1 -1
- package/.vs/sync/FileContentIndex/cc4f2708-8b6d-4932-9cb7-10b8b988cd7e.vsidx +0 -0
package/.vs/slnx.sqlite
CHANGED
|
Binary file
|
package/.vs/sync/v17/.wsuo
CHANGED
|
Binary file
|
package/configs.json
CHANGED
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: (
|
|
241
|
+
setRefreshDeltaTrigger: (workspace: string) => void,
|
|
242
242
|
setReadersTotal: (readersTotal: number) => void,
|
|
243
243
|
setReadersCurrent: (readersCurrent: number) => void,
|
|
244
244
|
setWritersTotal: (writersTotal: number) => void,
|
|
@@ -282,7 +282,14 @@ declare module "@mindline/sync" {
|
|
|
282
282
|
//
|
|
283
283
|
// Mindline Config API
|
|
284
284
|
//
|
|
285
|
-
export function configEdit(
|
|
285
|
+
export function configEdit(
|
|
286
|
+
instance: IPublicClientApplication,
|
|
287
|
+
authorizedUser: User,
|
|
288
|
+
config: Config,
|
|
289
|
+
setConfigId: (id: string) => void,
|
|
290
|
+
setSelectedConfigs: (selectedConfigs: { [id: string]: boolean | number[] }) => void,
|
|
291
|
+
workspace: Workspace,
|
|
292
|
+
debug: boolean): APIResult;
|
|
286
293
|
export function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): APIResult;
|
|
287
294
|
export function configsRefresh(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, ii: InitInfo, debug: boolean): APIResult;
|
|
288
295
|
export function initGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): APIResult;
|
package/index.ts
CHANGED
|
@@ -900,7 +900,7 @@ export class BatchArray {
|
|
|
900
900
|
setIdleText(`${this.pb_total} seconds elapsed. Last update ${this.pb_idle} seconds ago. [max idle: ${this.pb_idleMax}/60]`);
|
|
901
901
|
if (this.pb_idle >= 60) {
|
|
902
902
|
if (this.milestoneArray.milestones[0].Write == null) {
|
|
903
|
-
this.milestoneArray.write(setMilestones);
|
|
903
|
+
//this.milestoneArray.write(setMilestones); -- allow sync to cntinue
|
|
904
904
|
setConfigSyncResult(`sync continuing, but no update for ${this.pb_idle} seconds`);
|
|
905
905
|
}
|
|
906
906
|
}
|
|
@@ -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: (
|
|
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(
|
|
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;
|
|
@@ -1674,10 +1674,32 @@ export async function usersGet(instance: IPublicClientApplication, user: User |
|
|
|
1674
1674
|
}
|
|
1675
1675
|
}
|
|
1676
1676
|
// ======================= Mindline Config API ===============================
|
|
1677
|
-
export async function configEdit(
|
|
1677
|
+
export async function configEdit(
|
|
1678
|
+
instance: IPublicClientApplication,
|
|
1679
|
+
authorizedUser: User,
|
|
1680
|
+
config: Config,
|
|
1681
|
+
setConfigId: (id: string) => void,
|
|
1682
|
+
setSelectedConfigs: (selectedConfigs: { [id: string]: boolean | number[] }) => void,
|
|
1683
|
+
workspace: Workspace,
|
|
1684
|
+
debug: boolean): Promise<APIResult>
|
|
1685
|
+
{
|
|
1678
1686
|
let result: APIResult = new APIResult();
|
|
1679
1687
|
if (config.id === "1") {
|
|
1680
|
-
result = await configPost(instance, authorizedUser, config,
|
|
1688
|
+
result = await configPost(instance, authorizedUser, config, workspace.id, debug);
|
|
1689
|
+
if (result.result) {
|
|
1690
|
+
// config id was updated from "1"
|
|
1691
|
+
setConfigId(config.id);
|
|
1692
|
+
// set this config as the selected config
|
|
1693
|
+
const newSelection = {};
|
|
1694
|
+
Object.defineProperty(newSelection, config.id, { value: true, writable: true, enumerable: true });
|
|
1695
|
+
setSelectedConfigs(newSelection);
|
|
1696
|
+
// update associated configs in this workspace
|
|
1697
|
+
let idx: number = workspace.associatedConfigs.findIndex((id: string) => id == "1");
|
|
1698
|
+
if (idx !== -1) {
|
|
1699
|
+
workspace.associatedConfigs.splice(idx, 1);
|
|
1700
|
+
workspace.associatedConfigs.push(config.id);
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1681
1703
|
}
|
|
1682
1704
|
else {
|
|
1683
1705
|
result = await configPut(instance, authorizedUser, config, debug);
|
|
@@ -1788,14 +1810,12 @@ function processReturnedAdmins(workspace: Workspace, ii: InitInfo, returnedAdmin
|
|
|
1788
1810
|
if (dummyIndex !== -1) {
|
|
1789
1811
|
// clear and overwrite dummy
|
|
1790
1812
|
user = ii.us.at(dummyIndex);
|
|
1791
|
-
// replace dummy User oid "1" with real oid in associatedTenants of
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
}
|
|
1798
|
-
});
|
|
1813
|
+
// replace dummy User oid "1" with real oid in associatedTenants of this workspace
|
|
1814
|
+
let idx: number = workspace.associatedUsers.findIndex((oid: string) => oid == "1");
|
|
1815
|
+
if (idx !== -1) {
|
|
1816
|
+
workspace.associatedUsers.splice(idx, 1);
|
|
1817
|
+
workspace.associatedUsers.push(item.userId);
|
|
1818
|
+
}
|
|
1799
1819
|
}
|
|
1800
1820
|
else {
|
|
1801
1821
|
// create and track new user
|
|
@@ -1826,6 +1846,7 @@ function processReturnedAdmins(workspace: Workspace, ii: InitInfo, returnedAdmin
|
|
|
1826
1846
|
let idx = workspace.associatedUsers.findIndex((u) => u === user.oid);
|
|
1827
1847
|
if (idx == -1) workspace.associatedUsers.push(user.oid);
|
|
1828
1848
|
});
|
|
1849
|
+
ii.save();
|
|
1829
1850
|
}
|
|
1830
1851
|
function processReturnedTenants(workspace: Workspace, ii: InitInfo, returnedTenants: Array<Object>) {
|
|
1831
1852
|
returnedTenants.map((item) => {
|
|
@@ -1838,14 +1859,12 @@ function processReturnedTenants(workspace: Workspace, ii: InitInfo, returnedTena
|
|
|
1838
1859
|
if (dummyIndex !== -1) {
|
|
1839
1860
|
// clear and overwrite dummy
|
|
1840
1861
|
tenant = ii.ts.at(dummyIndex);
|
|
1841
|
-
// replace dummy Tenant id "1" with real id in associatedTenants of
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
}
|
|
1848
|
-
});
|
|
1862
|
+
// replace dummy Tenant id "1" with real id in associatedTenants of this workspace
|
|
1863
|
+
let idx: number = workspace.associatedTenants.findIndex((tid: string) => tid == "1");
|
|
1864
|
+
if (idx !== -1) {
|
|
1865
|
+
workspace.associatedTenants.splice(idx, 1);
|
|
1866
|
+
workspace.associatedTenants.push(item.tenantId);
|
|
1867
|
+
}
|
|
1849
1868
|
} else {
|
|
1850
1869
|
// create and track new tenant
|
|
1851
1870
|
tenant = new Tenant();
|
|
@@ -1871,6 +1890,7 @@ function processReturnedTenants(workspace: Workspace, ii: InitInfo, returnedTena
|
|
|
1871
1890
|
let idx = workspace.associatedTenants.findIndex((t) => t === item.tenantId);
|
|
1872
1891
|
if (idx == -1) workspace.associatedTenants.push(item.tenantId);
|
|
1873
1892
|
});
|
|
1893
|
+
ii.save();
|
|
1874
1894
|
}
|
|
1875
1895
|
function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConfigs: Array<Object>) {
|
|
1876
1896
|
// process returned configs
|
|
@@ -1884,14 +1904,12 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
|
|
|
1884
1904
|
if (dummyIndex !== -1) {
|
|
1885
1905
|
// clear and overwrite dummy
|
|
1886
1906
|
config = ii.cs.at(dummyIndex);
|
|
1887
|
-
// replace dummy Config id "1" with real id in associatedConfigs of
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
}
|
|
1894
|
-
});
|
|
1907
|
+
// replace dummy Config id "1" with real id in associatedConfigs of this workspace
|
|
1908
|
+
let idx: number = workspace.associatedConfigs.findIndex((id: string) => id == "1");
|
|
1909
|
+
if (idx !== -1) {
|
|
1910
|
+
workspace.associatedConfigs.splice(idx, 1);
|
|
1911
|
+
workspace.associatedConfigs.push(item.id);
|
|
1912
|
+
}
|
|
1895
1913
|
} else {
|
|
1896
1914
|
// create and track new workspace
|
|
1897
1915
|
config = new Config();
|
|
@@ -1902,6 +1920,7 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
|
|
|
1902
1920
|
config = ii.cs.at(csIndex);
|
|
1903
1921
|
}
|
|
1904
1922
|
config!.id = item.id;
|
|
1923
|
+
config!.workspaceId = item.workspaceId;
|
|
1905
1924
|
config!.name = item.name;
|
|
1906
1925
|
config!.description = item.description;
|
|
1907
1926
|
config!.isEnabled = item.isEnabled;
|
|
@@ -1924,6 +1943,7 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
|
|
|
1924
1943
|
let idx = workspace.associatedConfigs.findIndex((c) => c === item.id);
|
|
1925
1944
|
if (idx == -1) workspace.associatedConfigs.push(item.id);
|
|
1926
1945
|
});
|
|
1946
|
+
ii.save();
|
|
1927
1947
|
}
|
|
1928
1948
|
async function workspaceInfoGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, debug: boolean): Promise<APIResult> {
|
|
1929
1949
|
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.
|
|
4
|
+
"version": "1.0.61",
|
|
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
|
Binary file
|