@noldova/checkpoints 0.0.0-stage → 0.0.1

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 (296) hide show
  1. package/LICENSE +21 -0
  2. package/module.json +15 -0
  3. package/package.json +49 -4
  4. package/settings.json +15 -0
  5. package/src/api/index.d.ts +1150 -0
  6. package/src/api/index.js +34 -0
  7. package/src/api/index.js.map +1 -0
  8. package/src/exceptions/checkpoint-file-missing.exception.js +17 -0
  9. package/src/exceptions/checkpoint-file-missing.exception.js.map +1 -0
  10. package/src/exceptions/checkpoints.exception.js +14 -0
  11. package/src/exceptions/checkpoints.exception.js.map +1 -0
  12. package/src/exceptions/git-exited.exception.js +21 -0
  13. package/src/exceptions/git-exited.exception.js.map +1 -0
  14. package/src/exceptions/git-manifest-invalid.exception.js +18 -0
  15. package/src/exceptions/git-manifest-invalid.exception.js.map +1 -0
  16. package/src/exceptions/git-missing.exception.js +18 -0
  17. package/src/exceptions/git-missing.exception.js.map +1 -0
  18. package/src/exceptions/git-stopped.exception.js +19 -0
  19. package/src/exceptions/git-stopped.exception.js.map +1 -0
  20. package/src/exceptions/git.exception.js +14 -0
  21. package/src/exceptions/git.exception.js.map +1 -0
  22. package/src/exceptions/ignore-rules-mismatch.exception.js +17 -0
  23. package/src/exceptions/ignore-rules-mismatch.exception.js.map +1 -0
  24. package/src/exceptions/journal-field-missing.exception.js +19 -0
  25. package/src/exceptions/journal-field-missing.exception.js.map +1 -0
  26. package/src/exceptions/restore-folder-changed.exception.js +19 -0
  27. package/src/exceptions/restore-folder-changed.exception.js.map +1 -0
  28. package/src/exceptions/restore-path-changed.exception.js +17 -0
  29. package/src/exceptions/restore-path-changed.exception.js.map +1 -0
  30. package/src/exceptions/restore-path-in-the-way.exception.js +17 -0
  31. package/src/exceptions/restore-path-in-the-way.exception.js.map +1 -0
  32. package/src/exceptions/restore-path-occupied.exception.js +17 -0
  33. package/src/exceptions/restore-path-occupied.exception.js.map +1 -0
  34. package/src/exceptions/restore-step-failed.exception.js +18 -0
  35. package/src/exceptions/restore-step-failed.exception.js.map +1 -0
  36. package/src/exceptions/restore-step.exception.js +14 -0
  37. package/src/exceptions/restore-step.exception.js.map +1 -0
  38. package/src/exceptions/script-step-missing.exception.js +17 -0
  39. package/src/exceptions/script-step-missing.exception.js.map +1 -0
  40. package/src/exceptions/staged-file-missing.exception.js +17 -0
  41. package/src/exceptions/staged-file-missing.exception.js.map +1 -0
  42. package/src/exceptions/store-answers-mismatch.exception.js +19 -0
  43. package/src/exceptions/store-answers-mismatch.exception.js.map +1 -0
  44. package/src/exceptions/store-count-missing.exception.js +17 -0
  45. package/src/exceptions/store-count-missing.exception.js.map +1 -0
  46. package/src/exceptions/store-field-not-a-boolean.exception.js +17 -0
  47. package/src/exceptions/store-field-not-a-boolean.exception.js.map +1 -0
  48. package/src/exceptions/store-field-not-a-string-list.exception.js +17 -0
  49. package/src/exceptions/store-field-not-a-string-list.exception.js.map +1 -0
  50. package/src/exceptions/store-file-unreadable.exception.js +18 -0
  51. package/src/exceptions/store-file-unreadable.exception.js.map +1 -0
  52. package/src/exceptions/store-object-missing.exception.js +17 -0
  53. package/src/exceptions/store-object-missing.exception.js.map +1 -0
  54. package/src/exceptions/store-object-not-a-blob.exception.js +19 -0
  55. package/src/exceptions/store-object-not-a-blob.exception.js.map +1 -0
  56. package/src/exceptions/store.exception.js +14 -0
  57. package/src/exceptions/store.exception.js.map +1 -0
  58. package/src/exceptions/tree-line-malformed.exception.js +17 -0
  59. package/src/exceptions/tree-line-malformed.exception.js.map +1 -0
  60. package/src/exceptions/unexpected-store-object.exception.js +17 -0
  61. package/src/exceptions/unexpected-store-object.exception.js.map +1 -0
  62. package/src/exceptions/unknown-entry-kind.exception.js +17 -0
  63. package/src/exceptions/unknown-entry-kind.exception.js.map +1 -0
  64. package/src/exceptions/unknown-git-mode.exception.js +17 -0
  65. package/src/exceptions/unknown-git-mode.exception.js.map +1 -0
  66. package/src/exceptions/unknown-journal-record.exception.js +17 -0
  67. package/src/exceptions/unknown-journal-record.exception.js.map +1 -0
  68. package/src/exceptions/unknown-link-kind.exception.js +17 -0
  69. package/src/exceptions/unknown-link-kind.exception.js.map +1 -0
  70. package/src/exceptions/unsupported-store-format.exception.js +17 -0
  71. package/src/exceptions/unsupported-store-format.exception.js.map +1 -0
  72. package/src/models/byte-set.js +31 -0
  73. package/src/models/byte-set.js.map +1 -0
  74. package/src/models/checkpoint-record.js +76 -0
  75. package/src/models/checkpoint-record.js.map +1 -0
  76. package/src/models/depth-order.js +23 -0
  77. package/src/models/depth-order.js.map +1 -0
  78. package/src/models/entry-kind.js +48 -0
  79. package/src/models/entry-kind.js.map +1 -0
  80. package/src/models/finished-restore.js +18 -0
  81. package/src/models/finished-restore.js.map +1 -0
  82. package/src/models/folder-file.js +20 -0
  83. package/src/models/folder-file.js.map +1 -0
  84. package/src/models/folder-index.js +41 -0
  85. package/src/models/folder-index.js.map +1 -0
  86. package/src/models/folder-record.js +27 -0
  87. package/src/models/folder-record.js.map +1 -0
  88. package/src/models/folder-store.js +38 -0
  89. package/src/models/folder-store.js.map +1 -0
  90. package/src/models/git-build.js +18 -0
  91. package/src/models/git-build.js.map +1 -0
  92. package/src/models/git-limits.js +20 -0
  93. package/src/models/git-limits.js.map +1 -0
  94. package/src/models/housekeeping-record.js +27 -0
  95. package/src/models/housekeeping-record.js.map +1 -0
  96. package/src/models/ignore-file.js +32 -0
  97. package/src/models/ignore-file.js.map +1 -0
  98. package/src/models/ignore-pattern.js +57 -0
  99. package/src/models/ignore-pattern.js.map +1 -0
  100. package/src/models/ignore-record.js +32 -0
  101. package/src/models/ignore-record.js.map +1 -0
  102. package/src/models/ignore-rules.js +48 -0
  103. package/src/models/ignore-rules.js.map +1 -0
  104. package/src/models/import-result.js +16 -0
  105. package/src/models/import-result.js.map +1 -0
  106. package/src/models/index-entry.js +56 -0
  107. package/src/models/index-entry.js.map +1 -0
  108. package/src/models/journal-reading.js +19 -0
  109. package/src/models/journal-reading.js.map +1 -0
  110. package/src/models/journal-record-type.js +43 -0
  111. package/src/models/journal-record-type.js.map +1 -0
  112. package/src/models/journal-record.js +94 -0
  113. package/src/models/journal-record.js.map +1 -0
  114. package/src/models/link-kind.js +27 -0
  115. package/src/models/link-kind.js.map +1 -0
  116. package/src/models/link-record.js +28 -0
  117. package/src/models/link-record.js.map +1 -0
  118. package/src/models/loaded-checkpoint.js +16 -0
  119. package/src/models/loaded-checkpoint.js.map +1 -0
  120. package/src/models/newest-checkpoint.js +16 -0
  121. package/src/models/newest-checkpoint.js.map +1 -0
  122. package/src/models/no-plan.js +20 -0
  123. package/src/models/no-plan.js.map +1 -0
  124. package/src/models/object-batch.js +29 -0
  125. package/src/models/object-batch.js.map +1 -0
  126. package/src/models/object-counts.js +35 -0
  127. package/src/models/object-counts.js.map +1 -0
  128. package/src/models/pending-change.js +22 -0
  129. package/src/models/pending-change.js.map +1 -0
  130. package/src/models/planned-restore.js +22 -0
  131. package/src/models/planned-restore.js.map +1 -0
  132. package/src/models/read-failure.js +37 -0
  133. package/src/models/read-failure.js.map +1 -0
  134. package/src/models/restore-run.js +28 -0
  135. package/src/models/restore-run.js.map +1 -0
  136. package/src/models/restore-script.js +82 -0
  137. package/src/models/restore-script.js.map +1 -0
  138. package/src/models/scheduled-call.js +17 -0
  139. package/src/models/scheduled-call.js.map +1 -0
  140. package/src/models/script-step.js +72 -0
  141. package/src/models/script-step.js.map +1 -0
  142. package/src/models/side-content.js +16 -0
  143. package/src/models/side-content.js.map +1 -0
  144. package/src/models/side-entry.js +21 -0
  145. package/src/models/side-entry.js.map +1 -0
  146. package/src/models/side-file.js +19 -0
  147. package/src/models/side-file.js.map +1 -0
  148. package/src/models/side-folder.js +19 -0
  149. package/src/models/side-folder.js.map +1 -0
  150. package/src/models/side-listing.js +49 -0
  151. package/src/models/side-listing.js.map +1 -0
  152. package/src/models/staged-blob.js +20 -0
  153. package/src/models/staged-blob.js.map +1 -0
  154. package/src/models/staged-step.js +16 -0
  155. package/src/models/staged-step.js.map +1 -0
  156. package/src/models/stored-object.js +26 -0
  157. package/src/models/stored-object.js.map +1 -0
  158. package/src/models/tree-file.js +14 -0
  159. package/src/models/tree-file.js.map +1 -0
  160. package/src/models/tree-listing.js +39 -0
  161. package/src/models/tree-listing.js.map +1 -0
  162. package/src/models/unhashed-file.js +16 -0
  163. package/src/models/unhashed-file.js.map +1 -0
  164. package/src/models/walk-result.js +79 -0
  165. package/src/models/walk-result.js.map +1 -0
  166. package/src/models/walked-child.js +16 -0
  167. package/src/models/walked-child.js.map +1 -0
  168. package/src/models/walked-entry.js +31 -0
  169. package/src/models/walked-entry.js.map +1 -0
  170. package/src/models/walked-listing.js +16 -0
  171. package/src/models/walked-listing.js.map +1 -0
  172. package/src/models/wildcard-pattern.js +19 -0
  173. package/src/models/wildcard-pattern.js.map +1 -0
  174. package/src/models/write-meter.js +16 -0
  175. package/src/models/write-meter.js.map +1 -0
  176. package/src/resources.js +564 -0
  177. package/src/resources.js.map +1 -0
  178. package/src/runtime-part.js +22 -0
  179. package/src/runtime-part.js.map +1 -0
  180. package/src/services/batch-output.parser.js +65 -0
  181. package/src/services/batch-output.parser.js.map +1 -0
  182. package/src/services/blob-batch.writer.js +86 -0
  183. package/src/services/blob-batch.writer.js.map +1 -0
  184. package/src/services/blob-stager.js +41 -0
  185. package/src/services/blob-stager.js.map +1 -0
  186. package/src/services/capture-pause.js +37 -0
  187. package/src/services/capture-pause.js.map +1 -0
  188. package/src/services/case-probe.js +32 -0
  189. package/src/services/case-probe.js.map +1 -0
  190. package/src/services/change-describer.js +38 -0
  191. package/src/services/change-describer.js.map +1 -0
  192. package/src/services/checkpoint-capture.js +153 -0
  193. package/src/services/checkpoint-capture.js.map +1 -0
  194. package/src/services/checkpoint-comparer.js +37 -0
  195. package/src/services/checkpoint-comparer.js.map +1 -0
  196. package/src/services/checkpoint-file.reader.js +146 -0
  197. package/src/services/checkpoint-file.reader.js.map +1 -0
  198. package/src/services/checkpoint-id-source.js +27 -0
  199. package/src/services/checkpoint-id-source.js.map +1 -0
  200. package/src/services/checkpoint-lister.js +63 -0
  201. package/src/services/checkpoint-lister.js.map +1 -0
  202. package/src/services/checkpoints-host.js +184 -0
  203. package/src/services/checkpoints-host.js.map +1 -0
  204. package/src/services/checkpoints.service.js +10 -0
  205. package/src/services/checkpoints.service.js.map +1 -0
  206. package/src/services/clock.js +26 -0
  207. package/src/services/clock.js.map +1 -0
  208. package/src/services/command-deadline.js +34 -0
  209. package/src/services/command-deadline.js.map +1 -0
  210. package/src/services/entry.reader.js +84 -0
  211. package/src/services/entry.reader.js.map +1 -0
  212. package/src/services/failures.js +55 -0
  213. package/src/services/failures.js.map +1 -0
  214. package/src/services/fast-import-leftovers.js +35 -0
  215. package/src/services/fast-import-leftovers.js.map +1 -0
  216. package/src/services/folder-deleter.js +86 -0
  217. package/src/services/folder-deleter.js.map +1 -0
  218. package/src/services/folder-file.reader.js +78 -0
  219. package/src/services/folder-file.reader.js.map +1 -0
  220. package/src/services/folder-queue.js +27 -0
  221. package/src/services/folder-queue.js.map +1 -0
  222. package/src/services/folder-sync.js +25 -0
  223. package/src/services/folder-sync.js.map +1 -0
  224. package/src/services/folder-walker.js +123 -0
  225. package/src/services/folder-walker.js.map +1 -0
  226. package/src/services/free-space.js +30 -0
  227. package/src/services/free-space.js.map +1 -0
  228. package/src/services/git-build.locator.js +67 -0
  229. package/src/services/git-build.locator.js.map +1 -0
  230. package/src/services/git-path.js +21 -0
  231. package/src/services/git-path.js.map +1 -0
  232. package/src/services/git-process.js +127 -0
  233. package/src/services/git-process.js.map +1 -0
  234. package/src/services/git-runner.js +235 -0
  235. package/src/services/git-runner.js.map +1 -0
  236. package/src/services/housekeeping-schedule.js +77 -0
  237. package/src/services/housekeeping-schedule.js.map +1 -0
  238. package/src/services/ignore-file.reader.js +41 -0
  239. package/src/services/ignore-file.reader.js.map +1 -0
  240. package/src/services/input-writer.js +67 -0
  241. package/src/services/input-writer.js.map +1 -0
  242. package/src/services/line-diff.js +32 -0
  243. package/src/services/line-diff.js.map +1 -0
  244. package/src/services/link-probe.js +22 -0
  245. package/src/services/link-probe.js.map +1 -0
  246. package/src/services/listing-comparer.js +41 -0
  247. package/src/services/listing-comparer.js.map +1 -0
  248. package/src/services/module-activation.js +42 -0
  249. package/src/services/module-activation.js.map +1 -0
  250. package/src/services/name-decoder.js +30 -0
  251. package/src/services/name-decoder.js.map +1 -0
  252. package/src/services/object.reader.js +40 -0
  253. package/src/services/object.reader.js.map +1 -0
  254. package/src/services/path-guard.js +45 -0
  255. package/src/services/path-guard.js.map +1 -0
  256. package/src/services/plan-state.js +31 -0
  257. package/src/services/plan-state.js.map +1 -0
  258. package/src/services/relative-path.js +18 -0
  259. package/src/services/relative-path.js.map +1 -0
  260. package/src/services/repository-name.js +14 -0
  261. package/src/services/repository-name.js.map +1 -0
  262. package/src/services/restore-applier.js +175 -0
  263. package/src/services/restore-applier.js.map +1 -0
  264. package/src/services/restore-journal.js +120 -0
  265. package/src/services/restore-journal.js.map +1 -0
  266. package/src/services/restore-paths.js +130 -0
  267. package/src/services/restore-paths.js.map +1 -0
  268. package/src/services/restore-planner.js +114 -0
  269. package/src/services/restore-planner.js.map +1 -0
  270. package/src/services/restore-rollback.js +159 -0
  271. package/src/services/restore-rollback.js.map +1 -0
  272. package/src/services/restore-runner.js +221 -0
  273. package/src/services/restore-runner.js.map +1 -0
  274. package/src/services/restore-scope.js +42 -0
  275. package/src/services/restore-scope.js.map +1 -0
  276. package/src/services/side-loader.js +83 -0
  277. package/src/services/side-loader.js.map +1 -0
  278. package/src/services/storage-reader.js +80 -0
  279. package/src/services/storage-reader.js.map +1 -0
  280. package/src/services/store-file.js +54 -0
  281. package/src/services/store-file.js.map +1 -0
  282. package/src/services/store-format.js +30 -0
  283. package/src/services/store-format.js.map +1 -0
  284. package/src/services/store-housekeeping.js +66 -0
  285. package/src/services/store-housekeeping.js.map +1 -0
  286. package/src/services/store-opener.js +31 -0
  287. package/src/services/store-opener.js.map +1 -0
  288. package/src/services/store-reads.js +38 -0
  289. package/src/services/store-reads.js.map +1 -0
  290. package/src/services/text-probe.js +27 -0
  291. package/src/services/text-probe.js.map +1 -0
  292. package/src/services/tree-lister.js +20 -0
  293. package/src/services/tree-lister.js.map +1 -0
  294. package/src/services/wildcard.parser.js +152 -0
  295. package/src/services/wildcard.parser.js.map +1 -0
  296. package/README.md +0 -3
