@noldova/checkpoints.protocol 0.0.1 → 0.0.3

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 (96) hide show
  1. package/README.md +10 -0
  2. package/package.json +4 -3
  3. package/src/api/index.d.ts +76 -511
  4. package/src/api/index.js +0 -11
  5. package/src/api/index.js.map +1 -1
  6. package/src/models/capture-paused-event.js +2 -3
  7. package/src/models/capture-paused-event.js.map +1 -1
  8. package/src/models/capture-request.js +3 -4
  9. package/src/models/capture-request.js.map +1 -1
  10. package/src/models/capture-result.js +4 -5
  11. package/src/models/capture-result.js.map +1 -1
  12. package/src/models/capture-resumed-event.js +2 -3
  13. package/src/models/capture-resumed-event.js.map +1 -1
  14. package/src/models/change-side.js +3 -4
  15. package/src/models/change-side.js.map +1 -1
  16. package/src/models/change.js +6 -7
  17. package/src/models/change.js.map +1 -1
  18. package/src/models/checkpoint-list.js +3 -4
  19. package/src/models/checkpoint-list.js.map +1 -1
  20. package/src/models/checkpoint.js +3 -4
  21. package/src/models/checkpoint.js.map +1 -1
  22. package/src/models/compare-request.js +3 -4
  23. package/src/models/compare-request.js.map +1 -1
  24. package/src/models/compare-result.js +3 -4
  25. package/src/models/compare-result.js.map +1 -1
  26. package/src/models/delete-folder-request.js +3 -4
  27. package/src/models/delete-folder-request.js.map +1 -1
  28. package/src/models/delete-folder-result.js +3 -4
  29. package/src/models/delete-folder-result.js.map +1 -1
  30. package/src/models/diff-target.js +3 -4
  31. package/src/models/diff-target.js.map +1 -1
  32. package/src/models/folder-reference.js +2 -3
  33. package/src/models/folder-reference.js.map +1 -1
  34. package/src/models/folder-usage.js +3 -4
  35. package/src/models/folder-usage.js.map +1 -1
  36. package/src/models/kept-path.js +3 -4
  37. package/src/models/kept-path.js.map +1 -1
  38. package/src/models/list-request.js +3 -4
  39. package/src/models/list-request.js.map +1 -1
  40. package/src/models/preview-request.js +3 -4
  41. package/src/models/preview-request.js.map +1 -1
  42. package/src/models/preview-result.js +4 -5
  43. package/src/models/preview-result.js.map +1 -1
  44. package/src/models/read-request.js +4 -5
  45. package/src/models/read-request.js.map +1 -1
  46. package/src/models/read-result.js +3 -4
  47. package/src/models/read-result.js.map +1 -1
  48. package/src/models/restore-held-up-event.js +3 -4
  49. package/src/models/restore-held-up-event.js.map +1 -1
  50. package/src/models/restore-plan.js +3 -4
  51. package/src/models/restore-plan.js.map +1 -1
  52. package/src/models/restore-request.js +3 -4
  53. package/src/models/restore-request.js.map +1 -1
  54. package/src/models/restore-result.js +5 -6
  55. package/src/models/restore-result.js.map +1 -1
  56. package/src/models/restore-step.js +5 -6
  57. package/src/models/restore-step.js.map +1 -1
  58. package/src/models/restored-event.js +2 -3
  59. package/src/models/restored-event.js.map +1 -1
  60. package/src/models/storage-list.js +3 -4
  61. package/src/models/storage-list.js.map +1 -1
  62. package/src/models/storage-request.js +2 -2
  63. package/src/models/storage-request.js.map +1 -1
  64. package/src/models/unread-path.js +3 -4
  65. package/src/models/unread-path.js.map +1 -1
  66. package/src/resources.js +5 -30
  67. package/src/resources.js.map +1 -1
  68. package/src/services/scope-paths.js.map +1 -1
  69. package/src/services/wire-form.js +32 -0
  70. package/src/services/wire-form.js.map +1 -0
  71. package/src/exceptions/field-not-a-boolean.exception.js +0 -19
  72. package/src/exceptions/field-not-a-boolean.exception.js.map +0 -1
  73. package/src/exceptions/field-not-a-list.exception.js +0 -19
  74. package/src/exceptions/field-not-a-list.exception.js.map +0 -1
  75. package/src/exceptions/field-not-a-number-or-null.exception.js +0 -19
  76. package/src/exceptions/field-not-a-number-or-null.exception.js.map +0 -1
  77. package/src/exceptions/field-not-a-number.exception.js +0 -19
  78. package/src/exceptions/field-not-a-number.exception.js.map +0 -1
  79. package/src/exceptions/field-not-a-string-list.exception.js +0 -19
  80. package/src/exceptions/field-not-a-string-list.exception.js.map +0 -1
  81. package/src/exceptions/field-not-a-string-or-null.exception.js +0 -19
  82. package/src/exceptions/field-not-a-string-or-null.exception.js.map +0 -1
  83. package/src/exceptions/field-not-a-string.exception.js +0 -19
  84. package/src/exceptions/field-not-a-string.exception.js.map +0 -1
  85. package/src/exceptions/missing-field.exception.js +0 -19
  86. package/src/exceptions/missing-field.exception.js.map +0 -1
  87. package/src/exceptions/not-an-object.exception.js +0 -17
  88. package/src/exceptions/not-an-object.exception.js.map +0 -1
  89. package/src/exceptions/unknown-field.exception.js +0 -19
  90. package/src/exceptions/unknown-field.exception.js.map +0 -1
  91. package/src/services/json-object.reader.js +0 -89
  92. package/src/services/json-object.reader.js.map +0 -1
  93. package/src/types/json-object.js +0 -9
  94. package/src/types/json-object.js.map +0 -1
  95. package/src/types/json-value.js +0 -9
  96. package/src/types/json-value.js.map +0 -1
