@hydranium/protocol 1.0.0-next.30 → 1.0.0-next.300

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.
Files changed (259) hide show
  1. package/README.md +44 -49
  2. package/lib/abstract-logger.d.ts +5 -0
  3. package/lib/abstract-logger.d.ts.map +1 -1
  4. package/lib/abstract-logger.js +7 -0
  5. package/lib/abstract-logger.js.map +1 -1
  6. package/lib/client/data-connection.d.ts +302 -0
  7. package/lib/client/data-connection.d.ts.map +1 -0
  8. package/lib/client/data-connection.js +533 -0
  9. package/lib/client/data-connection.js.map +1 -0
  10. package/lib/client/data-events.d.ts +17 -1
  11. package/lib/client/data-events.d.ts.map +1 -1
  12. package/lib/client/data-events.js +25 -0
  13. package/lib/client/data-events.js.map +1 -1
  14. package/lib/client/data-port.d.ts +34 -24
  15. package/lib/client/data-port.d.ts.map +1 -1
  16. package/lib/client/data-session.d.ts +657 -89
  17. package/lib/client/data-session.d.ts.map +1 -1
  18. package/lib/client/data-session.js +1113 -115
  19. package/lib/client/data-session.js.map +1 -1
  20. package/lib/client/index.d.ts +15 -9
  21. package/lib/client/index.d.ts.map +1 -1
  22. package/lib/client/index.js +15 -9
  23. package/lib/client/index.js.map +1 -1
  24. package/lib/client/message-relay.d.ts +4 -4
  25. package/lib/client/message-relay.js +4 -4
  26. package/lib/client/message-relay.js.map +1 -1
  27. package/lib/client/post-message-transport.d.ts +64 -3
  28. package/lib/client/post-message-transport.d.ts.map +1 -1
  29. package/lib/client/post-message-transport.js +175 -1
  30. package/lib/client/post-message-transport.js.map +1 -1
  31. package/lib/client/rpc-connection.d.ts +157 -0
  32. package/lib/client/rpc-connection.d.ts.map +1 -0
  33. package/lib/client/rpc-connection.js +214 -0
  34. package/lib/client/rpc-connection.js.map +1 -0
  35. package/lib/client/worker-handshake.d.ts +72 -0
  36. package/lib/client/worker-handshake.d.ts.map +1 -0
  37. package/lib/client/worker-handshake.js +51 -0
  38. package/lib/client/worker-handshake.js.map +1 -0
  39. package/lib/client-ids.d.ts +45 -0
  40. package/lib/client-ids.d.ts.map +1 -0
  41. package/lib/client-ids.js +48 -0
  42. package/lib/client-ids.js.map +1 -0
  43. package/lib/clock.d.ts +50 -10
  44. package/lib/clock.d.ts.map +1 -1
  45. package/lib/clock.js +36 -1
  46. package/lib/clock.js.map +1 -1
  47. package/lib/console-logger.d.ts +23 -0
  48. package/lib/console-logger.d.ts.map +1 -0
  49. package/lib/console-logger.js +39 -0
  50. package/lib/console-logger.js.map +1 -0
  51. package/lib/data/data-protocol-methods.d.ts +4 -4
  52. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  53. package/lib/data/data-protocol-methods.js +13 -1
  54. package/lib/data/data-protocol-methods.js.map +1 -1
  55. package/lib/data/data-server-protocol.d.ts +165 -48
  56. package/lib/data/data-server-protocol.d.ts.map +1 -1
  57. package/lib/data/events.d.ts +137 -21
  58. package/lib/data/events.d.ts.map +1 -1
  59. package/lib/data/requests.d.ts +71 -11
  60. package/lib/data/requests.d.ts.map +1 -1
  61. package/lib/debouncer.d.ts +3 -3
  62. package/lib/debouncer.d.ts.map +1 -1
  63. package/lib/debouncer.js +6 -9
  64. package/lib/debouncer.js.map +1 -1
  65. package/lib/errors.d.ts +175 -30
  66. package/lib/errors.d.ts.map +1 -1
  67. package/lib/errors.js +260 -32
  68. package/lib/errors.js.map +1 -1
  69. package/lib/glsp-request-model-args.d.ts +16 -0
  70. package/lib/glsp-request-model-args.d.ts.map +1 -0
  71. package/lib/glsp-request-model-args.js +19 -0
  72. package/lib/glsp-request-model-args.js.map +1 -0
  73. package/lib/glsp-save-model-actions.d.ts +50 -0
  74. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  75. package/lib/glsp-save-model-actions.js +28 -0
  76. package/lib/glsp-save-model-actions.js.map +1 -0
  77. package/lib/index.d.ts +6 -0
  78. package/lib/index.d.ts.map +1 -1
  79. package/lib/index.js +6 -0
  80. package/lib/index.js.map +1 -1
  81. package/lib/latency-collector.d.ts +8 -4
  82. package/lib/latency-collector.d.ts.map +1 -1
  83. package/lib/latency-collector.js.map +1 -1
  84. package/lib/logger.d.ts +38 -7
  85. package/lib/logger.d.ts.map +1 -1
  86. package/lib/logger.js +42 -4
  87. package/lib/logger.js.map +1 -1
  88. package/lib/messages/index.d.ts +4 -2
  89. package/lib/messages/index.d.ts.map +1 -1
  90. package/lib/messages/index.js +14 -4
  91. package/lib/messages/index.js.map +1 -1
  92. package/lib/messages/primitives.d.ts +71 -10
  93. package/lib/messages/primitives.d.ts.map +1 -1
  94. package/lib/messages/primitives.js +55 -3
  95. package/lib/messages/primitives.js.map +1 -1
  96. package/lib/model-server.d.ts +60 -13
  97. package/lib/model-server.d.ts.map +1 -1
  98. package/lib/model-server.js +4 -2
  99. package/lib/model-server.js.map +1 -1
  100. package/lib/model-service/base-version.d.ts +67 -0
  101. package/lib/model-service/base-version.d.ts.map +1 -0
  102. package/lib/model-service/base-version.js +44 -0
  103. package/lib/model-service/base-version.js.map +1 -0
  104. package/lib/model-service/index.d.ts +1 -1
  105. package/lib/model-service/index.d.ts.map +1 -1
  106. package/lib/model-service/index.js +4 -5
  107. package/lib/model-service/index.js.map +1 -1
  108. package/lib/model-service/reference-candidate.d.ts +5 -3
  109. package/lib/model-service/reference-candidate.d.ts.map +1 -1
  110. package/lib/{model-service/args.js → node/index.d.ts} +2 -3
  111. package/lib/node/index.d.ts.map +1 -0
  112. package/lib/node/index.js +29 -0
  113. package/lib/node/index.js.map +1 -0
  114. package/lib/node/process-memory.d.ts +66 -0
  115. package/lib/node/process-memory.d.ts.map +1 -0
  116. package/lib/node/process-memory.js +291 -0
  117. package/lib/node/process-memory.js.map +1 -0
  118. package/lib/noop-logger.d.ts.map +1 -1
  119. package/lib/noop-logger.js.map +1 -1
  120. package/lib/observable-value.js.map +1 -1
  121. package/lib/patch-merge.d.ts +63 -35
  122. package/lib/patch-merge.d.ts.map +1 -1
  123. package/lib/patch-merge.js +171 -25
  124. package/lib/patch-merge.js.map +1 -1
  125. package/lib/profile-session.d.ts +8 -4
  126. package/lib/profile-session.d.ts.map +1 -1
  127. package/lib/profile-session.js.map +1 -1
  128. package/lib/project.d.ts +4 -1
  129. package/lib/project.d.ts.map +1 -1
  130. package/lib/project.js.map +1 -1
  131. package/lib/random-uuid.d.ts +14 -0
  132. package/lib/random-uuid.d.ts.map +1 -0
  133. package/lib/random-uuid.js +24 -0
  134. package/lib/random-uuid.js.map +1 -0
  135. package/lib/reconcile-write.d.ts +67 -0
  136. package/lib/reconcile-write.d.ts.map +1 -0
  137. package/lib/reconcile-write.js +69 -0
  138. package/lib/reconcile-write.js.map +1 -0
  139. package/lib/rpc/bind-rpc-methods.d.ts +33 -3
  140. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  141. package/lib/rpc/bind-rpc-methods.js +32 -3
  142. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  143. package/lib/rpc/create-rpc-proxy.d.ts +10 -0
  144. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  145. package/lib/rpc/create-rpc-proxy.js +12 -2
  146. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  147. package/lib/rpc/index.d.ts +1 -0
  148. package/lib/rpc/index.d.ts.map +1 -1
  149. package/lib/rpc/index.js +1 -0
  150. package/lib/rpc/index.js.map +1 -1
  151. package/lib/rpc/send-by-method-name.d.ts +76 -0
  152. package/lib/rpc/send-by-method-name.d.ts.map +1 -0
  153. package/lib/rpc/send-by-method-name.js +120 -0
  154. package/lib/rpc/send-by-method-name.js.map +1 -0
  155. package/lib/rpc/wire-prefix.js.map +1 -1
  156. package/lib/testing/catalogue-audit.d.ts +80 -0
  157. package/lib/testing/catalogue-audit.d.ts.map +1 -0
  158. package/lib/testing/catalogue-audit.js +94 -0
  159. package/lib/testing/catalogue-audit.js.map +1 -0
  160. package/lib/testing/data-doubles.d.ts +41 -12
  161. package/lib/testing/data-doubles.d.ts.map +1 -1
  162. package/lib/testing/data-doubles.js +56 -8
  163. package/lib/testing/data-doubles.js.map +1 -1
  164. package/lib/testing/fake-clock.d.ts +17 -2
  165. package/lib/testing/fake-clock.d.ts.map +1 -1
  166. package/lib/testing/fake-clock.js +61 -46
  167. package/lib/testing/fake-clock.js.map +1 -1
  168. package/lib/testing/index.d.ts +1 -0
  169. package/lib/testing/index.d.ts.map +1 -1
  170. package/lib/testing/index.js +5 -2
  171. package/lib/testing/index.js.map +1 -1
  172. package/lib/testing/node/duplex-connection.d.ts.map +1 -1
  173. package/lib/testing/node/duplex-connection.js +3 -2
  174. package/lib/testing/node/duplex-connection.js.map +1 -1
  175. package/lib/testing/node/duplex-stream.js.map +1 -1
  176. package/lib/testing/node/index.d.ts +1 -0
  177. package/lib/testing/node/index.d.ts.map +1 -1
  178. package/lib/testing/node/index.js +2 -2
  179. package/lib/testing/node/index.js.map +1 -1
  180. package/lib/testing/node/message-port-pair.d.ts +25 -0
  181. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  182. package/lib/testing/node/message-port-pair.js +26 -0
  183. package/lib/testing/node/message-port-pair.js.map +1 -0
  184. package/lib/testing/wait-for.d.ts +9 -3
  185. package/lib/testing/wait-for.d.ts.map +1 -1
  186. package/lib/testing/wait-for.js +57 -11
  187. package/lib/testing/wait-for.js.map +1 -1
  188. package/lib/tracer.d.ts.map +1 -1
  189. package/lib/tracer.js +5 -9
  190. package/lib/tracer.js.map +1 -1
  191. package/lib/transfer-diagnostic.js.map +1 -1
  192. package/lib/transfer-document.d.ts +95 -32
  193. package/lib/transfer-document.d.ts.map +1 -1
  194. package/lib/transfer-document.js +17 -9
  195. package/lib/transfer-document.js.map +1 -1
  196. package/lib/uri.d.ts.map +1 -1
  197. package/lib/uri.js.map +1 -1
  198. package/lib/util.d.ts +8 -2
  199. package/lib/util.d.ts.map +1 -1
  200. package/lib/util.js +32 -4
  201. package/lib/util.js.map +1 -1
  202. package/package.json +24 -40
  203. package/src/abstract-logger.ts +8 -0
  204. package/src/client/data-connection.ts +653 -0
  205. package/src/client/data-events.ts +37 -1
  206. package/src/client/data-port.ts +36 -25
  207. package/src/client/data-session.ts +1427 -137
  208. package/src/client/index.ts +15 -9
  209. package/src/client/message-relay.ts +4 -4
  210. package/src/client/post-message-transport.ts +219 -4
  211. package/src/client/rpc-connection.ts +281 -0
  212. package/src/client/worker-handshake.ts +98 -0
  213. package/src/client-ids.ts +49 -0
  214. package/src/clock.ts +68 -10
  215. package/src/console-logger.ts +39 -0
  216. package/src/data/data-protocol-methods.ts +14 -4
  217. package/src/data/data-server-protocol.ts +192 -48
  218. package/src/data/events.ts +143 -21
  219. package/src/data/requests.ts +77 -11
  220. package/src/debouncer.ts +7 -10
  221. package/src/errors.ts +309 -40
  222. package/src/glsp-request-model-args.ts +16 -0
  223. package/src/glsp-save-model-actions.ts +59 -0
  224. package/src/index.ts +6 -0
  225. package/src/latency-collector.ts +8 -3
  226. package/src/logger.ts +44 -8
  227. package/src/messages/index.ts +4 -2
  228. package/src/messages/primitives.ts +102 -10
  229. package/src/model-server.ts +64 -19
  230. package/src/model-service/base-version.ts +75 -0
  231. package/src/model-service/index.ts +4 -5
  232. package/src/model-service/reference-candidate.ts +5 -3
  233. package/src/node/index.ts +14 -0
  234. package/src/node/process-memory.ts +299 -0
  235. package/src/patch-merge.ts +230 -45
  236. package/src/profile-session.ts +9 -4
  237. package/src/project.ts +4 -1
  238. package/src/random-uuid.ts +21 -0
  239. package/src/reconcile-write.ts +128 -0
  240. package/src/rpc/README.md +6 -6
  241. package/src/rpc/bind-rpc-methods.ts +59 -4
  242. package/src/rpc/create-rpc-proxy.ts +20 -2
  243. package/src/rpc/index.ts +1 -0
  244. package/src/rpc/send-by-method-name.ts +140 -0
  245. package/src/testing/catalogue-audit.ts +111 -0
  246. package/src/testing/data-doubles.ts +141 -19
  247. package/src/testing/fake-clock.ts +76 -48
  248. package/src/testing/index.ts +5 -2
  249. package/src/testing/node/duplex-connection.ts +3 -2
  250. package/src/testing/node/index.ts +2 -2
  251. package/src/testing/node/message-port-pair.ts +40 -0
  252. package/src/testing/wait-for.ts +61 -13
  253. package/src/tracer.ts +5 -9
  254. package/src/transfer-document.ts +115 -34
  255. package/src/util.ts +33 -6
  256. package/lib/model-service/args.d.ts +0 -64
  257. package/lib/model-service/args.d.ts.map +0 -1
  258. package/lib/model-service/args.js.map +0 -1
  259. package/src/model-service/args.ts +0 -67
