@mindline/sync 1.0.9 → 1.0.10
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/index.js +12 -4
- package/index.test.js +4 -5
- package/package.json +1 -1
- package/sync.d.ts +10 -2
package/index.js
CHANGED
|
@@ -20,6 +20,14 @@ export class User {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export class UserConfigInfo {
|
|
24
|
+
constructor(){
|
|
25
|
+
this.vts = null;
|
|
26
|
+
this.sts = null;
|
|
27
|
+
this.scs = null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
// shared base class of virtual and sync tenants
|
|
24
32
|
export class Tenant {
|
|
25
33
|
constructor(){
|
|
@@ -82,7 +90,7 @@ export function readobjects() {
|
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
// retrievesync configurations based on passed user information
|
|
85
|
-
export function readConfigs(user,
|
|
93
|
+
export function readConfigs(user, userConfigInfo)
|
|
86
94
|
{
|
|
87
95
|
debugger;
|
|
88
96
|
// for now, just get hardcoded data from JSON
|
|
@@ -90,9 +98,9 @@ export function readConfigs(user, virtuals, syncs, configs)
|
|
|
90
98
|
var syncTenantsString = JSON.stringify(syncTenants);
|
|
91
99
|
var syncConfigsString = JSON.stringify(syncConfigs);
|
|
92
100
|
try {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
userConfigInfo.vts = deserializeArray(VirtualTenant, virtualTenantsString);
|
|
102
|
+
userConfigInfo.sts = deserializeArray(SyncTenant, syncTenantsString);
|
|
103
|
+
userConfigInfo.scs = deserializeArray(SyncConfig, syncConfigsString);
|
|
96
104
|
} catch (e) {
|
|
97
105
|
debugger;
|
|
98
106
|
return false;
|
package/index.test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {sum, readobjects, readConfigs, User, VirtualTenant, SyncTenant, SyncConfig} from "./index.js";
|
|
1
|
+
import {sum, readobjects, readConfigs, User, UserConfigInfo, VirtualTenant, SyncTenant, SyncConfig} from "./index.js";
|
|
2
2
|
import {test, expect} from "vitest";
|
|
3
3
|
|
|
4
4
|
test("adds 1 + 2 to equal 3", () => {
|
|
@@ -9,8 +9,7 @@ test("loads array of VirtualTenants from JSON and expects 2", () => {
|
|
|
9
9
|
});
|
|
10
10
|
test("loads config based on a user and expects function to return true", () => {
|
|
11
11
|
let u = new User();
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
expect(readConfigs(u, vts, sts, scs)).toBe(true);
|
|
12
|
+
let uci = new UserConfigInfo();
|
|
13
|
+
expect(readConfigs(u, uci)).toBe(true);
|
|
14
|
+
expect(uci.vts.length).toBe(2);
|
|
16
15
|
});
|
package/package.json
CHANGED
package/sync.d.ts
CHANGED
|
@@ -2,13 +2,21 @@ declare module "@mindline/sync" {
|
|
|
2
2
|
export function sum(a: number, b: number): number;
|
|
3
3
|
export function helloNpm(): string;
|
|
4
4
|
|
|
5
|
+
// user information passed to back end
|
|
5
6
|
export class User {
|
|
6
7
|
authority: string; // from AAD
|
|
7
8
|
oid: string; // from AAD
|
|
8
9
|
tid: string; // from AAD
|
|
9
10
|
upn: string; // from AAD
|
|
10
11
|
name: string; // from AAD
|
|
11
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// configuration information returned by back end
|
|
15
|
+
export class UserConfigInfo {
|
|
16
|
+
vts: VirtualTenant[];
|
|
17
|
+
sts: SyncTenant[];
|
|
18
|
+
scs: SyncConfig[];
|
|
19
|
+
}
|
|
12
20
|
|
|
13
21
|
// shared base class of virtual and sync tenants
|
|
14
22
|
export class Tenant {
|
|
@@ -39,5 +47,5 @@ declare module "@mindline/sync" {
|
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export function readobjects(): number;
|
|
42
|
-
export function readConfigs(u: User,
|
|
50
|
+
export function readConfigs(u: User, uci: UserConfigInfo): boolean;
|
|
43
51
|
}
|