@@ -7,34 +7,22 @@
7
7
  */
8
8
 
9
9
  import { Exception, type ExceptionOptions } from "@noldova/context.exceptions";
10
-
11
- /**
12
- * A JSON object whose values are JSON values.
13
- */
14
- export type JsonObject = { readonly [key: string]: JsonValue };
15
-
16
- /**
17
- * A value that JSON can represent.
18
- */
19
- export type JsonValue = string | number | boolean | null | JsonObject | readonly JsonValue[];
20
-
21
- /**
22
- * The base of the checkpoints protocol's exceptions, thrown when a model is built from values it refuses, or read from JSON that isn't
23
- * its wire form. Its subclasses: {@link CaptureCheckpointMismatchException}, {@link CaptureSpaceMismatchException},
24
- * {@link ChangeSidesMismatchException}, {@link CompareChangesMismatchException}, {@link ContentTooLongException},
25
- * {@link FieldNotABooleanException}, {@link FieldNotAListException}, {@link FieldNotANumberException},
26
- * {@link FieldNotANumberOrNullException}, {@link FieldNotAStringException}, {@link FieldNotAStringListException},
27
- * {@link FieldNotAStringOrNullException}, {@link InvalidBase64Exception}, {@link InvalidCheckpointIdException},
28
- * {@link InvalidDateException}, {@link InvalidFolderPathException}, {@link InvalidIdentityException}, {@link InvalidPlanStateException},
29
- * {@link InvalidReadLimitException}, {@link InvalidRelativePathException}, {@link InvalidSizeException}, {@link InvalidTimeException},
30
- * {@link LabelTooLongException}, {@link MissingFieldException}, {@link NotAnObjectException}, {@link PreviewPlanMismatchException},
31
- * {@link ReadCutMismatchException}, {@link ReadOutcomeMismatchException}, {@link RestoreCheckpointsMismatchException},
32
- * {@link SideSizeMismatchException}, {@link StepSidesMismatchException}, {@link UnknownCaptureModeException},
33
- * {@link UnknownCaptureOutcomeException}, {@link UnknownChangeStatusException}, {@link UnknownCompareOutcomeException},
34
- * {@link UnknownDeleteFolderOutcomeException}, {@link UnknownFieldException}, {@link UnknownKeepReasonException},
35
- * {@link UnknownPathKindException}, {@link UnknownPreviewOutcomeException}, {@link UnknownReadOutcomeException},
36
- * {@link UnknownRestoreActionException}, {@link UnknownRestoreOutcomeException}, {@link UnknownUnreadReasonException},
37
- * {@link UnreadCodeMismatchException}, {@link UnreadReasonMismatchException}.
10
+ import type { JsonObject } from "@noldova/context.json";
11
+
12
+ /**
13
+ * The base of the checkpoints protocol's exceptions, thrown when a model is built from values it refuses; JSON that isn't a model's wire
14
+ * form fails with `JsonException` from `@noldova/context.json` instead. Its subclasses: {@link CaptureCheckpointMismatchException}, {@link
15
+ * CaptureSpaceMismatchException}, {@link ChangeSidesMismatchException}, {@link CompareChangesMismatchException}, {@link
16
+ * ContentTooLongException}, {@link InvalidBase64Exception}, {@link InvalidCheckpointIdException}, {@link InvalidDateException}, {@link
17
+ * InvalidFolderPathException}, {@link InvalidIdentityException}, {@link InvalidPlanStateException}, {@link InvalidReadLimitException},
18
+ * {@link InvalidRelativePathException}, {@link InvalidSizeException}, {@link InvalidTimeException}, {@link LabelTooLongException}, {@link
19
+ * PreviewPlanMismatchException}, {@link ReadCutMismatchException}, {@link ReadOutcomeMismatchException}, {@link
20
+ * RestoreCheckpointsMismatchException}, {@link SideSizeMismatchException}, {@link StepSidesMismatchException}, {@link
21
+ * UnknownCaptureModeException}, {@link UnknownCaptureOutcomeException}, {@link UnknownChangeStatusException}, {@link
22
+ * UnknownCompareOutcomeException}, {@link UnknownDeleteFolderOutcomeException}, {@link UnknownKeepReasonException}, {@link
23
+ * UnknownPathKindException}, {@link UnknownPreviewOutcomeException}, {@link UnknownReadOutcomeException}, {@link
24
+ * UnknownRestoreActionException}, {@link UnknownRestoreOutcomeException}, {@link UnknownUnreadReasonException}, {@link
25
+ * UnreadCodeMismatchException}, {@link UnreadReasonMismatchException}.
38
26
  *
39
27
  * @example
40
28
  * ```ts
@@ -184,216 +172,6 @@ export declare class ContentTooLongException extends ProtocolException {
184
172
  public constructor(length: number, size: number);
185
173
  }
186
174
 
187
- /**
188
- * Thrown when a model's field is neither `true` nor `false`.
189
- */
190
- export declare class FieldNotABooleanException extends ProtocolException {
191
- /**
192
- * The field's name.
193
- */
194
- public readonly field: string;
195
-
196
- /**
197
- * The model's name.
198
- */
199
- public readonly model: string;
200
-
201
- /**
202
- * Formats the exception's message from its facts.
203
- *
204
- * @param model The model's name.
205
- * @param field The field's name.
206
- * @example
207
- * ```ts
208
- * import { FieldNotABooleanException } from "@noldova/checkpoints.protocol";
209
- *
210
- * const exception = new FieldNotABooleanException("Model", "number");
211
- * console.log(exception.message, exception.model, exception.field);
212
- * ```
213
- */
214
- public constructor(model: string, field: string);
215
- }
216
-
217
- /**
218
- * Thrown when a model's field isn't a list.
219
- */
220
- export declare class FieldNotAListException extends ProtocolException {
221
- /**
222
- * The field's name.
223
- */
224
- public readonly field: string;
225
-
226
- /**
227
- * The model's name.
228
- */
229
- public readonly model: string;
230
-
231
- /**
232
- * Formats the exception's message from its facts.
233
- *
234
- * @param model The model's name.
235
- * @param field The field's name.
236
- * @example
237
- * ```ts
238
- * import { FieldNotAListException } from "@noldova/checkpoints.protocol";
239
- *
240
- * const exception = new FieldNotAListException("Model", "number");
241
- * console.log(exception.message, exception.model, exception.field);
242
- * ```
243
- */
244
- public constructor(model: string, field: string);
245
- }
246
-
247
- /**
248
- * Thrown when a model's field isn't a number.
249
- */
250
- export declare class FieldNotANumberException extends ProtocolException {
251
- /**
252
- * The field's name.
253
- */
254
- public readonly field: string;
255
-
256
- /**
257
- * The model's name.
258
- */
259
- public readonly model: string;
260
-
261
- /**
262
- * Formats the exception's message from its facts.
263
- *
264
- * @param model The model's name.
265
- * @param field The field's name.
266
- * @example
267
- * ```ts
268
- * import { FieldNotANumberException } from "@noldova/checkpoints.protocol";
269
- *
270
- * const exception = new FieldNotANumberException("Model", "text");
271
- * console.log(exception.message, exception.model, exception.field);
272
- * ```
273
- */
274
- public constructor(model: string, field: string);
275
- }
276
-
277
- /**
278
- * Thrown when a model's field is neither a number nor `null`.
279
- */
280
- export declare class FieldNotANumberOrNullException extends ProtocolException {
281
- /**
282
- * The field's name.
283
- */
284
- public readonly field: string;
285
-
286
- /**
287
- * The model's name.
288
- */
289
- public readonly model: string;
290
-
291
- /**
292
- * Formats the exception's message from its facts.
293
- *
294
- * @param model The model's name.
295
- * @param field The field's name.
296
- * @example
297
- * ```ts
298
- * import { FieldNotANumberOrNullException } from "@noldova/checkpoints.protocol";
299
- *
300
- * const exception = new FieldNotANumberOrNullException("Model", "text");
301
- * console.log(exception.message, exception.model, exception.field);
302
- * ```
303
- */
304
- public constructor(model: string, field: string);
305
- }
306
-
307
- /**
308
- * Thrown when a model's field isn't text.
309
- */
310
- export declare class FieldNotAStringException extends ProtocolException {
311
- /**
312
- * The field's name.
313
- */
314
- public readonly field: string;
315
-
316
- /**
317
- * The model's name.
318
- */
319
- public readonly model: string;
320
-
321
- /**
322
- * Formats the exception's message from its facts.
323
- *
324
- * @param model The model's name.
325
- * @param field The field's name.
326
- * @example
327
- * ```ts
328
- * import { FieldNotAStringException } from "@noldova/checkpoints.protocol";
329
- *
330
- * const exception = new FieldNotAStringException("Model", "number");
331
- * console.log(exception.message, exception.model, exception.field);
332
- * ```
333
- */
334
- public constructor(model: string, field: string);
335
- }
336
-
337
- /**
338
- * Thrown when a model's field isn't a list of text.
339
- */
340
- export declare class FieldNotAStringListException extends ProtocolException {
341
- /**
342
- * The field's name.
343
- */
344
- public readonly field: string;
345
-
346
- /**
347
- * The model's name.
348
- */
349
- public readonly model: string;
350
-
351
- /**
352
- * Formats the exception's message from its facts.
353
- *
354
- * @param model The model's name.
355
- * @param field The field's name.
356
- * @example
357
- * ```ts
358
- * import { FieldNotAStringListException } from "@noldova/checkpoints.protocol";
359
- *
360
- * const exception = new FieldNotAStringListException("Model", "mixed");
361
- * console.log(exception.message, exception.model, exception.field);
362
- * ```
363
- */
364
- public constructor(model: string, field: string);
365
- }
366
-
367
- /**
368
- * Thrown when a model's field is neither text nor `null`.
369
- */
370
- export declare class FieldNotAStringOrNullException extends ProtocolException {
371
- /**
372
- * The field's name.
373
- */
374
- public readonly field: string;
375
-
376
- /**
377
- * The model's name.
378
- */
379
- public readonly model: string;
380
-
381
- /**
382
- * Formats the exception's message from its facts.
383
- *
384
- * @param model The model's name.
385
- * @param field The field's name.
386
- * @example
387
- * ```ts
388
- * import { FieldNotAStringOrNullException } from "@noldova/checkpoints.protocol";
389
- *
390
- * const exception = new FieldNotAStringOrNullException("Model", "number");
391
- * console.log(exception.message, exception.model, exception.field);
392
- * ```
393
- */
394
- public constructor(model: string, field: string);
395
- }
396
-
397
175
  /**
398
176
  * Thrown when a read result's wire content isn't padded base64 text.
399
177
  */