package/lib/errors.d.ts CHANGED
@@ -8,55 +8,72 @@
8
8
  ********************************************************************************/
9
9
  import { ResponseError } from 'vscode-jsonrpc';
10
10
  import { type HydraniumMessageData } from './messages/primitives';
11
+ import { type ModelVersion, type TextVersion } from './model-service/base-version';
11
12
  /**
12
- * The catalogue declaration behind {@link ConflictError}'s sentence.
13
+ * The catalogue declaration behind {@link ConflictError}'s sentence. It words
14
+ * the version mismatch rather than stating it: the two numbers mean nothing to
15
+ * an end user, and they stay in {@link ConflictErrorData}.
13
16
  *
14
17
  * Its English must keep containing {@link CONFLICT_ERROR_MESSAGE_MARKER}: the
15
18
  * marker is tier 3 of {@link isConflictError}'s ladder, and it matches on text.
16
19
  * That tier only ever works untranslated, which is why it is the last resort
17
20
  * behind the numeric code rather than the primary check.
18
21
  */
19
- export declare const STALE_BASED_UPDATE: import("./messages/primitives").MessageDefinition<"Stale-based update for {uri}: expected v{expected}, server is at v{actual}">;
22
+ export declare const STALE_BASE_VERSION_UPDATE: import("./messages/primitives").MessageDefinition<"The edit to {uri} was not applied: it was made to an older version of the document.">;
20
23
  /**
21
- * Application-specific JSON-RPC error code for {@link ConflictError}.
22
- * Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
24
+ * Every JSON-RPC error code the framework raises, from any package, keyed by
25
+ * the error it identifies.
26
+ *
27
+ * The framework reserves the block 42000 to 42999 for these, and an adopter's
28
+ * own codes stay outside it: after an RPC a guard matches on the code alone, so
29
+ * an adopter's error carrying one of these reads as the framework's. A new code
30
+ * takes the next unused number in the block, whichever package raises it, and
31
+ * is declared here, where tests hold every code distinct and inside the block.
32
+ * The block sits clear of the range JSON-RPC 2.0 reserves for itself, -32768
33
+ * to -32000.
34
+ */
35
+ export declare const HYDRANIUM_ERROR_CODES: {
36
+ readonly conflict: 42001;
37
+ readonly noActiveProfile: 42002;
38
+ readonly referenceSettleTimeout: 42003;
39
+ readonly sessionClosed: 42004;
40
+ readonly documentNotOpen: 42005;
41
+ readonly duplicateClientId: 42006;
42
+ readonly reservedClientId: 42007;
43
+ };
44
+ /**
45
+ * JSON-RPC error code for {@link ConflictError}.
23
46
  *
24
47
  * The code is the load-bearing identifier across realm boundaries —
25
48
  * `code` is a first-class field on the JSON-RPC error envelope and
26
49
  * survives wire reconstruction; the custom `Error` subclass name does
27
50
  * not.
28
51
  */
