@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.
@@ -2,6 +2,6 @@
2
2
  "ExpandedNodes": [
3
3
  ""
4
4
  ],
5
- "SelectedNode": "\\index.d.ts",
5
+ "SelectedNode": "\\index.ts",
6
6
  "PreviewInSolutionExplorer": false
7
7
  }
package/.vs/slnx.sqlite CHANGED
Binary file
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
- ### `npm test`
20
+
21
+ npm test
21
22
  # 6. Publish
22
- ### `npm login`
23
- username, password, OTP code required
24
- ### `npm publish --access=public --otp=XXXXXX`
25
- ### `npm publish --dry-run`
26
- publishes package
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
- readerEndpoint: "https://dev-fn-reader-westus.azurewebsites.net/api/startSync/"
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
- // decide whethere to send source group values
416
+ // TODO: more sophisticated source tenant user filtering
417
417
  configBody += `{
418
- "tenantId": "${tci.tid}",
419
- "sourceGroupId": "${tci.sourceGroupId}",
420
- "sourceGroupName": "${tci.sourceGroupName}",
421
- "configurationTenantType": "${tci.configurationTenantType}"
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
- // add email parameter to endpoint
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.readerEndpoint + config.id;
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
- 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;
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
- test(instance: IPublicClientApplication, authorizedUser: User|undefined, config: Config|null|undefined): void;
141
+ startSync(instance: IPublicClientApplication, authorizedUser: User|null|undefined, config: Config|null|undefined): void;
140
142
  }
141
143
  export class TenantNode {
142
144
  expanded: boolean;