@noldova/checkpoints.protocol 0.0.0-stage → 0.0.2

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 (204) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -2
  3. package/package.json +34 -4
  4. package/src/api/index.d.ts +4062 -0
  5. package/src/api/index.js +98 -0
  6. package/src/api/index.js.map +1 -0
  7. package/src/exceptions/capture-checkpoint-mismatch.exception.js +17 -0
  8. package/src/exceptions/capture-checkpoint-mismatch.exception.js.map +1 -0
  9. package/src/exceptions/capture-space-mismatch.exception.js +17 -0
  10. package/src/exceptions/capture-space-mismatch.exception.js.map +1 -0
  11. package/src/exceptions/change-sides-mismatch.exception.js +17 -0
  12. package/src/exceptions/change-sides-mismatch.exception.js.map +1 -0
  13. package/src/exceptions/compare-changes-mismatch.exception.js +17 -0
  14. package/src/exceptions/compare-changes-mismatch.exception.js.map +1 -0
  15. package/src/exceptions/content-too-long.exception.js +19 -0
  16. package/src/exceptions/content-too-long.exception.js.map +1 -0
  17. package/src/exceptions/field-not-a-boolean.exception.js +19 -0
  18. package/src/exceptions/field-not-a-boolean.exception.js.map +1 -0
  19. package/src/exceptions/field-not-a-list.exception.js +19 -0
  20. package/src/exceptions/field-not-a-list.exception.js.map +1 -0
  21. package/src/exceptions/field-not-a-number-or-null.exception.js +19 -0
  22. package/src/exceptions/field-not-a-number-or-null.exception.js.map +1 -0
  23. package/src/exceptions/field-not-a-number.exception.js +19 -0
  24. package/src/exceptions/field-not-a-number.exception.js.map +1 -0
  25. package/src/exceptions/field-not-a-string-list.exception.js +19 -0
  26. package/src/exceptions/field-not-a-string-list.exception.js.map +1 -0
  27. package/src/exceptions/field-not-a-string-or-null.exception.js +19 -0
  28. package/src/exceptions/field-not-a-string-or-null.exception.js.map +1 -0
  29. package/src/exceptions/field-not-a-string.exception.js +19 -0
  30. package/src/exceptions/field-not-a-string.exception.js.map +1 -0
  31. package/src/exceptions/invalid-base64.exception.js +15 -0
  32. package/src/exceptions/invalid-base64.exception.js.map +1 -0
  33. package/src/exceptions/invalid-checkpoint-id.exception.js +17 -0
  34. package/src/exceptions/invalid-checkpoint-id.exception.js.map +1 -0
  35. package/src/exceptions/invalid-date.exception.js +15 -0
  36. package/src/exceptions/invalid-date.exception.js.map +1 -0
  37. package/src/exceptions/invalid-folder-path.exception.js +17 -0
  38. package/src/exceptions/invalid-folder-path.exception.js.map +1 -0
  39. package/src/exceptions/invalid-identity.exception.js +17 -0
  40. package/src/exceptions/invalid-identity.exception.js.map +1 -0
  41. package/src/exceptions/invalid-plan-state.exception.js +17 -0
  42. package/src/exceptions/invalid-plan-state.exception.js.map +1 -0
  43. package/src/exceptions/invalid-read-limit.exception.js +17 -0
  44. package/src/exceptions/invalid-read-limit.exception.js.map +1 -0
  45. package/src/exceptions/invalid-relative-path.exception.js +18 -0
  46. package/src/exceptions/invalid-relative-path.exception.js.map +1 -0
  47. package/src/exceptions/invalid-size.exception.js +17 -0
  48. package/src/exceptions/invalid-size.exception.js.map +1 -0
  49. package/src/exceptions/invalid-time.exception.js +17 -0
  50. package/src/exceptions/invalid-time.exception.js.map +1 -0
  51. package/src/exceptions/label-too-long.exception.js +17 -0
  52. package/src/exceptions/label-too-long.exception.js.map +1 -0
  53. package/src/exceptions/missing-field.exception.js +19 -0
  54. package/src/exceptions/missing-field.exception.js.map +1 -0
  55. package/src/exceptions/not-an-object.exception.js +17 -0
  56. package/src/exceptions/not-an-object.exception.js.map +1 -0
  57. package/src/exceptions/preview-plan-mismatch.exception.js +17 -0
  58. package/src/exceptions/preview-plan-mismatch.exception.js.map +1 -0
  59. package/src/exceptions/protocol.exception.js +14 -0
  60. package/src/exceptions/protocol.exception.js.map +1 -0
  61. package/src/exceptions/read-cut-mismatch.exception.js +17 -0
  62. package/src/exceptions/read-cut-mismatch.exception.js.map +1 -0
  63. package/src/exceptions/read-outcome-mismatch.exception.js +17 -0
  64. package/src/exceptions/read-outcome-mismatch.exception.js.map +1 -0
  65. package/src/exceptions/restore-checkpoints-mismatch.exception.js +17 -0
  66. package/src/exceptions/restore-checkpoints-mismatch.exception.js.map +1 -0
  67. package/src/exceptions/side-size-mismatch.exception.js +17 -0
  68. package/src/exceptions/side-size-mismatch.exception.js.map +1 -0
  69. package/src/exceptions/step-sides-mismatch.exception.js +17 -0
  70. package/src/exceptions/step-sides-mismatch.exception.js.map +1 -0
  71. package/src/exceptions/unknown-capture-mode.exception.js +17 -0
  72. package/src/exceptions/unknown-capture-mode.exception.js.map +1 -0
  73. package/src/exceptions/unknown-capture-outcome.exception.js +17 -0
  74. package/src/exceptions/unknown-capture-outcome.exception.js.map +1 -0
  75. package/src/exceptions/unknown-change-status.exception.js +17 -0
  76. package/src/exceptions/unknown-change-status.exception.js.map +1 -0
  77. package/src/exceptions/unknown-compare-outcome.exception.js +17 -0
  78. package/src/exceptions/unknown-compare-outcome.exception.js.map +1 -0
  79. package/src/exceptions/unknown-delete-folder-outcome.exception.js +17 -0
  80. package/src/exceptions/unknown-delete-folder-outcome.exception.js.map +1 -0
  81. package/src/exceptions/unknown-field.exception.js +19 -0
  82. package/src/exceptions/unknown-field.exception.js.map +1 -0
  83. package/src/exceptions/unknown-keep-reason.exception.js +17 -0
  84. package/src/exceptions/unknown-keep-reason.exception.js.map +1 -0
  85. package/src/exceptions/unknown-path-kind.exception.js +17 -0
  86. package/src/exceptions/unknown-path-kind.exception.js.map +1 -0
  87. package/src/exceptions/unknown-preview-outcome.exception.js +17 -0
  88. package/src/exceptions/unknown-preview-outcome.exception.js.map +1 -0
  89. package/src/exceptions/unknown-read-outcome.exception.js +17 -0
  90. package/src/exceptions/unknown-read-outcome.exception.js.map +1 -0
  91. package/src/exceptions/unknown-restore-action.exception.js +17 -0
  92. package/src/exceptions/unknown-restore-action.exception.js.map +1 -0
  93. package/src/exceptions/unknown-restore-outcome.exception.js +17 -0
  94. package/src/exceptions/unknown-restore-outcome.exception.js.map +1 -0
  95. package/src/exceptions/unknown-unread-reason.exception.js +17 -0
  96. package/src/exceptions/unknown-unread-reason.exception.js.map +1 -0
  97. package/src/exceptions/unread-code-mismatch.exception.js +17 -0
  98. package/src/exceptions/unread-code-mismatch.exception.js.map +1 -0
  99. package/src/exceptions/unread-reason-mismatch.exception.js +17 -0
  100. package/src/exceptions/unread-reason-mismatch.exception.js.map +1 -0
  101. package/src/models/capture-mode.js +27 -0
  102. package/src/models/capture-mode.js.map +1 -0
  103. package/src/models/capture-outcome.js +31 -0
  104. package/src/models/capture-outcome.js.map +1 -0
  105. package/src/models/capture-paused-event.js +35 -0
  106. package/src/models/capture-paused-event.js.map +1 -0
  107. package/src/models/capture-request.js +32 -0
  108. package/src/models/capture-request.js.map +1 -0
  109. package/src/models/capture-result.js +50 -0
  110. package/src/models/capture-result.js.map +1 -0
  111. package/src/models/capture-resumed-event.js +28 -0
  112. package/src/models/capture-resumed-event.js.map +1 -0
  113. package/src/models/change-side.js +36 -0
  114. package/src/models/change-side.js.map +1 -0
  115. package/src/models/change-status.js +32 -0
  116. package/src/models/change-status.js.map +1 -0
  117. package/src/models/change.js +57 -0
  118. package/src/models/change.js.map +1 -0
  119. package/src/models/checkpoint-list.js +26 -0
  120. package/src/models/checkpoint-list.js.map +1 -0
  121. package/src/models/checkpoint.js +55 -0
  122. package/src/models/checkpoint.js.map +1 -0
  123. package/src/models/compare-outcome.js +30 -0
  124. package/src/models/compare-outcome.js.map +1 -0
  125. package/src/models/compare-request.js +35 -0
  126. package/src/models/compare-request.js.map +1 -0
  127. package/src/models/compare-result.js +32 -0
  128. package/src/models/compare-result.js.map +1 -0
  129. package/src/models/delete-folder-outcome.js +27 -0
  130. package/src/models/delete-folder-outcome.js.map +1 -0
  131. package/src/models/delete-folder-request.js +27 -0
  132. package/src/models/delete-folder-request.js.map +1 -0
  133. package/src/models/delete-folder-result.js +26 -0
  134. package/src/models/delete-folder-result.js.map +1 -0
  135. package/src/models/diff-target.js +28 -0
  136. package/src/models/diff-target.js.map +1 -0
  137. package/src/models/folder-reference.js +32 -0
  138. package/src/models/folder-reference.js.map +1 -0
  139. package/src/models/folder-usage.js +36 -0
  140. package/src/models/folder-usage.js.map +1 -0
  141. package/src/models/keep-reason.js +30 -0
  142. package/src/models/keep-reason.js.map +1 -0
  143. package/src/models/kept-path.js +32 -0
  144. package/src/models/kept-path.js.map +1 -0
  145. package/src/models/list-request.js +27 -0
  146. package/src/models/list-request.js.map +1 -0
  147. package/src/models/path-kind.js +29 -0
  148. package/src/models/path-kind.js.map +1 -0
  149. package/src/models/preview-outcome.js +33 -0
  150. package/src/models/preview-outcome.js.map +1 -0
  151. package/src/models/preview-request.js +34 -0
  152. package/src/models/preview-request.js.map +1 -0
  153. package/src/models/preview-result.js +33 -0
  154. package/src/models/preview-result.js.map +1 -0
  155. package/src/models/read-outcome.js +35 -0
  156. package/src/models/read-outcome.js.map +1 -0
  157. package/src/models/read-request.js +54 -0
  158. package/src/models/read-request.js.map +1 -0
  159. package/src/models/read-result.js +52 -0
  160. package/src/models/read-result.js.map +1 -0
  161. package/src/models/restore-action.js +28 -0
  162. package/src/models/restore-action.js.map +1 -0
  163. package/src/models/restore-held-up-event.js +35 -0
  164. package/src/models/restore-held-up-event.js.map +1 -0
  165. package/src/models/restore-outcome.js +36 -0
  166. package/src/models/restore-outcome.js.map +1 -0
  167. package/src/models/restore-plan.js +59 -0
  168. package/src/models/restore-plan.js.map +1 -0
  169. package/src/models/restore-request.js +30 -0
  170. package/src/models/restore-request.js.map +1 -0
  171. package/src/models/restore-result.js +40 -0
  172. package/src/models/restore-result.js.map +1 -0
  173. package/src/models/restore-step.js +47 -0
  174. package/src/models/restore-step.js.map +1 -0
  175. package/src/models/restored-event.js +35 -0
  176. package/src/models/restored-event.js.map +1 -0
  177. package/src/models/storage-list.js +26 -0
  178. package/src/models/storage-list.js.map +1 -0
  179. package/src/models/storage-request.js +20 -0
  180. package/src/models/storage-request.js.map +1 -0
  181. package/src/models/unread-path.js +37 -0
  182. package/src/models/unread-path.js.map +1 -0
  183. package/src/models/unread-reason.js +29 -0
  184. package/src/models/unread-reason.js.map +1 -0
  185. package/src/resources.js +247 -0
  186. package/src/resources.js.map +1 -0
  187. package/src/services/base64.js +48 -0
  188. package/src/services/base64.js.map +1 -0
  189. package/src/services/byte-size.js +15 -0
  190. package/src/services/byte-size.js.map +1 -0
  191. package/src/services/checkpoint-id.js +16 -0
  192. package/src/services/checkpoint-id.js.map +1 -0
  193. package/src/services/folder-identity.js +16 -0
  194. package/src/services/folder-identity.js.map +1 -0
  195. package/src/services/json-object.reader.js +89 -0
  196. package/src/services/json-object.reader.js.map +1 -0
  197. package/src/services/relative-path.js +14 -0
  198. package/src/services/relative-path.js.map +1 -0
  199. package/src/services/scope-paths.js +24 -0
  200. package/src/services/scope-paths.js.map +1 -0
  201. package/src/types/json-object.js +9 -0
  202. package/src/types/json-object.js.map +1 -0
  203. package/src/types/json-value.js +9 -0
  204. package/src/types/json-value.js.map +1 -0