29
- export declare const CONFLICT_ERROR_CODE = 1001;
30
- /**
31
- * Structured payload carried in {@link ConflictError.data}, and the only place
32
- * a post-RPC caller can read the version mismatch from.
33
- */
52
+ export declare const CONFLICT_ERROR_CODE: 42001;
53
+ /** Structured payload carried in {@link ConflictError.data}. */
34
54
  export interface ConflictErrorData extends HydraniumMessageData {
35
55
  readonly uri: string;
36
- /** The based-on version the caller authored against. */
37
- readonly expected: number;
56
+ /** The base version the caller authored against. */
57
+ readonly baseVersion: ModelVersion;
38
58
  /** The server's current text-document version at the time of the throw. */
39
- readonly actual: number;
59
+ readonly actualVersion: TextVersion;
40
60
  }
41
61
  /**
42
- * Thrown by `ModelService.update` / `ModelService.save` when the caller-
43
- * supplied based-on version no longer matches the server's current text-
62
+ * Thrown by a client session's `update` / `save` when the caller-
63
+ * supplied base version no longer matches the server's current text-
44
64
  * document version for the same URI — i.e. the snapshot the caller
45
65
  * authored against has been superseded by an intervening edit.
46
66
  *
47
67
  * Extends vscode-jsonrpc's {@link ResponseError} so the typed
48
68
  * {@link ConflictErrorData} payload rides on the standard JSON-RPC
49
69
  * error envelope (`code`, `message`, `data`) — all three fields are
50
- * preserved by RPC reconstruction. Adopters that catch the error on
51
- * the receiving side of an RPC call read the version mismatch from
52
- * `err.data` (the instance is reconstructed as a generic
53
- * `ResponseError`, so subclass getters / fields do not survive).
70
+ * preserved by RPC reconstruction. `createRpcProxy` revives it into
71
+ * this class on the receiving side; a path that does not leaves a
72
+ * plain `ResponseError`, readable through `err.data` only.
54
73
  *
55
- * Detection is opt-in via the optional `baseVersion` field on
56
- * `TransferUpdateArgs` / `TransferSaveArgs`; callers that omit the field get
57
- * no gating. This mirrors LSP's `OptionalVersionedTextDocumentIdentifier`
58
- * posture, so headless / CLI / batch tooling with no meaningful based-on
59
- * version can opt out explicitly.
74
+ * Detection is driven by the required `baseVersion` field of every write
75
+ * request; a caller with no meaningful base version passes
76
+ * `'any'` and gets no gating.
60
77
  *
61
78
  * Three reasonable adopter recovery strategies:
62
79
  *
@@ -70,11 +87,138 @@ export interface ConflictErrorData extends HydraniumMessageData {
70
87
  * No auto-retry or auto-merge ships by default.
71
88
  */
