@frontegg/rest-api 3.1.74-alpha.9437937621 → 3.1.74
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/ContextHolder/index.d.ts +27 -108
- package/ContextHolder/index.js +50 -155
- package/account-settings/index.d.ts +7 -19
- package/account-settings/index.js +13 -23
- package/applications/index.d.ts +44 -49
- package/applications/index.js +37 -51
- package/audits/index.d.ts +15 -27
- package/audits/index.js +17 -27
- package/auth/index.d.ts +768 -817
- package/auth/index.js +721 -902
- package/auth/secutiry-poilicy/index.d.ts +102 -58
- package/auth/secutiry-poilicy/index.js +90 -122
- package/auth/utils.d.ts +2 -2
- package/auth/utils.js +8 -9
- package/connectivity/index.d.ts +26 -125
- package/connectivity/index.js +114 -147
- package/directory/index.d.ts +22 -31
- package/directory/index.js +15 -27
- package/entitlements/index.d.ts +8 -14
- package/entitlements/index.js +4 -12
- package/feature-flags/index.d.ts +2 -8
- package/feature-flags/index.js +8 -16
- package/fetch.d.ts +24 -0
- package/fetch.js +265 -0
- package/groups/index.d.ts +49 -73
- package/groups/index.js +45 -64
- package/impersonate/index.d.ts +6 -15
- package/impersonate/index.js +5 -13
- package/index.d.ts +108 -154
- package/index.js +78 -109
- package/interfaces.d.ts +0 -10
- package/metadata/index.d.ts +7 -67
- package/metadata/index.js +32 -52
- package/node/ContextHolder/index.js +50 -155
- package/node/account-settings/index.js +16 -27
- package/node/applications/index.js +44 -51
- package/node/audits/index.js +20 -31
- package/node/auth/index.js +1035 -768
- package/node/auth/secutiry-poilicy/index.js +136 -125
- package/node/auth/utils.js +7 -9
- package/node/connectivity/index.js +187 -148
- package/node/directory/index.js +20 -29
- package/node/entitlements/index.js +5 -18
- package/node/feature-flags/index.js +9 -21
- package/node/fetch.js +306 -0
- package/node/groups/index.js +63 -65
- package/node/impersonate/index.js +5 -18
- package/node/index.js +71 -116
- package/node/metadata/index.js +52 -61
- package/node/notifications/index.js +27 -37
- package/node/reports/index.js +70 -78
- package/node/roles/index.js +51 -56
- package/node/security-center/index.js +9 -21
- package/node/sub-tenants/index.js +89 -90
- package/node/subscriptions/index.js +107 -79
- package/node/subscriptions/invoices.js +17 -25
- package/node/subscriptions/managedSubscriptions.js +27 -32
- package/node/subscriptions/paymentMethods.js +20 -27
- package/node/subscriptions/paymentProviders.js +6 -15
- package/node/subscriptions/plans.js +9 -17
- package/node/subscriptions/providers/index.js +18 -0
- package/node/subscriptions/providers/stripe/index.js +21 -26
- package/node/subscriptions/subscriptions.js +27 -32
- package/node/subscriptions/summaries.js +6 -15
- package/node/subscriptions/tenantConfiguration.js +9 -17
- package/node/subscriptions/vendorPublicConfigurations.js +6 -15
- package/node/teams/index.js +138 -130
- package/node/tenants/index.js +60 -65
- package/node/user-phone-numbers/index.js +24 -32
- package/node/users/index.js +53 -58
- package/node/vendor/index.js +6 -17
- package/notifications/index.d.ts +16 -22
- package/notifications/index.js +22 -33
- package/package.json +1 -1
- package/reports/index.d.ts +44 -50
- package/reports/index.js +62 -75
- package/roles/index.d.ts +38 -44
- package/roles/index.js +41 -57
- package/security-center/index.d.ts +2 -14
- package/security-center/index.js +6 -15
- package/sub-tenants/index.d.ts +15 -57
- package/sub-tenants/index.js +68 -88
- package/subscriptions/index.d.ts +11 -56
- package/subscriptions/index.js +11 -68
- package/subscriptions/invoices.d.ts +13 -16
- package/subscriptions/invoices.js +14 -24
- package/subscriptions/managedSubscriptions.d.ts +15 -18
- package/subscriptions/managedSubscriptions.js +22 -33
- package/subscriptions/paymentMethods.d.ts +13 -16
- package/subscriptions/paymentMethods.js +17 -26
- package/subscriptions/paymentProviders.d.ts +5 -8
- package/subscriptions/paymentProviders.js +4 -11
- package/subscriptions/plans.d.ts +8 -11
- package/subscriptions/plans.js +6 -14
- package/subscriptions/providers/index.d.ts +1 -0
- package/subscriptions/providers/index.js +1 -0
- package/subscriptions/providers/stripe/index.d.ts +21 -24
- package/subscriptions/providers/stripe/index.js +16 -27
- package/subscriptions/subscriptions.d.ts +21 -24
- package/subscriptions/subscriptions.js +22 -33
- package/subscriptions/summaries.d.ts +4 -7
- package/subscriptions/summaries.js +3 -10
- package/subscriptions/tenantConfiguration.d.ts +3 -6
- package/subscriptions/tenantConfiguration.js +7 -15
- package/subscriptions/vendorPublicConfigurations.d.ts +2 -5
- package/subscriptions/vendorPublicConfigurations.js +4 -11
- package/teams/index.d.ts +131 -35
- package/teams/index.js +93 -122
- package/tenants/index.d.ts +37 -25
- package/tenants/index.js +46 -62
- package/user-phone-numbers/index.d.ts +26 -32
- package/user-phone-numbers/index.js +19 -32
- package/users/index.d.ts +15 -21
- package/users/index.js +44 -60
- package/vendor/index.d.ts +6 -12
- package/vendor/index.js +4 -11
- package/BaseApiClient.d.ts +0 -16
- package/BaseApiClient.js +0 -39
- package/FetchClient.d.ts +0 -42
- package/FetchClient.js +0 -308
- package/node/BaseApiClient.js +0 -49
- package/node/FetchClient.js +0 -326
package/ContextHolder/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SessionContext, ContextOptions, RedirectOptions, RequestSource } from '../interfaces';
|
|
2
|
-
import { IUserProfile } from
|
|
2
|
+
import { IUserProfile } from "../users/interfaces";
|
|
3
3
|
/**
|
|
4
4
|
* Entitlements config from frontegg provider
|
|
5
5
|
*/
|
|
@@ -7,141 +7,60 @@ export interface EntitlementsOptions {
|
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare class ContextHolder {
|
|
10
|
-
private static
|
|
10
|
+
private static instance;
|
|
11
11
|
private context;
|
|
12
12
|
private accessToken;
|
|
13
13
|
private user;
|
|
14
14
|
private requestSource;
|
|
15
|
-
onRedirectTo
|
|
16
|
-
logout
|
|
15
|
+
private onRedirectTo;
|
|
16
|
+
private logout;
|
|
17
17
|
private entitlementsOptions;
|
|
18
18
|
private appName;
|
|
19
19
|
private sessionContext?;
|
|
20
20
|
private constructor();
|
|
21
|
-
static
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
static
|
|
28
|
-
static createInstance(appName?: string): ContextHolder;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated - use ContextHolder.for(appName).setContext instead
|
|
31
|
-
*/
|
|
32
|
-
static setContext(context: ContextOptions, appName?: string): void;
|
|
33
|
-
setContext(context: ContextOptions): void;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated - use ContextHolder.for(appName).setAccessToken instead
|
|
36
|
-
*/
|
|
37
|
-
static setAccessToken(accessToken: string | null, appName?: string): void;
|
|
38
|
-
setAccessToken(accessToken: string | null): void;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated - use ContextHolder.for(appName).setUser instead
|
|
41
|
-
*/
|
|
42
|
-
static setUser(user: IUserProfile | null, appName?: string): void;
|
|
43
|
-
setUser(user: IUserProfile | null): void;
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated - use ContextHolder.for(appName).setRequestSource instead
|
|
46
|
-
*/
|
|
47
|
-
static setRequestSource(requestSource: RequestSource | null, appName?: string): void;
|
|
48
|
-
setRequestSource(requestSource: RequestSource | null): void;
|
|
49
|
-
/**
|
|
50
|
-
* @deprecated - use ContextHolder.for(appName).setOnRedirectTo instead
|
|
51
|
-
*/
|
|
52
|
-
static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void, appName?: string): void;
|
|
53
|
-
setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void): void;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated - use ContextHolder.for(appName).setLogout instead
|
|
56
|
-
*/
|
|
57
|
-
static setLogout(logout: (callback?: () => void) => void, logoutUrl: string, appName?: string): void;
|
|
58
|
-
setLogout(logout: (callback?: () => void) => void): void;
|
|
21
|
+
static getInstance(): ContextHolder;
|
|
22
|
+
static setContext(context: ContextOptions): void;
|
|
23
|
+
static setAccessToken(accessToken: string | null): void;
|
|
24
|
+
static setUser(user: IUserProfile | null): void;
|
|
25
|
+
static setRequestSource(requestSource: RequestSource | null): void;
|
|
26
|
+
static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void): void;
|
|
27
|
+
static setLogout(logout: (callback?: () => void) => void, logoutUrl: string): void;
|
|
59
28
|
/**
|
|
60
29
|
* App name should also be set for entitlements
|
|
61
|
-
* @deprecated - use ContextHolder.for(appName).setEntitlementsOptions instead
|
|
62
30
|
* @param entitlementsOptions frontegg options entitlements config
|
|
63
|
-
* @param appName - app name
|
|
64
31
|
*/
|
|
65
|
-
static setEntitlementsOptions(entitlementsOptions: EntitlementsOptions
|
|
66
|
-
setEntitlementsOptions(entitlementsOptions: EntitlementsOptions): void;
|
|
32
|
+
static setEntitlementsOptions(entitlementsOptions: EntitlementsOptions): void;
|
|
67
33
|
/**
|
|
68
|
-
* @deprecated - use ContextHolder.for(appName).setSessionContext instead
|
|
69
34
|
* @param sessionContext frontegg options SessionContext config
|
|
70
|
-
* @param appName - app name
|
|
71
35
|
*/
|
|
72
|
-
static setSessionContext(sessionContext: SessionContext
|
|
73
|
-
setSessionContext(sessionContext: SessionContext): void;
|
|
36
|
+
static setSessionContext(sessionContext: SessionContext): void;
|
|
74
37
|
/**
|
|
75
|
-
* @
|
|
38
|
+
* @param appName for feature flags e.g.
|
|
76
39
|
*/
|
|
77
|
-
static setAppName(appName: string): void;
|
|
78
|
-
|
|
40
|
+
static setAppName(appName: string | null): void;
|
|
41
|
+
static getContext(): ContextOptions;
|
|
42
|
+
static getAccessToken(): string | null;
|
|
43
|
+
static getRequestSource(): RequestSource | null;
|
|
44
|
+
static getUser(): IUserProfile | null;
|
|
45
|
+
static onRedirectTo(path: string, opts?: RedirectOptions): void;
|
|
46
|
+
static logout(callback?: () => void): void;
|
|
79
47
|
/**
|
|
80
|
-
* @deprecated - use ContextHolder.for(appName).getContext instead
|
|
81
|
-
*/
|
|
82
|
-
static getContext(appName?: string): ContextOptions;
|
|
83
|
-
getContext(): ContextOptions;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated - use ContextHolder.for(appName).getAccessToken instead
|
|
86
|
-
*/
|
|
87
|
-
static getAccessToken(appName?: string): string | null;
|
|
88
|
-
getAccessToken(): string | null;
|
|
89
|
-
/**
|
|
90
|
-
* @deprecated - use ContextHolder.for(appName).requestSource instead
|
|
91
|
-
*/
|
|
92
|
-
static getRequestSource(appName?: string): RequestSource | null;
|
|
93
|
-
getRequestSource(): RequestSource | null;
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated - use ContextHolder.for(appName).getUser instead
|
|
96
|
-
*/
|
|
97
|
-
static getUser(appName?: string): IUserProfile | null;
|
|
98
|
-
getUser(): IUserProfile | null;
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated - use ContextHolder.for(appName).onRedirectTo instead
|
|
101
|
-
*/
|
|
102
|
-
static onRedirectTo(path: string, opts?: RedirectOptions, appName?: string): void;
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated - use ContextHolder.for(appName).logout instead
|
|
105
|
-
*/
|
|
106
|
-
static logout(callback?: () => void, appName?: string): void;
|
|
107
|
-
/**
|
|
108
|
-
* @deprecated - use ContextHolder.for(appName).shouldLoadEntitlements instead
|
|
109
48
|
* @returns shouldLoadEntitlements. Default to false.
|
|
110
49
|
*/
|
|
111
|
-
static shouldLoadEntitlements(
|
|
112
|
-
shouldLoadEntitlements(): boolean;
|
|
50
|
+
static shouldLoadEntitlements(): boolean;
|
|
113
51
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
static isSessionPerTenantEnabled(appName?: string): boolean;
|
|
118
|
-
isSessionPerTenantEnabled(): boolean;
|
|
52
|
+
* @returns isSessionPerTenantEnabled. Default to false.
|
|
53
|
+
*/
|
|
54
|
+
static isSessionPerTenantEnabled(): boolean;
|
|
119
55
|
/**
|
|
120
|
-
* @deprecated - use ContextHolder.for(appName).getAppName instead
|
|
121
56
|
* @returns app name value
|
|
122
57
|
*/
|
|
123
|
-
static getAppName(
|
|
124
|
-
getAppName(): string | null;
|
|
58
|
+
static getAppName(): string | null;
|
|
125
59
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Frontegg context to be used in the application
|
|
128
|
-
*
|
|
129
|
-
* @deprecated use ContextHolder.for instead
|
|
130
|
-
*/
|
|
131
60
|
export declare const FronteggContext: {
|
|
132
61
|
getContext: () => ContextOptions;
|
|
133
62
|
getAccessToken: () => string | null;
|
|
134
|
-
setAccessToken: (accessToken: string | null) => void;
|
|
135
63
|
getUser: () => IUserProfile | null;
|
|
136
|
-
|
|
137
|
-
onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void;
|
|
138
|
-
setOnRedirectTo: (onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void) => void;
|
|
64
|
+
onRedirectTo: (path: string, opts: RedirectOptions) => void;
|
|
139
65
|
logout: (callback?: (() => void) | undefined) => void;
|
|
140
|
-
getRequestSource: () => RequestSource | null;
|
|
141
|
-
setRequestSource: (requestSource: RequestSource | null) => void;
|
|
142
|
-
isSessionPerTenantEnabled: () => boolean;
|
|
143
|
-
shouldLoadEntitlements: () => boolean;
|
|
144
|
-
getAppName: () => string | null;
|
|
145
|
-
setEntitlementsOptions: (entitlementsOptions: EntitlementsOptions) => void;
|
|
146
|
-
setSessionContext: (sessionContext: SessionContext) => void;
|
|
147
66
|
};
|
package/ContextHolder/index.js
CHANGED
|
@@ -14,214 +14,109 @@ export class ContextHolder {
|
|
|
14
14
|
this.sessionContext = void 0;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
static for(appName) {
|
|
22
|
-
return ContextHolder.getInstance(appName);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static getInstance(appName = 'default') {
|
|
26
|
-
if (!ContextHolder._apps) {
|
|
27
|
-
ContextHolder._apps = {};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (ContextHolder._apps[appName]) {
|
|
31
|
-
return ContextHolder._apps[appName];
|
|
17
|
+
static getInstance() {
|
|
18
|
+
if (!ContextHolder.instance) {
|
|
19
|
+
ContextHolder.instance = new ContextHolder();
|
|
32
20
|
}
|
|
33
21
|
|
|
34
|
-
ContextHolder.
|
|
35
|
-
return ContextHolder._apps[appName];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static createInstance(appName = 'default') {
|
|
39
|
-
ContextHolder._apps[appName] = new ContextHolder();
|
|
40
|
-
ContextHolder._apps[appName].appName = appName;
|
|
41
|
-
return ContextHolder._apps[appName];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static setContext(context, appName = 'default') {
|
|
45
|
-
ContextHolder.for(appName).context = context;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setContext(context) {
|
|
49
|
-
this.context = context;
|
|
22
|
+
return ContextHolder.instance;
|
|
50
23
|
}
|
|
51
24
|
|
|
52
|
-
static
|
|
53
|
-
ContextHolder.
|
|
25
|
+
static setContext(context) {
|
|
26
|
+
ContextHolder.getInstance().context = context;
|
|
54
27
|
}
|
|
55
28
|
|
|
56
|
-
setAccessToken(accessToken) {
|
|
57
|
-
|
|
29
|
+
static setAccessToken(accessToken) {
|
|
30
|
+
ContextHolder.getInstance().accessToken = accessToken;
|
|
58
31
|
}
|
|
59
32
|
|
|
60
|
-
static setUser(user
|
|
61
|
-
ContextHolder.
|
|
33
|
+
static setUser(user) {
|
|
34
|
+
ContextHolder.getInstance().user = user;
|
|
62
35
|
}
|
|
63
36
|
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
static setRequestSource(requestSource) {
|
|
38
|
+
ContextHolder.getInstance().requestSource = requestSource;
|
|
66
39
|
}
|
|
67
40
|
|
|
68
|
-
static
|
|
69
|
-
ContextHolder.
|
|
41
|
+
static setOnRedirectTo(onRedirectTo) {
|
|
42
|
+
ContextHolder.getInstance().onRedirectTo = onRedirectTo;
|
|
70
43
|
}
|
|
71
44
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static setOnRedirectTo(onRedirectTo, appName = 'default') {
|
|
77
|
-
ContextHolder.for(appName).onRedirectTo = onRedirectTo;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
setOnRedirectTo(onRedirectTo) {
|
|
81
|
-
this.onRedirectTo = onRedirectTo;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
static setLogout(logout, logoutUrl, appName = 'default') {
|
|
85
|
-
const context = ContextHolder.for(appName);
|
|
86
|
-
|
|
87
|
-
context.logout = callback => {
|
|
45
|
+
static setLogout(logout, logoutUrl) {
|
|
46
|
+
ContextHolder.getInstance().logout = callback => {
|
|
88
47
|
if (!callback) {
|
|
89
|
-
|
|
48
|
+
ContextHolder.onRedirectTo(logoutUrl);
|
|
90
49
|
} else {
|
|
91
50
|
logout(callback);
|
|
92
51
|
}
|
|
93
52
|
};
|
|
94
53
|
}
|
|
95
54
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
static setEntitlementsOptions(entitlementsOptions, appName = 'default') {
|
|
101
|
-
ContextHolder.for(appName).entitlementsOptions = entitlementsOptions;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
setEntitlementsOptions(entitlementsOptions) {
|
|
105
|
-
this.entitlementsOptions = entitlementsOptions;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static setSessionContext(sessionContext, appName = 'default') {
|
|
109
|
-
ContextHolder.for(appName).sessionContext = sessionContext;
|
|
55
|
+
static setEntitlementsOptions(entitlementsOptions) {
|
|
56
|
+
ContextHolder.getInstance().entitlementsOptions = entitlementsOptions;
|
|
110
57
|
}
|
|
111
58
|
|
|
112
|
-
setSessionContext(sessionContext) {
|
|
113
|
-
|
|
59
|
+
static setSessionContext(sessionContext) {
|
|
60
|
+
const instance = ContextHolder.getInstance();
|
|
61
|
+
instance.sessionContext = sessionContext;
|
|
114
62
|
}
|
|
115
63
|
|
|
116
64
|
static setAppName(appName) {
|
|
117
|
-
ContextHolder.
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
setAppName(appName) {
|
|
121
|
-
this.appName = appName;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
static getContext(appName = 'default') {
|
|
125
|
-
var _ContextHolder$for$co;
|
|
126
|
-
|
|
127
|
-
return (_ContextHolder$for$co = ContextHolder.for(appName).context) != null ? _ContextHolder$for$co : {
|
|
128
|
-
baseUrl: window.location.href,
|
|
129
|
-
tokenResolver: () => 'my-authentication-token',
|
|
130
|
-
logLevel: 'error'
|
|
131
|
-
};
|
|
65
|
+
ContextHolder.getInstance().appName = appName;
|
|
132
66
|
}
|
|
133
67
|
|
|
134
|
-
getContext() {
|
|
135
|
-
var
|
|
68
|
+
static getContext() {
|
|
69
|
+
var _ContextHolder$getIns;
|
|
136
70
|
|
|
137
|
-
return (
|
|
71
|
+
return (_ContextHolder$getIns = ContextHolder.getInstance().context) != null ? _ContextHolder$getIns : {
|
|
138
72
|
baseUrl: window.location.href,
|
|
139
73
|
tokenResolver: () => 'my-authentication-token',
|
|
140
74
|
logLevel: 'error'
|
|
141
75
|
};
|
|
142
76
|
}
|
|
143
77
|
|
|
144
|
-
static getAccessToken(
|
|
145
|
-
return ContextHolder.
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
getAccessToken() {
|
|
149
|
-
return this.accessToken;
|
|
78
|
+
static getAccessToken() {
|
|
79
|
+
return ContextHolder.getInstance().accessToken;
|
|
150
80
|
}
|
|
151
81
|
|
|
152
|
-
static getRequestSource(
|
|
153
|
-
return ContextHolder.
|
|
82
|
+
static getRequestSource() {
|
|
83
|
+
return ContextHolder.getInstance().requestSource;
|
|
154
84
|
}
|
|
155
85
|
|
|
156
|
-
|
|
157
|
-
return
|
|
86
|
+
static getUser() {
|
|
87
|
+
return ContextHolder.getInstance().user;
|
|
158
88
|
}
|
|
159
89
|
|
|
160
|
-
static
|
|
161
|
-
return ContextHolder.
|
|
90
|
+
static onRedirectTo(path, opts) {
|
|
91
|
+
return ContextHolder.getInstance().onRedirectTo(path, opts);
|
|
162
92
|
}
|
|
163
93
|
|
|
164
|
-
|
|
165
|
-
return
|
|
94
|
+
static logout(callback) {
|
|
95
|
+
return ContextHolder.getInstance().logout(callback);
|
|
166
96
|
}
|
|
167
97
|
|
|
168
|
-
static
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
static logout(callback, appName = 'default') {
|
|
173
|
-
return ContextHolder.for(appName).logout(callback);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
static shouldLoadEntitlements(appName = 'default') {
|
|
177
|
-
var _ContextHolder$for$en;
|
|
178
|
-
|
|
179
|
-
return ((_ContextHolder$for$en = ContextHolder.for(appName).entitlementsOptions) == null ? void 0 : _ContextHolder$for$en.enabled) || false;
|
|
180
|
-
}
|
|
98
|
+
static shouldLoadEntitlements() {
|
|
99
|
+
var _ContextHolder$getIns2;
|
|
181
100
|
|
|
182
|
-
|
|
183
|
-
var _this$entitlementsOpt;
|
|
184
|
-
|
|
185
|
-
return ((_this$entitlementsOpt = this.entitlementsOptions) == null ? void 0 : _this$entitlementsOpt.enabled) || false;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
static isSessionPerTenantEnabled(appName = 'default') {
|
|
189
|
-
var _ContextHolder$for$se;
|
|
190
|
-
|
|
191
|
-
return ((_ContextHolder$for$se = ContextHolder.for(appName).sessionContext) == null ? void 0 : _ContextHolder$for$se.enableSessionPerTenant) || false;
|
|
101
|
+
return ((_ContextHolder$getIns2 = ContextHolder.getInstance().entitlementsOptions) == null ? void 0 : _ContextHolder$getIns2.enabled) || false;
|
|
192
102
|
}
|
|
193
103
|
|
|
194
|
-
isSessionPerTenantEnabled() {
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
return ((_this$sessionContext = this.sessionContext) == null ? void 0 : _this$sessionContext.enableSessionPerTenant) || false;
|
|
198
|
-
}
|
|
104
|
+
static isSessionPerTenantEnabled() {
|
|
105
|
+
var _ContextHolder$getIns3;
|
|
199
106
|
|
|
200
|
-
|
|
201
|
-
return ContextHolder.for(appName).appName;
|
|
107
|
+
return ((_ContextHolder$getIns3 = ContextHolder.getInstance().sessionContext) == null ? void 0 : _ContextHolder$getIns3.enableSessionPerTenant) || false;
|
|
202
108
|
}
|
|
203
109
|
|
|
204
|
-
getAppName() {
|
|
205
|
-
return
|
|
110
|
+
static getAppName() {
|
|
111
|
+
return ContextHolder.getInstance().appName;
|
|
206
112
|
}
|
|
207
113
|
|
|
208
114
|
}
|
|
209
|
-
ContextHolder.
|
|
210
|
-
const DEFAULT_APP_NAME = 'default';
|
|
115
|
+
ContextHolder.instance = void 0;
|
|
211
116
|
export const FronteggContext = {
|
|
212
|
-
getContext: () => ContextHolder.getContext(
|
|
213
|
-
getAccessToken: () => ContextHolder.getAccessToken(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts, DEFAULT_APP_NAME),
|
|
218
|
-
setOnRedirectTo: onRedirectTo => ContextHolder.setOnRedirectTo(onRedirectTo, DEFAULT_APP_NAME),
|
|
219
|
-
logout: callback => ContextHolder.logout(callback, DEFAULT_APP_NAME),
|
|
220
|
-
getRequestSource: () => ContextHolder.getRequestSource(DEFAULT_APP_NAME),
|
|
221
|
-
setRequestSource: requestSource => ContextHolder.setRequestSource(requestSource, DEFAULT_APP_NAME),
|
|
222
|
-
isSessionPerTenantEnabled: () => ContextHolder.isSessionPerTenantEnabled(DEFAULT_APP_NAME),
|
|
223
|
-
shouldLoadEntitlements: () => ContextHolder.shouldLoadEntitlements(DEFAULT_APP_NAME),
|
|
224
|
-
getAppName: () => ContextHolder.getAppName(DEFAULT_APP_NAME),
|
|
225
|
-
setEntitlementsOptions: entitlementsOptions => ContextHolder.setEntitlementsOptions(entitlementsOptions, DEFAULT_APP_NAME),
|
|
226
|
-
setSessionContext: sessionContext => ContextHolder.setSessionContext(sessionContext, DEFAULT_APP_NAME)
|
|
117
|
+
getContext: () => ContextHolder.getContext(),
|
|
118
|
+
getAccessToken: () => ContextHolder.getAccessToken(),
|
|
119
|
+
getUser: () => ContextHolder.getUser(),
|
|
120
|
+
onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts),
|
|
121
|
+
logout: callback => ContextHolder.logout(callback)
|
|
227
122
|
};
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { IPublicSettingsResponse, ISettingsResponse, IUpdateSettings } from "./interfaces";
|
|
2
2
|
import { UserJwtOptions } from "../interfaces";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
updateSettings: (body: IUpdateSettings, options?: UserJwtOptions | undefined) => Promise<ISettingsResponse>;
|
|
11
|
-
/**
|
|
12
|
-
* Get account settings for a tenant.
|
|
13
|
-
*/
|
|
14
|
-
getSettings: (options?: UserJwtOptions | undefined) => Promise<ISettingsResponse>;
|
|
15
|
-
/**
|
|
16
|
-
* Get public account settings.
|
|
17
|
-
*/
|
|
18
|
-
getPublicSettings: () => Promise<IPublicSettingsResponse>;
|
|
19
|
-
}
|
|
20
|
-
declare const _default: AccountSettingsApi;
|
|
21
|
-
export default _default;
|
|
3
|
+
/*** update account settings for tenant.
|
|
4
|
+
* tenantId is caclulated in the backend from context
|
|
5
|
+
* ``authorized user``
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateSettings(body: IUpdateSettings, options?: UserJwtOptions): Promise<ISettingsResponse>;
|
|
8
|
+
export declare function getSettings(options?: UserJwtOptions): Promise<ISettingsResponse>;
|
|
9
|
+
export declare function getPublicSettings(): Promise<IPublicSettingsResponse>;
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
import { urls } from "../constants";
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.updateSettings = async (body, options) => {
|
|
8
|
-
return this.put(urls.tenants.accountSettings.v1, body, {
|
|
9
|
-
headers: this.extractHeadersFromOptions(options)
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
this.getSettings = async options => {
|
|
14
|
-
return this.get(urls.tenants.accountSettings.v1, undefined, {
|
|
15
|
-
headers: this.extractHeadersFromOptions(options)
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
this.getPublicSettings = async () => {
|
|
20
|
-
return this.get(`${urls.tenants.accountSettings.v1}/public`);
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
2
|
+
import { extractHeadersFromOptions, Get, Put } from "../fetch";
|
|
3
|
+
export async function updateSettings(body, options) {
|
|
4
|
+
return Put(urls.tenants.accountSettings.v1, body, {
|
|
5
|
+
headers: extractHeadersFromOptions(options)
|
|
6
|
+
});
|
|
24
7
|
}
|
|
25
|
-
export
|
|
8
|
+
export async function getSettings(options) {
|
|
9
|
+
return Get(urls.tenants.accountSettings.v1, undefined, {
|
|
10
|
+
headers: extractHeadersFromOptions(options)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export async function getPublicSettings() {
|
|
14
|
+
return Get(`${urls.tenants.accountSettings.v1}/public`);
|
|
15
|
+
}
|
package/applications/index.d.ts
CHANGED
|
@@ -1,51 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IUserApplicationsIdPayload, IUserApplicationsDataPayload, IApplicationsResponse, IAssignUserToApplicationsBody, IUsersApplicationsIdPayload, IUsersOfApplicationsResponse, ITenantApplicationsResponse, IGetUsersOfApplicationsQuery, IUsersApplicationsIdsResponse } from './interfaces';
|
|
1
|
+
import { IUserApplicationsIdPayload, IUserApplicationsDataPayload, IApplicationsResponse, IAssignUserToApplicationsBody, IUsersApplicationsIdPayload, IUsersOfApplicationsResponse, ITenantApplicationsResponse, IGetUsersOfApplicationsQuery, IUsersApplicationsIdsResponse } from "./interfaces";
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Get applications id array for single user by user id
|
|
4
|
+
* @param userId - user id to find his applications id array
|
|
5
|
+
* @returns all app ids as string[]
|
|
5
6
|
*/
|
|
6
|
-
export declare
|
|
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
|
-
* @returns {Promise<IUsersOfApplicationsResponse[]>} array of objects with application id and its users array.
|
|
47
|
-
*/
|
|
48
|
-
getUsersOfApplications: ({ appIds }: IGetUsersOfApplicationsQuery) => Promise<IUsersOfApplicationsResponse[]>;
|
|
49
|
-
}
|
|
50
|
-
declare const _default: ApplicationsApi;
|
|
51
|
-
export default _default;
|
|
7
|
+
export declare function getUserApplicationsId({ userId }: IUserApplicationsIdPayload): Promise<string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Get applications id array for multiple users by user id array
|
|
10
|
+
* @param userIds - array of all user id's
|
|
11
|
+
* @returns object that maps every user id to his applications id array
|
|
12
|
+
*/
|
|
13
|
+
export declare function getUsersApplicationsId({ userIds }: IUsersApplicationsIdPayload): Promise<IUsersApplicationsIdsResponse[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Get applications data array for specific tenant
|
|
16
|
+
* @returns array of object with tenant id and his applications id array
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTenantsApplications(): Promise<ITenantApplicationsResponse[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Get applications data by array of application ids
|
|
21
|
+
* @param appIds - array of application ids
|
|
22
|
+
* @returns array of application data
|
|
23
|
+
*/
|
|
24
|
+
export declare function getApplicationsData({ appIds, includeFreeAccess }: IUserApplicationsDataPayload): Promise<IApplicationsResponse[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Assign user to multiple applications
|
|
27
|
+
* @param appIds - string[]
|
|
28
|
+
* @param tenantId - string
|
|
29
|
+
* @param userId - string
|
|
30
|
+
* @returns void
|
|
31
|
+
*/
|
|
32
|
+
export declare function assignUserToApplications(body: IAssignUserToApplicationsBody): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Unassign user from multiple applications
|
|
35
|
+
* @param appIds - string[]
|
|
36
|
+
* @param tenantId - string
|
|
37
|
+
* @param userId - string
|
|
38
|
+
* @returns void
|
|
39
|
+
*/
|
|
40
|
+
export declare function unassignUserFromApplications(body: IAssignUserToApplicationsBody): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Get users array for each application for array of applications
|
|
43
|
+
* @param appIds - array of applications
|
|
44
|
+
* @returns array of objects with application id and his users array
|
|
45
|
+
*/
|
|
46
|
+
export declare function getUsersOfApplications({ appIds }: IGetUsersOfApplicationsQuery): Promise<IUsersOfApplicationsResponse[]>;
|