@astrale-os/kernel-client 1.0.0-beta.30 → 1.0.0-beta.31
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/errors/refusal.d.ts +5 -0
- package/dist/errors/refusal.js +20 -5
- package/package.json +4 -4
package/dist/errors/refusal.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ResponseError } from './response-error.js';
|
|
2
2
|
/** Return the delay a refused invocation prescribes before it is sent again, and nothing else. */
|
|
3
3
|
export declare function retryAfterOf(error: unknown): number | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Return the byte bound the answer to an invocation exceeded, whichever side refused it: the
|
|
6
|
+
* client's own `maximumResponseBytes`, or the server's, and nothing else.
|
|
7
|
+
*/
|
|
8
|
+
export declare function maximumResponseBytesOf(error: unknown): number | undefined;
|
|
4
9
|
/** Whether the Instance refused the invocation because a maintenance session admits only root. */
|
|
5
10
|
export declare function isMaintenance(error: unknown): error is ResponseError;
|
|
6
11
|
/**
|
package/dist/errors/refusal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
2
2
|
import { CALLABLE_FINGERPRINT_MISMATCH } from '@astrale-os/kernel-protocol/invocation';
|
|
3
3
|
import { ResponseError } from './response-error.js';
|
|
4
|
+
import { ResponseTooLargeError } from './response-too-large-error.js';
|
|
4
5
|
/**
|
|
5
6
|
* Sealed conflicts whose plan met a checkpoint advanced past its pinned snapshot, an Authority
|
|
6
7
|
* evaluation's included (POLICY_SNAPSHOT_MISMATCH).
|
|
@@ -21,11 +22,18 @@ const EXPECTATION_MISMATCH_REASONS = new Set([
|
|
|
21
22
|
export function retryAfterOf(error) {
|
|
22
23
|
if (!(error instanceof ResponseError))
|
|
23
24
|
return undefined;
|
|
24
|
-
return errors.retryAfterOf(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return errors.retryAfterOf(payloadOf(error));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Return the byte bound the answer to an invocation exceeded, whichever side refused it: the
|
|
29
|
+
* client's own `maximumResponseBytes`, or the server's, and nothing else.
|
|
30
|
+
*/
|
|
31
|
+
export function maximumResponseBytesOf(error) {
|
|
32
|
+
if (error instanceof ResponseTooLargeError)
|
|
33
|
+
return error.maximumResponseBytes;
|
|
34
|
+
if (!(error instanceof ResponseError))
|
|
35
|
+
return undefined;
|
|
36
|
+
return errors.maximumResponseBytesOf(payloadOf(error));
|
|
29
37
|
}
|
|
30
38
|
/** Whether the Instance refused the invocation because a maintenance session admits only root. */
|
|
31
39
|
export function isMaintenance(error) {
|
|
@@ -61,3 +69,10 @@ export function isExpectationMismatch(error) {
|
|
|
61
69
|
error.reason !== undefined &&
|
|
62
70
|
EXPECTATION_MISMATCH_REASONS.has(error.reason.code));
|
|
63
71
|
}
|
|
72
|
+
function payloadOf(error) {
|
|
73
|
+
return {
|
|
74
|
+
code: error.code,
|
|
75
|
+
message: error.message,
|
|
76
|
+
...(error.data === undefined ? {} : { data: error.data }),
|
|
77
|
+
};
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.31",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@astrale-os/kernel-core": "1.0.0-beta.
|
|
68
|
+
"@astrale-os/kernel-core": "1.0.0-beta.28",
|
|
69
69
|
"@astrale-os/kernel-dsl": "1.0.0-beta.19",
|
|
70
|
-
"@astrale-os/kernel-protocol": "1.0.0-beta.
|
|
70
|
+
"@astrale-os/kernel-protocol": "1.0.0-beta.28",
|
|
71
71
|
"@tanstack/pacer": "0.20.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@astrale-os/kernel-server": "1.0.0-beta.
|
|
74
|
+
"@astrale-os/kernel-server": "1.0.0-beta.28",
|
|
75
75
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"esbuild": "0.28.1",
|