@@ -0,0 +1,1150 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ import type {
10
+ CaptureMode,
11
+ CaptureRequest,
12
+ CaptureResult,
13
+ CheckpointList,
14
+ CompareRequest,
15
+ CompareResult,
16
+ DeleteFolderRequest,
17
+ DeleteFolderResult,
18
+ ListRequest,
19
+ PreviewRequest,
20
+ PreviewResult,
21
+ ReadRequest,
22
+ ReadResult,
23
+ RestoreRequest,
24
+ RestoreResult,
25
+ StorageList
26
+ } from "@noldova/checkpoints.protocol";
27
+ import { Exception, type ExceptionOptions } from "@noldova/context.exceptions";
28
+ import type { IRuntimePart, IRuntimePartContext, ModuleActivationException } from "@noldova/desktop.runtime";
29
+
30
+ /**
31
+ * The base of every exception the checkpoints module defines. Its subclasses: {@link GitException}, {@link GitManifestInvalidException},
32
+ * {@link GitMissingException} and {@link StoreException}. A failure of the system itself, such as a store the system won't let it move
33
+ * aside, passes as Node's own error where a member says so.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { FolderReference, ListRequest } from "@noldova/checkpoints.protocol";
38
+ * import { CheckpointsException, CheckpointsService } from "@noldova/checkpoints/runtime";
39
+ *
40
+ * export async function listAsync(checkpoints: CheckpointsService): Promise<void> {
41
+ * try {
42
+ * await checkpoints.listAsync(new ListRequest(new FolderReference("project-1", "/work/project")));
43
+ * }
44
+ * catch (error) {
45
+ * console.log(error instanceof CheckpointsException);
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ export declare abstract class CheckpointsException extends Exception {
51
+ /**
52
+ * Initializes the message and the cause for a subclass.
53
+ *
54
+ * @param message The exception's message.
55
+ * @param options The failure that caused it, if any.
56
+ * @example
57
+ * ```ts
58
+ * import { CheckpointsException } from "@noldova/checkpoints/runtime";
59
+ *
60
+ * export class ProbeException extends CheckpointsException {
61
+ * public constructor() {
62
+ * super("The probe failed.");
63
+ * }
64
+ * }
65
+ * ```
66
+ */
67
+ protected constructor(message: string, options?: ExceptionOptions);
68
+ }
69
+
70
+ /**
71
+ * Thrown when a Git command the module ran didn't succeed; the operation it was part of fails as a whole and leaves no checkpoint.
72
+ * Its subclasses: {@link GitExitedException} and {@link GitStoppedException}.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * import { GitException, GitExitedException } from "@noldova/checkpoints/runtime";
77
+ *
78
+ * const exception = new GitExitedException("fast-import", 128, "fatal: broken stream");
79
+ * console.log(exception instanceof GitException, exception.command, exception.errors);
80
+ * ```
81
+ */
82
+ export declare abstract class GitException extends CheckpointsException {
83
+ /**
84
+ * The Git command, such as `"fast-import"`.
85
+ */
86
+ public abstract readonly command: string;
87
+
88
+ /**
89
+ * What the command wrote to its error output.
90
+ */
91
+ public abstract readonly errors: string;
92
+
93
+ /**
94
+ * Initializes the message and the cause for a subclass, which holds the command's facts.
95
+ *
96
+ * @param message The exception's message.
97
+ * @param options The failure that caused it, if any.
98
+ * @example
99
+ * ```ts
100
+ * import { GitException } from "@noldova/checkpoints/runtime";
101
+ *
102
+ * export class ProbeGitException extends GitException {
103
+ * public override readonly command: string = "cat-file";
104
+ * public override readonly errors: string = "";
105
+ *
106
+ * public constructor() {
107
+ * super("Git's cat-file failed.");
108
+ * }
109
+ * }
110
+ * ```
111
+ */
112
+ protected constructor(message: string, options?: ExceptionOptions);
113
+ }
114
+
115
+ /**
116
+ * Thrown when a Git command the module ran exited with a code other than success.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * import { GitExitedException } from "@noldova/checkpoints/runtime";
121
+ *
122
+ * const exception = new GitExitedException("fast-import", 128, "fatal: broken stream");
123
+ * console.log(exception.message, exception.exitCode);
124
+ * ```
125
+ */
126
+ export declare class GitExitedException extends GitException {
127
+ /**
128
+ * The Git command, such as `"fast-import"`.
129
+ */
130
+ public override readonly command: string;
131
+
132
+ /**
133
+ * What the command wrote to its error output.
134
+ */
135
+ public override readonly errors: string;
136
+
137
+ /**
138
+ * The command's exit code.
139
+ */
140
+ public readonly exitCode: number;
141
+
142
+ /**
143
+ * Formats the exception's message from its facts.
144
+ *
145
+ * @param command The Git command.
146
+ * @param exitCode The command's exit code.
147
+ * @param errors What the command wrote to its error output.
148
+ * @example
149
+ * ```ts
150
+ * import { GitExitedException } from "@noldova/checkpoints/runtime";
151
+ *
152
+ * export const failure: GitExitedException = new GitExitedException("fast-import", 128, "fatal: broken stream");
153
+ * ```
154
+ */
155
+ public constructor(command: string, exitCode: number, errors: string);
156
+ }
157
+
158
+ /**
159
+ * Thrown when the module stopped a Git command, at its time limit or as a signal asked, before it exited.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * import { GitStoppedException } from "@noldova/checkpoints/runtime";
164
+ *
165
+ * const exception = new GitStoppedException("cat-file", "");
166
+ * console.log(exception.message);
167
+ * ```
168
+ */
169
+ export declare class GitStoppedException extends GitException {
170
+ /**
171
+ * The Git command, such as `"cat-file"`.
172
+ */
173
+ public override readonly command: string;
174
+
175
+ /**
176
+ * What the command wrote to its error output, which may be empty.
177
+ */
178
+ public override readonly errors: string;
179
+
180
+ /**
181
+ * Formats the exception's message from its facts.
182
+ *
183
+ * @param command The Git command.
184
+ * @param errors What the command wrote to its error output.
185
+ * @example
186
+ * ```ts
187
+ * import { GitStoppedException } from "@noldova/checkpoints/runtime";
188
+ *
189
+ * export const failure: GitStoppedException = new GitStoppedException("cat-file", "");
190
+ * ```
191
+ */
192
+ public constructor(command: string, errors: string);
193
+ }
194
+
195
+ /**
196
+ * The cause of the `ModuleActivationException` activation rejects with when the Git build for the running system,
197
+ * `@noldova/checkpoints.git.<platform>-<arch>`, isn't installed.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * import { GitMissingException } from "@noldova/checkpoints/runtime";
202
+ *
203
+ * const exception = new GitMissingException("@noldova/checkpoints.git.linux-x64", new Error("Cannot find package"));
204
+ * console.log(exception.message, exception.packageName, exception.cause);
205
+ * ```
206
+ */
207
+ export declare class GitMissingException extends CheckpointsException {
208
+ /**
209
+ * The name of the missing package.
210
+ */
211
+ public readonly packageName: string;
212
+
213
+ /**
214
+ * Formats the exception's message from its facts.
215
+ *
216
+ * @param packageName The name of the missing package.
217
+ * @param cause The failure that showed it missing.
218
+ * @example
219
+ * ```ts
220
+ * import { GitMissingException } from "@noldova/checkpoints/runtime";
221
+ *
222
+ * export const failure: GitMissingException = new GitMissingException("@noldova/checkpoints.git.linux-x64", new Error("Cannot find package"));
223
+ * ```
224
+ */
225
+ public constructor(packageName: string, cause: Error);
226
+ }
227
+
228
+ /**
229
+ * The cause of the `ModuleActivationException` activation rejects with when the installed Git build's manifest isn't JSON, can't
230
+ * be read, or doesn't name the build's program, exec path and path as text.
231
+ *
232
+ * @example
233
+ * ```ts
234
+ * import { GitManifestInvalidException } from "@noldova/checkpoints/runtime";
235
+ *
236
+ * const exception = new GitManifestInvalidException("/app/git/package.json", new Error("GitPackage has no field path."));
237
+ * console.log(exception.message, exception.manifestFile, exception.cause);
238
+ * ```
239
+ */
240
+ export declare class GitManifestInvalidException extends CheckpointsException {
241
+ /**
242
+ * The manifest's path, or, for a manifest Node refused while it looked for the build, the manifest as the module asked Node for
243
+ * it, `@noldova/checkpoints.git.<platform>-<arch>/package.json`.
244
+ */
245
+ public readonly manifestFile: string;
246
+
247
+ /**
248
+ * Formats the exception's message from its facts and the cause's message.
249
+ *
250
+ * @param manifestFile The manifest's path, or the manifest as the module asked Node for it.
251
+ * @param cause Why the manifest can't be read.
252
+ * @example
253
+ * ```ts
254
+ * import { GitManifestInvalidException } from "@noldova/checkpoints/runtime";
255
+ *
256
+ * export const failure: GitManifestInvalidException = new GitManifestInvalidException("/app/git/package.json", new Error("GitPackage has no field path."));
257
+ * ```
258
+ */
259
+ public constructor(manifestFile: string, cause: Error);
260
+ }
261
+
262
+ /**
263
+ * Thrown when a folder's store holds a file the module can't read, or one of a format version it doesn't know. Its subclasses:
264
+ * {@link CheckpointFileMissingException}, {@link IgnoreRulesMismatchException}, {@link JournalFieldMissingException}, {@link ScriptStepMissingException}, {@link StoreAnswersMismatchException}, {@link StoreFieldNotABooleanException}, {@link StoreFieldNotAStringListException}, {@link StoreFileUnreadableException}, {@link StoreObjectMissingException}, {@link StoreObjectNotABlobException}, {@link TreeLineMalformedException}, {@link UnexpectedStoreObjectException}, {@link UnknownEntryKindException}, {@link UnknownGitModeException}, {@link UnknownJournalRecordException}, {@link UnknownLinkKindException}, {@link UnsupportedStoreFormatException}.
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * import { StoreException, UnknownEntryKindException } from "@noldova/checkpoints/runtime";
269
+ *
270
+ * console.log(new UnknownEntryKindException("Socket") instanceof StoreException);
271
+ * ```
272
+ */
273
+ export declare abstract class StoreException extends CheckpointsException {
274
+ /**
275
+ * Initializes the message and the cause for a subclass.
276
+ *
277
+ * @param message The exception's message.
278
+ * @param options The failure that caused it, if any.
279
+ * @example
280
+ * ```ts
281
+ * import { StoreException } from "@noldova/checkpoints/runtime";
282
+ *
283
+ * export class ProbeStoreException extends StoreException {
284
+ * public constructor() {
285
+ * super("The probe's store file can't be read.");
286
+ * }
287
+ * }
288
+ * ```
289
+ */
290
+ protected constructor(message: string, options?: ExceptionOptions);
291
+ }
292
+
293
+ /**
294
+ * Thrown when a checkpoint's commit in the store holds no checkpoint.json.
295
+ *
296
+ * @example
297
+ * ```ts
298
+ * import { CheckpointFileMissingException } from "@noldova/checkpoints/runtime";
299
+ *
300
+ * const exception = new CheckpointFileMissingException("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
301
+ * console.log(exception.message, exception.commit);
302
+ * ```
303
+ */
304
+ export declare class CheckpointFileMissingException extends StoreException {
305
+ /**
306
+ * The checkpoint's commit.
307
+ */
308
+ public readonly commit: string;
309
+
310
+ /**
311
+ * Formats the exception's message from its facts.
312
+ *
313
+ * @param commit The checkpoint's commit.
314
+ * @example
315
+ * ```ts
316
+ * import { CheckpointFileMissingException } from "@noldova/checkpoints/runtime";
317
+ *
318
+ * export const failure: CheckpointFileMissingException = new CheckpointFileMissingException("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
319
+ * ```
320
+ */
321
+ public constructor(commit: string);
322
+ }
323
+
324
+ /**
325
+ * Thrown when a checkpoint.json holds ignore rules though its checkpoint didn't follow the ignore files, or none though it did.
326
+ *
327
+ * @example
328
+ * ```ts
329
+ * import { CaptureMode } from "@noldova/checkpoints.protocol";
330
+ * import { IgnoreRulesMismatchException } from "@noldova/checkpoints/runtime";
331
+ *
332
+ * const exception = new IgnoreRulesMismatchException(CaptureMode.EveryFile);
333
+ * console.log(exception.message, exception.mode);
334
+ * ```
335
+ */
336
+ export declare class IgnoreRulesMismatchException extends StoreException {
337
+ /**
338
+ * The checkpoint's mode.
339
+ */
340
+ public readonly mode: CaptureMode;
341
+
342
+ /**
343
+ * Formats the exception's message from its facts.
344
+ *
345
+ * @param mode The checkpoint's mode.
346
+ * @example
347
+ * ```ts
348
+ * import { CaptureMode } from "@noldova/checkpoints.protocol";
349
+ * import { IgnoreRulesMismatchException } from "@noldova/checkpoints/runtime";
350
+ *
351
+ * export const failure: IgnoreRulesMismatchException = new IgnoreRulesMismatchException(CaptureMode.EveryFile);
352
+ * ```
353
+ */
354
+ public constructor(mode: CaptureMode);
355
+ }
356
+
357
+ /**
358
+ * Thrown when a record of a restore's journal, or a step of its script, lacks a field its type needs.
359
+ *
360
+ * @example
361
+ * ```ts
362
+ * import { JournalFieldMissingException } from "@noldova/checkpoints/runtime";
363
+ *
364
+ * const exception = new JournalFieldMissingException("JournalRecord", "path");
365
+ * console.log(exception.message, exception.field, exception.model);
366
+ * ```
367
+ */
368
+ export declare class JournalFieldMissingException extends StoreException {
369
+ /**
370
+ * The field it lacks.
371
+ */
372
+ public readonly field: string;
373
+
374
+ /**
375
+ * The record or the step, such as `"JournalRecord"`.
376
+ */
377
+ public readonly model: string;
378
+
379
+ /**
380
+ * Formats the exception's message from its facts.
381
+ *
382
+ * @param model The record or the step.
383
+ * @param field The field it lacks.
384
+ * @example
385
+ * ```ts
386
+ * import { JournalFieldMissingException } from "@noldova/checkpoints/runtime";
387
+ *
388
+ * export const failure: JournalFieldMissingException = new JournalFieldMissingException("JournalRecord", "path");
389
+ * ```
390
+ */
391
+ public constructor(model: string, field: string);
392
+ }
393
+
394
+ /**
395
+ * Thrown when a record of a restore's journal names a step its script doesn't hold.
396
+ *
397
+ * @example
398
+ * ```ts
399
+ * import { ScriptStepMissingException } from "@noldova/checkpoints/runtime";
400
+ *
401
+ * const exception = new ScriptStepMissingException(3);
402
+ * console.log(exception.message, exception.step);
403
+ * ```
404
+ */
405
+ export declare class ScriptStepMissingException extends StoreException {
406
+ /**
407
+ * The step's index.
408
+ */
409
+ public readonly step: number;
410
+
411
+ /**
412
+ * Formats the exception's message from its facts.
413
+ *
414
+ * @param step The step's index.
415
+ * @example
416
+ * ```ts
417
+ * import { ScriptStepMissingException } from "@noldova/checkpoints/runtime";
418
+ *
419
+ * export const failure: ScriptStepMissingException = new ScriptStepMissingException(3);
420
+ * ```
421
+ */
422
+ public constructor(step: number);
423
+ }
424
+
425
+ /**
426
+ * Thrown when the store gives more or fewer answers than the names the module asked it to read, so no answer can be matched to
427
+ * its name; a compare, a read, a preview or a restore rejects with it.
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * import { StoreAnswersMismatchException } from "@noldova/checkpoints/runtime";
432
+ *
433
+ * const exception = new StoreAnswersMismatchException(2, 1);
434
+ * console.log(exception.message, exception.asked, exception.answered);
435
+ * ```
436
+ */
437
+ export declare class StoreAnswersMismatchException extends StoreException {
438
+ /**
439
+ * How many answers the store gave.
440
+ */
441
+ public readonly answered: number;
442
+
443
+ /**
444
+ * How many names the module asked the store to read.
445
+ */
446
+ public readonly asked: number;
447
+
448
+ /**
449
+ * Formats the exception's message from its facts.
450
+ *
451
+ * @param asked How many names the module asked the store to read.
452
+ * @param answered How many answers the store gave.
453
+ * @example
454
+ * ```ts
455
+ * import { StoreAnswersMismatchException } from "@noldova/checkpoints/runtime";
456
+ *
457
+ * export const failure: StoreAnswersMismatchException = new StoreAnswersMismatchException(2, 1);
458
+ * ```
459
+ */
460
+ public constructor(asked: number, answered: number);
461
+ }
462
+
463
+ /**
464
+ * Thrown when a field of a store file holds something other than true or false.
465
+ *
466
+ * @example
467
+ * ```ts
468
+ * import { StoreFieldNotABooleanException } from "@noldova/checkpoints/runtime";
469
+ *
470
+ * const exception = new StoreFieldNotABooleanException("ignoresCase");
471
+ * console.log(exception.message, exception.field);
472
+ * ```
473
+ */
474
+ export declare class StoreFieldNotABooleanException extends StoreException {
475
+ /**
476
+ * The field.
477
+ */
478
+ public readonly field: string;
479
+
480
+ /**
481
+ * Formats the exception's message from its facts.
482
+ *
483
+ * @param field The field.
484
+ * @example
485
+ * ```ts
486
+ * import { StoreFieldNotABooleanException } from "@noldova/checkpoints/runtime";
487
+ *
488
+ * export const failure: StoreFieldNotABooleanException = new StoreFieldNotABooleanException("ignoresCase");
489
+ * ```
490
+ */
491
+ public constructor(field: string);
492
+ }
493
+
494
+ /**
495
+ * Thrown when a field of a store file holds something other than text.
496
+ *
497
+ * @example
498
+ * ```ts
499
+ * import { StoreFieldNotAStringListException } from "@noldova/checkpoints/runtime";
500
+ *
501
+ * const exception = new StoreFieldNotAStringListException("emptyFolders");
502
+ * console.log(exception.message, exception.field);
503
+ * ```
504
+ */
505
+ export declare class StoreFieldNotAStringListException extends StoreException {
506
+ /**
507
+ * The field.
508
+ */
509
+ public readonly field: string;
510
+
511
+ /**
512
+ * Formats the exception's message from its facts.
513
+ *
514
+ * @param field The field.
515
+ * @example
516
+ * ```ts
517
+ * import { StoreFieldNotAStringListException } from "@noldova/checkpoints/runtime";
518
+ *
519
+ * export const failure: StoreFieldNotAStringListException = new StoreFieldNotAStringListException("emptyFolders");
520
+ * ```
521
+ */
522
+ public constructor(field: string);
523
+ }
524
+
525
+ /**
526
+ * Thrown when one of the store's files isn't JSON, or isn't one the module wrote; the cause says why.
527
+ *
528
+ * @example
529
+ * ```ts
530
+ * import { StoreFileUnreadableException } from "@noldova/checkpoints/runtime";
531
+ *
532
+ * const exception = new StoreFileUnreadableException("index", new SyntaxError("Unexpected end of JSON input"));
533
+ * console.log(exception.message, exception.file);
534
+ * ```
535
+ */
536
+ export declare class StoreFileUnreadableException extends StoreException {
537
+ /**
538
+ * The file's name, such as `"index"`.
539
+ */
540
+ public readonly file: string;
541
+
542
+ /**
543
+ * Formats the exception's message from its facts.
544
+ *
545
+ * @param file The file's name.
546
+ * @param cause Why it can't be read.
547
+ * @example
548
+ * ```ts
549
+ * import { StoreFileUnreadableException } from "@noldova/checkpoints/runtime";
550
+ *
551
+ * export const failure: StoreFileUnreadableException = new StoreFileUnreadableException("index", new SyntaxError("Unexpected end of JSON input"));
552
+ * ```
553
+ */
554
+ public constructor(file: string, cause: Error);
555
+ }
556
+
557
+ /**
558
+ * Thrown when the store lacks the content of a file a restore stages, or of an ignore file a checkpoint followed, which a compare, a preview or a restore of that checkpoint reads.
559
+ *
560
+ * @example
561
+ * ```ts
562
+ * import { StoreObjectMissingException } from "@noldova/checkpoints/runtime";
563
+ *
564
+ * const exception = new StoreObjectMissingException("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
565
+ * console.log(exception.message, exception.objectId);
566
+ * ```
567
+ */
568
+ export declare class StoreObjectMissingException extends StoreException {
569
+ /**
570
+ * The content's object id.
571
+ */
572
+ public readonly objectId: string;
573
+
574
+ /**
575
+ * Formats the exception's message from its facts.
576
+ *
577
+ * @param objectId The content's object id.
578
+ * @example
579
+ * ```ts
580
+ * import { StoreObjectMissingException } from "@noldova/checkpoints/runtime";
581
+ *
582
+ * export const failure: StoreObjectMissingException = new StoreObjectMissingException("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
583
+ * ```
584
+ */
585
+ public constructor(objectId: string);
586
+ }
587
+
588
+ /**
589
+ * Thrown when the store gives what a restore stages, or an ignore file a checkpoint followed, as something other than a file's content, such as a tree.
590
+ *
591
+ * @example
592
+ * ```ts
593
+ * import { StoreObjectNotABlobException } from "@noldova/checkpoints/runtime";
594
+ *
595
+ * const exception = new StoreObjectNotABlobException("4b825dc642cb6eb9a060e54bf8d69288fbee4904", "4b825dc642cb6eb9a060e54bf8d69288fbee4904 tree 0");
596
+ * console.log(exception.message, exception.objectId, exception.header);
597
+ * ```
598
+ */
599
+ export declare class StoreObjectNotABlobException extends StoreException {
600
+ /**
601
+ * The header the store gave the object, such as `"<id> tree 0"`.
602
+ */
603
+ public readonly header: string;
604
+
605
+ /**
606
+ * The object id the restore asked for.
607
+ */
608
+ public readonly objectId: string;
609
+
610
+ /**
611
+ * Formats the exception's message from its facts.
612
+ *
613
+ * @param objectId The object id the restore asked for.
614
+ * @param header The header the store gave the object.
615
+ * @example
616
+ * ```ts
617
+ * import { StoreObjectNotABlobException } from "@noldova/checkpoints/runtime";
618
+ *
619
+ * export const failure: StoreObjectNotABlobException = new StoreObjectNotABlobException("4b825dc642cb6eb9a060e54bf8d69288fbee4904", "4b825dc642cb6eb9a060e54bf8d69288fbee4904 tree 0");
620
+ * ```
621
+ */
622
+ public constructor(objectId: string, header: string);
623
+ }
624
+
625
+ /**
626
+ * Thrown when the store lists a line of a checkpoint's tree, as `diff-tree` gives it, without the line's mode or object id; a
627
+ * compare, a read, a preview or a restore of that checkpoint rejects with it.
628
+ *
629
+ * @example
630
+ * ```ts
631
+ * import { TreeLineMalformedException } from "@noldova/checkpoints/runtime";
632
+ *
633
+ * const exception = new TreeLineMalformedException(":000000 100644");
634
+ * console.log(exception.message, exception.line);
635
+ * ```
636
+ */
637
+ export declare class TreeLineMalformedException extends StoreException {
638
+ /**
639
+ * The line as the store listed it.
640
+ */
641
+ public readonly line: string;
642
+
643
+ /**
644
+ * Formats the exception's message from its facts.
645
+ *
646
+ * @param line The line as the store listed it.
647
+ * @example
648
+ * ```ts
649
+ * import { TreeLineMalformedException } from "@noldova/checkpoints/runtime";
650
+ *
651
+ * export const failure: TreeLineMalformedException = new TreeLineMalformedException(":000000 100644");
652
+ * ```
653
+ */
654
+ public constructor(line: string);
655
+ }
656
+
657
+ /**
658
+ * Thrown when the store gives a file's content that no staged file asked for.
659
+ *
660
+ * @example
661
+ * ```ts
662
+ * import { UnexpectedStoreObjectException } from "@noldova/checkpoints/runtime";
663
+ *
664
+ * const exception = new UnexpectedStoreObjectException("4b825dc642cb6eb9a060e54bf8d69288fbee4904 blob 5");
665
+ * console.log(exception.message, exception.header);
666
+ * ```
667
+ */
668
+ export declare class UnexpectedStoreObjectException extends StoreException {
669
+ /**
670
+ * The header the store gave the content.
671
+ */
672
+ public readonly header: string;
673
+
674
+ /**
675
+ * Formats the exception's message from its facts.
676
+ *
677
+ * @param header The header the store gave the content.
678
+ * @example
679
+ * ```ts
680
+ * import { UnexpectedStoreObjectException } from "@noldova/checkpoints/runtime";
681
+ *
682
+ * export const failure: UnexpectedStoreObjectException = new UnexpectedStoreObjectException("4b825dc642cb6eb9a060e54bf8d69288fbee4904 blob 5");
683
+ * ```
684
+ */
685
+ public constructor(header: string);
686
+ }
687
+
688
+ /**
689
+ * Thrown when a store file names a kind of entry the module doesn't know.
690
+ *
691
+ * @example
692
+ * ```ts
693
+ * import { UnknownEntryKindException } from "@noldova/checkpoints/runtime";
694
+ *
695
+ * const exception = new UnknownEntryKindException("Socket");
696
+ * console.log(exception.message, exception.value);
697
+ * ```
698
+ */
699
+ export declare class UnknownEntryKindException extends StoreException {
700
+ /**
701
+ * The kind it names.
702
+ */
703
+ public readonly value: string;
704
+
705
+ /**
706
+ * Formats the exception's message from its facts.
707
+ *
708
+ * @param value The kind it names.
709
+ * @example
710
+ * ```ts
711
+ * import { UnknownEntryKindException } from "@noldova/checkpoints/runtime";
712
+ *
713
+ * export const failure: UnknownEntryKindException = new UnknownEntryKindException("Socket");
714
+ * ```
715
+ */
716
+ public constructor(value: string);
717
+ }
718
+
719
+ /**
720
+ * Thrown when a checkpoint's tree gives a path a mode the module doesn't write.
721
+ *
722
+ * @example
723
+ * ```ts
724
+ * import { UnknownGitModeException } from "@noldova/checkpoints/runtime";
725
+ *
726
+ * const exception = new UnknownGitModeException("160000");
727
+ * console.log(exception.message, exception.mode);
728
+ * ```
729
+ */
730
+ export declare class UnknownGitModeException extends StoreException {
731
+ /**
732
+ * The mode, such as `"160000"`.
733
+ */
734
+ public readonly mode: string;
735
+
736
+ /**
737
+ * Formats the exception's message from its facts.
738
+ *
739
+ * @param mode The mode.
740
+ * @example
741
+ * ```ts
742
+ * import { UnknownGitModeException } from "@noldova/checkpoints/runtime";
743
+ *
744
+ * export const failure: UnknownGitModeException = new UnknownGitModeException("160000");
745
+ * ```
746
+ */
747
+ public constructor(mode: string);
748
+ }
749
+
750
+ /**
751
+ * Thrown when a restore's journal holds a record of a type the module doesn't know.
752
+ *
753
+ * @example
754
+ * ```ts
755
+ * import { UnknownJournalRecordException } from "@noldova/checkpoints/runtime";
756
+ *
757
+ * const exception = new UnknownJournalRecordException("Paused");
758
+ * console.log(exception.message, exception.type);
759
+ * ```
760
+ */
761
+ export declare class UnknownJournalRecordException extends StoreException {
762
+ /**
763
+ * The record's type.
764
+ */
765
+ public readonly type: string;
766
+
767
+ /**
768
+ * Formats the exception's message from its facts.
769
+ *
770
+ * @param type The record's type.
771
+ * @example
772
+ * ```ts
773
+ * import { UnknownJournalRecordException } from "@noldova/checkpoints/runtime";
774
+ *
775
+ * export const failure: UnknownJournalRecordException = new UnknownJournalRecordException("Paused");
776
+ * ```
777
+ */
778
+ public constructor(type: string);
779
+ }
780
+
781
+ /**
782
+ * Thrown when a store file names a kind of link the module doesn't know.
783
+ *
784
+ * @example
785
+ * ```ts
786
+ * import { UnknownLinkKindException } from "@noldova/checkpoints/runtime";
787
+ *
788
+ * const exception = new UnknownLinkKindException("Junction");
789
+ * console.log(exception.message, exception.value);
790
+ * ```
791
+ */
792
+ export declare class UnknownLinkKindException extends StoreException {
793
+ /**
794
+ * The kind it names.
795
+ */
796
+ public readonly value: string;
797
+
798
+ /**
799
+ * Formats the exception's message from its facts.
800
+ *
801
+ * @param value The kind it names.
802
+ * @example
803
+ * ```ts
804
+ * import { UnknownLinkKindException } from "@noldova/checkpoints/runtime";
805
+ *
806
+ * export const failure: UnknownLinkKindException = new UnknownLinkKindException("Junction");
807
+ * ```
808
+ */
809
+ public constructor(value: string);
810
+ }
811
+
812
+ /**
813
+ * Thrown when a store file has a format version this version of the module doesn't read.
814
+ *
815
+ * @example
816
+ * ```ts
817
+ * import { UnsupportedStoreFormatException } from "@noldova/checkpoints/runtime";
818
+ *
819
+ * const exception = new UnsupportedStoreFormatException("2");
820
+ * console.log(exception.message, exception.version);
821
+ * ```
822
+ */
823
+ export declare class UnsupportedStoreFormatException extends StoreException {
824
+ /**
825
+ * The format version, as the file writes it.
826
+ */
827
+ public readonly version: string;
828
+
829
+ /**
830
+ * Formats the exception's message from its facts.
831
+ *
832
+ * @param version The format version.
833
+ * @example
834
+ * ```ts
835
+ * import { UnsupportedStoreFormatException } from "@noldova/checkpoints/runtime";
836
+ *
837
+ * export const failure: UnsupportedStoreFormatException = new UnsupportedStoreFormatException("2");
838
+ * ```
839
+ */
840
+ public constructor(version: string);
841
+ }
842
+
843
+ /**
844
+ * The checkpoints service, which the runtime part publishes as `checkpoints.service` for other runtime parts, and with which it
845
+ * answers the `checkpoints.*` methods. Each folder's operations run one at a time; a request that arrives during one waits for it.
846
+ * Each first finishes or undoes any restore of the folder that was interrupted; while that can't finish, the folder's captures and
847
+ * restores are refused with the outcome `HeldUp`.
848
+ *
849
+ * Each call takes an optional signal, such as its request's. A call whose signal aborts while it waits never runs; one that runs
850
+ * stops before its next file or Git command, ends the Git commands it started, and rejects with the signal's reason once they have
851
+ * exited, and the folder's next call runs. A capture so stopped leaves no checkpoint and the folder's index as it was. A restore
852
+ * stops so only until it starts writing its journal; from then on it runs to its end. The recovery of an interrupted restore that a
853
+ * call starts with always runs to its end.
854
+ *
855
+ * It is abstract: the runtime part publishes the module's own instance, and a module gets it with `getService`, which takes the class.
856
+ *
857
+ * @example
858
+ * ```ts
859
+ * import { CaptureRequest, FolderReference } from "@noldova/checkpoints.protocol";
860
+ * import { CheckpointsService } from "@noldova/checkpoints/runtime";
861
+ * import type { IRuntimePartContext } from "@noldova/desktop.runtime";
862
+ *
863
+ * export async function captureAsync(context: IRuntimePartContext): Promise<void> {
864
+ * const checkpoints = context.getService("checkpoints.service", CheckpointsService);
865
+ * const result = await checkpoints.captureAsync(new CaptureRequest(new FolderReference("project-1", "/work/project"), "Turn 3"));
866
+ * console.log(result.outcome.value);
867
+ * }
868
+ * ```
869
+ */
870
+ export declare abstract class CheckpointsService {
871
+ /**
872
+ * Takes a checkpoint of a folder: every file, link and folder in it but each `.git`, or, while the setting
873
+ * `checkpoints.followIgnoreFiles` is on, only those its `.gitignore` files don't ignore, matched as Git matches them. The
874
+ * checkpoint's `mode` says which. It needs, on the store's volume, 2 GiB free beyond the size of the new and changed files it
875
+ * adds, before it streams and while it does; one without the space takes no checkpoint, posts the folder's
876
+ * `checkpoints.lowDiskSpace` notification and raises `checkpoints.capturePaused`, and the folder's next capture that is taken
877
+ * dismisses the notification and raises `checkpoints.captureResumed`.
878
+ *
879
+ * @param request The folder and the label to attach.
880
+ * @param signal Stops the call; none by default.
881
+ * @returns The checkpoint taken; or the outcome `LowDiskSpace`, with the space free and the space needed in bytes, `FolderMissing`
882
+ * when the folder's path is missing, or `HeldUp` while an interrupted restore of the folder can't finish.
883
+ * @throws {GitException} When a Git command fails; no checkpoint is left.
884
+ * @throws {StoreException} When the folder's store holds a file the module can't read.
885
+ * @throws {Error} When the system refuses the module a step of its own, such as reading the folder itself (EACCES), writing its
886
+ * store (ENOSPC) or finishing an interrupted restore of the folder; a path the capture can't read is listed in the checkpoint instead.
887
+ * @example
888
+ * ```ts
889
+ * import { CaptureRequest, FolderReference } from "@noldova/checkpoints.protocol";
890
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
891
+ *
892
+ * export async function captureAsync(checkpoints: CheckpointsService, signal: AbortSignal): Promise<string | null> {
893
+ * const result = await checkpoints.captureAsync(new CaptureRequest(new FolderReference("project-1", "/work/project"), "Turn 3"), signal);
894
+ * return result.checkpoint?.id ?? null;
895
+ * }
896
+ * ```
897
+ */
898
+ public abstract captureAsync(request: CaptureRequest, signal?: AbortSignal): Promise<CaptureResult>;
899
+
900
+ /**
901
+ * Compares one of a folder's checkpoints with another, or with the folder now, which it walks in the checkpoint's own mode. A path
902
+ * either side's rules ignore is on neither side, a `.git` never is, and a path the module couldn't read on either side is
903
+ * `Unknown`, never `Deleted`. It writes nothing.
904
+ *
905
+ * @param request The folder, the checkpoint the changes start from, and the one they lead to, or `null` for the folder now.
906
+ * @param signal Stops the call; none by default.
907
+ * @returns The changes, in the byte order of their paths; or the outcome `CheckpointMissing` when either checkpoint is missing,
908
+ * or `FolderMissing` when the folder now is asked for and its path is missing.
909
+ * @throws {GitException} When a Git command fails.
910
+ * @throws {StoreException} When the folder's store holds a checkpoint the module can't read.
911
+ * @throws {Error} When the system refuses the module a step of its own, such as reading its store, finishing an interrupted restore of the folder, or,
912
+ * for the folder now, reading the folder itself (EACCES).
913
+ * @example
914
+ * ```ts
915
+ * import { CompareRequest, FolderReference } from "@noldova/checkpoints.protocol";
916
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
917
+ *
918
+ * export async function changedPathsAsync(checkpoints: CheckpointsService, from: string): Promise<readonly string[]> {
919
+ * const result = await checkpoints.compareAsync(new CompareRequest(new FolderReference("project-1", "/work/project"), from, null));
920
+ * return result.changes.map(t => t.path);
921
+ * }
922
+ * ```
923
+ */
924
+ public abstract compareAsync(request: CompareRequest, signal?: AbortSignal): Promise<CompareResult>;
925
+
926
+ /**
927
+ * Deletes all of a folder's checkpoints by removing its store whole, after the folder's earlier calls; a housekeeping pass running
928
+ * on the store is stopped first. It first finishes or undoes a restore of the folder that was interrupted, and while that can't
929
+ * finish it deletes nothing, since the restore's journal is what puts the folder's files right. A crash mid-delete never leaves a
930
+ * half store: the store is moved aside whole before it is removed, once a `storageAsync` reading it has, and what a crash leaves
931
+ * there is removed when the module next starts. The folder's next capture starts a new store. The module stopping stops the call as
932
+ * its signal would, and waits for it.
933
+ *
934
+ * @param request The folder.
935
+ * @param signal Stops the call until the store is moved aside; none by default.
936
+ * @returns The outcome `Deleted`, also for a folder that has no checkpoints, or `HeldUp` while an interrupted restore of the folder
937
+ * can't finish.
938
+ * @throws {Error} When the system refuses to move the store aside, after trying for about 5 s while it holds a file; the store is
939
+ * left whole.
940
+ * @example
941
+ * ```ts
942
+ * import { DeleteFolderRequest, FolderReference } from "@noldova/checkpoints.protocol";
943
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
944
+ *
945
+ * export async function forgetAsync(checkpoints: CheckpointsService): Promise<string> {
946
+ * const result = await checkpoints.deleteFolderAsync(new DeleteFolderRequest(new FolderReference("project-1", "/work/project")));
947
+ * return result.outcome.value;
948
+ * }
949
+ * ```
950
+ */
951
+ public abstract deleteFolderAsync(request: DeleteFolderRequest, signal?: AbortSignal): Promise<DeleteFolderResult>;
952
+
953
+ /**
954
+ * Lists a folder's checkpoints.
955
+ *
956
+ * @param request The folder.
957
+ * @param signal Stops the call; none by default.
958
+ * @returns The folder's checkpoints, newest first; none for a folder never captured.
959
+ * @throws {GitException} When a Git command fails.
960
+ * @throws {StoreException} When the folder's store holds a checkpoint the module can't read.
961
+ * @throws {Error} When the system refuses the module a step of its own, such as reading its store or finishing an interrupted restore of the folder.
962
+ * @example
963
+ * ```ts
964
+ * import { FolderReference, ListRequest } from "@noldova/checkpoints.protocol";
965
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
966
+ *
967
+ * export async function newestAsync(checkpoints: CheckpointsService): Promise<string | null> {
968
+ * const list = await checkpoints.listAsync(new ListRequest(new FolderReference("project-1", "/work/project")));
969
+ * return list.checkpoints[0]?.id ?? null;
970
+ * }
971
+ * ```
972
+ */
973
+ public abstract listAsync(request: ListRequest, signal?: AbortSignal): Promise<CheckpointList>;
974
+
975
+ /**
976
+ * Plans a restore of one of a folder's checkpoints over the folder now, which it walks in the checkpoint's own mode: each path the
977
+ * restore writes, replaces or deletes, with its side now and in the checkpoint, and each path that stays as it is, with its reason:
978
+ * a `.git` or another name for one, a folder that holds a `.git` at any depth or one above it, a path either side's rules ignore,
979
+ * one either side couldn't read, or a link this system won't let the module create. It writes nothing to the folder.
980
+ *
981
+ * @param request The folder and the checkpoint to restore.
982
+ * @param signal Stops the call; none by default.
983
+ * @returns The plan, with the state of the folder it was planned on; or the outcome `HeldUp` while a restore holds the folder,
984
+ * `CheckpointMissing` when the checkpoint is missing, or `FolderMissing` when the folder's path is missing.
985
+ * @throws {GitException} When a Git command fails.
986
+ * @throws {StoreException} When the folder's store holds a checkpoint the module can't read.
987
+ * @throws {Error} When the system refuses the module a step of its own, such as reading its store, finishing an interrupted restore of the folder or
988
+ * reading the folder itself (EACCES).
989
+ * @example
990
+ * ```ts
991
+ * import { FolderReference, PreviewRequest } from "@noldova/checkpoints.protocol";
992
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
993
+ *
994
+ * export async function stepCountAsync(checkpoints: CheckpointsService, checkpoint: string): Promise<number> {
995
+ * const result = await checkpoints.previewRestoreAsync(new PreviewRequest(new FolderReference("project-1", "/work/project"), checkpoint, ["src"]));
996
+ * return result.plan?.steps.length ?? 0;
997
+ * }
998
+ * ```
999
+ */
1000
+ public abstract previewRestoreAsync(request: PreviewRequest, signal?: AbortSignal): Promise<PreviewResult>;
1001
+
1002
+ /**
1003
+ * Reads one file of a checkpoint: its content, or its line diff to another checkpoint or to the folder now, cut at the request's
1004
+ * limit. A diff to the folder now writes the file's content there into the store as one object no checkpoint names; nothing else
1005
+ * is written.
1006
+ *
1007
+ * @param request The folder, the checkpoint, the path, what to diff against, if anything, and the most bytes to give.
1008
+ * @param signal Stops the call; none by default.
1009
+ * @returns The content or the diff, with its whole size, so a result shorter than its size is cut; or why there's none.
1010
+ * @throws {GitException} When a Git command fails.
1011
+ * @throws {StoreException} When the folder's store holds a checkpoint the module can't read.
1012
+ * @throws {Error} When the system refuses the module a step of its own, such as reading its store, finishing an interrupted restore of the folder, or,
1013
+ * for the folder now, reading the folder itself (EACCES).
1014
+ * @example
1015
+ * ```ts
1016
+ * import { DiffTarget, FolderReference, ReadRequest } from "@noldova/checkpoints.protocol";
1017
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
1018
+ *
1019
+ * export async function diffToNowAsync(checkpoints: CheckpointsService, checkpoint: string): Promise<Uint8Array> {
1020
+ * const request = new ReadRequest(new FolderReference("project-1", "/work/project"), checkpoint, "src/main.ts", new DiffTarget(null), 65536);
1021
+ * return (await checkpoints.readAsync(request)).content;
1022
+ * }
1023
+ * ```
1024
+ */
1025
+ public abstract readAsync(request: ReadRequest, signal?: AbortSignal): Promise<ReadResult>;
1026
+
1027
+ /**
1028
+ * Restores one of a folder's checkpoints by the plan its preview gave, whole or not at all. It plans again and refuses a plan the
1029
+ * folder has moved on from, then takes a checkpoint of the folder labelled `Before restore`, which undoes the restore. It stages
1030
+ * new content in a folder of its own at the folder's root, moves each file it replaces or deletes aside and compares it with that
1031
+ * checkpoint, so a file another program wrote is never lost; it never writes through a link, never changes a `.git`, and never
1032
+ * moves, renames or removes a folder that holds one. A restore that fails rolls back; one interrupted is finished or undone when the folder is next
1033
+ * opened. It raises `checkpoints.restored` when it finishes, and `checkpoints.restoreHeldUp` when its rollback can't.
1034
+ *
1035
+ * @param request The folder and the plan its preview gave.
1036
+ * @param signal Stops the call until the restore starts writing its journal; none by default.
1037
+ * @returns The outcome, with the checkpoint taken before the restore when it restored or rolled back, and, when it restored, the
1038
+ * checkpoint labelled `Recovered after restore` that keeps what another program changed in a file the restore had moved aside;
1039
+ * or `MovedOn` when the folder no longer matches the plan, `LowDiskSpace`, `CheckpointMissing`, `FolderMissing` or `HeldUp`.
1040
+ * @throws {GitException} When a Git command fails before the restore changes anything.
1041
+ * @throws {StoreException} When the folder's store holds a file the module can't read.
1042
+ * @throws {Error} When the system refuses the module a step of its own before the restore changes anything, such as reading the
1043
+ * folder itself (EACCES), writing its store (ENOSPC) or finishing an interrupted restore of the folder.
1044
+ * @example
1045
+ * ```ts
1046
+ * import { FolderReference, PreviewRequest, RestoreRequest } from "@noldova/checkpoints.protocol";
1047
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
1048
+ *
1049
+ * export async function restoreAsync(checkpoints: CheckpointsService, checkpoint: string): Promise<string> {
1050
+ * const folder = new FolderReference("project-1", "/work/project");
1051
+ * const preview = await checkpoints.previewRestoreAsync(new PreviewRequest(folder, checkpoint, null));
1052
+ * if (preview.plan === null)
1053
+ * return preview.outcome.value;
1054
+ * return (await checkpoints.restoreAsync(new RestoreRequest(folder, preview.plan))).outcome.value;
1055
+ * }
1056
+ * ```
1057
+ */
1058
+ public abstract restoreAsync(request: RestoreRequest, signal?: AbortSignal): Promise<RestoreResult>;
1059
+
1060
+ /**
1061
+ * Lists every folder's space used: the sum of the sizes of its store's files, and the path the folder had at its last capture. It
1062
+ * reads outside the folders' calls, so it never waits for one; a capture or a housekeeping pass running meanwhile may change the
1063
+ * sizes at once. A folder whose store a delete is moving aside is left out, and a delete waits for a call reading it. Space a delete
1064
+ * couldn't free yet isn't listed.
1065
+ *
1066
+ * @param signal Stops the call; none by default.
1067
+ * @returns The folders, the largest first; none when no folder was ever captured.
1068
+ * @throws {Error} When the system refuses to list the module's stores, or a store's files, other than one that is gone.
1069
+ * @example
1070
+ * ```ts
1071
+ * import type { CheckpointsService } from "@noldova/checkpoints/runtime";
1072
+ *
1073
+ * export async function usedBytesAsync(checkpoints: CheckpointsService): Promise<number> {
1074
+ * const list = await checkpoints.storageAsync();
1075
+ * return list.folders.reduce((total, t) => total + t.bytes, 0);
1076
+ * }
1077
+ * ```
1078
+ */
1079
+ public abstract storageAsync(signal?: AbortSignal): Promise<StorageList>;
1080
+ }
1081
+
1082
+ /**
1083
+ * The module's runtime part, which Noldova Desktop loads from `@noldova/checkpoints/runtime`.
1084
+ *
1085
+ * @example
1086
+ * ```ts
1087
+ * import { RuntimePart } from "@noldova/checkpoints/runtime";
1088
+ * import type { IRuntimePart } from "@noldova/desktop.runtime";
1089
+ *
1090
+ * export const part: IRuntimePart = new RuntimePart();
1091
+ * ```
1092
+ */
1093
+ export declare class RuntimePart implements IRuntimePart {
1094
+ /**
1095
+ * Makes a part that holds nothing until it is activated.
1096
+ *
1097
+ * @example
1098
+ * ```ts
1099
+ * import { RuntimePart } from "@noldova/checkpoints/runtime";
1100
+ *
1101
+ * export const part: RuntimePart = new RuntimePart();
1102
+ * ```
1103
+ */
1104
+ public constructor();
1105
+
1106
+ /**
1107
+ * Finds the Git build for the running system, declares `checkpoints.restored`, `checkpoints.restoreHeldUp`,
1108
+ * `checkpoints.capturePaused` and `checkpoints.captureResumed`, publishes the checkpoints service, registers `checkpoints.capture`,
1109
+ * `checkpoints.list`, `checkpoints.compare`, `checkpoints.read`, `checkpoints.previewRestore`, `checkpoints.restore`,
1110
+ * `checkpoints.storage` and `checkpoints.deleteFolder`, then starts removing in the background what a delete left moved aside, and
1111
+ * starts the build's Git once with `--version` in the background, so the first capture doesn't wait for the system's check of a
1112
+ * newly written program. A failure to publish or register starts nothing in the background.
1113
+ *
1114
+ * @param context The part's context.
1115
+ * @returns A promise that resolves once the part is active.
1116
+ * @throws {ModuleActivationException} Rejects, before the part declares or registers anything, when the Git build for the running
1117
+ * system isn't installed, with a {@link GitMissingException} as its cause, or when its manifest can't be read, with a
1118
+ * {@link GitManifestInvalidException} as its cause; its message, which names no path, is what the person sees.
1119
+ * @example
1120
+ * ```ts
1121
+ * import { RuntimePart } from "@noldova/checkpoints/runtime";
1122
+ * import type { IRuntimePartContext } from "@noldova/desktop.runtime";
1123
+ *
1124
+ * export async function startAsync(context: IRuntimePartContext): Promise<RuntimePart> {
1125
+ * const part = new RuntimePart();
1126
+ * await part.activateAsync(context);
1127
+ * return part;
1128
+ * }
1129
+ * ```
1130
+ */
1131
+ public activateAsync(context: IRuntimePartContext): Promise<void>;
1132
+
1133
+ /**
1134
+ * Deactivates the part, once the service's requests, the stores' housekeeping, and the removal and Git's start begun at activation
1135
+ * have stopped: every request's signal aborts, so one still waiting never runs, one running stops at its next safe point, and one
1136
+ * that comes to the service later is refused, the removal stops before its next store, and Git's start is stopped; the service
1137
+ * keeps nothing else open between requests. A part never activated has nothing to stop.
1138
+ *
1139
+ * @returns A promise that resolves once everything the part started has stopped.
1140
+ * @example
1141
+ * ```ts
1142
+ * import type { RuntimePart } from "@noldova/checkpoints/runtime";
1143
+ *
1144
+ * export async function stopAsync(part: RuntimePart): Promise<void> {
1145
+ * await part.deactivateAsync();
1146
+ * }
1147
+ * ```
1148
+ */
1149
+ public deactivateAsync(): Promise<void>;
1150
+ }