@noldova/checkpoints.protocol 0.0.2 → 0.0.4
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.
- package/README.md +3 -2
- package/package.json +5 -3
- package/src/api/index.d.ts +248 -535
- package/src/api/index.js +3 -11
- package/src/api/index.js.map +1 -1
- package/src/exceptions/{missing-field.exception.js → capture-content-mismatch.exception.js} +6 -8
- package/src/exceptions/capture-content-mismatch.exception.js.map +1 -0
- package/src/exceptions/{not-an-object.exception.js → earlier-paths-mismatch.exception.js} +6 -6
- package/src/exceptions/earlier-paths-mismatch.exception.js.map +1 -0
- package/src/exceptions/{field-not-a-list.exception.js → restore-content-mismatch.exception.js} +6 -8
- package/src/exceptions/restore-content-mismatch.exception.js.map +1 -0
- package/src/models/capture-mode.js +2 -1
- package/src/models/capture-mode.js.map +1 -1
- package/src/models/capture-outcome.js +4 -2
- package/src/models/capture-outcome.js.map +1 -1
- package/src/models/capture-paused-event.js +2 -3
- package/src/models/capture-paused-event.js.map +1 -1
- package/src/models/capture-request.js +17 -8
- package/src/models/capture-request.js.map +1 -1
- package/src/models/capture-result.js +26 -13
- package/src/models/capture-result.js.map +1 -1
- package/src/models/capture-resumed-event.js +2 -3
- package/src/models/capture-resumed-event.js.map +1 -1
- package/src/models/change-side.js +6 -6
- package/src/models/change-side.js.map +1 -1
- package/src/models/change-status.js +2 -1
- package/src/models/change-status.js.map +1 -1
- package/src/models/change.js +12 -12
- package/src/models/change.js.map +1 -1
- package/src/models/checkpoint-list.js +3 -4
- package/src/models/checkpoint-list.js.map +1 -1
- package/src/models/checkpoint.js +5 -9
- package/src/models/checkpoint.js.map +1 -1
- package/src/models/compare-outcome.js +2 -1
- package/src/models/compare-outcome.js.map +1 -1
- package/src/models/compare-request.js +5 -5
- package/src/models/compare-request.js.map +1 -1
- package/src/models/compare-result.js +3 -4
- package/src/models/compare-result.js.map +1 -1
- package/src/models/delete-folder-outcome.js +2 -1
- package/src/models/delete-folder-outcome.js.map +1 -1
- package/src/models/delete-folder-request.js +3 -4
- package/src/models/delete-folder-request.js.map +1 -1
- package/src/models/delete-folder-result.js +3 -4
- package/src/models/delete-folder-result.js.map +1 -1
- package/src/models/diff-target.js +5 -5
- package/src/models/diff-target.js.map +1 -1
- package/src/models/folder-reference.js +2 -3
- package/src/models/folder-reference.js.map +1 -1
- package/src/models/folder-usage.js +5 -5
- package/src/models/folder-usage.js.map +1 -1
- package/src/models/keep-reason.js +4 -2
- package/src/models/keep-reason.js.map +1 -1
- package/src/models/kept-path.js +3 -4
- package/src/models/kept-path.js.map +1 -1
- package/src/models/list-request.js +3 -4
- package/src/models/list-request.js.map +1 -1
- package/src/models/path-kind.js +2 -1
- package/src/models/path-kind.js.map +1 -1
- package/src/models/preview-outcome.js +2 -1
- package/src/models/preview-outcome.js.map +1 -1
- package/src/models/preview-request.js +3 -4
- package/src/models/preview-request.js.map +1 -1
- package/src/models/preview-result.js +7 -7
- package/src/models/preview-result.js.map +1 -1
- package/src/models/read-outcome.js +2 -1
- package/src/models/read-outcome.js.map +1 -1
- package/src/models/read-request.js +6 -6
- package/src/models/read-request.js.map +1 -1
- package/src/models/read-result.js +3 -4
- package/src/models/read-result.js.map +1 -1
- package/src/models/restore-action.js +2 -1
- package/src/models/restore-action.js.map +1 -1
- package/src/models/restore-held-up-event.js +3 -4
- package/src/models/restore-held-up-event.js.map +1 -1
- package/src/models/restore-outcome.js +5 -2
- package/src/models/restore-outcome.js.map +1 -1
- package/src/models/restore-plan.js +15 -7
- package/src/models/restore-plan.js.map +1 -1
- package/src/models/restore-request.js +3 -4
- package/src/models/restore-request.js.map +1 -1
- package/src/models/restore-result.js +27 -11
- package/src/models/restore-result.js.map +1 -1
- package/src/models/restore-step.js +9 -9
- package/src/models/restore-step.js.map +1 -1
- package/src/models/restored-event.js +2 -3
- package/src/models/restored-event.js.map +1 -1
- package/src/models/storage-list.js +3 -4
- package/src/models/storage-list.js.map +1 -1
- package/src/models/storage-request.js +2 -2
- package/src/models/storage-request.js.map +1 -1
- package/src/models/unread-path.js +5 -5
- package/src/models/unread-path.js.map +1 -1
- package/src/models/unread-reason.js +4 -2
- package/src/models/unread-reason.js.map +1 -1
- package/src/resources.js +20 -32
- package/src/resources.js.map +1 -1
- package/src/services/scope-paths.js +3 -2
- package/src/services/scope-paths.js.map +1 -1
- package/src/services/wire-form.js +43 -0
- package/src/services/wire-form.js.map +1 -0
- package/src/exceptions/field-not-a-boolean.exception.js +0 -19
- package/src/exceptions/field-not-a-boolean.exception.js.map +0 -1
- package/src/exceptions/field-not-a-list.exception.js.map +0 -1
- package/src/exceptions/field-not-a-number-or-null.exception.js +0 -19
- package/src/exceptions/field-not-a-number-or-null.exception.js.map +0 -1
- package/src/exceptions/field-not-a-number.exception.js +0 -19
- package/src/exceptions/field-not-a-number.exception.js.map +0 -1
- package/src/exceptions/field-not-a-string-list.exception.js +0 -19
- package/src/exceptions/field-not-a-string-list.exception.js.map +0 -1
- package/src/exceptions/field-not-a-string-or-null.exception.js +0 -19
- package/src/exceptions/field-not-a-string-or-null.exception.js.map +0 -1
- package/src/exceptions/field-not-a-string.exception.js +0 -19
- package/src/exceptions/field-not-a-string.exception.js.map +0 -1
- package/src/exceptions/missing-field.exception.js.map +0 -1
- package/src/exceptions/not-an-object.exception.js.map +0 -1
- package/src/exceptions/unknown-field.exception.js +0 -19
- package/src/exceptions/unknown-field.exception.js.map +0 -1
- package/src/services/json-object.reader.js +0 -89
- package/src/services/json-object.reader.js.map +0 -1
- package/src/types/json-object.js +0 -9
- package/src/types/json-object.js.map +0 -1
- package/src/types/json-value.js +0 -9
- package/src/types/json-value.js.map +0 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { UnknownReadOutcomeException } from "../exceptions/unknown-read-outcome.exception.js";
|
|
9
10
|
export class ReadOutcome {
|
|
10
11
|
static Read = new ReadOutcome("Read", true);
|
|
@@ -24,7 +25,7 @@ export class ReadOutcome {
|
|
|
24
25
|
}
|
|
25
26
|
static fromJson(value) {
|
|
26
27
|
const outcome = ReadOutcome.ALL.find(t => t.value === value);
|
|
27
|
-
if (outcome
|
|
28
|
+
if (Object.isUndefined(outcome))
|
|
28
29
|
throw new UnknownReadOutcomeException(String(value));
|
|
29
30
|
return outcome;
|
|
30
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-outcome.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/read-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAE9F,MAAM,OAAO,WAAW;IACf,MAAM,CAAU,IAAI,GAAgB,IAAI,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClE,MAAM,CAAU,aAAa,GAAgB,IAAI,WAAW,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACrF,MAAM,CAAU,iBAAiB,GAAgB,IAAI,WAAW,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC7F,MAAM,CAAU,WAAW,GAAgB,IAAI,WAAW,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACjF,MAAM,CAAU,OAAO,GAAgB,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,CAAU,MAAM,GAAgB,IAAI,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACtE,MAAM,CAAU,GAAG,GAA2B;QACpD,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,iBAAiB,EAAE,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM;KAC7I,CAAC;IACc,MAAM,CAAU;IAChB,KAAK,CAAS;IAE9B,YAAoB,KA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;IAE9B,YAAoB,KAAa,EAAE,MAAe;QAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAC7D,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;YAC7B,MAAM,IAAI,2BAA2B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvD,OAAO,OAAO,CAAC;IACjB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { InvalidReadLimitException } from "../exceptions/invalid-read-limit.exception.js";
|
|
9
10
|
import { InvalidRelativePathException } from "../exceptions/invalid-relative-path.exception.js";
|
|
10
11
|
import { Resources } from "../resources.js";
|
|
11
12
|
import { CheckpointId } from "../services/checkpoint-id.js";
|
|
12
|
-
import { JsonObjectReader } from "../services/json-object.reader.js";
|
|
13
13
|
import { RelativePath } from "../services/relative-path.js";
|
|
14
|
+
import { WireForm } from "../services/wire-form.js";
|
|
14
15
|
import { DiffTarget } from "./diff-target.js";
|
|
15
16
|
import { FolderReference } from "./folder-reference.js";
|
|
16
17
|
export class ReadRequest {
|
|
@@ -36,17 +37,16 @@ export class ReadRequest {
|
|
|
36
37
|
this.path = path;
|
|
37
38
|
}
|
|
38
39
|
static fromJson(value) {
|
|
39
|
-
const reader =
|
|
40
|
-
reader.
|
|
41
|
-
|
|
42
|
-
return new ReadRequest(FolderReference.fromJson(reader.read(Resources.folderField)), reader.readString(Resources.checkpointField), reader.readString(Resources.pathField), against === null ? null : DiffTarget.fromJson(against), reader.readNumber(Resources.limitField));
|
|
40
|
+
const reader = WireForm.read(value, Resources.readRequestModel, ReadRequest.FIELDS);
|
|
41
|
+
const against = reader.readValue(Resources.againstField);
|
|
42
|
+
return new ReadRequest(FolderReference.fromJson(reader.readValue(Resources.folderField)), reader.readString(Resources.checkpointField), reader.readString(Resources.pathField), Object.isNull(against) ? null : DiffTarget.fromJson(against), reader.readNumber(Resources.limitField));
|
|
43
43
|
}
|
|
44
44
|
toJson() {
|
|
45
45
|
return {
|
|
46
46
|
[Resources.folderField]: this.folder.toJson(),
|
|
47
47
|
[Resources.checkpointField]: this.checkpoint,
|
|
48
48
|
[Resources.pathField]: this.path,
|
|
49
|
-
[Resources.againstField]: this.against
|
|
49
|
+
[Resources.againstField]: Object.isNull(this.against) ? null : this.against.toJson(),
|
|
50
50
|
[Resources.limitField]: this.limit
|
|
51
51
|
};
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/read-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"read-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/read-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAG/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,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eMismatchException } from "../exceptions/read-outcome-mismatc
|
|
|
11
11
|
import { Resources } from "../resources.js";
|
|
12
12
|
import { Base64 } from "../services/base64.js";
|
|
13
13
|
import { ByteSize } from "../services/byte-size.js";
|
|
14
|
-
import {
|
|
14
|
+
import { WireForm } from "../services/wire-form.js";
|
|
15
15
|
import { ReadOutcome } from "./read-outcome.js";
|
|
16
16
|
export class ReadResult {
|
|
17
17
|
static FIELDS = [Resources.outcomeField, Resources.contentField, Resources.isCutField, Resources.sizeField];
|
|
@@ -32,9 +32,8 @@ export class ReadResult {
|
|
|
32
32
|
return this.content.length < this.size;
|
|
33
33
|
}
|
|
34
34
|
static fromJson(value) {
|
|
35
|
-
const reader =
|
|
36
|
-
reader.
|
|
37
|
-
const result = new ReadResult(ReadOutcome.fromJson(reader.read(Resources.outcomeField)), Base64.decode(reader.readString(Resources.contentField)), reader.readNumber(Resources.sizeField));
|
|
35
|
+
const reader = WireForm.read(value, Resources.readResultModel, ReadResult.FIELDS);
|
|
36
|
+
const result = new ReadResult(ReadOutcome.fromJson(reader.readValue(Resources.outcomeField)), Base64.decode(reader.readString(Resources.contentField)), reader.readNumber(Resources.sizeField));
|
|
38
37
|
const isCut = reader.readBoolean(Resources.isCutField);
|
|
39
38
|
if (isCut !== result.isCut)
|
|
40
39
|
throw new ReadCutMismatchException(isCut);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-result.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/read-result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"read-result.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/read-result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,k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C,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,EACpJ,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACvD,IAAI,KAAK,KAAK,MAAM,CAAC,KAAK;YACxB,MAAM,IAAI,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,MAAM;QACX,OAAO;YACL,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC/C,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACrD,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,KAAK;YAClC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI;SACjC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { UnknownRestoreActionException } from "../exceptions/unknown-restore-action.exception.js";
|
|
9
10
|
export class RestoreAction {
|
|
10
11
|
static Write = new RestoreAction("Write");
|
|
@@ -17,7 +18,7 @@ export class RestoreAction {
|
|
|
17
18
|
}
|
|
18
19
|
static fromJson(value) {
|
|
19
20
|
const action = RestoreAction.ALL.find(t => t.value === value);
|
|
20
|
-
if (action
|
|
21
|
+
if (Object.isUndefined(action))
|
|
21
22
|
throw new UnknownRestoreActionException(String(value));
|
|
22
23
|
return action;
|
|
23
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-action.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-action.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAElG,MAAM,OAAO,aAAa;IACjB,MAAM,CAAU,KAAK,GAAkB,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IAClE,MAAM,CAAU,OAAO,GAAkB,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;IACtE,MAAM,CAAU,MAAM,GAAkB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnE,MAAM,CAAU,GAAG,GAA6B,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3G,KAAK,CAAS;IAE9B,YAAoB,KAAa;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAC9D,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"restore-action.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-action.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAElG,MAAM,OAAO,aAAa;IACjB,MAAM,CAAU,KAAK,GAAkB,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IAClE,MAAM,CAAU,OAAO,GAAkB,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;IACtE,MAAM,CAAU,MAAM,GAAkB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnE,MAAM,CAAU,GAAG,GAA6B,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3G,KAAK,CAAS;IAE9B,YAAoB,KAAa;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;YAC5B,MAAM,IAAI,6BAA6B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { InvalidRelativePathException } from "../exceptions/invalid-relative-path.exception.js";
|
|
9
9
|
import { Resources } from "../resources.js";
|
|
10
10
|
import { FolderIdentity } from "../services/folder-identity.js";
|
|
11
|
-
import { JsonObjectReader } from "../services/json-object.reader.js";
|
|
12
11
|
import { RelativePath } from "../services/relative-path.js";
|
|
12
|
+
import { WireForm } from "../services/wire-form.js";
|
|
13
13
|
export class RestoreHeldUpEvent {
|
|
14
14
|
static event = Resources.restoreHeldUpEvent;
|
|
15
15
|
static FIELDS = [Resources.identityField, Resources.pathsField];
|
|
@@ -24,9 +24,8 @@ export class RestoreHeldUpEvent {
|
|
|
24
24
|
this.paths = [...paths];
|
|
25
25
|
}
|
|
26
26
|
static fromJson(value) {
|
|
27
|
-
const reader =
|
|
28
|
-
reader.
|
|
29
|
-
return new RestoreHeldUpEvent(reader.readString(Resources.identityField), reader.readStringList(Resources.pathsField));
|
|
27
|
+
const reader = WireForm.read(value, Resources.restoreHeldUpEventModel, RestoreHeldUpEvent.FIELDS);
|
|
28
|
+
return new RestoreHeldUpEvent(reader.readString(Resources.identityField), reader.readStringArray(Resources.pathsField));
|
|
30
29
|
}
|
|
31
30
|
toJson() {
|
|
32
31
|
return { [Resources.identityField]: this.identity, [Resources.pathsField]: [...this.paths] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-held-up-event.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-held-up-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"restore-held-up-event.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-held-up-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,OAAO,kBAAkB;IACtB,MAAM,CAAU,KAAK,GAAW,SAAS,CAAC,kBAAkB,CAAC;IAC5D,MAAM,CAAU,MAAM,GAAsB,CAAC,SAAS,CAAC,aAAa,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACpF,QAAQ,CAAS;IACjB,KAAK,CAAoB;IAEzC,YAAmB,QAAgB,EAAE,KAAwB;QAC3D,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/B,KAAK,MAAM,IAAI,IAAI,KAAK;YACtB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;gBAC7B,MAAM,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC;QAEjD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAClG,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1H,CAAC;IAEM,MAAM;QACX,OAAO,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IAC/F,CAAC;CACF"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { UnknownRestoreOutcomeException } from "../exceptions/unknown-restore-outcome.exception.js";
|
|
9
10
|
export class RestoreOutcome {
|
|
10
11
|
static Restored = new RestoreOutcome("Restored", true);
|
|
@@ -14,8 +15,10 @@ export class RestoreOutcome {
|
|
|
14
15
|
static LowDiskSpace = new RestoreOutcome("LowDiskSpace", false);
|
|
15
16
|
static HeldUp = new RestoreOutcome("HeldUp", false);
|
|
16
17
|
static RolledBack = new RestoreOutcome("RolledBack", false);
|
|
18
|
+
static TooLarge = new RestoreOutcome("TooLarge", false);
|
|
17
19
|
static ALL = [
|
|
18
|
-
RestoreOutcome.Restored, RestoreOutcome.MovedOn, RestoreOutcome.CheckpointMissing, RestoreOutcome.FolderMissing, RestoreOutcome.LowDiskSpace, RestoreOutcome.HeldUp,
|
|
20
|
+
RestoreOutcome.Restored, RestoreOutcome.MovedOn, RestoreOutcome.CheckpointMissing, RestoreOutcome.FolderMissing, RestoreOutcome.LowDiskSpace, RestoreOutcome.HeldUp,
|
|
21
|
+
RestoreOutcome.RolledBack, RestoreOutcome.TooLarge
|
|
19
22
|
];
|
|
20
23
|
isRestored;
|
|
21
24
|
value;
|
|
@@ -25,7 +28,7 @@ export class RestoreOutcome {
|
|
|
25
28
|
}
|
|
26
29
|
static fromJson(value) {
|
|
27
30
|
const outcome = RestoreOutcome.ALL.find(t => t.value === value);
|
|
28
|
-
if (outcome
|
|
31
|
+
if (Object.isUndefined(outcome))
|
|
29
32
|
throw new UnknownRestoreOutcomeException(String(value));
|
|
30
33
|
return outcome;
|
|
31
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-outcome.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AAEpG,MAAM,OAAO,cAAc;IAClB,MAAM,CAAU,QAAQ,GAAmB,IAAI,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChF,MAAM,CAAU,OAAO,GAAmB,IAAI,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC/E,MAAM,CAAU,iBAAiB,GAAmB,IAAI,cAAc,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IACnG,MAAM,CAAU,aAAa,GAAmB,IAAI,cAAc,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAC3F,MAAM,CAAU,YAAY,GAAmB,IAAI,cAAc,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACzF,MAAM,CAAU,MAAM,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CAAC,QAAQ;KACnD,CAAC;IACc,UAAU,CAAU;IACpB,KAAK,CAAS;IAE9B,YAAoB,KAAa,EAAE,UAAmB;QACpD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAChE,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;YAC7B,MAAM,IAAI,8BAA8B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,OAAO,OAAO,CAAC;IACjB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -5,34 +5,42 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
9
|
+
import { EarlierPathsMismatchException } from "../exceptions/earlier-paths-mismatch.exception.js";
|
|
8
10
|
import { InvalidPlanStateException } from "../exceptions/invalid-plan-state.exception.js";
|
|
9
11
|
import { Resources } from "../resources.js";
|
|
10
12
|
import { ByteSize } from "../services/byte-size.js";
|
|
11
13
|
import { CheckpointId } from "../services/checkpoint-id.js";
|
|
12
|
-
import { JsonObjectReader } from "../services/json-object.reader.js";
|
|
13
14
|
import { ScopePaths } from "../services/scope-paths.js";
|
|
15
|
+
import { WireForm } from "../services/wire-form.js";
|
|
14
16
|
import { KeptPath } from "./kept-path.js";
|
|
15
17
|
import { RestoreStep } from "./restore-step.js";
|
|
16
18
|
export class RestorePlan {
|
|
17
19
|
static FIELDS = [
|
|
18
20
|
Resources.checkpointField, Resources.stepsField, Resources.staysField, Resources.bytesToWriteField, Resources.spaceNeededField, Resources.stateField,
|
|
19
|
-
Resources.pathsField
|
|
21
|
+
Resources.pathsField, Resources.earlierPathsField
|
|
20
22
|
];
|
|
21
23
|
bytesToWrite;
|
|
22
24
|
checkpoint;
|
|
25
|
+
earlierPaths;
|
|
23
26
|
paths;
|
|
24
27
|
spaceNeeded;
|
|
25
28
|
state;
|
|
26
29
|
stays;
|
|
27
30
|
steps;
|
|
28
|
-
constructor(checkpoint, steps, stays, bytesToWrite, spaceNeeded, state, paths) {
|
|
31
|
+
constructor(checkpoint, steps, stays, bytesToWrite, spaceNeeded, state, paths, earlierPaths = []) {
|
|
29
32
|
CheckpointId.check(checkpoint);
|
|
30
33
|
for (const size of [bytesToWrite, spaceNeeded])
|
|
31
34
|
ByteSize.check(size);
|
|
32
35
|
if (!Resources.stateDigestPattern.test(state))
|
|
33
36
|
throw new InvalidPlanStateException(state);
|
|
37
|
+
const stepPaths = new Set(steps.map(t => t.path));
|
|
38
|
+
const earlier = earlierPaths.find((t, u) => !stepPaths.has(t) || earlierPaths.indexOf(t) !== u);
|
|
39
|
+
if (!Object.isUndefined(earlier))
|
|
40
|
+
throw new EarlierPathsMismatchException(earlier);
|
|
34
41
|
this.bytesToWrite = bytesToWrite;
|
|
35
42
|
this.checkpoint = checkpoint;
|
|
43
|
+
this.earlierPaths = [...earlierPaths];
|
|
36
44
|
this.paths = ScopePaths.of(paths);
|
|
37
45
|
this.spaceNeeded = spaceNeeded;
|
|
38
46
|
this.state = state;
|
|
@@ -40,9 +48,8 @@ export class RestorePlan {
|
|
|
40
48
|
this.steps = [...steps];
|
|
41
49
|
}
|
|
42
50
|
static fromJson(value) {
|
|
43
|
-
const reader =
|
|
44
|
-
reader.
|
|
45
|
-
return new RestorePlan(reader.readString(Resources.checkpointField), reader.readList(Resources.stepsField).map(t => RestoreStep.fromJson(t)), reader.readList(Resources.staysField).map(t => KeptPath.fromJson(t)), reader.readNumber(Resources.bytesToWriteField), reader.readNumber(Resources.spaceNeededField), reader.readString(Resources.stateField), reader.readStringListOrNull(Resources.pathsField));
|
|
51
|
+
const reader = WireForm.read(value, Resources.restorePlanModel, RestorePlan.FIELDS);
|
|
52
|
+
return new RestorePlan(reader.readString(Resources.checkpointField), WireForm.readArray(reader, Resources.stepsField).map(t => RestoreStep.fromJson(t)), WireForm.readArray(reader, Resources.staysField).map(t => KeptPath.fromJson(t)), reader.readNumber(Resources.bytesToWriteField), reader.readNumber(Resources.spaceNeededField), reader.readString(Resources.stateField), WireForm.readNullableStringArray(reader, Resources.pathsField), reader.readStringArray(Resources.earlierPathsField));
|
|
46
53
|
}
|
|
47
54
|
toJson() {
|
|
48
55
|
return {
|
|
@@ -52,7 +59,8 @@ export class RestorePlan {
|
|
|
52
59
|
[Resources.bytesToWriteField]: this.bytesToWrite,
|
|
53
60
|
[Resources.spaceNeededField]: this.spaceNeeded,
|
|
54
61
|
[Resources.stateField]: this.state,
|
|
55
|
-
[Resources.pathsField]: ScopePaths.toJson(this.paths)
|
|
62
|
+
[Resources.pathsField]: ScopePaths.toJson(this.paths),
|
|
63
|
+
[Resources.earlierPathsField]: [...this.earlierPaths]
|
|
56
64
|
};
|
|
57
65
|
}
|
|
58
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-plan.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"restore-plan.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-plan.ts"],"names":[],"mappings":"AAAA;;;;;;GA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AAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;SACtD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import { Resources } from "../resources.js";
|
|
9
|
-
import {
|
|
9
|
+
import { WireForm } from "../services/wire-form.js";
|
|
10
10
|
import { FolderReference } from "./folder-reference.js";
|
|
11
11
|
import { RestorePlan } from "./restore-plan.js";
|
|
12
12
|
export class RestoreRequest {
|
|
@@ -19,9 +19,8 @@ export class RestoreRequest {
|
|
|
19
19
|
this.plan = plan;
|
|
20
20
|
}
|
|
21
21
|
static fromJson(value) {
|
|
22
|
-
const reader =
|
|
23
|
-
reader.
|
|
24
|
-
return new RestoreRequest(FolderReference.fromJson(reader.read(Resources.folderField)), RestorePlan.fromJson(reader.read(Resources.planField)));
|
|
22
|
+
const reader = WireForm.read(value, Resources.restoreRequestModel, RestoreRequest.FIELDS);
|
|
23
|
+
return new RestoreRequest(FolderReference.fromJson(reader.readValue(Resources.folderField)), RestorePlan.fromJson(reader.readValue(Resources.planField)));
|
|
25
24
|
}
|
|
26
25
|
toJson() {
|
|
27
26
|
return { [Resources.folderField]: this.folder.toJson(), [Resources.planField]: this.plan.toJson() };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"restore-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,cAAc;IAClB,MAAM,CAAU,MAAM,GAAW,SAAS,CAAC,aAAa,CAAC;IACxD,MAAM,CAAU,MAAM,GAAsB,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjF,MAAM,CAAkB;IACxB,IAAI,CAAc;IAElC,YAAmB,MAAuB,EAAE,IAAiB;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,mBAAmB,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;QAC1F,OAAO,IAAI,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5J,CAAC;IAEM,MAAM;QACX,OAAO,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACtG,CAAC;CACF"}
|
|
@@ -5,35 +5,51 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { RestoreCheckpointsMismatchException } from "../exceptions/restore-checkpoints-mismatch.exception.js";
|
|
10
|
+
import { RestoreContentMismatchException } from "../exceptions/restore-content-mismatch.exception.js";
|
|
9
11
|
import { Resources } from "../resources.js";
|
|
10
|
-
import {
|
|
12
|
+
import { ByteSize } from "../services/byte-size.js";
|
|
13
|
+
import { WireForm } from "../services/wire-form.js";
|
|
11
14
|
import { Checkpoint } from "./checkpoint.js";
|
|
12
15
|
import { RestoreOutcome } from "./restore-outcome.js";
|
|
13
16
|
export class RestoreResult {
|
|
14
|
-
static FIELDS = [
|
|
17
|
+
static FIELDS = [
|
|
18
|
+
Resources.outcomeField, Resources.beforeField, Resources.recoveredField, Resources.contentSizeField, Resources.contentLimitField
|
|
19
|
+
];
|
|
15
20
|
before;
|
|
21
|
+
contentLimit;
|
|
22
|
+
contentSize;
|
|
16
23
|
outcome;
|
|
17
24
|
recovered;
|
|
18
|
-
constructor(outcome, before, recovered) {
|
|
19
|
-
if ((before
|
|
25
|
+
constructor(outcome, before, recovered, contentSize = null, contentLimit = null) {
|
|
26
|
+
if ((!Object.isNull(before)) !== (outcome.isRestored || outcome === RestoreOutcome.RolledBack) || !Object.isNull(recovered) && !outcome.isRestored)
|
|
20
27
|
throw new RestoreCheckpointsMismatchException(outcome);
|
|
28
|
+
const contents = [contentSize, contentLimit];
|
|
29
|
+
if (contents.some(t => (!Object.isNull(t)) !== (outcome === RestoreOutcome.TooLarge)))
|
|
30
|
+
throw new RestoreContentMismatchException(outcome);
|
|
31
|
+
for (const size of contents)
|
|
32
|
+
if (!Object.isNull(size))
|
|
33
|
+
ByteSize.check(size);
|
|
21
34
|
this.before = before;
|
|
35
|
+
this.contentLimit = contentLimit;
|
|
36
|
+
this.contentSize = contentSize;
|
|
22
37
|
this.outcome = outcome;
|
|
23
38
|
this.recovered = recovered;
|
|
24
39
|
}
|
|
25
40
|
static fromJson(value) {
|
|
26
|
-
const reader =
|
|
27
|
-
reader.
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return new RestoreResult(RestoreOutcome.fromJson(reader.read(Resources.outcomeField)), before === null ? null : Checkpoint.fromJson(before), recovered === null ? null : Checkpoint.fromJson(recovered));
|
|
41
|
+
const reader = WireForm.read(value, Resources.restoreResultModel, RestoreResult.FIELDS);
|
|
42
|
+
const before = reader.readValue(Resources.beforeField);
|
|
43
|
+
const recovered = reader.readValue(Resources.recoveredField);
|
|
44
|
+
return new RestoreResult(RestoreOutcome.fromJson(reader.readValue(Resources.outcomeField)), Object.isNull(before) ? null : Checkpoint.fromJson(before), Object.isNull(recovered) ? null : Checkpoint.fromJson(recovered), WireForm.readNullableNumber(reader, Resources.contentSizeField), WireForm.readNullableNumber(reader, Resources.contentLimitField));
|
|
31
45
|
}
|
|
32
46
|
toJson() {
|
|
33
47
|
return {
|
|
34
48
|
[Resources.outcomeField]: this.outcome.toJson(),
|
|
35
|
-
[Resources.beforeField]: this.before
|
|
36
|
-
[Resources.recoveredField]: this.recovered
|
|
49
|
+
[Resources.beforeField]: Object.isNull(this.before) ? null : this.before.toJson(),
|
|
50
|
+
[Resources.recoveredField]: Object.isNull(this.recovered) ? null : this.recovered.toJson(),
|
|
51
|
+
[Resources.contentSizeField]: this.contentSize,
|
|
52
|
+
[Resources.contentLimitField]: this.contentLimit
|
|
37
53
|
};
|
|
38
54
|
}
|
|
39
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-result.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"restore-result.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAG/B,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAC;AAC9G,OAAO,EAAE,+BAA+B,EA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S,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC/C,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YACjF,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YAC1F,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC,WAAW;YAC9C,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,YAAY;SACjD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { InvalidRelativePathException } from "../exceptions/invalid-relative-path.exception.js";
|
|
9
10
|
import { StepSidesMismatchException } from "../exceptions/step-sides-mismatch.exception.js";
|
|
10
11
|
import { Resources } from "../resources.js";
|
|
11
|
-
import { JsonObjectReader } from "../services/json-object.reader.js";
|
|
12
12
|
import { RelativePath } from "../services/relative-path.js";
|
|
13
|
+
import { WireForm } from "../services/wire-form.js";
|
|
13
14
|
import { ChangeSide } from "./change-side.js";
|
|
14
15
|
import { RestoreAction } from "./restore-action.js";
|
|
15
16
|
export class RestoreStep {
|
|
@@ -21,7 +22,7 @@ export class RestoreStep {
|
|
|
21
22
|
constructor(path, action, before, after) {
|
|
22
23
|
if (!RelativePath.isValid(path))
|
|
23
24
|
throw new InvalidRelativePathException(path);
|
|
24
|
-
if ((before
|
|
25
|
+
if ((Object.isNull(before)) !== (action === RestoreAction.Write) || (Object.isNull(after)) !== (action === RestoreAction.Delete))
|
|
25
26
|
throw new StepSidesMismatchException(action);
|
|
26
27
|
this.action = action;
|
|
27
28
|
this.after = after;
|
|
@@ -29,18 +30,17 @@ export class RestoreStep {
|
|
|
29
30
|
this.path = path;
|
|
30
31
|
}
|
|
31
32
|
static fromJson(value) {
|
|
32
|
-
const reader =
|
|
33
|
-
reader.
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
return new RestoreStep(reader.readString(Resources.pathField), RestoreAction.fromJson(reader.read(Resources.actionField)), before === null ? null : ChangeSide.fromJson(before), after === null ? null : ChangeSide.fromJson(after));
|
|
33
|
+
const reader = WireForm.read(value, Resources.restoreStepModel, RestoreStep.FIELDS);
|
|
34
|
+
const before = reader.readValue(Resources.beforeField);
|
|
35
|
+
const after = reader.readValue(Resources.afterField);
|
|
36
|
+
return new RestoreStep(reader.readString(Resources.pathField), RestoreAction.fromJson(reader.readValue(Resources.actionField)), Object.isNull(before) ? null : ChangeSide.fromJson(before), Object.isNull(after) ? null : ChangeSide.fromJson(after));
|
|
37
37
|
}
|
|
38
38
|
toJson() {
|
|
39
39
|
return {
|
|
40
40
|
[Resources.pathField]: this.path,
|
|
41
41
|
[Resources.actionField]: this.action.toJson(),
|
|
42
|
-
[Resources.beforeField]: this.before
|
|
43
|
-
[Resources.afterField]: this.after
|
|
42
|
+
[Resources.beforeField]: Object.isNull(this.before) ? null : this.before.toJson(),
|
|
43
|
+
[Resources.afterField]: Object.isNull(this.after) ? null : this.after.toJson()
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restore-step.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restore-step.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDA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IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YACjF,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;SAC/E,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Resources } from "../resources.js";
|
|
9
9
|
import { CheckpointId } from "../services/checkpoint-id.js";
|
|
10
10
|
import { FolderIdentity } from "../services/folder-identity.js";
|
|
11
|
-
import {
|
|
11
|
+
import { WireForm } from "../services/wire-form.js";
|
|
12
12
|
export class RestoredEvent {
|
|
13
13
|
static event = Resources.restoredEvent;
|
|
14
14
|
static FIELDS = [Resources.identityField, Resources.checkpointField, Resources.beforeField];
|
|
@@ -24,8 +24,7 @@ export class RestoredEvent {
|
|
|
24
24
|
this.identity = identity;
|
|
25
25
|
}
|
|
26
26
|
static fromJson(value) {
|
|
27
|
-
const reader =
|
|
28
|
-
reader.refuseOtherFields(RestoredEvent.FIELDS);
|
|
27
|
+
const reader = WireForm.read(value, Resources.restoredEventModel, RestoredEvent.FIELDS);
|
|
29
28
|
return new RestoredEvent(reader.readString(Resources.identityField), reader.readString(Resources.checkpointField), reader.readString(Resources.beforeField));
|
|
30
29
|
}
|
|
31
30
|
toJson() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restored-event.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restored-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"restored-event.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/restored-event.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE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AI,CAAC,UAAU,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAC1I,CAAC;CACF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import { Resources } from "../resources.js";
|
|
9
|
-
import {
|
|
9
|
+
import { WireForm } from "../services/wire-form.js";
|
|
10
10
|
import { FolderUsage } from "./folder-usage.js";
|
|
11
11
|
export class StorageList {
|
|
12
12
|
static FIELDS = [Resources.foldersField];
|
|
@@ -15,9 +15,8 @@ export class StorageList {
|
|
|
15
15
|
this.folders = [...folders];
|
|
16
16
|
}
|
|
17
17
|
static fromJson(value) {
|
|
18
|
-
const reader =
|
|
19
|
-
reader.
|
|
20
|
-
return new StorageList(reader.readList(Resources.foldersField).map(t => FolderUsage.fromJson(t)));
|
|
18
|
+
const reader = WireForm.read(value, Resources.storageListModel, StorageList.FIELDS);
|
|
19
|
+
return new StorageList(WireForm.readArray(reader, Resources.foldersField).map(t => FolderUsage.fromJson(t)));
|
|
21
20
|
}
|
|
22
21
|
toJson() {
|
|
23
22
|
return { [Resources.foldersField]: this.folders.map(t => t.toJson()) };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-list.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/storage-list.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"storage-list.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/storage-list.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,WAAW;IACd,MAAM,CAAU,MAAM,GAAsB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC7D,OAAO,CAAyB;IAEhD,YAAmB,OAA+B;QAChD,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACpF,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/G,CAAC;IAEM,MAAM;QACX,OAAO,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
import { Resources } from "../resources.js";
|
|
9
|
-
import {
|
|
9
|
+
import { WireForm } from "../services/wire-form.js";
|
|
10
10
|
export class StorageRequest {
|
|
11
11
|
static method = Resources.storageMethod;
|
|
12
12
|
static fromJson(value) {
|
|
13
|
-
|
|
13
|
+
WireForm.read(value, Resources.storageRequestModel, []);
|
|
14
14
|
return new StorageRequest();
|
|
15
15
|
}
|
|
16
16
|
toJson() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/storage-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"storage-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/storage-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,MAAM,OAAO,cAAc;IAClB,MAAM,CAAU,MAAM,GAAW,SAAS,CAAC,aAAa,CAAC;IAEzD,MAAM,CAAC,QAAQ,CAAC,KAAc;QACnC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,cAAc,EAAE,CAAC;IAC9B,CAAC;IAEM,MAAM;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* This source code is licensed under the license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
8
9
|
import { InvalidRelativePathException } from "../exceptions/invalid-relative-path.exception.js";
|
|
9
10
|
import { UnreadCodeMismatchException } from "../exceptions/unread-code-mismatch.exception.js";
|
|
10
11
|
import { Resources } from "../resources.js";
|
|
11
|
-
import { JsonObjectReader } from "../services/json-object.reader.js";
|
|
12
12
|
import { RelativePath } from "../services/relative-path.js";
|
|
13
|
+
import { WireForm } from "../services/wire-form.js";
|
|
13
14
|
import { UnreadReason } from "./unread-reason.js";
|
|
14
15
|
export class UnreadPath {
|
|
15
16
|
static FIELDS = [Resources.pathField, Resources.reasonField, Resources.codeField];
|
|
@@ -19,16 +20,15 @@ export class UnreadPath {
|
|
|
19
20
|
constructor(path, reason, code) {
|
|
20
21
|
if (!RelativePath.isValid(path))
|
|
21
22
|
throw new InvalidRelativePathException(path);
|
|
22
|
-
if ((reason === UnreadReason.Unreadable) !== (code
|
|
23
|
+
if ((reason === UnreadReason.Unreadable) !== (!Object.isNull(code)))
|
|
23
24
|
throw new UnreadCodeMismatchException(reason);
|
|
24
25
|
this.path = path;
|
|
25
26
|
this.reason = reason;
|
|
26
27
|
this.code = code;
|
|
27
28
|
}
|
|
28
29
|
static fromJson(value) {
|
|
29
|
-
const reader =
|
|
30
|
-
reader.
|
|
31
|
-
return new UnreadPath(reader.readString(Resources.pathField), UnreadReason.fromJson(reader.read(Resources.reasonField)), reader.readStringOrNull(Resources.codeField));
|
|
30
|
+
const reader = WireForm.read(value, Resources.unreadPathModel, UnreadPath.FIELDS);
|
|
31
|
+
return new UnreadPath(reader.readString(Resources.pathField), UnreadReason.fromJson(reader.readValue(Resources.reasonField)), reader.readNullableString(Resources.codeField));
|
|
32
32
|
}
|
|
33
33
|
toJson() {
|
|
34
34
|
return { [Resources.pathField]: this.path, [Resources.reasonField]: this.reason.toJson(), [Resources.codeField]: this.code };
|