72
89
  export declare class ConflictError extends ResponseError<ConflictErrorData> {
73
- constructor(uri: string, expected: number, actual: number);
90
+ constructor(uri: string, baseVersion: ModelVersion, actualVersion: TextVersion);
74
91
  get uri(): string;
75
- get expected(): number;
76
- get actual(): number;
92
+ /**
93
+ * The base version the caller authored against. Not `expected`, and its
94
+ * sibling not `actual`: a test reporter reads that pair as an assertion
95
+ * failure and reports nothing of the real one.
96
+ */
97
+ get baseVersion(): ModelVersion;
98
+ /** The server's version at the time of the throw. Not `actual`, see {@link baseVersion}. */
99
+ get actualVersion(): TextVersion;
100
+ }
101
+ /**
102
+ * JSON-RPC code for {@link SessionClosedError}, beside {@link CONFLICT_ERROR_CODE}
103
+ * and for the same reason: the code survives reconstruction, the class does not.
104
+ */
105
+ export declare const SESSION_CLOSED_ERROR_CODE: 42004;
106
+ /** JSON-RPC code for {@link DocumentNotOpenError}. */
107
+ export declare const DOCUMENT_NOT_OPEN_ERROR_CODE: 42005;
108
+ /** JSON-RPC code for {@link DuplicateClientIdError}. */
109
+ export declare const DUPLICATE_CLIENT_ID_ERROR_CODE: 42006;
110
+ /** JSON-RPC code for {@link ReservedClientIdError}. */
111
+ export declare const RESERVED_CLIENT_ID_ERROR_CODE: 42007;
112
+ /**
113
+ * The catalogue declaration behind {@link SessionClosedError}'s default
114
+ * sentence. It names no client id: the sentence can reach an end user, and the
115
+ * id stays in {@link SessionClosedErrorData.clientId} for whoever needs it.
116
+ */
117
+ export declare const SESSION_CLOSED: import("./messages/primitives").MessageDefinition<"The editing session has ended.">;
118
+ /** Structured payload carried in {@link SessionClosedError.data}. */
119
+ export interface SessionClosedErrorData extends HydraniumMessageData {
120
+ readonly clientId: string;
77
121
  }
122
+ /**
123
+ * Thrown by every call on a client session after it ended, and by an open that
124
+ * was still in flight when its session ended: by the server for its sessions,
125
+ * and by a client-side `DataSession` once disposed, so a caller handles both
126
+ * the same way. A caller recognises it with {@link isSessionClosedError}, never
127
+ * by its sentence.
128
+ */
129
+ export declare class SessionClosedError extends ResponseError<SessionClosedErrorData> {
130
+ /**
131
+ * `message` replaces the default English, for a caller that knows more than
132
+ * that the session is gone. The identity stays {@link SESSION_CLOSED}'s, so a
133
+ * translating renderer renders the catalogue sentence in its place.
134
+ */
135
+ constructor(clientId: string, message?: string);
136
+ get clientId(): string;
137
+ }
138
+ /**
139
+ * The catalogue declaration behind {@link DocumentNotOpenError}'s sentence. The
140
+ * client id stays in {@link DocumentNotOpenErrorData.clientId}.
141
+ */
142
+ export declare const DOCUMENT_NOT_OPEN: import("./messages/primitives").MessageDefinition<"The document {uri} is not open in this editing session.">;
143
+ /** Structured payload carried in {@link DocumentNotOpenError.data}. */
144
+ export interface DocumentNotOpenErrorData extends HydraniumMessageData {
145
+ readonly uri: string;
146
+ readonly clientId: string;
147
+ }
148
+ /**
149
+ * Thrown when a client session writes a document it does not have open.
150
+ *
151
+ * A session writes only what it has open, so this is the answer both to a write
152
+ * that never opened and to one whose open was closed underneath it — by the
153
+ * session itself, or by the document being deleted.
154
+ */
155
+ export declare class DocumentNotOpenError extends ResponseError<DocumentNotOpenErrorData> {
156
+ constructor(uri: string, clientId: string);
157
+ get uri(): string;
158
+ get clientId(): string;
159
+ }
160
+ /**
161
+ * The catalogue declaration behind {@link DuplicateClientIdError}'s sentence.
162
+ * The client id stays in {@link DuplicateClientIdErrorData.clientId}.
163
+ */
164
+ export declare const DUPLICATE_CLIENT_ID: import("./messages/primitives").MessageDefinition<"Could not start an editing session: its identifier is still in use by another editor.">;
165
+ /** Structured payload carried in {@link DuplicateClientIdError.data}. */
166
+ export interface DuplicateClientIdErrorData extends HydraniumMessageData {
167
+ readonly clientId: string;
168
+ }
169
+ /**
170
+ * Thrown when a client session is started under an id that is already live in
171
+ * the process. The id frees up once its holder ends or closes its last
172
+ * document, so a caller may retry.
173
+ *
174
+ * Ids are unique process-wide because the id is also the author label on every
175
+ * version and the key a client recognises its own echoes by; two participants
176
+ * sharing one would each take the other's writes for their own.
177
+ */
178
+ export declare class DuplicateClientIdError extends ResponseError<DuplicateClientIdErrorData> {
179
+ constructor(clientId: string);
180
+ get clientId(): string;
181
+ }
182
+ /**
183
+ * Thrown when a client session is started under an id the framework reserves
184
+ * for one of its own participants. A reserved id never frees up, so a caller
185
+ * that retries on {@link DuplicateClientIdError} stops on this one.
186
+ *
187
+ * It carries no message identity: a host that picks a reserved id has a bug,
188
+ * and no sentence addressed to an end user is true for it.
189
+ */
190
+ export declare class ReservedClientIdError extends ResponseError<{
191
+ readonly clientId: string;
192
+ }> {
193
+ constructor(clientId: string);
194
+ get clientId(): string;
195
+ }
196
+ /**
197
+ * Whether `error` is a `ResponseError` from any copy of `vscode-jsonrpc`. An
198
+ * install holds several copies, and `instanceof` recognises only its own. An
199
+ * error that merely carries an integer `code` has no `toJson`, and is not one.
200
+ */
201
+ export declare function isResponseError(error: unknown): error is ResponseError<unknown>;
202
+ /**
203
+ * `error` as an instance of the typed error class its code names, with its
204
+ * message, data and stack kept, or `error` itself when its code names none or
205
+ * its data lacks the fields that class reads.
206
+ * An RPC reconstructs every rejection as a plain `ResponseError`, which has
207
+ * none of the class getters.
208
+ */
209
+ export declare function reviveProtocolError(error: unknown): unknown;
210
+ /**
211
+ * Whether `error` is a {@link SessionClosedError}: by name in-process, by code
212
+ * when it arrives as a plain `ResponseError`, through a path that does not
213
+ * {@link reviveProtocolError revive} it.
214
+ */
215
+ export declare function isSessionClosedError(error: unknown): error is SessionClosedError;
216
+ /** Whether `error` is a {@link DocumentNotOpenError}; see {@link isSessionClosedError}. */
217
+ export declare function isDocumentNotOpenError(error: unknown): error is DocumentNotOpenError;
218
+ /** Whether `error` is a {@link DuplicateClientIdError}; see {@link isSessionClosedError}. */
219
+ export declare function isDuplicateClientIdError(error: unknown): error is DuplicateClientIdError;
220
+ /** Whether `error` is a {@link ReservedClientIdError}; see {@link isSessionClosedError}. */
221
+ export declare function isReservedClientIdError(error: unknown): error is ReservedClientIdError;
78
222
  /**
79
223
  * Type guard for {@link ConflictError}. Detection ladder:
80
224
  *
@@ -84,11 +228,12 @@ export declare class ConflictError extends ResponseError<ConflictErrorData> {
84
228
  * canonical wire-side check; the JSON-RPC `code` field is preserved
85
229
  * across reconstruction, so any adopter catching after an RPC call
86
230
  * hits this branch.
87
- * 3. `error.message.includes('Stale-based update for ')` — fallback
88
- * for transports that re-wrap the message and drop the code (rare).
231
+ * 3. `error.message` contains the marker {@link STALE_BASE_VERSION_UPDATE}'s
232
+ * English carries — fallback for transports that re-wrap the message
233
+ * and drop the code (rare).
89
234
  *
90
- * `instanceof ConflictError` alone would silently return `false` on the
91
- * reconstructed shape, so callers do not use it.
235
+ * `instanceof ConflictError` alone returns `false` on a rejection that was
236
+ * not {@link reviveProtocolError revived}, so callers do not use it.
92
237
  */
