@mindline/sync 1.0.34 → 1.0.36
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 -1
- package/.vs/slnx.sqlite +0 -0
- package/.vs/sync/FileContentIndex/65b0b1c9-0b62-4457-8808-4e1317638277.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/README.md +11 -7
- package/hybridspa.ts +9 -12
- package/index.d.ts +174 -173
- package/index.ts +51 -7
- package/package.json +2 -1
- package/.vs/sync/FileContentIndex/d66b84a1-9161-4980-846d-006358a14cf0.vsidx +0 -0
package/.vs/slnx.sqlite
CHANGED
|
Binary file
|
package/.vs/sync/v17/.wsuo
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -17,13 +17,17 @@ npm install @azure/msal-browser --save
|
|
|
17
17
|
# 2. Latest releases
|
|
18
18
|
# 3. API references
|
|
19
19
|
# 4. Unit Test
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
npm test
|
|
21
22
|
# 6. Publish
|
|
22
|
-
|
|
23
|
-
username, password, OTP code required
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
|
|
24
|
+
username, password, OTP code required to publish package
|
|
25
|
+
|
|
26
|
+
npm login
|
|
27
|
+
npm version patch
|
|
28
|
+
npm publish --access=public --otp=XXXXXX
|
|
29
|
+
npm publish --dry-run
|
|
30
|
+
|
|
31
|
+
|
|
28
32
|
# 7. Contribute
|
|
29
33
|
TODO: Explain how other users and developers can contribute to make your code better.
|
package/hybridspa.ts
CHANGED
|
@@ -112,7 +112,6 @@ export async function adminDelete(
|
|
|
112
112
|
let url: URL | null = null;
|
|
113
113
|
if (user.oid !== user.mail) {
|
|
114
114
|
url = new URL(graphConfig.adminEndpoint);
|
|
115
|
-
url.searchParams.append("userId", user.oid);
|
|
116
115
|
url.searchParams.append("workspaceId", workspaceId);
|
|
117
116
|
}
|
|
118
117
|
// or of an incomplete admin?
|
|
@@ -414,13 +413,14 @@ export async function configPut(
|
|
|
414
413
|
// if last character is } we need a comma first
|
|
415
414
|
let needComma: boolean = configBody.slice(-1) === "}";
|
|
416
415
|
if (needComma) configBody += ",";
|
|
417
|
-
//
|
|
416
|
+
// TODO: more sophisticated source tenant user filtering
|
|
418
417
|
configBody += `{
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
418
|
+
"tenantId": "${tci.tid}",
|
|
419
|
+
"sourceGroupId": "${tci.sourceGroupId}",
|
|
420
|
+
"sourceGroupName": "${tci.sourceGroupName}",
|
|
421
|
+
"configurationTenantType": "${tci.configurationTenantType}",
|
|
422
|
+
"deltaToken": "${tci.deltaToken}"
|
|
423
|
+
}`;
|
|
424
424
|
});
|
|
425
425
|
configBody += `]}`;
|
|
426
426
|
let options = { method: "PUT", headers: headers, body: configBody };
|
|
@@ -805,9 +805,8 @@ export async function workspacesGet(
|
|
|
805
805
|
}
|
|
806
806
|
// create workspaces endpoint
|
|
807
807
|
let workspaceEndpoint: string = graphConfig.workspaceEndpoint;
|
|
808
|
-
//
|
|
808
|
+
// create workspace endpoint
|
|
809
809
|
let url: URL = new URL(workspaceEndpoint);
|
|
810
|
-
url.searchParams.append("userEmail", user.mail);
|
|
811
810
|
// create workspace headers
|
|
812
811
|
const headers = await defineHeaders(instance, authorizedUser);
|
|
813
812
|
// make workspace endpoint call
|
|
@@ -864,14 +863,12 @@ export async function readerPost(
|
|
|
864
863
|
return result;
|
|
865
864
|
}
|
|
866
865
|
// create reader endpoint with config ID
|
|
867
|
-
|
|
868
|
-
let readerEndpoint: string = graphConfig.readerApiEndpoint + config.id;
|
|
866
|
+
let readerEndpoint: string = graphConfig.readerStartSyncEndpoint + config.id;
|
|
869
867
|
// create headers
|
|
870
868
|
const headers = await defineHeaders(instance, authorizedUser);
|
|
871
869
|
// make reader endpoint call
|
|
872
870
|
let options = { method: "POST", headers: headers };
|
|
873
871
|
try {
|
|
874
|
-
debugger;
|
|
875
872
|
console.log("Attempting POST to /startSync: " + readerEndpoint);
|
|
876
873
|
let response = await fetch(readerEndpoint, options);
|
|
877
874
|
if (response.status === 200 && response.statusText === "OK") {
|
package/index.d.ts
CHANGED
|
@@ -1,185 +1,186 @@
|
|
|
1
1
|
import { IPublicClientApplication } from "@azure/msal-browser";
|
|
2
2
|
|
|
3
3
|
declare module "@mindline/sync" {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export function sum(a: number, b: number): number;
|
|
5
|
+
export function helloNpm(): string;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
7
|
+
export class Group {
|
|
8
|
+
id: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
// admin
|
|
13
|
+
export class User {
|
|
14
|
+
oid: string; // from AAD ID token
|
|
15
|
+
name: string; // from AAD ID token
|
|
16
|
+
mail: string; // from AAD ID token TODO: preferred_username *may* differ from UPN, may differ from mail
|
|
17
|
+
authority: string; // from AAD auth response - cloud instance login endpoint
|
|
18
|
+
tid: string; // from AAD ID token
|
|
19
|
+
companyName: string; // findTenantInformationByTenantId TODO: process changes to company name
|
|
20
|
+
companyDomain: string; // findTenantInformationByTenantId TODO: process changes to company name
|
|
21
|
+
associatedWorkspaces: string[];
|
|
22
|
+
workspaceIDs: string;
|
|
23
|
+
session: string;
|
|
24
|
+
spacode: string;
|
|
25
|
+
accessToken: string;
|
|
26
|
+
loginHint: string;
|
|
27
|
+
scopes: string[];
|
|
28
|
+
authTS: Date;
|
|
29
|
+
constructor();
|
|
30
|
+
}
|
|
31
|
+
// tenant (Azure AD tenant, AD domain, Google workspace)
|
|
32
|
+
export enum TenantType {
|
|
33
|
+
invalid = 0,
|
|
34
|
+
aad = 1,
|
|
35
|
+
ad = 2,
|
|
36
|
+
googleworkspace = 3
|
|
37
|
+
}
|
|
38
|
+
type TenantTypeStrings = keyof typeof TenantType;
|
|
39
|
+
export enum TenantPermissionType {
|
|
40
|
+
read = 1,
|
|
41
|
+
write = 2,
|
|
42
|
+
notassigned = 3
|
|
43
|
+
}
|
|
44
|
+
type TenantPermissionTypeStrings = keyof typeof TenantPermissionType;
|
|
45
|
+
export class Tenant {
|
|
46
|
+
tid: string; // from AAD ID token
|
|
47
|
+
name: string; // findTenantInformationByTenantId
|
|
48
|
+
domain: string; // findTenantInformationByTenantId
|
|
49
|
+
tenantType: TenantTypeStrings; // always "aad" for now
|
|
50
|
+
permissionType: TenantPermissionTypeStrings; // read/write/notassigned
|
|
51
|
+
onboarded: string; // have we onboarded this tenant? "true" or "false"
|
|
52
|
+
authority: string; // from AAD ID auth response
|
|
53
|
+
readServicePrincipal: string; // from AAD consent
|
|
54
|
+
writeServicePrincipal: string; // from AAD consent
|
|
55
|
+
workspaceIDs: string;
|
|
56
|
+
constructor();
|
|
57
|
+
}
|
|
58
|
+
// config
|
|
59
|
+
export enum TenantConfigType {
|
|
60
|
+
source = 1,
|
|
61
|
+
target = 2,
|
|
62
|
+
sourcetarget = 3
|
|
63
|
+
}
|
|
64
|
+
export type TenantConfigTypeStrings = keyof typeof TenantConfigType;
|
|
65
|
+
export class TenantConfigInfo {
|
|
66
|
+
tid: string; // tenant identifier
|
|
67
|
+
sourceGroupId: string; // source group - we can configure source group for reading
|
|
68
|
+
sourceGroupName: string; // source group - we can configure source group for reading
|
|
69
|
+
configurationTenantType: TenantConfigTypeStrings;
|
|
70
|
+
deltaToken: string;
|
|
71
|
+
filesWritten: number;
|
|
72
|
+
configId: string;
|
|
73
|
+
}
|
|
74
|
+
export class Config {
|
|
75
|
+
id: string;
|
|
76
|
+
workspaceId: string;
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
tenants: TenantConfigInfo[];
|
|
80
|
+
isEnabled: boolean;
|
|
81
|
+
workspaceIDs: string;
|
|
82
|
+
constructor();
|
|
83
|
+
}
|
|
84
|
+
// class to group Users, Tenants, and Configs
|
|
85
|
+
export class Workspace {
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
associatedUsers: string[];
|
|
89
|
+
associatedTenants: string[];
|
|
90
|
+
associatedConfigs: string[];
|
|
91
|
+
constructor();
|
|
92
|
+
}
|
|
93
|
+
export class InitInfo {
|
|
94
|
+
us: User[];
|
|
95
|
+
ts: Tenant[];
|
|
96
|
+
cs: Config[];
|
|
97
|
+
ws: Workspace[];
|
|
98
|
+
constructor(bClearLocalStorage: boolean);
|
|
99
|
+
init(bClearLocalStorage: boolean): void;
|
|
100
|
+
save(): void;
|
|
101
|
+
tagWithWorkspaces(): boolean;
|
|
102
|
+
}
|
|
103
|
+
export type TaskType = "initialization" |
|
|
101
104
|
"authenticate user" |
|
|
102
105
|
"reload React" |
|
|
103
106
|
"PUT access token" |
|
|
104
107
|
"GET tenant details" |
|
|
105
108
|
"POST config init" |
|
|
106
109
|
"GET workspaces" |
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
110
|
+
"onboard tenant" |
|
|
111
|
+
"create 2nd tenant" |
|
|
112
|
+
"invite 2nd admin" |
|
|
113
|
+
"onboard 2nd tenant" |
|
|
114
|
+
"create config";
|
|
115
|
+
export class TaskArray {
|
|
116
|
+
tasks: Task[];
|
|
117
|
+
constructor(bClearLocalStorage: boolean);
|
|
118
|
+
init(bClearLocalStorage: boolean): void;
|
|
119
|
+
setTaskStart(taskType: TaskType, startDate: Date): void;
|
|
120
|
+
setTaskEnd(taskType: TaskType, startDate: Date, status: string): void;
|
|
121
|
+
}
|
|
122
|
+
export class Task {
|
|
123
|
+
id: number;
|
|
124
|
+
task: string;
|
|
125
|
+
start: Date;
|
|
126
|
+
startDisplay: string;
|
|
127
|
+
end: Date;
|
|
128
|
+
endDisplay: string;
|
|
129
|
+
elapsedDisplay: string;
|
|
130
|
+
expected: number;
|
|
131
|
+
status: string;
|
|
132
|
+
expanded: boolean;
|
|
133
|
+
subtasks: Task[];
|
|
134
|
+
setEnd(endDate: Date): void;
|
|
135
|
+
setStart(startDate: Date): void;
|
|
136
|
+
}
|
|
137
|
+
export class BatchArray {
|
|
138
|
+
tenantNodes: TenantNode[];
|
|
139
|
+
constructor(config: Config|null, syncPortalGlobalState: InitInfo|null, bClearLocalStorage: boolean);
|
|
140
|
+
// populate tenantNodes based on config tenants
|
|
141
|
+
init(config: Config|null, syncPortalGlobalState: InitInfo|null, bClearLocalStorage: boolean): void;
|
|
142
|
+
startSync(instance: IPublicClientApplication, authorizedUser: User|null|undefined, config: Config|null|undefined): void;
|
|
143
|
+
}
|
|
144
|
+
export class TenantNode {
|
|
145
|
+
expanded: boolean;
|
|
146
|
+
status: string;
|
|
147
|
+
name: string;
|
|
148
|
+
tid: string;
|
|
149
|
+
total: number;
|
|
150
|
+
read: number;
|
|
151
|
+
written: number;
|
|
152
|
+
deferred: number;
|
|
153
|
+
targets: TenantNode[];
|
|
154
|
+
constructor(tid: string, name: string);
|
|
155
|
+
update(total: number, read: number, written: number, deferred: number): void;
|
|
156
|
+
}
|
|
157
|
+
export class APIResult {
|
|
158
|
+
result: boolean;
|
|
159
|
+
status: number;
|
|
160
|
+
error: string;
|
|
161
|
+
constructor();
|
|
162
|
+
}
|
|
163
|
+
//
|
|
164
|
+
// Azure AD Graph API
|
|
165
|
+
//
|
|
166
|
+
export function groupGet(tenant: Tenant, groupid: string): Promise<{group: string, error: string}>;
|
|
167
|
+
export function groupsGet(tenant: Tenant, groupSearchString: string): Promise<{groups: Group[], error: string}>;
|
|
168
|
+
export function signIn(user: User, tasks: TaskArray): void;
|
|
169
|
+
export function signInIncrementally(user: User, scope: string): void;
|
|
170
|
+
export function signOut(user: User): void;
|
|
171
|
+
export function tenantRelationshipsGetByDomain(loggedInuser: User, tenant: Tenant, instance: IPublicClientApplication, debug: boolean): boolean;
|
|
172
|
+
export function tenantRelationshipsGetById(user: User, ii: InitInfo, instance: IPublicClientApplication, tasks: TaskArray, debug: boolean): boolean;
|
|
173
|
+
export function usersGet(tenant: Tenant): {users: string[], error: string};
|
|
174
|
+
//
|
|
175
|
+
// Mindline Config API
|
|
176
|
+
//
|
|
177
|
+
export function configEdit(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): APIResult;
|
|
178
|
+
export function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): APIResult;
|
|
179
|
+
export function configsRefresh(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, ii: InitInfo, debug: boolean): APIResult;
|
|
180
|
+
export function initGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): APIResult;
|
|
181
|
+
export function tenantAdd(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string): APIResult;
|
|
182
|
+
export function tenantComplete(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, debug: boolean): APIResult;
|
|
183
|
+
export function tenantRemove(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string, debug: boolean): APIResult;
|
|
184
|
+
export function userAdd(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
|
181
185
|
export function userRemove(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
|
182
|
-
//
|
|
183
|
-
// Mindline Sync API
|
|
184
|
-
//
|
|
185
186
|
}
|
package/index.ts
CHANGED
|
@@ -104,11 +104,17 @@ export class TenantConfigInfo {
|
|
|
104
104
|
sourceGroupId: string;
|
|
105
105
|
sourceGroupName: string;
|
|
106
106
|
configurationTenantType: TenantConfigTypeStrings;
|
|
107
|
+
deltaToken: string;
|
|
108
|
+
filesWritten: number;
|
|
109
|
+
configId: string;
|
|
107
110
|
constructor() {
|
|
108
111
|
this.tid = "";
|
|
109
112
|
this.sourceGroupId = "";
|
|
110
113
|
this.sourceGroupName = "";
|
|
111
114
|
this.configurationTenantType = "source";
|
|
115
|
+
this.deltaToken = "";
|
|
116
|
+
this.filesWritten = 0;
|
|
117
|
+
this.configId = "";
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
export class Config {
|
|
@@ -643,18 +649,25 @@ export class BatchArray {
|
|
|
643
649
|
}
|
|
644
650
|
}
|
|
645
651
|
*/
|
|
646
|
-
//
|
|
647
|
-
startSync(instance: IPublicClientApplication, authorizedUser: User | undefined, config: Config | null | undefined): void {
|
|
652
|
+
// start a sync cycle
|
|
653
|
+
startSync(instance: IPublicClientApplication, authorizedUser: User | null | undefined, config: Config | null | undefined): void {
|
|
648
654
|
if (this.tenantNodes == null || this.tenantNodes.length == 0) {
|
|
649
655
|
// we should not have an empty batch array for a test
|
|
650
656
|
debugger;
|
|
651
657
|
}
|
|
658
|
+
// start SignalR connection
|
|
659
|
+
const connection = new signalR.HubConnectionBuilder() // SignalR initialization
|
|
660
|
+
.withUrl("https://dev-signalrdispatcher-westus.azurewebsites.net/statsHub?statsId=df9c2e0a-f6fe-43bb-a155-d51f66dffe0e", { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets } )
|
|
661
|
+
.configureLogging(signalR.LogLevel.Information)
|
|
662
|
+
.build();
|
|
663
|
+
// when you get a message, log the message
|
|
664
|
+
connection.on("newMessage", function (message) {
|
|
665
|
+
console.log(message); // log the message
|
|
666
|
+
});
|
|
667
|
+
connection.start().catch(console.error);
|
|
652
668
|
// execute post to reader endpoint
|
|
653
669
|
readerPost(instance, authorizedUser, config);
|
|
654
|
-
|
|
655
|
-
// start SignalR connection
|
|
656
|
-
//debugger;
|
|
657
|
-
//monitorSyncProgress();
|
|
670
|
+
// refresh delta tokens for this Configuration (we read all Configurations at once)
|
|
658
671
|
}
|
|
659
672
|
}
|
|
660
673
|
export class TenantNode {
|
|
@@ -966,6 +979,34 @@ export async function configEdit(instance: IPublicClientApplication, authorizedU
|
|
|
966
979
|
export async function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): Promise<APIResult> {
|
|
967
980
|
return configDelete(instance, authorizedUser, config, workspaceId, debug);
|
|
968
981
|
}
|
|
982
|
+
export async function configsRefresh(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, ii: InitInfo, debug: boolean): Promise<APIResult> {
|
|
983
|
+
let result: APIResult = new APIResult();
|
|
984
|
+
if (debug) debugger;
|
|
985
|
+
try {
|
|
986
|
+
let workspace: Workspace = ii.ws.find((w) => w.id === workspaceId);
|
|
987
|
+
if (workspace != null) {
|
|
988
|
+
// clear Config associations as we are about to reset
|
|
989
|
+
workspace.associatedConfigs.length = 0;
|
|
990
|
+
// GET configs associated with this workspace
|
|
991
|
+
let configsPromise: Promise<APIResult> = configsGet(instance, authorizedUser, workspace.id, debug);
|
|
992
|
+
// wait for query to finish, return on any failure
|
|
993
|
+
let [configsResult] = await Promise.all([configsPromise]);
|
|
994
|
+
if (!configsResult.result) return configsResult;
|
|
995
|
+
// process returned workspace components
|
|
996
|
+
processReturnedConfigs(workspace, ii, configsResult.array!);
|
|
997
|
+
// tag components with workspaceIDs
|
|
998
|
+
ii.tagWithWorkspaces();
|
|
999
|
+
}
|
|
1000
|
+
return result;
|
|
1001
|
+
}
|
|
1002
|
+
catch (error: any) {
|
|
1003
|
+
console.log(error.message);
|
|
1004
|
+
result.error = error.message;
|
|
1005
|
+
}
|
|
1006
|
+
result.result = false;
|
|
1007
|
+
result.status = 500;
|
|
1008
|
+
return result;
|
|
1009
|
+
}
|
|
969
1010
|
// retrieve Workspace(s), User(s), Tenant(s), Config(s) given newly logged in user
|
|
970
1011
|
export async function initGet(instance: IPublicClientApplication, authorizedUser: User, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): Promise<APIResult> {
|
|
971
1012
|
let result: APIResult = new APIResult();
|
|
@@ -982,9 +1023,10 @@ export async function initGet(instance: IPublicClientApplication, authorizedUser
|
|
|
982
1023
|
if (result.result) {
|
|
983
1024
|
tasks.setTaskStart("GET workspaces", new Date());
|
|
984
1025
|
result = await workspaceInfoGet(instance, authorizedUser, user, ii, debug);
|
|
985
|
-
tasks.setTaskEnd("GET workspaces", new Date(), result ? "complete" : "failed");
|
|
1026
|
+
tasks.setTaskEnd("GET workspaces", new Date(), result.result ? "complete" : "failed");
|
|
986
1027
|
}
|
|
987
1028
|
if (result.result) result.error = version;
|
|
1029
|
+
else console.log("@mindline/sync package version: " + version);
|
|
988
1030
|
return result;
|
|
989
1031
|
}
|
|
990
1032
|
export async function tenantAdd(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string): Promise<APIResult> {
|
|
@@ -1104,6 +1146,8 @@ function processReturnedConfigs(workspace: Workspace, ii: InitInfo, returnedConf
|
|
|
1104
1146
|
tenantConfigInfo.sourceGroupId = tci.sourceGroupId;
|
|
1105
1147
|
tenantConfigInfo.sourceGroupName = tci.sourceGroupName;
|
|
1106
1148
|
tenantConfigInfo.configurationTenantType = tci.configurationTenantType.toLowerCase();
|
|
1149
|
+
tenantConfigInfo.deltaToken = tci.deltaToken ?? "";
|
|
1150
|
+
tenantConfigInfo.configId = config!.id;
|
|
1107
1151
|
config!.tenants.push(tenantConfigInfo);
|
|
1108
1152
|
});
|
|
1109
1153
|
// ensure this workspace tracks this config
|
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.36",
|
|
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.",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"vitest": "^0.29.8"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@microsoft/signalr": "^7.0.10",
|
|
19
20
|
"class-transformer": "^0.5.1",
|
|
20
21
|
"reflect-metadata": "^0.1.13"
|
|
21
22
|
}
|
|
Binary file
|