@astrale-os/kernel-client 1.0.0-beta.10 → 1.0.0-beta.11

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.
@@ -10,3 +10,10 @@ export declare function isMaintenance(error: unknown): error is ResponseError;
10
10
  export declare function isMaintenanceSessionStale(error: unknown): error is ResponseError;
11
11
  /** Whether a sealed conflict ran nothing because the graph snapshot advanced; resend it at once. */
12
12
  export declare function isSnapshotStale(error: unknown): error is ResponseError;
13
+ /**
14
+ * Whether the Kernel refused a request because the client was built against a Domain meaning this
15
+ * Instance does not serve: the revision a Query or a Mutation expects of a Domain, or the meaning
16
+ * of a callable. Nothing ran; resending it unchanged cannot succeed, so the client is rebuilt or
17
+ * reloaded against what the Instance serves.
18
+ */
19
+ export declare function isExpectationMismatch(error: unknown): error is ResponseError;
@@ -1,4 +1,5 @@
1
1
  import * as errors from '@astrale-os/kernel-protocol/errors';
2
+ import { CALLABLE_FINGERPRINT_MISMATCH } from '@astrale-os/kernel-protocol/invocation';
2
3
  import { ResponseError } from './response-error.js';
3
4
  /** Sealed conflicts whose plan met a checkpoint advanced past its pinned snapshot. */
4
5
  const SNAPSHOT_STALE_REASONS = new Set([
@@ -6,6 +7,12 @@ const SNAPSHOT_STALE_REASONS = new Set([
6
7
  'QUERY_SNAPSHOT_STALE',
7
8
  'MUTATION_SNAPSHOT_STALE',
8
9
  ]);
10
+ /** Conflicts whose request expects a Domain meaning this Instance does not serve. */
11
+ const EXPECTATION_MISMATCH_REASONS = new Set([
12
+ 'QUERY_EXPECTATION_MISMATCH',
13
+ 'MUTATION_EXPECTATION_MISMATCH',
14
+ CALLABLE_FINGERPRINT_MISMATCH,
15
+ ]);
9
16
  /** Return the delay a refused invocation prescribes before it is sent again, and nothing else. */
10
17
  export function retryAfterOf(error) {
11
18
  if (!(error instanceof ResponseError))
@@ -38,3 +45,15 @@ export function isSnapshotStale(error) {
38
45
  error.reason !== undefined &&
39
46
  SNAPSHOT_STALE_REASONS.has(error.reason.code));
40
47
  }
48
+ /**
49
+ * Whether the Kernel refused a request because the client was built against a Domain meaning this
50
+ * Instance does not serve: the revision a Query or a Mutation expects of a Domain, or the meaning
51
+ * of a callable. Nothing ran; resending it unchanged cannot succeed, so the client is rebuilt or
52
+ * reloaded against what the Instance serves.
53
+ */
54
+ export function isExpectationMismatch(error) {
55
+ return (error instanceof ResponseError &&
56
+ error.code === errors.CODES.CONFLICT &&
57
+ error.reason !== undefined &&
58
+ EXPECTATION_MISMATCH_REASONS.has(error.reason.code));
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-client",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "Universal Client — protocol-first, transport-agnostic",
5
5
  "keywords": [
6
6
  "astrale",