93
238
  export declare function isConflictError(error: unknown): error is ConflictError;
94
239
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAiB,KAAK,oBAAoB,E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K,IAAI,kBAAkB,CAEhF;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAEpF;AAED,6FAA6F;AAC7F,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAExF;AAED,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAEtF;AAWD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAYtE"}
package/lib/errors.js CHANGED
@@ -8,48 +8,85 @@
8
8
  * SPDX-License-Identifier: MIT
9
9
  ********************************************************************************/
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.ConflictError = exports.CONFLICT_ERROR_CODE = exports.STALE_BASED_UPDATE = void 0;
11
+ exports.ReservedClientIdError = exports.DuplicateClientIdError = exports.DUPLICATE_CLIENT_ID = exports.DocumentNotOpenError = exports.DOCUMENT_NOT_OPEN = exports.SessionClosedError = exports.SESSION_CLOSED = exports.RESERVED_CLIENT_ID_ERROR_CODE = exports.DUPLICATE_CLIENT_ID_ERROR_CODE = exports.DOCUMENT_NOT_OPEN_ERROR_CODE = exports.SESSION_CLOSED_ERROR_CODE = exports.ConflictError = exports.CONFLICT_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES = exports.STALE_BASE_VERSION_UPDATE = void 0;
12
+ exports.isResponseError = isResponseError;
13
+ exports.reviveProtocolError = reviveProtocolError;
14
+ exports.isSessionClosedError = isSessionClosedError;
15
+ exports.isDocumentNotOpenError = isDocumentNotOpenError;
16
+ exports.isDuplicateClientIdError = isDuplicateClientIdError;
17
+ exports.isReservedClientIdError = isReservedClientIdError;
12
18
  exports.isConflictError = isConflictError;
13
19
  const vscode_jsonrpc_1 = require("vscode-jsonrpc");
14
20
  const primitives_1 = require("./messages/primitives");
21
+ const base_version_1 = require("./model-service/base-version");
22
+ /*
23
+ * Every error here is a typed error: a caller reacts to it, so it has a class,
24
+ * a JSON-RPC code and an `is*` guard, and an English message. A typed error
25
+ * also carries a message identity where the framework can write an end-user
26
+ * sentence that needs no context. A URI may stay in that sentence; a client id
27
+ * or a raw version stays out of it, worded or left to `data`.
28
+ *
29
+ * An error nothing reacts to does not belong here: it stays a plain `Error`, or
30
+ * a named subclass without a code, at its throw site, since a code and a guard
31
+ * are public API that no caller would use.
32
+ */
15
33
  /**
16
- * The catalogue declaration behind {@link ConflictError}'s sentence.
34
+ * The catalogue declaration behind {@link ConflictError}'s sentence. It words
35
+ * the version mismatch rather than stating it: the two numbers mean nothing to
36
+ * an end user, and they stay in {@link ConflictErrorData}.
17
37
  *
18
38
  * Its English must keep containing {@link CONFLICT_ERROR_MESSAGE_MARKER}: the
19
39
  * marker is tier 3 of {@link isConflictError}'s ladder, and it matches on text.
20
40
  * That tier only ever works untranslated, which is why it is the last resort
21
41
  * behind the numeric code rather than the primary check.
22
42
  */
