@north-light/crouter-api 0.3.317 → 0.3.319
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/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +9 -9
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -310,7 +310,7 @@ export declare class CrtrClient {
|
|
|
310
310
|
prune(req: PruneRequest): Promise<PruneResultDTO>;
|
|
311
311
|
/** Raw request for routes not yet method-wrapped. Applies the same
|
|
312
312
|
* autostart + error-mapping semantics. */
|
|
313
|
-
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
313
|
+
request<T>(method: string, path: string, body?: unknown, timeoutMs?: number): Promise<T>;
|
|
314
314
|
/** The unparsed request: cold-socket and interrupted-response recovery, no
|
|
315
315
|
* JSON parse. Every wrapper goes through here; only non-JSON routes call it directly. */
|
|
316
316
|
private send;
|
package/dist/api/client.js
CHANGED
|
@@ -156,7 +156,7 @@ export class CrtrClient {
|
|
|
156
156
|
if (waitSeconds !== undefined && (!Number.isInteger(waitSeconds) || waitSeconds < 0 || waitSeconds > 25)) {
|
|
157
157
|
throw new RangeError('waitSeconds must be an integer between 0 and 25');
|
|
158
158
|
}
|
|
159
|
-
return this.request('GET', withQuery(routes.nodeOutcome(this.nodePath(id)), { wait: waitSeconds }));
|
|
159
|
+
return this.request('GET', withQuery(routes.nodeOutcome(this.nodePath(id)), { wait: waitSeconds }), undefined, (waitSeconds ?? 0) * 1_000 + this.timeoutMs);
|
|
160
160
|
}
|
|
161
161
|
/** Register or replace an armed target for terminal-outcome delivery. */
|
|
162
162
|
registerOutcomeDelivery(id, req) {
|
|
@@ -630,27 +630,27 @@ export class CrtrClient {
|
|
|
630
630
|
// Escape hatch
|
|
631
631
|
/** Raw request for routes not yet method-wrapped. Applies the same
|
|
632
632
|
* autostart + error-mapping semantics. */
|
|
633
|
-
async request(method, path, body) {
|
|
634
|
-
return parse(await this.send(method, path, body));
|
|
633
|
+
async request(method, path, body, timeoutMs) {
|
|
634
|
+
return parse(await this.send(method, path, body, undefined, timeoutMs));
|
|
635
635
|
}
|
|
636
636
|
/** The unparsed request: cold-socket and interrupted-response recovery, no
|
|
637
637
|
* JSON parse. Every wrapper goes through here; only non-JSON routes call it directly. */
|
|
638
|
-
async send(method, path, body, extraHeaders) {
|
|
638
|
+
async send(method, path, body, extraHeaders, timeoutMs) {
|
|
639
639
|
try {
|
|
640
|
-
return await this.transport(method, path, body, extraHeaders);
|
|
640
|
+
return await this.transport(method, path, body, extraHeaders, timeoutMs);
|
|
641
641
|
}
|
|
642
642
|
catch (err) {
|
|
643
643
|
if (this.isColdSocketError(err)) {
|
|
644
644
|
try {
|
|
645
645
|
await this.handleColdSocket(err);
|
|
646
|
-
return await this.transport(method, path, body, extraHeaders);
|
|
646
|
+
return await this.transport(method, path, body, extraHeaders, timeoutMs);
|
|
647
647
|
}
|
|
648
648
|
catch (recoveryError) {
|
|
649
649
|
throw toTransportApiError(recoveryError);
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
if (this.isInterruptedSocketError(err))
|
|
653
|
-
return await this.rideOutInterruptedRequest(method, path, body, extraHeaders);
|
|
653
|
+
return await this.rideOutInterruptedRequest(method, path, body, extraHeaders, timeoutMs);
|
|
654
654
|
throw toTransportApiError(err);
|
|
655
655
|
}
|
|
656
656
|
}
|
|
@@ -782,7 +782,7 @@ export class CrtrClient {
|
|
|
782
782
|
/** Wait for the local API after an interrupted response. GET/HEAD can retry
|
|
783
783
|
* because they are idempotent. A mutation may already have been applied, so
|
|
784
784
|
* it never replays. */
|
|
785
|
-
async rideOutInterruptedRequest(method, path, body, extraHeaders) {
|
|
785
|
+
async rideOutInterruptedRequest(method, path, body, extraHeaders, timeoutMs) {
|
|
786
786
|
try {
|
|
787
787
|
await this.awaitAvailability();
|
|
788
788
|
}
|
|
@@ -793,7 +793,7 @@ export class CrtrClient {
|
|
|
793
793
|
throw new ApiError(503, 'daemon_request_interrupted', `crtrd connection ended before this ${method} response; the request may or may not have been applied.`);
|
|
794
794
|
}
|
|
795
795
|
try {
|
|
796
|
-
return await this.transport(method, path, body, extraHeaders);
|
|
796
|
+
return await this.transport(method, path, body, extraHeaders, timeoutMs);
|
|
797
797
|
}
|
|
798
798
|
catch (err) {
|
|
799
799
|
throw toTransportApiError(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/crouter-api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.319",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|