@xh/hoist 89.2.0 → 89.3.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
CHANGED
|
@@ -11,6 +11,19 @@
|
|
|
11
11
|
codebase, or with the symbol itself (`Foo.bar` now ...) when a living API changed behavior.
|
|
12
12
|
3. Plain ASCII punctuation only. Use " - " for in-sentence breaks, never an em dash.
|
|
13
13
|
-->
|
|
14
|
+
## 89.3.0 - 2026-10-21
|
|
15
|
+
|
|
16
|
+
### 🎁 New Features
|
|
17
|
+
* `fetchNdjson` streams are now aborted cleanly and fully via the `autoAbortKey` or if the reading
|
|
18
|
+
consumer closes the connection early.
|
|
19
|
+
|
|
20
|
+
### 🐞 Bug Fixes
|
|
21
|
+
* Fixed a `FetchOptions.fetchOpts.signal` replacing `FetchService`'s own, which left `timeout` and
|
|
22
|
+
`autoAbortKey` unable to abort the request. The two signals are now joined, and an abort with a
|
|
23
|
+
custom reason reports as "Fetch Aborted".
|
|
24
|
+
* Fixed oversized pinned column zones in the desktop column chooser. They now fit their columns.
|
|
25
|
+
|
|
26
|
+
|
|
14
27
|
## 89.2.0 - 2026-10-20
|
|
15
28
|
|
|
16
29
|
### 🎁 New Features
|
|
@@ -177,8 +177,9 @@ export declare class FetchService extends HoistService {
|
|
|
177
177
|
getInternStats(): PlainObject[];
|
|
178
178
|
private static readonly defaultIdGenerator;
|
|
179
179
|
/**
|
|
180
|
-
* @param
|
|
181
|
-
* track across the full stream lifetime - suppresses both here
|
|
180
|
+
* @param streamAborter - aborter for a stream, set by fetchNdjson. It applies its own span and
|
|
181
|
+
* track across the full stream lifetime - suppresses both here - and releases any
|
|
182
|
+
* autoAbortKey once the stream completes.
|
|
182
183
|
*/
|
|
183
184
|
private fetchInternalAsync;
|
|
184
185
|
private sendJsonInternalAsync;
|
|
@@ -187,6 +188,8 @@ export declare class FetchService extends HoistService {
|
|
|
187
188
|
private withResolvedHeadersAsync;
|
|
188
189
|
private shouldPropagateTrace;
|
|
189
190
|
private managedFetchAsync;
|
|
191
|
+
private isAborted;
|
|
192
|
+
private releaseAutoAbortKey;
|
|
190
193
|
private abortableFetchAsync;
|
|
191
194
|
private parseJsonAsync;
|
|
192
195
|
private safeResponseTextAsync;
|
|
@@ -127,15 +127,12 @@
|
|
|
127
127
|
height: fit-content;
|
|
128
128
|
min-height: 40px;
|
|
129
129
|
|
|
130
|
+
// Shrink ag-grid's auto-height body floor (150px by default) to match our compact drop strip.
|
|
131
|
+
--ag-auto-height-min-body-height: 40px;
|
|
132
|
+
|
|
130
133
|
// Match the unpinned bucket's reserved gutter, so action-column checkboxes share a right edge.
|
|
131
134
|
padding-right: var(--xh-scrollbar-size-px);
|
|
132
135
|
|
|
133
|
-
// Override ag-grid's own inline min-height on this viewport (set via JS layout) to match our
|
|
134
|
-
// compact drop strip.
|
|
135
|
-
.ag-layout-auto-height .ag-body-horizontal-scroll-viewport {
|
|
136
|
-
min-height: 40px !important;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
136
|
.ag-overlay-no-rows-wrapper {
|
|
140
137
|
// ag-grid's inline centering padding-top is computed against a pre-layout (~0) auto-height
|
|
141
138
|
// viewport, hiding the text until a resize recomputes it. Our strip is a fixed band anyway.
|
package/package.json
CHANGED
package/svc/FetchService.ts
CHANGED
|
@@ -213,18 +213,23 @@ export class FetchService extends HoistService {
|
|
|
213
213
|
// The runner will manage the lifecycle, but we won't await it here -- return
|
|
214
214
|
// the result straight away. Also stifle telemetry exception. Stream already produces them.
|
|
215
215
|
let ret: NdjsonResultImpl;
|
|
216
|
+
const aborter = new AbortController();
|
|
216
217
|
runner
|
|
217
218
|
.run(async innerCtx => {
|
|
218
219
|
ret = new NdjsonResultImpl(
|
|
219
|
-
this.fetchInternalAsync(opts, innerCtx,
|
|
220
|
+
this.fetchInternalAsync(opts, innerCtx, aborter),
|
|
220
221
|
opts,
|
|
221
222
|
this.getInterner(opts.internStrings),
|
|
222
223
|
(cause, response) =>
|
|
223
|
-
|
|
224
|
+
this.isAborted(opts, aborter)
|
|
224
225
|
? this.abortedException(opts, innerCtx, cause)
|
|
225
226
|
: this.streamFailedException(opts, innerCtx, response, cause)
|
|
226
227
|
);
|
|
227
|
-
|
|
228
|
+
try {
|
|
229
|
+
await ret.whenCompleteAsync();
|
|
230
|
+
} finally {
|
|
231
|
+
this.releaseAutoAbortKey(opts.autoAbortKey, aborter);
|
|
232
|
+
}
|
|
228
233
|
})
|
|
229
234
|
.catch(noop);
|
|
230
235
|
return ret;
|
|
@@ -311,15 +316,17 @@ export class FetchService extends HoistService {
|
|
|
311
316
|
private static readonly defaultIdGenerator = new ShortUniqueId({length: 16});
|
|
312
317
|
|
|
313
318
|
/**
|
|
314
|
-
* @param
|
|
315
|
-
* track across the full stream lifetime - suppresses both here
|
|
319
|
+
* @param streamAborter - aborter for a stream, set by fetchNdjson. It applies its own span and
|
|
320
|
+
* track across the full stream lifetime - suppresses both here - and releases any
|
|
321
|
+
* autoAbortKey once the stream completes.
|
|
316
322
|
*/
|
|
317
323
|
private async fetchInternalAsync(
|
|
318
324
|
opts: FetchOptions,
|
|
319
325
|
ctx?: CallContextLike,
|
|
320
|
-
|
|
326
|
+
streamAborter: AbortController = null
|
|
321
327
|
): Promise<any> {
|
|
322
328
|
ctx ??= {};
|
|
329
|
+
const forStreaming = !!streamAborter;
|
|
323
330
|
|
|
324
331
|
let spanConfig = forStreaming ? null : this.createSpanConfig(opts),
|
|
325
332
|
runner = spanConfig ? this.runner(ctx).span(spanConfig) : this.runner(ctx),
|
|
@@ -327,7 +334,7 @@ export class FetchService extends HoistService {
|
|
|
327
334
|
opts = this.withCorrelationId(opts);
|
|
328
335
|
opts = this.withTraceId(opts, ctx.span);
|
|
329
336
|
return this.withResolvedHeadersAsync(opts, ctx.span).then(opts =>
|
|
330
|
-
this.managedFetchAsync(opts, ctx)
|
|
337
|
+
this.managedFetchAsync(opts, ctx, streamAborter)
|
|
331
338
|
);
|
|
332
339
|
});
|
|
333
340
|
|
|
@@ -428,15 +435,19 @@ export class FetchService extends HoistService {
|
|
|
428
435
|
return isFunction(propagateTrace) ? propagateTrace(opts) : propagateTrace;
|
|
429
436
|
}
|
|
430
437
|
|
|
431
|
-
private async managedFetchAsync(
|
|
438
|
+
private async managedFetchAsync(
|
|
439
|
+
opts: FetchOptions,
|
|
440
|
+
callCtx: CallContext,
|
|
441
|
+
streamAborter: AbortController
|
|
442
|
+
): Promise<any> {
|
|
432
443
|
// Prepare auto-aborter
|
|
433
444
|
const {autoAborters, defaultTimeout} = this,
|
|
434
445
|
{autoAbortKey, timeout = defaultTimeout} = opts,
|
|
435
|
-
aborter = new AbortController();
|
|
446
|
+
aborter = streamAborter ?? new AbortController();
|
|
436
447
|
|
|
437
448
|
// autoAbortKey handling. Abort anything running under this key, and mark this run
|
|
438
449
|
if (autoAbortKey) {
|
|
439
|
-
|
|
450
|
+
this.abort(autoAbortKey);
|
|
440
451
|
autoAborters[autoAbortKey] = aborter;
|
|
441
452
|
}
|
|
442
453
|
|
|
@@ -455,17 +466,24 @@ export class FetchService extends HoistService {
|
|
|
455
466
|
throw this.timeoutException(opts, callCtx, e, msg);
|
|
456
467
|
}
|
|
457
468
|
|
|
458
|
-
if (
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
throw e;
|
|
469
|
+
if (this.isAborted(opts, aborter)) throw this.abortedException(opts, callCtx, e);
|
|
470
|
+
if (e.isHoistException) throw e;
|
|
471
|
+
|
|
472
|
+
// Any other error means the server could not be reached.
|
|
473
|
+
throw this.serverUnavailableException(opts, callCtx, e);
|
|
465
474
|
} finally {
|
|
466
|
-
if (
|
|
467
|
-
|
|
468
|
-
|
|
475
|
+
if (!streamAborter) this.releaseAutoAbortKey(autoAbortKey, aborter);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// Fetch listens to both signals, joined - check each, as a custom abort reason is no AbortError.
|
|
480
|
+
private isAborted(opts: FetchOptions, aborter: AbortController): boolean {
|
|
481
|
+
return aborter.signal.aborted || !!opts.fetchOpts?.signal?.aborted;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
private releaseAutoAbortKey(autoAbortKey: string, aborter: AbortController) {
|
|
485
|
+
if (autoAbortKey && this.autoAborters[autoAbortKey] === aborter) {
|
|
486
|
+
delete this.autoAborters[autoAbortKey];
|
|
469
487
|
}
|
|
470
488
|
}
|
|
471
489
|
|
|
@@ -478,16 +496,17 @@ export class FetchService extends HoistService {
|
|
|
478
496
|
let {url, method, headers, body, params} = opts;
|
|
479
497
|
url = this.resolveUrl(url);
|
|
480
498
|
|
|
481
|
-
// 2) Prepare options for fetch API
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
499
|
+
// 2) Prepare options for fetch API. Join any caller signal with ours, so either aborts.
|
|
500
|
+
const {signal, ...callerFetchOpts} = opts.fetchOpts ?? {},
|
|
501
|
+
fetchOpts: RequestInit = {
|
|
502
|
+
credentials: 'include',
|
|
503
|
+
redirect: 'follow',
|
|
504
|
+
headers: new Headers(omitBy(headers, isNil)),
|
|
505
|
+
method,
|
|
506
|
+
body,
|
|
507
|
+
...callerFetchOpts,
|
|
508
|
+
signal: signal ? AbortSignal.any([aborter.signal, signal]) : aborter.signal
|
|
509
|
+
};
|
|
491
510
|
|
|
492
511
|
// 3) Preprocess and apply params
|
|
493
512
|
if (params) {
|
package/svc/README.md
CHANGED
|
@@ -136,7 +136,8 @@ override async doLoadAsync(loadSpec: LoadSpec) {
|
|
|
136
136
|
| `params` | object | Query string parameters |
|
|
137
137
|
| `headers` | object | Additional headers |
|
|
138
138
|
| `timeout` | number | Timeout in ms (default 30000) |
|
|
139
|
-
| `autoAbortKey` | string | Cancel previous requests with same key
|
|
139
|
+
| `autoAbortKey` | string | Cancel previous requests with same key. For `fetchNdjson`, covers the whole stream |
|
|
140
|
+
| `fetchOpts` | object | Options for the native `fetch()`. A `signal` here also aborts the request, alongside Hoist's own |
|
|
140
141
|
| `propagateTrace` | boolean | Send a `traceparent` header when tracing is enabled. Overrides `FetchService.defaults.propagateTrace` |
|
|
141
142
|
| `loadSpec` | LoadSpec | Metadata for tracking |
|
|
142
143
|
| `span` | Span | Parent span for tracing. Typically supplied via a `Runner` chain (`runner.fetchJson(...)`) rather than set directly |
|
|
@@ -119,19 +119,24 @@ export class NdjsonResultImpl implements NdjsonResult {
|
|
|
119
119
|
decoder = new TextDecoder();
|
|
120
120
|
let buffer = '';
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
try {
|
|
123
|
+
while (true) {
|
|
124
|
+
const {done, value} = await reader.read();
|
|
125
|
+
if (done) break;
|
|
126
|
+
|
|
127
|
+
buffer += decoder.decode(value, {stream: true});
|
|
128
|
+
const lines = buffer.split('\n');
|
|
129
|
+
buffer = lines.pop(); // retain any partial trailing line for the next chunk
|
|
130
|
+
for (const line of lines) {
|
|
131
|
+
if (!line) continue;
|
|
132
|
+
const record = JSON.parse(line);
|
|
133
|
+
interner?.intern(record);
|
|
134
|
+
yield record;
|
|
135
|
+
}
|
|
134
136
|
}
|
|
137
|
+
} finally {
|
|
138
|
+
// Close the connection if the consumer exits early or a line fails to parse.
|
|
139
|
+
reader.cancel().catch(noop);
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
buffer += decoder.decode();
|