23
- exports.STALE_BASED_UPDATE = (0, primitives_1.defineMessage)('hydranium/protocol/stale-based-update', 'Stale-based update for {uri}: expected v{expected}, server is at v{actual}');
43
+ exports.STALE_BASE_VERSION_UPDATE = (0, primitives_1.defineMessage)('hydranium/protocol/stale-base-version-update', 'The edit to {uri} was not applied: it was made to an older version of the document.');
24
44
  /**
25
- * Application-specific JSON-RPC error code for {@link ConflictError}.
26
- * Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
45
+ * Every JSON-RPC error code the framework raises, from any package, keyed by
46
+ * the error it identifies.
47
+ *
48
+ * The framework reserves the block 42000 to 42999 for these, and an adopter's
49
+ * own codes stay outside it: after an RPC a guard matches on the code alone, so
50
+ * an adopter's error carrying one of these reads as the framework's. A new code
51
+ * takes the next unused number in the block, whichever package raises it, and
52
+ * is declared here, where tests hold every code distinct and inside the block.
53
+ * The block sits clear of the range JSON-RPC 2.0 reserves for itself, -32768
54
+ * to -32000.
55
+ */
56
+ exports.HYDRANIUM_ERROR_CODES = {
57
+ conflict: 42001,
58
+ noActiveProfile: 42002,
59
+ referenceSettleTimeout: 42003,
60
+ sessionClosed: 42004,
61
+ documentNotOpen: 42005,
62
+ duplicateClientId: 42006,
63
+ reservedClientId: 42007
64
+ };
65
+ /**
66
+ * JSON-RPC error code for {@link ConflictError}.
27
67
  *
28
68
  * The code is the load-bearing identifier across realm boundaries —
29
69
  * `code` is a first-class field on the JSON-RPC error envelope and
30
70
  * survives wire reconstruction; the custom `Error` subclass name does
31
71
  * not.
32
72
  */
33
- exports.CONFLICT_ERROR_CODE = 1001;
73
+ exports.CONFLICT_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.conflict;
34
74
  /**
35
- * Thrown by `ModelService.update` / `ModelService.save` when the caller-
36
- * supplied based-on version no longer matches the server's current text-
75
+ * Thrown by a client session's `update` / `save` when the caller-
76
+ * supplied base version no longer matches the server's current text-
37
77
  * document version for the same URI — i.e. the snapshot the caller
38
78
  * authored against has been superseded by an intervening edit.
39
79
  *
40
80
  * Extends vscode-jsonrpc's {@link ResponseError} so the typed
41
81
  * {@link ConflictErrorData} payload rides on the standard JSON-RPC
42
82
  * error envelope (`code`, `message`, `data`) — all three fields are
43
- * preserved by RPC reconstruction. Adopters that catch the error on
44
- * the receiving side of an RPC call read the version mismatch from
45
- * `err.data` (the instance is reconstructed as a generic
46
- * `ResponseError`, so subclass getters / fields do not survive).
83
+ * preserved by RPC reconstruction. `createRpcProxy` revives it into
84
+ * this class on the receiving side; a path that does not leaves a
85
+ * plain `ResponseError`, readable through `err.data` only.
47
86
  *
48
- * Detection is opt-in via the optional `baseVersion` field on
49
- * `TransferUpdateArgs` / `TransferSaveArgs`; callers that omit the field get
50
- * no gating. This mirrors LSP's `OptionalVersionedTextDocumentIdentifier`
51
- * posture, so headless / CLI / batch tooling with no meaningful based-on
52
- * version can opt out explicitly.
87
+ * Detection is driven by the required `baseVersion` field of every write
88
+ * request; a caller with no meaningful base version passes
89
+ * `'any'` and gets no gating.
53
90
  *
54
91
  * Three reasonable adopter recovery strategies:
55
92
  *
@@ -63,35 +100,225 @@ exports.CONFLICT_ERROR_CODE = 1001;
63
100
  * No auto-retry or auto-merge ships by default.
64
101
  */
