@mindline/sync 1.0.107 → 1.0.108
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/dist/src/index.d.ts +2 -2
- package/dist/sync.es.js +417 -411
- package/dist/sync.es.js.map +1 -1
- package/dist/sync.umd.js +23 -19
- package/dist/sync.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +14 -14
- package/src/index.ts +17 -6
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ declare module "@mindline/sync" {
|
|
|
4
4
|
export function helloNpm(): string;
|
|
5
5
|
export function getSyncVersion(): string;
|
|
6
6
|
|
|
7
|
-
export class APIResult {
|
|
7
|
+
export class APIResult<T = any> {
|
|
8
8
|
result: boolean;
|
|
9
9
|
status: number;
|
|
10
10
|
error: string;
|
|
11
11
|
version: string;
|
|
12
|
-
array: Array<
|
|
12
|
+
array: Array<T> | null;
|
|
13
13
|
constructor();
|
|
14
14
|
}
|
|
15
15
|
export class azureConfig {
|
|
@@ -189,14 +189,14 @@ declare module "@mindline/sync" {
|
|
|
189
189
|
save(): void;
|
|
190
190
|
tagWithWorkspaces(): boolean;
|
|
191
191
|
}
|
|
192
|
-
export type TaskType = "initialization" |
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
export type TaskType = "initialization" |
|
|
193
|
+
"authenticate user" |
|
|
194
|
+
"reload React" |
|
|
195
|
+
"GET tenant details" |
|
|
196
|
+
"POST config init" |
|
|
197
|
+
"GET workspaces";
|
|
198
198
|
export class TaskArray {
|
|
199
|
-
tasks: Task[];
|
|
199
|
+
tasks: Task[];
|
|
200
200
|
constructor(bClearLocalStorage: boolean);
|
|
201
201
|
init(bClearLocalStorage: boolean): void;
|
|
202
202
|
setTaskStart(taskType: TaskType, startDate: Date): void;
|
|
@@ -257,9 +257,9 @@ declare module "@mindline/sync" {
|
|
|
257
257
|
pb_total: number;
|
|
258
258
|
pb_timer: NodeJS.Timer;
|
|
259
259
|
milestoneArray: MilestoneArray;
|
|
260
|
-
constructor(config: SyncConfig|null, syncPortalGlobalState: InitInfo|null, bClearLocalStorage: boolean);
|
|
260
|
+
constructor(config: SyncConfig | null, syncPortalGlobalState: InitInfo | null, bClearLocalStorage: boolean);
|
|
261
261
|
// populate tenantNodes based on config tenants
|
|
262
|
-
init(config: SyncConfig|null|undefined, syncPortalGlobalState: InitInfo|null, bClearLocalStorage: boolean): void;
|
|
262
|
+
init(config: SyncConfig | null | undefined, syncPortalGlobalState: InitInfo | null, bClearLocalStorage: boolean): void;
|
|
263
263
|
initializeProgressBar(setSyncProgress: (progress: number) => void, setConfigSyncResult: (result: string) => void, setIdleText: (idleText: string) => void, setMilestones: (milestones: Milestone[]) => void): void;
|
|
264
264
|
uninitializeProgressBar(setSyncProgress: (progress: number) => void, setConfigSyncResult: (result: string) => void, setIdleText: (idleText: string) => void, setMilestones: (milestones: Milestone[]) => void): void;
|
|
265
265
|
initializeSignalR(
|
|
@@ -323,7 +323,7 @@ declare module "@mindline/sync" {
|
|
|
323
323
|
}
|
|
324
324
|
// ======================= Azure AD Graph API ===============================
|
|
325
325
|
export function groupsGet(instance: IPublicClientApplication, user: User | undefined, groupSearchString: string): Promise<{ groups: Group[], error: string }>;
|
|
326
|
-
export function oauth2PermissionGrantsGet(options: RequestInit, user: User, spid: string, oid: string): Promise<{grants: string, error: string}>;
|
|
326
|
+
export function oauth2PermissionGrantsGet(options: RequestInit, user: User, spid: string, oid: string): Promise<{ grants: string, error: string }>;
|
|
327
327
|
export function requestAdminConsent(admin: User, tct: TenantConfigType): void;
|
|
328
328
|
export function servicePrincipalGet(options: RequestInit, user: User, appid: string): Promise<{ spid: string, error: string }>;
|
|
329
329
|
export function signIn(user: User, tasks: TaskArray): boolean;
|
|
@@ -338,8 +338,8 @@ declare module "@mindline/sync" {
|
|
|
338
338
|
// ======================= Mindline SyncConfig API ===============================
|
|
339
339
|
export function auditConfigAdd(instance: IPublicClientApplication, user: User, ac: AuditConfig, debug: boolean): Promise<APIResult>;
|
|
340
340
|
export function auditConfigRetrieve(instance: IPublicClientApplication, user: User, configurationId: string, debug: boolean): Promise<APIResult>;
|
|
341
|
-
export function auditConfigEdit(instance: IPublicClientApplication, user: User, configurationId: string, config: AuditConfig, debug: boolean): Promise<APIResult>;
|
|
342
|
-
export function auditConfigRemove(instance: IPublicClientApplication, user: User, configurationId: string, debug: boolean): Promise<APIResult>;
|
|
341
|
+
export function auditConfigEdit(instance: IPublicClientApplication, user: User, configurationId: string, config: AuditConfig, debug: boolean): Promise<APIResult>;
|
|
342
|
+
export function auditConfigRemove(instance: IPublicClientApplication, user: User, configurationId: string, debug: boolean): Promise<APIResult>;
|
|
343
343
|
export function auditEventsRetrieve(instance: IPublicClientApplication, user: User, debug: boolean): Promise<APIResult>;
|
|
344
344
|
export function configEdit(instance: IPublicClientApplication, authorizedUser: User, config: SyncConfig, setConfigId: (id: string) => void, setSelectedConfigs: (selectedConfigs: { [id: string]: boolean | number[] }) => void, workspace: Workspace, ii: InitInfo, debug: boolean): APIResult;
|
|
345
345
|
export function configEnable(instance: IPublicClientApplication, authorizedUser: User, configurationId: string, enabled: boolean, debug: boolean): APIResult;
|
package/src/index.ts
CHANGED
|
@@ -25,12 +25,12 @@ export function getSyncVersion(): string {
|
|
|
25
25
|
// injected at build time
|
|
26
26
|
return __SYNC_VERSION__;
|
|
27
27
|
}
|
|
28
|
-
export class APIResult {
|
|
28
|
+
export class APIResult<T = any> {
|
|
29
29
|
result: boolean;
|
|
30
30
|
status: number;
|
|
31
31
|
error: string;
|
|
32
32
|
version: string;
|
|
33
|
-
array: Array<
|
|
33
|
+
array: Array<T> | null;
|
|
34
34
|
constructor() { this.result = true; this.status = 200; this.error = ""; this.version = getSyncVersion(); this.array = null; }
|
|
35
35
|
}
|
|
36
36
|
export class azureConfig {
|
|
@@ -2106,6 +2106,12 @@ export async function configEdit(
|
|
|
2106
2106
|
result = await configPost(instance, authorizedUser, config, workspace.id, debug);
|
|
2107
2107
|
if (result.result) {
|
|
2108
2108
|
// config id was updated from "1"
|
|
2109
|
+
// Update all TCI configIds to reference the new config ID
|
|
2110
|
+
config.tenants.forEach((tci) => {
|
|
2111
|
+
if (tci.configId === "1" || tci.configId === "") {
|
|
2112
|
+
tci.configId = config.id;
|
|
2113
|
+
}
|
|
2114
|
+
});
|
|
2109
2115
|
if (setConfigId) {
|
|
2110
2116
|
setConfigId(config.id);
|
|
2111
2117
|
}
|
|
@@ -3498,7 +3504,9 @@ export async function configPost(
|
|
|
3498
3504
|
"sourceGroupName": ${sourceGroupName},
|
|
3499
3505
|
"targetGroupId": ${targetGroupId},
|
|
3500
3506
|
"targetGroupName": ${targetGroupName},
|
|
3501
|
-
"configurationTenantType": "${tci.configurationTenantType}"
|
|
3507
|
+
"configurationTenantType": "${tci.configurationTenantType}",
|
|
3508
|
+
"isReadPermissionConsented": ${tci.isReadPermissionConsented},
|
|
3509
|
+
"isWritePermissionConsented": ${tci.isWritePermissionConsented}
|
|
3502
3510
|
}`;
|
|
3503
3511
|
});
|
|
3504
3512
|
configBody += `]}`;
|
|
@@ -3510,9 +3518,10 @@ export async function configPost(
|
|
|
3510
3518
|
let response = await fetch(endpoint, options);
|
|
3511
3519
|
if (response.status === 200 && response.statusText === "OK") {
|
|
3512
3520
|
let data = await response.json();
|
|
3513
|
-
|
|
3521
|
+
// API returns an object {id: "..."} or just the ID string directly
|
|
3522
|
+
config.id = (typeof data === 'object' && data !== null && data.id) ? data.id : data;
|
|
3514
3523
|
console.log(
|
|
3515
|
-
`Successful ConfigID: ${
|
|
3524
|
+
`Successful ConfigID: ${config.id} from POST to /config: ${configBody}`
|
|
3516
3525
|
);
|
|
3517
3526
|
return result;
|
|
3518
3527
|
}
|
|
@@ -3575,7 +3584,9 @@ export async function configPut(
|
|
|
3575
3584
|
"targetGroupId": ${targetGroupId},
|
|
3576
3585
|
"targetGroupName": ${targetGroupName},
|
|
3577
3586
|
"configurationTenantType": "${tci.configurationTenantType}",
|
|
3578
|
-
"deltaToken": "${tci.deltaToken}"
|
|
3587
|
+
"deltaToken": "${tci.deltaToken}",
|
|
3588
|
+
"isReadPermissionConsented": ${tci.isReadPermissionConsented},
|
|
3589
|
+
"isWritePermissionConsented": ${tci.isWritePermissionConsented}
|
|
3579
3590
|
}`;
|
|
3580
3591
|
});
|
|
3581
3592
|
configBody += `]}`;
|