@@ -645,60 +423,6 @@ export declare class LabelTooLongException extends ProtocolException {
645
423
  public constructor(length: number);
646
424
  }
647
425
 
648
- /**
649
- * Thrown when a model's wire form lacks a field it needs.
650
- */
651
- export declare class MissingFieldException extends ProtocolException {
652
- /**
653
- * The field's name.
654
- */
655
- public readonly field: string;
656
-
657
- /**
658
- * The model's name.
659
- */
660
- public readonly model: string;
661
-
662
- /**
663
- * Formats the exception's message from its facts.
664
- *
665
- * @param model The model's name.
666
- * @param field The field's name.
667
- * @example
668
- * ```ts
669
- * import { MissingFieldException } from "@noldova/checkpoints.protocol";
670
- *
671
- * const exception = new MissingFieldException("Model", "missing");
672
- * console.log(exception.message, exception.model, exception.field);
673
- * ```
674
- */
675
- public constructor(model: string, field: string);
676
- }
677
-
678
- /**
679
- * Thrown when a model's wire form isn't a JSON object.
680
- */
681
- export declare class NotAnObjectException extends ProtocolException {
682
- /**
683
- * The model's name.
684
- */
685
- public readonly model: string;
686
-
687
- /**
688
- * Formats the exception's message from its facts.
689
- *
690
- * @param model The model's name.
691
- * @example
692
- * ```ts
693
- * import { NotAnObjectException } from "@noldova/checkpoints.protocol";
694
- *
695
- * const exception = new NotAnObjectException("Model");
696
- * console.log(exception.message, exception.model);
697
- * ```
698
- */
699
- public constructor(model: string);
700
- }
701
-
702
426
  /**
703
427
  * Thrown when a preview result holds a plan other than exactly when its outcome is Planned.
704
428
  */