65
102
  class ConflictError extends vscode_jsonrpc_1.ResponseError {
66
- constructor(uri, expected, actual) {
67
- const params = { uri, expected, actual };
103
+ constructor(uri, baseVersion, actualVersion) {
68
104
  // The identity rides alongside the typed payload rather than replacing
69
- // it: this class's getters and `isConflictError`'s name check are surface
70
- // an adopter may bind, so the payload widens rather than changing shape.
71
- super(exports.CONFLICT_ERROR_CODE, exports.STALE_BASED_UPDATE.format(params), { ...params, ...(0, primitives_1.messageData)(exports.STALE_BASED_UPDATE, params) });
105
+ // it: `isConflictError`'s name check is surface an adopter may bind, so
106
+ // adding the identity widens the payload rather than reshaping it.
107
+ super(exports.CONFLICT_ERROR_CODE, exports.STALE_BASE_VERSION_UPDATE.format({ uri }), {
108
+ uri,
109
+ baseVersion,
110
+ actualVersion,
111
+ ...(0, primitives_1.messageData)(exports.STALE_BASE_VERSION_UPDATE, { uri })
112
+ });
72
113
  this.name = 'ConflictError';
73
114
  // ResponseError's constructor calls `Object.setPrototypeOf(this,
74
115
  // ResponseError.prototype)` to keep its own prototype chain intact across
75
116
  // transpilation targets; that resets us to ResponseError, hiding the
76
117
  // ConflictError-specific getters. Restore the prototype here so
77
- // `err.uri` / `.expected` / `.actual` resolve through this class.
118
+ // `err.uri` / `.baseVersion` / `.actualVersion` resolve through this
119
+ // class.
78
120
  Object.setPrototypeOf(this, ConflictError.prototype);
79
121
  }
80
122
  get uri() {
81
123
  return this.data.uri;
82
124
  }
83
- get expected() {
84
- return this.data.expected;
125
+ /**
126
+ * The base version the caller authored against. Not `expected`, and its
127
+ * sibling not `actual`: a test reporter reads that pair as an assertion
128
+ * failure and reports nothing of the real one.
129
+ */
130
+ get baseVersion() {
131
+ return this.data.baseVersion;
85
132
  }
86
- get actual() {
87
- return this.data.actual;
133
+ /** The server's version at the time of the throw. Not `actual`, see {@link baseVersion}. */
134
+ get actualVersion() {
135
+ return this.data.actualVersion;
88
136
  }
89
137
  }
90
138
  exports.ConflictError = ConflictError;
139
+ /**
140
+ * JSON-RPC code for {@link SessionClosedError}, beside {@link CONFLICT_ERROR_CODE}
141
+ * and for the same reason: the code survives reconstruction, the class does not.
142
+ */
143
+ exports.SESSION_CLOSED_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.sessionClosed;
144
+ /** JSON-RPC code for {@link DocumentNotOpenError}. */
145
+ exports.DOCUMENT_NOT_OPEN_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.documentNotOpen;
146
+ /** JSON-RPC code for {@link DuplicateClientIdError}. */
147
+ exports.DUPLICATE_CLIENT_ID_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.duplicateClientId;
148
+ /** JSON-RPC code for {@link ReservedClientIdError}. */
149
+ exports.RESERVED_CLIENT_ID_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.reservedClientId;
150
+ /**
151
+ * The catalogue declaration behind {@link SessionClosedError}'s default
152
+ * sentence. It names no client id: the sentence can reach an end user, and the
153
+ * id stays in {@link SessionClosedErrorData.clientId} for whoever needs it.
154
+ */
155
+ exports.SESSION_CLOSED = (0, primitives_1.defineMessage)('hydranium/protocol/session-closed', 'The editing session has ended.');
156
+ /**
157
+ * Thrown by every call on a client session after it ended, and by an open that
158
+ * was still in flight when its session ended: by the server for its sessions,
159
+ * and by a client-side `DataSession` once disposed, so a caller handles both
160
+ * the same way. A caller recognises it with {@link isSessionClosedError}, never
161
+ * by its sentence.
162
+ */
163
+ class SessionClosedError extends vscode_jsonrpc_1.ResponseError {
164
+ /**
165
+ * `message` replaces the default English, for a caller that knows more than
166
+ * that the session is gone. The identity stays {@link SESSION_CLOSED}'s, so a
167
+ * translating renderer renders the catalogue sentence in its place.
168
+ */
169
+ constructor(clientId, message = exports.SESSION_CLOSED.format()) {
170
+ super(exports.SESSION_CLOSED_ERROR_CODE, message, { clientId, ...(0, primitives_1.messageData)(exports.SESSION_CLOSED) });
171
+ this.name = 'SessionClosedError';
172
+ // `ResponseError` resets the prototype to its own; see `ConflictError`.
173
+ Object.setPrototypeOf(this, SessionClosedError.prototype);
174
+ }
175
+ get clientId() {
176
+ return this.data.clientId;
177
+ }
178
+ }
179
+ exports.SessionClosedError = SessionClosedError;
180
+ /**
181
+ * The catalogue declaration behind {@link DocumentNotOpenError}'s sentence. The
182
+ * client id stays in {@link DocumentNotOpenErrorData.clientId}.
183
+ */
184
+ exports.DOCUMENT_NOT_OPEN = (0, primitives_1.defineMessage)('hydranium/protocol/document-not-open', 'The document {uri} is not open in this editing session.');
185
+ /**
186
+ * Thrown when a client session writes a document it does not have open.
187
+ *
188
+ * A session writes only what it has open, so this is the answer both to a write
189
+ * that never opened and to one whose open was closed underneath it — by the
190
+ * session itself, or by the document being deleted.
191
+ */
192
+ class DocumentNotOpenError extends vscode_jsonrpc_1.ResponseError {
193
+ constructor(uri, clientId) {
194
+ super(exports.DOCUMENT_NOT_OPEN_ERROR_CODE, exports.DOCUMENT_NOT_OPEN.format({ uri }), {
195
+ uri,
196
+ clientId,
197
+ ...(0, primitives_1.messageData)(exports.DOCUMENT_NOT_OPEN, { uri })
198
+ });
199
+ this.name = 'DocumentNotOpenError';
200
+ Object.setPrototypeOf(this, DocumentNotOpenError.prototype);
201
+ }
202
+ get uri() {
203
+ return this.data.uri;
204
+ }
205
+ get clientId() {
206
+ return this.data.clientId;
207
+ }
208
+ }
209
+ exports.DocumentNotOpenError = DocumentNotOpenError;
210
+ /**
211
+ * The catalogue declaration behind {@link DuplicateClientIdError}'s sentence.
212
+ * The client id stays in {@link DuplicateClientIdErrorData.clientId}.
213
+ */
214
+ exports.DUPLICATE_CLIENT_ID = (0, primitives_1.defineMessage)('hydranium/protocol/duplicate-client-id', 'Could not start an editing session: its identifier is still in use by another editor.');
215
+ /**
216
+ * Thrown when a client session is started under an id that is already live in
217
+ * the process. The id frees up once its holder ends or closes its last
218
+ * document, so a caller may retry.
219
+ *
220
+ * Ids are unique process-wide because the id is also the author label on every
221
+ * version and the key a client recognises its own echoes by; two participants
222
+ * sharing one would each take the other's writes for their own.
223
+ */
224
+ class DuplicateClientIdError extends vscode_jsonrpc_1.ResponseError {
225
+ constructor(clientId) {
226
+ super(exports.DUPLICATE_CLIENT_ID_ERROR_CODE, exports.DUPLICATE_CLIENT_ID.format(), { clientId, ...(0, primitives_1.messageData)(exports.DUPLICATE_CLIENT_ID) });
227
+ this.name = 'DuplicateClientIdError';
228
+ Object.setPrototypeOf(this, DuplicateClientIdError.prototype);
229
+ }
230
+ get clientId() {
231
+ return this.data.clientId;
232
+ }
233
+ }
234
+ exports.DuplicateClientIdError = DuplicateClientIdError;
235
+ /**
236
+ * Thrown when a client session is started under an id the framework reserves
237
+ * for one of its own participants. A reserved id never frees up, so a caller
238
+ * that retries on {@link DuplicateClientIdError} stops on this one.
239
+ *
240
+ * It carries no message identity: a host that picks a reserved id has a bug,
241
+ * and no sentence addressed to an end user is true for it.
242
+ */
243
+ class ReservedClientIdError extends vscode_jsonrpc_1.ResponseError {
244
+ constructor(clientId) {
245
+ super(exports.RESERVED_CLIENT_ID_ERROR_CODE, `Client id ${clientId} is reserved for a framework participant`, { clientId });
246
+ this.name = 'ReservedClientIdError';
247
+ Object.setPrototypeOf(this, ReservedClientIdError.prototype);
248
+ }
249
+ get clientId() {
250
+ return this.data.clientId;
251
+ }
252
+ }
253
+ exports.ReservedClientIdError = ReservedClientIdError;
254
+ /** One entry per typed error class, keyed by its code; a class without one reaches a caller as a plain `ResponseError`. */
255
+ const PROTOCOL_ERROR_REVIVERS = new Map([
256
+ [
257
+ exports.CONFLICT_ERROR_CODE,
258
+ ({ uri, baseVersion, actualVersion }) => typeof uri === 'string' && typeof baseVersion === 'number' && typeof actualVersion === 'number'
259
+ ? new ConflictError(uri, (0, base_version_1.asModelVersion)(baseVersion), actualVersion)
260
+ : undefined
261
+ ],
262
+ [exports.SESSION_CLOSED_ERROR_CODE, ({ clientId }) => (typeof clientId === 'string' ? new SessionClosedError(clientId) : undefined)],
263
+ [
264
+ exports.DOCUMENT_NOT_OPEN_ERROR_CODE,
265
+ ({ uri, clientId }) => (typeof uri === 'string' && typeof clientId === 'string' ? new DocumentNotOpenError(uri, clientId) : undefined)
266
+ ],
267
+ [exports.DUPLICATE_CLIENT_ID_ERROR_CODE, ({ clientId }) => (typeof clientId === 'string' ? new DuplicateClientIdError(clientId) : undefined)],
268
+ [exports.RESERVED_CLIENT_ID_ERROR_CODE, ({ clientId }) => (typeof clientId === 'string' ? new ReservedClientIdError(clientId) : undefined)]
269
+ ]);
270
+ /**
271
+ * Whether `error` is a `ResponseError` from any copy of `vscode-jsonrpc`. An
272
+ * install holds several copies, and `instanceof` recognises only its own. An
273
+ * error that merely carries an integer `code` has no `toJson`, and is not one.
274
+ */
275
+ function isResponseError(error) {
276
+ return (error instanceof Error && 'code' in error && Number.isInteger(error.code) && 'toJson' in error && typeof error.toJson === 'function');
277
+ }
278
+ /**
279
+ * `error` as an instance of the typed error class its code names, with its
280
+ * message, data and stack kept, or `error` itself when its code names none or
281
+ * its data lacks the fields that class reads.
282
+ * An RPC reconstructs every rejection as a plain `ResponseError`, which has
283
+ * none of the class getters.
284
+ */
285
+ function reviveProtocolError(error) {
286
+ if (!isResponseError(error) || error.data === null || typeof error.data !== 'object') {
287
+ return error;
288
+ }
289
+ const revived = PROTOCOL_ERROR_REVIVERS.get(error.code)?.({ ...error.data });
290
+ if (!revived) {
291
+ return error;
292
+ }
293
+ return Object.assign(revived, { message: error.message, data: error.data, stack: error.stack });
294
+ }
295
+ /**
296
+ * Whether `error` is a {@link SessionClosedError}: by name in-process, by code
297
+ * when it arrives as a plain `ResponseError`, through a path that does not
298
+ * {@link reviveProtocolError revive} it.
299
+ */
300
+ function isSessionClosedError(error) {
301
+ return hasErrorIdentity(error, 'SessionClosedError', exports.SESSION_CLOSED_ERROR_CODE);
302
+ }
303
+ /** Whether `error` is a {@link DocumentNotOpenError}; see {@link isSessionClosedError}. */
304
+ function isDocumentNotOpenError(error) {
305
+ return hasErrorIdentity(error, 'DocumentNotOpenError', exports.DOCUMENT_NOT_OPEN_ERROR_CODE);
306
+ }
307
+ /** Whether `error` is a {@link DuplicateClientIdError}; see {@link isSessionClosedError}. */
308
+ function isDuplicateClientIdError(error) {
309
+ return hasErrorIdentity(error, 'DuplicateClientIdError', exports.DUPLICATE_CLIENT_ID_ERROR_CODE);
310
+ }
311
+ /** Whether `error` is a {@link ReservedClientIdError}; see {@link isSessionClosedError}. */
312
+ function isReservedClientIdError(error) {
313
+ return hasErrorIdentity(error, 'ReservedClientIdError', exports.RESERVED_CLIENT_ID_ERROR_CODE);
314
+ }
315
+ function hasErrorIdentity(error, name, code) {
316
+ return error instanceof Error && (error.name === name || error.code === code);
317
+ }
91
318
  /** Marker substring present in every {@link ConflictError} message, used by
92
319
  * {@link isConflictError} as a fallback when a transport re-wraps the error
93
320
  * and drops the JSON-RPC code. */
94
- const CONFLICT_ERROR_MESSAGE_MARKER = 'Stale-based update for ';
321
+ const CONFLICT_ERROR_MESSAGE_MARKER = ': it was made to an older version of the document';
95
322
  /**
96
323
  * Type guard for {@link ConflictError}. Detection ladder:
97
324
  *
@@ -101,11 +328,12 @@ const CONFLICT_ERROR_MESSAGE_MARKER = 'Stale-based update for ';
101
328
  * canonical wire-side check; the JSON-RPC `code` field is preserved
102
329
  * across reconstruction, so any adopter catching after an RPC call
103
330
  * hits this branch.
104
- * 3. `error.message.includes('Stale-based update for ')` — fallback
105
- * for transports that re-wrap the message and drop the code (rare).
331
+ * 3. `error.message` contains the marker {@link STALE_BASE_VERSION_UPDATE}'s
332
+ * English carries — fallback for transports that re-wrap the message
333
+ * and drop the code (rare).
106
334
  *
107
- * `instanceof ConflictError` alone would silently return `false` on the
108
- * reconstructed shape, so callers do not use it.
335
+ * `instanceof ConflictError` alone returns `false` on a rejection that was
336
+ * not {@link reviveProtocolError revived}, so callers do not use it.
109
337
  */
110
338
  function isConflictError(error) {
111
339
  if (!(error instanceof Error)) {
package/lib/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAyHlF,0CAYC;AAnID,mDAA+C;AAC/C,sDAA8F;AAE9F;;;;;;;GAOG;AACU,QAAA,kBAAkB,GAAG,IAAA,0BAAa,EAC5C,uCAAuC,EACvC,4EAA4E,CAC9E,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAcxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAa,aAAc,SAAQ,8BAAgC;IAChE,YAAY,GAAW,EAAE,QAAgB,EAAE,MAAc;QACtD,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QACzC,uEAAuE;QACvE,0EAA0E;QAC1E,yEAAyE;QACzE,KAAK,CAAC,2BAAmB,EAAE,0BAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,IAAA,wBAAW,EAAC,0BAAkB,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QACzH,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,iEAAiE;QACjE,0EAA0E;QAC1E,qEAAqE;QACrE,gEAAgE;QAChE,kEAAkE;QAClE,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,GAAG;QACJ,OAAO,IAAI,CAAC,IAAK,CAAC,GAAG,CAAC;IACzB,CAAC;IAED,IAAI,QAAQ;QACT,OAAO,IAAI,CAAC,IAAK,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAED,IAAI,MAAM;QACP,OAAO,IAAI,CAAC,IAAK,CAAC,MAAM,CAAC;IA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