@@ -0,0 +1,247 @@
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
+ export class Resources {
9
+ static absolutePathPattern = /^(?:\/|[A-Za-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+)/;
10
+ static actionField = "action";
11
+ static afterField = "after";
12
+ static againstField = "against";
13
+ static base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
14
+ static base64DigitMask = 0x3f;
15
+ static base64GroupLength = 4;
16
+ static base64Padding = "=";
17
+ static base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
18
+ static base64TrailingPadding = /=+$/;
19
+ static beforeField = "before";
20
+ static bitsPerBase64Digit = 6;
21
+ static bitsPerByte = 8;
22
+ static byteMask = 0xff;
23
+ static bytesField = "bytes";
24
+ static bytesToWriteField = "bytesToWrite";
25
+ static captureMethod = "checkpoints.capture";
26
+ static capturePausedEvent = "checkpoints.capturePaused";
27
+ static capturePausedEventModel = "CapturePausedEvent";
28
+ static captureRequestModel = "CaptureRequest";
29
+ static captureResultModel = "CaptureResult";
30
+ static captureResumedEvent = "checkpoints.captureResumed";
31
+ static captureResumedEventModel = "CaptureResumedEvent";
32
+ static changeModel = "Change";
33
+ static changeSideModel = "ChangeSide";
34
+ static changesField = "changes";
35
+ static checkpointField = "checkpoint";
36
+ static checkpointListModel = "CheckpointList";
37
+ static checkpointModel = "Checkpoint";
38
+ static checkpointsField = "checkpoints";
39
+ static codeField = "code";
40
+ static compareMethod = "checkpoints.compare";
41
+ static compareRequestModel = "CompareRequest";
42
+ static compareResultModel = "CompareResult";
43
+ static contentField = "content";
44
+ static currentFolderName = ".";
45
+ static deleteFolderMethod = "checkpoints.deleteFolder";
46
+ static deleteFolderRequestModel = "DeleteFolderRequest";
47
+ static deleteFolderResultModel = "DeleteFolderResult";
48
+ static diffTargetModel = "DiffTarget";
49
+ static folderField = "folder";
50
+ static folderReferenceModel = "FolderReference";
51
+ static foldersField = "folders";
52
+ static folderUsageModel = "FolderUsage";
53
+ static fromField = "from";
54
+ static idField = "id";
55
+ static identityField = "identity";
56
+ static identityPattern = /^[A-Za-z0-9-]{1,64}$/;
57
+ static invalidBase64 = "The content is not base64 text.";
58
+ static invalidIdentity = "A folder's identity must be 1 to 64 letters, digits or hyphens.";
59
+ static invalidTime = "A checkpoint's time must be a valid date.";
60
+ static isCutField = "isCut";
61
+ static isTextField = "isText";
62
+ static keptPathModel = "KeptPath";
63
+ static kindField = "kind";
64
+ static labelField = "label";
65
+ static limitField = "limit";
66
+ static listMethod = "checkpoints.list";
67
+ static listRequestModel = "ListRequest";
68
+ static maximumLabelLength = 1_024;
69
+ static maximumReadLimit = 16 * 1024 * 1024;
70
+ static minimumReadLimit = 1;
71
+ static modeField = "mode";
72
+ static outcomeField = "outcome";
73
+ static parentFolderName = "..";
74
+ static pathField = "path";
75
+ static pathsField = "paths";
76
+ static planField = "plan";
77
+ static previewRequestModel = "PreviewRequest";
78
+ static previewRestoreMethod = "checkpoints.previewRestore";
79
+ static previewResultModel = "PreviewResult";
80
+ static readMethod = "checkpoints.read";
81
+ static readRequestModel = "ReadRequest";
82
+ static readResultModel = "ReadResult";
83
+ static reasonField = "reason";
84
+ static recoveredField = "recovered";
85
+ static relativePathSeparator = "/";
86
+ static restoredEvent = "checkpoints.restored";
87
+ static restoredEventModel = "RestoredEvent";
88
+ static restoreHeldUpEvent = "checkpoints.restoreHeldUp";
89
+ static restoreHeldUpEventModel = "RestoreHeldUpEvent";
90
+ static restoreMethod = "checkpoints.restore";
91
+ static restorePlanModel = "RestorePlan";
92
+ static restoreRequestModel = "RestoreRequest";
93
+ static restoreResultModel = "RestoreResult";
94
+ static restoreStepModel = "RestoreStep";
95
+ static sizeField = "size";
96
+ static spaceFreeField = "spaceFree";
97
+ static spaceNeededField = "spaceNeeded";
98
+ static stateDigestPattern = /^[0-9a-f]{64}$/;
99
+ static stateField = "state";
100
+ static statusField = "status";
101
+ static staysField = "stays";
102
+ static stepsField = "steps";
103
+ static storageListModel = "StorageList";
104
+ static storageMethod = "checkpoints.storage";
105
+ static storageRequestModel = "StorageRequest";
106
+ static timeField = "time";
107
+ static timePattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
108
+ static toField = "to";
109
+ static unreadPathModel = "UnreadPath";
110
+ static unreadPathsField = "unreadPaths";
111
+ static unreadReasonField = "unreadReason";
112
+ static versionSevenIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
113
+ static windowsPathSeparator = "\\";
114
+ static formatBackslashInPath(value) {
115
+ return `"${value}" is not a path in a restore's scope: its names never hold "\\", which Windows reads as a separator between folders.`;
116
+ }
117
+ static formatChangeSidesMismatch(status) {
118
+ return `A change has a side before exactly when it isn't Added, and one after exactly when it isn't Deleted, but when it's Unknown; the status is ${status}.`;
119
+ }
120
+ static formatChangesMismatch(outcome) {
121
+ return `A compare result holds changes only when its outcome is Compared; the outcome is ${outcome}.`;
122
+ }
123
+ static formatCheckpointMismatch(outcome) {
124
+ return `A capture result holds a checkpoint exactly when its outcome is Captured; the outcome is ${outcome}.`;
125
+ }
126
+ static formatContentTooLong(length, size) {
127
+ return `A read result's content of ${length} bytes is longer than its size, ${size}.`;
128
+ }
129
+ static formatCutMismatch(isCut) {
130
+ return `A read result is cut exactly when its content is shorter than its size; it says isCut is ${isCut}.`;
131
+ }
132
+ static formatInvalidCheckpointId(value) {
133
+ return `"${value}" is not a checkpoint ID: a lowercase UUID version 7.`;
134
+ }
135
+ static formatInvalidFolderPath(value) {
136
+ return `"${value}" is not an absolute folder path.`;
137
+ }
138
+ static formatInvalidReadLimit(value) {
139
+ return `A read's limit is a whole number of bytes from ${Resources.minimumReadLimit} to ${Resources.maximumReadLimit}; this one is ${value}.`;
140
+ }
141
+ static formatInvalidRelativePath(value) {
142
+ return `"${value}" is not a path inside a folder: its names must be non-empty, never "." or "..", and joined by "/".`;
143
+ }
144
+ static formatInvalidSize(value) {
145
+ return `A size is a whole number of bytes, 0 or more; this one is ${value}.`;
146
+ }
147
+ static formatInvalidState(value) {
148
+ return `"${value}" is not a plan's state: a lowercase SHA-256 in hexadecimal.`;
149
+ }
150
+ static formatInvalidTime(value) {
151
+ return `"${value}" is not a time in UTC with milliseconds, such as 2026-10-18T12:00:00.000Z.`;
152
+ }
153
+ static formatLabelTooLong(length) {
154
+ return `A label has at most ${Resources.maximumLabelLength} characters; this one has ${length}.`;
155
+ }
156
+ static formatMissingField(model, field) {
157
+ return `${model}.${field} is missing.`;
158
+ }
159
+ static formatNotABoolean(model, field) {
160
+ return `${model}.${field} must be true or false.`;
161
+ }
162
+ static formatNotAList(model, field) {
163
+ return `${model}.${field} must be a list.`;
164
+ }
165
+ static formatNotANumber(model, field) {
166
+ return `${model}.${field} must be a number.`;
167
+ }
168
+ static formatNotANumberOrNull(model, field) {
169
+ return `${model}.${field} must be a number or null.`;
170
+ }
171
+ static formatNotAnObject(model) {
172
+ return `${model} must be a JSON object.`;
173
+ }
174
+ static formatNotAString(model, field) {
175
+ return `${model}.${field} must be a string.`;
176
+ }
177
+ static formatNotAStringList(model, field) {
178
+ return `${model}.${field} must be a list of strings.`;
179
+ }
180
+ static formatNotAStringOrNull(model, field) {
181
+ return `${model}.${field} must be a string or null.`;
182
+ }
183
+ static formatPlanMismatch(outcome) {
184
+ return `A preview result holds a plan exactly when its outcome is Planned; the outcome is ${outcome}.`;
185
+ }
186
+ static formatReadMismatch(outcome) {
187
+ return `A read result holds content and a size only when its outcome is Read; the outcome is ${outcome}.`;
188
+ }
189
+ static formatRestoreCheckpointsMismatch(outcome) {
190
+ return `A restore result holds the checkpoint before exactly when its outcome is Restored or RolledBack, and a recovered one only when it is Restored; the outcome is ${outcome}.`;
191
+ }
192
+ static formatSideSizeMismatch(kind) {
193
+ return `A side has a size exactly when it isn't a folder, and a folder is never text; the kind is ${kind}.`;
194
+ }
195
+ static formatSpaceMismatch(outcome) {
196
+ return `A capture result holds the space free and the space needed exactly when its outcome is LowDiskSpace; the outcome is ${outcome}.`;
197
+ }
198
+ static formatStepSidesMismatch(action) {
199
+ return `A restore step has a side now exactly when it isn't a Write, and one in the checkpoint exactly when it isn't a Delete; the action is ${action}.`;
200
+ }
201
+ static formatUnknownCaptureMode(value) {
202
+ return `"${value}" is not a known capture mode.`;
203
+ }
204
+ static formatUnknownCaptureOutcome(value) {
205
+ return `"${value}" is not a known capture outcome.`;
206
+ }
207
+ static formatUnknownChangeStatus(value) {
208
+ return `"${value}" is not a known change status.`;
209
+ }
210
+ static formatUnknownCompareOutcome(value) {
211
+ return `"${value}" is not a known compare outcome.`;
212
+ }
213
+ static formatUnknownDeleteFolderOutcome(value) {
214
+ return `"${value}" is not a known delete outcome.`;
215
+ }
216
+ static formatUnknownField(model, field) {
217
+ return `${model}.${field} is not a known field.`;
218
+ }
219
+ static formatUnknownKeepReason(value) {
220
+ return `"${value}" is not a known reason a restore keeps a path.`;
221
+ }
222
+ static formatUnknownPathKind(value) {
223
+ return `"${value}" is not a known kind of path.`;
224
+ }
225
+ static formatUnknownPreviewOutcome(value) {
226
+ return `"${value}" is not a known preview outcome.`;
227
+ }
228
+ static formatUnknownReadOutcome(value) {
229
+ return `"${value}" is not a known read outcome.`;
230
+ }
231
+ static formatUnknownRestoreAction(value) {
232
+ return `"${value}" is not a known restore action.`;
233
+ }
234
+ static formatUnknownRestoreOutcome(value) {
235
+ return `"${value}" is not a known restore outcome.`;
236
+ }
237
+ static formatUnknownUnreadReason(value) {
238
+ return `"${value}" is not a known reason for a path that couldn't be read.`;
239
+ }
240
+ static formatUnreadCodeMismatch(reason) {
241
+ return `A path that couldn't be read has an error code exactly when its reason is Unreadable; the reason is ${reason}.`;
242
+ }
243
+ static formatUnreadReasonMismatch(status) {
244
+ return `A change has a reason it couldn't be read exactly when its status is Unknown; the status is ${status}.`;
245
+ }
246
+ }
247
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../../src/noldova.checkpoints.protocol/src/resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,OAAO,SAAS;IACb,MAAM,CAAU,mBAAmB,GAAW,gDAAgD,CAAC;IAC/F,MAAM,CAAU,WAAW,GAAW,QAAQ,CAAC;IAC/C,MAAM,CAAU,UAAU,GAAW,OAAO,CAAC;IAC7C,MAAM,CAAU,YAAY,GAAW,SAAS,CAAC;IACjD,MAAM,CAAU,cAAc,GAAW,kEAAkE,CAAC;IAC5G,MAAM,CAAU,eAAe,GAAW,IAAI,CAAC;IAC/C,MAAM,CAAU,iBAAiB,GAAW,CAAC,CAAC;IAC9C,MAAM,CAAU,aAAa,GAAW,GAAG,CAAC;IAC5C,MAAM,CAAU,aAAa,GAAW,kEAAkE,CAAC;IAC3G,MAA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+ * @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
+ import { InvalidBase64Exception } from "../exceptions/invalid-base64.exception.js";
9
+ import { Resources } from "../resources.js";
10
+ export class Base64 {
11
+ static decode(text) {
12
+ if (!Resources.base64Pattern.test(text))
13
+ throw new InvalidBase64Exception();
14
+ const digits = text.replace(Resources.base64TrailingPadding, "");
15
+ const bytes = new Uint8Array(Math.floor(digits.length * Resources.bitsPerBase64Digit / Resources.bitsPerByte));
16
+ let bits = 0;
17
+ let count = 0;
18
+ let index = 0;
19
+ for (const digit of digits) {
20
+ bits = bits << Resources.bitsPerBase64Digit | Resources.base64Alphabet.indexOf(digit);
21
+ count += Resources.bitsPerBase64Digit;
22
+ if (count >= Resources.bitsPerByte) {
23
+ count -= Resources.bitsPerByte;
24
+ bytes[index++] = bits >> count & Resources.byteMask;
25
+ bits &= (1 << count) - 1;
26
+ }
27
+ }
28
+ return bytes;
29
+ }
30
+ static encode(bytes) {
31
+ const digits = [];
32
+ let bits = 0;
33
+ let count = 0;
34
+ for (const byte of bytes) {
35
+ bits = bits << Resources.bitsPerByte | byte;
36
+ count += Resources.bitsPerByte;
37
+ while (count >= Resources.bitsPerBase64Digit) {
38
+ count -= Resources.bitsPerBase64Digit;
39
+ digits.push(Resources.base64Alphabet.charAt(bits >> count & Resources.base64DigitMask));
40
+ }
41
+ bits &= (1 << count) - 1;
42
+ }
43
+ if (count > 0)
44
+ digits.push(Resources.base64Alphabet.charAt(bits << Resources.bitsPerBase64Digit - count & Resources.base64DigitMask));
45
+ return digits.join("") + Resources.base64Padding.repeat((Resources.base64GroupLength - digits.length % Resources.base64GroupLength) % Resources.base64GroupLength);
46
+ }
47
+ }
48
+ //# sourceMappingURL=base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/base64.ts"],"names":[],"mappings":"A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QAC5B,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,GAAG,IAAI,IAAI,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;YAC5C,KAAK,IAAI,SAAS,CAAC,WAAW,CAAC;YAC/B,OAAO,KAAK,IAAI,SAAS,CAAC,kBAAkB,EAAE,CAAC;gBAC7C,KAAK,IAAI,SAAS,CAAC,kBAAkB,CAAC;gBACtC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;YAC1F,CAAC;YACD,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,KAAK,GAAG,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,IAAI,SAAS,CAAC,kBAAkB,GAAG,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;QACzH,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACrK,CAAC;CACF"}
@@ -0,0 +1,15 @@
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
+ import { InvalidSizeException } from "../exceptions/invalid-size.exception.js";
9
+ export class ByteSize {
10
+ static check(size) {
11
+ if (!Number.isSafeInteger(size) || size < 0)
12
+ throw new InvalidSizeException(size);
13
+ }
14
+ }
15
+ //# sourceMappingURL=byte-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"byte-size.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/byte-size.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,MAAM,OAAO,QAAQ;IACZ,MAAM,CAAC,KAAK,CAAC,IAAY;QAC9B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;YACzC,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF"}
@@ -0,0 +1,16 @@
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
+ import { InvalidCheckpointIdException } from "../exceptions/invalid-checkpoint-id.exception.js";
9
+ import { Resources } from "../resources.js";
10
+ export class CheckpointId {
11
+ static check(id) {
12
+ if (!Resources.versionSevenIdPattern.test(id))
13
+ throw new InvalidCheckpointIdException(id);
14
+ }
15
+ }
16
+ //# sourceMappingURL=checkpoint-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-id.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/checkpoint-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,KAAK,CAAC,EAAU;QAC5B,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,4BAA4B,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,16 @@
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
+ import { InvalidIdentityException } from "../exceptions/invalid-identity.exception.js";
9
+ import { Resources } from "../resources.js";
10
+ export class FolderIdentity {
11
+ static check(identity) {
12
+ if (!Resources.identityPattern.test(identity))
13
+ throw new InvalidIdentityException(identity);
14
+ }
15
+ }
16
+ //# sourceMappingURL=folder-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder-identity.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/folder-identity.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,cAAc;IAClB,MAAM,CAAC,KAAK,CAAC,QAAgB;QAClC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC3C,MAAM,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF"}
@@ -0,0 +1,89 @@
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
+ import { FieldNotABooleanException } from "../exceptions/field-not-a-boolean.exception.js";
9
+ import { FieldNotAListException } from "../exceptions/field-not-a-list.exception.js";
10
+ import { FieldNotANumberOrNullException } from "../exceptions/field-not-a-number-or-null.exception.js";
11
+ import { FieldNotANumberException } from "../exceptions/field-not-a-number.exception.js";
12
+ import { FieldNotAStringListException } from "../exceptions/field-not-a-string-list.exception.js";
13
+ import { FieldNotAStringOrNullException } from "../exceptions/field-not-a-string-or-null.exception.js";
14
+ import { FieldNotAStringException } from "../exceptions/field-not-a-string.exception.js";
15
+ import { MissingFieldException } from "../exceptions/missing-field.exception.js";
16
+ import { NotAnObjectException } from "../exceptions/not-an-object.exception.js";
17
+ import { UnknownFieldException } from "../exceptions/unknown-field.exception.js";
18
+ export class JsonObjectReader {
19
+ fields;
20
+ model;
21
+ constructor(value, model) {
22
+ if (typeof value !== "object" || value === null || Array.isArray(value))
23
+ throw new NotAnObjectException(model);
24
+ this.fields = new Map(Object.entries(value));
25
+ this.model = model;
26
+ }
27
+ read(field) {
28
+ if (!this.fields.has(field))
29
+ throw new MissingFieldException(this.model, field);
30
+ return this.fields.get(field);
31
+ }
32
+ readBoolean(field) {
33
+ const value = this.read(field);
34
+ if (typeof value !== "boolean")
35
+ throw new FieldNotABooleanException(this.model, field);
36
+ return value;
37
+ }
38
+ readList(field) {
39
+ const value = this.read(field);
40
+ if (!Array.isArray(value))
41
+ throw new FieldNotAListException(this.model, field);
42
+ return value;
43
+ }
44
+ readNumber(field) {
45
+ const value = this.read(field);
46
+ if (typeof value !== "number")
47
+ throw new FieldNotANumberException(this.model, field);
48
+ return value;
49
+ }
50
+ readNumberOrNull(field) {
51
+ const value = this.read(field);
52
+ if (value !== null && typeof value !== "number")
53
+ throw new FieldNotANumberOrNullException(this.model, field);
54
+ return value;
55
+ }
56
+ readString(field) {
57
+ const value = this.read(field);
58
+ if (typeof value !== "string")
59
+ throw new FieldNotAStringException(this.model, field);
60
+ return value;
61
+ }
62
+ readStringOrNull(field) {
63
+ const value = this.read(field);
64
+ if (value !== null && typeof value !== "string")
65
+ throw new FieldNotAStringOrNullException(this.model, field);
66
+ return value;
67
+ }
68
+ readStringList(field) {
69
+ return this.stringListOf(field, this.read(field));
70
+ }
71
+ readStringListOrNull(field) {
72
+ const value = this.read(field);
73
+ return value === null ? null : this.stringListOf(field, value);
74
+ }
75
+ refuseOtherFields(known) {
76
+ for (const field of this.fields.keys())
77
+ if (!known.includes(field))
78
+ throw new UnknownFieldException(this.model, field);
79
+ }
80
+ stringListOf(field, value) {
81
+ if (!Array.isArray(value))
82
+ throw new FieldNotAStringListException(this.model, field);
83
+ const strings = value.filter((t) => typeof t === "string");
84
+ if (strings.length !== value.length)
85
+ throw new FieldNotAStringListException(this.model, field);
86
+ return strings;
87
+ }
88
+ }
89
+ //# sourceMappingURL=json-object.reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-object.reader.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/json-object.reader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,uDAAuD,CAAC;AACvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EAAE,8BAA8B,EAAE,MAAM,uDAAuD,CAAC;AACvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,MAAM,OAAO,gBAAgB;IACV,MAAM,CAA+B;IACrC,KAAK,CAAS;IAE/B,YAAmB,KAAc,EAAE,KAAa;QAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACrE,MAAM,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEM,IAAI,CAAC,KA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I,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;QACxE,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YACjC,MAAM,IAAI,4BAA4B,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,14 @@
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
+ import { Resources } from "../resources.js";
9
+ export class RelativePath {
10
+ static isValid(path) {
11
+ return !path.split(Resources.relativePathSeparator).some(t => t === "" || t === Resources.currentFolderName || t === Resources.parentFolderName);
12
+ }
13
+ }
14
+ //# sourceMappingURL=relative-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relative-path.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/relative-path.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,OAAO,CAAC,IAAY;QAChC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,SAAS,CAAC,iBAAiB,IAAI,CAAC,KAAK,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACnJ,CAAC;CACF"}
@@ -0,0 +1,24 @@
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
+ import { InvalidRelativePathException } from "../exceptions/invalid-relative-path.exception.js";
9
+ import { Resources } from "../resources.js";
10
+ import { RelativePath } from "./relative-path.js";
11
+ export class ScopePaths {
12
+ static of(paths) {
13
+ if (paths === null)
14
+ return null;
15
+ for (const path of paths)
16
+ if (path.includes(Resources.windowsPathSeparator) || !RelativePath.isValid(path))
17
+ throw new InvalidRelativePathException(path);
18
+ return [...paths];
19
+ }
20
+ static toJson(paths) {
21
+ return paths === null ? null : [...paths];
22
+ }
23
+ }
24
+ //# sourceMappingURL=scope-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-paths.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/services/scope-paths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,UAAU;IACd,MAAM,CAAC,EAAE,CAAC,KAA+B;QAC9C,IAAI,KAAK,KAAK,IAAI;YAChB,OAAO,IAAI,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,KAAK;YACtB,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC9E,MAAM,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACpB,CAAC;IAEM,MAAM,CAAC,MAAM,CAAC,KAA+B;QAClD,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,9 @@
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
+ export {};
9
+ //# sourceMappingURL=json-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-object.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/types/json-object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,9 @@
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
+ export {};
9
+ //# sourceMappingURL=json-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-value.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/types/json-value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}