@xh/hoist 72.0.0 → 72.2.0
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/CHANGELOG.md +41 -2
- package/admin/jsonsearch/JsonSearch.ts +294 -0
- package/admin/jsonsearch/impl/JsonSearchImplModel.ts +175 -0
- package/admin/tabs/activity/clienterrors/ClientErrorsModel.ts +23 -4
- package/admin/tabs/general/config/ConfigPanel.ts +26 -4
- package/admin/tabs/userData/jsonblob/JsonBlobPanel.ts +47 -10
- package/admin/tabs/userData/prefs/UserPreferencePanel.ts +45 -15
- package/admin/tabs/userData/roles/RoleModel.ts +3 -3
- package/admin/tabs/userData/roles/details/RoleDetailsModel.ts +2 -1
- package/admin/tabs/userData/roles/editor/form/RoleFormModel.ts +3 -3
- package/admin/tabs/userData/roles/recategorize/RecategorizeDialogModel.ts +1 -1
- package/build/types/admin/jsonsearch/JsonSearch.d.ts +17 -0
- package/build/types/admin/jsonsearch/impl/JsonSearchImplModel.d.ts +32 -0
- package/build/types/cmp/tab/TabContainerModel.d.ts +5 -5
- package/build/types/core/HoistProps.d.ts +1 -0
- package/build/types/core/XH.d.ts +5 -5
- package/build/types/core/persist/PersistenceProvider.d.ts +4 -0
- package/build/types/core/types/Interfaces.d.ts +9 -0
- package/build/types/data/Store.d.ts +4 -0
- package/build/types/data/StoreRecord.d.ts +2 -0
- package/build/types/desktop/cmp/appOption/AutoRefreshAppOption.d.ts +1 -0
- package/build/types/desktop/cmp/appOption/ThemeAppOption.d.ts +1 -0
- package/build/types/kit/blueprint/Wrappers.d.ts +1 -1
- package/build/types/kit/swiper/index.d.ts +4 -4
- package/build/types/security/BaseOAuthClient.d.ts +19 -21
- package/build/types/security/Token.d.ts +0 -1
- package/build/types/security/Types.d.ts +12 -0
- package/build/types/security/authzero/AuthZeroClient.d.ts +3 -4
- package/build/types/security/msal/MsalClient.d.ts +3 -4
- package/cmp/filter/FilterChooserModel.ts +6 -2
- package/cmp/grid/impl/InitPersist.ts +9 -3
- package/cmp/grouping/GroupingChooserModel.ts +6 -2
- package/cmp/tab/TabContainerModel.ts +5 -5
- package/cmp/zoneGrid/impl/InitPersist.ts +9 -3
- package/core/HoistBase.ts +1 -2
- package/core/HoistBaseDecorators.ts +4 -1
- package/core/HoistProps.ts +1 -0
- package/core/XH.ts +13 -5
- package/core/exception/Exception.ts +19 -12
- package/core/persist/PersistenceProvider.ts +31 -0
- package/core/types/Interfaces.ts +11 -0
- package/data/Store.ts +13 -3
- package/data/StoreRecord.ts +6 -1
- package/data/cube/row/BaseRow.ts +3 -2
- package/desktop/appcontainer/ExceptionDialog.ts +1 -1
- package/desktop/cmp/dash/canvas/DashCanvas.ts +2 -1
- package/mobile/cmp/navigator/NavigatorModel.ts +7 -0
- package/package.json +1 -1
- package/security/BaseOAuthClient.ts +41 -36
- package/security/Token.ts +0 -2
- package/security/Types.ts +22 -0
- package/security/authzero/AuthZeroClient.ts +6 -8
- package/security/msal/MsalClient.ts +6 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/react/LayoutPropUtils.ts +2 -1
|
@@ -8,7 +8,8 @@ import type {Auth0ClientOptions} from '@auth0/auth0-spa-js';
|
|
|
8
8
|
import {Auth0Client} from '@auth0/auth0-spa-js';
|
|
9
9
|
import {XH} from '@xh/hoist/core';
|
|
10
10
|
import {wait} from '@xh/hoist/promise';
|
|
11
|
-
import {Token
|
|
11
|
+
import {Token} from '@xh/hoist/security/Token';
|
|
12
|
+
import {AccessTokenSpec, TokenMap} from '../Types';
|
|
12
13
|
import {SECONDS} from '@xh/hoist/utils/datetime';
|
|
13
14
|
import {mergeDeep, throwIf} from '@xh/hoist/utils/js';
|
|
14
15
|
import {flatMap, union} from 'lodash';
|
|
@@ -40,10 +41,7 @@ export interface AuthZeroClientConfig extends BaseOAuthClientConfig<AuthZeroToke
|
|
|
40
41
|
authZeroClientOptions?: Partial<Auth0ClientOptions>;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export interface AuthZeroTokenSpec {
|
|
44
|
-
/** Scopes for the desired access token.*/
|
|
45
|
-
scopes: string[];
|
|
46
|
-
|
|
44
|
+
export interface AuthZeroTokenSpec extends AccessTokenSpec {
|
|
47
45
|
/**
|
|
48
46
|
* Audience (i.e. API) identifier for AccessToken. Must be registered with Auth0.
|
|
49
47
|
* Note that this is required to ensure that issued token is a JWT and not an opaque string.
|
|
@@ -75,7 +73,7 @@ export class AuthZeroClient extends BaseOAuthClient<AuthZeroClientConfig, AuthZe
|
|
|
75
73
|
const {appState} = await client.handleRedirectCallback();
|
|
76
74
|
this.restoreRedirectState(appState);
|
|
77
75
|
await this.noteUserAuthenticatedAsync();
|
|
78
|
-
return this.fetchAllTokensAsync();
|
|
76
|
+
return this.fetchAllTokensAsync({eagerOnly: true});
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
// 1) If we are logged in, try to just reload tokens silently. This is the happy path on
|
|
@@ -83,7 +81,7 @@ export class AuthZeroClient extends BaseOAuthClient<AuthZeroClientConfig, AuthZe
|
|
|
83
81
|
if (await client.isAuthenticated()) {
|
|
84
82
|
try {
|
|
85
83
|
this.logDebug('Attempting silent token load.');
|
|
86
|
-
return await this.fetchAllTokensAsync();
|
|
84
|
+
return await this.fetchAllTokensAsync({eagerOnly: true});
|
|
87
85
|
} catch (e) {
|
|
88
86
|
this.logDebug('Failed to load tokens on init, fall back to login', e.message ?? e);
|
|
89
87
|
}
|
|
@@ -94,7 +92,7 @@ export class AuthZeroClient extends BaseOAuthClient<AuthZeroClientConfig, AuthZe
|
|
|
94
92
|
await this.loginAsync();
|
|
95
93
|
|
|
96
94
|
// 3) return tokens
|
|
97
|
-
return this.fetchAllTokensAsync();
|
|
95
|
+
return this.fetchAllTokensAsync({eagerOnly: true});
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
protected override async doLoginRedirectAsync(): Promise<void> {
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
SilentRequest
|
|
14
14
|
} from '@azure/msal-browser';
|
|
15
15
|
import {XH} from '@xh/hoist/core';
|
|
16
|
-
import {Token
|
|
16
|
+
import {Token} from '@xh/hoist/security/Token';
|
|
17
|
+
import {AccessTokenSpec, TokenMap} from '../Types';
|
|
17
18
|
import {logDebug, logError, logInfo, logWarn, mergeDeep, throwIf} from '@xh/hoist/utils/js';
|
|
18
19
|
import {flatMap, union, uniq} from 'lodash';
|
|
19
20
|
import {BaseOAuthClient, BaseOAuthClientConfig} from '../BaseOAuthClient';
|
|
@@ -65,10 +66,7 @@ export interface MsalClientConfig extends BaseOAuthClientConfig<MsalTokenSpec> {
|
|
|
65
66
|
msalClientOptions?: Partial<msal.Configuration>;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
export interface MsalTokenSpec {
|
|
69
|
-
/** Scopes for the desired access token. */
|
|
70
|
-
scopes: string[];
|
|
71
|
-
|
|
69
|
+
export interface MsalTokenSpec extends AccessTokenSpec {
|
|
72
70
|
/**
|
|
73
71
|
* Scopes to be added to the scopes requested during interactive and SSO logins.
|
|
74
72
|
* See the `scopes` property on `PopupRequest`, `RedirectRequest`, and `SSORequest`
|
|
@@ -127,7 +125,7 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
127
125
|
this.logDebug('Completing Redirect login');
|
|
128
126
|
this.noteUserAuthenticated(redirectResp.account);
|
|
129
127
|
this.restoreRedirectState(redirectResp.state);
|
|
130
|
-
return this.fetchAllTokensAsync();
|
|
128
|
+
return this.fetchAllTokensAsync({eagerOnly: true});
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
// 1) If we are logged in, try to just reload tokens silently. This is the happy path on
|
|
@@ -142,7 +140,7 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
142
140
|
try {
|
|
143
141
|
this.initialTokenLoad = true;
|
|
144
142
|
this.logDebug('Attempting silent token load.');
|
|
145
|
-
return await this.fetchAllTokensAsync();
|
|
143
|
+
return await this.fetchAllTokensAsync({eagerOnly: true});
|
|
146
144
|
} catch (e) {
|
|
147
145
|
this.account = null;
|
|
148
146
|
this.logDebug('Failed to load tokens on init, fall back to login', e.message ?? e);
|
|
@@ -171,7 +169,7 @@ export class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTokenSpec>
|
|
|
171
169
|
}
|
|
172
170
|
|
|
173
171
|
// 3) Return tokens
|
|
174
|
-
return this.fetchAllTokensAsync();
|
|
172
|
+
return this.fetchAllTokensAsync({eagerOnly: true});
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
protected override async doLoginPopupAsync(): Promise<void> {
|