@mindline/sync 1.0.33 → 1.0.35
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/1fe38d21-0fca-4d45-9e42-8c354c1a37f7.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/README.md +11 -6
- package/hybridspa.ts +17 -12
- package/index.d.ts +7 -5
- package/index.ts +1035 -934
- package/package.json +1 -1
- package/.vs/sync/FileContentIndex/0ce1eeba-1f09-47e1-a427-aa0c39a8194a.vsidx +0 -0
package/.vs/slnx.sqlite
CHANGED
|
Binary file
|
package/.vs/sync/v17/.wsuo
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -17,12 +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
|
-
|
|
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
|
+
|
|
27
32
|
# 7. Contribute
|
|
28
33
|
TODO: Explain how other users and developers can contribute to make your code better.
|
package/hybridspa.ts
CHANGED
|
@@ -42,7 +42,8 @@ export const graphConfig = {
|
|
|
42
42
|
"https://graph.microsoft.com/beta/tenantRelationships/findTenantInformationByTenantId",
|
|
43
43
|
graphUsersEndpoint: "https://graph.microsoft.com/v1.0/users",
|
|
44
44
|
// reader endpoint to trigger sync start
|
|
45
|
-
|
|
45
|
+
readerStartSyncEndpoint: "https://dev-fn-reader-westus.azurewebsites.net/api/startSync/",
|
|
46
|
+
readerApiEndpoint: "https://dev-fn-reader-westus.azurewebsites.net/api/lookup/"
|
|
46
47
|
};
|
|
47
48
|
// helper functions
|
|
48
49
|
async function defineHeaders(
|
|
@@ -111,7 +112,6 @@ export async function adminDelete(
|
|
|
111
112
|
let url: URL | null = null;
|
|
112
113
|
if (user.oid !== user.mail) {
|
|
113
114
|
url = new URL(graphConfig.adminEndpoint);
|
|
114
|
-
url.searchParams.append("userId", user.oid);
|
|
115
115
|
url.searchParams.append("workspaceId", workspaceId);
|
|
116
116
|
}
|
|
117
117
|
// or of an incomplete admin?
|
|
@@ -413,13 +413,14 @@ export async function configPut(
|
|
|
413
413
|
// if last character is } we need a comma first
|
|
414
414
|
let needComma: boolean = configBody.slice(-1) === "}";
|
|
415
415
|
if (needComma) configBody += ",";
|
|
416
|
-
//
|
|
416
|
+
// TODO: more sophisticated source tenant user filtering
|
|
417
417
|
configBody += `{
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
"tenantId": "${tci.tid}",
|
|
419
|
+
"sourceGroupId": "${tci.sourceGroupId}",
|
|
420
|
+
"sourceGroupName": "${tci.sourceGroupName}",
|
|
421
|
+
"configurationTenantType": "${tci.configurationTenantType}",
|
|
422
|
+
"deltaToken": "${tci.deltaToken}"
|
|
423
|
+
}`;
|
|
423
424
|
});
|
|
424
425
|
configBody += `]}`;
|
|
425
426
|
let options = { method: "PUT", headers: headers, body: configBody };
|
|
@@ -804,9 +805,8 @@ export async function workspacesGet(
|
|
|
804
805
|
}
|
|
805
806
|
// create workspaces endpoint
|
|
806
807
|
let workspaceEndpoint: string = graphConfig.workspaceEndpoint;
|
|
807
|
-
//
|
|
808
|
+
// create workspace endpoint
|
|
808
809
|
let url: URL = new URL(workspaceEndpoint);
|
|
809
|
-
url.searchParams.append("userEmail", user.mail);
|
|
810
810
|
// create workspace headers
|
|
811
811
|
const headers = await defineHeaders(instance, authorizedUser);
|
|
812
812
|
// make workspace endpoint call
|
|
@@ -863,17 +863,22 @@ export async function readerPost(
|
|
|
863
863
|
return result;
|
|
864
864
|
}
|
|
865
865
|
// create reader endpoint with config ID
|
|
866
|
-
let readerEndpoint: string = graphConfig.
|
|
866
|
+
//let readerEndpoint: string = graphConfig.readerStartSyncEndpoint + config.id;
|
|
867
|
+
let readerEndpoint: string = graphConfig.readerApiEndpoint + config.id;
|
|
867
868
|
// create headers
|
|
868
869
|
const headers = await defineHeaders(instance, authorizedUser);
|
|
869
870
|
// make reader endpoint call
|
|
870
871
|
let options = { method: "POST", headers: headers };
|
|
871
872
|
try {
|
|
872
|
-
console.log("Attempting POST to /startSync: " + readerEndpoint);
|
|
873
873
|
debugger;
|
|
874
|
+
console.log("Attempting POST to /startSync: " + readerEndpoint);
|
|
874
875
|
let response = await fetch(readerEndpoint, options);
|
|
875
876
|
if (response.status === 200 && response.statusText === "OK") {
|
|
876
877
|
console.log(`Successful POST to /startSync: ${readerEndpoint}`);
|
|
878
|
+
|
|
879
|
+
let textResponse = await response.text();
|
|
880
|
+
textResponse = textResponse;
|
|
881
|
+
|
|
877
882
|
return result;
|
|
878
883
|
} else {
|
|
879
884
|
result.error = await processErrors(response);
|
package/index.d.ts
CHANGED
|
@@ -63,10 +63,12 @@ declare module "@mindline/sync" {
|
|
|
63
63
|
}
|
|
64
64
|
export type TenantConfigTypeStrings = keyof typeof TenantConfigType;
|
|
65
65
|
export class TenantConfigInfo {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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;
|
|
70
72
|
}
|
|
71
73
|
export class Config {
|
|
72
74
|
id: string;
|
|
@@ -136,7 +138,7 @@ declare module "@mindline/sync" {
|
|
|
136
138
|
constructor(config: Config|null, syncPortalGlobalState: InitInfo|null, bClearLocalStorage: boolean);
|
|
137
139
|
// populate tenantNodes based on config tenants
|
|
138
140
|
init(config: Config|null, syncPortalGlobalState: InitInfo|null, bClearLocalStorage: boolean): void;
|
|
139
|
-
|
|
141
|
+
startSync(instance: IPublicClientApplication, authorizedUser: User|null|undefined, config: Config|null|undefined): void;
|
|
140
142
|
}
|
|
141
143
|
export class TenantNode {
|
|
142
144
|
expanded: boolean;
|