@xh/hoist 83.0.1 → 83.1.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 +23 -1
- package/build/types/cmp/error/ErrorBoundary.d.ts +2 -0
- package/build/types/cmp/error/ErrorBoundaryModel.d.ts +12 -0
- package/build/types/cmp/filter/FilterChooserModel.d.ts +18 -0
- package/build/types/cmp/form/Form.d.ts +4 -4
- package/build/types/cmp/form/formfieldset/FormFieldSetModel.d.ts +9 -0
- package/build/types/cmp/grouping/GroupingChooserModel.d.ts +16 -0
- package/build/types/cmp/pinpad/PinPadModel.d.ts +8 -0
- package/build/types/cmp/treemap/SplitTreeMapModel.d.ts +10 -10
- package/build/types/cmp/treemap/TreeMapModel.d.ts +19 -20
- package/build/types/core/HoistComponent.d.ts +20 -22
- package/build/types/core/load/LoadSpec.d.ts +19 -19
- package/build/types/data/impl/RecordSet.d.ts +2 -2
- package/build/types/desktop/cmp/input/DateInput.d.ts +1 -1
- package/build/types/desktop/cmp/leftrightchooser/LeftRightChooserModel.d.ts +1 -1
- package/build/types/svc/AutoRefreshService.d.ts +1 -1
- package/build/types/svc/ChangelogService.d.ts +2 -3
- package/build/types/svc/FetchService.d.ts +19 -17
- package/cmp/error/ErrorBoundary.ts +2 -0
- package/cmp/error/ErrorBoundaryModel.ts +12 -0
- package/cmp/filter/FilterChooserModel.ts +18 -0
- package/cmp/form/Form.ts +4 -4
- package/cmp/form/formfieldset/FormFieldSetModel.ts +9 -0
- package/cmp/grouping/GroupingChooserModel.ts +16 -0
- package/cmp/pinpad/PinPadModel.ts +8 -0
- package/cmp/treemap/SplitTreeMapModel.ts +10 -10
- package/cmp/treemap/TreeMapModel.ts +19 -20
- package/core/HoistComponent.ts +20 -22
- package/core/load/LoadSpec.ts +19 -20
- package/data/impl/RecordSet.ts +3 -3
- package/desktop/cmp/input/DateInput.ts +1 -1
- package/desktop/cmp/leftrightchooser/LeftRightChooserModel.ts +1 -1
- package/mcp/cli/ts.ts +9 -2
- package/mcp/data/ts-registry.ts +116 -12
- package/mcp/formatters/typescript.ts +50 -4
- package/mcp/tools/typescript.ts +9 -2
- package/package.json +2 -2
- package/svc/AutoRefreshService.ts +1 -1
- package/svc/ChangelogService.ts +2 -3
- package/svc/EnvironmentService.ts +7 -5
- package/svc/FetchService.ts +20 -18
- package/svc/WebSocketService.ts +1 -1
package/svc/FetchService.ts
CHANGED
|
@@ -25,32 +25,34 @@ import ShortUniqueId from 'short-unique-id';
|
|
|
25
25
|
|
|
26
26
|
const defaultIdGenerator = new ShortUniqueId({length: 16});
|
|
27
27
|
|
|
28
|
+
export interface FetchServiceDefaults {
|
|
29
|
+
autoGenCorrelationIds?: boolean | ((opts: FetchOptions) => boolean);
|
|
30
|
+
correlationIdHeaderKey?: string;
|
|
31
|
+
genCorrelationId?: () => string;
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* Service for making managed HTTP requests, both to the app's own Hoist server and to remote APIs.
|
|
30
36
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* included, and redirects followed.
|
|
37
|
+
* Typically accessed via `XH.fetchService` or the convenience methods on XH — `XH.fetch()`,
|
|
38
|
+
* `XH.fetchJson()`, `XH.postJson()`, `XH.putJson()`, `XH.deleteJson()` — which delegate here.
|
|
34
39
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* {@link FetchOptions.correlationId}.
|
|
40
|
+
* Wraps the standard Fetch API with CORS enabled, credentials included, and redirects followed.
|
|
41
|
+
* Provides JSON convenience methods (`fetchJson`, `postJson`, `putJson`, `patchJson`,
|
|
42
|
+
* `deleteJson`, `getJson`) that handle serialization and content-type headers automatically.
|
|
39
43
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
44
|
+
* Key features:
|
|
45
|
+
* - Configurable timeouts (default 30s) via {@link FetchOptions.timeout}
|
|
46
|
+
* - Auto-abort of duplicate in-flight requests via {@link FetchOptions.autoAbortKey}
|
|
47
|
+
* - Optional correlation IDs for request tracking (see `defaults.autoGenCorrelationIds`)
|
|
48
|
+
* - Request/response interceptors via {@link addInterceptor}
|
|
49
|
+
* - Default headers for all requests via {@link addDefaultHeaders}
|
|
50
|
+
* - Rich exception handling with HTTP status, server messages, and trace IDs
|
|
42
51
|
*
|
|
43
|
-
*
|
|
52
|
+
* All convenience methods accept the same {@link FetchOptions} as the main `fetch()` entry point.
|
|
44
53
|
*
|
|
45
|
-
*
|
|
46
|
-
* as the main entry point `fetch`, as they delegate to fetch after setting additional defaults.
|
|
54
|
+
* @see FetchOptions
|
|
47
55
|
*/
|
|
48
|
-
export interface FetchServiceDefaults {
|
|
49
|
-
autoGenCorrelationIds?: boolean | ((opts: FetchOptions) => boolean);
|
|
50
|
-
correlationIdHeaderKey?: string;
|
|
51
|
-
genCorrelationId?: () => string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
56
|
export class FetchService extends HoistService {
|
|
55
57
|
static instance: FetchService;
|
|
56
58
|
|
package/svc/WebSocketService.ts
CHANGED
|
@@ -345,7 +345,7 @@ export class WebSocketService extends HoistService {
|
|
|
345
345
|
private buildWebSocketUrl() {
|
|
346
346
|
const protocol = window.location.protocol == 'https:' ? 'wss:' : 'ws:',
|
|
347
347
|
endpoint = `xhWebSocket?${this.METADATA_FOR_HANDSHAKE.map(key => `${key}=${XH[key]}`).join('&')}`;
|
|
348
|
-
return XH.
|
|
348
|
+
return XH.baseUrl.includes('//')
|
|
349
349
|
? `${protocol}//${XH.baseUrl.split('//')[1]}${endpoint}`
|
|
350
350
|
: `${protocol}//${window.location.host}${XH.baseUrl}${endpoint}`;
|
|
351
351
|
}
|