@mindline/sync 1.0.99 → 1.0.101
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 +0 -1
- package/.vs/slnx.sqlite +0 -0
- package/.vs/sync/CopilotIndices/17.14.260.54502/CodeChunks.db +0 -0
- package/.vs/sync/CopilotIndices/17.14.260.54502/SemanticSymbols.db +0 -0
- package/.vs/sync/FileContentIndex/24a4af15-f48f-4636-bba3-eb444f17772c.vsidx +0 -0
- package/.vs/sync/FileContentIndex/3d735301-6bc9-4349-a917-609e552af3d6.vsidx +0 -0
- package/.vs/sync/FileContentIndex/547368c3-2a34-40f3-abaf-8bff09e997f6.vsidx +0 -0
- package/.vs/sync/FileContentIndex/97436329-fb83-43f9-95a2-5f3a047fcb45.vsidx +0 -0
- package/.vs/sync/v17/.wsuo +0 -0
- package/.vs/sync/v17/DocumentLayout.backup.json +27 -60
- package/.vs/sync/v17/DocumentLayout.json +35 -60
- package/dist/src/index.d.ts +20 -1
- package/dist/sync.es.js +610 -515
- package/dist/sync.es.js.map +1 -1
- package/dist/sync.umd.js +31 -23
- package/dist/sync.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/index.d.ts +18 -3
- package/src/index.ts +164 -7
- package/.vs/sync/FileContentIndex/3f844564-c214-4f94-a0ae-1560b50e152c.vsidx +0 -0
- package/.vs/sync/FileContentIndex/45c8c5a2-a7a0-4025-b787-3053b90d28fc.vsidx +0 -0
- package/.vs/sync/FileContentIndex/ca40703e-4694-45d5-9233-86b471772c65.vsidx +0 -0
- package/.vs/sync/FileContentIndex/e1515f5f-1990-4d24-a71a-49811665cbe1.vsidx +0 -0
- /package/.vs/sync/FileContentIndex/{b9c9b1f1-a6bb-4dbc-8e91-4e9ecf1382d5.vsidx → c124698b-787d-47cd-a04b-0fc30de7e469.vsidx} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindline/sync",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.101",
|
|
4
4
|
"description": "sync is a node.js package encapsulating JavaScript classes required for configuring Mindline sync service.",
|
|
5
5
|
"main": "dist/sync.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "vite build",
|
|
12
|
+
"prepublishOnly": "npm run build",
|
|
12
13
|
"test": "vitest"
|
|
13
14
|
},
|
|
14
15
|
"keywords": [],
|
package/src/index.d.ts
CHANGED
|
@@ -148,6 +148,17 @@ declare module "@mindline/sync" {
|
|
|
148
148
|
sel: boolean; // selection state
|
|
149
149
|
constructor();
|
|
150
150
|
}
|
|
151
|
+
export class AuditConfig {
|
|
152
|
+
id: string;
|
|
153
|
+
workspaceId: string;
|
|
154
|
+
name: string;
|
|
155
|
+
description: string;
|
|
156
|
+
isEnabled: boolean;
|
|
157
|
+
email: string;
|
|
158
|
+
tenantId: string;
|
|
159
|
+
sel: boolean; // selection state
|
|
160
|
+
constructor();
|
|
161
|
+
}
|
|
151
162
|
// class to group Users, Tenants, and Configs
|
|
152
163
|
export class Workspace {
|
|
153
164
|
id: string;
|
|
@@ -320,18 +331,22 @@ declare module "@mindline/sync" {
|
|
|
320
331
|
export function userDelegatedScopesRemove(instance: IPublicClientApplication, loggedInUser: User, tenant: Tenant, scope: string): boolean;
|
|
321
332
|
export function usersGet(instance: IPublicClientApplication, user: User | undefined): { users: string[], error: string };
|
|
322
333
|
// ======================= Mindline Config API ===============================
|
|
323
|
-
export function
|
|
324
|
-
export function
|
|
334
|
+
export function auditConfigAdd(instance: IPublicClientApplication, user: User, ac: AuditConfig, debug: boolean): Promise<APIResult>;
|
|
335
|
+
export function auditConfigRetrieve(instance: IPublicClientApplication, user: User, debug: boolean): Promise<APIResult>;
|
|
336
|
+
export function auditEventsRetrieve(instance: IPublicClientApplication, user: User, debug: boolean): Promise<APIResult>;
|
|
325
337
|
export function configEdit(instance: IPublicClientApplication, authorizedUser: User, config: Config, setConfigId: (id: string) => void, setSelectedConfigs: (selectedConfigs: { [id: string]: boolean | number[] }) => void, workspace: Workspace, ii: InitInfo, debug: boolean): APIResult;
|
|
326
338
|
export function configEnable(instance: IPublicClientApplication, authorizedUser: User, configurationId: string, enabled: boolean, debug: boolean): APIResult;
|
|
327
|
-
export function
|
|
339
|
+
export function configConsentForRead(instance: IPublicClientApplication, authorizedUser: User, configId: string, tid: string, consent: boolean): Promise<APIResult>;
|
|
340
|
+
export function configConsentForWrite(instance: IPublicClientApplication, authorizedUser: User, configId: string, tid: string, consent: boolean): Promise<APIResult>;
|
|
328
341
|
export function configsRefresh(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, ii: InitInfo, debug: boolean): APIResult;
|
|
342
|
+
export function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): APIResult;
|
|
329
343
|
export function initGet(instance: IPublicClientApplication, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): APIResult;
|
|
330
344
|
export function tenantAdd(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string): APIResult;
|
|
331
345
|
export function tenantRemove(instance: IPublicClientApplication, authorizedUser: User, tenant: Tenant, workspaceId: string, debug: boolean): APIResult;
|
|
332
346
|
export function userAdd(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
|
333
347
|
export function userRemove(instance: IPublicClientApplication, authorizedUser: User, user: User, workspaceId: string): APIResult;
|
|
334
348
|
export function workspaceEdit(instance: IPublicClientApplication, authorizedUser: User, workspaceId: string, workspaceName: string): Promise<APIResult>;
|
|
349
|
+
// ======================= PowerBI Access Token Retrieval ===============================
|
|
335
350
|
export function getPowerBIAccessToken(instance: IPublicClientApplication, user: User): Promise<string>;
|
|
336
351
|
// ======================= Azure REST API ===============================
|
|
337
352
|
export function canListRootAssignments(instance: IPublicClientApplication, user: User): Promise<boolean>;
|
package/src/index.ts
CHANGED
|
@@ -50,6 +50,12 @@ export class mindlineConfig {
|
|
|
50
50
|
static adminsEndpoint(): string {
|
|
51
51
|
return `https://${mindlineConfig.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/admins`;
|
|
52
52
|
};
|
|
53
|
+
static auditConfigEndpoint(): string {
|
|
54
|
+
return `https://${mindlineConfig.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-configuration`;
|
|
55
|
+
}
|
|
56
|
+
static auditEventsEndpoint(): string {
|
|
57
|
+
return `https://${mindlineConfig.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/audit-events`;
|
|
58
|
+
};
|
|
53
59
|
static configConsentEndpoint(): string {
|
|
54
60
|
return `https://${mindlineConfig.environmentTag}-configurationapi-westus.azurewebsites.net/api/v1/configuration/consent`;
|
|
55
61
|
};
|
|
@@ -276,6 +282,26 @@ export class Config {
|
|
|
276
282
|
this.sel = false;
|
|
277
283
|
}
|
|
278
284
|
}
|
|
285
|
+
export class AuditConfig {
|
|
286
|
+
id: string;
|
|
287
|
+
workspaceId: string;
|
|
288
|
+
name: string;
|
|
289
|
+
description: string;
|
|
290
|
+
isEnabled: boolean;
|
|
291
|
+
email: string;
|
|
292
|
+
tenantId: string;
|
|
293
|
+
sel: boolean; // selection state
|
|
294
|
+
constructor() {
|
|
295
|
+
this.id = "";
|
|
296
|
+
this.name = "";
|
|
297
|
+
this.workspaceId = "";
|
|
298
|
+
this.description = "";
|
|
299
|
+
this.isEnabled = false;
|
|
300
|
+
this.email = "";
|
|
301
|
+
this.tenantId = "";
|
|
302
|
+
this.sel = false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
279
305
|
export class Workspace {
|
|
280
306
|
id: string;
|
|
281
307
|
name: string;
|
|
@@ -1994,6 +2020,15 @@ export async function usersGet(instance: IPublicClientApplication, user: User |
|
|
|
1994
2020
|
}
|
|
1995
2021
|
}
|
|
1996
2022
|
// ======================= Mindline Config API ===============================
|
|
2023
|
+
export async function auditConfigAdd(instance: IPublicClientApplication, user: User, ac: AuditConfig, debug: boolean): Promise<APIResult> {
|
|
2024
|
+
return auditConfigPost(instance, user, ac, debug);
|
|
2025
|
+
}
|
|
2026
|
+
export async function auditConfigRetrieve(instance: IPublicClientApplication, user: User, debug: boolean): Promise<APIResult> {
|
|
2027
|
+
return auditConfigGet(instance, user, debug);
|
|
2028
|
+
}
|
|
2029
|
+
export async function auditEventsRetrieve(instance: IPublicClientApplication, authorizedUser: User, debug: boolean): Promise<APIResult> {
|
|
2030
|
+
return auditEventsGet(instance, authorizedUser, debug);
|
|
2031
|
+
}
|
|
1997
2032
|
export async function configEdit(
|
|
1998
2033
|
instance: IPublicClientApplication,
|
|
1999
2034
|
authorizedUser: User,
|
|
@@ -2041,9 +2076,6 @@ export async function configEnable(
|
|
|
2041
2076
|
result = await configPatch(instance, authorizedUser, configurationId, enabled, debug);
|
|
2042
2077
|
return result;
|
|
2043
2078
|
}
|
|
2044
|
-
export async function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): Promise<APIResult> {
|
|
2045
|
-
return configDelete(instance, authorizedUser, config, workspaceId, debug);
|
|
2046
|
-
}
|
|
2047
2079
|
export async function configConsentForRead(instance: IPublicClientApplication, authorizedUser: User, configId: string, tid: string, consent: boolean): Promise<APIResult> {
|
|
2048
2080
|
return configConsentReadPut(instance, authorizedUser, configId, tid, consent);
|
|
2049
2081
|
}
|
|
@@ -2083,6 +2115,9 @@ export async function configsRefresh(instance: IPublicClientApplication, authori
|
|
|
2083
2115
|
result.status = 500;
|
|
2084
2116
|
return result;
|
|
2085
2117
|
}
|
|
2118
|
+
export async function configRemove(instance: IPublicClientApplication, authorizedUser: User, config: Config, workspaceId: string, debug: boolean): Promise<APIResult> {
|
|
2119
|
+
return configDelete(instance, authorizedUser, config, workspaceId, debug);
|
|
2120
|
+
}
|
|
2086
2121
|
export async function initGet(instance: IPublicClientApplication, user: User, ii: InitInfo, tasks: TaskArray, debug: boolean): Promise<APIResult> {
|
|
2087
2122
|
console.log(`>>>>>> initGet`);
|
|
2088
2123
|
let result: APIResult = new APIResult();
|
|
@@ -2556,10 +2591,7 @@ async function readResources(instance: IPublicClientApplication, user: User): Pr
|
|
|
2556
2591
|
}
|
|
2557
2592
|
return resources;
|
|
2558
2593
|
}
|
|
2559
|
-
|
|
2560
|
-
//hybridspa.ts - calls to Mindline Config API
|
|
2561
|
-
|
|
2562
|
-
// helper functions
|
|
2594
|
+
// ======================= HYBRIDSPA.TS -- Mindline Config API helper functions ===============================
|
|
2563
2595
|
function getAPIScope(user: User): string {
|
|
2564
2596
|
let apiAppID: string = "8d95d21c-c378-4bb0-9f52-88c30d271e7a";
|
|
2565
2597
|
let authority: string = user.authority.toLowerCase();
|
|
@@ -2802,6 +2834,131 @@ export async function adminPost(
|
|
|
2802
2834
|
}
|
|
2803
2835
|
return result;
|
|
2804
2836
|
}
|
|
2837
|
+
//auditConfigPost: write audit config to back end
|
|
2838
|
+
export async function auditConfigPost(
|
|
2839
|
+
instance: IPublicClientApplication,
|
|
2840
|
+
user: User,
|
|
2841
|
+
config: AuditConfig,
|
|
2842
|
+
debug: boolean
|
|
2843
|
+
): Promise<APIResult> {
|
|
2844
|
+
instance = instance;
|
|
2845
|
+
user = user;
|
|
2846
|
+
debug = debug;
|
|
2847
|
+
let result: APIResult = new APIResult();
|
|
2848
|
+
if (config.id === "") {
|
|
2849
|
+
result.result = false;
|
|
2850
|
+
result.error = "auditConfigPost: invalid config ID";
|
|
2851
|
+
result.status = 500;
|
|
2852
|
+
return result;
|
|
2853
|
+
}
|
|
2854
|
+
// create no parameter audit config post endpoint
|
|
2855
|
+
let endpoint: string = mindlineConfig.auditConfigEndpoint();
|
|
2856
|
+
// create config headers
|
|
2857
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
2858
|
+
// create config body
|
|
2859
|
+
let configBody: string = `
|
|
2860
|
+
{
|
|
2861
|
+
"workspaceId": "${config.workspaceId}",
|
|
2862
|
+
"name": "${config.name}",
|
|
2863
|
+
"description": "${config.description}",
|
|
2864
|
+
"isEnabled": ${config.isEnabled},
|
|
2865
|
+
"email": "${config.email}",
|
|
2866
|
+
"tenantId": "${config.tenantId}"
|
|
2867
|
+
}`;
|
|
2868
|
+
let options = { method: "POST", headers: headers, body: configBody };
|
|
2869
|
+
// make config endpoint call
|
|
2870
|
+
try {
|
|
2871
|
+
if (debug) debugger;
|
|
2872
|
+
console.log("Attempting POST to /audit-configuration: " + endpoint);
|
|
2873
|
+
let response = await fetch(endpoint, options);
|
|
2874
|
+
if (response.status === 200 && response.statusText === "OK") {
|
|
2875
|
+
let data = await response.json();
|
|
2876
|
+
config.id = data;
|
|
2877
|
+
console.log(
|
|
2878
|
+
`Successful AuditConfigID: ${data} from POST to /audit-configuration: ${configBody}`
|
|
2879
|
+
);
|
|
2880
|
+
return result;
|
|
2881
|
+
}
|
|
2882
|
+
else {
|
|
2883
|
+
result.error = await processErrors(response);
|
|
2884
|
+
console.log(`Failed POST to /audit-configuration: ${configBody}`);
|
|
2885
|
+
console.log(result.error);
|
|
2886
|
+
result.status = 500;
|
|
2887
|
+
result.result = false;
|
|
2888
|
+
return result;
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
catch (error: any) {
|
|
2892
|
+
result.status = 500;
|
|
2893
|
+
result.result = false;
|
|
2894
|
+
result.error = error.message;
|
|
2895
|
+
console.log(result.error);
|
|
2896
|
+
return result;
|
|
2897
|
+
}
|
|
2898
|
+
return result;
|
|
2899
|
+
}
|
|
2900
|
+
//auditConfigPost: get audit config from back end
|
|
2901
|
+
export async function auditConfigGet(instance: IPublicClientApplication, user: User, debug: boolean): Promise<APIResult> {
|
|
2902
|
+
instance = instance;
|
|
2903
|
+
user = user;
|
|
2904
|
+
debug = debug;
|
|
2905
|
+
let result: APIResult = new APIResult();
|
|
2906
|
+
return result;
|
|
2907
|
+
}
|
|
2908
|
+
export async function auditEventsGet(instance: IPublicClientApplication, user: User, debug: boolean): Promise<APIResult> {
|
|
2909
|
+
let result: APIResult = new APIResult();
|
|
2910
|
+
// we need a valid user
|
|
2911
|
+
if (user.mail == undefined || user.mail == "") {
|
|
2912
|
+
result.result = false;
|
|
2913
|
+
result.status = 500;
|
|
2914
|
+
result.error = "auditEventsGet: no user provided";
|
|
2915
|
+
return result;
|
|
2916
|
+
}
|
|
2917
|
+
// create endpoint
|
|
2918
|
+
let endpoint: string = mindlineConfig.auditEventsEndpoint();
|
|
2919
|
+
let url: URL = new URL(endpoint);
|
|
2920
|
+
// create workspace headers
|
|
2921
|
+
const headers = await mindlineDefineHeaders(instance, user);
|
|
2922
|
+
// make workspace endpoint call
|
|
2923
|
+
let options = { method: "GET", headers: headers };
|
|
2924
|
+
try {
|
|
2925
|
+
if (debug) debugger;
|
|
2926
|
+
console.log("Attempting GET from /audit-events endpoint: " + url.href);
|
|
2927
|
+
let response = await fetch(url.href, options);
|
|
2928
|
+
if (response.status === 200 && response.statusText === "OK") {
|
|
2929
|
+
let json = await response.json();
|
|
2930
|
+
if (Array.isArray(json.data)) {
|
|
2931
|
+
let returnedArray: Array<Object> = json.data;
|
|
2932
|
+
if (returnedArray != null) {
|
|
2933
|
+
result.array = returnedArray;
|
|
2934
|
+
let initialValue: string = "";
|
|
2935
|
+
console.log(`Successful GET from /audit-events: ${result.array.reduce((acc, curr: any) => acc + curr.initiatedByUser + " ", initialValue)}`);
|
|
2936
|
+
return result;
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
result.error = `Failed GET from /audit-events: failed to JSON-parse response`;
|
|
2940
|
+
console.log(result.error);
|
|
2941
|
+
result.status = 500;
|
|
2942
|
+
result.result = false;
|
|
2943
|
+
return result;
|
|
2944
|
+
}
|
|
2945
|
+
else {
|
|
2946
|
+
console.log(`Failed GET from /audit-events: ${url.href}`);
|
|
2947
|
+
result.error = await processErrors(response);
|
|
2948
|
+
result.status = 500;
|
|
2949
|
+
result.result = false;
|
|
2950
|
+
console.log(result.error);
|
|
2951
|
+
return result;
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
catch (error: any) {
|
|
2955
|
+
result.error = error.message;
|
|
2956
|
+
result.status = 500;
|
|
2957
|
+
result.result = false;
|
|
2958
|
+
console.log(error.message);
|
|
2959
|
+
}
|
|
2960
|
+
return result;
|
|
2961
|
+
}
|
|
2805
2962
|
//configConsentReadPut
|
|
2806
2963
|
export async function configConsentReadPut(instance: IPublicClientApplication, authorizedUser: User, configId: string, tid: string, consent: boolean): Promise<APIResult> {
|
|
2807
2964
|
let result: APIResult = new APIResult();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|