@xh/hoist 73.0.0-SNAPSHOT.1740517958946 → 73.0.0-SNAPSHOT.1741787114903
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
CHANGED
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
* Modify `TabContainerModel` to make more methods `protected`, improving extensibility for advanced
|
|
8
8
|
use-cases.
|
|
9
9
|
|
|
10
|
+
* Enhance exception handling in `FetchService` to capture messages returned as raw strings, or without
|
|
11
|
+
explicit names.
|
|
12
|
+
|
|
13
|
+
|
|
10
14
|
## v72.1.0 - 2025-02-13
|
|
11
15
|
|
|
12
16
|
### 🎁 New Features
|
|
@@ -63,11 +63,10 @@ export interface BaseOAuthClientConfig<S> {
|
|
|
63
63
|
* suitable concrete implementation to power a client-side OauthService. See `MsalClient` and
|
|
64
64
|
* `AuthZeroClient`
|
|
65
65
|
*
|
|
66
|
-
* Initialize such a service and this client within
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* flow as necessary.
|
|
66
|
+
* Initialize such a service and this client within an app's primary {@link HoistAuthModel} to use
|
|
67
|
+
* the tokens it acquires to authenticate with the Hoist server. (Note this requires a suitable
|
|
68
|
+
* server-side `AuthenticationService` implementation to validate the token and actually resolve
|
|
69
|
+
* the user.) On init, the client impl will initiate a pop-up or redirect flow as necessary.
|
|
71
70
|
*/
|
|
72
71
|
export declare abstract class BaseOAuthClient<C extends BaseOAuthClientConfig<S>, S> extends HoistBase {
|
|
73
72
|
/** Config loaded from UI server + init method. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {PlainObject, XH} from '@xh/hoist/core';
|
|
8
8
|
import {FetchOptions} from '@xh/hoist/svc';
|
|
9
9
|
import {pluralize} from '@xh/hoist/utils/js';
|
|
10
|
-
import {isPlainObject} from 'lodash';
|
|
10
|
+
import {isPlainObject, truncate} from 'lodash';
|
|
11
11
|
import {FetchException, HoistException, TimeoutException, TimeoutExceptionConfig} from './Types';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -90,17 +90,16 @@ export class Exception {
|
|
|
90
90
|
// Try to "smart" decode as server provided JSON Exception (with a name)
|
|
91
91
|
try {
|
|
92
92
|
const cType = headers.get('Content-Type');
|
|
93
|
-
if (cType
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
93
|
+
if (cType?.includes('application/json')) {
|
|
94
|
+
const obj = safeParseJson(responseText),
|
|
95
|
+
message = obj ? obj.message : truncate(responseText?.trim(), {length: 255});
|
|
96
|
+
return this.createFetchException({
|
|
97
|
+
...defaults,
|
|
98
|
+
name: obj?.name ?? defaults.name,
|
|
99
|
+
message: message ?? statusText,
|
|
100
|
+
isRoutine: obj?.isRoutine ?? false,
|
|
101
|
+
serverDetails: obj ?? responseText
|
|
102
|
+
});
|
|
104
103
|
}
|
|
105
104
|
} catch (ignored) {}
|
|
106
105
|
|
|
@@ -222,6 +221,14 @@ export class Exception {
|
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
223
|
|
|
224
|
+
function safeParseJson(txt: string): PlainObject {
|
|
225
|
+
try {
|
|
226
|
+
return JSON.parse(txt);
|
|
227
|
+
} catch (ignored) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
225
232
|
export function isHoistException(src: unknown): src is HoistException {
|
|
226
233
|
return src?.['isHoistException'];
|
|
227
234
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "73.0.0-SNAPSHOT.
|
|
3
|
+
"version": "73.0.0-SNAPSHOT.1741787114903",
|
|
4
4
|
"description": "Hoist add-on for building and deploying React Applications.",
|
|
5
5
|
"repository": "github:xh/hoist-react",
|
|
6
6
|
"homepage": "https://xh.io",
|
|
@@ -89,11 +89,10 @@ export interface BaseOAuthClientConfig<S> {
|
|
|
89
89
|
* suitable concrete implementation to power a client-side OauthService. See `MsalClient` and
|
|
90
90
|
* `AuthZeroClient`
|
|
91
91
|
*
|
|
92
|
-
* Initialize such a service and this client within
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* flow as necessary.
|
|
92
|
+
* Initialize such a service and this client within an app's primary {@link HoistAuthModel} to use
|
|
93
|
+
* the tokens it acquires to authenticate with the Hoist server. (Note this requires a suitable
|
|
94
|
+
* server-side `AuthenticationService` implementation to validate the token and actually resolve
|
|
95
|
+
* the user.) On init, the client impl will initiate a pop-up or redirect flow as necessary.
|
|
97
96
|
*/
|
|
98
97
|
export abstract class BaseOAuthClient<C extends BaseOAuthClientConfig<S>, S> extends HoistBase {
|
|
99
98
|
/** Config loaded from UI server + init method. */
|