@noldova/checkpoints.protocol 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/package.json +4 -3
- package/src/api/index.d.ts +76 -511
- package/src/api/index.js +0 -11
- package/src/api/index.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 +3 -4
- package/src/models/capture-request.js.map +1 -1
- package/src/models/capture-result.js +4 -5
- 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 +3 -4
- package/src/models/change-side.js.map +1 -1
- package/src/models/change.js +6 -7
- 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 +3 -4
- package/src/models/checkpoint.js.map +1 -1
- package/src/models/compare-request.js +3 -4
- 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-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 +3 -4
- 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 +3 -4
- package/src/models/folder-usage.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/preview-request.js +3 -4
- package/src/models/preview-request.js.map +1 -1
- package/src/models/preview-result.js +4 -5
- package/src/models/preview-result.js.map +1 -1
- package/src/models/read-request.js +4 -5
- 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-held-up-event.js +3 -4
- package/src/models/restore-held-up-event.js.map +1 -1
- package/src/models/restore-plan.js +3 -4
- 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 +5 -6
- package/src/models/restore-result.js.map +1 -1
- package/src/models/restore-step.js +5 -6
- 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 +3 -4
- package/src/models/unread-path.js.map +1 -1
- package/src/resources.js +5 -30
- package/src/resources.js.map +1 -1
- package/src/services/scope-paths.js.map +1 -1
- package/src/services/wire-form.js +32 -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 +0 -19
- 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 +0 -19
- package/src/exceptions/missing-field.exception.js.map +0 -1
- package/src/exceptions/not-an-object.exception.js +0 -17
- 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
|
@@ -0,0 +1,32 @@
|
|
|
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 { JsonException, JsonReader } from "@noldova/context.json";
|
|
9
|
+
import { Resources } from "../resources.js";
|
|
10
|
+
export class WireForm {
|
|
11
|
+
static read(value, model, fields) {
|
|
12
|
+
const names = typeof value === "object" && value !== null ? Object.keys(value) : [];
|
|
13
|
+
const reader = JsonReader.fromValue(value, model);
|
|
14
|
+
const unknown = names.find(t => !fields.includes(t));
|
|
15
|
+
if (unknown !== undefined)
|
|
16
|
+
throw new JsonException(Resources.unknownField, Resources.formatFieldPath(reader.path, unknown));
|
|
17
|
+
return reader;
|
|
18
|
+
}
|
|
19
|
+
static readArray(reader, field) {
|
|
20
|
+
const value = reader.readValue(field);
|
|
21
|
+
if (!Array.isArray(value))
|
|
22
|
+
throw new JsonException(Resources.arrayExpected, Resources.formatFieldPath(reader.path, field));
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
static readNullableNumber(reader, field) {
|
|
26
|
+
return reader.readValue(field) === null ? null : reader.readNumber(field);
|
|
27
|
+
}
|
|
28
|
+
static readNullableStringArray(reader, field) {
|
|
29
|
+
return reader.readValue(field) === null ? null : reader.readStringArray(field);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=wire-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-form.js","sourceRoot":"","sources":["../../../../../src/noldova.check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C,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;IAEM,MAAM,CAAC,uBAAuB,CAAC,MAAkB,EAAE,KAAa;QACrE,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACjF,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotABooleanException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotABoolean(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-boolean.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-boolean.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-boolean.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAC9C,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAEjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotAListException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotAList(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-list.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-list.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-list.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAC3C,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAE9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotANumberOrNullException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotANumberOrNull(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-number-or-null.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-number-or-null.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-number-or-null.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,8BAA+B,SAAQ,iBAAiB;IACnD,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAEtD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotANumberException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotANumber(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-number.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-number.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-number.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAC7C,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAEhD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotAStringListException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotAStringList(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-string-list.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-string-list.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-string-list.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,4BAA6B,SAAQ,iBAAiB;IACjD,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAEpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotAStringOrNullException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotAStringOrNull(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-string-or-null.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-string-or-null.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-string-or-null.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,8BAA+B,SAAQ,iBAAiB;IACnD,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAEtD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class FieldNotAStringException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatNotAString(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=field-not-a-string.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-not-a-string.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/field-not-a-string.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAC7C,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAEhD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class MissingFieldException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatMissingField(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=missing-field.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"missing-field.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/missing-field.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAC1C,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAElD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class NotAnObjectException extends ProtocolException {
|
|
11
|
-
model;
|
|
12
|
-
constructor(model) {
|
|
13
|
-
super(Resources.formatNotAnObject(model));
|
|
14
|
-
this.model = model;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=not-an-object.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"not-an-object.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/not-an-object.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IACzC,KAAK,CAAS;IAE9B,YAAmB,KAAa;QAC9B,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;QAE1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
import { ProtocolException } from "./protocol.exception.js";
|
|
10
|
-
export class UnknownFieldException extends ProtocolException {
|
|
11
|
-
field;
|
|
12
|
-
model;
|
|
13
|
-
constructor(model, field) {
|
|
14
|
-
super(Resources.formatUnknownField(model, field));
|
|
15
|
-
this.field = field;
|
|
16
|
-
this.model = model;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=unknown-field.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-field.exception.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/exceptions/unknown-field.exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAC1C,KAAK,CAAS;IACd,KAAK,CAAS;IAE9B,YAAmB,KAAa,EAAE,KAAa;QAC7C,KAAK,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QAElD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,89 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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/json-object.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-object.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/types/json-object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/src/types/json-value.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-value.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/types/json-value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|