@@ -963,36 +687,6 @@ export declare class UnknownDeleteFolderOutcomeException extends ProtocolExcepti
963
687
  public constructor(value: string);
964
688
  }
965
689
 
966
- /**
967
- * Thrown when a model's wire form has a field the model doesn't.
968
- */
969
- export declare class UnknownFieldException extends ProtocolException {
970
- /**
971
- * The field's name.
972
- */
973
- public readonly field: string;
974
-
975
- /**
976
- * The model's name.
977
- */
978
- public readonly model: string;
979
-
980
- /**
981
- * Formats the exception's message from its facts.
982
- *
983
- * @param model The model's name.
984
- * @param field The field's name.
985
- * @example
986
- * ```ts
987
- * import { UnknownFieldException } from "@noldova/checkpoints.protocol";
988
- *
989
- * const exception = new UnknownFieldException("Model", "other");
990
- * console.log(exception.message, exception.model, exception.field);
991
- * ```
992
- */
993
- public constructor(model: string, field: string);
994
- }
995
-
996
690
  /**
997
691
  * Thrown when a wire value names no reason a restore keeps a path.
998
692
  */
@@ -1421,7 +1115,8 @@ export declare class UnreadPath {
1421
1115
  *
1422
1116
  * @param value The wire form.
1423
1117
  * @returns The path.
1424
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a path.
1118
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a path: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1119
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1425
1120
  * @example
1426
1121
  * ```ts
1427
1122
  * import { UnreadPath } from "@noldova/checkpoints.protocol";
@@ -1497,7 +1192,8 @@ export declare class Checkpoint {
1497
1192
  *
1498
1193
  * @param value The wire form.
1499
1194
  * @returns The checkpoint.
1500
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a checkpoint.
1195
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a checkpoint: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1196
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1501
1197
  * @example
1502
1198
  * ```ts
1503
1199
  * import { Checkpoint } from "@noldova/checkpoints.protocol";
@@ -1556,7 +1252,8 @@ export declare class FolderReference {
1556
1252
  *
1557
1253
  * @param value The wire form.
1558
1254
  * @returns The folder.
1559
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a folder.
1255
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a folder: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1256
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1560
1257
  * @example
1561
1258
  * ```ts
1562
1259
  * import { FolderReference } from "@noldova/checkpoints.protocol";
@@ -1618,7 +1315,8 @@ export declare class CaptureRequest {
1618
1315
  *
1619
1316
  * @param value The wire form.
1620
1317
  * @returns The request.
1621
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
1318
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1319
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1622
1320
  * @example
1623
1321
  * ```ts
1624
1322
  * import { CaptureRequest } from "@noldova/checkpoints.protocol";
@@ -1691,7 +1389,8 @@ export declare class CaptureResult {
1691
1389
  *
1692
1390
  * @param value The wire form.
1693
1391
  * @returns The result.
1694
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a result.
1392
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a result: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1393
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1695
1394
  * @example
1696
1395
  * ```ts
1697
1396
  * import { CaptureResult } from "@noldova/checkpoints.protocol";
@@ -1747,7 +1446,8 @@ export declare class ListRequest {
1747
1446
  *
1748
1447
  * @param value The wire form.
1749
1448
  * @returns The request.
1750
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
1449
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1450
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1751
1451
  * @example
1752
1452
  * ```ts
1753
1453
  * import { ListRequest } from "@noldova/checkpoints.protocol";
@@ -1799,7 +1499,8 @@ export declare class CheckpointList {
1799
1499
  *
1800
1500
  * @param value The wire form.
1801
1501
  * @returns The list.
1802
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a list.
1502
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a list: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1503
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1803
1504
  * @example
1804
1505
  * ```ts
1805
1506
  * import { CheckpointList } from "@noldova/checkpoints.protocol";
@@ -1984,7 +1685,8 @@ export declare class ChangeSide {
1984
1685
  *
1985
1686
  * @param value The wire form.
1986
1687
  * @returns The side.
1987
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a side.
1688
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a side: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1689
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
1988
1690
  * @example
1989
1691
  * ```ts
1990
1692
  * import { ChangeSide } from "@noldova/checkpoints.protocol";
@@ -2060,7 +1762,8 @@ export declare class Change {
2060
1762
  *
2061
1763
  * @param value The wire form.
2062
1764
  * @returns The change.
2063
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a change.
1765
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a change: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1766
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2064
1767
  * @example
2065
1768
  * ```ts
2066
1769
  * import { Change } from "@noldova/checkpoints.protocol";
@@ -2186,7 +1889,8 @@ export declare class CompareRequest {
2186
1889
  *
2187
1890
  * @param value The wire form.
2188
1891
  * @returns The request.
2189
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
1892
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1893
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2190
1894
  * @example
2191
1895
  * ```ts
2192
1896
  * import { CompareRequest } from "@noldova/checkpoints.protocol";
@@ -2248,7 +1952,8 @@ export declare class CompareResult {
2248
1952
  *
2249
1953
  * @param value The wire form.
2250
1954
  * @returns The result.
2251
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a result.
1955
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a result: it isn't an object, or a field is missing, of the wrong type or not one the model has.
1956
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2252
1957
  * @example
2253
1958
  * ```ts
2254
1959
  * import { CompareResult } from "@noldova/checkpoints.protocol";
@@ -2299,7 +2004,8 @@ export declare class DiffTarget {
2299
2004
  *
2300
2005
  * @param value The wire form.
2301
2006
  * @returns The target.
2302
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a target.
2007
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a target: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2008
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2303
2009
  * @example
2304
2010
  * ```ts
2305
2011
  * import { DiffTarget } from "@noldova/checkpoints.protocol";
@@ -2455,7 +2161,8 @@ export declare class ReadRequest {
2455
2161
  *
2456
2162
  * @param value The wire form.
2457
2163
  * @returns The request.
2458
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
2164
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2165
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2459
2166
  * @example
2460
2167
  * ```ts
2461
2168
  * import { ReadRequest } from "@noldova/checkpoints.protocol";
@@ -2535,7 +2242,8 @@ export declare class ReadResult {
2535
2242
  *
2536
2243
  * @param value The wire form.
2537
2244
  * @returns The result.
2538
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a result, such as content that isn't base64 text.
2245
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a result: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2246
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses, such as content that isn't base64 text.
2539
2247
  * @example
2540
2248
  * ```ts
2541
2249
  * import { ReadResult } from "@noldova/checkpoints.protocol";
@@ -2721,7 +2429,8 @@ export declare class RestoreStep {
2721
2429
  *
2722
2430
  * @param value The wire form.
2723
2431
  * @returns The step.
2724
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a step.
2432
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a step: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2433
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2725
2434
  * @example
2726
2435
  * ```ts
2727
2436
  * import { RestoreStep } from "@noldova/checkpoints.protocol";
@@ -2778,7 +2487,8 @@ export declare class KeptPath {
2778
2487
  *
2779
2488
  * @param value The wire form.
2780
2489
  * @returns The kept path.
2781
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a kept path.
2490
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a kept path: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2491
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2782
2492
  * @example
2783
2493
  * ```ts
2784
2494
  * import { KeptPath } from "@noldova/checkpoints.protocol";
@@ -2873,7 +2583,8 @@ export declare class RestorePlan {
2873
2583
  *
2874
2584
  * @param value The wire form.
2875
2585
  * @returns The plan.
2876
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a plan.
2586
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a plan: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2587
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
2877
2588
  * @example
2878
2589
  * ```ts
2879
2590
  * import { RestorePlan } from "@noldova/checkpoints.protocol";
@@ -3016,7 +2727,8 @@ export declare class PreviewRequest {
3016
2727
  *
3017
2728
  * @param value The wire form.
3018
2729
  * @returns The request.
3019
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
2730
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2731
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3020
2732
  * @example
3021
2733
  * ```ts
3022
2734
  * import { PreviewRequest } from "@noldova/checkpoints.protocol";
@@ -3078,7 +2790,8 @@ export declare class PreviewResult {
3078
2790
  *
3079
2791
  * @param value The wire form.
3080
2792
  * @returns The result.
3081
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a result.
2793
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a result: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2794
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3082
2795
  * @example
3083
2796
  * ```ts
3084
2797
  * import { PreviewResult } from "@noldova/checkpoints.protocol";
@@ -3221,7 +2934,8 @@ export declare class RestoreRequest {
3221
2934
  *
3222
2935
  * @param value The wire form.
3223
2936
  * @returns The request.
3224
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
2937
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
2938
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3225
2939
  * @example
3226
2940
  * ```ts
3227
2941
  * import { RestoreRequest } from "@noldova/checkpoints.protocol";
@@ -3294,7 +3008,8 @@ export declare class RestoreResult {
3294
3008
  *
3295
3009
  * @param value The wire form.
3296
3010
  * @returns The result.
3297
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a result.
3011
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a result: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3012
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3298
3013
  * @example
3299
3014
  * ```ts
3300
3015
  * import { RestoreResult } from "@noldova/checkpoints.protocol";
@@ -3344,7 +3059,8 @@ export declare class StorageRequest {
3344
3059
  *
3345
3060
  * @param value The wire form.
3346
3061
  * @returns The request.
3347
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
3062
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3063
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3348
3064
  * @example
3349
3065
  * ```ts
3350
3066
  * import { StorageRequest } from "@noldova/checkpoints.protocol";
@@ -3408,7 +3124,8 @@ export declare class FolderUsage {
3408
3124
  *
3409
3125
  * @param value The wire form.
3410
3126
  * @returns The folder's space used.
3411
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a folder's space used.
3127
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a folder's space used: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3128
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3412
3129
  * @example
3413
3130
  * ```ts
3414
3131
  * import { FolderUsage } from "@noldova/checkpoints.protocol";
@@ -3458,7 +3175,8 @@ export declare class StorageList {
3458
3175
  *
3459
3176
  * @param value The wire form.
3460
3177
  * @returns The list.
3461
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a list.
3178
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a list: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3179
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3462
3180
  * @example
3463
3181
  * ```ts
3464
3182
  * import { StorageList } from "@noldova/checkpoints.protocol";
@@ -3563,7 +3281,8 @@ export declare class DeleteFolderRequest {
3563
3281
  *
3564
3282
  * @param value The wire form.
3565
3283
  * @returns The request.
3566
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a request.
3284
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a request: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3285
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3567
3286
  * @example
3568
3287
  * ```ts
3569
3288
  * import { DeleteFolderRequest } from "@noldova/checkpoints.protocol";
@@ -3615,7 +3334,8 @@ export declare class DeleteFolderResult {
3615
3334
  *
3616
3335
  * @param value The wire form.
3617
3336
  * @returns The result.
3618
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of a result.
3337
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of a result: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3338
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3619
3339
  * @example
3620
3340
  * ```ts
3621
3341
  * import { DeleteFolderResult } from "@noldova/checkpoints.protocol";
@@ -3685,7 +3405,8 @@ export declare class RestoredEvent {
3685
3405
  *
3686
3406
  * @param value The wire form.
3687
3407
  * @returns The event.
3688
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of the event.
3408
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of the event: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3409
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3689
3410
  * @example
3690
3411
  * ```ts
3691
3412
  * import { RestoredEvent } from "@noldova/checkpoints.protocol";
@@ -3758,7 +3479,8 @@ export declare class CapturePausedEvent {
3758
3479
  *
3759
3480
  * @param value The wire form.
3760
3481
  * @returns The event.
3761
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of the event.
3482
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of the event: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3483
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3762
3484
  * @example
3763
3485
  * ```ts
3764
3486
  * import { CapturePausedEvent } from "@noldova/checkpoints.protocol";
@@ -3815,7 +3537,8 @@ export declare class CaptureResumedEvent {
3815
3537
  *
3816
3538
  * @param value The wire form.
3817
3539
  * @returns The event.
3818
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of the event.
3540
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of the event: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3541
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3819
3542
  * @example
3820
3543
  * ```ts
3821
3544
  * import { CaptureResumedEvent } from "@noldova/checkpoints.protocol";
@@ -3878,7 +3601,8 @@ export declare class RestoreHeldUpEvent {
3878
3601
  *
3879
3602
  * @param value The wire form.
3880
3603
  * @returns The event.
3881
- * @throws {ProtocolException} Thrown synchronously when the value isn't the wire form of the event.
3604
+ * @throws {JsonException} Thrown synchronously when the value isn't the wire form of the event: it isn't an object, or a field is missing, of the wrong type or not one the model has.
3605
+ * @throws {ProtocolException} Thrown synchronously when the wire form holds a value the model refuses.
3882
3606
  * @example
3883
3607
  * ```ts
3884
3608
  * import { RestoreHeldUpEvent } from "@noldova/checkpoints.protocol";
@@ -3901,162 +3625,3 @@ export declare class RestoreHeldUpEvent {
3901
3625
  */
3902
3626
  public toJson(): JsonObject;
3903
3627
  }
3904
-
3905
- /**
3906
- * Reads the fields of a JSON object that a model's wire form must be, failing with a {@link ProtocolException} that names the model.
3907
- */
3908
- export declare class JsonObjectReader {
3909
- /**
3910
- * @param value The value to read, which must be a JSON object.
3911
- * @param model The model's name, for the failures' messages.
3912
- * @throws {ProtocolException} Thrown synchronously when the value isn't an object.
3913
- * @example
3914
- * ```ts
3915
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
3916
- *
3917
- * const reader = new JsonObjectReader({ label: "Turn 3" }, "Model");
3918
- * reader.refuseOtherFields(["label"]);
3919
- * console.log(reader.readString("label"));
3920
- * ```
3921
- */
3922
- public constructor(value: unknown, model: string);
3923
-
3924
- /**
3925
- * @param field The field's name.
3926
- * @returns The field's value.
3927
- * @throws {ProtocolException} Thrown synchronously when the object has no such field.
3928
- * @example
3929
- * ```ts
3930
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
3931
- *
3932
- * const reader = new JsonObjectReader({ label: "Turn 3" }, "Model");
3933
- * console.log(reader.read("label"));
3934
- * ```
3935
- */
3936
- public read(field: string): unknown;
3937
-
3938
- /**
3939
- * @param field The field's name.
3940
- * @returns The field's `true` or `false`.
3941
- * @throws {ProtocolException} Thrown synchronously when the field is missing or is neither `true` nor `false`.
3942
- * @example
3943
- * ```ts
3944
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
3945
- *
3946
- * const reader = new JsonObjectReader({ isText: true }, "Model");
3947
- * console.log(reader.readBoolean("isText"));
3948
- * ```
3949
- */
3950
- public readBoolean(field: string): boolean;
3951
-
3952
- /**
3953
- * @param field The field's name.
3954
- * @returns The field's list.
3955
- * @throws {ProtocolException} Thrown synchronously when the field is missing or isn't a list.
3956
- * @example
3957
- * ```ts
3958
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
3959
- *
3960
- * const reader = new JsonObjectReader({ steps: [] }, "Model");
3961
- * console.log(reader.readList("steps").length);
3962
- * ```
3963
- */
3964
- public readList(field: string): readonly unknown[];
3965
-
3966
- /**
3967
- * @param field The field's name.
3968
- * @returns The field's number.
3969
- * @throws {ProtocolException} Thrown synchronously when the field is missing or isn't a number.
3970
- * @example
3971
- * ```ts
3972
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
3973
- *
3974
- * const reader = new JsonObjectReader({ size: 1_024 }, "Model");
3975
- * console.log(reader.readNumber("size"));
3976
- * ```
3977
- */
3978
- public readNumber(field: string): number;
3979
-
3980
- /**
3981
- * @param field The field's name.
3982
- * @returns The field's number, or `null`.
3983
- * @throws {ProtocolException} Thrown synchronously when the field is missing or is neither a number nor `null`.
3984
- * @example
3985
- * ```ts
3986
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
3987
- *
3988
- * const reader = new JsonObjectReader({ size: null }, "Model");
3989
- * console.log(reader.readNumberOrNull("size"));
3990
- * ```
3991
- */
3992
- public readNumberOrNull(field: string): number | null;
3993
-
3994
- /**
3995
- * @param field The field's name.
3996
- * @returns The field's text.
3997
- * @throws {ProtocolException} Thrown synchronously when the field is missing or isn't text.
3998
- * @example
3999
- * ```ts
4000
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
4001
- *
4002
- * const reader = new JsonObjectReader({ label: "Turn 3" }, "Model");
4003
- * console.log(reader.readString("label"));
4004
- * ```
4005
- */
4006
- public readString(field: string): string;
4007
-
4008
- /**
4009
- * @param field The field's name.
4010
- * @returns The field's text, or `null`.
4011
- * @throws {ProtocolException} Thrown synchronously when the field is missing or is neither text nor `null`.
4012
- * @example
4013
- * ```ts
4014
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
4015
- *
4016
- * const reader = new JsonObjectReader({ label: null }, "Model");
4017
- * console.log(reader.readStringOrNull("label"));
4018
- * ```
4019
- */
4020
- public readStringOrNull(field: string): string | null;
4021
-
4022
- /**
4023
- * @param field The field's name.
4024
- * @returns The field's list of text.
4025
- * @throws {ProtocolException} Thrown synchronously when the field is missing or isn't a list of text.
4026
- * @example
4027
- * ```ts
4028
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
4029
- *
4030
- * const reader = new JsonObjectReader({ paths: ["src", "docs"] }, "Model");
4031
- * console.log(reader.readStringList("paths"));
4032
- * ```
4033
- */
4034
- public readStringList(field: string): readonly string[];
4035
-
4036
- /**
4037
- * @param field The field's name.
4038
- * @returns The field's list of text, or `null`.
4039
- * @throws {ProtocolException} Thrown synchronously when the field is missing or is neither a list of text nor `null`.
4040
- * @example
4041
- * ```ts
4042
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
4043
- *
4044
- * const reader = new JsonObjectReader({ paths: null }, "Model");
4045
- * console.log(reader.readStringListOrNull("paths"));
4046
- * ```
4047
- */
4048
- public readStringListOrNull(field: string): readonly string[] | null;
4049
-
4050
- /**
4051
- * @param known The fields the model has.
4052
- * @throws {ProtocolException} Thrown synchronously when the object has a field the model doesn't.
4053
- * @example
4054
- * ```ts
4055
- * import { JsonObjectReader } from "@noldova/checkpoints.protocol";
4056
- *
4057
- * const reader = new JsonObjectReader({ label: "Turn 3" }, "Model");
4058
- * reader.refuseOtherFields(["label"]);
4059
- * ```
4060
- */
4061
- public refuseOtherFields(known: readonly string[]): void;
4062
- }